phirepass-widgets 0.0.101 → 0.0.103

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 (33) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/phirepass-rdp.cjs.entry.js +1 -1
  3. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +547 -81
  4. package/dist/cjs/phirepass-terminal.cjs.entry.js +2 -2
  5. package/dist/cjs/phirepass-widgets.cjs.js +1 -1
  6. package/dist/cjs/{protocol-B45sQiET.js → protocol-9IbZ-NTW.js} +155 -59
  7. package/dist/collection/common/protocol.js +1 -0
  8. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +342 -2
  9. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +568 -80
  10. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
  11. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  12. package/dist/components/p-D4vz9Xu4.js +1 -0
  13. package/dist/components/phirepass-rdp.js +1 -1
  14. package/dist/components/phirepass-sftp-client.js +1 -1
  15. package/dist/components/phirepass-terminal.js +2 -2
  16. package/dist/esm/loader.js +1 -1
  17. package/dist/esm/phirepass-rdp.entry.js +1 -1
  18. package/dist/esm/phirepass-sftp-client.entry.js +547 -81
  19. package/dist/esm/phirepass-terminal.entry.js +2 -2
  20. package/dist/esm/phirepass-widgets.js +1 -1
  21. package/dist/esm/{protocol-DFhjP92A.js → protocol-D4vz9Xu4.js} +154 -58
  22. package/dist/phirepass-widgets/{p-de23b6db.entry.js → p-471340b8.entry.js} +1 -1
  23. package/dist/phirepass-widgets/p-D4vz9Xu4.js +1 -0
  24. package/dist/phirepass-widgets/p-ca67e389.entry.js +1 -0
  25. package/dist/phirepass-widgets/{p-c4a31b26.entry.js → p-dc4051cc.entry.js} +2 -2
  26. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  27. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  28. package/dist/types/common/protocol.d.ts +22 -2
  29. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +85 -4
  30. package/package.json +2 -2
  31. package/dist/components/p-DFhjP92A.js +0 -1
  32. package/dist/phirepass-widgets/p-0e9afedb.entry.js +0 -1
  33. package/dist/phirepass-widgets/p-DFhjP92A.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-AP5XjS35.js';
2
- import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-DFhjP92A.js';
2
+ import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-D4vz9Xu4.js';
3
3
 
