@bota.dev/web-app-sdk 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +517 -0
  3. package/dist/capabilities.d.ts +8 -0
  4. package/dist/capabilities.js +21 -0
  5. package/dist/client.d.ts +39 -0
  6. package/dist/client.js +153 -0
  7. package/dist/controlManager.d.ts +38 -0
  8. package/dist/controlManager.js +344 -0
  9. package/dist/core.d.ts +698 -0
  10. package/dist/core.js +13 -0
  11. package/dist/deviceManager.d.ts +52 -0
  12. package/dist/deviceManager.js +491 -0
  13. package/dist/encryptedUploadV2Host.d.ts +239 -0
  14. package/dist/encryptedUploadV2Host.js +2136 -0
  15. package/dist/errors.d.ts +24 -0
  16. package/dist/errors.js +230 -0
  17. package/dist/gatt.d.ts +39 -0
  18. package/dist/gatt.js +57 -0
  19. package/dist/generated/bota_device_sdk_core.d.ts +202 -0
  20. package/dist/generated/bota_device_sdk_core.js +1025 -0
  21. package/dist/generated/bota_device_sdk_core_bg.wasm +0 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/index.js +2 -0
  24. package/dist/indexedDbWorkflowStore.d.ts +52 -0
  25. package/dist/indexedDbWorkflowStore.js +763 -0
  26. package/dist/logManager.d.ts +24 -0
  27. package/dist/logManager.js +205 -0
  28. package/dist/models.d.ts +217 -0
  29. package/dist/models.js +1 -0
  30. package/dist/opfsBlobStore.d.ts +12 -0
  31. package/dist/opfsBlobStore.js +250 -0
  32. package/dist/otaManager.d.ts +49 -0
  33. package/dist/otaManager.js +951 -0
  34. package/dist/providerCancellation.d.ts +2 -0
  35. package/dist/providerCancellation.js +23 -0
  36. package/dist/providers.d.ts +138 -0
  37. package/dist/providers.js +1 -0
  38. package/dist/provisioningManager.d.ts +48 -0
  39. package/dist/provisioningManager.js +753 -0
  40. package/dist/recordingManager.d.ts +53 -0
  41. package/dist/recordingManager.js +1397 -0
  42. package/dist/storage.d.ts +103 -0
  43. package/dist/storage.js +60 -0
  44. package/dist/transport.d.ts +33 -0
  45. package/dist/transport.js +8 -0
  46. package/dist/wasmCore.d.ts +3 -0
  47. package/dist/wasmCore.js +1651 -0
  48. package/dist/webBluetoothTransport.d.ts +23 -0
  49. package/dist/webBluetoothTransport.js +369 -0
  50. package/dist/wifiManager.d.ts +54 -0
  51. package/dist/wifiManager.js +528 -0
  52. package/dist/workflowRuntime.d.ts +115 -0
  53. package/dist/workflowRuntime.js +1508 -0
  54. package/package.json +46 -0
