phirepass-widgets 0.0.41 → 0.0.43

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 (38) hide show
  1. package/dist/cjs/{index-Rxdu9QG2.js → index-DTAHGGCM.js} +111 -44
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +225 -3
  4. package/dist/cjs/phirepass-terminal.cjs.entry.js +31 -815
  5. package/dist/cjs/phirepass-widgets.cjs.js +3 -3
  6. package/dist/cjs/protocol-C4R_gGQV.js +801 -0
  7. package/dist/collection/collection-manifest.json +1 -1
  8. package/dist/collection/common/protocol.js +20 -0
  9. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +142 -1
  10. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +509 -1
  11. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.logo.svg +6 -0
  12. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.max.svg +8 -0
  13. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +13 -21
  14. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  15. package/dist/components/index.js +1 -1
  16. package/dist/components/p-DgZMmpg7.js +1 -0
  17. package/dist/components/phirepass-sftp-client.js +1 -1
  18. package/dist/components/phirepass-terminal.js +5 -5
  19. package/dist/esm/{index-C8ZFkLEv.js → index-D6RLmr6w.js} +111 -44
  20. package/dist/esm/loader.js +3 -3
  21. package/dist/esm/phirepass-sftp-client.entry.js +225 -3
  22. package/dist/esm/phirepass-terminal.entry.js +10 -793
  23. package/dist/esm/phirepass-widgets.js +4 -4
  24. package/dist/esm/protocol-DgZMmpg7.js +796 -0
  25. package/dist/phirepass-widgets/p-4e32fef4.entry.js +49 -0
  26. package/dist/phirepass-widgets/p-79a71767.entry.js +1 -0
  27. package/dist/phirepass-widgets/p-D6RLmr6w.js +2 -0
  28. package/dist/phirepass-widgets/p-DgZMmpg7.js +1 -0
  29. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  30. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  31. package/dist/types/common/protocol.d.ts +17 -0
  32. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +42 -0
  33. package/dist/types/components/phirepass-terminal/phirepass-terminal.d.ts +1 -6
  34. package/dist/types/components.d.ts +97 -1
  35. package/package.json +5 -5
  36. package/dist/phirepass-widgets/p-2f3f0b69.entry.js +0 -49
  37. package/dist/phirepass-widgets/p-376ef3af.entry.js +0 -1
  38. package/dist/phirepass-widgets/p-C8ZFkLEv.js +0 -2
