phirepass-widgets 0.0.112 → 0.0.114

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 (91) hide show
  1. package/README.md +33 -0
  2. package/dist/cjs/{index-B8w6l0VL.js → index-BCgmMoIq.js} +103 -32
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/phirepass-downloader_3.cjs.entry.js +3717 -0
  5. package/dist/cjs/phirepass-rdp.cjs.entry.js +18 -6
  6. package/dist/cjs/phirepass-terminal.cjs.entry.js +6 -5
  7. package/dist/cjs/phirepass-widgets.cjs.js +3 -3
  8. package/dist/cjs/protocol-CYh109n2.js +1472 -0
  9. package/dist/collection/collection-manifest.json +3 -1
  10. package/dist/collection/common/channel.js +21 -1
  11. package/dist/collection/common/fetch.js +44 -0
  12. package/dist/collection/components/phirepass-downloader/form.js +69 -0
  13. package/dist/collection/components/phirepass-downloader/format.js +105 -0
  14. package/dist/collection/components/phirepass-downloader/jobs.js +373 -0
  15. package/dist/collection/components/phirepass-downloader/phirepass-downloader.css +1109 -0
  16. package/dist/collection/components/phirepass-downloader/phirepass-downloader.js +1455 -0
  17. package/dist/collection/components/phirepass-downloader/source.js +120 -0
  18. package/dist/collection/components/phirepass-downloader/views/dialogs.js +34 -0
  19. package/dist/collection/components/phirepass-downloader/views/fetch-form.js +65 -0
  20. package/dist/collection/components/phirepass-downloader/views/icons.js +33 -0
  21. package/dist/collection/components/phirepass-downloader/views/job-row.js +91 -0
  22. package/dist/collection/components/phirepass-downloader/views/notices.js +15 -0
  23. package/dist/collection/components/phirepass-downloader/views/states.js +19 -0
  24. package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +216 -0
  25. package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +473 -0
  26. package/dist/collection/components/phirepass-media-player/player.js +94 -0
  27. package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +36 -13
  28. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +122 -0
  29. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.fetch.js +35 -0
  30. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +181 -31
  31. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
  32. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  33. package/dist/collection/testing/fixtures.js +219 -0
  34. package/dist/collection/testing/mock-channel.js +410 -0
  35. package/dist/components/index.js +1 -1
  36. package/dist/components/p-BtMWUitf.js +1 -0
  37. package/dist/components/p-C4cmk3bS.js +1 -0
  38. package/dist/components/p-CKnb-oeB.js +1 -0
  39. package/dist/components/phirepass-downloader.d.ts +11 -0
  40. package/dist/components/phirepass-downloader.js +1 -0
  41. package/dist/components/phirepass-media-player.d.ts +11 -0
  42. package/dist/components/phirepass-media-player.js +1 -0
  43. package/dist/components/phirepass-rdp.js +1 -1
  44. package/dist/components/phirepass-sftp-client.js +1 -1
  45. package/dist/components/phirepass-terminal.js +2 -2
  46. package/dist/esm/{index-DGq2b7rM.js → index-Dd9o0CbU.js} +103 -32
  47. package/dist/esm/loader.js +3 -3
  48. package/dist/esm/phirepass-downloader_3.entry.js +3713 -0
  49. package/dist/esm/phirepass-rdp.entry.js +18 -6
  50. package/dist/esm/phirepass-terminal.entry.js +6 -5
  51. package/dist/esm/phirepass-widgets.js +4 -4
  52. package/dist/esm/protocol-BtMWUitf.js +1467 -0
  53. package/dist/phirepass-widgets/p-97d84225.entry.js +1 -0
  54. package/dist/phirepass-widgets/p-BtMWUitf.js +1 -0
  55. package/dist/phirepass-widgets/p-Dd9o0CbU.js +3 -0
  56. package/dist/phirepass-widgets/p-a4a5e5f5.entry.js +1 -0
  57. package/dist/phirepass-widgets/{p-1fef5b5f.entry.js → p-a5ce104d.entry.js} +2 -2
  58. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  59. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  60. package/dist/types/common/channel.d.ts +30 -0
  61. package/dist/types/common/fetch.d.ts +167 -0
  62. package/dist/types/components/phirepass-downloader/form.d.ts +54 -0
  63. package/dist/types/components/phirepass-downloader/format.d.ts +17 -0
  64. package/dist/types/components/phirepass-downloader/jobs.d.ts +116 -0
  65. package/dist/types/components/phirepass-downloader/phirepass-downloader.d.ts +231 -0
  66. package/dist/types/components/phirepass-downloader/source.d.ts +61 -0
  67. package/dist/types/components/phirepass-downloader/views/dialogs.d.ts +52 -0
  68. package/dist/types/components/phirepass-downloader/views/fetch-form.d.ts +31 -0
  69. package/dist/types/components/phirepass-downloader/views/icons.d.ts +5 -0
  70. package/dist/types/components/phirepass-downloader/views/job-row.d.ts +21 -0
  71. package/dist/types/components/phirepass-downloader/views/notices.d.ts +18 -0
  72. package/dist/types/components/phirepass-downloader/views/states.d.ts +38 -0
  73. package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +67 -0
  74. package/dist/types/components/phirepass-media-player/player.d.ts +43 -0
  75. package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +10 -0
  76. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +30 -0
  77. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.fetch.d.ts +40 -0
  78. package/dist/types/components.d.ts +426 -34
  79. package/dist/types/stencil-public-runtime.d.ts +1 -1
  80. package/dist/types/testing/fixtures.d.ts +25 -0
  81. package/dist/types/testing/mock-channel.d.ts +132 -0
  82. package/package.json +26 -12
  83. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +0 -1469
  84. package/dist/cjs/protocol-COvteaUJ.js +0 -1044
  85. package/dist/components/p-Dur4cBX7.js +0 -1
  86. package/dist/esm/phirepass-sftp-client.entry.js +0 -1467
  87. package/dist/esm/protocol-Dur4cBX7.js +0 -1039
  88. package/dist/phirepass-widgets/p-8eb3ec24.entry.js +0 -1
  89. package/dist/phirepass-widgets/p-9a1f9b9f.entry.js +0 -1
  90. package/dist/phirepass-widgets/p-DGq2b7rM.js +0 -3
  91. package/dist/phirepass-widgets/p-Dur4cBX7.js +0 -1
