phirepass-widgets 0.0.113 → 0.0.115

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 (52) hide show
  1. package/dist/cjs/{index-CurErEK7.js → index-BCgmMoIq.js} +3 -3
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/phirepass-downloader_3.cjs.entry.js +157 -41
  4. package/dist/cjs/phirepass-rdp.cjs.entry.js +3 -3
  5. package/dist/cjs/phirepass-terminal.cjs.entry.js +4 -4
  6. package/dist/cjs/phirepass-widgets.cjs.js +3 -3
  7. package/dist/cjs/{protocol-DCBMfc2u.js → protocol-CYh109n2.js} +252 -21
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/common/fetch.js +4 -0
  10. package/dist/collection/components/phirepass-downloader/jobs.js +26 -3
  11. package/dist/collection/components/phirepass-downloader/source.js +14 -0
  12. package/dist/collection/components/phirepass-downloader/views/icons.js +1 -0
  13. package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +9 -0
  14. package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +79 -3
  15. package/dist/collection/components/phirepass-media-player/player.js +24 -0
  16. package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +1 -1
  17. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +33 -33
  18. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
  19. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  20. package/dist/components/p-BtMWUitf.js +1 -0
  21. package/dist/components/p-DIf-Ru26.js +1 -0
  22. package/dist/components/p-DqT-qhTU.js +1 -0
  23. package/dist/components/phirepass-downloader.js +1 -1
  24. package/dist/components/phirepass-media-player.js +1 -1
  25. package/dist/components/phirepass-rdp.js +1 -1
  26. package/dist/components/phirepass-sftp-client.js +1 -1
  27. package/dist/components/phirepass-terminal.js +2 -2
  28. package/dist/esm/{index-B9qUl6FW.js → index-Dd9o0CbU.js} +3 -3
  29. package/dist/esm/loader.js +3 -3
  30. package/dist/esm/phirepass-downloader_3.entry.js +157 -41
  31. package/dist/esm/phirepass-rdp.entry.js +3 -3
  32. package/dist/esm/phirepass-terminal.entry.js +4 -4
  33. package/dist/esm/phirepass-widgets.js +4 -4
  34. package/dist/esm/{protocol-CsYQJXY2.js → protocol-BtMWUitf.js} +251 -20
  35. package/dist/phirepass-widgets/{p-1b84c526.entry.js → p-2fd32ec5.entry.js} +1 -1
  36. package/dist/phirepass-widgets/{p-41dd1ac9.entry.js → p-705501d4.entry.js} +2 -2
  37. package/dist/phirepass-widgets/p-BtMWUitf.js +1 -0
  38. package/dist/phirepass-widgets/{p-B9qUl6FW.js → p-Dd9o0CbU.js} +2 -2
  39. package/dist/phirepass-widgets/p-b8caf9e1.entry.js +1 -0
  40. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  41. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  42. package/dist/types/common/fetch.d.ts +6 -0
  43. package/dist/types/components/phirepass-downloader/jobs.d.ts +10 -2
  44. package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +16 -1
  45. package/dist/types/components/phirepass-media-player/player.d.ts +10 -0
  46. package/dist/types/components.d.ts +10 -2
  47. package/package.json +6 -6
  48. package/dist/components/p-C4cmk3bS.js +0 -1
  49. package/dist/components/p-CsYQJXY2.js +0 -1
  50. package/dist/components/p-D6Geq8Rn.js +0 -1
  51. package/dist/phirepass-widgets/p-614ab3de.entry.js +0 -1
  52. package/dist/phirepass-widgets/p-CsYQJXY2.js +0 -1
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-B9qUl6FW.js';
2
- export { s as setNonce } from './index-B9qUl6FW.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-Dd9o0CbU.js';
2
+ export { s as setNonce } from './index-Dd9o0CbU.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v4.45.3 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.45.4 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
 
