phirepass-widgets 0.0.41 → 0.0.42

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