@@ -0,0 +1,796 @@
1
+ /* @ts-self-types="./phirepass-channel.d.ts" */
2
+
3
+ class Channel {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ ChannelFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_channel_free(ptr, 0);
13
+ }
14
+ /**
15
+ * @param {string} token
16
+ * @param {string} node_id
17
+ * @param {number | null} [msg_id]
18
+ */
19
+ authenticate(token, node_id, msg_id) {
20
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
21
+ const len0 = WASM_VECTOR_LEN;
22
+ const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
23
+ const len1 = WASM_VECTOR_LEN;
24
+ wasm.channel_authenticate(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
25
+ }
26
+ connect() {
27
+ wasm.channel_connect(this.__wbg_ptr);
28
+ }
29
+ disconnect() {
30
+ wasm.channel_disconnect(this.__wbg_ptr);
31
+ }
32
+ /**
33
+ * @returns {boolean}
34
+ */
35
+ is_connected() {
36
+ const ret = wasm.channel_is_connected(this.__wbg_ptr);
37
+ return ret !== 0;
38
+ }
39
+ /**
40
+ * @returns {boolean}
41
+ */
42
+ is_disconnected() {
43
+ const ret = wasm.channel_is_disconnected(this.__wbg_ptr);
44
+ return ret !== 0;
45
+ }
46
+ /**
47
+ * @param {string} endpoint
48
+ * @param {string} node_id
49
+ * @param {string | null} [server_id]
50
+ */
51
+ constructor(endpoint, node_id, server_id) {
52
+ const ptr0 = passStringToWasm0(endpoint, wasm.__wbindgen_export, wasm.__wbindgen_export2);
53
+ const len0 = WASM_VECTOR_LEN;
54
+ const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
55
+ const len1 = WASM_VECTOR_LEN;
56
+ var ptr2 = isLikeNone(server_id) ? 0 : passStringToWasm0(server_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
57
+ var len2 = WASM_VECTOR_LEN;
58
+ const ret = wasm.channel_new(ptr0, len0, ptr1, len1, ptr2, len2);
59
+ this.__wbg_ptr = ret >>> 0;
60
+ ChannelFinalization.register(this, this.__wbg_ptr, this);
61
+ return this;
62
+ }
63
+ /**
64
+ * @param {Function | null} [cb]
65
+ */
66
+ on_connection_close(cb) {
67
+ wasm.channel_on_connection_close(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
68
+ }
69
+ /**
70
+ * @param {Function | null} [cb]
71
+ */
72
+ on_connection_error(cb) {
73
+ wasm.channel_on_connection_error(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
74
+ }
75
+ /**
76
+ * @param {Function | null} [cb]
77
+ */
78
+ on_connection_message(cb) {
79
+ wasm.channel_on_connection_message(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
80
+ }
81
+ /**
82
+ * @param {Function | null} [cb]
83
+ */
84
+ on_connection_open(cb) {
85
+ wasm.channel_on_connection_open(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
86
+ }
87
+ /**
88
+ * @param {Function | null} [cb]
89
+ */
90
+ on_protocol_message(cb) {
91
+ wasm.channel_on_protocol_message(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
92
+ }
93
+ /**
94
+ * @param {string} node_id
95
+ * @param {string | null} [username]
96
+ * @param {string | null} [password]
97
+ * @param {number | null} [msg_id]
98
+ */
99
+ open_sftp_tunnel(node_id, username, password, msg_id) {
100
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
101
+ const len0 = WASM_VECTOR_LEN;
102
+ var ptr1 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
103
+ var len1 = WASM_VECTOR_LEN;
104
+ var ptr2 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
105
+ var len2 = WASM_VECTOR_LEN;
106
+ wasm.channel_open_sftp_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
107
+ }
108
+ /**
109
+ * @param {string} node_id
110
+ * @param {string | null} [username]
111
+ * @param {string | null} [password]
112
+ * @param {number | null} [msg_id]
113
+ */
114
+ open_ssh_tunnel(node_id, username, password, msg_id) {
115
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
116
+ const len0 = WASM_VECTOR_LEN;
117
+ var ptr1 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
118
+ var len1 = WASM_VECTOR_LEN;
119
+ var ptr2 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
120
+ var len2 = WASM_VECTOR_LEN;
121
+ wasm.channel_open_ssh_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
122
+ }
123
+ /**
124
+ * @param {string} node_id
125
+ * @param {number} sid
126
+ * @param {string} path
127
+ * @param {string} filename
128
+ * @param {number | null} [msg_id]
129
+ */
130
+ send_sftp_delete(node_id, sid, path, filename, msg_id) {
131
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
132
+ const len0 = WASM_VECTOR_LEN;
133
+ const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
134
+ const len1 = WASM_VECTOR_LEN;
135
+ const ptr2 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
136
+ const len2 = WASM_VECTOR_LEN;
137
+ wasm.channel_send_sftp_delete(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
138
+ }
139
+ /**
140
+ * @param {string} node_id
141
+ * @param {number} sid
142
+ * @param {number} download_id
143
+ * @param {number} chunk_index
144
+ * @param {number | null} [msg_id]
145
+ */
146
+ send_sftp_download_chunk(node_id, sid, download_id, chunk_index, msg_id) {
147
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
148
+ const len0 = WASM_VECTOR_LEN;
149
+ wasm.channel_send_sftp_download_chunk(this.__wbg_ptr, ptr0, len0, sid, download_id, chunk_index, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
150
+ }
151
+ /**
152
+ * @param {string} node_id
153
+ * @param {number} sid
154
+ * @param {string} path
155
+ * @param {string} filename
156
+ * @param {number | null} [msg_id]
157
+ */
158
+ send_sftp_download_start(node_id, sid, path, filename, msg_id) {
159
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
+ const len1 = WASM_VECTOR_LEN;
163
+ const ptr2 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
164
+ const len2 = WASM_VECTOR_LEN;
165
+ wasm.channel_send_sftp_download_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
166
+ }
167
+ /**
168
+ * @param {string} node_id
169
+ * @param {number} sid
170
+ * @param {string} path
171
+ * @param {number | null} [msg_id]
172
+ */
173
+ send_sftp_list_data(node_id, sid, path, msg_id) {
174
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
175
+ const len0 = WASM_VECTOR_LEN;
176
+ const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
177
+ const len1 = WASM_VECTOR_LEN;
178
+ wasm.channel_send_sftp_list_data(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
179
+ }
180
+ /**
181
+ * @param {string} node_id
182
+ * @param {number} sid
183
+ * @param {number} upload_id
184
+ * @param {number} chunk_index
185
+ * @param {number} chunk_size
186
+ * @param {Uint8Array} data
187
+ * @param {number | null} [msg_id]
188
+ */
189
+ send_sftp_upload_chunk(node_id, sid, upload_id, chunk_index, chunk_size, data, msg_id) {
190
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
191
+ const len0 = WASM_VECTOR_LEN;
192
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
193
+ const len1 = WASM_VECTOR_LEN;
194
+ wasm.channel_send_sftp_upload_chunk(this.__wbg_ptr, ptr0, len0, sid, upload_id, chunk_index, chunk_size, ptr1, len1, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
195
+ }
196
+ /**
197
+ * @param {string} node_id
198
+ * @param {number} sid
199
+ * @param {string} filename
200
+ * @param {string} remote_path
201
+ * @param {number} total_chunks
202
+ * @param {bigint} total_size
203
+ * @param {number | null} [msg_id]
204
+ */
205
+ send_sftp_upload_start(node_id, sid, filename, remote_path, total_chunks, total_size, msg_id) {
206
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
207
+ const len0 = WASM_VECTOR_LEN;
208
+ const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
209
+ const len1 = WASM_VECTOR_LEN;
210
+ const ptr2 = passStringToWasm0(remote_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
211
+ const len2 = WASM_VECTOR_LEN;
212
+ wasm.channel_send_sftp_upload_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, total_chunks, total_size, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
213
+ }
214
+ /**
215
+ * @param {string} node_id
216
+ * @param {number} sid
217
+ * @param {number} cols
218
+ * @param {number} rows
219
+ * @param {number} px_width
220
+ * @param {number} px_height
221
+ */
222
+ send_ssh_terminal_resize(node_id, sid, cols, rows, px_width, px_height) {
223
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
224
+ const len0 = WASM_VECTOR_LEN;
225
+ wasm.channel_send_ssh_terminal_resize(this.__wbg_ptr, ptr0, len0, sid, cols, rows, px_width, px_height);
226
+ }
227
+ /**
228
+ * @param {string} node_id
229
+ * @param {number} sid
230
+ * @param {string} data
231
+ */
232
+ send_ssh_tunnel_data(node_id, sid, data) {
233
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
234
+ const len0 = WASM_VECTOR_LEN;
235
+ const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
236
+ const len1 = WASM_VECTOR_LEN;
237
+ wasm.channel_send_ssh_tunnel_data(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1);
238
+ }
239
+ /**
240
+ * @param {number} interval_as_millis
241
+ */
242
+ start_heartbeat(interval_as_millis) {
243
+ wasm.channel_start_heartbeat(this.__wbg_ptr, interval_as_millis);
244
+ }
245
+ stop_heartbeat() {
246
+ wasm.channel_stop_heartbeat(this.__wbg_ptr);
247
+ }
248
+ }
249
+ if (Symbol.dispose) Channel.prototype[Symbol.dispose] = Channel.prototype.free;
250
+
251
+ /**
252
+ * @enum {0 | 10 | 100 | 110 | 120}
253
+ */
254
+ const ErrorType = Object.freeze({
255
+ Generic: 0, "0": "Generic",
256
+ Authentication: 10, "10": "Authentication",
257
+ RequiresUsername: 100, "100": "RequiresUsername",
258
+ RequiresPassword: 110, "110": "RequiresPassword",
259
+ RequiresUsernamePassword: 120, "120": "RequiresUsernamePassword",
260
+ });
261
+ function __wbg_get_imports() {
262
+ const import0 = {
263
+ __proto__: null,
264
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
265
+ const ret = Error(getStringFromWasm0(arg0, arg1));
266
+ return addHeapObject(ret);
267
+ },
268
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
269
+ const ret = String(getObject(arg1));
270
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
271
+ const len1 = WASM_VECTOR_LEN;
272
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
273
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
274
+ },
275
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
276
+ const ret = debugString(getObject(arg1));
277
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
278
+ const len1 = WASM_VECTOR_LEN;
279
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
280
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
281
+ },
282
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
283
+ const obj = getObject(arg1);
284
+ const ret = typeof(obj) === 'string' ? obj : undefined;
285
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
286
+ var len1 = WASM_VECTOR_LEN;
287
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
288
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
289
+ },
290
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
291
+ throw new Error(getStringFromWasm0(arg0, arg1));
292
+ },
293
+ __wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
294
+ getObject(arg0)._wbg_cb_unref();
295
+ },
296
+ __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
297
+ const ret = getObject(arg0).call(getObject(arg1));
298
+ return addHeapObject(ret);
299
+ }, arguments); },
300
+ __wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
301
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
302
+ return addHeapObject(ret);
303
+ }, arguments); },
304
+ __wbg_clearInterval_26ba580547547579: function(arg0) {
305
+ const ret = clearInterval(takeObject(arg0));
306
+ return addHeapObject(ret);
307
+ },
308
+ __wbg_close_88106990eea7f544: function() { return handleError(function (arg0) {
309
+ getObject(arg0).close();
310
+ }, arguments); },
311
+ __wbg_data_bb9dffdd1e99cf2d: function(arg0) {
312
+ const ret = getObject(arg0).data;
313
+ return addHeapObject(ret);
314
+ },
315
+ __wbg_from_0dbf29f09e7fb200: function(arg0) {
316
+ const ret = Array.from(getObject(arg0));
317
+ return addHeapObject(ret);
318
+ },
319
+ __wbg_info_28c8c91558eab232: function(arg0, arg1) {
320
+ console.info(getStringFromWasm0(arg0, arg1));
321
+ },
322
+ __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
323
+ let result;
324
+ try {
325
+ result = getObject(arg0) instanceof ArrayBuffer;
326
+ } catch (_) {
327
+ result = false;
328
+ }
329
+ const ret = result;
330
+ return ret;
331
+ },
332
+ __wbg_length_9f1775224cf1d815: function(arg0) {
333
+ const ret = getObject(arg0).length;
334
+ return ret;
335
+ },
336
+ __wbg_new_0c7403db6e782f19: function(arg0) {
337
+ const ret = new Uint8Array(getObject(arg0));
338
+ return addHeapObject(ret);
339
+ },
340
+ __wbg_new_682678e2f47e32bc: function() {
341
+ const ret = new Array();
342
+ return addHeapObject(ret);
343
+ },
344
+ __wbg_new_aa8d0fa9762c29bd: function() {
345
+ const ret = new Object();
346
+ return addHeapObject(ret);
347
+ },
348
+ __wbg_new_with_str_sequence_6453b755acdcc2e7: function() { return handleError(function (arg0, arg1, arg2) {
349
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));
350
+ return addHeapObject(ret);
351
+ }, arguments); },
352
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
353
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
354
+ },
355
+ __wbg_push_471a5b068a5295f6: function(arg0, arg1) {
356
+ const ret = getObject(arg0).push(getObject(arg1));
357
+ return ret;
358
+ },
359
+ __wbg_readyState_c78e609c7de3b381: function(arg0) {
360
+ const ret = getObject(arg0).readyState;
361
+ return ret;
362
+ },
363
+ __wbg_send_186c85704c7f2d00: function() { return handleError(function (arg0, arg1, arg2) {
364
+ getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
365
+ }, arguments); },
366
+ __wbg_setInterval_cbf1c35c6a692d37: function() { return handleError(function (arg0, arg1) {
367
+ const ret = setInterval(getObject(arg0), arg1);
368
+ return addHeapObject(ret);
369
+ }, arguments); },
370
+ __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
371
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
372
+ },
373
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
374
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
375
+ },
376
+ __wbg_set_binaryType_770e68648ca5e83d: function(arg0, arg1) {
377
+ getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
378
+ },
379
+ __wbg_set_onclose_17fa3bbcc4ba3541: function(arg0, arg1) {
380
+ getObject(arg0).onclose = getObject(arg1);
381
+ },
382
+ __wbg_set_onerror_da99c4232662a084: function(arg0, arg1) {
383
+ getObject(arg0).onerror = getObject(arg1);
384
+ },
385
+ __wbg_set_onmessage_c1db358b9c38e3f1: function(arg0, arg1) {
386
+ getObject(arg0).onmessage = getObject(arg1);
387
+ },
388
+ __wbg_set_onopen_cd47b8fb1d92dee9: function(arg0, arg1) {
389
+ getObject(arg0).onopen = getObject(arg1);
390
+ },
391
+ __wbg_warn_7b0e6adca8922a5f: function(arg0, arg1) {
392
+ console.warn(getStringFromWasm0(arg0, arg1));
393
+ },
394
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
395
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
396
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_41);
397
+ return addHeapObject(ret);
398
+ },
399
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
400
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
401
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_41_1);
402
+ return addHeapObject(ret);
403
+ },
404
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
405
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
406
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_41_2);
407
+ return addHeapObject(ret);
408
+ },
409
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
410
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
411
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_39);
412
+ return addHeapObject(ret);
413
+ },
414
+ __wbindgen_cast_0000000000000005: function(arg0) {
415
+ // Cast intrinsic for `F64 -> Externref`.
416
+ const ret = arg0;
417
+ return addHeapObject(ret);
418
+ },
419
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
420
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
421
+ const ret = getArrayU8FromWasm0(arg0, arg1);
422
+ return addHeapObject(ret);
423
+ },
424
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
425
+ // Cast intrinsic for `Ref(String) -> Externref`.
426
+ const ret = getStringFromWasm0(arg0, arg1);
427
+ return addHeapObject(ret);
428
+ },
429
+ __wbindgen_cast_0000000000000008: function(arg0) {
430
+ // Cast intrinsic for `U64 -> Externref`.
431
+ const ret = BigInt.asUintN(64, arg0);
432
+ return addHeapObject(ret);
433
+ },
434
+ __wbindgen_object_clone_ref: function(arg0) {
435
+ const ret = getObject(arg0);
436
+ return addHeapObject(ret);
437
+ },
438
+ __wbindgen_object_drop_ref: function(arg0) {
439
+ takeObject(arg0);
440
+ },
441
+ };
442
+ return {
443
+ __proto__: null,
444
+ "./phirepass-channel_bg.js": import0,
445
+ };
446
+ }
447
+
448
+ function __wasm_bindgen_func_elem_39(arg0, arg1) {
449
+ wasm.__wasm_bindgen_func_elem_39(arg0, arg1);
450
+ }
451
+
452
+ function __wasm_bindgen_func_elem_41(arg0, arg1, arg2) {
453
+ wasm.__wasm_bindgen_func_elem_41(arg0, arg1, addHeapObject(arg2));
454
+ }
455
+
456
+ function __wasm_bindgen_func_elem_41_1(arg0, arg1, arg2) {
457
+ wasm.__wasm_bindgen_func_elem_41_1(arg0, arg1, addHeapObject(arg2));
458
+ }
459
+
460
+ function __wasm_bindgen_func_elem_41_2(arg0, arg1, arg2) {
461
+ wasm.__wasm_bindgen_func_elem_41_2(arg0, arg1, addHeapObject(arg2));
462
+ }
463
+
464
+
465
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
466
+ const ChannelFinalization = (typeof FinalizationRegistry === 'undefined')
467
+ ? { register: () => {}, unregister: () => {} }
468
+ : new FinalizationRegistry(ptr => wasm.__wbg_channel_free(ptr >>> 0, 1));
469
+
470
+ function addHeapObject(obj) {
471
+ if (heap_next === heap.length) heap.push(heap.length + 1);
472
+ const idx = heap_next;
473
+ heap_next = heap[idx];
474
+
475
+ heap[idx] = obj;
476
+ return idx;
477
+ }
478
+
479
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
480
+ ? { register: () => {}, unregister: () => {} }
481
+ : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
482
+
483
+ function debugString(val) {
484
+ // primitive types
485
+ const type = typeof val;
486
+ if (type == 'number' || type == 'boolean' || val == null) {
487
+ return `${val}`;
488
+ }
489
+ if (type == 'string') {
490
+ return `"${val}"`;
491
+ }
492
+ if (type == 'symbol') {
493
+ const description = val.description;
494
+ if (description == null) {
495
+ return 'Symbol';
496
+ } else {
497
+ return `Symbol(${description})`;
498
+ }
499
+ }
500
+ if (type == 'function') {
501
+ const name = val.name;
502
+ if (typeof name == 'string' && name.length > 0) {
503
+ return `Function(${name})`;
504
+ } else {
505
+ return 'Function';
506
+ }
507
+ }
508
+ // objects
509
+ if (Array.isArray(val)) {
510
+ const length = val.length;
511
+ let debug = '[';
512
+ if (length > 0) {
513
+ debug += debugString(val[0]);
514
+ }
515
+ for(let i = 1; i < length; i++) {
516
+ debug += ', ' + debugString(val[i]);
517
+ }
518
+ debug += ']';
519
+ return debug;
520
+ }
521
+ // Test for built-in
522
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
523
+ let className;
524
+ if (builtInMatches && builtInMatches.length > 1) {
525
+ className = builtInMatches[1];
526
+ } else {
527
+ // Failed to match the standard '[object ClassName]'
528
+ return toString.call(val);
529
+ }
530
+ if (className == 'Object') {
531
+ // we're a user defined class or Object
532
+ // JSON.stringify avoids problems with cycles, and is generally much
533
+ // easier than looping through ownProperties of `val`.
534
+ try {
535
+ return 'Object(' + JSON.stringify(val) + ')';
536
+ } catch (_) {
537
+ return 'Object';
538
+ }
539
+ }
540
+ // errors
541
+ if (val instanceof Error) {
542
+ return `${val.name}: ${val.message}\n${val.stack}`;
543
+ }
544
+ // TODO we could test for more things here, like `Set`s and `Map`s.
545
+ return className;
546
+ }
547
+
548
+ function dropObject(idx) {
549
+ if (idx < 1028) return;
550
+ heap[idx] = heap_next;
551
+ heap_next = idx;
552
+ }
553
+
554
+ function getArrayU8FromWasm0(ptr, len) {
555
+ ptr = ptr >>> 0;
556
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
557
+ }
558
+
559
+ let cachedDataViewMemory0 = null;
560
+ function getDataViewMemory0() {
561
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
562
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
563
+ }
564
+ return cachedDataViewMemory0;
565
+ }
566
+
567
+ function getStringFromWasm0(ptr, len) {
568
+ ptr = ptr >>> 0;
569
+ return decodeText(ptr, len);
570
+ }
571
+
572
+ let cachedUint8ArrayMemory0 = null;
573
+ function getUint8ArrayMemory0() {
574
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
575
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
576
+ }
577
+ return cachedUint8ArrayMemory0;
578
+ }
579
+
580
+ function getObject(idx) { return heap[idx]; }
581
+
582
+ function handleError(f, args) {
583
+ try {
584
+ return f.apply(this, args);
585
+ } catch (e) {
586
+ wasm.__wbindgen_export3(addHeapObject(e));
587
+ }
588
+ }
589
+
590
+ let heap = new Array(1024).fill(undefined);
591
+ heap.push(undefined, null, true, false);
592
+
593
+ let heap_next = heap.length;
594
+
595
+ function isLikeNone(x) {
596
+ return x === undefined || x === null;
597
+ }
598
+
599
+ function makeMutClosure(arg0, arg1, f) {
600
+ const state = { a: arg0, b: arg1, cnt: 1 };
601
+ const real = (...args) => {
602
+
603
+ // First up with a closure we increment the internal reference
604
+ // count. This ensures that the Rust closure environment won't
605
+ // be deallocated while we're invoking it.
606
+ state.cnt++;
607
+ const a = state.a;
608
+ state.a = 0;
609
+ try {
610
+ return f(a, state.b, ...args);
611
+ } finally {
612
+ state.a = a;
613
+ real._wbg_cb_unref();
614
+ }
615
+ };
616
+ real._wbg_cb_unref = () => {
617
+ if (--state.cnt === 0) {
618
+ wasm.__wbindgen_export4(state.a, state.b);
619
+ state.a = 0;
620
+ CLOSURE_DTORS.unregister(state);
621
+ }
622
+ };
623
+ CLOSURE_DTORS.register(real, state, state);
624
+ return real;
625
+ }
626
+
627
+ function passArray8ToWasm0(arg, malloc) {
628
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
629
+ getUint8ArrayMemory0().set(arg, ptr / 1);
630
+ WASM_VECTOR_LEN = arg.length;
631
+ return ptr;
632
+ }
633
+
634
+ function passStringToWasm0(arg, malloc, realloc) {
635
+ if (realloc === undefined) {
636
+ const buf = cachedTextEncoder.encode(arg);
637
+ const ptr = malloc(buf.length, 1) >>> 0;
638
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
639
+ WASM_VECTOR_LEN = buf.length;
640
+ return ptr;
641
+ }
642
+
643
+ let len = arg.length;
644
+ let ptr = malloc(len, 1) >>> 0;
645
+
646
+ const mem = getUint8ArrayMemory0();
647
+
648
+ let offset = 0;
649
+
650
+ for (; offset < len; offset++) {
651
+ const code = arg.charCodeAt(offset);
652
+ if (code > 0x7F) break;
653
+ mem[ptr + offset] = code;
654
+ }
655
+ if (offset !== len) {
656
+ if (offset !== 0) {
657
+ arg = arg.slice(offset);
658
+ }
659
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
660
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
661
+ const ret = cachedTextEncoder.encodeInto(arg, view);
662
+
663
+ offset += ret.written;
664
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
665
+ }
666
+
667
+ WASM_VECTOR_LEN = offset;
668
+ return ptr;
669
+ }
670
+
671
+ function takeObject(idx) {
672
+ const ret = getObject(idx);
673
+ dropObject(idx);
674
+ return ret;
675
+ }
676
+
677
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
678
+ cachedTextDecoder.decode();
679
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
680
+ let numBytesDecoded = 0;
681
+ function decodeText(ptr, len) {
682
+ numBytesDecoded += len;
683
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
684
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
685
+ cachedTextDecoder.decode();
686
+ numBytesDecoded = len;
687
+ }
688
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
689
+ }
690
+
691
+ const cachedTextEncoder = new TextEncoder();
692
+
693
+ if (!('encodeInto' in cachedTextEncoder)) {
694
+ cachedTextEncoder.encodeInto = function (arg, view) {
695
+ const buf = cachedTextEncoder.encode(arg);
696
+ view.set(buf);
697
+ return {
698
+ read: arg.length,
699
+ written: buf.length
700
+ };
701
+ };
702
+ }
703
+
704
+ let WASM_VECTOR_LEN = 0;
705
+
706
+ let wasm;
707
+ function __wbg_finalize_init(instance, module) {
708
+ wasm = instance.exports;
709
+ cachedDataViewMemory0 = null;
710
+ cachedUint8ArrayMemory0 = null;
711
+ return wasm;
712
+ }
713
+
714
+ async function __wbg_load(module, imports) {
715
+ if (typeof Response === 'function' && module instanceof Response) {
716
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
717
+ try {
718
+ return await WebAssembly.instantiateStreaming(module, imports);
719
+ } catch (e) {
720
+ const validResponse = module.ok && expectedResponseType(module.type);
721
+
722
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
723
+ 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);
724
+
725
+ } else { throw e; }
726
+ }
727
+ }
728
+
729
+ const bytes = await module.arrayBuffer();
730
+ return await WebAssembly.instantiate(bytes, imports);
731
+ } else {
732
+ const instance = await WebAssembly.instantiate(module, imports);
733
+
734
+ if (instance instanceof WebAssembly.Instance) {
735
+ return { instance, module };
736
+ } else {
737
+ return instance;
738
+ }
739
+ }
740
+
741
+ function expectedResponseType(type) {
742
+ switch (type) {
743
+ case 'basic': case 'cors': case 'default': return true;
744
+ }
745
+ return false;
746
+ }
747
+ }
748
+
749
+ async function __wbg_init(module_or_path) {
750
+ if (wasm !== undefined) return wasm;
751
+
752
+
753
+ if (module_or_path !== undefined) {
754
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
755
+ ({module_or_path} = module_or_path);
756
+ } else {
757
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead');
758
+ }
759
+ }
760
+
761
+ if (module_or_path === undefined) {
762
+ module_or_path = new URL('phirepass-channel_bg.wasm', import.meta.url);
763
+ }
764
+ const imports = __wbg_get_imports();
765
+
766
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
767
+ module_or_path = fetch(module_or_path);
768
+ }
769
+
770
+ const { instance} = await __wbg_load(await module_or_path, imports);
771
+
772
+ return __wbg_finalize_init(instance);
773
+ }
774
+
775
+ var ProtocolMessageType;
776
+ (function (ProtocolMessageType) {
777
+ ProtocolMessageType["Error"] = "Error";
778
+ ProtocolMessageType["AuthSuccess"] = "AuthSuccess";
779
+ ProtocolMessageType["TunnelOpened"] = "TunnelOpened";
780
+ ProtocolMessageType["TunnelClosed"] = "TunnelClosed";
781
+ ProtocolMessageType["TunnelData"] = "TunnelData";
782
+ })(ProtocolMessageType || (ProtocolMessageType = {}));
783
+ var InputMode;
784
+ (function (InputMode) {
785
+ InputMode[InputMode["Username"] = 0] = "Username";
786
+ InputMode[InputMode["Password"] = 1] = "Password";
787
+ InputMode[InputMode["Default"] = 2] = "Default";
788
+ })(InputMode || (InputMode = {}));
789
+ var ConnectionState;
790
+ (function (ConnectionState) {
791
+ ConnectionState["Disconnected"] = "disconnected";
792
+ ConnectionState["Connected"] = "connected";
793
+ ConnectionState["Error"] = "error";
794
+ })(ConnectionState || (ConnectionState = {}));
795
+
796
+ export { Channel as C, ErrorType as E, InputMode as I, ProtocolMessageType as P, __wbg_init as _, ConnectionState as a };