@@ -1,1039 +0,0 @@
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) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
25
- }
26
- connect() {
27
- wasm.channel_connect(this.__wbg_ptr);
28
- }
29
- /**
30
- * @param {string} node_id
31
- * @param {string} kind
32
- * @param {string | null | undefined} name
33
- * @param {string} host
34
- * @param {number} port
35
- * @param {string | null} [username]
36
- * @param {string | null} [password]
37
- * @param {string | null} [scheme]
38
- * @param {number | null} [msg_id]
39
- */
40
- create_service(node_id, kind, name, host, port, username, password, scheme, msg_id) {
41
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
42
- const len0 = WASM_VECTOR_LEN;
43
- const ptr1 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
44
- const len1 = WASM_VECTOR_LEN;
45
- var ptr2 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
46
- var len2 = WASM_VECTOR_LEN;
47
- const ptr3 = passStringToWasm0(host, wasm.__wbindgen_export, wasm.__wbindgen_export2);
48
- const len3 = WASM_VECTOR_LEN;
49
- var ptr4 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
50
- var len4 = WASM_VECTOR_LEN;
51
- var ptr5 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
52
- var len5 = WASM_VECTOR_LEN;
53
- var ptr6 = isLikeNone(scheme) ? 0 : passStringToWasm0(scheme, wasm.__wbindgen_export, wasm.__wbindgen_export2);
54
- var len6 = WASM_VECTOR_LEN;
55
- wasm.channel_create_service(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, port, ptr4, len4, ptr5, len5, ptr6, len6, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
56
- }
57
- /**
58
- * @param {string} node_id
59
- * @param {string} id
60
- * @param {number | null} [msg_id]
61
- */
62
- delete_service(node_id, id, msg_id) {
63
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
64
- const len0 = WASM_VECTOR_LEN;
65
- const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
66
- const len1 = WASM_VECTOR_LEN;
67
- wasm.channel_delete_service(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
68
- }
69
- disconnect() {
70
- wasm.channel_disconnect(this.__wbg_ptr);
71
- }
72
- /**
73
- * @returns {boolean}
74
- */
75
- is_connected() {
76
- const ret = wasm.channel_is_connected(this.__wbg_ptr);
77
- return ret !== 0;
78
- }
79
- /**
80
- * @returns {boolean}
81
- */
82
- is_disconnected() {
83
- const ret = wasm.channel_is_disconnected(this.__wbg_ptr);
84
- return ret !== 0;
85
- }
86
- /**
87
- * @param {string} endpoint
88
- * @param {string} node_id
89
- * @param {string | null} [server_id]
90
- */
91
- constructor(endpoint, node_id, server_id) {
92
- const ptr0 = passStringToWasm0(endpoint, wasm.__wbindgen_export, wasm.__wbindgen_export2);
93
- const len0 = WASM_VECTOR_LEN;
94
- const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
95
- const len1 = WASM_VECTOR_LEN;
96
- var ptr2 = isLikeNone(server_id) ? 0 : passStringToWasm0(server_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
97
- var len2 = WASM_VECTOR_LEN;
98
- const ret = wasm.channel_new(ptr0, len0, ptr1, len1, ptr2, len2);
99
- this.__wbg_ptr = ret;
100
- ChannelFinalization.register(this, this.__wbg_ptr, this);
101
- return this;
102
- }
103
- /**
104
- * @param {Function | null} [cb]
105
- */
106
- on_connection_close(cb) {
107
- wasm.channel_on_connection_close(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
108
- }
109
- /**
110
- * @param {Function | null} [cb]
111
- */
112
- on_connection_error(cb) {
113
- wasm.channel_on_connection_error(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
114
- }
115
- /**
116
- * @param {Function | null} [cb]
117
- */
118
- on_connection_message(cb) {
119
- wasm.channel_on_connection_message(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
120
- }
121
- /**
122
- * @param {Function | null} [cb]
123
- */
124
- on_connection_open(cb) {
125
- wasm.channel_on_connection_open(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
126
- }
127
- /**
128
- * @param {Function | null} [cb]
129
- */
130
- on_protocol_message(cb) {
131
- wasm.channel_on_protocol_message(this.__wbg_ptr, isLikeNone(cb) ? 0 : addHeapObject(cb));
132
- }
133
- /**
134
- * @param {string} frame_type
135
- * @param {Function | null} [cb]
136
- */
137
- on_protocol_message_type(frame_type, cb) {
138
- const ptr0 = passStringToWasm0(frame_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
139
- const len0 = WASM_VECTOR_LEN;
140
- wasm.channel_on_protocol_message_type(this.__wbg_ptr, ptr0, len0, isLikeNone(cb) ? 0 : addHeapObject(cb));
141
- }
142
- /**
143
- * Requests an RDP tunnel. Credentials are validated by the agent but are
144
- * not used to log in: CredSSP runs in the browser's own RDP client, inside
145
- * the tunnel.
146
- *
147
- * Unlike the other protocols this does **not** yield a `TunnelOpened`.
148
- * The answer is an `RDPAuthorized` frame carrying a `sid` and a single-use
149
- * `ticket`; the RDP client then opens its own socket at
150
- * `/api/web/rdp/{node_id}` and presents that ticket in its RDCleanPath
151
- * request. No tunnel data for an RDP session ever crosses *this* channel.
152
- * @param {string} node_id
153
- * @param {string} service_id
154
- * @param {string | null} [username]
155
- * @param {string | null} [password]
156
- * @param {number | null} [msg_id]
157
- */
158
- open_rdp_tunnel(node_id, service_id, username, password, msg_id) {
159
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
- const len0 = WASM_VECTOR_LEN;
161
- const ptr1 = passStringToWasm0(service_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
162
- const len1 = WASM_VECTOR_LEN;
163
- var ptr2 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
164
- var len2 = WASM_VECTOR_LEN;
165
- var ptr3 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
166
- var len3 = WASM_VECTOR_LEN;
167
- wasm.channel_open_rdp_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
168
- }
169
- /**
170
- * @param {string} node_id
171
- * @param {string} service_id
172
- * @param {string | null} [username]
173
- * @param {string | null} [password]
174
- * @param {number | null} [msg_id]
175
- */
176
- open_sftp_tunnel(node_id, service_id, username, password, msg_id) {
177
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
178
- const len0 = WASM_VECTOR_LEN;
179
- const ptr1 = passStringToWasm0(service_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
180
- const len1 = WASM_VECTOR_LEN;
181
- var ptr2 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
182
- var len2 = WASM_VECTOR_LEN;
183
- var ptr3 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
184
- var len3 = WASM_VECTOR_LEN;
185
- wasm.channel_open_sftp_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
186
- }
187
- /**
188
- * @param {string} node_id
189
- * @param {string} service_id
190
- * @param {string | null} [username]
191
- * @param {string | null} [password]
192
- * @param {number | null} [msg_id]
193
- */
194
- open_ssh_tunnel(node_id, service_id, username, password, msg_id) {
195
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
196
- const len0 = WASM_VECTOR_LEN;
197
- const ptr1 = passStringToWasm0(service_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
198
- const len1 = WASM_VECTOR_LEN;
199
- var ptr2 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
200
- var len2 = WASM_VECTOR_LEN;
201
- var ptr3 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
202
- var len3 = WASM_VECTOR_LEN;
203
- wasm.channel_open_ssh_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
204
- }
205
- /**
206
- * Set permission bits. The agent masks these to `0o7777`.
207
- * @param {string} node_id
208
- * @param {number} sid
209
- * @param {string} path
210
- * @param {number} permissions
211
- * @param {number | null} [msg_id]
212
- */
213
- send_sftp_chmod(node_id, sid, path, permissions, msg_id) {
214
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
215
- const len0 = WASM_VECTOR_LEN;
216
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
217
- const len1 = WASM_VECTOR_LEN;
218
- wasm.channel_send_sftp_chmod(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, permissions, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
219
- }
220
- /**
221
- * @param {string} node_id
222
- * @param {number} sid
223
- * @param {string} path
224
- * @param {string} filename
225
- * @param {number | null} [msg_id]
226
- */
227
- send_sftp_delete(node_id, sid, path, filename, msg_id) {
228
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
229
- const len0 = WASM_VECTOR_LEN;
230
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
231
- const len1 = WASM_VECTOR_LEN;
232
- const ptr2 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
233
- const len2 = WASM_VECTOR_LEN;
234
- wasm.channel_send_sftp_delete(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
235
- }
236
- /**
237
- * Send a pipelining ACK to the agent: acknowledges all chunks with index ≤ ack_up_to
238
- * so the agent's sliding window advances, and it can push the next batch.
239
- * Call this after processing each received SFTPDownloadChunk (or every N chunks).
240
- * @param {string} node_id
241
- * @param {number} sid
242
- * @param {number} download_id
243
- * @param {number} ack_up_to
244
- */
245
- send_sftp_download_ack(node_id, sid, download_id, ack_up_to) {
246
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
247
- const len0 = WASM_VECTOR_LEN;
248
- wasm.channel_send_sftp_download_ack(this.__wbg_ptr, ptr0, len0, sid, download_id, ack_up_to);
249
- }
250
- /**
251
- * @param {string} node_id
252
- * @param {number} sid
253
- * @param {number} download_id
254
- * @param {number} chunk_index
255
- * @param {number | null} [msg_id]
256
- */
257
- send_sftp_download_chunk(node_id, sid, download_id, chunk_index, msg_id) {
258
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
- const len0 = WASM_VECTOR_LEN;
260
- wasm.channel_send_sftp_download_chunk(this.__wbg_ptr, ptr0, len0, sid, download_id, chunk_index, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
261
- }
262
- /**
263
- * @param {string} node_id
264
- * @param {number} sid
265
- * @param {string} path
266
- * @param {string} filename
267
- * @param {number | null} [msg_id]
268
- */
269
- send_sftp_download_start(node_id, sid, path, filename, msg_id) {
270
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
271
- const len0 = WASM_VECTOR_LEN;
272
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
273
- const len1 = WASM_VECTOR_LEN;
274
- const ptr2 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
275
- const len2 = WASM_VECTOR_LEN;
276
- wasm.channel_send_sftp_download_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
277
- }
278
- /**
279
- * @param {string} node_id
280
- * @param {number} sid
281
- * @param {string} path
282
- * @param {number | null} [msg_id]
283
- */
284
- send_sftp_list_data(node_id, sid, path, msg_id) {
285
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
286
- const len0 = WASM_VECTOR_LEN;
287
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
288
- const len1 = WASM_VECTOR_LEN;
289
- wasm.channel_send_sftp_list_data(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
290
- }
291
- /**
292
- * Create one directory. Parents must exist already, as with `mkdir`.
293
- * @param {string} node_id
294
- * @param {number} sid
295
- * @param {string} path
296
- * @param {number | null} [msg_id]
297
- */
298
- send_sftp_mkdir(node_id, sid, path, msg_id) {
299
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
300
- const len0 = WASM_VECTOR_LEN;
301
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
302
- const len1 = WASM_VECTOR_LEN;
303
- wasm.channel_send_sftp_mkdir(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
304
- }
305
- /**
306
- * Read a whole file for the in-page editor. Answered with an
307
- * `SFTPOpResult` carrying `FileContents`, or an `Error` if the file is
308
- * above the agent's editor size limit.
309
- * @param {string} node_id
310
- * @param {number} sid
311
- * @param {string} path
312
- * @param {number | null} [msg_id]
313
- */
314
- send_sftp_read_file(node_id, sid, path, msg_id) {
315
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
316
- const len0 = WASM_VECTOR_LEN;
317
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
318
- const len1 = WASM_VECTOR_LEN;
319
- wasm.channel_send_sftp_read_file(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
320
- }
321
- /**
322
- * Remove a file, a symlink, or a directory. Without `recursive` the remote
323
- * refuses a directory that still has anything in it.
324
- * @param {string} node_id
325
- * @param {number} sid
326
- * @param {string} path
327
- * @param {boolean} recursive
328
- * @param {number | null} [msg_id]
329
- */
330
- send_sftp_remove(node_id, sid, path, recursive, msg_id) {
331
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
332
- const len0 = WASM_VECTOR_LEN;
333
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
334
- const len1 = WASM_VECTOR_LEN;
335
- wasm.channel_send_sftp_remove(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, recursive, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
336
- }
337
- /**
338
- * Rename or move. `to` is a full path, so one call covers both.
339
- * @param {string} node_id
340
- * @param {number} sid
341
- * @param {string} from
342
- * @param {string} to
343
- * @param {number | null} [msg_id]
344
- */
345
- send_sftp_rename(node_id, sid, from, to, msg_id) {
346
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
347
- const len0 = WASM_VECTOR_LEN;
348
- const ptr1 = passStringToWasm0(from, wasm.__wbindgen_export, wasm.__wbindgen_export2);
349
- const len1 = WASM_VECTOR_LEN;
350
- const ptr2 = passStringToWasm0(to, wasm.__wbindgen_export, wasm.__wbindgen_export2);
351
- const len2 = WASM_VECTOR_LEN;
352
- wasm.channel_send_sftp_rename(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
353
- }
354
- /**
355
- * @param {string} node_id
356
- * @param {number} sid
357
- * @param {number} upload_id
358
- * @param {number} chunk_index
359
- * @param {number} chunk_size
360
- * @param {Uint8Array} data
361
- * @param {number | null} [msg_id]
362
- */
363
- send_sftp_upload_chunk(node_id, sid, upload_id, chunk_index, chunk_size, data, msg_id) {
364
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
365
- const len0 = WASM_VECTOR_LEN;
366
- const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
367
- const len1 = WASM_VECTOR_LEN;
368
- wasm.channel_send_sftp_upload_chunk(this.__wbg_ptr, ptr0, len0, sid, upload_id, chunk_index, chunk_size, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
369
- }
370
- /**
371
- * @param {string} node_id
372
- * @param {number} sid
373
- * @param {string} filename
374
- * @param {string} remote_path
375
- * @param {number} total_chunks
376
- * @param {bigint} total_size
377
- * @param {number | null} [msg_id]
378
- */
379
- send_sftp_upload_start(node_id, sid, filename, remote_path, total_chunks, total_size, msg_id) {
380
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
381
- const len0 = WASM_VECTOR_LEN;
382
- const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
383
- const len1 = WASM_VECTOR_LEN;
384
- const ptr2 = passStringToWasm0(remote_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
385
- const len2 = WASM_VECTOR_LEN;
386
- wasm.channel_send_sftp_upload_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, total_chunks, total_size, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
387
- }
388
- /**
389
- * Write a whole file back, truncating whatever was there.
390
- * @param {string} node_id
391
- * @param {number} sid
392
- * @param {string} path
393
- * @param {Uint8Array} contents
394
- * @param {number | null} [msg_id]
395
- */
396
- send_sftp_write_file(node_id, sid, path, contents, msg_id) {
397
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
398
- const len0 = WASM_VECTOR_LEN;
399
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
400
- const len1 = WASM_VECTOR_LEN;
401
- const ptr2 = passArray8ToWasm0(contents, wasm.__wbindgen_export);
402
- const len2 = WASM_VECTOR_LEN;
403
- wasm.channel_send_sftp_write_file(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
404
- }
405
- /**
406
- * @param {string} node_id
407
- * @param {number} sid
408
- * @param {number} cols
409
- * @param {number} rows
410
- * @param {number} px_width
411
- * @param {number} px_height
412
- */
413
- send_ssh_terminal_resize(node_id, sid, cols, rows, px_width, px_height) {
414
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
415
- const len0 = WASM_VECTOR_LEN;
416
- wasm.channel_send_ssh_terminal_resize(this.__wbg_ptr, ptr0, len0, sid, cols, rows, px_width, px_height);
417
- }
418
- /**
419
- * @param {string} node_id
420
- * @param {number} sid
421
- * @param {string} data
422
- */
423
- send_ssh_tunnel_data(node_id, sid, data) {
424
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
425
- const len0 = WASM_VECTOR_LEN;
426
- const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
427
- const len1 = WASM_VECTOR_LEN;
428
- wasm.channel_send_ssh_tunnel_data(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1);
429
- }
430
- /**
431
- * @param {number} interval_as_millis
432
- */
433
- start_heartbeat(interval_as_millis) {
434
- wasm.channel_start_heartbeat(this.__wbg_ptr, interval_as_millis);
435
- }
436
- stop_heartbeat() {
437
- wasm.channel_stop_heartbeat(this.__wbg_ptr);
438
- }
439
- /**
440
- * @param {string} node_id
441
- * @param {string} service_id
442
- * @param {string} kind
443
- * @param {string | null | undefined} name
444
- * @param {string} host
445
- * @param {number} port
446
- * @param {string | null} [username]
447
- * @param {string | null} [password]
448
- * @param {string | null} [scheme]
449
- * @param {number | null} [msg_id]
450
- */
451
- update_service(node_id, service_id, kind, name, host, port, username, password, scheme, msg_id) {
452
- const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
453
- const len0 = WASM_VECTOR_LEN;
454
- const ptr1 = passStringToWasm0(service_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
455
- const len1 = WASM_VECTOR_LEN;
456
- const ptr2 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
457
- const len2 = WASM_VECTOR_LEN;
458
- var ptr3 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
459
- var len3 = WASM_VECTOR_LEN;
460
- const ptr4 = passStringToWasm0(host, wasm.__wbindgen_export, wasm.__wbindgen_export2);
461
- const len4 = WASM_VECTOR_LEN;
462
- var ptr5 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
463
- var len5 = WASM_VECTOR_LEN;
464
- var ptr6 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
465
- var len6 = WASM_VECTOR_LEN;
466
- var ptr7 = isLikeNone(scheme) ? 0 : passStringToWasm0(scheme, wasm.__wbindgen_export, wasm.__wbindgen_export2);
467
- var len7 = WASM_VECTOR_LEN;
468
- wasm.channel_update_service(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, port, ptr5, len5, ptr6, len6, ptr7, len7, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
469
- }
470
- }
471
- if (Symbol.dispose) Channel.prototype[Symbol.dispose] = Channel.prototype.free;
472
-
473
- /**
474
- * @enum {0 | 10 | 100 | 110 | 120}
475
- */
476
- const ErrorType = Object.freeze({
477
- Generic: 0, "0": "Generic",
478
- Authentication: 10, "10": "Authentication",
479
- RequiresUsername: 100, "100": "RequiresUsername",
480
- RequiresPassword: 110, "110": "RequiresPassword",
481
- RequiresUsernamePassword: 120, "120": "RequiresUsernamePassword",
482
- });
483
- function __wbg_get_imports() {
484
- const import0 = {
485
- __proto__: null,
486
- __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
487
- const ret = Error(getStringFromWasm0(arg0, arg1));
488
- return addHeapObject(ret);
489
- },
490
- __wbg_String_8564e559799eccda: function(arg0, arg1) {
491
- const ret = String(getObject(arg1));
492
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
493
- const len1 = WASM_VECTOR_LEN;
494
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
495
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
496
- },
497
- __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
498
- const ret = debugString(getObject(arg1));
499
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
500
- const len1 = WASM_VECTOR_LEN;
501
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
502
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
503
- },
504
- __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
505
- const obj = getObject(arg1);
506
- const ret = typeof(obj) === 'string' ? obj : undefined;
507
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
508
- var len1 = WASM_VECTOR_LEN;
509
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
510
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
511
- },
512
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
513
- throw new Error(getStringFromWasm0(arg0, arg1));
514
- },
515
- __wbg__wbg_cb_unref_dcc1a90847f04c41: function(arg0) {
516
- getObject(arg0)._wbg_cb_unref();
517
- },
518
- __wbg_call_1875a20c43a36133: function() { return handleError(function (arg0, arg1, arg2, arg3) {
519
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
520
- return addHeapObject(ret);
521
- }, arguments); },
522
- __wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
523
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
524
- return addHeapObject(ret);
525
- }, arguments); },
526
- __wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
527
- const ret = getObject(arg0).call(getObject(arg1));
528
- return addHeapObject(ret);
529
- }, arguments); },
530
- __wbg_clearInterval_26ba580547547579: function(arg0) {
531
- const ret = clearInterval(takeObject(arg0));
532
- return addHeapObject(ret);
533
- },
534
- __wbg_close_d3ed56b5763be5ae: function() { return handleError(function (arg0) {
535
- getObject(arg0).close();
536
- }, arguments); },
537
- __wbg_data_522f7abc70721269: function(arg0) {
538
- const ret = getObject(arg0).data;
539
- return addHeapObject(ret);
540
- },
541
- __wbg_from_296ca31f8d0f1c52: function(arg0) {
542
- const ret = Array.from(getObject(arg0));
543
- return addHeapObject(ret);
544
- },
545
- __wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
546
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
547
- }, arguments); },
548
- __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
549
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
550
- return addHeapObject(ret);
551
- }, arguments); },
552
- __wbg_info_930469ca0112784b: function(arg0, arg1) {
553
- console.info(getStringFromWasm0(arg0, arg1));
554
- },
555
- __wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
556
- let result;
557
- try {
558
- result = getObject(arg0) instanceof ArrayBuffer;
559
- } catch (_) {
560
- result = false;
561
- }
562
- const ret = result;
563
- return ret;
564
- },
565
- __wbg_length_7f3c00c40364105e: function(arg0) {
566
- const ret = getObject(arg0).length;
567
- return ret;
568
- },
569
- __wbg_new_1dbf7428bba60a42: function(arg0) {
570
- const ret = new Uint8Array(getObject(arg0));
571
- return addHeapObject(ret);
572
- },
573
- __wbg_new_617a8cdb8bb1130e: function() {
574
- const ret = new Object();
575
- return addHeapObject(ret);
576
- },
577
- __wbg_new_ee2291f50781bf1d: function() {
578
- const ret = new Array();
579
- return addHeapObject(ret);
580
- },
581
- __wbg_new_with_str_sequence_f79e461d58fdeacc: function() { return handleError(function (arg0, arg1, arg2) {
582
- const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));
583
- return addHeapObject(ret);
584
- }, arguments); },
585
- __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
586
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
587
- },
588
- __wbg_push_2baf45db356cf468: function(arg0, arg1) {
589
- const ret = getObject(arg0).push(getObject(arg1));
590
- return ret;
591
- },
592
- __wbg_readyState_d8514376867e415b: function(arg0) {
593
- const ret = getObject(arg0).readyState;
594
- return ret;
595
- },
596
- __wbg_send_c1dad0ec2e52defb: function() { return handleError(function (arg0, arg1, arg2) {
597
- getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
598
- }, arguments); },
599
- __wbg_setInterval_cbf1c35c6a692d37: function() { return handleError(function (arg0, arg1) {
600
- const ret = setInterval(getObject(arg0), arg1);
601
- return addHeapObject(ret);
602
- }, arguments); },
603
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
604
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
605
- },
606
- __wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
607
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
608
- },
609
- __wbg_set_binaryType_21835bf0df8f70aa: function(arg0, arg1) {
610
- getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
611
- },
612
- __wbg_set_onclose_a84370531f3d2948: function(arg0, arg1) {
613
- getObject(arg0).onclose = getObject(arg1);
614
- },
615
- __wbg_set_onerror_94ee307653399172: function(arg0, arg1) {
616
- getObject(arg0).onerror = getObject(arg1);
617
- },
618
- __wbg_set_onmessage_cb6f77d2d8e0402a: function(arg0, arg1) {
619
- getObject(arg0).onmessage = getObject(arg1);
620
- },
621
- __wbg_set_onopen_c914147e8a2db4b0: function(arg0, arg1) {
622
- getObject(arg0).onopen = getObject(arg1);
623
- },
624
- __wbg_warn_018ad7405d6ad231: function(arg0, arg1) {
625
- console.warn(getStringFromWasm0(arg0, arg1));
626
- },
627
- __wbindgen_generic_0000000000000001: function(arg0, arg1) {
628
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
629
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_60);
630
- return addHeapObject(ret);
631
- },
632
- __wbindgen_generic_0000000000000002: function(arg0, arg1) {
633
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
634
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_60_37);
635
- return addHeapObject(ret);
636
- },
637
- __wbindgen_generic_0000000000000003: function(arg0, arg1) {
638
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
639
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_60_38);
640
- return addHeapObject(ret);
641
- },
642
- __wbindgen_generic_0000000000000004: function(arg0, arg1) {
643
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
644
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_64);
645
- return addHeapObject(ret);
646
- },
647
- __wbindgen_generic_0000000000000005: function(arg0) {
648
- // Cast intrinsic for `F64 -> Externref`.
649
- const ret = arg0;
650
- return addHeapObject(ret);
651
- },
652
- __wbindgen_generic_0000000000000006: function(arg0, arg1) {
653
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
654
- const ret = getArrayU8FromWasm0(arg0, arg1);
655
- return addHeapObject(ret);
656
- },
657
- __wbindgen_generic_0000000000000007: function(arg0, arg1) {
658
- // Cast intrinsic for `Ref(String) -> Externref`.
659
- const ret = getStringFromWasm0(arg0, arg1);
660
- return addHeapObject(ret);
661
- },
662
- __wbindgen_generic_0000000000000008: function(arg0) {
663
- // Cast intrinsic for `U64 -> Externref`.
664
- const ret = BigInt.asUintN(64, arg0);
665
- return addHeapObject(ret);
666
- },
667
- __wbindgen_object_clone_ref: function(arg0) {
668
- const ret = getObject(arg0);
669
- return addHeapObject(ret);
670
- },
671
- __wbindgen_object_drop_ref: function(arg0) {
672
- takeObject(arg0);
673
- },
674
- };
675
- return {
676
- __proto__: null,
677
- "./phirepass-channel_bg.js": import0,
678
- };
679
- }
680
-
681
- function __wasm_bindgen_func_elem_64(arg0, arg1) {
682
- wasm.__wasm_bindgen_func_elem_64(arg0, arg1);
683
- }
684
-
685
- function __wasm_bindgen_func_elem_60(arg0, arg1, arg2) {
686
- wasm.__wasm_bindgen_func_elem_60(arg0, arg1, addHeapObject(arg2));
687
- }
688
-
689
- function __wasm_bindgen_func_elem_60_37(arg0, arg1, arg2) {
690
- wasm.__wasm_bindgen_func_elem_60_37(arg0, arg1, addHeapObject(arg2));
691
- }
692
-
693
- function __wasm_bindgen_func_elem_60_38(arg0, arg1, arg2) {
694
- wasm.__wasm_bindgen_func_elem_60_38(arg0, arg1, addHeapObject(arg2));
695
- }
696
-
697
-
698
- const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
699
- const ChannelFinalization = (typeof FinalizationRegistry === 'undefined')
700
- ? { register: () => {}, unregister: () => {} }
701
- : new FinalizationRegistry(ptr => wasm.__wbg_channel_free(ptr, 1));
702
-
703
- function addHeapObject(obj) {
704
- if (heap_next === heap.length) heap.push(heap.length + 1);
705
- const idx = heap_next;
706
- heap_next = heap[idx];
707
-
708
- heap[idx] = obj;
709
- return idx;
710
- }
711
-
712
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
713
- ? { register: () => {}, unregister: () => {} }
714
- : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
715
-
716
- function debugString(val) {
717
- // primitive types
718
- const type = typeof val;
719
- if (type == 'number' || type == 'boolean' || val == null) {
720
- return `${val}`;
721
- }
722
- if (type == 'string') {
723
- return `"${val}"`;
724
- }
725
- if (type == 'symbol') {
726
- const description = val.description;
727
- if (description == null) {
728
- return 'Symbol';
729
- } else {
730
- return `Symbol(${description})`;
731
- }
732
- }
733
- if (type == 'function') {
734
- const name = val.name;
735
- if (typeof name == 'string' && name.length > 0) {
736
- return `Function(${name})`;
737
- } else {
738
- return 'Function';
739
- }
740
- }
741
- // objects
742
- if (Array.isArray(val)) {
743
- const length = val.length;
744
- let debug = '[';
745
- if (length > 0) {
746
- debug += debugString(val[0]);
747
- }
748
- for(let i = 1; i < length; i++) {
749
- debug += ', ' + debugString(val[i]);
750
- }
751
- debug += ']';
752
- return debug;
753
- }
754
- // Test for built-in
755
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
756
- let className;
757
- if (builtInMatches && builtInMatches.length > 1) {
758
- className = builtInMatches[1];
759
- } else {
760
- // Failed to match the standard '[object ClassName]'
761
- return toString.call(val);
762
- }
763
- if (className == 'Object') {
764
- // we're a user defined class or Object
765
- // JSON.stringify avoids problems with cycles, and is generally much
766
- // easier than looping through ownProperties of `val`.
767
- try {
768
- return 'Object(' + JSON.stringify(val) + ')';
769
- } catch (_) {
770
- return 'Object';
771
- }
772
- }
773
- // errors
774
- if (val instanceof Error) {
775
- return `${val.name}: ${val.message}\n${val.stack}`;
776
- }
777
- // TODO we could test for more things here, like `Set`s and `Map`s.
778
- return className;
779
- }
780
-
781
- function dropObject(idx) {
782
- if (idx < 1028) return;
783
- heap[idx] = heap_next;
784
- heap_next = idx;
785
- }
786
-
787
- function getArrayU8FromWasm0(ptr, len) {
788
- ptr = ptr >>> 0;
789
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
790
- }
791
-
792
- let cachedDataViewMemory0 = null;
793
- function getDataViewMemory0() {
794
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
795
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
796
- }
797
- return cachedDataViewMemory0;
798
- }
799
-
800
- function getStringFromWasm0(ptr, len) {
801
- return decodeText(ptr >>> 0, len);
802
- }
803
-
804
- let cachedUint8ArrayMemory0 = null;
805
- function getUint8ArrayMemory0() {
806
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
807
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
808
- }
809
- return cachedUint8ArrayMemory0;
810
- }
811
-
812
- function getObject(idx) { return heap[idx]; }
813
-
814
- function handleError(f, args) {
815
- try {
816
- return f.apply(this, args);
817
- } catch (e) {
818
- wasm.__wbindgen_export3(addHeapObject(e));
819
- }
820
- }
821
-
822
- let heap = new Array(1024).fill(undefined);
823
- heap.push(undefined, null, true, false);
824
-
825
- let heap_next = heap.length;
826
-
827
- function isLikeNone(x) {
828
- return x === undefined || x === null;
829
- }
830
-
831
- function makeMutClosure(arg0, arg1, f) {
832
- const state = { a: arg0, b: arg1, cnt: 1 };
833
- const real = (...args) => {
834
-
835
- // First up with a closure we increment the internal reference
836
- // count. This ensures that the Rust closure environment won't
837
- // be deallocated while we're invoking it.
838
- state.cnt++;
839
- const a = state.a;
840
- state.a = 0;
841
- try {
842
- return f(a, state.b, ...args);
843
- } finally {
844
- state.a = a;
845
- real._wbg_cb_unref();
846
- }
847
- };
848
- real._wbg_cb_unref = () => {
849
- if (--state.cnt === 0) {
850
- wasm.__wbindgen_export4(state.a, state.b);
851
- state.a = 0;
852
- CLOSURE_DTORS.unregister(state);
853
- }
854
- };
855
- CLOSURE_DTORS.register(real, state, state);
856
- return real;
857
- }
858
-
859
- function passArray8ToWasm0(arg, malloc) {
860
- const ptr = malloc(arg.length * 1, 1) >>> 0;
861
- getUint8ArrayMemory0().set(arg, ptr / 1);
862
- WASM_VECTOR_LEN = arg.length;
863
- return ptr;
864
- }
865
-
866
- function passStringToWasm0(arg, malloc, realloc) {
867
- if (realloc === undefined) {
868
- const buf = cachedTextEncoder.encode(arg);
869
- const ptr = malloc(buf.length, 1) >>> 0;
870
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
871
- WASM_VECTOR_LEN = buf.length;
872
- return ptr;
873
- }
874
-
875
- let len = arg.length;
876
- let ptr = malloc(len, 1) >>> 0;
877
-
878
- const mem = getUint8ArrayMemory0();
879
-
880
- let offset = 0;
881
-
882
- for (; offset < len; offset++) {
883
- const code = arg.charCodeAt(offset);
884
- if (code > 0x7F) break;
885
- mem[ptr + offset] = code;
886
- }
887
- if (offset !== len) {
888
- if (offset !== 0) {
889
- arg = arg.slice(offset);
890
- }
891
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
892
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
893
- const ret = cachedTextEncoder.encodeInto(arg, view);
894
-
895
- offset += ret.written;
896
- ptr = realloc(ptr, len, offset, 1) >>> 0;
897
- }
898
-
899
- WASM_VECTOR_LEN = offset;
900
- return ptr;
901
- }
902
-
903
- function takeObject(idx) {
904
- const ret = getObject(idx);
905
- dropObject(idx);
906
- return ret;
907
- }
908
-
909
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
910
- cachedTextDecoder.decode();
911
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
912
- let numBytesDecoded = 0;
913
- function decodeText(ptr, len) {
914
- numBytesDecoded += len;
915
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
916
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
917
- cachedTextDecoder.decode();
918
- numBytesDecoded = len;
919
- }
920
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
921
- }
922
-
923
- const cachedTextEncoder = new TextEncoder();
924
-
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
-
936
- let WASM_VECTOR_LEN = 0;
937
-
938
- let wasm;
939
- function __wbg_finalize_init(instance, module) {
940
- wasm = instance.exports;
941
- cachedDataViewMemory0 = null;
942
- cachedUint8ArrayMemory0 = null;
943
- return wasm;
944
- }
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
-
952
- if (typeof WebAssembly.instantiateStreaming === 'function') {
953
- try {
954
- return await WebAssembly.instantiateStreaming(module, imports);
955
- } catch (e) {
956
- const validResponse = expectedResponseType(module.type);
957
-
958
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
959
- 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);
960
-
961
- } else { throw e; }
962
- }
963
- }
964
-
965
- const bytes = await module.arrayBuffer();
966
- return await WebAssembly.instantiate(bytes, imports);
967
- } else {
968
- const instance = await WebAssembly.instantiate(module, imports);
969
-
970
- if (instance instanceof WebAssembly.Instance) {
971
- return { instance, module };
972
- } else {
973
- return instance;
974
- }
975
- }
976
-
977
- function expectedResponseType(type) {
978
- switch (type) {
979
- case 'basic': case 'cors': case 'default': return true;
980
- }
981
- return false;
982
- }
983
- }
984
-
985
- async function __wbg_init(module_or_path) {
986
- if (wasm !== undefined) return wasm;
987
-
988
-
989
- if (module_or_path !== undefined) {
990
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
991
- ({module_or_path} = module_or_path);
992
- } else {
993
- console.warn('using deprecated parameters for the initialization function; pass a single object instead');
994
- }
995
- }
996
-
997
- if (module_or_path === undefined) {
998
- module_or_path = new URL('phirepass-channel_bg.wasm', import.meta.url);
999
- }
1000
- const imports = __wbg_get_imports();
1001
-
1002
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1003
- module_or_path = fetch(module_or_path);
1004
- }
1005
-
1006
- const { instance} = await __wbg_load(await module_or_path, imports);
1007
-
1008
- return __wbg_finalize_init(instance);
1009
- }
1010
-
1011
- var ProtocolMessageType;
1012
- (function (ProtocolMessageType) {
1013
- ProtocolMessageType["Error"] = "Error";
1014
- ProtocolMessageType["AuthSuccess"] = "AuthSuccess";
1015
- ProtocolMessageType["TunnelOpened"] = "TunnelOpened";
1016
- ProtocolMessageType["TunnelClosed"] = "TunnelClosed";
1017
- ProtocolMessageType["TunnelData"] = "TunnelData";
1018
- ProtocolMessageType["RDPAuthorized"] = "RDPAuthorized";
1019
- ProtocolMessageType["SFTPListItems"] = "SFTPListItems";
1020
- ProtocolMessageType["SFTPDownloadStartResponse"] = "SFTPDownloadStartResponse";
1021
- ProtocolMessageType["SFTPDownloadChunk"] = "SFTPDownloadChunk";
1022
- ProtocolMessageType["SFTPUploadStartResponse"] = "SFTPUploadStartResponse";
1023
- ProtocolMessageType["SFTPUploadChunkAck"] = "SFTPUploadChunkAck";
1024
- ProtocolMessageType["SFTPOpResult"] = "SFTPOpResult";
1025
- })(ProtocolMessageType || (ProtocolMessageType = {}));
1026
- var InputMode;
1027
- (function (InputMode) {
1028
- InputMode[InputMode["Username"] = 0] = "Username";
1029
- InputMode[InputMode["Password"] = 1] = "Password";
1030
- InputMode[InputMode["Default"] = 2] = "Default";
1031
- })(InputMode || (InputMode = {}));
1032
- var ConnectionState;
1033
- (function (ConnectionState) {
1034
- ConnectionState["Disconnected"] = "disconnected";
1035
- ConnectionState["Connected"] = "connected";
1036
- ConnectionState["Error"] = "error";
1037
- })(ConnectionState || (ConnectionState = {}));
1038
-
1039
- export { Channel as C, ErrorType as E, InputMode as I, ProtocolMessageType as P, __wbg_init as _, ConnectionState as a };