4
4
  /**
5
5
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -693,7 +693,7 @@ const PhirepassTerminal = class {
693
693
  this.usernameBuffer = "";
694
694
  }
695
695
  render() {
696
- return (h$1(Host, { key: '5e05e1ea65ffcaa21b3e819008fa5c7d7949d15d' }, h$1("div", { key: '9b8b336caff03d4456bc072ecaaa490325089ced', id: "ccc", ref: el => (this.containerEl = el) })));
696
+ return (h$1(Host, { key: '6f1e695bbce4fc68bce5de1b871fe2fc440c0d9b' }, h$1("div", { key: '574d4494690232071c35da7d080e0ac0fdb88d24', id: "ccc", ref: el => (this.containerEl = el) })));
697
697
  }
698
698
  static get watchers() { return {
699
699
  "nodeId": [{
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["phirepass-rdp",[[769,"phirepass-rdp",{"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"username":[1],"password":[1],"destination":[1],"scale":[1],"dynamicResize":[4,"dynamic-resize"],"captureKeyboard":[4,"capture-keyboard"],"clipboard":[4],"serverId":[1,"server-id"],"credentialsPrompt":[32],"statusMessage":[32],"toggleFullscreen":[64],"keyboardLockSupported":[64],"focusDesktop":[64],"sendCtrlAltDel":[64],"sendMetaKey":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-sftp-client",[[513,"phirepass-sftp-client",{"name":[1],"description":[1],"hideHeader":[4,"hide-header"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"serverId":[1,"server-id"],"max":[32],"show_login_screen":[32],"show_login_screen_username":[32],"show_error":[32],"error_message":[32],"show_login_screen_password":[32],"show_navigation":[32],"breadcrumbs":[32],"current_dir":[32],"listing":[32],"show_content":[32],"show_loader":[32],"version":[32],"status":[32],"selected_item":[32],"show_upload_modal":[32],"upload_progress":[32],"upload_file_name":[32],"upload_speed":[32],"upload_finished":[32],"show_download_modal":[32],"download_progress":[32],"download_file_name":[32],"download_speed":[32],"download_finished":[32],"show_delete_modal":[32],"delete_file_name":[32],"delete_loading":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
20
+ return bootstrapLazy([["phirepass-rdp",[[769,"phirepass-rdp",{"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"username":[1],"password":[1],"destination":[1],"scale":[1],"dynamicResize":[4,"dynamic-resize"],"captureKeyboard":[4,"capture-keyboard"],"clipboard":[4],"serverId":[1,"server-id"],"credentialsPrompt":[32],"statusMessage":[32],"toggleFullscreen":[64],"keyboardLockSupported":[64],"focusDesktop":[64],"sendCtrlAltDel":[64],"sendMetaKey":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-sftp-client",[[513,"phirepass-sftp-client",{"name":[1],"description":[1],"hideHeader":[4,"hide-header"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"serverId":[1,"server-id"],"max":[32],"show_login_screen":[32],"show_login_screen_username":[32],"show_error":[32],"error_message":[32],"show_login_screen_password":[32],"show_navigation":[32],"breadcrumbs":[32],"current_dir":[32],"listing":[32],"show_content":[32],"show_loader":[32],"version":[32],"status":[32],"selected_item":[32],"show_upload_modal":[32],"upload_progress":[32],"upload_file_name":[32],"upload_speed":[32],"upload_finished":[32],"show_download_modal":[32],"download_progress":[32],"download_file_name":[32],"download_speed":[32],"download_finished":[32],"show_delete_modal":[32],"delete_file_name":[32],"delete_loading":[32],"delete_is_dir":[32],"delete_recursive":[32],"delete_error":[32],"prompt_kind":[32],"prompt_value":[32],"prompt_error":[32],"prompt_busy":[32],"chmod_target":[32],"chmod_mode":[32],"chmod_error":[32],"chmod_busy":[32],"show_editor":[32],"editor_name":[32],"editor_text":[32],"editor_saved_text":[32],"editor_busy":[32],"editor_error":[32],"editor_confirm_discard":[32],"editor_loaded":[32],"filter":[32],"sort_key":[32],"sort_asc":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
21
21
  });
@@ -202,6 +202,21 @@ class Channel {
202
202
  var len3 = WASM_VECTOR_LEN;
203
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
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
+ }
205
220
  /**
206
221
  * @param {string} node_id
207
222
  * @param {number} sid
@@ -273,6 +288,69 @@ class Channel {
273
288
  const len1 = WASM_VECTOR_LEN;
274
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);
275
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
+ }
276
354
  /**
277
355
  * @param {string} node_id
278
356
  * @param {number} sid
@@ -307,6 +385,23 @@ class Channel {
307
385
  const len2 = WASM_VECTOR_LEN;
308
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);
309
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
+ }
310
405
  /**
311
406
  * @param {string} node_id
312
407
  * @param {number} sid
@@ -388,7 +483,7 @@ const ErrorType = Object.freeze({
388
483
  function __wbg_get_imports() {
389
484
  const import0 = {
390
485
  __proto__: null,
391
- __wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
486
+ __wbg_Error_67e7344beaa85059: function(arg0, arg1) {
392
487
  const ret = Error(getStringFromWasm0(arg0, arg1));
393
488
  return addHeapObject(ret);
394
489
  },
@@ -399,14 +494,14 @@ function __wbg_get_imports() {
399
494
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
400
495
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
401
496
  },
402
- __wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
497
+ __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
403
498
  const ret = debugString(getObject(arg1));
404
499
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
405
500
  const len1 = WASM_VECTOR_LEN;
406
501
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
407
502
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
408
503
  },
409
- __wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
504
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
410
505
  const obj = getObject(arg1);
411
506
  const ret = typeof(obj) === 'string' ? obj : undefined;
412
507
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -414,50 +509,50 @@ function __wbg_get_imports() {
414
509
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
415
510
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
416
511
  },
417
- __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
512
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
418
513
  throw new Error(getStringFromWasm0(arg0, arg1));
419
514
  },
420
- __wbg__wbg_cb_unref_be22cc64ae6946a0: function(arg0) {
515
+ __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
421
516
  getObject(arg0)._wbg_cb_unref();
422
517
  },
423
- __wbg_call_0f2a9af232c18fd2: function() { return handleError(function (arg0, arg1, arg2, arg3) {
424
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
425
- return addHeapObject(ret);
426
- }, arguments); },
427
- __wbg_call_1c5886ab9c57d1c7: function() { return handleError(function (arg0, arg1) {
518
+ __wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
428
519
  const ret = getObject(arg0).call(getObject(arg1));
429
520
  return addHeapObject(ret);
430
521
  }, arguments); },
431
- __wbg_call_35dba3c747ad7521: function() { return handleError(function (arg0, arg1, arg2) {
522
+ __wbg_call_6bcf8d3e20937e46: function() { return handleError(function (arg0, arg1, arg2) {
432
523
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
433
524
  return addHeapObject(ret);
434
525
  }, arguments); },
526
+ __wbg_call_7bbd9cceba9949ad: function() { return handleError(function (arg0, arg1, arg2, arg3) {
527
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
528
+ return addHeapObject(ret);
529
+ }, arguments); },
435
530
  __wbg_clearInterval_26ba580547547579: function(arg0) {
436
531
  const ret = clearInterval(takeObject(arg0));
437
532
  return addHeapObject(ret);
438
533
  },
439
- __wbg_close_b857478a8d4c1a16: function() { return handleError(function (arg0) {
534
+ __wbg_close_a009f540ff811039: function() { return handleError(function (arg0) {
440
535
  getObject(arg0).close();
441
536
  }, arguments); },
442
- __wbg_data_57d8ce4eb5f0a433: function(arg0) {
537
+ __wbg_data_aa7ba49b34c0d883: function(arg0) {
443
538
  const ret = getObject(arg0).data;
444
539
  return addHeapObject(ret);
445
540
  },
446
- __wbg_from_74f3d90e0ff11240: function(arg0) {
541
+ __wbg_from_a39669ce566077da: function(arg0) {
447
542
  const ret = Array.from(getObject(arg0));
448
543
  return addHeapObject(ret);
449
544
  },
450
545
  __wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
451
546
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
452
547
  }, arguments); },
453
- __wbg_get_971a0c45d172643f: function() { return handleError(function (arg0, arg1) {
548
+ __wbg_get_989d0a1309644f2b: function() { return handleError(function (arg0, arg1) {
454
549
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
455
550
  return addHeapObject(ret);
456
551
  }, arguments); },
457
- __wbg_info_c401af4c728dfc5d: function(arg0, arg1) {
552
+ __wbg_info_1ec3bd19a05d875f: function(arg0, arg1) {
458
553
  console.info(getStringFromWasm0(arg0, arg1));
459
554
  },
460
- __wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
555
+ __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae: function(arg0) {
461
556
  let result;
462
557
  try {
463
558
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -467,104 +562,104 @@ function __wbg_get_imports() {
467
562
  const ret = result;
468
563
  return ret;
469
564
  },
470
- __wbg_length_36bd29c6848c2144: function(arg0) {
565
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
471
566
  const ret = getObject(arg0).length;
472
567
  return ret;
473
568
  },
474
- __wbg_new_116be93542d39019: function() {
475
- const ret = new Array();
476
- return addHeapObject(ret);
477
- },
478
- __wbg_new_77cc4f4f472aeb81: function(arg0) {
569
+ __wbg_new_1da3429bc3c4541c: function(arg0) {
479
570
  const ret = new Uint8Array(getObject(arg0));
480
571
  return addHeapObject(ret);
481
572
  },
482
- __wbg_new_ebe3e0f6837f0879: function() {
573
+ __wbg_new_bebc3f4757acf305: function() {
483
574
  const ret = new Object();
484
575
  return addHeapObject(ret);
485
576
  },
486
- __wbg_new_with_str_sequence_d8aa2988e9c191ed: function() { return handleError(function (arg0, arg1, arg2) {
577
+ __wbg_new_ffa92086ea89f79c: function() {
578
+ const ret = new Array();
579
+ return addHeapObject(ret);
580
+ },
581
+ __wbg_new_with_str_sequence_9ab4875494df9d99: function() { return handleError(function (arg0, arg1, arg2) {
487
582
  const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));
488
583
  return addHeapObject(ret);
489
584
  }, arguments); },
490
- __wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
585
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
491
586
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
492
587
  },
493
- __wbg_push_adb0107829f02d75: function(arg0, arg1) {
588
+ __wbg_push_bfdf956ba476f65b: function(arg0, arg1) {
494
589
  const ret = getObject(arg0).push(getObject(arg1));
495
590
  return ret;
496
591
  },
497
- __wbg_readyState_fe79161592fd15ce: function(arg0) {
592
+ __wbg_readyState_83df235b27cf257f: function(arg0) {
498
593
  const ret = getObject(arg0).readyState;
499
594
  return ret;
500
595
  },
501
- __wbg_send_76be66dda8ee844c: function() { return handleError(function (arg0, arg1, arg2) {
596
+ __wbg_send_af811d92e7aea5c4: function() { return handleError(function (arg0, arg1, arg2) {
502
597
  getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
503
598
  }, arguments); },
504
599
  __wbg_setInterval_cbf1c35c6a692d37: function() { return handleError(function (arg0, arg1) {
505
600
  const ret = setInterval(getObject(arg0), arg1);
506
601
  return addHeapObject(ret);
507
602
  }, arguments); },
603
+ __wbg_set_13d25b81ab403f5e: function(arg0, arg1, arg2) {
604
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
605
+ },
508
606
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
509
607
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
510
608
  },
511
- __wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
512
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
513
- },
514
- __wbg_set_binaryType_b701908a03166a9f: function(arg0, arg1) {
609
+ __wbg_set_binaryType_f88804219cea0f9e: function(arg0, arg1) {
515
610
  getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
516
611
  },
517
- __wbg_set_onclose_cb71fea4ad9056fc: function(arg0, arg1) {
612
+ __wbg_set_onclose_97aab74a1c2662f7: function(arg0, arg1) {
518
613
  getObject(arg0).onclose = getObject(arg1);
519
614
  },
520
- __wbg_set_onerror_f1491b13f0fea022: function(arg0, arg1) {
615
+ __wbg_set_onerror_88cb2134dca3aba2: function(arg0, arg1) {
521
616
  getObject(arg0).onerror = getObject(arg1);
522
617
  },
523
- __wbg_set_onmessage_065a797dafa9c437: function(arg0, arg1) {
618
+ __wbg_set_onmessage_0f0d391465909a45: function(arg0, arg1) {
524
619
  getObject(arg0).onmessage = getObject(arg1);
525
620
  },
526
- __wbg_set_onopen_b28699f3431204cf: function(arg0, arg1) {
621
+ __wbg_set_onopen_e91e64af99b7966d: function(arg0, arg1) {
527
622
  getObject(arg0).onopen = getObject(arg1);
528
623
  },
529
- __wbg_warn_68977fa8f7b50381: function(arg0, arg1) {
624
+ __wbg_warn_496b1176d7c30f44: function(arg0, arg1) {
530
625
  console.warn(getStringFromWasm0(arg0, arg1));
531
626
  },
532
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
627
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
533
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`.
534
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_59);
629
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_60);
535
630
  return addHeapObject(ret);
536
631
  },
537
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
632
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
538
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`.
539
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_59_1);
634
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_60_37);
540
635
  return addHeapObject(ret);
541
636
  },
542
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
637
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
543
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`.
544
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_59_2);
639
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_60_38);
545
640
  return addHeapObject(ret);
546
641
  },
547
- __wbindgen_cast_0000000000000004: function(arg0, arg1) {
642
+ __wbindgen_generic_0000000000000004: function(arg0, arg1) {
548
643
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
549
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_63);
644
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_64);
550
645
  return addHeapObject(ret);
551
646
  },
552
- __wbindgen_cast_0000000000000005: function(arg0) {
647
+ __wbindgen_generic_0000000000000005: function(arg0) {
553
648
  // Cast intrinsic for `F64 -> Externref`.
554
649
  const ret = arg0;
555
650
  return addHeapObject(ret);
556
651
  },
557
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
652
+ __wbindgen_generic_0000000000000006: function(arg0, arg1) {
558
653
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
559
654
  const ret = getArrayU8FromWasm0(arg0, arg1);
560
655
  return addHeapObject(ret);
561
656
  },
562
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
657
+ __wbindgen_generic_0000000000000007: function(arg0, arg1) {
563
658
  // Cast intrinsic for `Ref(String) -> Externref`.
564
659
  const ret = getStringFromWasm0(arg0, arg1);
565
660
  return addHeapObject(ret);
566
661
  },
567
- __wbindgen_cast_0000000000000008: function(arg0) {
662
+ __wbindgen_generic_0000000000000008: function(arg0) {
568
663
  // Cast intrinsic for `U64 -> Externref`.
569
664
  const ret = BigInt.asUintN(64, arg0);
570
665
  return addHeapObject(ret);
@@ -583,20 +678,20 @@ function __wbg_get_imports() {
583
678
  };
584
679
  }
585
680
 
586
- function __wasm_bindgen_func_elem_63(arg0, arg1) {
587
- wasm.__wasm_bindgen_func_elem_63(arg0, arg1);
681
+ function __wasm_bindgen_func_elem_64(arg0, arg1) {
682
+ wasm.__wasm_bindgen_func_elem_64(arg0, arg1);
588
683
  }
589
684
 
590
- function __wasm_bindgen_func_elem_59(arg0, arg1, arg2) {
591
- wasm.__wasm_bindgen_func_elem_59(arg0, arg1, addHeapObject(arg2));
685
+ function __wasm_bindgen_func_elem_60(arg0, arg1, arg2) {
686
+ wasm.__wasm_bindgen_func_elem_60(arg0, arg1, addHeapObject(arg2));
592
687
  }
593
688
 
594
- function __wasm_bindgen_func_elem_59_1(arg0, arg1, arg2) {
595
- wasm.__wasm_bindgen_func_elem_59_1(arg0, arg1, addHeapObject(arg2));
689
+ function __wasm_bindgen_func_elem_60_37(arg0, arg1, arg2) {
690
+ wasm.__wasm_bindgen_func_elem_60_37(arg0, arg1, addHeapObject(arg2));
596
691
  }
597
692
 
598
- function __wasm_bindgen_func_elem_59_2(arg0, arg1, arg2) {
599
- wasm.__wasm_bindgen_func_elem_59_2(arg0, arg1, addHeapObject(arg2));
693
+ function __wasm_bindgen_func_elem_60_38(arg0, arg1, arg2) {
694
+ wasm.__wasm_bindgen_func_elem_60_38(arg0, arg1, addHeapObject(arg2));
600
695
  }
601
696
 
602
697
 
@@ -926,6 +1021,7 @@ var ProtocolMessageType;
926
1021
  ProtocolMessageType["SFTPDownloadChunk"] = "SFTPDownloadChunk";
927
1022
  ProtocolMessageType["SFTPUploadStartResponse"] = "SFTPUploadStartResponse";
928
1023
  ProtocolMessageType["SFTPUploadChunkAck"] = "SFTPUploadChunkAck";
1024
+ ProtocolMessageType["SFTPOpResult"] = "SFTPOpResult";
929
1025
  })(ProtocolMessageType || (ProtocolMessageType = {}));
930
1026
  var InputMode;
931
1027
  (function (InputMode) {
@@ -1 +1 @@
1
- import{r as t,c as s,g as e,h as i,H as o}from"./p-AP5XjS35.js";import{_ as n,C as h,a as r,P as a}from"./p-DFhjP92A.js";const c=200;function d(t){return!Number.isFinite(t)||t<=0?c:Math.min(8192,Math.max(c,Math.floor(t)))}function l(t){return t-t%2}function u(t){const s=t.getBoundingClientRect();return e=s.height,{width:l(d(s.width)),height:l(d(e))};var e}class p{onResize;debounceMs;observer;handle;reported;constructor(t,s=250){this.onResize=t,this.debounceMs=s}observe(t,s){this.disconnect(),this.reported=s,this.report(u(t)),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>{clearTimeout(this.handle),this.handle=setTimeout((()=>this.report(u(t))),this.debounceMs)})),this.observer.observe(t))}disconnect(){clearTimeout(this.handle),this.handle=void 0,this.observer?.disconnect(),this.observer=void 0,this.reported=void 0}report(t){var s,e;e=this.reported,(s=t)&&e&&s.width===e.width&&s.height===e.height||(this.reported=t,this.onResize(t))}}function f(){return navigator.keyboard}function b(){return"function"==typeof f()?.lock}function m(t){return document.fullscreenElement===t}function y(t){return document.fullscreenElement?.contains(t)??!1}function w(){if(b())try{f().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const g=class{constructor(e){t(this,e),this.connectionStateChanged=s(this,"connectionStateChanged")}channel;containerEl;ironEl;userInteraction;viewport;domReady=!1;runtimeReady=!1;connected=!1;disposed=!1;session_id;onFullscreenChange=()=>this.sync_keyboard_lock();credentials;credentialsPrompt=!1;statusMessage;usernameBuffer="";passwordBuffer="";get el(){return e(this)}serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;username;password;destination;scale="fit";dynamicResize=!0;captureKeyboard=!0;clipboard=!0;onNodeIdChange(t,s){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,s){this.onNodeIdChange(this.nodeId,this.nodeId)}connectionStateChanged;create_web_socket_endpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}async connectedCallback(){document.addEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!1,await n(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to RDP.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!0,this.session_id=void 0,this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}async toggleFullscreen(){const t=await async function(t){try{return m(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(s){return console.warn("Failed to change the fullscreen state of the RDP session:",s),m(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return b()}async focusDesktop(){this.focus_desktop()}async sendCtrlAltDel(){return!!this.userInteraction&&(this.userInteraction.ctrlAltDel(),this.focus_desktop(),!0)}async sendMetaKey(){return!!this.userInteraction&&(this.userInteraction.metaKey(),this.focus_desktop(),!0)}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.containerEl&&this.channel&&this.connect()}connect(){this.connected=!0,this.channel.connect()}open_comms(){this.channel=this.serverId?new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([r.Connected]),this.channel.authenticate(this.token,this.nodeId)})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([r.Disconnected]),this.teardown_client()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([r.Error,t])})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:s}=t.data;switch(s.type){case a.Error:this.handle_error(s);break;case a.AuthSuccess:this.handle_auth_success(s);break;case a.RDPAuthorized:this.handle_rdp_authorized(s);break;case a.TunnelClosed:this.handle_tunnel_closed(s);break;default:console.warn("Unknown protocol message type:",s)}}))}close_comms(){this.teardown_client(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}reset_session_state(){this.session_id=void 0,this.credentials=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer="",this.statusMessage=void 0}handle_auth_success(t){if(this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.username&&this.password)return this.credentials={username:this.username,password:this.password},void this.request_tunnel();this.credentialsPrompt=!0}request_tunnel(){this.credentials&&(this.statusMessage=void 0,this.channel.open_rdp_tunnel(this.nodeId,this.serviceId,this.credentials.username,this.credentials.password))}async handle_rdp_authorized(t){this.session_id=t.sid,this.statusMessage="Connecting…";const[s]=await Promise.all([import("@devolutions/iron-remote-desktop-rdp"),import("@devolutions/iron-remote-desktop")]);if(this.disposed||!this.containerEl||this.session_id!==t.sid)return;if(await s.init("info"),this.disposed||!this.containerEl||this.session_id!==t.sid)return;const e=document.createElement("iron-remote-desktop");e.module=s.Backend,e.scale=this.scale,e.flexcenter=!0,e.verbose=!1;const i=[s.enableCredssp(!0)];this.dynamicResize&&i.push(s.displayControl(!0)),e.addEventListener("ready",(s=>{this.start_session(s.detail.irgUserInteraction,t.ticket,i)})),this.ironEl=e,this.mount_client(e)}mount_client(t){this.el.appendChild(t)}async start_session(t,s,e){this.userInteraction=t,this.clipboard||t.setEnableClipboard(!1),t.onWarningCallback((t=>{console.warn("The remote desktop client reported a problem:",t)}));const i=t.configBuilder().withUsername(this.credentials?.username??"").withPassword(this.credentials?.password??"").withDestination(this.destination??this.nodeId).withProxyAddress(`${this.create_web_socket_endpoint()}/api/web/rdp/${this.nodeId}`).withAuthToken(s);for(const t of e)i.withExtension(t);let o;this.dynamicResize&&(o=function(t){const s=t.getBoundingClientRect();if(Number.isFinite(s.width)&&Number.isFinite(s.height)&&!(s.width<c||s.height<c))return{width:l(Math.min(Math.floor(s.width),4096)),height:l(Math.min(Math.floor(s.height),4096))}}(this.el),o&&i.withDesktopSize(o));try{const s=await t.connect(i.build());if(this.disposed)return this.shutdown_session(t),void await s.run();t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.sync_keyboard_lock();const e=s.run();this.start_viewport_sync(o);const n=await e;this.statusMessage=n.reason()}catch(t){const s=this.describe_error(t);this.statusMessage=s,this.connectionStateChanged.emit([r.Error,t])}}start_viewport_sync(t){this.dynamicResize&&(this.viewport=new p((t=>this.resize_desktop(t))),this.viewport.observe(this.el,t))}stop_viewport_sync(){this.viewport?.disconnect(),this.viewport=void 0}resize_desktop(t){try{this.userInteraction?.resize(t.width,t.height)}catch(t){console.warn("The remote host would not resize its desktop:",t)}}focus_desktop(){var t;t=this.ironEl,t?.focus({preventScroll:!0})}async sync_keyboard_lock(){this.captureKeyboard&&y(this.el)?(await async function(t){if(b()&&y(t))try{await f().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):w()}describe_error(t){return t&&"function"==typeof t.backtrace?t.backtrace():t instanceof Error?t.message:"Connection failed."}handle_tunnel_closed(t){this.session_id=void 0,this.statusMessage=this.statusMessage??"Connection closed.",this.teardown_client(),this.close_comms()}handle_error(t){this.statusMessage=t.message,this.connectionStateChanged.emit([r.Error,t])}shutdown_session(t){try{t.shutdown()}catch(t){console.warn("Failed to shut the RDP session down cleanly:",t)}}teardown_client(){this.stop_viewport_sync(),w(),this.userInteraction&&(this.shutdown_session(this.userInteraction),this.userInteraction=void 0),this.ironEl?.remove(),this.ironEl=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer=""}submit_credentials(t){t.preventDefault(),this.credentialsPrompt=!1,this.credentials={username:this.usernameBuffer,password:this.passwordBuffer},this.usernameBuffer="",this.passwordBuffer="",this.request_tunnel()}render(){return i(o,{key:"56354df7bd0d3f01fcd5ff65ca5618ceb6af1b91"},i("div",{key:"446dc83e41a29c3bc2c341a26092ed3581565967",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"2beafc92d81662dfac5c7b41356f6c6c802643b9"})),this.credentialsPrompt&&i("form",{key:"dcc29b21fba03bb97526ec3d1cf5a1fb51b483e9",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"b5a3e302089b2282aedbdbefd4fb5eaca7c34455",htmlFor:"rdp-username"},"Username"),i("input",{key:"3bd1c902a6bc41bc7e69c16258cac78035a949bd",id:"rdp-username",type:"text",autocomplete:"off",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"2defe12d73b609cbad27c06447c3c3221ff3e5aa",htmlFor:"rdp-password"},"Password"),i("input",{key:"55935891f24f0c1db71a14c42b2fc7a96c0c0ba6",id:"rdp-password",type:"password",autocomplete:"off",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"83439c0e8756001c7042fc3b6754889d62a8eada",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"294262625f44a3f45d54bcd492875a9b6fd03219",class:"status"},this.statusMessage))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};g.style=':host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%;display:flex}::slotted(iron-remote-desktop){display:block;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%}:host(:fullscreen){width:100vw;height:100vh;background:#000}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{margin-top:0.5rem;padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}';export{g as phirepass_rdp}
1
+ import{r as t,c as s,g as e,h as i,H as o}from"./p-AP5XjS35.js";import{_ as n,C as h,a as r,P as a}from"./p-D4vz9Xu4.js";const c=200;function d(t){return!Number.isFinite(t)||t<=0?c:Math.min(8192,Math.max(c,Math.floor(t)))}function l(t){return t-t%2}function u(t){const s=t.getBoundingClientRect();return e=s.height,{width:l(d(s.width)),height:l(d(e))};var e}class p{onResize;debounceMs;observer;handle;reported;constructor(t,s=250){this.onResize=t,this.debounceMs=s}observe(t,s){this.disconnect(),this.reported=s,this.report(u(t)),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>{clearTimeout(this.handle),this.handle=setTimeout((()=>this.report(u(t))),this.debounceMs)})),this.observer.observe(t))}disconnect(){clearTimeout(this.handle),this.handle=void 0,this.observer?.disconnect(),this.observer=void 0,this.reported=void 0}report(t){var s,e;e=this.reported,(s=t)&&e&&s.width===e.width&&s.height===e.height||(this.reported=t,this.onResize(t))}}function f(){return navigator.keyboard}function b(){return"function"==typeof f()?.lock}function m(t){return document.fullscreenElement===t}function y(t){return document.fullscreenElement?.contains(t)??!1}function w(){if(b())try{f().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const g=class{constructor(e){t(this,e),this.connectionStateChanged=s(this,"connectionStateChanged")}channel;containerEl;ironEl;userInteraction;viewport;domReady=!1;runtimeReady=!1;connected=!1;disposed=!1;session_id;onFullscreenChange=()=>this.sync_keyboard_lock();credentials;credentialsPrompt=!1;statusMessage;usernameBuffer="";passwordBuffer="";get el(){return e(this)}serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;username;password;destination;scale="fit";dynamicResize=!0;captureKeyboard=!0;clipboard=!0;onNodeIdChange(t,s){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,s){this.onNodeIdChange(this.nodeId,this.nodeId)}connectionStateChanged;create_web_socket_endpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}async connectedCallback(){document.addEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!1,await n(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to RDP.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.disposed=!0,this.session_id=void 0,this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}async toggleFullscreen(){const t=await async function(t){try{return m(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(s){return console.warn("Failed to change the fullscreen state of the RDP session:",s),m(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return b()}async focusDesktop(){this.focus_desktop()}async sendCtrlAltDel(){return!!this.userInteraction&&(this.userInteraction.ctrlAltDel(),this.focus_desktop(),!0)}async sendMetaKey(){return!!this.userInteraction&&(this.userInteraction.metaKey(),this.focus_desktop(),!0)}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.containerEl&&this.channel&&this.connect()}connect(){this.connected=!0,this.channel.connect()}open_comms(){this.channel=this.serverId?new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([r.Connected]),this.channel.authenticate(this.token,this.nodeId)})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([r.Disconnected]),this.teardown_client()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([r.Error,t])})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:s}=t.data;switch(s.type){case a.Error:this.handle_error(s);break;case a.AuthSuccess:this.handle_auth_success(s);break;case a.RDPAuthorized:this.handle_rdp_authorized(s);break;case a.TunnelClosed:this.handle_tunnel_closed(s);break;default:console.warn("Unknown protocol message type:",s)}}))}close_comms(){this.teardown_client(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}reset_session_state(){this.session_id=void 0,this.credentials=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer="",this.statusMessage=void 0}handle_auth_success(t){if(this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.username&&this.password)return this.credentials={username:this.username,password:this.password},void this.request_tunnel();this.credentialsPrompt=!0}request_tunnel(){this.credentials&&(this.statusMessage=void 0,this.channel.open_rdp_tunnel(this.nodeId,this.serviceId,this.credentials.username,this.credentials.password))}async handle_rdp_authorized(t){this.session_id=t.sid,this.statusMessage="Connecting…";const[s]=await Promise.all([import("@devolutions/iron-remote-desktop-rdp"),import("@devolutions/iron-remote-desktop")]);if(this.disposed||!this.containerEl||this.session_id!==t.sid)return;if(await s.init("info"),this.disposed||!this.containerEl||this.session_id!==t.sid)return;const e=document.createElement("iron-remote-desktop");e.module=s.Backend,e.scale=this.scale,e.flexcenter=!0,e.verbose=!1;const i=[s.enableCredssp(!0)];this.dynamicResize&&i.push(s.displayControl(!0)),e.addEventListener("ready",(s=>{this.start_session(s.detail.irgUserInteraction,t.ticket,i)})),this.ironEl=e,this.mount_client(e)}mount_client(t){this.el.appendChild(t)}async start_session(t,s,e){this.userInteraction=t,this.clipboard||t.setEnableClipboard(!1),t.onWarningCallback((t=>{console.warn("The remote desktop client reported a problem:",t)}));const i=t.configBuilder().withUsername(this.credentials?.username??"").withPassword(this.credentials?.password??"").withDestination(this.destination??this.nodeId).withProxyAddress(`${this.create_web_socket_endpoint()}/api/web/rdp/${this.nodeId}`).withAuthToken(s);for(const t of e)i.withExtension(t);let o;this.dynamicResize&&(o=function(t){const s=t.getBoundingClientRect();if(Number.isFinite(s.width)&&Number.isFinite(s.height)&&!(s.width<c||s.height<c))return{width:l(Math.min(Math.floor(s.width),4096)),height:l(Math.min(Math.floor(s.height),4096))}}(this.el),o&&i.withDesktopSize(o));try{const s=await t.connect(i.build());if(this.disposed)return this.shutdown_session(t),void await s.run();t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.sync_keyboard_lock();const e=s.run();this.start_viewport_sync(o);const n=await e;this.statusMessage=n.reason()}catch(t){const s=this.describe_error(t);this.statusMessage=s,this.connectionStateChanged.emit([r.Error,t])}}start_viewport_sync(t){this.dynamicResize&&(this.viewport=new p((t=>this.resize_desktop(t))),this.viewport.observe(this.el,t))}stop_viewport_sync(){this.viewport?.disconnect(),this.viewport=void 0}resize_desktop(t){try{this.userInteraction?.resize(t.width,t.height)}catch(t){console.warn("The remote host would not resize its desktop:",t)}}focus_desktop(){var t;t=this.ironEl,t?.focus({preventScroll:!0})}async sync_keyboard_lock(){this.captureKeyboard&&y(this.el)?(await async function(t){if(b()&&y(t))try{await f().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):w()}describe_error(t){return t&&"function"==typeof t.backtrace?t.backtrace():t instanceof Error?t.message:"Connection failed."}handle_tunnel_closed(t){this.session_id=void 0,this.statusMessage=this.statusMessage??"Connection closed.",this.teardown_client(),this.close_comms()}handle_error(t){this.statusMessage=t.message,this.connectionStateChanged.emit([r.Error,t])}shutdown_session(t){try{t.shutdown()}catch(t){console.warn("Failed to shut the RDP session down cleanly:",t)}}teardown_client(){this.stop_viewport_sync(),w(),this.userInteraction&&(this.shutdown_session(this.userInteraction),this.userInteraction=void 0),this.ironEl?.remove(),this.ironEl=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer=""}submit_credentials(t){t.preventDefault(),this.credentialsPrompt=!1,this.credentials={username:this.usernameBuffer,password:this.passwordBuffer},this.usernameBuffer="",this.passwordBuffer="",this.request_tunnel()}render(){return i(o,{key:"56354df7bd0d3f01fcd5ff65ca5618ceb6af1b91"},i("div",{key:"446dc83e41a29c3bc2c341a26092ed3581565967",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"2beafc92d81662dfac5c7b41356f6c6c802643b9"})),this.credentialsPrompt&&i("form",{key:"dcc29b21fba03bb97526ec3d1cf5a1fb51b483e9",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"b5a3e302089b2282aedbdbefd4fb5eaca7c34455",htmlFor:"rdp-username"},"Username"),i("input",{key:"3bd1c902a6bc41bc7e69c16258cac78035a949bd",id:"rdp-username",type:"text",autocomplete:"off",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"2defe12d73b609cbad27c06447c3c3221ff3e5aa",htmlFor:"rdp-password"},"Password"),i("input",{key:"55935891f24f0c1db71a14c42b2fc7a96c0c0ba6",id:"rdp-password",type:"password",autocomplete:"off",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"83439c0e8756001c7042fc3b6754889d62a8eada",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"294262625f44a3f45d54bcd492875a9b6fd03219",class:"status"},this.statusMessage))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};g.style=':host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%;display:flex}::slotted(iron-remote-desktop){display:block;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%}:host(:fullscreen){width:100vw;height:100vh;background:#000}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{margin-top:0.5rem;padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}';export{g as phirepass_rdp}
@@ -0,0 +1 @@
1
+ class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();j.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2);j.channel_authenticate(this.__wbg_ptr,r,o,i,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){j.channel_connect(this.__wbg_ptr)}create_service(n,t,e,r,o,i,c,s,_){const u=N(n,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=N(t,j.__wbindgen_export,j.__wbindgen_export2),b=k;var l=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),d=k;const w=N(r,j.__wbindgen_export,j.__wbindgen_export2),g=k;var h=R(i)?0:N(i,j.__wbindgen_export,j.__wbindgen_export2),p=k,m=R(c)?0:N(c,j.__wbindgen_export,j.__wbindgen_export2),y=k,v=R(s)?0:N(s,j.__wbindgen_export,j.__wbindgen_export2);j.channel_create_service(this.__wbg_ptr,u,a,f,b,l,d,w,g,o,h,p,m,y,v,k,R(_)?Number.MAX_SAFE_INTEGER:_>>>0)}delete_service(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2);j.channel_delete_service(this.__wbg_ptr,r,o,i,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}disconnect(){j.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==j.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==j.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2),c=k;var s=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2);const u=j.channel_new(r,o,i,c,s,k);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){j.channel_on_connection_close(this.__wbg_ptr,R(n)?0:u(n))}on_connection_error(n){j.channel_on_connection_error(this.__wbg_ptr,R(n)?0:u(n))}on_connection_message(n){j.channel_on_connection_message(this.__wbg_ptr,R(n)?0:u(n))}on_connection_open(n){j.channel_on_connection_open(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message(n){j.channel_on_protocol_message(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message_type(n,t){const e=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_on_protocol_message_type(this.__wbg_ptr,e,k,R(t)?0:u(t))}open_rdp_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_rdp_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_sftp_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_sftp_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_ssh_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_ssh_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_chmod(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_chmod(this.__wbg_ptr,i,c,t,s,k,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_delete(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_delete(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_ack(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_ack(this.__wbg_ptr,o,k,t,e,r)}send_sftp_download_chunk(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_chunk(this.__wbg_ptr,i,k,t,e,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_start(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_list_data(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_mkdir(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_mkdir(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_read_file(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_read_file(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_remove(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_remove(this.__wbg_ptr,i,c,t,s,k,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_rename(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_rename(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_upload_chunk(n,t,e,r,o,i,c){const s=N(n,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=S(i,j.__wbindgen_export);j.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,k,R(c)?Number.MAX_SAFE_INTEGER:c>>>0)}send_sftp_upload_start(n,t,e,r,o,i,c){const s=N(n,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,k,o,i,R(c)?Number.MAX_SAFE_INTEGER:c>>>0)}send_sftp_write_file(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=S(r,j.__wbindgen_export);j.channel_send_sftp_write_file(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_ssh_terminal_resize(n,t,e,r,o,i){const c=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_ssh_terminal_resize(this.__wbg_ptr,c,k,t,e,r,o,i)}send_ssh_tunnel_data(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,i,k)}start_heartbeat(n){j.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){j.channel_stop_heartbeat(this.__wbg_ptr)}update_service(n,t,e,r,o,i,c,s,_,u){const a=N(n,j.__wbindgen_export,j.__wbindgen_export2),f=k,b=N(t,j.__wbindgen_export,j.__wbindgen_export2),l=k,d=N(e,j.__wbindgen_export,j.__wbindgen_export2),w=k;var g=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2),h=k;const p=N(o,j.__wbindgen_export,j.__wbindgen_export2),m=k;var y=R(c)?0:N(c,j.__wbindgen_export,j.__wbindgen_export2),v=k,A=R(s)?0:N(s,j.__wbindgen_export,j.__wbindgen_export2),S=k,T=R(_)?0:N(_,j.__wbindgen_export,j.__wbindgen_export2);j.channel_update_service(this.__wbg_ptr,a,f,b,l,d,w,g,h,p,m,i,y,v,A,S,T,k,R(u)?Number.MAX_SAFE_INTEGER:u>>>0)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_67e7344beaa85059:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=N(String(p(t)),j.__wbindgen_export,j.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0:function(n,t){const e=N(f(p(t)),j.__wbindgen_export,j.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_92ab86bb19cbc12f:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2),i=k;d().setInt32(n+4,i,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_5d9e815e6fdf150f:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_997e73d32238e655:function(n){p(n)._wbg_cb_unref()},__wbg_call_269c5566fbede3eb:function(){return m((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_call_6bcf8d3e20937e46:function(){return m((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_call_7bbd9cceba9949ad:function(){return m((function(n,t,e,r){return u(p(n).call(p(t),p(e),p(r)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(T(n)))},__wbg_close_a009f540ff811039:function(){return m((function(n){p(n).close()}),arguments)},__wbg_data_aa7ba49b34c0d883:function(n){return u(p(n).data)},__wbg_from_a39669ce566077da:function(n){return u(Array.from(p(n)))},__wbg_getRandomValues_a608c4436c19407a:function(){return m((function(n,t){globalThis.crypto.getRandomValues(b(n,t))}),arguments)},__wbg_get_989d0a1309644f2b:function(){return m((function(n,t){return u(Reflect.get(p(n),p(t)))}),arguments)},__wbg_info_1ec3bd19a05d875f:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_d4ff01f8247925ae:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_31bdaf014f5fbde2:function(n){return p(n).length},__wbg_new_1da3429bc3c4541c:function(n){return u(new Uint8Array(p(n)))},__wbg_new_bebc3f4757acf305:function(){return u(new Object)},__wbg_new_ffa92086ea89f79c:function(){return u(new Array)},__wbg_new_with_str_sequence_9ab4875494df9d99:function(){return m((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_ae9f5e7459250748:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_bfdf956ba476f65b:function(n,t){return p(n).push(p(t))},__wbg_readyState_83df235b27cf257f:function(n){return p(n).readyState},__wbg_send_af811d92e7aea5c4:function(){return m((function(n,t,e){p(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return m((function(n,t){return u(setInterval(p(n),t))}),arguments)},__wbg_set_13d25b81ab403f5e:function(n,t,e){p(n)[t>>>0]=T(e)},__wbg_set_6be42768c690e380:function(n,t,e){p(n)[T(t)]=T(e)},__wbg_set_binaryType_f88804219cea0f9e:function(n,t){p(n).binaryType=s[t]},__wbg_set_onclose_97aab74a1c2662f7:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_88cb2134dca3aba2:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_0f0d391465909a45:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_e91e64af99b7966d:function(n,t){p(n).onopen=p(t)},__wbg_warn_496b1176d7c30f44:function(n,t){console.warn(w(n,t))},__wbindgen_generic_0000000000000001:function(n,t){return u(A(n,t,o))},__wbindgen_generic_0000000000000002:function(n,t){return u(A(n,t,i))},__wbindgen_generic_0000000000000003:function(n,t){return u(A(n,t,c))},__wbindgen_generic_0000000000000004:function(n,t){return u(A(n,t,r))},__wbindgen_generic_0000000000000005:function(n){return u(n)},__wbindgen_generic_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_generic_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_generic_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(p(n))},__wbindgen_object_drop_ref:function(n){T(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){j.__wasm_bindgen_func_elem_64(n,t)}function o(n,t,e){j.__wasm_bindgen_func_elem_60(n,t,u(e))}function i(n,t,e){j.__wasm_bindgen_func_elem_60_37(n,t,u(e))}function c(n,t,e){j.__wasm_bindgen_func_elem_60_38(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>j.__wbg_channel_free(n,1)));function u(n){v===y.length&&y.push(y.length+1);const t=v;return v=y[t],y[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>j.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==j.memory.buffer)&&(l=new DataView(j.memory.buffer)),l}function w(n,t){return function(n,t){return P+=t,P>=O&&(F=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),F.decode(),P=t),F.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(j.memory.buffer)),g}function p(n){return y[n]}function m(n,t){try{return n.apply(this,t)}catch(n){j.__wbindgen_export3(u(n))}}let y=new Array(1024).fill(void 0);y.push(void 0,null,!0,!1);let v=y.length;function R(n){return null==n}function A(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(j.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t){const e=t(1*n.length,1)>>>0;return h().set(n,e/1),k=n.length,e}function N(n,t,e){if(void 0===e){const e=U.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),k=e.length,r}let r=n.length,o=t(r,1)>>>0;const i=h();let c=0;for(;c<r;c++){const t=n.charCodeAt(c);if(t>127)break;i[o+c]=t}if(c!==r){0!==c&&(n=n.slice(c)),o=e(o,r,r=c+3*n.length,1)>>>0;const t=h().subarray(o+c,o+r);c+=U.encodeInto(n,t).written,o=e(o,r,c,1)>>>0}return k=c,o}function T(n){const t=p(n);return function(n){n<1028||(y[n]=v,v=n)}(n),t}let F=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});F.decode();const O=2146435072;let P=0;const U=new TextEncoder;"encodeInto"in U||(U.encodeInto=function(n,t){const e=U.encode(n);return t.set(e),{read:n.length,written:e.length}});let j,k=0;async function W(n){if(void 0!==j)return j;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;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",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return j=n.exports,l=null,g=null,j}(r)}var $,q,E;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.RDPAuthorized="RDPAuthorized",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck",n.SFTPOpResult="SFTPOpResult"}($||($={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(q||(q={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(E||(E={}));export{n as C,t as E,q as I,$ as P,W as _,E as a}