@@ -0,0 +1,1025 @@
1
+ /* @ts-self-types="./bota_device_sdk_core.d.ts" */
2
+ export class WebCoreBridge {
3
+ __destroy_into_raw() {
4
+ const ptr = this.__wbg_ptr;
5
+ this.__wbg_ptr = 0;
6
+ WebCoreBridgeFinalization.unregister(this);
7
+ return ptr;
8
+ }
9
+ free() {
10
+ const ptr = this.__destroy_into_raw();
11
+ wasm.__wbg_webcorebridge_free(ptr, 0);
12
+ }
13
+ /**
14
+ * @param {Uint8Array} cancellation_id
15
+ * @returns {any}
16
+ */
17
+ cancel(cancellation_id) {
18
+ const ptr0 = passArray8ToWasm0(cancellation_id, wasm.__wbindgen_malloc);
19
+ const len0 = WASM_VECTOR_LEN;
20
+ const ret = wasm.webcorebridge_cancel(this.__wbg_ptr, ptr0, len0);
21
+ if (ret[2]) {
22
+ throw takeFromExternrefTable0(ret[1]);
23
+ }
24
+ return takeFromExternrefTable0(ret[0]);
25
+ }
26
+ /**
27
+ * @param {any} event
28
+ * @returns {any}
29
+ */
30
+ dispatch(event) {
31
+ const ret = wasm.webcorebridge_dispatch(this.__wbg_ptr, event);
32
+ if (ret[2]) {
33
+ throw takeFromExternrefTable0(ret[1]);
34
+ }
35
+ return takeFromExternrefTable0(ret[0]);
36
+ }
37
+ constructor() {
38
+ const ret = wasm.webcorebridge_new();
39
+ this.__wbg_ptr = ret;
40
+ WebCoreBridgeFinalization.register(this, this.__wbg_ptr, this);
41
+ return this;
42
+ }
43
+ /**
44
+ * @param {any} input
45
+ * @returns {any}
46
+ */
47
+ startDeviceLogs(input) {
48
+ const ret = wasm.webcorebridge_startDeviceLogs(this.__wbg_ptr, input);
49
+ if (ret[2]) {
50
+ throw takeFromExternrefTable0(ret[1]);
51
+ }
52
+ return takeFromExternrefTable0(ret[0]);
53
+ }
54
+ /**
55
+ * @param {any} input
56
+ * @returns {any}
57
+ */
58
+ startEncryptedUploadV2(input) {
59
+ const ret = wasm.webcorebridge_startEncryptedUploadV2(this.__wbg_ptr, input);
60
+ if (ret[2]) {
61
+ throw takeFromExternrefTable0(ret[1]);
62
+ }
63
+ return takeFromExternrefTable0(ret[0]);
64
+ }
65
+ /**
66
+ * @param {string} expected_serial
67
+ * @param {string} peripheral_id
68
+ * @param {string | null | undefined} name
69
+ * @param {Uint8Array} cancellation_id
70
+ * @returns {any}
71
+ */
72
+ startExactConnection(expected_serial, peripheral_id, name, cancellation_id) {
73
+ const ptr0 = passStringToWasm0(expected_serial, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
74
+ const len0 = WASM_VECTOR_LEN;
75
+ const ptr1 = passStringToWasm0(peripheral_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
76
+ const len1 = WASM_VECTOR_LEN;
77
+ var ptr2 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
+ var len2 = WASM_VECTOR_LEN;
79
+ const ptr3 = passArray8ToWasm0(cancellation_id, wasm.__wbindgen_malloc);
80
+ const len3 = WASM_VECTOR_LEN;
81
+ const ret = wasm.webcorebridge_startExactConnection(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
82
+ if (ret[2]) {
83
+ throw takeFromExternrefTable0(ret[1]);
84
+ }
85
+ return takeFromExternrefTable0(ret[0]);
86
+ }
87
+ /**
88
+ * @param {any} input
89
+ * @returns {any}
90
+ */
91
+ startFirmwareUpdate(input) {
92
+ const ret = wasm.webcorebridge_startFirmwareUpdate(this.__wbg_ptr, input);
93
+ if (ret[2]) {
94
+ throw takeFromExternrefTable0(ret[1]);
95
+ }
96
+ return takeFromExternrefTable0(ret[0]);
97
+ }
98
+ /**
99
+ * @param {any} input
100
+ * @returns {any}
101
+ */
102
+ startProvisioning(input) {
103
+ const ret = wasm.webcorebridge_startProvisioning(this.__wbg_ptr, input);
104
+ if (ret[2]) {
105
+ throw takeFromExternrefTable0(ret[1]);
106
+ }
107
+ return takeFromExternrefTable0(ret[0]);
108
+ }
109
+ /**
110
+ * @param {any} input
111
+ * @returns {any}
112
+ */
113
+ startReconnect(input) {
114
+ const ret = wasm.webcorebridge_startReconnect(this.__wbg_ptr, input);
115
+ if (ret[2]) {
116
+ throw takeFromExternrefTable0(ret[1]);
117
+ }
118
+ return takeFromExternrefTable0(ret[0]);
119
+ }
120
+ /**
121
+ * @param {any} input
122
+ * @returns {any}
123
+ */
124
+ startRecordingTransfer(input) {
125
+ const ret = wasm.webcorebridge_startRecordingTransfer(this.__wbg_ptr, input);
126
+ if (ret[2]) {
127
+ throw takeFromExternrefTable0(ret[1]);
128
+ }
129
+ return takeFromExternrefTable0(ret[0]);
130
+ }
131
+ /**
132
+ * @returns {any}
133
+ */
134
+ status() {
135
+ const ret = wasm.webcorebridge_status(this.__wbg_ptr);
136
+ if (ret[2]) {
137
+ throw takeFromExternrefTable0(ret[1]);
138
+ }
139
+ return takeFromExternrefTable0(ret[0]);
140
+ }
141
+ /**
142
+ * @param {any} capabilities
143
+ * @returns {boolean}
144
+ */
145
+ supportsEncryptedUploadV2Batch(capabilities) {
146
+ const ret = wasm.webcorebridge_supportsEncryptedUploadV2Batch(this.__wbg_ptr, capabilities);
147
+ if (ret[2]) {
148
+ throw takeFromExternrefTable0(ret[1]);
149
+ }
150
+ return ret[0] !== 0;
151
+ }
152
+ /**
153
+ * @param {any} capabilities
154
+ * @param {number} recording_generation
155
+ * @param {number} storage_format
156
+ */
157
+ validateEncryptedUploadV2Profile(capabilities, recording_generation, storage_format) {
158
+ const ret = wasm.webcorebridge_validateEncryptedUploadV2Profile(this.__wbg_ptr, capabilities, recording_generation, storage_format);
159
+ if (ret[1]) {
160
+ throw takeFromExternrefTable0(ret[0]);
161
+ }
162
+ }
163
+ }
164
+ if (Symbol.dispose)
165
+ WebCoreBridge.prototype[Symbol.dispose] = WebCoreBridge.prototype.free;
166
+ export class WebIntegrityHasher {
167
+ __destroy_into_raw() {
168
+ const ptr = this.__wbg_ptr;
169
+ this.__wbg_ptr = 0;
170
+ WebIntegrityHasherFinalization.unregister(this);
171
+ return ptr;
172
+ }
173
+ free() {
174
+ const ptr = this.__destroy_into_raw();
175
+ wasm.__wbg_webintegrityhasher_free(ptr, 0);
176
+ }
177
+ /**
178
+ * @returns {number}
179
+ */
180
+ crc32() {
181
+ const ret = wasm.webintegrityhasher_crc32(this.__wbg_ptr);
182
+ return ret >>> 0;
183
+ }
184
+ /**
185
+ * @returns {bigint}
186
+ */
187
+ length() {
188
+ const ret = wasm.webintegrityhasher_length(this.__wbg_ptr);
189
+ return BigInt.asUintN(64, ret);
190
+ }
191
+ constructor() {
192
+ const ret = wasm.webintegrityhasher_new();
193
+ this.__wbg_ptr = ret;
194
+ WebIntegrityHasherFinalization.register(this, this.__wbg_ptr, this);
195
+ return this;
196
+ }
197
+ /**
198
+ * @returns {Uint8Array}
199
+ */
200
+ sha256Snapshot() {
201
+ const ret = wasm.webintegrityhasher_sha256Snapshot(this.__wbg_ptr);
202
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
203
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
204
+ return v1;
205
+ }
206
+ /**
207
+ * @param {Uint8Array} bytes
208
+ */
209
+ update(bytes) {
210
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
211
+ const len0 = WASM_VECTOR_LEN;
212
+ wasm.webintegrityhasher_update(this.__wbg_ptr, ptr0, len0);
213
+ }
214
+ }
215
+ if (Symbol.dispose)
216
+ WebIntegrityHasher.prototype[Symbol.dispose] = WebIntegrityHasher.prototype.free;
217
+ /**
218
+ * @param {Uint8Array} bytes
219
+ * @returns {any}
220
+ */
221
+ export function decodeConnectionSettings(bytes) {
222
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
223
+ const len0 = WASM_VECTOR_LEN;
224
+ const ret = wasm.decodeConnectionSettings(ptr0, len0);
225
+ if (ret[2]) {
226
+ throw takeFromExternrefTable0(ret[1]);
227
+ }
228
+ return takeFromExternrefTable0(ret[0]);
229
+ }
230
+ /**
231
+ * @param {Uint8Array} bytes
232
+ * @returns {any}
233
+ */
234
+ export function decodeDeprovisionResult(bytes) {
235
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
236
+ const len0 = WASM_VECTOR_LEN;
237
+ const ret = wasm.decodeDeprovisionResult(ptr0, len0);
238
+ if (ret[2]) {
239
+ throw takeFromExternrefTable0(ret[1]);
240
+ }
241
+ return takeFromExternrefTable0(ret[0]);
242
+ }
243
+ /**
244
+ * @param {Uint8Array} bytes
245
+ * @returns {any}
246
+ */
247
+ export function decodeDeviceStatus(bytes) {
248
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
249
+ const len0 = WASM_VECTOR_LEN;
250
+ const ret = wasm.decodeDeviceStatus(ptr0, len0);
251
+ if (ret[2]) {
252
+ throw takeFromExternrefTable0(ret[1]);
253
+ }
254
+ return takeFromExternrefTable0(ret[0]);
255
+ }
256
+ /**
257
+ * @param {Uint8Array} bytes
258
+ * @returns {any}
259
+ */
260
+ export function decodeEncryptedUploadV2Capabilities(bytes) {
261
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
262
+ const len0 = WASM_VECTOR_LEN;
263
+ const ret = wasm.decodeEncryptedUploadV2Capabilities(ptr0, len0);
264
+ if (ret[2]) {
265
+ throw takeFromExternrefTable0(ret[1]);
266
+ }
267
+ return takeFromExternrefTable0(ret[0]);
268
+ }
269
+ /**
270
+ * @param {Uint8Array} bytes
271
+ * @returns {any}
272
+ */
273
+ export function decodeEncryptedUploadV2SignedBlobResult(bytes) {
274
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
275
+ const len0 = WASM_VECTOR_LEN;
276
+ const ret = wasm.decodeEncryptedUploadV2SignedBlobResult(ptr0, len0);
277
+ if (ret[2]) {
278
+ throw takeFromExternrefTable0(ret[1]);
279
+ }
280
+ return takeFromExternrefTable0(ret[0]);
281
+ }
282
+ /**
283
+ * @param {Uint8Array} bytes
284
+ * @returns {any}
285
+ */
286
+ export function decodeEncryptedUploadV2Status(bytes) {
287
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ const ret = wasm.decodeEncryptedUploadV2Status(ptr0, len0);
290
+ if (ret[2]) {
291
+ throw takeFromExternrefTable0(ret[1]);
292
+ }
293
+ return takeFromExternrefTable0(ret[0]);
294
+ }
295
+ /**
296
+ * @param {Uint8Array} bytes
297
+ * @returns {any}
298
+ */
299
+ export function decodeEncryptedUploadV2Transfer(bytes) {
300
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
301
+ const len0 = WASM_VECTOR_LEN;
302
+ const ret = wasm.decodeEncryptedUploadV2Transfer(ptr0, len0);
303
+ if (ret[2]) {
304
+ throw takeFromExternrefTable0(ret[1]);
305
+ }
306
+ return takeFromExternrefTable0(ret[0]);
307
+ }
308
+ /**
309
+ * @param {Uint8Array} bytes
310
+ * @returns {any}
311
+ */
312
+ export function decodeRecordingControlResult(bytes) {
313
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
314
+ const len0 = WASM_VECTOR_LEN;
315
+ const ret = wasm.decodeRecordingControlResult(ptr0, len0);
316
+ if (ret[2]) {
317
+ throw takeFromExternrefTable0(ret[1]);
318
+ }
319
+ return takeFromExternrefTable0(ret[0]);
320
+ }
321
+ /**
322
+ * @param {Uint8Array} bytes
323
+ * @returns {any}
324
+ */
325
+ export function decodeRecordingList(bytes) {
326
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
327
+ const len0 = WASM_VECTOR_LEN;
328
+ const ret = wasm.decodeRecordingList(ptr0, len0);
329
+ if (ret[2]) {
330
+ throw takeFromExternrefTable0(ret[1]);
331
+ }
332
+ return takeFromExternrefTable0(ret[0]);
333
+ }
334
+ /**
335
+ * @param {Uint8Array} bytes
336
+ * @returns {any}
337
+ */
338
+ export function decodeWiFiConfigResult(bytes) {
339
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ const ret = wasm.decodeWiFiConfigResult(ptr0, len0);
342
+ if (ret[2]) {
343
+ throw takeFromExternrefTable0(ret[1]);
344
+ }
345
+ return takeFromExternrefTable0(ret[0]);
346
+ }
347
+ /**
348
+ * @param {Uint8Array} bytes
349
+ * @returns {any}
350
+ */
351
+ export function decodeWiFiScanUpdate(bytes) {
352
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
353
+ const len0 = WASM_VECTOR_LEN;
354
+ const ret = wasm.decodeWiFiScanUpdate(ptr0, len0);
355
+ if (ret[2]) {
356
+ throw takeFromExternrefTable0(ret[1]);
357
+ }
358
+ return takeFromExternrefTable0(ret[0]);
359
+ }
360
+ /**
361
+ * @param {Uint8Array} bytes
362
+ * @returns {any}
363
+ */
364
+ export function decodeWiFiStatus(bytes) {
365
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
366
+ const len0 = WASM_VECTOR_LEN;
367
+ const ret = wasm.decodeWiFiStatus(ptr0, len0);
368
+ if (ret[2]) {
369
+ throw takeFromExternrefTable0(ret[1]);
370
+ }
371
+ return takeFromExternrefTable0(ret[0]);
372
+ }
373
+ /**
374
+ * @param {any} settings
375
+ * @param {string} model
376
+ * @returns {Uint8Array}
377
+ */
378
+ export function encodeConnectionSettings(settings, model) {
379
+ const ptr0 = passStringToWasm0(model, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
380
+ const len0 = WASM_VECTOR_LEN;
381
+ const ret = wasm.encodeConnectionSettings(settings, ptr0, len0);
382
+ if (ret[3]) {
383
+ throw takeFromExternrefTable0(ret[2]);
384
+ }
385
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
386
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
387
+ return v2;
388
+ }
389
+ /**
390
+ * @returns {Uint8Array}
391
+ */
392
+ export function encodeDeprovisionCommand() {
393
+ const ret = wasm.encodeDeprovisionCommand();
394
+ if (ret[3]) {
395
+ throw takeFromExternrefTable0(ret[2]);
396
+ }
397
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
398
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
399
+ return v1;
400
+ }
401
+ /**
402
+ * @param {any} frame
403
+ * @returns {Uint8Array}
404
+ */
405
+ export function encodeEncryptedUploadV2SignedBlob(frame) {
406
+ const ret = wasm.encodeEncryptedUploadV2SignedBlob(frame);
407
+ if (ret[3]) {
408
+ throw takeFromExternrefTable0(ret[2]);
409
+ }
410
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
411
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
412
+ return v1;
413
+ }
414
+ /**
415
+ * @param {any} frame
416
+ * @returns {Uint8Array}
417
+ */
418
+ export function encodeEncryptedUploadV2Transfer(frame) {
419
+ const ret = wasm.encodeEncryptedUploadV2Transfer(frame);
420
+ if (ret[3]) {
421
+ throw takeFromExternrefTable0(ret[2]);
422
+ }
423
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
424
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
425
+ return v1;
426
+ }
427
+ /**
428
+ * @param {string} recording_uuid
429
+ * @returns {Uint8Array}
430
+ */
431
+ export function encodeRecordingConfirm(recording_uuid) {
432
+ const ptr0 = passStringToWasm0(recording_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
433
+ const len0 = WASM_VECTOR_LEN;
434
+ const ret = wasm.encodeRecordingConfirm(ptr0, len0);
435
+ if (ret[3]) {
436
+ throw takeFromExternrefTable0(ret[2]);
437
+ }
438
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
439
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
440
+ return v2;
441
+ }
442
+ /**
443
+ * @param {string} action
444
+ * @returns {Uint8Array}
445
+ */
446
+ export function encodeRecordingControlCommand(action) {
447
+ const ptr0 = passStringToWasm0(action, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
+ const len0 = WASM_VECTOR_LEN;
449
+ const ret = wasm.encodeRecordingControlCommand(ptr0, len0);
450
+ if (ret[3]) {
451
+ throw takeFromExternrefTable0(ret[2]);
452
+ }
453
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
454
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
455
+ return v2;
456
+ }
457
+ /**
458
+ * @returns {Uint8Array}
459
+ */
460
+ export function encodeRecordingListCommand() {
461
+ const ret = wasm.encodeRecordingListCommand();
462
+ if (ret[3]) {
463
+ throw takeFromExternrefTable0(ret[2]);
464
+ }
465
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
466
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
467
+ return v1;
468
+ }
469
+ /**
470
+ * @param {string} ssid
471
+ * @param {string} password
472
+ * @returns {Uint8Array}
473
+ */
474
+ export function encodeWiFiCredentials(ssid, password) {
475
+ const ptr0 = passStringToWasm0(ssid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len0 = WASM_VECTOR_LEN;
477
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
478
+ const len1 = WASM_VECTOR_LEN;
479
+ const ret = wasm.encodeWiFiCredentials(ptr0, len0, ptr1, len1);
480
+ if (ret[3]) {
481
+ throw takeFromExternrefTable0(ret[2]);
482
+ }
483
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
484
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
485
+ return v3;
486
+ }
487
+ /**
488
+ * @param {string} grant
489
+ * @param {number} capacity
490
+ * @returns {Uint8Array}
491
+ */
492
+ export function encodeWiFiGrant(grant, capacity) {
493
+ const ptr0 = passStringToWasm0(grant, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
494
+ const len0 = WASM_VECTOR_LEN;
495
+ const ret = wasm.encodeWiFiGrant(ptr0, len0, capacity);
496
+ if (ret[3]) {
497
+ throw takeFromExternrefTable0(ret[2]);
498
+ }
499
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
500
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
501
+ return v2;
502
+ }
503
+ /**
504
+ * @returns {Uint8Array}
505
+ */
506
+ export function encodeWiFiScanCommand() {
507
+ const ret = wasm.encodeWiFiScanCommand();
508
+ if (ret[3]) {
509
+ throw takeFromExternrefTable0(ret[2]);
510
+ }
511
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
512
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
513
+ return v1;
514
+ }
515
+ function __wbg_get_imports() {
516
+ const import0 = {
517
+ __proto__: null,
518
+ __wbg_Error_67e7344beaa85059: function (arg0, arg1) {
519
+ const ret = Error(getStringFromWasm0(arg0, arg1));
520
+ return ret;
521
+ },
522
+ __wbg_Number_c54e7112a3fa7e3e: function (arg0) {
523
+ const ret = Number(arg0);
524
+ return ret;
525
+ },
526
+ __wbg___wbindgen_bigint_get_as_i64_b482365c149396c8: function (arg0, arg1) {
527
+ const v = arg1;
528
+ const ret = typeof (v) === 'bigint' ? v : undefined;
529
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
530
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
531
+ },
532
+ __wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function (arg0) {
533
+ const v = arg0;
534
+ const ret = typeof (v) === 'boolean' ? v : undefined;
535
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
536
+ },
537
+ __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function (arg0, arg1) {
538
+ const ret = debugString(arg1);
539
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
540
+ const len1 = WASM_VECTOR_LEN;
541
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
542
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
543
+ },
544
+ __wbg___wbindgen_in_50072d4d6e45c193: function (arg0, arg1) {
545
+ const ret = arg0 in arg1;
546
+ return ret;
547
+ },
548
+ __wbg___wbindgen_is_bigint_60fc0336cb14f5d7: function (arg0) {
549
+ const ret = typeof (arg0) === 'bigint';
550
+ return ret;
551
+ },
552
+ __wbg___wbindgen_is_function_fcda5e3902d732fe: function (arg0) {
553
+ const ret = typeof (arg0) === 'function';
554
+ return ret;
555
+ },
556
+ __wbg___wbindgen_is_object_edb6b15aa3afe12e: function (arg0) {
557
+ const val = arg0;
558
+ const ret = typeof (val) === 'object' && val !== null;
559
+ return ret;
560
+ },
561
+ __wbg___wbindgen_is_string_c4f7cb494a2a21f1: function (arg0) {
562
+ const ret = typeof (arg0) === 'string';
563
+ return ret;
564
+ },
565
+ __wbg___wbindgen_is_undefined_8c687d0b90d5b524: function (arg0) {
566
+ const ret = arg0 === undefined;
567
+ return ret;
568
+ },
569
+ __wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b: function (arg0, arg1) {
570
+ const ret = arg0 === arg1;
571
+ return ret;
572
+ },
573
+ __wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd: function (arg0, arg1) {
574
+ const ret = arg0 == arg1;
575
+ return ret;
576
+ },
577
+ __wbg___wbindgen_number_get_1dc732b810cb937c: function (arg0, arg1) {
578
+ const obj = arg1;
579
+ const ret = typeof (obj) === 'number' ? obj : undefined;
580
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
581
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
582
+ },
583
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function (arg0, arg1) {
584
+ const obj = arg1;
585
+ const ret = typeof (obj) === 'string' ? obj : undefined;
586
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
587
+ var len1 = WASM_VECTOR_LEN;
588
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
589
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
590
+ },
591
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function (arg0, arg1) {
592
+ throw new Error(getStringFromWasm0(arg0, arg1));
593
+ },
594
+ __wbg_call_269c5566fbede3eb: function () {
595
+ return handleError(function (arg0, arg1) {
596
+ const ret = arg0.call(arg1);
597
+ return ret;
598
+ }, arguments);
599
+ },
600
+ __wbg_done_cffed884d87aa22e: function (arg0) {
601
+ const ret = arg0.done;
602
+ return ret;
603
+ },
604
+ __wbg_entries_972a87586902cf87: function (arg0) {
605
+ const ret = Object.entries(arg0);
606
+ return ret;
607
+ },
608
+ __wbg_get_6cf5a4d4d8ad3c5a: function () {
609
+ return handleError(function (arg0, arg1) {
610
+ const ret = Reflect.get(arg0, arg1);
611
+ return ret;
612
+ }, arguments);
613
+ },
614
+ __wbg_get_b1f0ab13c737f856: function (arg0, arg1) {
615
+ const ret = arg0[arg1 >>> 0];
616
+ return ret;
617
+ },
618
+ __wbg_get_unchecked_363572bdd397d473: function (arg0, arg1) {
619
+ const ret = arg0[arg1 >>> 0];
620
+ return ret;
621
+ },
622
+ __wbg_get_with_ref_key_6412cf3094599694: function (arg0, arg1) {
623
+ const ret = arg0[arg1];
624
+ return ret;
625
+ },
626
+ __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae: function (arg0) {
627
+ let result;
628
+ try {
629
+ result = arg0 instanceof ArrayBuffer;
630
+ }
631
+ catch (_) {
632
+ result = false;
633
+ }
634
+ const ret = result;
635
+ return ret;
636
+ },
637
+ __wbg_instanceof_Map_1ff6a2b54c899f0d: function (arg0) {
638
+ let result;
639
+ try {
640
+ result = arg0 instanceof Map;
641
+ }
642
+ catch (_) {
643
+ result = false;
644
+ }
645
+ const ret = result;
646
+ return ret;
647
+ },
648
+ __wbg_instanceof_Uint8Array_598adc0fef426aa8: function (arg0) {
649
+ let result;
650
+ try {
651
+ result = arg0 instanceof Uint8Array;
652
+ }
653
+ catch (_) {
654
+ result = false;
655
+ }
656
+ const ret = result;
657
+ return ret;
658
+ },
659
+ __wbg_isArray_5674713bb7b79043: function (arg0) {
660
+ const ret = Array.isArray(arg0);
661
+ return ret;
662
+ },
663
+ __wbg_isSafeInteger_8f51c743827d1ec5: function (arg0) {
664
+ const ret = Number.isSafeInteger(arg0);
665
+ return ret;
666
+ },
667
+ __wbg_iterator_22ddeb808cf55a6f: function () {
668
+ const ret = Symbol.iterator;
669
+ return ret;
670
+ },
671
+ __wbg_length_31bdaf014f5fbde2: function (arg0) {
672
+ const ret = arg0.length;
673
+ return ret;
674
+ },
675
+ __wbg_length_4e1adc0d42e23620: function (arg0) {
676
+ const ret = arg0.length;
677
+ return ret;
678
+ },
679
+ __wbg_new_1da3429bc3c4541c: function (arg0) {
680
+ const ret = new Uint8Array(arg0);
681
+ return ret;
682
+ },
683
+ __wbg_new_8d36e20aa758e411: function () {
684
+ const ret = new Map();
685
+ return ret;
686
+ },
687
+ __wbg_new_bebc3f4757acf305: function () {
688
+ const ret = new Object();
689
+ return ret;
690
+ },
691
+ __wbg_new_ffa92086ea89f79c: function () {
692
+ const ret = new Array();
693
+ return ret;
694
+ },
695
+ __wbg_next_95053e306b1c3aed: function (arg0) {
696
+ const ret = arg0.next;
697
+ return ret;
698
+ },
699
+ __wbg_next_f31ecb8646d2c605: function () {
700
+ return handleError(function (arg0) {
701
+ const ret = arg0.next();
702
+ return ret;
703
+ }, arguments);
704
+ },
705
+ __wbg_prototypesetcall_ae9f5e7459250748: function (arg0, arg1, arg2) {
706
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
707
+ },
708
+ __wbg_set_13d25b81ab403f5e: function (arg0, arg1, arg2) {
709
+ arg0[arg1 >>> 0] = arg2;
710
+ },
711
+ __wbg_set_6be42768c690e380: function (arg0, arg1, arg2) {
712
+ arg0[arg1] = arg2;
713
+ },
714
+ __wbg_set_bf6dde4923b9b059: function (arg0, arg1, arg2) {
715
+ const ret = arg0.set(arg1, arg2);
716
+ return ret;
717
+ },
718
+ __wbg_value_c227f843d21da141: function (arg0) {
719
+ const ret = arg0.value;
720
+ return ret;
721
+ },
722
+ __wbindgen_generic_0000000000000001: function (arg0) {
723
+ // Cast intrinsic for `F64 -> Externref`.
724
+ const ret = arg0;
725
+ return ret;
726
+ },
727
+ __wbindgen_generic_0000000000000002: function (arg0) {
728
+ // Cast intrinsic for `I64 -> Externref`.
729
+ const ret = arg0;
730
+ return ret;
731
+ },
732
+ __wbindgen_generic_0000000000000003: function (arg0, arg1) {
733
+ // Cast intrinsic for `Ref(String) -> Externref`.
734
+ const ret = getStringFromWasm0(arg0, arg1);
735
+ return ret;
736
+ },
737
+ __wbindgen_generic_0000000000000004: function (arg0) {
738
+ // Cast intrinsic for `U64 -> Externref`.
739
+ const ret = BigInt.asUintN(64, arg0);
740
+ return ret;
741
+ },
742
+ __wbindgen_init_externref_table: function () {
743
+ const table = wasm.__wbindgen_externrefs;
744
+ const offset = table.grow(4);
745
+ table.set(0, undefined);
746
+ table.set(offset + 0, undefined);
747
+ table.set(offset + 1, null);
748
+ table.set(offset + 2, true);
749
+ table.set(offset + 3, false);
750
+ },
751
+ };
752
+ return {
753
+ __proto__: null,
754
+ "./bota_device_sdk_core_bg.js": import0,
755
+ };
756
+ }
757
+ const WebCoreBridgeFinalization = (typeof FinalizationRegistry === 'undefined')
758
+ ? { register: () => { }, unregister: () => { } }
759
+ : new FinalizationRegistry(ptr => wasm.__wbg_webcorebridge_free(ptr, 1));
760
+ const WebIntegrityHasherFinalization = (typeof FinalizationRegistry === 'undefined')
761
+ ? { register: () => { }, unregister: () => { } }
762
+ : new FinalizationRegistry(ptr => wasm.__wbg_webintegrityhasher_free(ptr, 1));
763
+ function addToExternrefTable0(obj) {
764
+ const idx = wasm.__externref_table_alloc();
765
+ wasm.__wbindgen_externrefs.set(idx, obj);
766
+ return idx;
767
+ }
768
+ function debugString(val) {
769
+ // primitive types
770
+ const type = typeof val;
771
+ if (type == 'number' || type == 'boolean' || val == null) {
772
+ return `${val}`;
773
+ }
774
+ if (type == 'string') {
775
+ return `"${val}"`;
776
+ }
777
+ if (type == 'symbol') {
778
+ const description = val.description;
779
+ if (description == null) {
780
+ return 'Symbol';
781
+ }
782
+ else {
783
+ return `Symbol(${description})`;
784
+ }
785
+ }
786
+ if (type == 'function') {
787
+ const name = val.name;
788
+ if (typeof name == 'string' && name.length > 0) {
789
+ return `Function(${name})`;
790
+ }
791
+ else {
792
+ return 'Function';
793
+ }
794
+ }
795
+ // objects
796
+ if (Array.isArray(val)) {
797
+ const length = val.length;
798
+ let debug = '[';
799
+ if (length > 0) {
800
+ debug += debugString(val[0]);
801
+ }
802
+ for (let i = 1; i < length; i++) {
803
+ debug += ', ' + debugString(val[i]);
804
+ }
805
+ debug += ']';
806
+ return debug;
807
+ }
808
+ // Test for built-in
809
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
810
+ let className;
811
+ if (builtInMatches && builtInMatches.length > 1) {
812
+ className = builtInMatches[1];
813
+ }
814
+ else {
815
+ // Failed to match the standard '[object ClassName]'
816
+ return toString.call(val);
817
+ }
818
+ if (className == 'Object') {
819
+ // we're a user defined class or Object
820
+ // JSON.stringify avoids problems with cycles, and is generally much
821
+ // easier than looping through ownProperties of `val`.
822
+ try {
823
+ return 'Object(' + JSON.stringify(val) + ')';
824
+ }
825
+ catch (_) {
826
+ return 'Object';
827
+ }
828
+ }
829
+ // errors
830
+ if (val instanceof Error) {
831
+ return `${val.name}: ${val.message}\n${val.stack}`;
832
+ }
833
+ // TODO we could test for more things here, like `Set`s and `Map`s.
834
+ return className;
835
+ }
836
+ function getArrayU8FromWasm0(ptr, len) {
837
+ ptr = ptr >>> 0;
838
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
839
+ }
840
+ let cachedDataViewMemory0 = null;
841
+ function getDataViewMemory0() {
842
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
843
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
844
+ }
845
+ return cachedDataViewMemory0;
846
+ }
847
+ function getStringFromWasm0(ptr, len) {
848
+ return decodeText(ptr >>> 0, len);
849
+ }
850
+ let cachedUint8ArrayMemory0 = null;
851
+ function getUint8ArrayMemory0() {
852
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
853
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
854
+ }
855
+ return cachedUint8ArrayMemory0;
856
+ }
857
+ function handleError(f, args) {
858
+ try {
859
+ return f.apply(this, args);
860
+ }
861
+ catch (e) {
862
+ const idx = addToExternrefTable0(e);
863
+ wasm.__wbindgen_exn_store(idx);
864
+ }
865
+ }
866
+ function isLikeNone(x) {
867
+ return x === undefined || x === null;
868
+ }
869
+ function passArray8ToWasm0(arg, malloc) {
870
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
871
+ getUint8ArrayMemory0().set(arg, ptr / 1);
872
+ WASM_VECTOR_LEN = arg.length;
873
+ return ptr;
874
+ }
875
+ function passStringToWasm0(arg, malloc, realloc) {
876
+ if (realloc === undefined) {
877
+ const buf = cachedTextEncoder.encode(arg);
878
+ const ptr = malloc(buf.length, 1) >>> 0;
879
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
880
+ WASM_VECTOR_LEN = buf.length;
881
+ return ptr;
882
+ }
883
+ let len = arg.length;
884
+ let ptr = malloc(len, 1) >>> 0;
885
+ const mem = getUint8ArrayMemory0();
886
+ let offset = 0;
887
+ for (; offset < len; offset++) {
888
+ const code = arg.charCodeAt(offset);
889
+ if (code > 0x7F)
890
+ break;
891
+ mem[ptr + offset] = code;
892
+ }
893
+ if (offset !== len) {
894
+ if (offset !== 0) {
895
+ arg = arg.slice(offset);
896
+ }
897
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
898
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
899
+ const ret = cachedTextEncoder.encodeInto(arg, view);
900
+ offset += ret.written;
901
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
902
+ }
903
+ WASM_VECTOR_LEN = offset;
904
+ return ptr;
905
+ }
906
+ function takeFromExternrefTable0(idx) {
907
+ const value = wasm.__wbindgen_externrefs.get(idx);
908
+ wasm.__externref_table_dealloc(idx);
909
+ return value;
910
+ }
911
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
912
+ cachedTextDecoder.decode();
913
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
914
+ let numBytesDecoded = 0;
915
+ function decodeText(ptr, len) {
916
+ numBytesDecoded += len;
917
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
918
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
919
+ cachedTextDecoder.decode();
920
+ numBytesDecoded = len;
921
+ }
922
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
923
+ }
924
+ const cachedTextEncoder = new TextEncoder();
925
+ if (!('encodeInto' in cachedTextEncoder)) {
926
+ cachedTextEncoder.encodeInto = function (arg, view) {
927
+ const buf = cachedTextEncoder.encode(arg);
928
+ view.set(buf);
929
+ return {
930
+ read: arg.length,
931
+ written: buf.length
932
+ };
933
+ };
934
+ }
935
+ let WASM_VECTOR_LEN = 0;
936
+ let wasmModule, wasmInstance, wasm;
937
+ function __wbg_finalize_init(instance, module) {
938
+ wasmInstance = instance;
939
+ wasm = instance.exports;
940
+ wasmModule = module;
941
+ cachedDataViewMemory0 = null;
942
+ cachedUint8ArrayMemory0 = null;
943
+ wasm.__wbindgen_start();
944
+ return wasm;
945
+ }
946
+ async function __wbg_load(module, imports) {
947
+ if (typeof Response === 'function' && module instanceof Response) {
948
+ if (!module.ok) {
949
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
950
+ }
951
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
952
+ try {
953
+ return await WebAssembly.instantiateStreaming(module, imports);
954
+ }
955
+ catch (e) {
956
+ const validResponse = expectedResponseType(module.type);
957
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
958
+ 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);
959
+ }
960
+ else {
961
+ throw e;
962
+ }
963
+ }
964
+ }
965
+ const bytes = await module.arrayBuffer();
966
+ return await WebAssembly.instantiate(bytes, imports);
967
+ }
968
+ else {
969
+ const instance = await WebAssembly.instantiate(module, imports);
970
+ if (instance instanceof WebAssembly.Instance) {
971
+ return { instance, module };
972
+ }
973
+ else {
974
+ return instance;
975
+ }
976
+ }
977
+ function expectedResponseType(type) {
978
+ switch (type) {
979
+ case 'basic':
980
+ case 'cors':
981
+ case 'default': return true;
982
+ }
983
+ return false;
984
+ }
985
+ }
986
+ function initSync(module) {
987
+ if (wasm !== undefined)
988
+ return wasm;
989
+ if (module !== undefined) {
990
+ if (Object.getPrototypeOf(module) === Object.prototype) {
991
+ ({ module } = module);
992
+ }
993
+ else {
994
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
995
+ }
996
+ }
997
+ const imports = __wbg_get_imports();
998
+ if (!(module instanceof WebAssembly.Module)) {
999
+ module = new WebAssembly.Module(module);
1000
+ }
1001
+ const instance = new WebAssembly.Instance(module, imports);
1002
+ return __wbg_finalize_init(instance, module);
1003
+ }
1004
+ async function __wbg_init(module_or_path) {
1005
+ if (wasm !== undefined)
1006
+ return wasm;
1007
+ if (module_or_path !== undefined) {
1008
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1009
+ ({ module_or_path } = module_or_path);
1010
+ }
1011
+ else {
1012
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead');
1013
+ }
1014
+ }
1015
+ if (module_or_path === undefined) {
1016
+ module_or_path = new URL('bota_device_sdk_core_bg.wasm', import.meta.url);
1017
+ }
1018
+ const imports = __wbg_get_imports();
1019
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1020
+ module_or_path = fetch(module_or_path);
1021
+ }
1022
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1023
+ return __wbg_finalize_init(instance, module);
1024
+ }
1025
+ export { initSync, __wbg_init as default };