9
9
  var patchBrowser = () => {
@@ -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"],"channelFactory":[16],"credentialsPrompt":[32],"statusMessage":[32],"toggleFullscreen":[64],"keyboardLockSupported":[64],"focusDesktop":[64],"sendCtrlAltDel":[64],"sendMetaKey":[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],"keyBar":[1,"key-bar"],"serverId":[1,"server-id"],"channelFactory":[16],"ctrlArmed":[32],"altArmed":[32]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-downloader_3",[[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"],"channelFactory":[16],"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],"channel_ready":[32],"fetch_count":[32],"fresh_names":[32],"part_delete":[32],"torrent_menu":[32],"listing_player":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}],[513,"phirepass-downloader",{"nodeId":[1,"node-id"],"nodeLabel":[1,"node-label"],"token":[1],"channel":[16],"connected":[4],"channelFactory":[16],"browsingService":[1,"browsing-service"],"browsingPath":[1025,"browsing-path"],"compact":[516],"streamBase":[1,"stream-base"],"canConfigure":[4,"can-configure"],"inlinePlayer":[4,"inline-player"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"serverId":[1,"server-id"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"connection":[32],"caps":[32],"jobs":[32],"tab":[32],"drawerOpen":[32],"dialogOpen":[32],"unread":[32],"form":[32],"where":[32],"starting":[32],"refusal":[32],"confirm":[32],"notices":[32],"subDir":[32],"picker":[32],"player":[32],"receive":[64],"openFetch":[64],"toggleDrawer":[64],"jobForPath":[64],"deleteDownload":[64],"torrentPathFor":[64],"startTorrentPath":[64]},null,{"channel":[{"onChannel":0}],"connected":[{"onConnected":0}],"browsingPath":[{"onBrowsing":0}],"browsingService":[{"onBrowsing":0}],"nodeId":[{"onNode":0}]}],[513,"phirepass-media-player",{"src":[1],"name":[1],"mime":[1],"status":[1],"ready":[2],"positionStore":[16],"positionKey":[1,"position-key"],"remotePlayback":[16],"castDevice":[1,"cast-device"],"phase":[32],"stored":[32],"castAvailable":[32],"currentTime":[32],"duration":[32],"close":[64]},null,{"src":[{"onSrc":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"],"channelFactory":[16],"credentialsPrompt":[32],"statusMessage":[32],"toggleFullscreen":[64],"keyboardLockSupported":[64],"focusDesktop":[64],"sendCtrlAltDel":[64],"sendMetaKey":[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],"keyBar":[1,"key-bar"],"serverId":[1,"server-id"],"channelFactory":[16],"ctrlArmed":[32],"altArmed":[32]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-downloader_3",[[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"],"channelFactory":[16],"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],"channel_ready":[32],"fetch_count":[32],"fresh_names":[32],"part_delete":[32],"torrent_menu":[32],"listing_player":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}],[513,"phirepass-downloader",{"nodeId":[1,"node-id"],"nodeLabel":[1,"node-label"],"token":[1],"channel":[16],"connected":[4],"channelFactory":[16],"browsingService":[1,"browsing-service"],"browsingPath":[1025,"browsing-path"],"compact":[516],"streamBase":[1,"stream-base"],"canConfigure":[4,"can-configure"],"inlinePlayer":[4,"inline-player"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"serverId":[1,"server-id"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"connection":[32],"caps":[32],"jobs":[32],"tab":[32],"drawerOpen":[32],"dialogOpen":[32],"unread":[32],"form":[32],"where":[32],"starting":[32],"refusal":[32],"confirm":[32],"notices":[32],"subDir":[32],"picker":[32],"player":[32],"receive":[64],"openFetch":[64],"toggleDrawer":[64],"jobForPath":[64],"deleteDownload":[64],"torrentPathFor":[64],"startTorrentPath":[64]},null,{"channel":[{"onChannel":0}],"connected":[{"onConnected":0}],"browsingPath":[{"onBrowsing":0}],"browsingService":[{"onBrowsing":0}],"nodeId":[{"onNode":0}]}],[513,"phirepass-media-player",{"src":[1],"name":[1],"mime":[1],"status":[1],"ready":[2],"positionStore":[16],"positionKey":[1,"position-key"],"remotePlayback":[16],"linkMinter":[16],"castDevice":[1,"cast-device"],"phase":[32],"stored":[32],"castAvailable":[32],"castSrc":[32],"linkNote":[32],"currentTime":[32],"duration":[32],"close":[64]},null,{"src":[{"onSrc":0}]}]]]], options);
21
21
  });
@@ -270,6 +270,117 @@ class Channel {
270
270
  }
271
271
  wasm.channel_open_ssh_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, val5);
