kicksdk-js 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/pkg/kicksdk.js ADDED
@@ -0,0 +1,2036 @@
1
+ /* @ts-self-types="./kicksdk.d.ts" */
2
+
3
+ /**
4
+ * Reconnect delays: 1 s doubling to 30 s, and a slower stage for terminal
5
+ * closes (`nextDelayFor`).
6
+ */
7
+ export class Backoff {
8
+ __destroy_into_raw() {
9
+ const ptr = this.__wbg_ptr;
10
+ this.__wbg_ptr = 0;
11
+ BackoffFinalization.unregister(this);
12
+ return ptr;
13
+ }
14
+ free() {
15
+ const ptr = this.__destroy_into_raw();
16
+ wasm.__wbg_backoff_free(ptr, 0);
17
+ }
18
+ /**
19
+ * From `initialMs`, doubling to `maxMs` (whole milliseconds).
20
+ * @param {number | null} [initial_ms]
21
+ * @param {number | null} [max_ms]
22
+ */
23
+ constructor(initial_ms, max_ms) {
24
+ try {
25
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
26
+ wasm.backoff_new(retptr, isLikeNone(initial_ms) ? 0 : addHeapObject(initial_ms), isLikeNone(max_ms) ? 0 : addHeapObject(max_ms));
27
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
28
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
29
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
30
+ if (r2) {
31
+ throw takeObject(r1);
32
+ }
33
+ this.__wbg_ptr = r0;
34
+ BackoffFinalization.register(this, this.__wbg_ptr, this);
35
+ return this;
36
+ } finally {
37
+ wasm.__wbindgen_add_to_stack_pointer(16);
38
+ }
39
+ }
40
+ /**
41
+ * The wait before reconnecting after a connection ended, ms.
42
+ * `retryAfterMs` is what the end asked for: a `close` action's
43
+ * `retry_after_ms`, `retryAfterMs(code)` for a socket's close code, or 0
44
+ * for a failure without a code. With 0, exactly `nextDelayJittered`.
45
+ * With more (a terminal close), at least that, doubling with each
46
+ * terminal close since `reset()` up to six times it (300000: 5, 10, 20,
47
+ * then 30 minutes), plus up to a quarter more by `random`. Reconnect
48
+ * with a new client id after a terminal close.
49
+ * @param {number} retry_after_ms
50
+ * @param {number} random
51
+ * @returns {number}
52
+ */
53
+ nextDelayFor(retry_after_ms, random) {
54
+ try {
55
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
56
+ wasm.backoff_nextDelayFor(retptr, this.__wbg_ptr, addHeapObject(retry_after_ms), addHeapObject(random));
57
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
58
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
59
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
60
+ if (r3) {
61
+ throw takeObject(r2);
62
+ }
63
+ return r0;
64
+ } finally {
65
+ wasm.__wbindgen_add_to_stack_pointer(16);
66
+ }
67
+ }
68
+ /**
69
+ * The next wait, ms, spread over [half of it, all of it] by `random`,
70
+ * drawn uniformly from [0, 1) (`Math.random()`), so that clients dropped
71
+ * together do not all come back together. Out of range is clamped, NaN
72
+ * taken as 0.
73
+ * @param {number} random
74
+ * @returns {number}
75
+ */
76
+ nextDelayJittered(random) {
77
+ try {
78
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
79
+ wasm.backoff_nextDelayJittered(retptr, this.__wbg_ptr, addHeapObject(random));
80
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
81
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
82
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
83
+ if (r3) {
84
+ throw takeObject(r2);
85
+ }
86
+ return r0;
87
+ } finally {
88
+ wasm.__wbindgen_add_to_stack_pointer(16);
89
+ }
90
+ }
91
+ /**
92
+ * The next wait, ms.
93
+ * @returns {number}
94
+ */
95
+ nextDelay() {
96
+ const ret = wasm.backoff_nextDelay(this.__wbg_ptr);
97
+ return ret;
98
+ }
99
+ /**
100
+ * The chat feed subscribed: back to the first wait, and the terminal
101
+ * streak ends.
102
+ */
103
+ reset() {
104
+ wasm.backoff_reset(this.__wbg_ptr);
105
+ }
106
+ }
107
+ if (Symbol.dispose) Backoff.prototype[Symbol.dispose] = Backoff.prototype.free;
108
+
109
+ /**
110
+ * One connection's protocol. Each method returns the actions to carry out.
111
+ * `now` is whole milliseconds from a clock that only goes forward
112
+ * (`Math.floor(performance.now())`, or `Date.now()`).
113
+ */
114
+ export class Session {
115
+ __destroy_into_raw() {
116
+ const ptr = this.__wbg_ptr;
117
+ this.__wbg_ptr = 0;
118
+ SessionFinalization.unregister(this);
119
+ return ptr;
120
+ }
121
+ free() {
122
+ const ptr = this.__destroy_into_raw();
123
+ wasm.__wbg_session_free(ptr, 0);
124
+ }
125
+ /**
126
+ * The socket closed.
127
+ * @returns {any}
128
+ */
129
+ closed() {
130
+ try {
131
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
132
+ wasm.session_closed(retptr, this.__wbg_ptr);
133
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
134
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
135
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
136
+ if (r2) {
137
+ throw takeObject(r1);
138
+ }
139
+ return takeObject(r0);
140
+ } finally {
141
+ wasm.__wbindgen_add_to_stack_pointer(16);
142
+ }
143
+ }
144
+ /**
145
+ * When to call `tick` next, in ms, or undefined.
146
+ * @returns {number | undefined}
147
+ */
148
+ deadline() {
149
+ try {
150
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
151
+ wasm.session_deadline(retptr, this.__wbg_ptr);
152
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
153
+ var r2 = getDataViewMemory0().getFloat64(retptr + 8 * 1, true);
154
+ return r0 === 0 ? undefined : r2;
155
+ } finally {
156
+ wasm.__wbindgen_add_to_stack_pointer(16);
157
+ }
158
+ }
159
+ /**
160
+ * Whether Kick accepted the connection.
161
+ * @returns {boolean}
162
+ */
163
+ isConnected() {
164
+ const ret = wasm.session_isConnected(this.__wbg_ptr);
165
+ return ret !== 0;
166
+ }
167
+ /**
168
+ * Whether a feed is subscribed.
169
+ * @param {string} channel
170
+ * @returns {boolean}
171
+ */
172
+ isSubscribed(channel) {
173
+ const ptr0 = passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
174
+ const len0 = WASM_VECTOR_LEN;
175
+ const ret = wasm.session_isSubscribed(this.__wbg_ptr, ptr0, len0);
176
+ return ret !== 0;
177
+ }
178
+ /**
179
+ * A session for these feeds.
180
+ * @param {string[]} channels
181
+ */
182
+ constructor(channels) {
183
+ const ptr0 = passArrayJsValueToWasm0(channels, wasm.__wbindgen_export);
184
+ const len0 = WASM_VECTOR_LEN;
185
+ const ret = wasm.session_new(ptr0, len0);
186
+ this.__wbg_ptr = ret;
187
+ SessionFinalization.register(this, this.__wbg_ptr, this);
188
+ return this;
189
+ }
190
+ /**
191
+ * The socket opened.
192
+ * @param {string} token
193
+ * @param {number} now
194
+ * @returns {any}
195
+ */
196
+ open(token, now) {
197
+ try {
198
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
199
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
200
+ const len0 = WASM_VECTOR_LEN;
201
+ wasm.session_open(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(now));
202
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
203
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
204
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
205
+ if (r2) {
206
+ throw takeObject(r1);
207
+ }
208
+ return takeObject(r0);
209
+ } finally {
210
+ wasm.__wbindgen_add_to_stack_pointer(16);
211
+ }
212
+ }
213
+ /**
214
+ * A text frame arrived.
215
+ * @param {string} text
216
+ * @param {number} now
217
+ * @returns {any}
218
+ */
219
+ receive(text, now) {
220
+ try {
221
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
222
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
223
+ const len0 = WASM_VECTOR_LEN;
224
+ wasm.session_receive(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(now));
225
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
226
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
227
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
228
+ if (r2) {
229
+ throw takeObject(r1);
230
+ }
231
+ return takeObject(r0);
232
+ } finally {
233
+ wasm.__wbindgen_add_to_stack_pointer(16);
234
+ }
235
+ }
236
+ /**
237
+ * A new token, after a `refresh_token` action.
238
+ * @param {string} token
239
+ * @param {number} now
240
+ * @returns {any}
241
+ */
242
+ refresh(token, now) {
243
+ try {
244
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
245
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ wasm.session_refresh(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(now));
248
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
249
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
250
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
251
+ if (r2) {
252
+ throw takeObject(r1);
253
+ }
254
+ return takeObject(r0);
255
+ } finally {
256
+ wasm.__wbindgen_add_to_stack_pointer(16);
257
+ }
258
+ }
259
+ /**
260
+ * The clock reached `deadline()`.
261
+ * @param {number} now
262
+ * @returns {any}
263
+ */
264
+ tick(now) {
265
+ try {
266
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
267
+ wasm.session_tick(retptr, this.__wbg_ptr, addHeapObject(now));
268
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
269
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
270
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
271
+ if (r2) {
272
+ throw takeObject(r1);
273
+ }
274
+ return takeObject(r0);
275
+ } finally {
276
+ wasm.__wbindgen_add_to_stack_pointer(16);
277
+ }
278
+ }
279
+ }
280
+ if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
281
+
282
+ /**
283
+ * Kick's webhook key, read once: `new WebhookPublicKey(pem)`, then
284
+ * `key.verify(headers, body, options?)` for each delivery.
285
+ */
286
+ export class WebhookPublicKey {
287
+ __destroy_into_raw() {
288
+ const ptr = this.__wbg_ptr;
289
+ this.__wbg_ptr = 0;
290
+ WebhookPublicKeyFinalization.unregister(this);
291
+ return ptr;
292
+ }
293
+ free() {
294
+ const ptr = this.__destroy_into_raw();
295
+ wasm.__wbg_webhookpublickey_free(ptr, 0);
296
+ }
297
+ /**
298
+ * Reads a PEM key (`BEGIN PUBLIC KEY`, as Kick serves it, or
299
+ * `BEGIN RSA PUBLIC KEY`); throws if it is not one.
300
+ * @param {string} pem
301
+ */
302
+ constructor(pem) {
303
+ try {
304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
305
+ const ptr0 = passStringToWasm0(pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
306
+ const len0 = WASM_VECTOR_LEN;
307
+ wasm.webhookpublickey_new(retptr, ptr0, len0);
308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
310
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
311
+ if (r2) {
312
+ throw takeObject(r1);
313
+ }
314
+ this.__wbg_ptr = r0;
315
+ WebhookPublicKeyFinalization.register(this, this.__wbg_ptr, this);
316
+ return this;
317
+ } finally {
318
+ wasm.__wbindgen_add_to_stack_pointer(16);
319
+ }
320
+ }
321
+ /**
322
+ * `verifyWebhook`, with this key.
323
+ * @param {WebhookHeaders} headers
324
+ * @param {string | Uint8Array | ArrayBuffer} body
325
+ * @param {VerifyOptions | null} [options]
326
+ * @returns {VerifiedWebhook}
327
+ */
328
+ verify(headers, body, options) {
329
+ try {
330
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
331
+ wasm.webhookpublickey_verify(retptr, this.__wbg_ptr, addHeapObject(headers), addHeapObject(body), isLikeNone(options) ? 0 : addHeapObject(options));
332
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
333
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
334
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
335
+ if (r2) {
336
+ throw takeObject(r1);
337
+ }
338
+ return takeObject(r0);
339
+ } finally {
340
+ wasm.__wbindgen_add_to_stack_pointer(16);
341
+ }
342
+ }
343
+ }
344
+ if (Symbol.dispose) WebhookPublicKey.prototype[Symbol.dispose] = WebhookPublicKey.prototype.free;
345
+
346
+ /**
347
+ * An app token request (client credentials).
348
+ * @param {string} client_id
349
+ * @param {string} client_secret
350
+ * @param {Endpoints | null} [endpoints]
351
+ * @returns {any}
352
+ */
353
+ export function appTokenRequest(client_id, client_secret, endpoints) {
354
+ try {
355
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ptr1 = passStringToWasm0(client_secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
+ const len1 = WASM_VECTOR_LEN;
360
+ wasm.appTokenRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
361
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
362
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
363
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
364
+ if (r2) {
365
+ throw takeObject(r1);
366
+ }
367
+ return takeObject(r0);
368
+ } finally {
369
+ wasm.__wbindgen_add_to_stack_pointer(16);
370
+ }
371
+ }
372
+
373
+ /**
374
+ * Bans a user for good.
375
+ * @param {string} session
376
+ * @param {string} channel_slug
377
+ * @param {string} username
378
+ * @param {Endpoints | null} [endpoints]
379
+ * @returns {any}
380
+ */
381
+ export function banRequest(session, channel_slug, username, endpoints) {
382
+ try {
383
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
384
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
385
+ const len0 = WASM_VECTOR_LEN;
386
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
387
+ const len1 = WASM_VECTOR_LEN;
388
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
389
+ const len2 = WASM_VECTOR_LEN;
390
+ wasm.banRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
391
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
392
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
393
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
394
+ if (r2) {
395
+ throw takeObject(r1);
396
+ }
397
+ return takeObject(r0);
398
+ } finally {
399
+ wasm.__wbindgen_add_to_stack_pointer(16);
400
+ }
401
+ }
402
+
403
+ /**
404
+ * A channel by slug (`kick.com/api/v2`): chatroom id, followers, live state.
405
+ * @param {string} slug
406
+ * @param {Endpoints | null} [endpoints]
407
+ * @returns {any}
408
+ */
409
+ export function channelRequest(slug, endpoints) {
410
+ try {
411
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
412
+ const ptr0 = passStringToWasm0(slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
413
+ const len0 = WASM_VECTOR_LEN;
414
+ wasm.channelRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
415
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
416
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
417
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
418
+ if (r2) {
419
+ throw takeObject(r1);
420
+ }
421
+ return takeObject(r0);
422
+ } finally {
423
+ wasm.__wbindgen_add_to_stack_pointer(16);
424
+ }
425
+ }
426
+
427
+ /**
428
+ * A user as a channel sees them.
429
+ * @param {string} channel_slug
430
+ * @param {string} username
431
+ * @param {Endpoints | null} [endpoints]
432
+ * @returns {any}
433
+ */
434
+ export function channelUserRequest(channel_slug, username, endpoints) {
435
+ try {
436
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
437
+ const ptr0 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
438
+ const len0 = WASM_VECTOR_LEN;
439
+ const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
440
+ const len1 = WASM_VECTOR_LEN;
441
+ wasm.channelUserRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
442
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
443
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
444
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
445
+ if (r2) {
446
+ throw takeObject(r1);
447
+ }
448
+ return takeObject(r0);
449
+ } finally {
450
+ wasm.__wbindgen_add_to_stack_pointer(16);
451
+ }
452
+ }
453
+
454
+ /**
455
+ * `/channels` for up to 50 user ids.
456
+ * @param {string} token
457
+ * @param {readonly number[]} user_ids
458
+ * @param {Endpoints | null} [endpoints]
459
+ * @returns {any}
460
+ */
461
+ export function channelsByIdsRequest(token, user_ids, endpoints) {
462
+ try {
463
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
464
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
465
+ const len0 = WASM_VECTOR_LEN;
466
+ wasm.channelsByIdsRequest(retptr, ptr0, len0, addHeapObject(user_ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
467
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
468
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
469
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
470
+ if (r2) {
471
+ throw takeObject(r1);
472
+ }
473
+ return takeObject(r0);
474
+ } finally {
475
+ wasm.__wbindgen_add_to_stack_pointer(16);
476
+ }
477
+ }
478
+
479
+ /**
480
+ * `/channels` for up to 50 slugs (one unknown slug fails them all).
481
+ * @param {string} token
482
+ * @param {string[]} slugs
483
+ * @param {Endpoints | null} [endpoints]
484
+ * @returns {any}
485
+ */
486
+ export function channelsBySlugsRequest(token, slugs, endpoints) {
487
+ try {
488
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
489
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
490
+ const len0 = WASM_VECTOR_LEN;
491
+ const ptr1 = passArrayJsValueToWasm0(slugs, wasm.__wbindgen_export);
492
+ const len1 = WASM_VECTOR_LEN;
493
+ wasm.channelsBySlugsRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
494
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
495
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
496
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
497
+ if (r2) {
498
+ throw takeObject(r1);
499
+ }
500
+ return takeObject(r0);
501
+ } finally {
502
+ wasm.__wbindgen_add_to_stack_pointer(16);
503
+ }
504
+ }
505
+
506
+ /**
507
+ * The feeds for one chat, the chat feed first.
508
+ * @param {number} chatroom_id
509
+ * @param {number | null} [channel_id]
510
+ * @returns {string[]}
511
+ */
512
+ export function chatChannels(chatroom_id, channel_id) {
513
+ try {
514
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
515
+ wasm.chatChannels(retptr, addHeapObject(chatroom_id), isLikeNone(channel_id) ? 0 : addHeapObject(channel_id));
516
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
517
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
518
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
519
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
520
+ if (r3) {
521
+ throw takeObject(r2);
522
+ }
523
+ var v1 = getArrayJsValueFromWasm0(r0, r1);
524
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
525
+ return v1;
526
+ } finally {
527
+ wasm.__wbindgen_add_to_stack_pointer(16);
528
+ }
529
+ }
530
+
531
+ /**
532
+ * Where a channel's chat is served.
533
+ * @param {number} channel_id
534
+ * @param {string} client_id
535
+ * @param {Endpoints | null} [endpoints]
536
+ * @returns {any}
537
+ */
538
+ export function chatConnectionRequest(channel_id, client_id, endpoints) {
539
+ try {
540
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
541
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
542
+ const len0 = WASM_VECTOR_LEN;
543
+ wasm.chatConnectionRequest(retptr, addHeapObject(channel_id), ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
544
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
545
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
546
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
547
+ if (r2) {
548
+ throw takeObject(r1);
549
+ }
550
+ return takeObject(r0);
551
+ } finally {
552
+ wasm.__wbindgen_add_to_stack_pointer(16);
553
+ }
554
+ }
555
+
556
+ /**
557
+ * Where Kick's realtime is served in general.
558
+ * @param {string} client_id
559
+ * @param {Endpoints | null} [endpoints]
560
+ * @returns {any}
561
+ */
562
+ export function connectionRequest(client_id, endpoints) {
563
+ try {
564
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
565
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
566
+ const len0 = WASM_VECTOR_LEN;
567
+ wasm.connectionRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
568
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
569
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
570
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
571
+ if (r2) {
572
+ throw takeObject(r1);
573
+ }
574
+ return takeObject(r0);
575
+ } finally {
576
+ wasm.__wbindgen_add_to_stack_pointer(16);
577
+ }
578
+ }
579
+
580
+ /**
581
+ * Deletes a message.
582
+ * @param {string} session
583
+ * @param {number} chatroom_id
584
+ * @param {string} message_id
585
+ * @param {Endpoints | null} [endpoints]
586
+ * @returns {any}
587
+ */
588
+ export function deleteMessageRequest(session, chatroom_id, message_id, endpoints) {
589
+ try {
590
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
591
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
592
+ const len0 = WASM_VECTOR_LEN;
593
+ const ptr1 = passStringToWasm0(message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
594
+ const len1 = WASM_VECTOR_LEN;
595
+ wasm.deleteMessageRequest(retptr, ptr0, len0, addHeapObject(chatroom_id), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
596
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
597
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
598
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
599
+ if (r2) {
600
+ throw takeObject(r1);
601
+ }
602
+ return takeObject(r0);
603
+ } finally {
604
+ wasm.__wbindgen_add_to_stack_pointer(16);
605
+ }
606
+ }
607
+
608
+ /**
609
+ * An emote's image URL.
610
+ * @param {string} id
611
+ * @returns {string}
612
+ */
613
+ export function emoteUrl(id) {
614
+ let deferred3_0;
615
+ let deferred3_1;
616
+ try {
617
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
618
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
619
+ const len0 = WASM_VECTOR_LEN;
620
+ wasm.emoteUrl(retptr, ptr0, len0);
621
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
622
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
623
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
624
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
625
+ var ptr2 = r0;
626
+ var len2 = r1;
627
+ if (r3) {
628
+ ptr2 = 0; len2 = 0;
629
+ throw takeObject(r2);
630
+ }
631
+ deferred3_0 = ptr2;
632
+ deferred3_1 = len2;
633
+ return getStringFromWasm0(ptr2, len2);
634
+ } finally {
635
+ wasm.__wbindgen_add_to_stack_pointer(16);
636
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
637
+ }
638
+ }
639
+
640
+ /**
641
+ * Recent chat and the pin, by channel id.
642
+ * @param {number} channel_id
643
+ * @param {Endpoints | null} [endpoints]
644
+ * @returns {any}
645
+ */
646
+ export function historyRequest(channel_id, endpoints) {
647
+ try {
648
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
649
+ wasm.historyRequest(retptr, addHeapObject(channel_id), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
650
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
651
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
652
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
653
+ if (r2) {
654
+ throw takeObject(r1);
655
+ }
656
+ return takeObject(r0);
657
+ } finally {
658
+ wasm.__wbindgen_add_to_stack_pointer(16);
659
+ }
660
+ }
661
+
662
+ /**
663
+ * `/livestreams` for any number of user ids: one request per 50.
664
+ * @param {string} token
665
+ * @param {readonly number[]} user_ids
666
+ * @param {Endpoints | null} [endpoints]
667
+ * @returns {any}
668
+ */
669
+ export function livestreamsRequests(token, user_ids, endpoints) {
670
+ try {
671
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
672
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
673
+ const len0 = WASM_VECTOR_LEN;
674
+ wasm.livestreamsRequests(retptr, ptr0, len0, addHeapObject(user_ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
675
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
676
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
677
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
678
+ if (r2) {
679
+ throw takeObject(r1);
680
+ }
681
+ return takeObject(r0);
682
+ } finally {
683
+ wasm.__wbindgen_add_to_stack_pointer(16);
684
+ }
685
+ }
686
+
687
+ /**
688
+ * The signed-in viewer's standing on a channel.
689
+ * @param {string} session
690
+ * @param {string} channel_slug
691
+ * @param {Endpoints | null} [endpoints]
692
+ * @returns {any}
693
+ */
694
+ export function meRequest(session, channel_slug, endpoints) {
695
+ try {
696
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
697
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
698
+ const len0 = WASM_VECTOR_LEN;
699
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
700
+ const len1 = WASM_VECTOR_LEN;
701
+ wasm.meRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
702
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
703
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
704
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
705
+ if (r2) {
706
+ throw takeObject(r1);
707
+ }
708
+ return takeObject(r0);
709
+ } finally {
710
+ wasm.__wbindgen_add_to_stack_pointer(16);
711
+ }
712
+ }
713
+
714
+ /**
715
+ * Whether an acting call worked; throws with `status` if not.
716
+ * @param {number} status
717
+ * @param {string} body
718
+ */
719
+ export function parseAction(status, body) {
720
+ try {
721
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
722
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
723
+ const len0 = WASM_VECTOR_LEN;
724
+ wasm.parseAction(retptr, addHeapObject(status), ptr0, len0);
725
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
726
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
727
+ if (r1) {
728
+ throw takeObject(r0);
729
+ }
730
+ } finally {
731
+ wasm.__wbindgen_add_to_stack_pointer(16);
732
+ }
733
+ }
734
+
735
+ /**
736
+ * Reads an app token answer.
737
+ * @param {number} status
738
+ * @param {string} body
739
+ * @returns {any}
740
+ */
741
+ export function parseAppToken(status, body) {
742
+ try {
743
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
744
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
745
+ const len0 = WASM_VECTOR_LEN;
746
+ wasm.parseAppToken(retptr, addHeapObject(status), ptr0, len0);
747
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
748
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
749
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
750
+ if (r2) {
751
+ throw takeObject(r1);
752
+ }
753
+ return takeObject(r0);
754
+ } finally {
755
+ wasm.__wbindgen_add_to_stack_pointer(16);
756
+ }
757
+ }
758
+
759
+ /**
760
+ * Reads a website channel answer.
761
+ * @param {number} status
762
+ * @param {string} body
763
+ * @returns {any}
764
+ */
765
+ export function parseChannel(status, body) {
766
+ try {
767
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
768
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
769
+ const len0 = WASM_VECTOR_LEN;
770
+ wasm.parseChannel(retptr, addHeapObject(status), ptr0, len0);
771
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
772
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
773
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
774
+ if (r2) {
775
+ throw takeObject(r1);
776
+ }
777
+ return takeObject(r0);
778
+ } finally {
779
+ wasm.__wbindgen_add_to_stack_pointer(16);
780
+ }
781
+ }
782
+
783
+ /**
784
+ * Reads a channel user answer.
785
+ * @param {number} status
786
+ * @param {string} body
787
+ * @returns {any}
788
+ */
789
+ export function parseChannelUser(status, body) {
790
+ try {
791
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
792
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
793
+ const len0 = WASM_VECTOR_LEN;
794
+ wasm.parseChannelUser(retptr, addHeapObject(status), ptr0, len0);
795
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
796
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
797
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
798
+ if (r2) {
799
+ throw takeObject(r1);
800
+ }
801
+ return takeObject(r0);
802
+ } finally {
803
+ wasm.__wbindgen_add_to_stack_pointer(16);
804
+ }
805
+ }
806
+
807
+ /**
808
+ * Reads a `/channels` answer.
809
+ * @param {number} status
810
+ * @param {string} body
811
+ * @returns {any}
812
+ */
813
+ export function parseChannels(status, body) {
814
+ try {
815
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
816
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
817
+ const len0 = WASM_VECTOR_LEN;
818
+ wasm.parseChannels(retptr, addHeapObject(status), ptr0, len0);
819
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
820
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
821
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
822
+ if (r2) {
823
+ throw takeObject(r1);
824
+ }
825
+ return takeObject(r0);
826
+ } finally {
827
+ wasm.__wbindgen_add_to_stack_pointer(16);
828
+ }
829
+ }
830
+
831
+ /**
832
+ * Reads either connection answer: `[{provider, url}…]`.
833
+ * @param {number} status
834
+ * @param {string} body
835
+ * @returns {any}
836
+ */
837
+ export function parseConnection(status, body) {
838
+ try {
839
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
840
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
841
+ const len0 = WASM_VECTOR_LEN;
842
+ wasm.parseConnection(retptr, addHeapObject(status), ptr0, len0);
843
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
844
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
845
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
846
+ if (r2) {
847
+ throw takeObject(r1);
848
+ }
849
+ return takeObject(r0);
850
+ } finally {
851
+ wasm.__wbindgen_add_to_stack_pointer(16);
852
+ }
853
+ }
854
+
855
+ /**
856
+ * A message's text and emotes.
857
+ * @param {string} text
858
+ * @param {boolean} combine
859
+ * @returns {any}
860
+ */
861
+ export function parseContent(text, combine) {
862
+ try {
863
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
864
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
865
+ const len0 = WASM_VECTOR_LEN;
866
+ wasm.parseContent(retptr, ptr0, len0, addHeapObject(combine));
867
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
868
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
869
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
870
+ if (r2) {
871
+ throw takeObject(r1);
872
+ }
873
+ return takeObject(r0);
874
+ } finally {
875
+ wasm.__wbindgen_add_to_stack_pointer(16);
876
+ }
877
+ }
878
+
879
+ /**
880
+ * A feed event, typed: `{type: "chat_message", …}`. `data` as Kick sent it.
881
+ * @param {string} name
882
+ * @param {any} data
883
+ * @returns {any}
884
+ */
885
+ export function parseEvent(name, data) {
886
+ try {
887
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
888
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
889
+ const len0 = WASM_VECTOR_LEN;
890
+ wasm.parseEvent(retptr, ptr0, len0, addHeapObject(data));
891
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
892
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
893
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
894
+ if (r2) {
895
+ throw takeObject(r1);
896
+ }
897
+ return takeObject(r0);
898
+ } finally {
899
+ wasm.__wbindgen_add_to_stack_pointer(16);
900
+ }
901
+ }
902
+
903
+ /**
904
+ * Reads a history answer: `{messages, pinned}`.
905
+ * @param {number} status
906
+ * @param {string} body
907
+ * @returns {any}
908
+ */
909
+ export function parseHistory(status, body) {
910
+ try {
911
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
912
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
913
+ const len0 = WASM_VECTOR_LEN;
914
+ wasm.parseHistory(retptr, addHeapObject(status), ptr0, len0);
915
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
916
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
917
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
918
+ if (r2) {
919
+ throw takeObject(r1);
920
+ }
921
+ return takeObject(r0);
922
+ } finally {
923
+ wasm.__wbindgen_add_to_stack_pointer(16);
924
+ }
925
+ }
926
+
927
+ /**
928
+ * Reads a `/livestreams` answer.
929
+ * @param {number} status
930
+ * @param {string} body
931
+ * @returns {any}
932
+ */
933
+ export function parseLivestreams(status, body) {
934
+ try {
935
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
936
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
937
+ const len0 = WASM_VECTOR_LEN;
938
+ wasm.parseLivestreams(retptr, addHeapObject(status), ptr0, len0);
939
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
940
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
941
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
942
+ if (r2) {
943
+ throw takeObject(r1);
944
+ }
945
+ return takeObject(r0);
946
+ } finally {
947
+ wasm.__wbindgen_add_to_stack_pointer(16);
948
+ }
949
+ }
950
+
951
+ /**
952
+ * Reads a `me` answer.
953
+ * @param {number} status
954
+ * @param {string} body
955
+ * @returns {any}
956
+ */
957
+ export function parseMe(status, body) {
958
+ try {
959
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
960
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
961
+ const len0 = WASM_VECTOR_LEN;
962
+ wasm.parseMe(retptr, addHeapObject(status), ptr0, len0);
963
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
964
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
965
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
966
+ if (r2) {
967
+ throw takeObject(r1);
968
+ }
969
+ return takeObject(r0);
970
+ } finally {
971
+ wasm.__wbindgen_add_to_stack_pointer(16);
972
+ }
973
+ }
974
+
975
+ /**
976
+ * The PEM from a public key answer.
977
+ * @param {number} status
978
+ * @param {string} body
979
+ * @returns {string}
980
+ */
981
+ export function parsePublicKey(status, body) {
982
+ let deferred3_0;
983
+ let deferred3_1;
984
+ try {
985
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
986
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
987
+ const len0 = WASM_VECTOR_LEN;
988
+ wasm.parsePublicKey(retptr, addHeapObject(status), ptr0, len0);
989
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
990
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
991
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
992
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
993
+ var ptr2 = r0;
994
+ var len2 = r1;
995
+ if (r3) {
996
+ ptr2 = 0; len2 = 0;
997
+ throw takeObject(r2);
998
+ }
999
+ deferred3_0 = ptr2;
1000
+ deferred3_1 = len2;
1001
+ return getStringFromWasm0(ptr2, len2);
1002
+ } finally {
1003
+ wasm.__wbindgen_add_to_stack_pointer(16);
1004
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1005
+ }
1006
+ }
1007
+
1008
+ /**
1009
+ * Reads a subscriptions answer.
1010
+ * @param {number} status
1011
+ * @param {string} body
1012
+ * @returns {any}
1013
+ */
1014
+ export function parseSubscriptions(status, body) {
1015
+ try {
1016
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1017
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1018
+ const len0 = WASM_VECTOR_LEN;
1019
+ wasm.parseSubscriptions(retptr, addHeapObject(status), ptr0, len0);
1020
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1021
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1022
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1023
+ if (r2) {
1024
+ throw takeObject(r1);
1025
+ }
1026
+ return takeObject(r0);
1027
+ } finally {
1028
+ wasm.__wbindgen_add_to_stack_pointer(16);
1029
+ }
1030
+ }
1031
+
1032
+ /**
1033
+ * The token from a token answer.
1034
+ * @param {number} status
1035
+ * @param {string} body
1036
+ * @returns {string}
1037
+ */
1038
+ export function parseToken(status, body) {
1039
+ let deferred3_0;
1040
+ let deferred3_1;
1041
+ try {
1042
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1043
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1044
+ const len0 = WASM_VECTOR_LEN;
1045
+ wasm.parseToken(retptr, addHeapObject(status), ptr0, len0);
1046
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1047
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1048
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1049
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1050
+ var ptr2 = r0;
1051
+ var len2 = r1;
1052
+ if (r3) {
1053
+ ptr2 = 0; len2 = 0;
1054
+ throw takeObject(r2);
1055
+ }
1056
+ deferred3_0 = ptr2;
1057
+ deferred3_1 = len2;
1058
+ return getStringFromWasm0(ptr2, len2);
1059
+ } finally {
1060
+ wasm.__wbindgen_add_to_stack_pointer(16);
1061
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1062
+ }
1063
+ }
1064
+
1065
+ /**
1066
+ * Reads a delivery's body by its type header, without checking anything.
1067
+ * Throws when the body is not that type's shape. `body` is text or bytes.
1068
+ * @param {string} event_type
1069
+ * @param {string | Uint8Array | ArrayBuffer} body
1070
+ * @returns {any}
1071
+ */
1072
+ export function parseWebhook(event_type, body) {
1073
+ try {
1074
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1075
+ const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1076
+ const len0 = WASM_VECTOR_LEN;
1077
+ wasm.parseWebhook(retptr, ptr0, len0, addHeapObject(body));
1078
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1079
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1080
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1081
+ if (r2) {
1082
+ throw takeObject(r1);
1083
+ }
1084
+ return takeObject(r0);
1085
+ } finally {
1086
+ wasm.__wbindgen_add_to_stack_pointer(16);
1087
+ }
1088
+ }
1089
+
1090
+ /**
1091
+ * Pins a message (the feed's data for it, whole) for 1 to 10080 minutes.
1092
+ * @param {string} session
1093
+ * @param {string} channel_slug
1094
+ * @param {any} message
1095
+ * @param {number} minutes
1096
+ * @param {Endpoints | null} [endpoints]
1097
+ * @returns {any}
1098
+ */
1099
+ export function pinRequest(session, channel_slug, message, minutes, endpoints) {
1100
+ try {
1101
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1102
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1103
+ const len0 = WASM_VECTOR_LEN;
1104
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1105
+ const len1 = WASM_VECTOR_LEN;
1106
+ wasm.pinRequest(retptr, ptr0, len0, ptr1, len1, addHeapObject(message), addHeapObject(minutes), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1107
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1108
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1109
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1110
+ if (r2) {
1111
+ throw takeObject(r1);
1112
+ }
1113
+ return takeObject(r0);
1114
+ } finally {
1115
+ wasm.__wbindgen_add_to_stack_pointer(16);
1116
+ }
1117
+ }
1118
+
1119
+ /**
1120
+ * The webhook signing key request.
1121
+ * @param {Endpoints | null} [endpoints]
1122
+ * @returns {any}
1123
+ */
1124
+ export function publicKeyRequest(endpoints) {
1125
+ try {
1126
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1127
+ wasm.publicKeyRequest(retptr, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1128
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1129
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1130
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1131
+ if (r2) {
1132
+ throw takeObject(r1);
1133
+ }
1134
+ return takeObject(r0);
1135
+ } finally {
1136
+ wasm.__wbindgen_add_to_stack_pointer(16);
1137
+ }
1138
+ }
1139
+
1140
+ /**
1141
+ * The least to wait, ms, before reconnecting after the socket closed with
1142
+ * this code: 300000 (5 minutes) for Kick's terminal codes (3500-3999 and
1143
+ * 4500-4999: a bad token, a ban, a refused request), then reconnect with a
1144
+ * new client id; 0, the ordinary backoff, for the rest (1006, a network
1145
+ * drop, among them).
1146
+ * @param {number} code
1147
+ * @returns {number}
1148
+ */
1149
+ export function retryAfterMs(code) {
1150
+ try {
1151
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1152
+ wasm.retryAfterMs(retptr, addHeapObject(code));
1153
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
1154
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1155
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1156
+ if (r3) {
1157
+ throw takeObject(r2);
1158
+ }
1159
+ return r0;
1160
+ } finally {
1161
+ wasm.__wbindgen_add_to_stack_pointer(16);
1162
+ }
1163
+ }
1164
+
1165
+ /**
1166
+ * Sends a message, or a reply when `replyTo` is
1167
+ * `{message_id, content, sender_id, sender_username}`.
1168
+ * @param {string} session
1169
+ * @param {number} chatroom_id
1170
+ * @param {string} text
1171
+ * @param {string} message_ref
1172
+ * @param {ReplyTo | null} [reply_to]
1173
+ * @param {Endpoints | null} [endpoints]
1174
+ * @returns {any}
1175
+ */
1176
+ export function sendRequest(session, chatroom_id, text, message_ref, reply_to, endpoints) {
1177
+ try {
1178
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1179
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1180
+ const len0 = WASM_VECTOR_LEN;
1181
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1182
+ const len1 = WASM_VECTOR_LEN;
1183
+ const ptr2 = passStringToWasm0(message_ref, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1184
+ const len2 = WASM_VECTOR_LEN;
1185
+ wasm.sendRequest(retptr, ptr0, len0, addHeapObject(chatroom_id), ptr1, len1, ptr2, len2, isLikeNone(reply_to) ? 0 : addHeapObject(reply_to), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1186
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1187
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1188
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1189
+ if (r2) {
1190
+ throw takeObject(r1);
1191
+ }
1192
+ return takeObject(r0);
1193
+ } finally {
1194
+ wasm.__wbindgen_add_to_stack_pointer(16);
1195
+ }
1196
+ }
1197
+
1198
+ /**
1199
+ * Subscribes the app to webhook `events` (`[{name, version?}]`, version 1
1200
+ * when left out) for one channel.
1201
+ * @param {string} token
1202
+ * @param {number} broadcaster_user_id
1203
+ * @param {ReadonlyArray<{ name: string; version?: number }>} events
1204
+ * @param {Endpoints | null} [endpoints]
1205
+ * @returns {any}
1206
+ */
1207
+ export function subscribeRequest(token, broadcaster_user_id, events, endpoints) {
1208
+ try {
1209
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1210
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1211
+ const len0 = WASM_VECTOR_LEN;
1212
+ wasm.subscribeRequest(retptr, ptr0, len0, addHeapObject(broadcaster_user_id), addHeapObject(events), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1213
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1214
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1215
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1216
+ if (r2) {
1217
+ throw takeObject(r1);
1218
+ }
1219
+ return takeObject(r0);
1220
+ } finally {
1221
+ wasm.__wbindgen_add_to_stack_pointer(16);
1222
+ }
1223
+ }
1224
+
1225
+ /**
1226
+ * Every webhook subscription the app has.
1227
+ * @param {string} token
1228
+ * @param {Endpoints | null} [endpoints]
1229
+ * @returns {any}
1230
+ */
1231
+ export function subscriptionsRequest(token, endpoints) {
1232
+ try {
1233
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1234
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1235
+ const len0 = WASM_VECTOR_LEN;
1236
+ wasm.subscriptionsRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1237
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1238
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1239
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1240
+ if (r2) {
1241
+ throw takeObject(r1);
1242
+ }
1243
+ return takeObject(r0);
1244
+ } finally {
1245
+ wasm.__wbindgen_add_to_stack_pointer(16);
1246
+ }
1247
+ }
1248
+
1249
+ /**
1250
+ * Times a user out for 1 to 10080 minutes.
1251
+ * @param {string} session
1252
+ * @param {string} channel_slug
1253
+ * @param {string} username
1254
+ * @param {number} minutes
1255
+ * @param {Endpoints | null} [endpoints]
1256
+ * @returns {any}
1257
+ */
1258
+ export function timeoutRequest(session, channel_slug, username, minutes, endpoints) {
1259
+ try {
1260
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1261
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1262
+ const len0 = WASM_VECTOR_LEN;
1263
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1264
+ const len1 = WASM_VECTOR_LEN;
1265
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1266
+ const len2 = WASM_VECTOR_LEN;
1267
+ wasm.timeoutRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(minutes), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1268
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1269
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1270
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1271
+ if (r2) {
1272
+ throw takeObject(r1);
1273
+ }
1274
+ return takeObject(r0);
1275
+ } finally {
1276
+ wasm.__wbindgen_add_to_stack_pointer(16);
1277
+ }
1278
+ }
1279
+
1280
+ /**
1281
+ * A guest token request for `clientId`.
1282
+ * @param {string} client_id
1283
+ * @param {Endpoints | null} [endpoints]
1284
+ * @returns {any}
1285
+ */
1286
+ export function tokenRequest(client_id, endpoints) {
1287
+ try {
1288
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1289
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1290
+ const len0 = WASM_VECTOR_LEN;
1291
+ wasm.tokenRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1292
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1293
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1294
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1295
+ if (r2) {
1296
+ throw takeObject(r1);
1297
+ }
1298
+ return takeObject(r0);
1299
+ } finally {
1300
+ wasm.__wbindgen_add_to_stack_pointer(16);
1301
+ }
1302
+ }
1303
+
1304
+ /**
1305
+ * The top live streams, overall or in a category or language: 1 to 100
1306
+ * (100 by default). `sort` is `"viewer_count"` (the default) or
1307
+ * `"started_at"`.
1308
+ * @param {string} token
1309
+ * @param {number | null} [category_id]
1310
+ * @param {string | null} [language]
1311
+ * @param {'viewer_count' | 'started_at' | null} [sort]
1312
+ * @param {number | null} [limit]
1313
+ * @param {Endpoints | null} [endpoints]
1314
+ * @returns {any}
1315
+ */
1316
+ export function topLivestreamsRequest(token, category_id, language, sort, limit, endpoints) {
1317
+ try {
1318
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1319
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1320
+ const len0 = WASM_VECTOR_LEN;
1321
+ var ptr1 = isLikeNone(language) ? 0 : passStringToWasm0(language, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1322
+ var len1 = WASM_VECTOR_LEN;
1323
+ wasm.topLivestreamsRequest(retptr, ptr0, len0, isLikeNone(category_id) ? 0 : addHeapObject(category_id), ptr1, len1, isLikeNone(sort) ? 0 : addHeapObject(sort), isLikeNone(limit) ? 0 : addHeapObject(limit), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1324
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1325
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1326
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1327
+ if (r2) {
1328
+ throw takeObject(r1);
1329
+ }
1330
+ return takeObject(r0);
1331
+ } finally {
1332
+ wasm.__wbindgen_add_to_stack_pointer(16);
1333
+ }
1334
+ }
1335
+
1336
+ /**
1337
+ * Lifts a ban or timeout.
1338
+ * @param {string} session
1339
+ * @param {string} channel_slug
1340
+ * @param {string} username
1341
+ * @param {Endpoints | null} [endpoints]
1342
+ * @returns {any}
1343
+ */
1344
+ export function unbanRequest(session, channel_slug, username, endpoints) {
1345
+ try {
1346
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1347
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1348
+ const len0 = WASM_VECTOR_LEN;
1349
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1350
+ const len1 = WASM_VECTOR_LEN;
1351
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1352
+ const len2 = WASM_VECTOR_LEN;
1353
+ wasm.unbanRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1354
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1355
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1356
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1357
+ if (r2) {
1358
+ throw takeObject(r1);
1359
+ }
1360
+ return takeObject(r0);
1361
+ } finally {
1362
+ wasm.__wbindgen_add_to_stack_pointer(16);
1363
+ }
1364
+ }
1365
+
1366
+ /**
1367
+ * Removes the pin.
1368
+ * @param {string} session
1369
+ * @param {string} channel_slug
1370
+ * @param {Endpoints | null} [endpoints]
1371
+ * @returns {any}
1372
+ */
1373
+ export function unpinRequest(session, channel_slug, endpoints) {
1374
+ try {
1375
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1376
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1377
+ const len0 = WASM_VECTOR_LEN;
1378
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1379
+ const len1 = WASM_VECTOR_LEN;
1380
+ wasm.unpinRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1381
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1382
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1383
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1384
+ if (r2) {
1385
+ throw takeObject(r1);
1386
+ }
1387
+ return takeObject(r0);
1388
+ } finally {
1389
+ wasm.__wbindgen_add_to_stack_pointer(16);
1390
+ }
1391
+ }
1392
+
1393
+ /**
1394
+ * Removes subscriptions, 50 per request.
1395
+ * @param {string} token
1396
+ * @param {string[]} ids
1397
+ * @param {Endpoints | null} [endpoints]
1398
+ * @returns {any}
1399
+ */
1400
+ export function unsubscribeRequests(token, ids, endpoints) {
1401
+ try {
1402
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1403
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1404
+ const len0 = WASM_VECTOR_LEN;
1405
+ const ptr1 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
1406
+ const len1 = WASM_VECTOR_LEN;
1407
+ wasm.unsubscribeRequests(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1408
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1409
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1410
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1411
+ if (r2) {
1412
+ throw takeObject(r1);
1413
+ }
1414
+ return takeObject(r0);
1415
+ } finally {
1416
+ wasm.__wbindgen_add_to_stack_pointer(16);
1417
+ }
1418
+ }
1419
+
1420
+ /**
1421
+ * Checks a delivery and returns `{headers, event}`, or throws. `headers` as
1422
+ * `[[name, value]…]`, a fetch `Headers` or an object; `body` the raw body,
1423
+ * as text or bytes. The timestamp must be within 5 minutes of this
1424
+ * machine's clock, unless `options` says otherwise: `now` (Unix seconds),
1425
+ * `toleranceSecs`, or `skipFreshness: true` to re-check a stored delivery.
1426
+ *
1427
+ * A receiver checking many deliveries reads the key once, with
1428
+ * `new WebhookPublicKey(pem)`, and calls its `verify`.
1429
+ * @param {string} public_key_pem
1430
+ * @param {WebhookHeaders} headers
1431
+ * @param {string | Uint8Array | ArrayBuffer} body
1432
+ * @param {VerifyOptions | null} [options]
1433
+ * @returns {VerifiedWebhook}
1434
+ */
1435
+ export function verifyWebhook(public_key_pem, headers, body, options) {
1436
+ try {
1437
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1438
+ const ptr0 = passStringToWasm0(public_key_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1439
+ const len0 = WASM_VECTOR_LEN;
1440
+ wasm.verifyWebhook(retptr, ptr0, len0, addHeapObject(headers), addHeapObject(body), isLikeNone(options) ? 0 : addHeapObject(options));
1441
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1442
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1443
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1444
+ if (r2) {
1445
+ throw takeObject(r1);
1446
+ }
1447
+ return takeObject(r0);
1448
+ } finally {
1449
+ wasm.__wbindgen_add_to_stack_pointer(16);
1450
+ }
1451
+ }
1452
+ function __wbg_get_imports() {
1453
+ const import0 = {
1454
+ __proto__: null,
1455
+ __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
1456
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1457
+ return addHeapObject(ret);
1458
+ },
1459
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
1460
+ const ret = String(getObject(arg1));
1461
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1462
+ const len1 = WASM_VECTOR_LEN;
1463
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1464
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1465
+ },
1466
+ __wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
1467
+ const v = getObject(arg1);
1468
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1469
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1470
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1471
+ },
1472
+ __wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
1473
+ const v = getObject(arg0);
1474
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1475
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1476
+ },
1477
+ __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
1478
+ const ret = debugString(getObject(arg1));
1479
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1480
+ const len1 = WASM_VECTOR_LEN;
1481
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1482
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1483
+ },
1484
+ __wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
1485
+ const ret = getObject(arg0) in getObject(arg1);
1486
+ return ret;
1487
+ },
1488
+ __wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
1489
+ const ret = typeof(getObject(arg0)) === 'bigint';
1490
+ return ret;
1491
+ },
1492
+ __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
1493
+ const ret = typeof(getObject(arg0)) === 'function';
1494
+ return ret;
1495
+ },
1496
+ __wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
1497
+ const ret = getObject(arg0) === null;
1498
+ return ret;
1499
+ },
1500
+ __wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
1501
+ const val = getObject(arg0);
1502
+ const ret = typeof(val) === 'object' && val !== null;
1503
+ return ret;
1504
+ },
1505
+ __wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
1506
+ const ret = typeof(getObject(arg0)) === 'string';
1507
+ return ret;
1508
+ },
1509
+ __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
1510
+ const ret = getObject(arg0) === undefined;
1511
+ return ret;
1512
+ },
1513
+ __wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
1514
+ const ret = getObject(arg0) === getObject(arg1);
1515
+ return ret;
1516
+ },
1517
+ __wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
1518
+ const ret = getObject(arg0) == getObject(arg1);
1519
+ return ret;
1520
+ },
1521
+ __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
1522
+ const obj = getObject(arg1);
1523
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1524
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1525
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1526
+ },
1527
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
1528
+ const obj = getObject(arg1);
1529
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1530
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1531
+ var len1 = WASM_VECTOR_LEN;
1532
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1533
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1534
+ },
1535
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
1536
+ throw new Error(getStringFromWasm0(arg0, arg1));
1537
+ },
1538
+ __wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
1539
+ const ret = getObject(arg0).call(getObject(arg1));
1540
+ return addHeapObject(ret);
1541
+ }, arguments); },
1542
+ __wbg_done_b41a1d26cdb37fb6: function(arg0) {
1543
+ const ret = getObject(arg0).done;
1544
+ return ret;
1545
+ },
1546
+ __wbg_entries_fb6397112b1de25f: function(arg0) {
1547
+ const ret = Object.entries(getObject(arg0));
1548
+ return addHeapObject(ret);
1549
+ },
1550
+ __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
1551
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1552
+ return addHeapObject(ret);
1553
+ }, arguments); },
1554
+ __wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
1555
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1556
+ return addHeapObject(ret);
1557
+ }, arguments); },
1558
+ __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
1559
+ const ret = getObject(arg0)[arg1 >>> 0];
1560
+ return addHeapObject(ret);
1561
+ },
1562
+ __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
1563
+ const ret = getObject(arg0)[arg1 >>> 0];
1564
+ return addHeapObject(ret);
1565
+ },
1566
+ __wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
1567
+ let result;
1568
+ try {
1569
+ result = getObject(arg0) instanceof ArrayBuffer;
1570
+ } catch (_) {
1571
+ result = false;
1572
+ }
1573
+ const ret = result;
1574
+ return ret;
1575
+ },
1576
+ __wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
1577
+ let result;
1578
+ try {
1579
+ result = getObject(arg0) instanceof Map;
1580
+ } catch (_) {
1581
+ result = false;
1582
+ }
1583
+ const ret = result;
1584
+ return ret;
1585
+ },
1586
+ __wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
1587
+ let result;
1588
+ try {
1589
+ result = getObject(arg0) instanceof Uint8Array;
1590
+ } catch (_) {
1591
+ result = false;
1592
+ }
1593
+ const ret = result;
1594
+ return ret;
1595
+ },
1596
+ __wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
1597
+ const ret = Array.isArray(getObject(arg0));
1598
+ return ret;
1599
+ },
1600
+ __wbg_isSafeInteger_717808ad6a54bd9e: function(arg0) {
1601
+ const ret = Number.isSafeInteger(getObject(arg0));
1602
+ return ret;
1603
+ },
1604
+ __wbg_iterator_e3c31c892080e444: function() {
1605
+ const ret = Symbol.iterator;
1606
+ return addHeapObject(ret);
1607
+ },
1608
+ __wbg_keys_440be172f17c0265: function(arg0) {
1609
+ const ret = Object.keys(getObject(arg0));
1610
+ return addHeapObject(ret);
1611
+ },
1612
+ __wbg_length_7f3c00c40364105e: function(arg0) {
1613
+ const ret = getObject(arg0).length;
1614
+ return ret;
1615
+ },
1616
+ __wbg_length_d4bdea10311bd9cf: function(arg0) {
1617
+ const ret = getObject(arg0).length;
1618
+ return ret;
1619
+ },
1620
+ __wbg_new_1dbf7428bba60a42: function(arg0) {
1621
+ const ret = new Uint8Array(getObject(arg0));
1622
+ return addHeapObject(ret);
1623
+ },
1624
+ __wbg_new_28744009d011f847: function() {
1625
+ const ret = new Map();
1626
+ return addHeapObject(ret);
1627
+ },
1628
+ __wbg_new_2bdcdfcebdfc34d2: function(arg0, arg1) {
1629
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
1630
+ return addHeapObject(ret);
1631
+ },
1632
+ __wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
1633
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1634
+ return addHeapObject(ret);
1635
+ },
1636
+ __wbg_new_617a8cdb8bb1130e: function() {
1637
+ const ret = new Object();
1638
+ return addHeapObject(ret);
1639
+ },
1640
+ __wbg_new_6ab88fbe741af6b5: function(arg0, arg1) {
1641
+ const ret = new RangeError(getStringFromWasm0(arg0, arg1));
1642
+ return addHeapObject(ret);
1643
+ },
1644
+ __wbg_new_ee2291f50781bf1d: function() {
1645
+ const ret = new Array();
1646
+ return addHeapObject(ret);
1647
+ },
1648
+ __wbg_next_33784799010f1bbe: function(arg0) {
1649
+ const ret = getObject(arg0).next;
1650
+ return addHeapObject(ret);
1651
+ },
1652
+ __wbg_next_f4aac29c42af995c: function() { return handleError(function (arg0) {
1653
+ const ret = getObject(arg0).next();
1654
+ return addHeapObject(ret);
1655
+ }, arguments); },
1656
+ __wbg_now_aa4ccb83129e9e55: function() {
1657
+ const ret = Date.now();
1658
+ return ret;
1659
+ },
1660
+ __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
1661
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1662
+ },
1663
+ __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
1664
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1665
+ return ret;
1666
+ }, arguments); },
1667
+ __wbg_set_6ae97e73113c4f0b: function(arg0, arg1, arg2) {
1668
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1669
+ return addHeapObject(ret);
1670
+ },
1671
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1672
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1673
+ },
1674
+ __wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
1675
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1676
+ },
1677
+ __wbg_value_f3c585ee8f5ba40c: function(arg0) {
1678
+ const ret = getObject(arg0).value;
1679
+ return addHeapObject(ret);
1680
+ },
1681
+ __wbindgen_generic_0000000000000001: function(arg0) {
1682
+ // Cast intrinsic for `F64 -> Externref`.
1683
+ const ret = arg0;
1684
+ return addHeapObject(ret);
1685
+ },
1686
+ __wbindgen_generic_0000000000000002: function(arg0) {
1687
+ // Cast intrinsic for `I64 -> Externref`.
1688
+ const ret = arg0;
1689
+ return addHeapObject(ret);
1690
+ },
1691
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1692
+ // Cast intrinsic for `Ref(String) -> Externref`.
1693
+ const ret = getStringFromWasm0(arg0, arg1);
1694
+ return addHeapObject(ret);
1695
+ },
1696
+ __wbindgen_generic_0000000000000004: function(arg0) {
1697
+ // Cast intrinsic for `U64 -> Externref`.
1698
+ const ret = BigInt.asUintN(64, arg0);
1699
+ return addHeapObject(ret);
1700
+ },
1701
+ __wbindgen_object_clone_ref: function(arg0) {
1702
+ const ret = getObject(arg0);
1703
+ return addHeapObject(ret);
1704
+ },
1705
+ __wbindgen_object_drop_ref: function(arg0) {
1706
+ takeObject(arg0);
1707
+ },
1708
+ };
1709
+ return {
1710
+ __proto__: null,
1711
+ "./kicksdk_bg.js": import0,
1712
+ };
1713
+ }
1714
+
1715
+ const BackoffFinalization = (typeof FinalizationRegistry === 'undefined')
1716
+ ? { register: () => {}, unregister: () => {} }
1717
+ : new FinalizationRegistry(ptr => wasm.__wbg_backoff_free(ptr, 1));
1718
+ const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
1719
+ ? { register: () => {}, unregister: () => {} }
1720
+ : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr, 1));
1721
+ const WebhookPublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1722
+ ? { register: () => {}, unregister: () => {} }
1723
+ : new FinalizationRegistry(ptr => wasm.__wbg_webhookpublickey_free(ptr, 1));
1724
+
1725
+ function addHeapObject(obj) {
1726
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1727
+ const idx = heap_next;
1728
+ heap_next = heap[idx];
1729
+
1730
+ heap[idx] = obj;
1731
+ return idx;
1732
+ }
1733
+
1734
+ function debugString(val) {
1735
+ // primitive types
1736
+ const type = typeof val;
1737
+ if (type == 'number' || type == 'boolean' || val == null) {
1738
+ return `${val}`;
1739
+ }
1740
+ if (type == 'string') {
1741
+ return `"${val}"`;
1742
+ }
1743
+ if (type == 'symbol') {
1744
+ const description = val.description;
1745
+ if (description == null) {
1746
+ return 'Symbol';
1747
+ } else {
1748
+ return `Symbol(${description})`;
1749
+ }
1750
+ }
1751
+ if (type == 'function') {
1752
+ const name = val.name;
1753
+ if (typeof name == 'string' && name.length > 0) {
1754
+ return `Function(${name})`;
1755
+ } else {
1756
+ return 'Function';
1757
+ }
1758
+ }
1759
+ // objects
1760
+ if (Array.isArray(val)) {
1761
+ const length = val.length;
1762
+ let debug = '[';
1763
+ if (length > 0) {
1764
+ debug += debugString(val[0]);
1765
+ }
1766
+ for(let i = 1; i < length; i++) {
1767
+ debug += ', ' + debugString(val[i]);
1768
+ }
1769
+ debug += ']';
1770
+ return debug;
1771
+ }
1772
+ // Test for built-in
1773
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1774
+ let className;
1775
+ if (builtInMatches && builtInMatches.length > 1) {
1776
+ className = builtInMatches[1];
1777
+ } else {
1778
+ // Failed to match the standard '[object ClassName]'
1779
+ return toString.call(val);
1780
+ }
1781
+ if (className == 'Object') {
1782
+ // we're a user defined class or Object
1783
+ // JSON.stringify avoids problems with cycles, and is generally much
1784
+ // easier than looping through ownProperties of `val`.
1785
+ try {
1786
+ return 'Object(' + JSON.stringify(val) + ')';
1787
+ } catch (_) {
1788
+ return 'Object';
1789
+ }
1790
+ }
1791
+ // errors
1792
+ if (val instanceof Error) {
1793
+ return `${val.name}: ${val.message}\n${val.stack}`;
1794
+ }
1795
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1796
+ return className;
1797
+ }
1798
+
1799
+ function dropObject(idx) {
1800
+ if (idx < 1028) return;
1801
+ heap[idx] = heap_next;
1802
+ heap_next = idx;
1803
+ }
1804
+
1805
+ function getArrayJsValueFromWasm0(ptr, len) {
1806
+ ptr = ptr >>> 0;
1807
+ const mem = getDataViewMemory0();
1808
+ const result = [];
1809
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1810
+ result.push(takeObject(mem.getUint32(i, true)));
1811
+ }
1812
+ return result;
1813
+ }
1814
+
1815
+ function getArrayU8FromWasm0(ptr, len) {
1816
+ ptr = ptr >>> 0;
1817
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1818
+ }
1819
+
1820
+ let cachedDataViewMemory0 = null;
1821
+ function getDataViewMemory0() {
1822
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1823
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1824
+ }
1825
+ return cachedDataViewMemory0;
1826
+ }
1827
+
1828
+ function getStringFromWasm0(ptr, len) {
1829
+ return decodeText(ptr >>> 0, len);
1830
+ }
1831
+
1832
+ let cachedUint8ArrayMemory0 = null;
1833
+ function getUint8ArrayMemory0() {
1834
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1835
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1836
+ }
1837
+ return cachedUint8ArrayMemory0;
1838
+ }
1839
+
1840
+ function getObject(idx) { return heap[idx]; }
1841
+
1842
+ function handleError(f, args) {
1843
+ try {
1844
+ return f.apply(this, args);
1845
+ } catch (e) {
1846
+ wasm.__wbindgen_export3(addHeapObject(e));
1847
+ }
1848
+ }
1849
+
1850
+ let heap = new Array(1024).fill(undefined);
1851
+ heap.push(undefined, null, true, false);
1852
+
1853
+ let heap_next = heap.length;
1854
+
1855
+ function isLikeNone(x) {
1856
+ return x === undefined || x === null;
1857
+ }
1858
+
1859
+ function passArrayJsValueToWasm0(array, malloc) {
1860
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1861
+ const mem = getDataViewMemory0();
1862
+ for (let i = 0; i < array.length; i++) {
1863
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1864
+ }
1865
+ WASM_VECTOR_LEN = array.length;
1866
+ return ptr;
1867
+ }
1868
+
1869
+ function passStringToWasm0(arg, malloc, realloc) {
1870
+ if (realloc === undefined) {
1871
+ const buf = cachedTextEncoder.encode(arg);
1872
+ const ptr = malloc(buf.length, 1) >>> 0;
1873
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1874
+ WASM_VECTOR_LEN = buf.length;
1875
+ return ptr;
1876
+ }
1877
+
1878
+ let len = arg.length;
1879
+ let ptr = malloc(len, 1) >>> 0;
1880
+
1881
+ const mem = getUint8ArrayMemory0();
1882
+
1883
+ let offset = 0;
1884
+
1885
+ for (; offset < len; offset++) {
1886
+ const code = arg.charCodeAt(offset);
1887
+ if (code > 0x7F) break;
1888
+ mem[ptr + offset] = code;
1889
+ }
1890
+ if (offset !== len) {
1891
+ if (offset !== 0) {
1892
+ arg = arg.slice(offset);
1893
+ }
1894
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1895
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1896
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1897
+
1898
+ offset += ret.written;
1899
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1900
+ }
1901
+
1902
+ WASM_VECTOR_LEN = offset;
1903
+ return ptr;
1904
+ }
1905
+
1906
+ function takeObject(idx) {
1907
+ const ret = getObject(idx);
1908
+ dropObject(idx);
1909
+ return ret;
1910
+ }
1911
+
1912
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1913
+ cachedTextDecoder.decode();
1914
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1915
+ let numBytesDecoded = 0;
1916
+ function decodeText(ptr, len) {
1917
+ numBytesDecoded += len;
1918
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1919
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1920
+ cachedTextDecoder.decode();
1921
+ numBytesDecoded = len;
1922
+ }
1923
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1924
+ }
1925
+
1926
+ const cachedTextEncoder = new TextEncoder();
1927
+
1928
+ if (!('encodeInto' in cachedTextEncoder)) {
1929
+ cachedTextEncoder.encodeInto = function (arg, view) {
1930
+ const buf = cachedTextEncoder.encode(arg);
1931
+ view.set(buf);
1932
+ return {
1933
+ read: arg.length,
1934
+ written: buf.length
1935
+ };
1936
+ };
1937
+ }
1938
+
1939
+ let WASM_VECTOR_LEN = 0;
1940
+
1941
+ let wasmModule, wasmInstance, wasm;
1942
+ function __wbg_finalize_init(instance, module) {
1943
+ wasmInstance = instance;
1944
+ wasm = instance.exports;
1945
+ wasmModule = module;
1946
+ cachedDataViewMemory0 = null;
1947
+ cachedUint8ArrayMemory0 = null;
1948
+ return wasm;
1949
+ }
1950
+
1951
+ async function __wbg_load(module, imports) {
1952
+ if (typeof Response === 'function' && module instanceof Response) {
1953
+ if (!module.ok) {
1954
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
1955
+ }
1956
+
1957
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1958
+ try {
1959
+ return await WebAssembly.instantiateStreaming(module, imports);
1960
+ } catch (e) {
1961
+ const validResponse = expectedResponseType(module.type);
1962
+
1963
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1964
+ 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);
1965
+
1966
+ } else { throw e; }
1967
+ }
1968
+ }
1969
+
1970
+ const bytes = await module.arrayBuffer();
1971
+ return await WebAssembly.instantiate(bytes, imports);
1972
+ } else {
1973
+ const instance = await WebAssembly.instantiate(module, imports);
1974
+
1975
+ if (instance instanceof WebAssembly.Instance) {
1976
+ return { instance, module };
1977
+ } else {
1978
+ return instance;
1979
+ }
1980
+ }
1981
+
1982
+ function expectedResponseType(type) {
1983
+ switch (type) {
1984
+ case 'basic': case 'cors': case 'default': return true;
1985
+ }
1986
+ return false;
1987
+ }
1988
+ }
1989
+
1990
+ function initSync(module) {
1991
+ if (wasm !== undefined) return wasm;
1992
+
1993
+
1994
+ if (module !== undefined) {
1995
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1996
+ ({module} = module)
1997
+ } else {
1998
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1999
+ }
2000
+ }
2001
+
2002
+ const imports = __wbg_get_imports();
2003
+ if (!(module instanceof WebAssembly.Module)) {
2004
+ module = new WebAssembly.Module(module);
2005
+ }
2006
+ const instance = new WebAssembly.Instance(module, imports);
2007
+ return __wbg_finalize_init(instance, module);
2008
+ }
2009
+
2010
+ async function __wbg_init(module_or_path) {
2011
+ if (wasm !== undefined) return wasm;
2012
+
2013
+
2014
+ if (module_or_path !== undefined) {
2015
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2016
+ ({module_or_path} = module_or_path)
2017
+ } else {
2018
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2019
+ }
2020
+ }
2021
+
2022
+ if (module_or_path === undefined) {
2023
+ module_or_path = new URL('kicksdk_bg.wasm', import.meta.url);
2024
+ }
2025
+ const imports = __wbg_get_imports();
2026
+
2027
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2028
+ module_or_path = fetch(module_or_path);
2029
+ }
2030
+
2031
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2032
+
2033
+ return __wbg_finalize_init(instance, module);
2034
+ }
2035
+
2036
+ export { initSync, __wbg_init as default };