phirepass-widgets 0.0.48 → 0.0.50
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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +140 -18
- package/dist/cjs/phirepass-terminal.cjs.entry.js +1 -1
- package/dist/cjs/phirepass-widgets.cjs.js +1 -1
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +195 -13
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +151 -18
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/phirepass-sftp-client.entry.js +140 -18
- package/dist/esm/phirepass-terminal.entry.js +1 -1
- package/dist/esm/phirepass-widgets.js +1 -1
- package/dist/phirepass-widgets/{p-d8e588a3.entry.js → p-282d5896.entry.js} +1 -1
- package/dist/phirepass-widgets/p-5ac2d2bb.entry.js +1 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +22 -0
- package/package.json +1 -1
- package/dist/phirepass-widgets/p-764392dc.entry.js +0 -1
|
@@ -16,6 +16,9 @@ export class PhirepassSftpClient {
|
|
|
16
16
|
runtimeReady = false;
|
|
17
17
|
connected = false;
|
|
18
18
|
uploadInputEl;
|
|
19
|
+
uploadProgressHandle;
|
|
20
|
+
downloadProgressHandle;
|
|
21
|
+
deleteLoadingTimeout;
|
|
19
22
|
// private inputMode: InputMode = InputMode.Default;
|
|
20
23
|
session_id;
|
|
21
24
|
// private usernameBuffer = "";
|
|
@@ -73,6 +76,17 @@ export class PhirepassSftpClient {
|
|
|
73
76
|
version = '';
|
|
74
77
|
status = 'Disconnected';
|
|
75
78
|
selected_item = null;
|
|
79
|
+
show_upload_modal = false;
|
|
80
|
+
upload_progress = 0;
|
|
81
|
+
upload_file_name = '';
|
|
82
|
+
upload_finished = false;
|
|
83
|
+
show_download_modal = false;
|
|
84
|
+
download_progress = 0;
|
|
85
|
+
download_file_name = '';
|
|
86
|
+
download_finished = false;
|
|
87
|
+
show_delete_modal = false;
|
|
88
|
+
delete_file_name = '';
|
|
89
|
+
delete_loading = false;
|
|
76
90
|
toggle_max() {
|
|
77
91
|
this.maximizeEvent?.emit(!this.max);
|
|
78
92
|
}
|
|
@@ -103,9 +117,30 @@ export class PhirepassSftpClient {
|
|
|
103
117
|
this.connected = false;
|
|
104
118
|
this.domReady = false;
|
|
105
119
|
this.runtimeReady = false;
|
|
120
|
+
this.clear_upload_progress();
|
|
121
|
+
this.clear_download_progress();
|
|
122
|
+
this.clear_delete_loading_timeout();
|
|
106
123
|
this.close_comms();
|
|
107
124
|
// this.destroy_terminal();
|
|
108
125
|
}
|
|
126
|
+
clear_upload_progress() {
|
|
127
|
+
if (this.uploadProgressHandle !== undefined) {
|
|
128
|
+
window.clearInterval(this.uploadProgressHandle);
|
|
129
|
+
this.uploadProgressHandle = undefined;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
clear_download_progress() {
|
|
133
|
+
if (this.downloadProgressHandle !== undefined) {
|
|
134
|
+
window.clearInterval(this.downloadProgressHandle);
|
|
135
|
+
this.downloadProgressHandle = undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
clear_delete_loading_timeout() {
|
|
139
|
+
if (this.deleteLoadingTimeout !== undefined) {
|
|
140
|
+
window.clearTimeout(this.deleteLoadingTimeout);
|
|
141
|
+
this.deleteLoadingTimeout = undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
109
144
|
connect() {
|
|
110
145
|
this.connected = true;
|
|
111
146
|
this.channel.connect();
|
|
@@ -311,24 +346,93 @@ export class PhirepassSftpClient {
|
|
|
311
346
|
event.preventDefault();
|
|
312
347
|
event.stopPropagation();
|
|
313
348
|
this.selected_item = item;
|
|
314
|
-
|
|
349
|
+
this.download_file_name = item.name;
|
|
350
|
+
this.download_progress = 0;
|
|
351
|
+
this.download_finished = false;
|
|
352
|
+
this.show_download_modal = true;
|
|
353
|
+
this.clear_download_progress();
|
|
354
|
+
this.downloadProgressHandle = window.setInterval(() => {
|
|
355
|
+
if (this.download_progress >= 100) {
|
|
356
|
+
this.clear_download_progress();
|
|
357
|
+
this.download_finished = true;
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
this.download_progress = Math.min(100, this.download_progress + 5);
|
|
361
|
+
}, 180);
|
|
362
|
+
}
|
|
363
|
+
on_file_delete_action(item, event) {
|
|
364
|
+
event.preventDefault();
|
|
365
|
+
event.stopPropagation();
|
|
366
|
+
this.selected_item = item;
|
|
367
|
+
this.delete_file_name = item.name;
|
|
368
|
+
this.delete_loading = false;
|
|
369
|
+
this.show_delete_modal = true;
|
|
370
|
+
}
|
|
371
|
+
cancel_delete() {
|
|
372
|
+
if (this.delete_loading) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.show_delete_modal = false;
|
|
376
|
+
this.delete_file_name = '';
|
|
377
|
+
this.delete_loading = false;
|
|
378
|
+
}
|
|
379
|
+
confirm_delete() {
|
|
380
|
+
if (this.delete_loading) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
this.delete_loading = true;
|
|
384
|
+
const deletingFileName = this.delete_file_name;
|
|
385
|
+
this.clear_delete_loading_timeout();
|
|
386
|
+
this.deleteLoadingTimeout = window.setTimeout(() => {
|
|
387
|
+
this.show_delete_modal = false;
|
|
388
|
+
this.delete_loading = false;
|
|
389
|
+
this.show_error = true;
|
|
390
|
+
this.error_message = `Delete for "${deletingFileName}" is not available yet.`;
|
|
391
|
+
window.setTimeout(() => {
|
|
392
|
+
this.show_error = false;
|
|
393
|
+
}, 2_000);
|
|
394
|
+
this.delete_file_name = '';
|
|
395
|
+
this.deleteLoadingTimeout = undefined;
|
|
396
|
+
}, 1_100);
|
|
315
397
|
}
|
|
316
398
|
open_upload_picker() {
|
|
317
399
|
this.uploadInputEl?.click();
|
|
318
400
|
}
|
|
319
401
|
on_upload_selected(event) {
|
|
320
402
|
const input = event.target;
|
|
321
|
-
const
|
|
322
|
-
if (!
|
|
403
|
+
const selectedFile = input.files?.[0];
|
|
404
|
+
if (!selectedFile) {
|
|
323
405
|
return;
|
|
324
406
|
}
|
|
325
|
-
this.
|
|
326
|
-
this.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
407
|
+
this.upload_file_name = selectedFile.name;
|
|
408
|
+
this.upload_progress = 0;
|
|
409
|
+
this.upload_finished = false;
|
|
410
|
+
this.show_upload_modal = true;
|
|
411
|
+
this.clear_upload_progress();
|
|
412
|
+
this.uploadProgressHandle = window.setInterval(() => {
|
|
413
|
+
if (this.upload_progress >= 100) {
|
|
414
|
+
this.clear_upload_progress();
|
|
415
|
+
this.upload_finished = true;
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
this.upload_progress = Math.min(100, this.upload_progress + 5);
|
|
419
|
+
}, 180);
|
|
330
420
|
input.value = '';
|
|
331
421
|
}
|
|
422
|
+
cancel_upload() {
|
|
423
|
+
this.clear_upload_progress();
|
|
424
|
+
this.show_upload_modal = false;
|
|
425
|
+
this.upload_progress = 0;
|
|
426
|
+
this.upload_file_name = '';
|
|
427
|
+
this.upload_finished = false;
|
|
428
|
+
}
|
|
429
|
+
cancel_download() {
|
|
430
|
+
this.clear_download_progress();
|
|
431
|
+
this.show_download_modal = false;
|
|
432
|
+
this.download_progress = 0;
|
|
433
|
+
this.download_file_name = '';
|
|
434
|
+
this.download_finished = false;
|
|
435
|
+
}
|
|
332
436
|
is_selected(item) {
|
|
333
437
|
if (!this.selected_item) {
|
|
334
438
|
return false;
|
|
@@ -359,18 +463,18 @@ export class PhirepassSftpClient {
|
|
|
359
463
|
return [item.path, item.name].join('/');
|
|
360
464
|
}
|
|
361
465
|
render() {
|
|
362
|
-
return (h(Host, { key: '
|
|
466
|
+
return (h(Host, { key: '31a797ab81c687e6aaea760d882e8078d4ab226f', class: {
|
|
363
467
|
'default': !this.max,
|
|
364
468
|
'max': this.max,
|
|
365
|
-
} }, h("section", { key: '
|
|
366
|
-
h("header", { key: '
|
|
469
|
+
} }, h("section", { key: '0dd1df187509d0f2c3dc172119f97224a1fb8234', class: "listing" }, !this.hideHeader &&
|
|
470
|
+
h("header", { key: 'af24358a2d1d6ec9dc282683b1feff0a29287dd0' }, h("section", { key: 'f0195c9b0f99fe3c7ca64c7db04a3b08255bb58e', class: "title" }, h("img", { key: 'e04889ab957ccddb181850a5a787b6e40191842e', src: svg, alt: "SFTP Client" }), h("div", { key: 'dc364ca7481d3b78e99319c66a6a40dc29100ea4', class: "text" }, h("div", { key: '7b226fe3a81631656e8fce0b5a69854c3aaeb9c5', class: "name" }, this.name), h("div", { key: '8a843a5134ed28a985d2d1787b17ea3c7436bd45', class: "description" }, this.description))), h("section", { key: '73aec9dd75115faf4dfbcdfde1a076c960954923', class: "actions" }, h("div", { key: 'ce75ef7f9c3433e9d6dfadb41e0716a165666ee8', class: "action", onClick: () => this.toggle_max() }, h("img", { key: 'abbba7e239c57a52dfd46ed23aeeac81874f097c', src: max, alt: "Maximize" })))), h("main", { key: 'fbdd529cfb3090f41dba72f7333efe3a1af29aa4' }, this.show_navigation && h("nav", { key: '17601f7bf03f76169a14803ad0cc11b21f72df8d', class: "navigation" }, h("div", { key: '55fffc7a4686e4978002b9edf6334b07fc57322b', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index, breadcrumbs) => (h(h.Fragment, null, h("span", { key: index, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index < breadcrumbs.length - 1 && h("img", { class: "arrow", src: chevron }))))), h("section", { key: '163eb105d575eddebad721f4e114ea8f5a8e44a1', class: "actions", "aria-label": "SFTP actions" }, h("button", { key: 'ad9cbebffdc46ba08b3d05adc33a18ad027f1b3d', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, h("img", { key: '4f1bfd8154df3df70f8892b1f17391f06ac5ea3e', src: go_up, alt: "Go up" })), h("button", { key: '5bcb098f9fcfb61e6af07e9224617e82ce9e8e8b', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, h("img", { key: '863997b8a0ad3f465b68c10747739aa6bc123934', src: refresh, alt: "Refresh" })), h("button", { key: 'dcae91b637f58f7567709367b4607148ba6c84ce', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, h("img", { key: '75baffc951eb5bef65be10e1b77d782048fe19bc', src: upload, alt: "Upload" })), h("button", { key: '7ce741e5e4538bfa50b330128153584cae966865', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), h("input", { key: '86686c4eb1f5e56e2828687c8843ac0a0f79028b', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && h("div", { key: 'd5be43d27ae7933ad1eea5d9c7d53b3a4fa4d292', class: "content" }, h("table", { key: 'e6f57d64703faef89347da8c412eb4b224878a68' }, h("thead", { key: '89979dd9702878b6d0bccddb971c1e42353c4515' }, h("tr", { key: '9c744d7e8e12bd189ba17f6b2b7a4f371b4932eb' }, h("th", { key: '6f29cf58e3000d3d02881d38ca8065ab4174300d' }, "Name"), h("th", { key: '79ec3f7d0ac3a12a450f275845360576bd1430c6' }, "Size"), h("th", { key: 'ea1718d678f7016472688d7d08d311aad727dcc9' }, "Permissions"), h("th", { key: '6272cb391bd19801f9967b704185520799dc8a11' }, "Owner"), h("th", { key: '91fec7f7e28354e88a12fc7f92c543172800f0b3' }, "Modified"), h("th", { key: '6256a9926941f12ce4807c926e09c3a39c776d2d', class: "action-col", "aria-label": "Actions" }))), h("tbody", { key: 'f1e57f678a8381e4dad5c8daab6624849378b012' }, this.listing.map((item, index) => (h("tr", { key: index, class: {
|
|
367
471
|
'selected': this.is_selected(item),
|
|
368
472
|
}, onClick: () => this.list_directory(item) }, h("td", null, item.kind === 'Folder' ? h("img", { class: "kind", src: folder, alt: "Folder" }) : h("img", { class: "kind", src: file, alt: "File" }), h("span", { class: `name ${item.kind.toLowerCase()}` }, item.name)), h("td", null, item.attributes.size), h("td", null, item.attributes.permissions ?? '-'), h("td", null, item.attributes.user ?? '-'), h("td", null, new Date(item.attributes.mtime * 1000).toLocaleString()), h("td", { class: "action-col" }, item.kind === 'File' &&
|
|
369
|
-
h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": "Download" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("polyline", { points: "7 10 12 15 17 10" }), h("line", { x1: "12", x2: "12", y1: "15", y2: "3" })))))))))), this.show_loader && h("div", { key: '
|
|
370
|
-
h("section", { key: '
|
|
473
|
+
h("div", { class: "file-actions" }, h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": "Download" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("polyline", { points: "7 10 12 15 17 10" }), h("line", { x1: "12", x2: "12", y1: "15", y2: "3" }))), h("button", { type: "button", class: "file-action delete", onClick: (event) => this.on_file_delete_action(item, event), title: "Delete", "aria-label": "Delete" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("polyline", { points: "3 6 5 6 21 6" }), h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }), h("line", { x1: "10", x2: "10", y1: "11", y2: "17" }), h("line", { x1: "14", x2: "14", y1: "11", y2: "17" }))))))))))), this.show_loader && h("div", { key: '141c34cb925c0e42fca1e0397b610071b360c0d1', class: "loader" }, "Loading..."), this.show_error && h("div", { key: 'ebf97cf4b7307514e724c7778c4a9052ec32c68d', class: "error" }, this.error_message)), h("footer", { key: '1f243a6d09afe5380466dec79226bde67679ace8' }, h("section", { key: '59f7e3dd679213d76294c347f1af8ca4f3d5b3e6', class: "status" }, h("span", { key: '4aaebcfa2fea3e69d02814727c63484fd465dfee' }, this.status), this.selected_item && h("span", { key: '5f37d4f9a82a97cd5065651d5f4311104153b8a7', class: "selected-item" }, this.get_full_path(this.selected_item))), h("section", { key: '0a75c580bb9ce63e58e4cd3aef76f13f5d8a6c43', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
|
|
474
|
+
h("section", { key: 'bf83e07198a7bd7f6b11164261496cee880e8e95', class: {
|
|
371
475
|
'creds': true,
|
|
372
476
|
'blurred': this.show_login_screen,
|
|
373
|
-
} }, h("form", { key: '
|
|
477
|
+
} }, h("form", { key: 'c0b3f36031b3d0575e0dfc4d4e5c689a3e86093e', class: "auth", onSubmit: (event) => {
|
|
374
478
|
const formData = new FormData(event.target);
|
|
375
479
|
let username = undefined;
|
|
376
480
|
if (this.show_login_screen_username) {
|
|
@@ -387,9 +491,27 @@ export class PhirepassSftpClient {
|
|
|
387
491
|
this.show_loader = true;
|
|
388
492
|
event.stopPropagation();
|
|
389
493
|
event.preventDefault();
|
|
390
|
-
} }, h("div", { key: '
|
|
391
|
-
h("div", { key: '
|
|
392
|
-
h("div", { key: '
|
|
494
|
+
} }, h("div", { key: 'f8f811323c0aaa9d2c6e7c70b39e2bc58073f500', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
|
|
495
|
+
h("div", { key: '9d37d47a0c3d7235711964979389e34e7ae909e4' }, h("label", { key: '870aefcf5b1052663df6564158f85f0a1a6c14fc', htmlFor: "username" }, "Username"), h("input", { key: 'b51ee3b3f4a73c7116ace5d1d111d76e6c2d44a2', id: "username", autoComplete: 'off', name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
|
|
496
|
+
h("div", { key: 'f727237549f83c27639f943414665eab507d3e0b' }, h("label", { key: 'e0607fbaa128a26ca8a6ce2be5976c2be66cf1a8', htmlFor: "password" }, "Password"), h("input", { key: '4458ad7c4927bf21e27c9b979c14d5d3ca377514', id: "password", autoComplete: 'off', name: "password", type: "password", placeholder: "" })), h("div", { key: '7e3a5f468cc73a370558d4f447e1e7e91ea9dff2' }, h("button", { key: 'c63922f8ffd4377a13c76f51108e8fc9cfa7cdfa', type: "submit" }, "Connect")))), this.show_upload_modal &&
|
|
497
|
+
h("section", { key: 'b7935f9ab9e2cbfc8ecb66aff2c212e8f008675f', class: {
|
|
498
|
+
'upload-modal': true,
|
|
499
|
+
'visible': this.show_upload_modal,
|
|
500
|
+
} }, h("div", { key: 'e7c84c44c5ccec4d7211dd647abee21ba9e4dded', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, h("div", { key: '42411ccf81daad3d6f94455ec5f39a2ec8bd32ce', class: "title" }, "Uploading File"), h("div", { key: 'd7e6db3d7af27e69533bf2bcc532ab36de241a84', class: "file-name", title: this.upload_file_name }, this.upload_file_name), h("div", { key: '3b1e1eb29e1d9b737bf52c3e9d59c33871d661fc', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, h("div", { key: '36d23d0a85747aa12f36b05caa4fa047095245b9', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), h("div", { key: 'd981d282d1ad7216eee6a6ea8eaf0b48655d6b00', class: "progress-value" }, this.upload_progress, "%"), h("button", { key: '1e5eb505505098bc88fadad649da78e4f291e8c3', type: "button", class: {
|
|
501
|
+
'cancel': true,
|
|
502
|
+
'finished': this.upload_finished,
|
|
503
|
+
}, onClick: () => this.cancel_upload() }, this.upload_finished ? 'Close' : 'Cancel'))), this.show_download_modal &&
|
|
504
|
+
h("section", { key: 'f2d75e7719e5a5ecad1dc37145da05cedefc53eb', class: {
|
|
505
|
+
'download-modal': true,
|
|
506
|
+
'visible': this.show_download_modal,
|
|
507
|
+
} }, h("div", { key: '248a10deae9f5869290a362d2ec0dc49480c2f6a', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, h("div", { key: '05f2f39b31a59ecb402c8b803b9ba8819d9b41d3', class: "title" }, "Downloading File"), h("div", { key: '9979cfdbd9f0ac1888fbce3050ea51f1ac7fbc13', class: "file-name", title: this.download_file_name }, this.download_file_name), h("div", { key: '5a0edbdb962e730fb8b4ff6ed06d1826e84d6ee4', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, h("div", { key: 'fdb25a6a1a42cb82050b4d6e4da4cae52c09ecc1', class: "progress-fill", style: { width: `${this.download_progress}%` } })), h("div", { key: '2b9d47914221aa0537c0317b87cebedeb5c99b57', class: "progress-value" }, this.download_progress, "%"), h("button", { key: '15dee8510d3468eb00131248d7c2e6d31349b650', type: "button", class: {
|
|
508
|
+
'cancel': true,
|
|
509
|
+
'finished': this.download_finished,
|
|
510
|
+
}, onClick: () => this.cancel_download() }, this.download_finished ? 'Close' : 'Cancel'))), this.show_delete_modal &&
|
|
511
|
+
h("section", { key: '5b5fd8c394811a4f5a2c285b331ed0a989729fea', class: {
|
|
512
|
+
'delete-modal': true,
|
|
513
|
+
'visible': this.show_delete_modal,
|
|
514
|
+
} }, h("div", { key: 'db2010aa154ececde47f5a5b4c3da485db786b0e', class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Delete confirmation" }, h("div", { key: '2fdb21392ad194cf7b72bb07391d6fc469b72cea', class: "title" }, "Delete File"), h("div", { key: '28ea5040b1111a888d230fd9aa6c34ada0003132', class: "message" }, this.delete_loading ? 'Deleting file...' : 'Are you sure you want to delete this file?'), h("div", { key: '123138ed8bf191e0dd4d1d9ab0409a15caa2aec2', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_loading && h("div", { key: '7a30da76db24c7ecb56877ab055fca6f84ba995b', class: "delete-loading-bar", "aria-hidden": "true" }), h("div", { key: 'c6eda63ce75896cc6540f509c81e895b3317e197', class: "modal-actions" }, h("button", { key: '54e7f01e6858f1ac0a73091ed7a6a3666bfad968', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), h("button", { key: 'f647a2772cb3a14cb42fc6d654c5068bf9e3f7f1', type: "button", class: "btn destructive", onClick: () => this.confirm_delete(), disabled: this.delete_loading }, this.delete_loading ? 'Deleting...' : 'Delete'))))));
|
|
393
515
|
}
|
|
394
516
|
static get is() { return "phirepass-sftp-client"; }
|
|
395
517
|
static get encapsulation() { return "shadow"; }
|
|
@@ -620,7 +742,18 @@ export class PhirepassSftpClient {
|
|
|
620
742
|
"show_loader": {},
|
|
621
743
|
"version": {},
|
|
622
744
|
"status": {},
|
|
623
|
-
"selected_item": {}
|
|
745
|
+
"selected_item": {},
|
|
746
|
+
"show_upload_modal": {},
|
|
747
|
+
"upload_progress": {},
|
|
748
|
+
"upload_file_name": {},
|
|
749
|
+
"upload_finished": {},
|
|
750
|
+
"show_download_modal": {},
|
|
751
|
+
"download_progress": {},
|
|
752
|
+
"download_file_name": {},
|
|
753
|
+
"download_finished": {},
|
|
754
|
+
"show_delete_modal": {},
|
|
755
|
+
"delete_file_name": {},
|
|
756
|
+
"delete_loading": {}
|
|
624
757
|
};
|
|
625
758
|
}
|
|
626
759
|
static get events() {
|
|
@@ -482,7 +482,7 @@ export class PhirepassTerminal {
|
|
|
482
482
|
this.usernameBuffer = "";
|
|
483
483
|
}
|
|
484
484
|
render() {
|
|
485
|
-
return (h(Host, { key: '
|
|
485
|
+
return (h(Host, { key: '0df9307a490dc566e41be1e1d169f8862f8569b9' }, h("div", { key: 'c63a16718ef4a559b880c6058bf482db4aeb6af1', id: "ccc", ref: el => (this.containerEl = el) })));
|
|
486
486
|
}
|
|
487
487
|
static get is() { return "phirepass-terminal"; }
|
|
488
488
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as i,H as t,c as a,h as s,a as o}from"./index.js";import{_ as r,E as c,C as d,a as n,P as l}from"./p-BcIhGXR0.js";const h=i(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.maximizeEvent=a(this,"maximize"),this.connectionStateChanged=a(this,"connectionStateChanged")}channel;domReady=!1;runtimeReady=!1;connected=!1;uploadInputEl;session_id;name="SFTP";description="Client";hideHeader=!1;serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;token;onNodeIdChange(e,i){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),e&&(this.open_comms(),this.channel.connect(),this.status="Connecting...")}serverId;onServerIdChange(e,i){this.onNodeIdChange(this.nodeId,this.nodeId)}maximizeEvent;async maximize(){this.max=!this.max}async minimize(){this.max=!1}connectionStateChanged;max=!1;show_login_screen=!1;show_login_screen_username=!1;show_error=!1;error_message="";show_login_screen_password=!1;show_navigation=!1;breadcrumbs=[];current_dir=".";listing=[];show_content=!1;show_loader=!1;version="";status="Disconnected";selected_item=null;toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){await r(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}connect(){this.connected=!0,this.channel.connect(),this.status="Connecting..."}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.channel&&this.connect()}create_web_socket_endpoint(){const e=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${e}://${this.serverHost}`:`${e}://${this.serverHost}:${this.serverPort}`:`${e}://${this.serverHost}`}handle_error(e){switch(e.kind){case c.Generic:case c.Authentication:this.error_message=e.message||"An unknown error occurred.";break;case c.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case c.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case c.RequiresUsernamePassword:this.show_login_screen_username=!0,this.show_login_screen_password=!0,this.show_login_screen=!0}setTimeout((()=>{this.show_loader=!1}),1e3)}handle_auth_success(e){this.clear_creds_buffer(),this.version=e.version,this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_sftp_tunnel(this.nodeId),this.status="Connected"}handle_tunnel_opened(e){this.session_id=e.sid,this.channel.send_sftp_list_data(this.nodeId,this.session_id,this.current_dir)}handle_sftp_list_items(e){setTimeout((()=>{this.show_loader=!1}),500),this.listing=e.dir.items,this.current_dir=e.path,this.breadcrumbs=e.path.split("/").map(((e,i,t)=>""===e&&0===i?{label:"/",path:"/"}:{label:e,path:t.slice(0,i+1).join("/")})),this.show_content=!0,this.show_navigation=!0}handle_tunnel_data(e){console.log("received tunnel data:",e)}handle_tunnel_closed(e){this.clear_creds_buffer(),this.close_comms()}open_comms(){this.channel=this.serverId?new d(this.create_web_socket_endpoint()+"/api/web/ws",this.nodeId,this.serverId):new d(this.create_web_socket_endpoint()+"/api/web/ws",this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([n.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([n.Disconnected]),this.status="Disconnected"})),this.channel.on_connection_error((e=>{this.connectionStateChanged.emit([n.Error,e]),this.status="Error "+e.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((e=>{const{web:i}=e.data;switch(i.type){case l.Error:this.handle_error(i);break;case l.AuthSuccess:this.handle_auth_success(i);break;case l.TunnelOpened:this.handle_tunnel_opened(i);break;case l.TunnelClosed:this.handle_tunnel_closed(i);break;case l.TunnelData:this.handle_tunnel_data(i);break;case l.SFTPListItems:this.handle_sftp_list_items(i);break;default:console.warn("Unhandled protocol message type:",i)}}))}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}clear_creds_buffer(){}reset_session_state(){this.clear_creds_buffer()}list_breadcrumb(e){this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,e)}go_to_parent_directory(){this.session_id&&"/"!==this.current_dir&&this.list_breadcrumb(this.breadcrumbs[this.breadcrumbs.length-2]?.path||"/")}refresh_directory(){this.session_id&&this.list_breadcrumb(this.current_dir)}disconnect_session(){this.close_comms(),this.session_id=void 0,this.show_loader=!1,this.show_content=!1,this.breadcrumbs=[],this.current_dir=".",this.listing=[],this.show_navigation=!1,this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.version="",this.status="Disconnected"}on_file_row_action(e,i){i.preventDefault(),i.stopPropagation(),this.selected_item=e,window.alert(`Download for "${e.name}" is not available yet.`)}open_upload_picker(){this.uploadInputEl?.click()}on_upload_selected(e){const i=e.target,t=i.files?.[0];t&&(this.show_error=!0,this.error_message="Upload is not available yet in this widget.",setTimeout((()=>{this.show_error=!1}),2e3),i.value="")}is_selected(e){return!!this.selected_item&&this.selected_item.path===e.path&&this.selected_item.name===e.name}list_directory(e){if(!this.session_id)return void console.warn("No active session. Cannot list directory.");if("File"===e.kind)return console.warn("Cannot list directory of a file. Ignoring click."),void(this.selected_item=e);const i=[e.path,e.name].join("/");i!==this.current_dir?(this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,i)):console.warn("Already in this directory. Ignoring click.")}get_full_path(e){return[e.path,e.name].join("/")}render(){return s(o,{key:"84b1bd4b89e4e18be8165b2501af5fcf7bb09b68",class:{default:!this.max,max:this.max}},s("section",{key:"fd8e39bc72055158a7a1daac5f536e4d34393db9",class:"listing"},!this.hideHeader&&s("header",{key:"5f223331f9e2b5c6570ce80313c121c94ce36805"},s("section",{key:"1314b571f73bbdc07dd46f5015f75789793461e5",class:"title"},s("img",{key:"e582af1a23c051ddc9e0a44737f4c53a048b85be",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),s("div",{key:"f43bd6e4409b0e353b1224866b0d6ebe55e37705",class:"text"},s("div",{key:"f84ec4ed31f44b6216cf98fedda2eee3f6d3fae0",class:"name"},this.name),s("div",{key:"ad6b56a1f9e69b70be8e1906d26538ecf5e81369",class:"description"},this.description))),s("section",{key:"4cc95044e4d7ea1bacb8de579c6d22a29530a124",class:"actions"},s("div",{key:"fb85bf224c56e874ee7b4c0818ba35bcc06b4c35",class:"action",onClick:()=>this.toggle_max()},s("img",{key:"5cfbeafc5bbce5e5b87d75b23113a93c83d48f3b",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),s("main",{key:"f0ed3ecc82981b8352b4908df9bcc7706c07c111"},this.show_navigation&&s("nav",{key:"8b790eab0adc12e592b73e6757c1663db88f5a49",class:"navigation"},s("div",{key:"85c62f8b0e15d7aa77572028665d51705f9ef453",class:"breadcrumbs"},this.breadcrumbs.map(((e,i,t)=>s(s.Fragment,null,s("span",{key:i,onClick:()=>this.list_breadcrumb(e.path),class:"breadcrumb"},e.label),i<t.length-1&&s("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),s("section",{key:"9e1f1b406f3ac7b1a4fdda4081f310bdc054e125",class:"actions","aria-label":"SFTP actions"},s("button",{key:"1f95decb5addbd8c7c1b48b811e72231afb01491",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},s("img",{key:"888341d92e55f79037ccb8eca6b0eec69ff2f406",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),s("button",{key:"41d8256a3c8e7e6810c6f979537be3556de3611a",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},s("img",{key:"e7e2d8feef73e5a77580f311d3248baaa62a44ec",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),s("button",{key:"4a1453249181827600e980bfcc5eef10b94c4bd7",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},s("img",{key:"66dc18510465e05509ea966b0d48a92dabc5a00d",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),s("button",{key:"cbc12df3cb223cf650a12980f2b10db5114b2bff",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),s("input",{key:"8b472b4b82995d286127f60e394f6f83b88d05bd",type:"file",ref:e=>this.uploadInputEl=e,onChange:e=>this.on_upload_selected(e),style:{display:"none"}}),this.show_content&&s("div",{key:"9f4517dfb33071e1d1702c73fcbaaa812049c012",class:"content"},s("table",{key:"841b90ae73e52083478dcccb54d75ef52b208d74"},s("thead",{key:"96f9129791c51bae1f1693b4a77c3866cefe7ada"},s("tr",{key:"d5d5e032d059751a65305577670f1370c8cb0be5"},s("th",{key:"06a796b795813f286c1823eb053bc21211c7a6c2"},"Name"),s("th",{key:"4ce88c6ceb13af2d9e80a5c733a02ac7a15558ba"},"Size"),s("th",{key:"b4746be62c9c882f3c335b433486bc094b0fe6c3"},"Permissions"),s("th",{key:"8ab7d1bab01ce229b236d9aceb3ca166b84b2551"},"Owner"),s("th",{key:"baaf0986f2851903e22d8bb8c5a2aff8c4762bf1"},"Modified"),s("th",{key:"be874212a04f3e6f9764fb664837e11cacfc9b32",class:"action-col","aria-label":"Actions"}))),s("tbody",{key:"d14243b3467786b08a3cd8d53b4e365c7c9d644d"},this.listing.map(((e,i)=>s("tr",{key:i,class:{selected:this.is_selected(e)},onClick:()=>this.list_directory(e)},s("td",null,s("img","Folder"===e.kind?{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K",alt:"Folder"}:{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"File"}),s("span",{class:"name "+e.kind.toLowerCase()},e.name)),s("td",null,e.attributes.size),s("td",null,e.attributes.permissions??"-"),s("td",null,e.attributes.user??"-"),s("td",null,new Date(1e3*e.attributes.mtime).toLocaleString()),s("td",{class:"action-col"},"File"===e.kind&&s("button",{type:"button",class:"file-action",onClick:i=>this.on_file_row_action(e,i),title:"Download","aria-label":"Download"},s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},s("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s("polyline",{points:"7 10 12 15 17 10"}),s("line",{x1:"12",x2:"12",y1:"15",y2:"3"})))))))))),this.show_loader&&s("div",{key:"ee78459b85c3ffaf2583fd79edadc1398a96aa81",class:"loader"},"Loading..."),this.show_error&&s("div",{key:"f658bc7e5fd922d9a9499f2b6402ca3a6453adb8",class:"error"},this.error_message)),s("footer",{key:"8928750efac3a300348a0c2cfd97c735820351c7"},s("section",{key:"2c72adc84a24cf9255219125ad617578d9d4e50d",class:"status"},s("span",{key:"192c7f26e2372e22b8d48d3ce0d6697d20c1ad4a"},this.status),this.selected_item&&s("span",{key:"01d1d92290b47332e014b010be7575d9976a61d6",class:"selected-item"},this.get_full_path(this.selected_item))),s("section",{key:"32951e5b9ae53f2d84d90b43820801d1a2caeb65",class:"version"},this.version?"Version: "+this.version:""))),this.show_login_screen&&s("section",{key:"46ea29aafbc1b4392d5a368534b1fd1f5ca8446a",class:{creds:!0,blurred:this.show_login_screen}},s("form",{key:"c70ab635c91947a722dd203a346ed40b76471a25",class:"auth",onSubmit:e=>{const i=new FormData(e.target);let t,a;this.show_login_screen_username&&(t=i.get("username")),this.show_login_screen_password&&(a=i.get("password")),this.channel.open_sftp_tunnel(this.nodeId,t,a),this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_loader=!0,e.stopPropagation(),e.preventDefault()}},s("div",{key:"498d0374665f404fac6feef40ddcb7bc386e749b",class:"title"},"SFTP Connection"),this.show_login_screen_username&&s("div",{key:"2ff0c7b6bce0dabde50cc73de23ca3068951ef3d"},s("label",{key:"b6b6fb3d1c645e0ba7f55c420db3077a785cac48",htmlFor:"username"},"Username"),s("input",{key:"42e5c54dcf9ee40fc35c84b44be942b4775a82b4",id:"username",autoComplete:"off",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&s("div",{key:"ef4861042d2b239766add5185e8f4d46af526232"},s("label",{key:"901716f1f0f61d9116bdac51cc96581778bf2ebb",htmlFor:"password"},"Password"),s("input",{key:"da97e27113dfc2e9bb0c0a32e9b94140db1defa7",id:"password",autoComplete:"off",name:"password",type:"password",placeholder:""})),s("div",{key:"d8c497d4072f7b3940b483f02a722058c0b8a843"},s("button",{key:"bd9a920f46b0c48a15936a2249dadc4f04cdcc0f",type:"submit"},"Connect")))))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}static get style(){return":host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;.listing{flex:1;display:flex;flex-direction:column;justify-content:space-between;min-height:0;header{height:30px;background:rgba(28, 31, 38, 0.6);border-bottom:1px solid hsl(var(--border));display:flex;align-items:center;justify-content:space-between;.actions{display:flex;align-items:center;.action{cursor:pointer;padding:4px;display:flex;align-items:center;z-index:1;img{height:14px;padding:4px;border-radius:4px}&:hover{background-color:hsl(var(--border) / 0.6)}}}.title{color:hsl(var(--primary));height:14px;padding:0 12px;display:flex;align-items:center;font-size:0.75rem;line-height:1rem;img{height:14px;margin-right:5px}.text{display:flex;flex-direction:row;justify-content:center;margin-top:2px;.name{margin-right:10px}.description{color:hsl(var(--muted-foreground))}}}}main{flex:1;display:flex;flex-direction:column;position:relative;min-height:0;overflow:hidden;.loader{color:hsl(var(--muted-foreground));font-size:13px;animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;text-align:center;display:flex;align-items:center;justify-content:center;position:absolute;height:100%;width:100%;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.error{font-size:13px;text-align:center;color:hsl(var(--destructive));height:100%;display:flex;align-items:center;justify-content:center}.navigation{height:25px;padding:10px;font-size:0.75rem;line-height:1rem;background-color:hsl(var(--card));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid hsl(var(--border));position:sticky;top:0;z-index:3;.breadcrumbs{display:flex;align-items:center;margin-right:10px;.breadcrumb{color:hsl(var(--primary));margin-right:4px;cursor:pointer;&:after{margin-left:4px}&:hover{color:rgb(189, 219, 209)}&:last-child{margin-right:0;color:rgb(189, 219, 209);cursor:default}}.arrow{height:12px;width:12px;opacity:0.6;top:2px;margin-right:4px;position:relative}}.actions{display:flex;align-items:center;gap:8px}.action{border:none;background:transparent;color:rgb(189, 219, 209);font-size:1.1rem;line-height:1;padding:2px 4px;border-radius:4px;cursor:pointer;&:hover{background-color:hsl(var(--border) / 0.6)}img{height:14px;width:14px;display:block}}.action.disconnect{color:#ff4d5f;font-size:0.65rem;letter-spacing:0.08em;padding:4px 8px;&:hover{color:#ff6b7a;background-color:hsl(var(--destructive) / 0.12)}}}.content{flex:1;min-height:0;overflow:auto;font-size:0.75rem;line-height:1rem;scrollbar-width:thin;scrollbar-color:hsl(var(--scroll-thumb)) hsl(var(--scroll-track));&::-webkit-scrollbar{width:10px;height:10px}&::-webkit-scrollbar-track{background:hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb{background:hsl(var(--scroll-thumb));border-radius:999px;border:2px solid hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb:hover{background:hsl(var(--scroll-thumb-hover))}table{width:100%;border-collapse:separate;border-spacing:0;thead{background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));th{padding:8px 10px;text-align:left;color:hsl(var(--muted-foreground));position:sticky;top:0;z-index:2;background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));line-height:0.95rem;&.action-col{width:20px;min-width:20px;padding:0 10px}&:hover{&.action-col{color:blue;background-color:red;stroke:red}}}}tbody{padding:10px 10px;tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&.action-col{width:20px;min-width:20px;text-align:center;padding-left:1px;padding-right:1px;.file-action{border:none;background:transparent;color:hsl(var(--muted-foreground));width:16px;height:16px;border-radius:3px;cursor:pointer;opacity:0;visibility:hidden;pointer-events:none;transition:opacity 120ms ease;padding:0;svg{width:12px;height:12px;display:block;margin:0 auto}&:hover{color:hsl(var(--primary))}}}.name{&.file{color:rgb(189, 219, 209)}&.folder{color:hsl(var(--primary))}}.kind{height:14px;width:14px;margin-right:5px;top:3px;position:relative}}&:hover{cursor:pointer;background-color:hsl(var(--muted) / 0.4);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;color:hsl(var(--primary))}}&.selected{background-color:hsl(var(--primary) / 0.3);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto}&:hover{background-color:hsl(var(--primary) / 0.4)}}}}}}}footer{height:25px;background:rgba(28, 31, 38, 0.6);border-top:1px solid hsl(var(--border));font-size:0.75rem;line-height:1rem;display:flex;align-items:center;justify-content:space-between;padding:0 10px;.status{font-size:0.65rem;color:hsl(var(--muted-foreground));.selected-item{margin-left:10px;color:hsl(var(--primary))}}.version{font-size:0.65rem;color:hsl(var(--muted-foreground))}}}.creds{position:absolute;top:0;left:0;height:100%;width:100%;display:flex;justify-content:center;align-items:center;;&.blurred{background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.auth{display:flex;flex-direction:column;background:hsl(var(--card));position:relative;background-color:rgba(21, 24, 30, 0.95);border:1px solid hsl(var(--border));padding:30px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;border-radius:var(--radius);.title{margin-bottom:12px;color:hsl(var(--primary))}label{font-size:0.75rem;line-height:1rem;margin-bottom:1rem;color:hsl(var(--muted-foreground))}input{font-size:0.875rem;line-height:1.25rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;background-color:rgb(28, 31, 38);border-color:rgb(39, 44, 53);border-width:1px;border-radius:calc(var(--radius) - 2px);width:100%;margin-bottom:12px;color:rgb(189, 219, 209);box-sizing:border-box;&:focus{outline:none;border-color:hsl(var(--primary));box-shadow:0 0 0 1px hsl(var(--primary))}}button[type='submit']{margin-top:12px;width:100%;background-color:hsl(var(--primary));color:hsl(var(--primary-foreground));letter-spacing:0.05em;font-size:13px;font-weight:500;padding:0.5rem 1rem;border-radius:calc(var(--radius) - 2px);height:2rem;cursor:pointer;border:none;&:hover{background-color:hsl(var(--primary) / 0.9)}}}}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}"}},[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"],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],maximize:[64],minimize:[64]},void 0,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]);function b(){"undefined"!=typeof customElements&&["phirepass-sftp-client"].forEach((i=>{"phirepass-sftp-client"===i&&(customElements.get(e(i))||customElements.define(e(i),h))}))}b();const g=h,I=b;export{g as PhirepassSftpClient,I as defineCustomElement}
|
|
1
|
+
import{t as e,p as i,H as a,c as t,h as s,a as o}from"./index.js";import{_ as r,E as d,C as l,a as c,P as n}from"./p-BcIhGXR0.js";const h=i(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.maximizeEvent=t(this,"maximize"),this.connectionStateChanged=t(this,"connectionStateChanged")}channel;domReady=!1;runtimeReady=!1;connected=!1;uploadInputEl;uploadProgressHandle;downloadProgressHandle;deleteLoadingTimeout;session_id;name="SFTP";description="Client";hideHeader=!1;serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;token;onNodeIdChange(e,i){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),e&&(this.open_comms(),this.channel.connect(),this.status="Connecting...")}serverId;onServerIdChange(e,i){this.onNodeIdChange(this.nodeId,this.nodeId)}maximizeEvent;async maximize(){this.max=!this.max}async minimize(){this.max=!1}connectionStateChanged;max=!1;show_login_screen=!1;show_login_screen_username=!1;show_error=!1;error_message="";show_login_screen_password=!1;show_navigation=!1;breadcrumbs=[];current_dir=".";listing=[];show_content=!1;show_loader=!1;version="";status="Disconnected";selected_item=null;show_upload_modal=!1;upload_progress=0;upload_file_name="";upload_finished=!1;show_download_modal=!1;download_progress=0;download_file_name="";download_finished=!1;show_delete_modal=!1;delete_file_name="";delete_loading=!1;toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){await r(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.clear_upload_progress(),this.clear_download_progress(),this.clear_delete_loading_timeout(),this.close_comms()}clear_upload_progress(){void 0!==this.uploadProgressHandle&&(window.clearInterval(this.uploadProgressHandle),this.uploadProgressHandle=void 0)}clear_download_progress(){void 0!==this.downloadProgressHandle&&(window.clearInterval(this.downloadProgressHandle),this.downloadProgressHandle=void 0)}clear_delete_loading_timeout(){void 0!==this.deleteLoadingTimeout&&(window.clearTimeout(this.deleteLoadingTimeout),this.deleteLoadingTimeout=void 0)}connect(){this.connected=!0,this.channel.connect(),this.status="Connecting..."}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.channel&&this.connect()}create_web_socket_endpoint(){const e=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${e}://${this.serverHost}`:`${e}://${this.serverHost}:${this.serverPort}`:`${e}://${this.serverHost}`}handle_error(e){switch(e.kind){case d.Generic:case d.Authentication:this.error_message=e.message||"An unknown error occurred.";break;case d.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case d.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case d.RequiresUsernamePassword:this.show_login_screen_username=!0,this.show_login_screen_password=!0,this.show_login_screen=!0}setTimeout((()=>{this.show_loader=!1}),1e3)}handle_auth_success(e){this.clear_creds_buffer(),this.version=e.version,this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_sftp_tunnel(this.nodeId),this.status="Connected"}handle_tunnel_opened(e){this.session_id=e.sid,this.channel.send_sftp_list_data(this.nodeId,this.session_id,this.current_dir)}handle_sftp_list_items(e){setTimeout((()=>{this.show_loader=!1}),500),this.listing=e.dir.items,this.current_dir=e.path,this.breadcrumbs=e.path.split("/").map(((e,i,a)=>""===e&&0===i?{label:"/",path:"/"}:{label:e,path:a.slice(0,i+1).join("/")})),this.show_content=!0,this.show_navigation=!0}handle_tunnel_data(e){console.log("received tunnel data:",e)}handle_tunnel_closed(e){this.clear_creds_buffer(),this.close_comms()}open_comms(){this.channel=this.serverId?new l(this.create_web_socket_endpoint()+"/api/web/ws",this.nodeId,this.serverId):new l(this.create_web_socket_endpoint()+"/api/web/ws",this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([c.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([c.Disconnected]),this.status="Disconnected"})),this.channel.on_connection_error((e=>{this.connectionStateChanged.emit([c.Error,e]),this.status="Error "+e.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((e=>{const{web:i}=e.data;switch(i.type){case n.Error:this.handle_error(i);break;case n.AuthSuccess:this.handle_auth_success(i);break;case n.TunnelOpened:this.handle_tunnel_opened(i);break;case n.TunnelClosed:this.handle_tunnel_closed(i);break;case n.TunnelData:this.handle_tunnel_data(i);break;case n.SFTPListItems:this.handle_sftp_list_items(i);break;default:console.warn("Unhandled protocol message type:",i)}}))}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}clear_creds_buffer(){}reset_session_state(){this.clear_creds_buffer()}list_breadcrumb(e){this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,e)}go_to_parent_directory(){this.session_id&&"/"!==this.current_dir&&this.list_breadcrumb(this.breadcrumbs[this.breadcrumbs.length-2]?.path||"/")}refresh_directory(){this.session_id&&this.list_breadcrumb(this.current_dir)}disconnect_session(){this.close_comms(),this.session_id=void 0,this.show_loader=!1,this.show_content=!1,this.breadcrumbs=[],this.current_dir=".",this.listing=[],this.show_navigation=!1,this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.version="",this.status="Disconnected"}on_file_row_action(e,i){i.preventDefault(),i.stopPropagation(),this.selected_item=e,this.download_file_name=e.name,this.download_progress=0,this.download_finished=!1,this.show_download_modal=!0,this.clear_download_progress(),this.downloadProgressHandle=window.setInterval((()=>{if(this.download_progress>=100)return this.clear_download_progress(),void(this.download_finished=!0);this.download_progress=Math.min(100,this.download_progress+5)}),180)}on_file_delete_action(e,i){i.preventDefault(),i.stopPropagation(),this.selected_item=e,this.delete_file_name=e.name,this.delete_loading=!1,this.show_delete_modal=!0}cancel_delete(){this.delete_loading||(this.show_delete_modal=!1,this.delete_file_name="",this.delete_loading=!1)}confirm_delete(){if(this.delete_loading)return;this.delete_loading=!0;const e=this.delete_file_name;this.clear_delete_loading_timeout(),this.deleteLoadingTimeout=window.setTimeout((()=>{this.show_delete_modal=!1,this.delete_loading=!1,this.show_error=!0,this.error_message=`Delete for "${e}" is not available yet.`,window.setTimeout((()=>{this.show_error=!1}),2e3),this.delete_file_name="",this.deleteLoadingTimeout=void 0}),1100)}open_upload_picker(){this.uploadInputEl?.click()}on_upload_selected(e){const i=e.target,a=i.files?.[0];a&&(this.upload_file_name=a.name,this.upload_progress=0,this.upload_finished=!1,this.show_upload_modal=!0,this.clear_upload_progress(),this.uploadProgressHandle=window.setInterval((()=>{if(this.upload_progress>=100)return this.clear_upload_progress(),void(this.upload_finished=!0);this.upload_progress=Math.min(100,this.upload_progress+5)}),180),i.value="")}cancel_upload(){this.clear_upload_progress(),this.show_upload_modal=!1,this.upload_progress=0,this.upload_file_name="",this.upload_finished=!1}cancel_download(){this.clear_download_progress(),this.show_download_modal=!1,this.download_progress=0,this.download_file_name="",this.download_finished=!1}is_selected(e){return!!this.selected_item&&this.selected_item.path===e.path&&this.selected_item.name===e.name}list_directory(e){if(!this.session_id)return void console.warn("No active session. Cannot list directory.");if("File"===e.kind)return console.warn("Cannot list directory of a file. Ignoring click."),void(this.selected_item=e);const i=[e.path,e.name].join("/");i!==this.current_dir?(this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,i)):console.warn("Already in this directory. Ignoring click.")}get_full_path(e){return[e.path,e.name].join("/")}render(){return s(o,{key:"31a797ab81c687e6aaea760d882e8078d4ab226f",class:{default:!this.max,max:this.max}},s("section",{key:"0dd1df187509d0f2c3dc172119f97224a1fb8234",class:"listing"},!this.hideHeader&&s("header",{key:"af24358a2d1d6ec9dc282683b1feff0a29287dd0"},s("section",{key:"f0195c9b0f99fe3c7ca64c7db04a3b08255bb58e",class:"title"},s("img",{key:"e04889ab957ccddb181850a5a787b6e40191842e",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),s("div",{key:"dc364ca7481d3b78e99319c66a6a40dc29100ea4",class:"text"},s("div",{key:"7b226fe3a81631656e8fce0b5a69854c3aaeb9c5",class:"name"},this.name),s("div",{key:"8a843a5134ed28a985d2d1787b17ea3c7436bd45",class:"description"},this.description))),s("section",{key:"73aec9dd75115faf4dfbcdfde1a076c960954923",class:"actions"},s("div",{key:"ce75ef7f9c3433e9d6dfadb41e0716a165666ee8",class:"action",onClick:()=>this.toggle_max()},s("img",{key:"abbba7e239c57a52dfd46ed23aeeac81874f097c",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),s("main",{key:"fbdd529cfb3090f41dba72f7333efe3a1af29aa4"},this.show_navigation&&s("nav",{key:"17601f7bf03f76169a14803ad0cc11b21f72df8d",class:"navigation"},s("div",{key:"55fffc7a4686e4978002b9edf6334b07fc57322b",class:"breadcrumbs"},this.breadcrumbs.map(((e,i,a)=>s(s.Fragment,null,s("span",{key:i,onClick:()=>this.list_breadcrumb(e.path),class:"breadcrumb"},e.label),i<a.length-1&&s("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),s("section",{key:"163eb105d575eddebad721f4e114ea8f5a8e44a1",class:"actions","aria-label":"SFTP actions"},s("button",{key:"ad9cbebffdc46ba08b3d05adc33a18ad027f1b3d",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},s("img",{key:"4f1bfd8154df3df70f8892b1f17391f06ac5ea3e",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),s("button",{key:"5bcb098f9fcfb61e6af07e9224617e82ce9e8e8b",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},s("img",{key:"863997b8a0ad3f465b68c10747739aa6bc123934",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),s("button",{key:"dcae91b637f58f7567709367b4607148ba6c84ce",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},s("img",{key:"75baffc951eb5bef65be10e1b77d782048fe19bc",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),s("button",{key:"7ce741e5e4538bfa50b330128153584cae966865",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),s("input",{key:"86686c4eb1f5e56e2828687c8843ac0a0f79028b",type:"file",ref:e=>this.uploadInputEl=e,onChange:e=>this.on_upload_selected(e),style:{display:"none"}}),this.show_content&&s("div",{key:"d5be43d27ae7933ad1eea5d9c7d53b3a4fa4d292",class:"content"},s("table",{key:"e6f57d64703faef89347da8c412eb4b224878a68"},s("thead",{key:"89979dd9702878b6d0bccddb971c1e42353c4515"},s("tr",{key:"9c744d7e8e12bd189ba17f6b2b7a4f371b4932eb"},s("th",{key:"6f29cf58e3000d3d02881d38ca8065ab4174300d"},"Name"),s("th",{key:"79ec3f7d0ac3a12a450f275845360576bd1430c6"},"Size"),s("th",{key:"ea1718d678f7016472688d7d08d311aad727dcc9"},"Permissions"),s("th",{key:"6272cb391bd19801f9967b704185520799dc8a11"},"Owner"),s("th",{key:"91fec7f7e28354e88a12fc7f92c543172800f0b3"},"Modified"),s("th",{key:"6256a9926941f12ce4807c926e09c3a39c776d2d",class:"action-col","aria-label":"Actions"}))),s("tbody",{key:"f1e57f678a8381e4dad5c8daab6624849378b012"},this.listing.map(((e,i)=>s("tr",{key:i,class:{selected:this.is_selected(e)},onClick:()=>this.list_directory(e)},s("td",null,s("img","Folder"===e.kind?{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K",alt:"Folder"}:{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"File"}),s("span",{class:"name "+e.kind.toLowerCase()},e.name)),s("td",null,e.attributes.size),s("td",null,e.attributes.permissions??"-"),s("td",null,e.attributes.user??"-"),s("td",null,new Date(1e3*e.attributes.mtime).toLocaleString()),s("td",{class:"action-col"},"File"===e.kind&&s("div",{class:"file-actions"},s("button",{type:"button",class:"file-action",onClick:i=>this.on_file_row_action(e,i),title:"Download","aria-label":"Download"},s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},s("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s("polyline",{points:"7 10 12 15 17 10"}),s("line",{x1:"12",x2:"12",y1:"15",y2:"3"}))),s("button",{type:"button",class:"file-action delete",onClick:i=>this.on_file_delete_action(e,i),title:"Delete","aria-label":"Delete"},s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},s("polyline",{points:"3 6 5 6 21 6"}),s("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),s("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),s("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),s("line",{x1:"14",x2:"14",y1:"11",y2:"17"}))))))))))),this.show_loader&&s("div",{key:"141c34cb925c0e42fca1e0397b610071b360c0d1",class:"loader"},"Loading..."),this.show_error&&s("div",{key:"ebf97cf4b7307514e724c7778c4a9052ec32c68d",class:"error"},this.error_message)),s("footer",{key:"1f243a6d09afe5380466dec79226bde67679ace8"},s("section",{key:"59f7e3dd679213d76294c347f1af8ca4f3d5b3e6",class:"status"},s("span",{key:"4aaebcfa2fea3e69d02814727c63484fd465dfee"},this.status),this.selected_item&&s("span",{key:"5f37d4f9a82a97cd5065651d5f4311104153b8a7",class:"selected-item"},this.get_full_path(this.selected_item))),s("section",{key:"0a75c580bb9ce63e58e4cd3aef76f13f5d8a6c43",class:"version"},this.version?"Version: "+this.version:""))),this.show_login_screen&&s("section",{key:"bf83e07198a7bd7f6b11164261496cee880e8e95",class:{creds:!0,blurred:this.show_login_screen}},s("form",{key:"c0b3f36031b3d0575e0dfc4d4e5c689a3e86093e",class:"auth",onSubmit:e=>{const i=new FormData(e.target);let a,t;this.show_login_screen_username&&(a=i.get("username")),this.show_login_screen_password&&(t=i.get("password")),this.channel.open_sftp_tunnel(this.nodeId,a,t),this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_loader=!0,e.stopPropagation(),e.preventDefault()}},s("div",{key:"f8f811323c0aaa9d2c6e7c70b39e2bc58073f500",class:"title"},"SFTP Connection"),this.show_login_screen_username&&s("div",{key:"9d37d47a0c3d7235711964979389e34e7ae909e4"},s("label",{key:"870aefcf5b1052663df6564158f85f0a1a6c14fc",htmlFor:"username"},"Username"),s("input",{key:"b51ee3b3f4a73c7116ace5d1d111d76e6c2d44a2",id:"username",autoComplete:"off",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&s("div",{key:"f727237549f83c27639f943414665eab507d3e0b"},s("label",{key:"e0607fbaa128a26ca8a6ce2be5976c2be66cf1a8",htmlFor:"password"},"Password"),s("input",{key:"4458ad7c4927bf21e27c9b979c14d5d3ca377514",id:"password",autoComplete:"off",name:"password",type:"password",placeholder:""})),s("div",{key:"7e3a5f468cc73a370558d4f447e1e7e91ea9dff2"},s("button",{key:"c63922f8ffd4377a13c76f51108e8fc9cfa7cdfa",type:"submit"},"Connect")))),this.show_upload_modal&&s("section",{key:"b7935f9ab9e2cbfc8ecb66aff2c212e8f008675f",class:{"upload-modal":!0,visible:this.show_upload_modal}},s("div",{key:"e7c84c44c5ccec4d7211dd647abee21ba9e4dded",class:"upload-dialog",role:"dialog","aria-modal":"true","aria-label":"Upload progress"},s("div",{key:"42411ccf81daad3d6f94455ec5f39a2ec8bd32ce",class:"title"},"Uploading File"),s("div",{key:"d7e6db3d7af27e69533bf2bcc532ab36de241a84",class:"file-name",title:this.upload_file_name},this.upload_file_name),s("div",{key:"3b1e1eb29e1d9b737bf52c3e9d59c33871d661fc",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.upload_progress},s("div",{key:"36d23d0a85747aa12f36b05caa4fa047095245b9",class:"progress-fill",style:{width:this.upload_progress+"%"}})),s("div",{key:"d981d282d1ad7216eee6a6ea8eaf0b48655d6b00",class:"progress-value"},this.upload_progress,"%"),s("button",{key:"1e5eb505505098bc88fadad649da78e4f291e8c3",type:"button",class:{cancel:!0,finished:this.upload_finished},onClick:()=>this.cancel_upload()},this.upload_finished?"Close":"Cancel"))),this.show_download_modal&&s("section",{key:"f2d75e7719e5a5ecad1dc37145da05cedefc53eb",class:{"download-modal":!0,visible:this.show_download_modal}},s("div",{key:"248a10deae9f5869290a362d2ec0dc49480c2f6a",class:"download-dialog",role:"dialog","aria-modal":"true","aria-label":"Download progress"},s("div",{key:"05f2f39b31a59ecb402c8b803b9ba8819d9b41d3",class:"title"},"Downloading File"),s("div",{key:"9979cfdbd9f0ac1888fbce3050ea51f1ac7fbc13",class:"file-name",title:this.download_file_name},this.download_file_name),s("div",{key:"5a0edbdb962e730fb8b4ff6ed06d1826e84d6ee4",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.download_progress},s("div",{key:"fdb25a6a1a42cb82050b4d6e4da4cae52c09ecc1",class:"progress-fill",style:{width:this.download_progress+"%"}})),s("div",{key:"2b9d47914221aa0537c0317b87cebedeb5c99b57",class:"progress-value"},this.download_progress,"%"),s("button",{key:"15dee8510d3468eb00131248d7c2e6d31349b650",type:"button",class:{cancel:!0,finished:this.download_finished},onClick:()=>this.cancel_download()},this.download_finished?"Close":"Cancel"))),this.show_delete_modal&&s("section",{key:"5b5fd8c394811a4f5a2c285b331ed0a989729fea",class:{"delete-modal":!0,visible:this.show_delete_modal}},s("div",{key:"db2010aa154ececde47f5a5b4c3da485db786b0e",class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"Delete confirmation"},s("div",{key:"2fdb21392ad194cf7b72bb07391d6fc469b72cea",class:"title"},"Delete File"),s("div",{key:"28ea5040b1111a888d230fd9aa6c34ada0003132",class:"message"},this.delete_loading?"Deleting file...":"Are you sure you want to delete this file?"),s("div",{key:"123138ed8bf191e0dd4d1d9ab0409a15caa2aec2",class:"file-name",title:this.delete_file_name},this.delete_file_name),this.delete_loading&&s("div",{key:"7a30da76db24c7ecb56877ab055fca6f84ba995b",class:"delete-loading-bar","aria-hidden":"true"}),s("div",{key:"c6eda63ce75896cc6540f509c81e895b3317e197",class:"modal-actions"},s("button",{key:"54e7f01e6858f1ac0a73091ed7a6a3666bfad968",type:"button",class:"btn secondary",onClick:()=>this.cancel_delete(),disabled:this.delete_loading},"Cancel"),s("button",{key:"f647a2772cb3a14cb42fc6d654c5068bf9e3f7f1",type:"button",class:"btn destructive",onClick:()=>this.confirm_delete(),disabled:this.delete_loading},this.delete_loading?"Deleting...":"Delete")))))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}static get style(){return":host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;.listing{height:100%;display:flex;flex-direction:column;justify-content:space-between;min-height:0;header{height:30px;background:rgba(28, 31, 38, 0.6);border-bottom:1px solid hsl(var(--border));display:flex;align-items:center;justify-content:space-between;.actions{display:flex;align-items:center;.action{cursor:pointer;padding:4px;display:flex;align-items:center;z-index:1;img{height:14px;padding:4px;border-radius:4px}&:hover{background-color:hsl(var(--border) / 0.6)}}}.title{color:hsl(var(--primary));height:14px;padding:0 12px;display:flex;align-items:center;font-size:0.75rem;line-height:1rem;img{height:14px;margin-right:5px}.text{display:flex;flex-direction:row;justify-content:center;margin-top:2px;.name{margin-right:10px}.description{color:hsl(var(--muted-foreground))}}}}main{flex:1;display:flex;flex-direction:column;position:relative;min-height:0;overflow:hidden;.loader{color:hsl(var(--muted-foreground));font-size:13px;animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;text-align:center;display:flex;align-items:center;justify-content:center;position:absolute;height:100%;width:100%;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.error{font-size:13px;text-align:center;color:hsl(var(--destructive));height:100%;display:flex;align-items:center;justify-content:center}.navigation{height:25px;padding:10px;font-size:0.75rem;line-height:1rem;background-color:hsl(var(--card));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid hsl(var(--border));position:sticky;top:0;z-index:3;.breadcrumbs{display:flex;align-items:center;margin-right:10px;.breadcrumb{color:hsl(var(--primary));margin-right:4px;cursor:pointer;&:after{margin-left:4px}&:hover{color:rgb(189, 219, 209)}&:last-child{margin-right:0;color:rgb(189, 219, 209);cursor:default}}.arrow{height:12px;width:12px;opacity:0.6;top:2px;margin-right:4px;position:relative}}.actions{display:flex;align-items:center;gap:8px}.action{border:none;background:transparent;color:rgb(189, 219, 209);font-size:1.1rem;line-height:1;padding:2px 4px;border-radius:4px;cursor:pointer;&:hover{background-color:hsl(var(--border) / 0.6)}img{height:14px;width:14px;display:block}}.action.disconnect{color:#ff4d5f;font-size:0.65rem;letter-spacing:0.08em;padding:4px 8px;&:hover{color:#ff6b7a;background-color:hsl(var(--destructive) / 0.12)}}}.content{flex:1;min-height:0;overflow:auto;font-size:0.75rem;line-height:1rem;scrollbar-width:thin;scrollbar-color:hsl(var(--scroll-thumb)) hsl(var(--scroll-track));&::-webkit-scrollbar{width:10px;height:10px}&::-webkit-scrollbar-track{background:hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb{background:hsl(var(--scroll-thumb));border-radius:999px;border:2px solid hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb:hover{background:hsl(var(--scroll-thumb-hover))}table{width:100%;border-collapse:separate;border-spacing:0;thead{background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));th{padding:8px 10px;text-align:left;color:hsl(var(--muted-foreground));position:sticky;top:0;z-index:2;background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));line-height:0.95rem;&.action-col{width:58px;min-width:58px;padding:0 10px}}}tbody{padding:10px 10px;tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&.action-col{width:58px;min-width:58px;text-align:center;padding-left:1px;padding-right:1px;.file-actions{display:flex;align-items:center;justify-content:center;gap:8px}.file-action{border:none;background:transparent;color:hsl(var(--muted-foreground));width:16px;height:16px;border-radius:3px;cursor:pointer;opacity:0;visibility:hidden;pointer-events:none;transition:opacity 120ms ease;padding:0;svg{width:12px;height:12px;display:block;margin:0 auto}&:hover{color:hsl(var(--primary))}&.delete:hover{color:hsl(var(--destructive))}}}.name{&.file{color:rgb(189, 219, 209)}&.folder{color:hsl(var(--primary))}}.kind{height:14px;width:14px;margin-right:5px;top:3px;position:relative}}&:hover{cursor:pointer;background-color:hsl(var(--muted) / 0.4);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;color:hsl(var(--primary))}}&.selected{background-color:hsl(var(--primary) / 0.3);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto}&:hover{background-color:hsl(var(--primary) / 0.4)}}}}}}}footer{height:25px;background:rgba(28, 31, 38, 0.6);border-top:1px solid hsl(var(--border));font-size:0.75rem;line-height:1rem;display:flex;align-items:center;justify-content:space-between;padding:0 10px;.status{font-size:0.65rem;color:hsl(var(--muted-foreground));.selected-item{margin-left:10px;color:hsl(var(--primary))}}.version{font-size:0.65rem;color:hsl(var(--muted-foreground))}}}.creds{position:absolute;top:0;left:0;height:100%;width:100%;display:flex;justify-content:center;align-items:center;;&.blurred{background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.auth{display:flex;flex-direction:column;background:hsl(var(--card));position:relative;background-color:rgba(21, 24, 30, 0.95);border:1px solid hsl(var(--border));padding:30px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;border-radius:var(--radius);.title{margin-bottom:12px;color:hsl(var(--primary))}label{font-size:0.75rem;line-height:1rem;margin-bottom:1rem;color:hsl(var(--muted-foreground))}input{font-size:0.875rem;line-height:1.25rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;background-color:rgb(28, 31, 38);border-color:rgb(39, 44, 53);border-width:1px;border-radius:calc(var(--radius) - 2px);width:100%;margin-bottom:12px;color:rgb(189, 219, 209);box-sizing:border-box;&:focus{outline:none;border-color:hsl(var(--primary));box-shadow:0 0 0 1px hsl(var(--primary))}}button[type='submit']{margin-top:12px;width:100%;background-color:hsl(var(--primary));color:hsl(var(--primary-foreground));letter-spacing:0.05em;font-size:13px;font-weight:500;padding:0.5rem 1rem;border-radius:calc(var(--radius) - 2px);height:2rem;cursor:pointer;border:none;&:hover{background-color:hsl(var(--primary) / 0.9)}}}}.upload-modal,.download-modal,.delete-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:6;&.visible{display:flex}.upload-dialog,.download-dialog,.delete-dialog{width:min(360px, calc(100% - 24px));background-color:rgba(21, 24, 30, 0.96);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px}.file-name{color:rgb(189, 219, 209);font-size:0.72rem;line-height:1rem;margin-bottom:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.progress-track{width:100%;height:10px;border-radius:999px;background-color:hsl(var(--muted));overflow:hidden;border:1px solid hsl(var(--border));.progress-fill{height:100%;width:0;background:linear-gradient(90deg, hsl(var(--primary) / 0.7), hsl(var(--primary)));transition:width 140ms ease}}.progress-value{margin-top:8px;color:hsl(var(--muted-foreground));font-size:0.7rem;text-align:right}.cancel{margin-top:14px;width:100%;height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);background:hsl(var(--muted));color:rgb(189, 219, 209);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}&.finished{background-color:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover{background-color:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9);color:hsl(var(--primary-foreground))}}}.message{color:rgb(189, 219, 209);font-size:0.74rem;line-height:1rem;margin-bottom:8px}.modal-actions{margin-top:14px;display:grid;grid-template-columns:1fr 1fr;gap:8px;.btn{height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white;&:hover{background:hsl(var(--destructive) / 0.9);border-color:hsl(var(--destructive) / 0.9)}}}.delete-loading-bar{margin-top:2px;width:100%;height:8px;border-radius:999px;border:1px solid hsl(var(--border));background:linear-gradient(90deg, hsl(var(--muted)) 0%, hsl(var(--muted)) 100%), linear-gradient(90deg, hsl(var(--primary) / 0.3), hsl(var(--primary)), hsl(var(--primary) / 0.3));background-repeat:no-repeat;background-size:100% 100%, 40% 100%;animation:delete-loading 1s linear infinite}}}}@keyframes delete-loading{from{background-position:0 0, -45% 0}to{background-position:0 0, 145% 0}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}"}},[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"],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_finished:[32],show_download_modal:[32],download_progress:[32],download_file_name:[32],download_finished:[32],show_delete_modal:[32],delete_file_name:[32],delete_loading:[32],maximize:[64],minimize:[64]},void 0,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]);function b(){"undefined"!=typeof customElements&&["phirepass-sftp-client"].forEach((i=>{"phirepass-sftp-client"===i&&(customElements.get(e(i))||customElements.define(e(i),h))}))}b();const g=h,p=b;export{g as PhirepassSftpClient,p as defineCustomElement}
|