272
272
  }
273
+ /**
274
+ * @param {string} download_id
275
+ * @param {boolean} delete_file
276
+ * @param {number | null} [msg_id]
277
+ */
278
+ send_download_delete(download_id, delete_file, msg_id) {
279
+ const val2 = +delete_file;
280
+ const val3 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
281
+ const ptr0 = passStringToWasm0(download_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
282
+ const len0 = WASM_VECTOR_LEN;
283
+ wasm.channel_send_download_delete(this.__wbg_ptr, ptr0, len0, val2, val3);
284
+ }
285
+ /**
286
+ * @param {string} download_id
287
+ * @param {boolean} ignore_window
288
+ * @param {number | null} [msg_id]
289
+ */
290
+ send_download_resume(download_id, ignore_window, msg_id) {
291
+ const val2 = +ignore_window;
292
+ const val3 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
293
+ const ptr0 = passStringToWasm0(download_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
294
+ const len0 = WASM_VECTOR_LEN;
295
+ wasm.channel_send_download_resume(this.__wbg_ptr, ptr0, len0, val2, val3);
296
+ }
297
+ /**
298
+ * @param {string} download_id
299
+ * @param {boolean} in_order
300
+ * @param {number | null} [msg_id]
301
+ */
302
+ send_download_set_order(download_id, in_order, msg_id) {
303
+ const val2 = +in_order;
304
+ const val3 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
305
+ const ptr0 = passStringToWasm0(download_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
306
+ const len0 = WASM_VECTOR_LEN;
307
+ wasm.channel_send_download_set_order(this.__wbg_ptr, ptr0, len0, val2, val3);
308
+ }
309
+ /**
310
+ * @param {string} node_id
311
+ * @param {number | null} [msg_id]
312
+ */
313
+ send_download_settings_get(node_id, msg_id) {
314
+ const val2 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
315
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
316
+ const len0 = WASM_VECTOR_LEN;
317
+ wasm.channel_send_download_settings_get(this.__wbg_ptr, ptr0, len0, val2);
318
+ }
319
+ /**
320
+ * @param {string} node_id
321
+ * @param {any} settings
322
+ * @param {number | null} [msg_id]
323
+ */
324
+ send_download_settings_save(node_id, settings, msg_id) {
325
+ const val2 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
326
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
327
+ const len0 = WASM_VECTOR_LEN;
328
+ wasm.channel_send_download_settings_save(this.__wbg_ptr, ptr0, len0, settings, val2);
329
+ }
330
+ /**
331
+ * @param {string} node_id
332
+ * @param {any} source
333
+ * @param {string | null | undefined} sub_dir
334
+ * @param {any} browsing
335
+ * @param {boolean | null | undefined} in_order
336
+ * @param {any} options
337
+ * @param {number | null} [msg_id]
338
+ */
339
+ send_download_start(node_id, source, sub_dir, browsing, in_order, options, msg_id) {
340
+ const val3 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
341
+ let ptr0, len0, ptr1, len1;
342
+ try {
343
+ ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
344
+ len0 = WASM_VECTOR_LEN;
345
+ ptr1 = isLikeNone(sub_dir) ? 0 : passStringToWasm0(sub_dir, wasm.__wbindgen_export, wasm.__wbindgen_export2);
346
+ len1 = WASM_VECTOR_LEN;
347
+ } catch (e) {
348
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
349
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
350
+ throw e;
351
+ }
352
+ wasm.channel_send_download_start(this.__wbg_ptr, ptr0, len0, source, ptr1, len1, browsing, isLikeNone(in_order) ? 0xFFFFFF : in_order ? 1 : 0, options, val3);
353
+ }
354
+ /**
355
+ * @param {string} download_id
356
+ * @param {boolean} discard
357
+ * @param {number | null} [msg_id]
358
+ */
359
+ send_download_stop(download_id, discard, msg_id) {
360
+ const val2 = +discard;
361
+ const val3 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
362
+ const ptr0 = passStringToWasm0(download_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
363
+ const len0 = WASM_VECTOR_LEN;
364
+ wasm.channel_send_download_stop(this.__wbg_ptr, ptr0, len0, val2, val3);
365
+ }
366
+ /**
367
+ * `{ Node: "<uuid>" }` or `"All"`.
368
+ * @param {any} scope
369
+ */
370
+ send_download_subscribe(scope) {
371
+ wasm.channel_send_download_subscribe(this.__wbg_ptr, scope);
372
+ }
373
+ /**
374
+ * @param {string} node_id
375
+ * @param {any} browsing
376
+ * @param {number | null} [msg_id]
377
+ */
378
+ send_download_where(node_id, browsing, msg_id) {
379
+ const val2 = +(isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
380
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
381
+ const len0 = WASM_VECTOR_LEN;
382
+ wasm.channel_send_download_where(this.__wbg_ptr, ptr0, len0, browsing, val2);
383
+ }
273
384
  /**
274
385
  * Set permission bits. The agent masks these to `0o7777`.
275
386
  * @param {string} node_id
@@ -701,6 +812,10 @@ function __wbg_get_imports() {
701
812
  const ret = Error(getStringFromWasm0(arg0, arg1));
702
813
  return ret;
703
814
  },
815
+ __wbg_Number_ff192a72a0dcdf6d: function(arg0) {
816
+ const ret = Number(arg0);
817
+ return ret;
818
+ },
704
819
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
705
820
  const ret = String(arg1);
706
821
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -708,6 +823,17 @@ function __wbg_get_imports() {
708
823
  getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
709
824
  getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
710
825
  },
826
+ __wbg___wbindgen_bigint_get_as_i64_11da4b52cd0aedef: function(arg0, arg1) {
827
+ const v = arg1;
828
+ const ret = typeof(v) === 'bigint' ? v : undefined;
829
+ getDataViewMemory0().setBigInt64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
830
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
831
+ },
832
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(arg0) {
833
+ const v = arg0;
834
+ const ret = typeof(v) === 'boolean' ? v : undefined;
835
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
836
+ },
711
837
  __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
712
838
  const ret = debugString(arg1);
713
839
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -715,6 +841,49 @@ function __wbg_get_imports() {
715
841
  getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
716
842
  getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
717
843
  },
844
+ __wbg___wbindgen_in_3f58a9d3b3a7eed2: function(arg0, arg1) {
845
+ const ret = arg0 in arg1;
846
+ return ret;
847
+ },
848
+ __wbg___wbindgen_is_bigint_5fa10641e039d3ef: function(arg0) {
849
+ const ret = typeof(arg0) === 'bigint';
850
+ return ret;
851
+ },
852
+ __wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
853
+ const ret = typeof(arg0) === 'function';
854
+ return ret;
855
+ },
856
+ __wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
857
+ const ret = arg0 === null;
858
+ return ret;
859
+ },
860
+ __wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
861
+ const val = arg0;
862
+ const ret = typeof(val) === 'object' && val !== null;
863
+ return ret;
864
+ },
865
+ __wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
866
+ const ret = typeof(arg0) === 'string';
867
+ return ret;
868
+ },
869
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
870
+ const ret = arg0 === undefined;
871
+ return ret;
872
+ },
873
+ __wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
874
+ const ret = arg0 === arg1;
875
+ return ret;
876
+ },
877
+ __wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36: function(arg0, arg1) {
878
+ const ret = arg0 == arg1;
879
+ return ret;
880
+ },
881
+ __wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
882
+ const obj = arg1;
883
+ const ret = typeof(obj) === 'number' ? obj : undefined;
884
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
885
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
886
+ },
718
887
  __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
719
888
  const obj = arg1;
720
889
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -741,7 +910,7 @@ function __wbg_get_imports() {
741
910
  const ret = arg0.call(arg1, arg2, arg3);
742
911
  return ret;
743
912
  }, arguments); },
744
- __wbg_clearInterval_26ba580547547579: function(arg0) {
913
+ __wbg_clearInterval_2ed00e80b9bdc143: function(arg0) {
745
914
  const ret = clearInterval(arg0);
746
915
  return ret;
747
916
  },
@@ -752,6 +921,14 @@ function __wbg_get_imports() {
752
921
  const ret = arg0.data;
753
922
  return ret;
754
923
  },
924
+ __wbg_done_57e08d0be6e30c02: function(arg0) {
925
+ const ret = arg0.done;
926
+ return ret;
927
+ },
928
+ __wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
929
+ const ret = Object.entries(arg0);
930
+ return ret;
931
+ },
755
932
  __wbg_from_eac91875c8a5ffa4: function(arg0) {
756
933
  const ret = Array.from(arg0);
757
934
  return ret;
@@ -763,7 +940,23 @@ function __wbg_get_imports() {
763
940
  const ret = Reflect.get(arg0, arg1);
764
941
  return ret;
765
942
  }, arguments); },
766
- __wbg_info_2b8ee6588e4c6072: function(arg0, arg1) {
943
+ __wbg_get_635eea311fa1a291: function() { return handleError(function (arg0, arg1) {
944
+ const ret = Reflect.get(arg0, arg1);
945
+ return ret;
946
+ }, arguments); },
947
+ __wbg_get_d7176cfb76d71114: function(arg0, arg1) {
948
+ const ret = arg0[arg1 >>> 0];
949
+ return ret;
950
+ },
951
+ __wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
952
+ const ret = arg0[arg1 >>> 0];
953
+ return ret;
954
+ },
955
+ __wbg_get_with_ref_key_fc601247060b7204: function(arg0, arg1) {
956
+ const ret = arg0[arg1];
957
+ return ret;
958
+ },
959
+ __wbg_info_b0bac022aae81d46: function(arg0, arg1) {
767
960
  console.info(getStringFromWasm0(arg0, arg1));
768
961
  },
769
962
  __wbg_instanceof_ArrayBuffer_12cdaa4161423e6b: function(arg0) {
@@ -776,10 +969,36 @@ function __wbg_get_imports() {
776
969
  const ret = result;
777
970
  return ret;
778
971
  },
972
+ __wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
973
+ let result;
974
+ try {
975
+ result = arg0 instanceof Uint8Array;
976
+ } catch (_) {
977
+ result = false;
978
+ }
979
+ const ret = result;
980
+ return ret;
981
+ },
982
+ __wbg_isArray_bcf1376d0d732d08: function(arg0) {
983
+ const ret = Array.isArray(arg0);
984
+ return ret;
985
+ },
986
+ __wbg_isSafeInteger_1a35ba4d31e71d38: function(arg0) {
987
+ const ret = Number.isSafeInteger(arg0);
988
+ return ret;
989
+ },
990
+ __wbg_iterator_e4c5e8f68ada7b58: function() {
991
+ const ret = Symbol.iterator;
992
+ return ret;
993
+ },
779
994
  __wbg_length_186163212ffe79c3: function(arg0) {
780
995
  const ret = arg0.length;
781
996
  return ret;
782
997
  },
998
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
999
+ const ret = arg0.length;
1000
+ return ret;
1001
+ },
783
1002
  __wbg_new_13de428334042d26: function(arg0) {
784
1003
  const ret = new Uint8Array(arg0);
785
1004
  return ret;
@@ -796,6 +1015,14 @@ function __wbg_get_imports() {
796
1015
  const ret = new WebSocket(getStringFromWasm0(arg0, arg1), arg2);
797
1016
  return ret;
798
1017
  }, arguments); },
1018
+ __wbg_next_178c1651c11432b3: function(arg0) {
1019
+ const ret = arg0.next;
1020
+ return ret;
1021
+ },
1022
+ __wbg_next_af5ac6a08bb0a717: function() { return handleError(function (arg0) {
1023
+ const ret = arg0.next();
1024
+ return ret;
1025
+ }, arguments); },
799
1026
  __wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
800
1027
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
801
1028
  },
@@ -810,7 +1037,7 @@ function __wbg_get_imports() {
810
1037
  __wbg_send_d83d0891cf698779: function() { return handleError(function (arg0, arg1, arg2) {
811
1038
  arg0.send(getArrayU8FromWasm0(arg1, arg2));
812
1039
  }, arguments); },
813
- __wbg_setInterval_d933acbf2578adfa: function() { return handleError(function (arg0, arg1) {
1040
+ __wbg_setInterval_ef738bbfe8cc0974: function() { return handleError(function (arg0, arg1) {
814
1041
  const ret = setInterval(arg0, arg1);
815
1042
  return ret;
816
1043
  }, arguments); },
@@ -835,27 +1062,31 @@ function __wbg_get_imports() {
835
1062
  __wbg_set_onopen_757be120cc7b1ea6: function(arg0, arg1) {
836
1063
  arg0.onopen = arg1;
837
1064
  },
838
- __wbg_warn_b0df9a9e7105e74b: function(arg0, arg1) {
1065
+ __wbg_value_e0f328965e184931: function(arg0) {
1066
+ const ret = arg0.value;
1067
+ return ret;
1068
+ },
1069
+ __wbg_warn_95c497419b251cd5: function(arg0, arg1) {
839
1070
  console.warn(getStringFromWasm0(arg0, arg1));
840
1071
  },
841
1072
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
842
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
843
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_63);
1073
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1074
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_96);
844
1075
  return ret;
845
1076
  },
846
1077
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
847
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
848
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_63_37);
1078
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1079
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_96_46);
849
1080
  return ret;
850
1081
  },
851
1082
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
852
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
853
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_63_38);
1083
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1084
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_96_47);
854
1085
  return ret;
855
1086
  },
856
1087
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
857
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
858
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_67);
1088
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 7, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1089
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_100);
859
1090
  return ret;
860
1091
  },
861
1092
  __wbindgen_generic_0000000000000005: function(arg0) {
@@ -893,20 +1124,20 @@ function __wbg_get_imports() {
893
1124
  };
894
1125
  }
895
1126
 
896
- function __wasm_bindgen_func_elem_67(arg0, arg1) {
897
- wasm.__wasm_bindgen_func_elem_67(arg0, arg1);
1127
+ function __wasm_bindgen_func_elem_100(arg0, arg1) {
1128
+ wasm.__wasm_bindgen_func_elem_100(arg0, arg1);
898
1129
  }
899
1130
 
900
- function __wasm_bindgen_func_elem_63(arg0, arg1, arg2) {
901
- wasm.__wasm_bindgen_func_elem_63(arg0, arg1, arg2);
1131
+ function __wasm_bindgen_func_elem_96(arg0, arg1, arg2) {
1132
+ wasm.__wasm_bindgen_func_elem_96(arg0, arg1, arg2);
902
1133
  }
903
1134
 
904
- function __wasm_bindgen_func_elem_63_37(arg0, arg1, arg2) {
905
- wasm.__wasm_bindgen_func_elem_63_37(arg0, arg1, arg2);
1135
+ function __wasm_bindgen_func_elem_96_46(arg0, arg1, arg2) {
1136
+ wasm.__wasm_bindgen_func_elem_96_46(arg0, arg1, arg2);
906
1137
  }
907
1138
 
908
- function __wasm_bindgen_func_elem_63_38(arg0, arg1, arg2) {
909
- wasm.__wasm_bindgen_func_elem_63_38(arg0, arg1, arg2);
1139
+ function __wasm_bindgen_func_elem_96_47(arg0, arg1, arg2) {
1140
+ wasm.__wasm_bindgen_func_elem_96_47(arg0, arg1, arg2);
910
1141
  }
911
1142
 
912
1143
 
@@ -1 +1 @@
1
- import{r as t,c as e,g as s,h as i,H as o}from"./p-B9qUl6FW.js";import{_ as n,C as h,a as r,P as a}from"./p-CsYQJXY2.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 e=t.getBoundingClientRect();return s=e.height,{width:l(d(e.width)),height:l(d(s))};var s}class p{onResize;debounceMs;observer;handle;reported;constructor(t,e=250){this.onResize=t,this.debounceMs=e}observe(t,e){this.disconnect(),this.reported=e,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 e,s;s=this.reported,(e=t)&&s&&e.width===s.width&&e.height===s.height||(this.reported=t,this.onResize(t))}}function m(){return navigator.keyboard}function f(){return"function"==typeof m()?.lock}function b(t){return document.fullscreenElement===t}function w(t){return document.fullscreenElement?.contains(t)??!1}function y(){if(f())try{m().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const g=class{constructor(s){new.target===g&&t(this,s),this.connectionStateChanged=e(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 s(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,e){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;channelFactory;onServerIdChange(t,e){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,this.channelFactory||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 b(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(e){return console.warn("Failed to change the fullscreen state of the RDP session:",e),b(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return f()}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.channelFactory?this.channelFactory(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId||void 0):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:e}=t.data;switch(e.type){case a.Error:this.handle_error(e);break;case a.AuthSuccess:this.handle_auth_success(e);break;case a.RDPAuthorized:this.handle_rdp_authorized(e);break;case a.TunnelClosed:this.handle_tunnel_closed(e);break;default:console.warn("Unknown protocol message type:",e)}}))}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[e]=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 e.init("info"),this.disposed||!this.containerEl||this.session_id!==t.sid)return;const s=document.createElement("iron-remote-desktop");s.module=e.Backend,s.scale=this.scale,s.flexcenter=!0,s.verbose=!1;const i=[e.enableCredssp(!0)];this.dynamicResize&&i.push(e.displayControl(!0)),s.addEventListener("ready",(e=>{this.start_session(e.detail.irgUserInteraction,t.ticket,i)})),this.ironEl=s,this.mount_client(s)}mount_client(t){this.el.appendChild(t)}async start_session(t,e,s){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(e);for(const t of s)i.withExtension(t);let o;this.dynamicResize&&(o=function(t){const e=t.getBoundingClientRect();if(Number.isFinite(e.width)&&Number.isFinite(e.height)&&!(e.width<c||e.height<c))return{width:l(Math.min(Math.floor(e.width),4096)),height:l(Math.min(Math.floor(e.height),4096))}}(this.el),o&&i.withDesktopSize(o));try{const e=await t.connect(i.build());if(this.disposed)return this.shutdown_session(t),void await e.run();t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.sync_keyboard_lock();const s=e.run();this.start_viewport_sync(o);const n=await s;this.statusMessage=n.reason()}catch(t){const e=this.describe_error(t);this.statusMessage=e,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&&w(this.el)?(await async function(t){if(f()&&w(t))try{await m().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):y()}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(),y(),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:"04896084a5e914a9e2a184ee7b560f4978da9bfd"},i("div",{key:"db5d3d0d4351aeb868ffe6956b86f22b62775e4b",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"efafd5d8b1437687713aff0425c050413593d162"})),this.credentialsPrompt&&i("form",{key:"ad6079b6db1d71e8eb60bef71cd808be22b7387c",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"b976c7a3c01e4983fac39e1ef027e4307a6654c7",htmlFor:"rdp-username"},"Username"),i("input",{key:"3a90a73a446015d708eaebec6a7d9bc1703ae5d0",id:"rdp-username",type:"text",autocomplete:"off",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"eaf13aa5fe39e4576de052b15c85e6b60be466cb",htmlFor:"rdp-password"},"Password"),i("input",{key:"d53ec8c48b7826b011a07bcb57b7ae1fbe30160f",id:"rdp-password",type:"password",autocomplete:"off",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"d1616e75c1f37a853ec793a25ffc8919544c16d2",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"8e6deb9e32f0c416bf85666847f10e095f40e210",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;container-type:inline-size}.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}@container (max-width: 640px){.prompt{padding:1rem;gap:0.4rem}.prompt input{min-width:0;width:100%;max-width:22rem;font-size:16px;padding:0.625rem 0.75rem}.prompt button{width:100%;max-width:22rem;padding:0.75rem 1.25rem}.status{font-size:0.75rem;padding:0.5rem;padding-bottom:calc(0.5rem + env(safe-area-inset-bottom))}}';export{g as phirepass_rdp}
1
+ import{r as t,c as e,g as s,h as i,H as o}from"./p-Dd9o0CbU.js";import{_ as n,C as h,a as r,P as a}from"./p-BtMWUitf.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 e=t.getBoundingClientRect();return s=e.height,{width:l(d(e.width)),height:l(d(s))};var s}class p{onResize;debounceMs;observer;handle;reported;constructor(t,e=250){this.onResize=t,this.debounceMs=e}observe(t,e){this.disconnect(),this.reported=e,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 e,s;s=this.reported,(e=t)&&s&&e.width===s.width&&e.height===s.height||(this.reported=t,this.onResize(t))}}function f(){return navigator.keyboard}function m(){return"function"==typeof f()?.lock}function b(t){return document.fullscreenElement===t}function w(t){return document.fullscreenElement?.contains(t)??!1}function y(){if(m())try{f().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const g=class{constructor(s){new.target===g&&t(this,s),this.connectionStateChanged=e(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 s(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,e){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;channelFactory;onServerIdChange(t,e){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,this.channelFactory||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 b(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(e){return console.warn("Failed to change the fullscreen state of the RDP session:",e),b(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return m()}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.channelFactory?this.channelFactory(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId||void 0):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:e}=t.data;switch(e.type){case a.Error:this.handle_error(e);break;case a.AuthSuccess:this.handle_auth_success(e);break;case a.RDPAuthorized:this.handle_rdp_authorized(e);break;case a.TunnelClosed:this.handle_tunnel_closed(e);break;default:console.warn("Unknown protocol message type:",e)}}))}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[e]=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 e.init("info"),this.disposed||!this.containerEl||this.session_id!==t.sid)return;const s=document.createElement("iron-remote-desktop");s.module=e.Backend,s.scale=this.scale,s.flexcenter=!0,s.verbose=!1;const i=[e.enableCredssp(!0)];this.dynamicResize&&i.push(e.displayControl(!0)),s.addEventListener("ready",(e=>{this.start_session(e.detail.irgUserInteraction,t.ticket,i)})),this.ironEl=s,this.mount_client(s)}mount_client(t){this.el.appendChild(t)}async start_session(t,e,s){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(e);for(const t of s)i.withExtension(t);let o;this.dynamicResize&&(o=function(t){const e=t.getBoundingClientRect();if(Number.isFinite(e.width)&&Number.isFinite(e.height)&&!(e.width<c||e.height<c))return{width:l(Math.min(Math.floor(e.width),4096)),height:l(Math.min(Math.floor(e.height),4096))}}(this.el),o&&i.withDesktopSize(o));try{const e=await t.connect(i.build());if(this.disposed)return this.shutdown_session(t),void await e.run();t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.sync_keyboard_lock();const s=e.run();this.start_viewport_sync(o);const n=await s;this.statusMessage=n.reason()}catch(t){const e=this.describe_error(t);this.statusMessage=e,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&&w(this.el)?(await async function(t){if(m()&&w(t))try{await f().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):y()}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(),y(),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:"9db127da5dbe168ef5f7a021767e5cedeb8305e6"},i("div",{key:"06d2de6763ec479198389032ab65033eefab21d6",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"7842ca9fd64795794e1b90e15319ddaa599f85b8"})),this.credentialsPrompt&&i("form",{key:"ce53830ced182740f139a318f099918c31013d9f",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"2b55341b9cfc2e08a847e26985000f5e1bc86eca",htmlFor:"rdp-username"},"Username"),i("input",{key:"243500ff59de6f16cc67acc5ddf9e15e3c0de0f6",id:"rdp-username",type:"text",autocomplete:"off",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"5a346aa6a730c4cb0dd550eab9a65db9f2e74bc6",htmlFor:"rdp-password"},"Password"),i("input",{key:"0f1081b05f94e15a7f04df4de390a33a021ffe53",id:"rdp-password",type:"password",autocomplete:"off",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"e9657c9df124176210508f5125fc526e3c78c5f1",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"3c59dbae63b7c5c5ef80344abad4b1a2b4c0b79d",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;container-type:inline-size}.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}@container (max-width: 640px){.prompt{padding:1rem;gap:0.4rem}.prompt input{min-width:0;width:100%;max-width:22rem;font-size:16px;padding:0.625rem 0.75rem}.prompt button{width:100%;max-width:22rem;padding:0.75rem 1.25rem}.status{font-size:0.75rem;padding:0.5rem;padding-bottom:calc(0.5rem + env(safe-area-inset-bottom))}}';export{g as phirepass_rdp}