phirepass-widgets 0.0.54 → 0.0.56
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/{index-DqslB2R4.js → index-YW0ts9D0.js} +0 -37
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +462 -83
- package/dist/cjs/phirepass-terminal.cjs.entry.js +3 -3
- package/dist/cjs/phirepass-widgets.cjs.js +2 -2
- package/dist/cjs/{protocol-D_0VKXs_.js → protocol-psRGAoJv.js} +67 -64
- package/dist/collection/common/protocol.js +4 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +53 -40
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +462 -81
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-D48Fhv67.js +1 -0
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +2 -2
- package/dist/esm/{index-jdexunMF.js → index-PKnTMZa7.js} +0 -37
- package/dist/esm/loader.js +3 -3
- package/dist/esm/phirepass-sftp-client.entry.js +462 -83
- package/dist/esm/phirepass-terminal.entry.js +3 -3
- package/dist/esm/phirepass-widgets.js +3 -3
- package/dist/esm/{protocol-BYaVbj9C.js → protocol-D48Fhv67.js} +66 -63
- package/dist/phirepass-widgets/{p-a6553a86.entry.js → p-6f213827.entry.js} +2 -2
- package/dist/phirepass-widgets/p-D48Fhv67.js +1 -0
- package/dist/phirepass-widgets/p-PKnTMZa7.js +2 -0
- package/dist/phirepass-widgets/p-e23ef228.entry.js +1 -0
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/common/protocol.d.ts +37 -2
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +28 -5
- package/package.json +2 -2
- package/dist/components/p-BYaVbj9C.js +0 -1
- package/dist/phirepass-widgets/p-BYaVbj9C.js +0 -1
- package/dist/phirepass-widgets/p-ba7d75c5.entry.js +0 -1
- package/dist/phirepass-widgets/p-jdexunMF.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-
|
|
2
|
-
import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-
|
|
1
|
+
import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-PKnTMZa7.js';
|
|
2
|
+
import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-D48Fhv67.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
@@ -692,7 +692,7 @@ const PhirepassTerminal = class {
|
|
|
692
692
|
this.usernameBuffer = "";
|
|
693
693
|
}
|
|
694
694
|
render() {
|
|
695
|
-
return (h$1(Host, { key: '
|
|
695
|
+
return (h$1(Host, { key: '641344887f33ba9c4c8aa98186b84a92ebb020e7' }, h$1("div", { key: '558aebfd21575d5dbdaacf03335485941373679a', id: "ccc", ref: el => (this.containerEl = el) })));
|
|
696
696
|
}
|
|
697
697
|
static get watchers() { return {
|
|
698
698
|
"nodeId": [{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-PKnTMZa7.js';
|
|
2
|
+
export { s as setNonce } from './index-PKnTMZa7.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["phirepass-sftp-client",[[513,"phirepass-sftp-client",{"name":[1],"description":[1],"hideHeader":[4,"hide-header"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"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]},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"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["phirepass-sftp-client",[[513,"phirepass-sftp-client",{"name":[1],"description":[1],"hideHeader":[4,"hide-header"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"],"max":[32],"show_login_screen":[32],"show_login_screen_username":[32],"show_error":[32],"error_message":[32],"show_login_screen_password":[32],"show_navigation":[32],"breadcrumbs":[32],"current_dir":[32],"listing":[32],"show_content":[32],"show_loader":[32],"version":[32],"status":[32],"selected_item":[32],"show_upload_modal":[32],"upload_progress":[32],"upload_file_name":[32],"upload_speed":[32],"upload_finished":[32],"show_download_modal":[32],"download_progress":[32],"download_file_name":[32],"download_speed":[32],"download_finished":[32],"show_delete_modal":[32],"delete_file_name":[32],"delete_loading":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
|
|
21
21
|
});
|
|
@@ -21,7 +21,7 @@ class Channel {
|
|
|
21
21
|
const len0 = WASM_VECTOR_LEN;
|
|
22
22
|
const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
23
23
|
const len1 = WASM_VECTOR_LEN;
|
|
24
|
-
wasm.channel_authenticate(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(msg_id) ?
|
|
24
|
+
wasm.channel_authenticate(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
25
25
|
}
|
|
26
26
|
connect() {
|
|
27
27
|
wasm.channel_connect(this.__wbg_ptr);
|
|
@@ -56,7 +56,7 @@ class Channel {
|
|
|
56
56
|
var ptr2 = isLikeNone(server_id) ? 0 : passStringToWasm0(server_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
57
57
|
var len2 = WASM_VECTOR_LEN;
|
|
58
58
|
const ret = wasm.channel_new(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
59
|
-
this.__wbg_ptr = ret
|
|
59
|
+
this.__wbg_ptr = ret;
|
|
60
60
|
ChannelFinalization.register(this, this.__wbg_ptr, this);
|
|
61
61
|
return this;
|
|
62
62
|
}
|
|
@@ -103,7 +103,7 @@ class Channel {
|
|
|
103
103
|
var len1 = WASM_VECTOR_LEN;
|
|
104
104
|
var ptr2 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
105
105
|
var len2 = WASM_VECTOR_LEN;
|
|
106
|
-
wasm.channel_open_sftp_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ?
|
|
106
|
+
wasm.channel_open_sftp_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* @param {string} node_id
|
|
@@ -118,7 +118,7 @@ class Channel {
|
|
|
118
118
|
var len1 = WASM_VECTOR_LEN;
|
|
119
119
|
var ptr2 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
120
120
|
var len2 = WASM_VECTOR_LEN;
|
|
121
|
-
wasm.channel_open_ssh_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ?
|
|
121
|
+
wasm.channel_open_ssh_tunnel(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* @param {string} node_id
|
|
@@ -134,7 +134,7 @@ class Channel {
|
|
|
134
134
|
const len1 = WASM_VECTOR_LEN;
|
|
135
135
|
const ptr2 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
136
136
|
const len2 = WASM_VECTOR_LEN;
|
|
137
|
-
wasm.channel_send_sftp_delete(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ?
|
|
137
|
+
wasm.channel_send_sftp_delete(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* @param {string} node_id
|
|
@@ -146,7 +146,7 @@ class Channel {
|
|
|
146
146
|
send_sftp_download_chunk(node_id, sid, download_id, chunk_index, msg_id) {
|
|
147
147
|
const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
148
148
|
const len0 = WASM_VECTOR_LEN;
|
|
149
|
-
wasm.channel_send_sftp_download_chunk(this.__wbg_ptr, ptr0, len0, sid, download_id, chunk_index, isLikeNone(msg_id) ?
|
|
149
|
+
wasm.channel_send_sftp_download_chunk(this.__wbg_ptr, ptr0, len0, sid, download_id, chunk_index, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* @param {string} node_id
|
|
@@ -162,7 +162,7 @@ class Channel {
|
|
|
162
162
|
const len1 = WASM_VECTOR_LEN;
|
|
163
163
|
const ptr2 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
164
164
|
const len2 = WASM_VECTOR_LEN;
|
|
165
|
-
wasm.channel_send_sftp_download_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ?
|
|
165
|
+
wasm.channel_send_sftp_download_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* @param {string} node_id
|
|
@@ -175,7 +175,7 @@ class Channel {
|
|
|
175
175
|
const len0 = WASM_VECTOR_LEN;
|
|
176
176
|
const ptr1 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
177
177
|
const len1 = WASM_VECTOR_LEN;
|
|
178
|
-
wasm.channel_send_sftp_list_data(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, isLikeNone(msg_id) ?
|
|
178
|
+
wasm.channel_send_sftp_list_data(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* @param {string} node_id
|
|
@@ -191,7 +191,7 @@ class Channel {
|
|
|
191
191
|
const len0 = WASM_VECTOR_LEN;
|
|
192
192
|
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
193
193
|
const len1 = WASM_VECTOR_LEN;
|
|
194
|
-
wasm.channel_send_sftp_upload_chunk(this.__wbg_ptr, ptr0, len0, sid, upload_id, chunk_index, chunk_size, ptr1, len1, isLikeNone(msg_id) ?
|
|
194
|
+
wasm.channel_send_sftp_upload_chunk(this.__wbg_ptr, ptr0, len0, sid, upload_id, chunk_index, chunk_size, ptr1, len1, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* @param {string} node_id
|
|
@@ -209,7 +209,7 @@ class Channel {
|
|
|
209
209
|
const len1 = WASM_VECTOR_LEN;
|
|
210
210
|
const ptr2 = passStringToWasm0(remote_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
211
211
|
const len2 = WASM_VECTOR_LEN;
|
|
212
|
-
wasm.channel_send_sftp_upload_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, total_chunks, total_size, isLikeNone(msg_id) ?
|
|
212
|
+
wasm.channel_send_sftp_upload_start(this.__wbg_ptr, ptr0, len0, sid, ptr1, len1, ptr2, len2, total_chunks, total_size, isLikeNone(msg_id) ? Number.MAX_SAFE_INTEGER : (msg_id) >>> 0);
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* @param {string} node_id
|
|
@@ -261,7 +261,7 @@ const ErrorType = Object.freeze({
|
|
|
261
261
|
function __wbg_get_imports() {
|
|
262
262
|
const import0 = {
|
|
263
263
|
__proto__: null,
|
|
264
|
-
|
|
264
|
+
__wbg_Error_3639a60ed15f87e7: function(arg0, arg1) {
|
|
265
265
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
266
266
|
return addHeapObject(ret);
|
|
267
267
|
},
|
|
@@ -272,14 +272,14 @@ function __wbg_get_imports() {
|
|
|
272
272
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
273
273
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
274
274
|
},
|
|
275
|
-
|
|
275
|
+
__wbg___wbindgen_debug_string_07cb72cfcc952e2b: function(arg0, arg1) {
|
|
276
276
|
const ret = debugString(getObject(arg1));
|
|
277
277
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
278
278
|
const len1 = WASM_VECTOR_LEN;
|
|
279
279
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
280
280
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
281
281
|
},
|
|
282
|
-
|
|
282
|
+
__wbg___wbindgen_string_get_965592073e5d848c: function(arg0, arg1) {
|
|
283
283
|
const obj = getObject(arg1);
|
|
284
284
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
285
285
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -287,39 +287,39 @@ function __wbg_get_imports() {
|
|
|
287
287
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
288
288
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
289
289
|
},
|
|
290
|
-
|
|
290
|
+
__wbg___wbindgen_throw_9c75d47bf9e7731e: function(arg0, arg1) {
|
|
291
291
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
292
292
|
},
|
|
293
|
-
|
|
293
|
+
__wbg__wbg_cb_unref_158e43e869788cdc: function(arg0) {
|
|
294
294
|
getObject(arg0)._wbg_cb_unref();
|
|
295
295
|
},
|
|
296
|
-
|
|
297
|
-
const ret = getObject(arg0).call(getObject(arg1));
|
|
296
|
+
__wbg_call_a41d6421b30a32c5: function() { return handleError(function (arg0, arg1, arg2) {
|
|
297
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
298
298
|
return addHeapObject(ret);
|
|
299
299
|
}, arguments); },
|
|
300
|
-
|
|
301
|
-
const ret = getObject(arg0).call(getObject(arg1)
|
|
300
|
+
__wbg_call_add9e5a76382e668: function() { return handleError(function (arg0, arg1) {
|
|
301
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
302
302
|
return addHeapObject(ret);
|
|
303
303
|
}, arguments); },
|
|
304
304
|
__wbg_clearInterval_26ba580547547579: function(arg0) {
|
|
305
305
|
const ret = clearInterval(takeObject(arg0));
|
|
306
306
|
return addHeapObject(ret);
|
|
307
307
|
},
|
|
308
|
-
|
|
308
|
+
__wbg_close_931d0c62e2aab92c: function() { return handleError(function (arg0) {
|
|
309
309
|
getObject(arg0).close();
|
|
310
310
|
}, arguments); },
|
|
311
|
-
|
|
311
|
+
__wbg_data_4a14fad4c5f216c4: function(arg0) {
|
|
312
312
|
const ret = getObject(arg0).data;
|
|
313
313
|
return addHeapObject(ret);
|
|
314
314
|
},
|
|
315
|
-
|
|
315
|
+
__wbg_from_ff141b1e4c69b979: function(arg0) {
|
|
316
316
|
const ret = Array.from(getObject(arg0));
|
|
317
317
|
return addHeapObject(ret);
|
|
318
318
|
},
|
|
319
|
-
|
|
319
|
+
__wbg_info_b32d86aa057de44b: function(arg0, arg1) {
|
|
320
320
|
console.info(getStringFromWasm0(arg0, arg1));
|
|
321
321
|
},
|
|
322
|
-
|
|
322
|
+
__wbg_instanceof_ArrayBuffer_eab9f28fbec23477: function(arg0) {
|
|
323
323
|
let result;
|
|
324
324
|
try {
|
|
325
325
|
result = getObject(arg0) instanceof ArrayBuffer;
|
|
@@ -329,86 +329,86 @@ function __wbg_get_imports() {
|
|
|
329
329
|
const ret = result;
|
|
330
330
|
return ret;
|
|
331
331
|
},
|
|
332
|
-
|
|
332
|
+
__wbg_length_ba3c032602efe310: function(arg0) {
|
|
333
333
|
const ret = getObject(arg0).length;
|
|
334
334
|
return ret;
|
|
335
335
|
},
|
|
336
|
-
|
|
337
|
-
const ret = new
|
|
336
|
+
__wbg_new_2fad8ca02fd00684: function() {
|
|
337
|
+
const ret = new Object();
|
|
338
338
|
return addHeapObject(ret);
|
|
339
339
|
},
|
|
340
|
-
|
|
340
|
+
__wbg_new_3baa8d9866155c79: function() {
|
|
341
341
|
const ret = new Array();
|
|
342
342
|
return addHeapObject(ret);
|
|
343
343
|
},
|
|
344
|
-
|
|
345
|
-
const ret = new
|
|
344
|
+
__wbg_new_8454eee672b2ba6e: function(arg0) {
|
|
345
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
346
346
|
return addHeapObject(ret);
|
|
347
347
|
},
|
|
348
|
-
|
|
348
|
+
__wbg_new_with_str_sequence_d90cb07368a00c61: function() { return handleError(function (arg0, arg1, arg2) {
|
|
349
349
|
const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));
|
|
350
350
|
return addHeapObject(ret);
|
|
351
351
|
}, arguments); },
|
|
352
|
-
|
|
352
|
+
__wbg_prototypesetcall_fd4050e806e1d519: function(arg0, arg1, arg2) {
|
|
353
353
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
354
354
|
},
|
|
355
|
-
|
|
355
|
+
__wbg_push_60a5366c0bb22a7d: function(arg0, arg1) {
|
|
356
356
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
357
357
|
return ret;
|
|
358
358
|
},
|
|
359
|
-
|
|
359
|
+
__wbg_readyState_be3cc9403da6c6ae: function(arg0) {
|
|
360
360
|
const ret = getObject(arg0).readyState;
|
|
361
361
|
return ret;
|
|
362
362
|
},
|
|
363
|
-
|
|
363
|
+
__wbg_send_c422d0aa0cb71d09: function() { return handleError(function (arg0, arg1, arg2) {
|
|
364
364
|
getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
|
|
365
365
|
}, arguments); },
|
|
366
366
|
__wbg_setInterval_cbf1c35c6a692d37: function() { return handleError(function (arg0, arg1) {
|
|
367
367
|
const ret = setInterval(getObject(arg0), arg1);
|
|
368
368
|
return addHeapObject(ret);
|
|
369
369
|
}, arguments); },
|
|
370
|
-
__wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
|
|
371
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
372
|
-
},
|
|
373
370
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
374
371
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
375
372
|
},
|
|
376
|
-
|
|
373
|
+
__wbg_set_binaryType_8564bdba0fbec720: function(arg0, arg1) {
|
|
377
374
|
getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
|
|
378
375
|
},
|
|
379
|
-
|
|
376
|
+
__wbg_set_f614f6a0608d1d1d: function(arg0, arg1, arg2) {
|
|
377
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
378
|
+
},
|
|
379
|
+
__wbg_set_onclose_f756840519cd20b5: function(arg0, arg1) {
|
|
380
380
|
getObject(arg0).onclose = getObject(arg1);
|
|
381
381
|
},
|
|
382
|
-
|
|
382
|
+
__wbg_set_onerror_02f33de339f1fa31: function(arg0, arg1) {
|
|
383
383
|
getObject(arg0).onerror = getObject(arg1);
|
|
384
384
|
},
|
|
385
|
-
|
|
385
|
+
__wbg_set_onmessage_d2ff0c1d20584625: function(arg0, arg1) {
|
|
386
386
|
getObject(arg0).onmessage = getObject(arg1);
|
|
387
387
|
},
|
|
388
|
-
|
|
388
|
+
__wbg_set_onopen_1da8a4f65e6180d2: function(arg0, arg1) {
|
|
389
389
|
getObject(arg0).onopen = getObject(arg1);
|
|
390
390
|
},
|
|
391
|
-
|
|
391
|
+
__wbg_warn_a5241bed60363932: function(arg0, arg1) {
|
|
392
392
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
393
393
|
},
|
|
394
394
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
395
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
396
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
395
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
396
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42);
|
|
397
397
|
return addHeapObject(ret);
|
|
398
398
|
},
|
|
399
399
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
400
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx:
|
|
401
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
400
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
401
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42_1);
|
|
402
402
|
return addHeapObject(ret);
|
|
403
403
|
},
|
|
404
404
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
405
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
406
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
405
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
406
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_42_2);
|
|
407
407
|
return addHeapObject(ret);
|
|
408
408
|
},
|
|
409
409
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
410
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
411
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
410
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
411
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_40);
|
|
412
412
|
return addHeapObject(ret);
|
|
413
413
|
},
|
|
414
414
|
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
@@ -445,27 +445,27 @@ function __wbg_get_imports() {
|
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
function
|
|
449
|
-
wasm.
|
|
448
|
+
function __wasm_bindgen_func_elem_40(arg0, arg1) {
|
|
449
|
+
wasm.__wasm_bindgen_func_elem_40(arg0, arg1);
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
function
|
|
453
|
-
wasm.
|
|
452
|
+
function __wasm_bindgen_func_elem_42(arg0, arg1, arg2) {
|
|
453
|
+
wasm.__wasm_bindgen_func_elem_42(arg0, arg1, addHeapObject(arg2));
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
function
|
|
457
|
-
wasm.
|
|
456
|
+
function __wasm_bindgen_func_elem_42_1(arg0, arg1, arg2) {
|
|
457
|
+
wasm.__wasm_bindgen_func_elem_42_1(arg0, arg1, addHeapObject(arg2));
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
function
|
|
461
|
-
wasm.
|
|
460
|
+
function __wasm_bindgen_func_elem_42_2(arg0, arg1, arg2) {
|
|
461
|
+
wasm.__wasm_bindgen_func_elem_42_2(arg0, arg1, addHeapObject(arg2));
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
|
|
465
465
|
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
|
|
466
466
|
const ChannelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
467
467
|
? { register: () => {}, unregister: () => {} }
|
|
468
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_channel_free(ptr
|
|
468
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_channel_free(ptr, 1));
|
|
469
469
|
|
|
470
470
|
function addHeapObject(obj) {
|
|
471
471
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
@@ -565,8 +565,7 @@ function getDataViewMemory0() {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
function getStringFromWasm0(ptr, len) {
|
|
568
|
-
|
|
569
|
-
return decodeText(ptr, len);
|
|
568
|
+
return decodeText(ptr >>> 0, len);
|
|
570
569
|
}
|
|
571
570
|
|
|
572
571
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -780,6 +779,10 @@ var ProtocolMessageType;
|
|
|
780
779
|
ProtocolMessageType["TunnelClosed"] = "TunnelClosed";
|
|
781
780
|
ProtocolMessageType["TunnelData"] = "TunnelData";
|
|
782
781
|
ProtocolMessageType["SFTPListItems"] = "SFTPListItems";
|
|
782
|
+
ProtocolMessageType["SFTPDownloadStartResponse"] = "SFTPDownloadStartResponse";
|
|
783
|
+
ProtocolMessageType["SFTPDownloadChunk"] = "SFTPDownloadChunk";
|
|
784
|
+
ProtocolMessageType["SFTPUploadStartResponse"] = "SFTPUploadStartResponse";
|
|
785
|
+
ProtocolMessageType["SFTPUploadChunkAck"] = "SFTPUploadChunkAck";
|
|
783
786
|
})(ProtocolMessageType || (ProtocolMessageType = {}));
|
|
784
787
|
var InputMode;
|
|
785
788
|
(function (InputMode) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as t,c as i,g as s,h as e,H as h}from"./p-
|
|
1
|
+
import{r as t,c as i,g as s,h as e,H as h}from"./p-PKnTMZa7.js";import{I as r,_ as n,C as o,a as l,P as a,E as u}from"./p-D48Fhv67.js";
|
|
2
2
|
/**
|
|
3
3
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
4
4
|
* @license MIT
|
|
@@ -46,4 +46,4 @@ import{r as t,c as i,g as s,h as e,H as h}from"./p-jdexunMF.js";import{I as r,_
|
|
|
46
46
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
47
47
|
* http://bellard.org/jslinux/
|
|
48
48
|
* Copyright (c) 2011 Fabrice Bellard
|
|
49
|
-
*/function eu(t,i){let s,e=this,h=!1;return function(){return h||(h=!0,i||(s=t.apply(e,arguments))),s}}(t=>{t.isLessThan=function(t){return t<0},t.isLessThanOrEqual=function(t){return t<=0},t.isGreaterThan=function(t){return t>0},t.isNeitherLessOrGreaterThan=function(t){return 0===t},t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Ha||={}),(t=>{function i(t){return t&&"object"==typeof t&&"function"==typeof t[Symbol.iterator]}t.is=i;let s=Object.freeze([]);function*e(t){yield t}t.empty=function(){return s},t.single=e,t.wrap=function(t){return i(t)?t:e(t)},t.from=function(t){return t||s},t.reverse=function*(t){for(let i=t.length-1;i>=0;i--)yield t[i]},t.isEmpty=function(t){return!t||!0===t[Symbol.iterator]().next().done},t.first=function(t){return t[Symbol.iterator]().next().value},t.some=function(t,i){let s=0;for(let e of t)if(i(e,s++))return!0;return!1},t.find=function(t,i){for(let s of t)if(i(s))return s},t.filter=function*(t,i){for(let s of t)i(s)&&(yield s)},t.map=function*(t,i){let s=0;for(let e of t)yield i(e,s++)},t.flatMap=function*(t,i){let s=0;for(let e of t)yield*i(e,s++)},t.concat=function*(...t){for(let i of t)yield*i},t.reduce=function(t,i,s){let e=s;for(let s of t)e=i(e,s);return e},t.slice=function*(t,i,s=t.length){for(i<0&&(i+=t.length),s<0?s+=t.length:s>t.length&&(s=t.length);i<s;i++)yield t[i]},t.consume=function(i,s=Number.POSITIVE_INFINITY){let e=[];if(0===s)return[e,i];let h=i[Symbol.iterator]();for(let i=0;i<s;i++){let i=h.next();if(i.done)return[e,t.empty()];e.push(i.value)}return[e,{[Symbol.iterator]:()=>h}]},t.asyncToArray=async function(t){let i=[];for await(let s of t)i.push(s);return Promise.resolve(i)}})(Ta||={});var hu=class t{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{!function(t){if(Ta.is(t)){let i=[];for(let s of t)if(s)try{s.dispose()}catch(t){i.push(t)}if(1===i.length)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}t&&t.dispose()}(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?t.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&this._toDispose.delete(t)}};hu.DISABLE_DISPOSED_WARNING=!1;var ru=hu,nu=class{constructor(){this._store=new ru}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};nu.None=Object.freeze({dispose(){}});var ou=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},lu=class t extends nu{constructor(t){super(),this._terminal=t,this._optionsRefresh=this._register(new ou),this._oldOpen=this._terminal._core.open,this._terminal._core.open=t=>{this._oldOpen?.call(this._terminal._core,t),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange((t=>{"fontSize"===t&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))})),this._register(function(t){return{dispose:eu((()=>{t()}))}}((()=>{this.removeLayerFromDom(),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this.canvas=void 0,this._ctx=void 0,this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0})))}static createCanvas(t,i,s){let e=(t||document).createElement("canvas");return e.width=0|i,e.height=0|s,e}static createImageData(t,i,s,e){if("function"!=typeof ImageData){let h=t.createImageData(i,s);return e&&h.data.set(new Uint8ClampedArray(e,0,i*s*4)),h}return e?new ImageData(new Uint8ClampedArray(e,0,i*s*4),i,s):new ImageData(i,s)}static createImageBitmap(t){return"function"!=typeof createImageBitmap?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&-1!==this.cellSize.height&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._renderService?.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,i){this._ctx?.clearRect(0,t*(this.dimensions?.css.cell.height||0),this.dimensions?.css.canvas.width||0,(++i-t)*(this.dimensions?.css.cell.height||0))}clearAll(){this._ctx?.clearRect(0,0,this.canvas?.width||0,this.canvas?.height||0)}draw(t,i,s,e,h=1){if(!this._ctx)return;let{width:r,height:n}=this.cellSize;if(-1===r||-1===n)return;this._rescaleImage(t,r,n);let o=t.actual,l=Math.ceil(o.width/r),a=i%l*r,u=Math.floor(i/l)*n,c=s*r,A=e*n,f=h*r+a>o.width?o.width-a:h*r,d=u+n>o.height?o.height-u:n;this._ctx.drawImage(o,Math.floor(a),Math.floor(u),Math.ceil(f),Math.ceil(d),Math.floor(c),Math.floor(A),Math.ceil(f),Math.ceil(d))}extractTile(i,s){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h)return;this._rescaleImage(i,e,h);let r=i.actual,n=Math.ceil(r.width/e),o=s%n*e,l=Math.floor(s/n)*h,a=e+o>r.width?r.width-o:e,u=l+h>r.height?r.height-l:h,c=t.createCanvas(this.document,a,u),A=c.getContext("2d");return A?(A.drawImage(r,Math.floor(o),Math.floor(l),Math.floor(a),Math.floor(u),0,0,Math.floor(a),Math.floor(u)),c):void 0}drawPlaceholder(t,i,s=1){if(this._ctx){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h||(this._placeholder?h>=this._placeholder.height&&this._createPlaceHolder(h+1):this._createPlaceHolder(Math.max(h+1,24)),!this._placeholder))return;this._ctx.drawImage(this._placeholderBitmap||this._placeholder,t*e,i*h%2?0:1,e*s,h,t*e,i*h,e*s,h)}}rescaleCanvas(){this.canvas&&(this.canvas.width!==this.dimensions.css.canvas.width||this.canvas.height!==this.dimensions.css.canvas.height)&&(this.canvas.width=this.dimensions.css.canvas.width||0,this.canvas.height=this.dimensions.css.canvas.height||0)}_rescaleImage(i,s,e){if(s===i.actualCellSize.width&&e===i.actualCellSize.height)return;let{width:h,height:r}=i.origCellSize;if(s===h&&e===r)return i.actual=i.orig,i.actualCellSize.width=h,void(i.actualCellSize.height=r);let n=t.createCanvas(this.document,Math.ceil(i.orig.width*s/h),Math.ceil(i.orig.height*e/r)),o=n.getContext("2d");o&&(o.drawImage(i.orig,0,0,n.width,n.height),i.actual=n,i.actualCellSize.width=s,i.actualCellSize.height=e)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{this.removeLayerFromDom(),this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(){this.document&&this._terminal._core.screenElement?this.canvas||(this.canvas=t.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0),this.canvas.classList.add("xterm-image-layer"),this._terminal._core.screenElement.appendChild(this.canvas),this._ctx=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0}),this.clearAll()):console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement")}removeLayerFromDom(){this.canvas&&(this._ctx=void 0,this.canvas.remove(),this.canvas=void 0)}_createPlaceHolder(i=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let s=32,e=t.createCanvas(this.document,s,i),h=e.getContext("2d",{alpha:!1});if(!h)return;let r=t.createImageData(h,s,i),n=new Uint32Array(r.data.buffer),o=(0,su.toRGBA8888)(0,0,0),l=(0,su.toRGBA8888)(255,255,255);n.fill(o);for(let t=0;t<i;++t){let i=t%2,e=t*s;for(let t=0;t<s;t+=2)n[e+t+i]=l}h.putImageData(r,0,0);let a=screen.width+s-1&-32||4096;this._placeholder=t.createCanvas(this.document,a,i);let u=this._placeholder.getContext("2d",{alpha:!1});if(u){for(let t=0;t<a;t+=s)u.drawImage(e,t,0);t.createImageBitmap(this._placeholder).then((t=>this._placeholderBitmap=t))}else this._placeholder=void 0}get document(){return this._terminal._core._coreBrowserService?.window.document}},au={width:7,height:14},uu=class t{constructor(t=0,i=0,s=-1,e=-1){this.imageId=s,this.tileId=e,this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(t){this._ext&=-67108864,this._ext|=67108863&t}get underlineVariantOffset(){let t=(3758096384&this._ext)>>29;return t<0?4294967288^t:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new t(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId&&-1===this.imageId}},cu=new uu,Au=class{constructor(t,i,s){this._terminal=t,this._renderer=i,this._opts=s,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(t){console.error(t.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let t of this._images.values())t.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return 4*this._pixelLimit/1e6}setLimit(t){if(t<.5||t>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=t/4*1e6>>>0,this._evictOldest(0)}getUsage(){return 4*this._getStoredPixels()/1e6}_getStoredPixels(){let t=0;for(let i of this._images.values())i.orig&&(t+=i.orig.width*i.orig.height,i.actual&&i.actual!==i.orig&&(t+=i.actual.width*i.actual.height));return t}_delImg(t){let i=this._images.get(t);this._images.delete(t),i&&window.ImageBitmap&&i.orig instanceof ImageBitmap&&i.orig.close()}wipeAlternate(){let t=[];for(let[i,s]of this._images.entries())"alternate"===s.bufferType&&(s.marker?.dispose(),t.push(i));for(let i of t)this._delImg(i);this._needsFullClear=!0,this._fullyCleared=!1}advanceCursor(t){if(this._opts.sixelScrolling){let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=au);let s=Math.ceil(t/i.height);for(let t=1;t<s;++t)this._terminal._core._inputHandler.lineFeed()}}addImage(t){this._evictOldest(t.width*t.height);let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=au);let s=Math.ceil(t.width/i.width),e=Math.ceil(t.height/i.height),h=++this._lastId,r=this._terminal._core.buffer,n=this._terminal.cols,o=this._terminal.rows,l=r.x,a=r.y,u=l,c=0;this._opts.sixelScrolling||(r.x=0,r.y=0,u=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y);for(let t=0;t<e;++t){let i=r.lines.get(r.y+r.ybase);for(let e=0;e<s&&!(u+e>=n);++e)this._writeToCell(i,u+e,h,t*s+e),c++;if(this._opts.sixelScrolling)t<e-1&&this._terminal._core._inputHandler.lineFeed();else if(++r.y>=o)break;r.x=u}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y),this._opts.sixelScrolling?r.x=u:(r.x=l,r.y=a);let A=[];for(let[t,i]of this._images.entries())i.tileCount<1&&(i.marker?.dispose(),A.push(t));for(let t of A)this._delImg(t);let f=this._terminal.registerMarker(0);f?.onDispose((()=>{this._images.get(h)&&this._delImg(h)})),"alternate"===this._terminal.buffer.active.type&&this._evictOnAlternate();let d={orig:t,origCellSize:i,actual:t,actualCellSize:{...i},marker:f||void 0,tileCount:c,bufferType:this._terminal.buffer.active.type};this._images.set(h,d)}render(t){if(!this._renderer.canvas&&this._images.size&&(this._renderer.insertLayerToDom(),!this._renderer.canvas))return;if(this._renderer.rescaleCanvas(),!this._images.size)return this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),void(this._renderer.canvas&&this._renderer.removeLayerFromDom());this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:i,end:s}=t,e=this._terminal._core.buffer,h=this._terminal._core.cols;this._renderer.clearLines(i,s);for(let t=i;t<=s;++t){let i=e.lines.get(t+e.ydisp);if(!i)return;for(let s=0;s<h;++s)if(268435456&i.getBg(s)){let e=i._extendedAttrs[s]||cu,r=e.imageId;if(void 0===r||-1===r)continue;let n=this._images.get(r);if(-1!==e.tileId){let o=e.tileId,l=s,a=1;for(;++s<h&&268435456&i.getBg(s)&&(e=i._extendedAttrs[s]||cu)&&e.imageId===r&&e.tileId===o+a;)a++;s--,n?n.actual&&this._renderer.draw(n,o,l,t,a):this._opts.showPlaceholder&&this._renderer.drawPlaceholder(l,t,a),this._fullyCleared=!1}}}}viewportResize(t){if(!this._images.size)return void(this._viewportMetrics=t);if(this._viewportMetrics.cols>=t.cols)return void(this._viewportMetrics=t);let i=this._terminal._core.buffer,s=i.lines.length,e=this._viewportMetrics.cols-1;for(let h=0;h<s;++h){let s=i.lines.get(h);if(268435456&s.getBg(e)){let i=s._extendedAttrs[e]||cu,h=i.imageId;if(void 0===h||-1===h)continue;let r=this._images.get(h);if(!r)continue;let n=Math.ceil((r.actual?.width||0)/r.actualCellSize.width);if(i.tileId%n+1>=n)continue;let o=!1;for(let i=e+1;i>t.cols;++i)if(4194303&s._data[3*i+0]){o=!0;break}if(o)continue;let l=Math.min(t.cols,n-i.tileId%n+e),a=i.tileId;for(let t=e+1;t<l;++t)this._writeToCell(s,t,h,++a),r.tileCount++}}this._viewportMetrics=t}getImageAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||cu;if(i.imageId&&-1!==i.imageId){let t=this._images.get(i.imageId)?.orig;if(window.ImageBitmap&&t instanceof ImageBitmap){let i=lu.createCanvas(window.document,t.width,t.height);return i.getContext("2d")?.drawImage(t,0,0,t.width,t.height),i}return t}}}extractTileAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||cu;if(i.imageId&&-1!==i.imageId&&-1!==i.tileId){let t=this._images.get(i.imageId);if(t)return this._renderer.extractTile(t,i.tileId)}}}_evictOldest(t){let i=this._getStoredPixels(),s=i;for(;this._pixelLimit<s+t&&this._images.size;){let t=this._images.get(++this._lowestId);t&&t.orig&&(s-=t.orig.width*t.orig.height,t.actual&&t.orig!==t.actual&&(s-=t.actual.width*t.actual.height),t.marker?.dispose(),this._delImg(this._lowestId))}return i-s}_writeToCell(t,i,s,e){if(268435456&t._data[3*i+2]){let h=t._extendedAttrs[i];if(h){if(void 0!==h.imageId){let t=this._images.get(h.imageId);return t&&t.tileCount--,h.imageId=s,void(h.tileId=e)}return void(t._extendedAttrs[i]=new uu(h.ext,h.urlId,s,e))}}t._data[3*i+2]|=268435456,t._extendedAttrs[i]=new uu(0,0,s,e)}_evictOnAlternate(){for(let t of this._images.values())"alternate"===t.bufferType&&(t.tileCount=0);let t=this._terminal._core.buffer;for(let i=0;i<this._terminal.rows;++i){let s=t.lines.get(i);if(s)for(let t=0;t<this._terminal.cols;++t)if(268435456&s._data[3*t+2]){let i=s._extendedAttrs[t]?.imageId;if(i){let t=this._images.get(i);t&&t.tileCount++}}}let i=[];for(let[t,s]of this._images.entries())"alternate"===s.bufferType&&!s.tileCount&&(s.marker?.dispose(),i.push(t));for(let t of i)this._delImg(t)}},fu=Ya(Va());function du(t){let i="";for(let s=0;s<t.length;++s)i+=String.fromCharCode(t[s]);return i}function gu(t){let i=0;for(let s=0;s<t.length;++s){if(t[s]<48||t[s]>57)throw new Error("illegal char");i=10*i+t[s]-48}return i}function wu(t){let i=du(t);if(!i.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return i}var pu={inline:gu,size:gu,name:function(t){if(typeof Buffer<"u")return Buffer.from(du(t),"base64").toString();let i=atob(du(t)),s=new Uint8Array(i.length);for(let t=0;t<s.length;++t)s[t]=i.charCodeAt(t);return(new TextDecoder).decode(s)},width:wu,height:wu,preserveAspectRatio:gu},Cu=[70,105,108,101],mu=1024,Iu=class{constructor(){this.state=0,this._buffer=new Uint32Array(mu),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}parse(t,i,s){let e=this.state,h=this._position,r=this._buffer;if(1===e||4===e||0===e&&h>6)return-1;for(let n=i;n<s;++n){let i=t[n];switch(i){case 59:if(!this._storeValue(h))return this._a();e=2,h=0;break;case 61:if(0===e){for(let t=0;t<Cu.length;++t)if(r[t]!==Cu[t])return this._a();e=2,h=0}else if(2===e){if(!this._storeKey(h))return this._a();e=3,h=0}else if(3===e){if(h>=mu)return this._a();r[h++]=i}break;case 58:return 3!==e||this._storeValue(h)?(this.state=4,n+1):this._a();default:if(h>=mu)return this._a();r[h++]=i}}return this.state=e,this._position=h,-2}_a(){return this.state=1,-1}_storeKey(t){let i=du(this._buffer.subarray(0,t));return!!i&&(this._key=i,this.fields[i]=null,!0)}_storeValue(t){if(this._key){try{let i=this._buffer.slice(0,t);this.fields[this._key]=pu[this._key]?pu[this._key](i):i}catch{return!1}return!0}return!1}},vu={mime:"unsupported",width:0,height:0},Bu={name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},Mu=class{constructor(t,i,s,e){this._opts=t,this._renderer=i,this._storage=s,this._coreTerminal=e,this._aborted=!1,this._hp=new Iu,this._header=Bu,this._dec=new fu.default(4194304),this._metrics=vu}reset(){}start(){this._aborted=!1,this._header=Bu,this._metrics=vu,this._hp.reset()}put(t,i,s){if(!this._aborted)if(4===this._hp.state)this._dec.put(t,i,s)&&(this._dec.release(),this._aborted=!0);else{let e=this._hp.parse(t,i,s);if(-1===e)return void(this._aborted=!0);if(e>0){if(this._header=Object.assign({},Bu,this._hp.fields),!this._header.inline||!this._header.size||this._header.size>this._opts.iipSizeLimit)return void(this._aborted=!0);this._dec.init(this._header.size),this._dec.put(t,e,s)&&(this._dec.release(),this._aborted=!0)}}}end(t){if(this._aborted)return!0;let i=0,s=0,e=!0;if((e=t)&&(e=!this._dec.end())&&(this._metrics=function(t){if(t.length<24)return vu;let i=new Uint32Array(t.buffer,t.byteOffset,6);if(1196314761===i[0]&&169478669===i[1]&&1380206665===i[3])return{mime:"image/png",width:t[16]<<24|t[17]<<16|t[18]<<8|t[19],height:t[20]<<24|t[21]<<16|t[22]<<8|t[23]};if(255===t[0]&&216===t[1]&&255===t[2]){let[i,s]=function(t){let i=t.length,s=4,e=t[s]<<8|t[s+1];for(;;){if(s+=e,s>=i)return[0,0];if(255!==t[s])return[0,0];if(192===t[s+1]||194===t[s+1])return s+8<i?[t[s+7]<<8|t[s+8],t[s+5]<<8|t[s+6]]:[0,0];s+=2,e=t[s]<<8|t[s+1]}}(t);return{mime:"image/jpeg",width:i,height:s}}return 944130375!==i[0]||55!==t[4]&&57!==t[4]||97!==t[5]?vu:{mime:"image/gif",width:t[7]<<8|t[6],height:t[9]<<8|t[8]}}(this._dec.data8),(e="unsupported"!==this._metrics.mime)&&(i=this._metrics.width,s=this._metrics.height,(e=i&&s&&i*s<this._opts.pixelLimit)&&([i,s]=this._resize(i,s).map(Math.floor),e=i&&s&&i*s<this._opts.pixelLimit))),!e)return this._dec.release(),!0;let h=new Blob([this._dec.data8],{type:this._metrics.mime});if(this._dec.release(),!window.createImageBitmap){let t=URL.createObjectURL(h),e=new Image;return new Promise((h=>{e.addEventListener("load",(()=>{URL.revokeObjectURL(t);let r=lu.createCanvas(window.document,i,s);r.getContext("2d")?.drawImage(e,0,0,i,s),this._storage.addImage(r),h(!0)})),e.src=t,setTimeout((()=>h(!0)),1e3)}))}return createImageBitmap(h,{resizeWidth:i,resizeHeight:s}).then((t=>(this._storage.addImage(t),!0)))}_resize(t,i){let s=this._renderer.dimensions?.css.cell.width||au.width,e=this._renderer.dimensions?.css.cell.height||au.height,h=this._renderer.dimensions?.css.canvas.width||s*this._coreTerminal.cols,r=this._renderer.dimensions?.css.canvas.height||e*this._coreTerminal.rows,n=this._dim(this._header.width,h,s),o=this._dim(this._header.height,r,e);if(!n&&!o){let s=Math.min(h/t,(r-e)/i);return s<1?[t*s,i*s]:[t,i]}return n?!this._header.preserveAspectRatio&&n&&o?[n,o]:[n,i*n/t]:[t*o/i,o]}_dim(t,i,s){return"auto"===t?0:t.endsWith("%")?parseInt(t.slice(0,-1))*i/100:t.endsWith("px")?parseInt(t.slice(0,-2)):parseInt(t)*s}},yu=Ya(Za()),Qu=Ya(iu()),Eu=yu.PALETTE_ANSI_256;Eu.set(yu.PALETTE_VT340_COLOR);var bu=class{constructor(t,i,s){this._opts=t,this._storage=i,this._coreTerminal=s,this._size=0,this._aborted=!1,(0,Qu.DecoderAsync)({memoryLimit:4*this._opts.pixelLimit,palette:Eu,paletteLimit:this._opts.sixelPaletteLimit}).then((t=>this._dec=t))}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Eu,this._opts.sixelPaletteLimit))}hook(t){if(this._size=0,this._aborted=!1,this._dec){let i=1===t.params[1]?0:function(t,i){let s=0;if(!i)return s;if(t.isInverse())if(t.isFgDefault())s=ku(i.foreground.rgba);else if(t.isFgRGB()){let i=t.constructor.toColorRGB(t.getFgColor());s=(0,yu.toRGBA8888)(...i)}else s=ku(i.ansi[t.getFgColor()].rgba);else if(t.isBgDefault())s=ku(i.background.rgba);else if(t.isBgRGB()){let i=t.constructor.toColorRGB(t.getBgColor());s=(0,yu.toRGBA8888)(...i)}else s=ku(i.ansi[t.getBgColor()].rgba);return s}(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(i,null,this._opts.sixelPaletteLimit)}}put(t,i,s){if(!this._aborted&&this._dec){if(this._size+=s-i,this._size>this._opts.sixelSizeLimit)return console.warn("SIXEL: too much data, aborting"),this._aborted=!0,void this._dec.release();try{this._dec.decode(t,i,s)}catch(t){console.warn(`SIXEL: error while decoding image - ${t}`),this._aborted=!0,this._dec.release()}}}unhook(t){if(this._aborted||!t||!this._dec)return!0;let i=this._dec.width,s=this._dec.height;if(!i||!s)return s&&this._storage.advanceCursor(s),!0;let e=lu.createCanvas(void 0,i,s);return e.getContext("2d")?.putImageData(new ImageData(this._dec.data8,i,s),0,0),this._dec.memoryUsage>4194304&&this._dec.release(),this._storage.addImage(e),!0}};function ku(t){return yu.BIG_ENDIAN?t:(255&t)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255}var xu={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7},Du=class{constructor(t){this._disposables=[],this._handlers=new Map,this._opts=Object.assign({},xu,t),this._defaultOpts=Object.assign({},xu,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear()}_disposeLater(...t){for(let i of t)this._disposables.push(i)}activate(t){if(this._terminal=t,this._renderer=new lu(t),this._storage=new Au(t,this._renderer,this._opts),this._opts.enableSizeReports){let i=t.options.windowOptions||{};i.getWinSizePixels=!0,i.getCellSizePixels=!0,i.getWinSizeChars=!0,t.options.windowOptions=i}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},(t=>this._decset(t))),t.parser.registerCsiHandler({prefix:"?",final:"l"},(t=>this._decrst(t))),t.parser.registerCsiHandler({final:"c"},(t=>this._da1(t))),t.parser.registerCsiHandler({prefix:"?",final:"S"},(t=>this._xtermGraphicsAttributes(t))),t.onRender((t=>this._storage?.render(t))),t.parser.registerCsiHandler({intermediates:"!",final:"p"},(()=>this.reset())),t.parser.registerEscHandler({final:"c"},(()=>this.reset())),t._core._inputHandler.onRequestReset((()=>this.reset())),t.buffer.onBufferChange((()=>this._storage?.wipeAlternate())),t.onResize((t=>this._storage?.viewportResize(t)))),this._opts.sixelSupport){let i=new bu(this._opts,this._storage,t);this._handlers.set("sixel",i),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},i))}if(this._opts.iipSupport){let i=new Mu(this._opts,this._renderer,this._storage,t);this._handlers.set("iip",i),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,i))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,i){return this._storage?.getImageAtBufferCell(t,i)}extractTileAtBufferCell(t,i){return this._storage?.extractTileAtBufferCell(t,i)}_report(t){this._terminal?._core.coreService.triggerDataEvent(t)}_decset(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return!!t[0]||!!this._opts.sixelSupport&&(this._report("[?62;4;9;22c"),!0)}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(1===t[0])switch(t[1]){case 1:return this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let t of this._handlers.values())t.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=4096?(this._opts.sixelPaletteLimit=t[2],this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`[?${t[0]};2S`),!0;case 4:return this._report(`[?${t[0]};0;4096S`),!0;default:return this._report(`[?${t[0]};2S`),!0}if(2===t[0])switch(t[1]){case 1:let i=this._renderer?.dimensions?.css.canvas.width,s=this._renderer?.dimensions?.css.canvas.height;if(!i||!s){let t=au;i=(this._terminal?.cols||80)*t.width,s=(this._terminal?.rows||24)*t.height}if(i*s<this._opts.pixelLimit)this._report(`[?${t[0]};0;${i.toFixed(0)};${s.toFixed(0)}S`);else{let i=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`[?${t[0]};0;${i};${i}S`)}return!0;case 4:let e=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`[?${t[0]};0;${e};${e}S`),!0;default:return this._report(`[?${t[0]};2S`),!0}return this._report(`[?${t[0]};1S`),!0}};const Lu=class{constructor(s){t(this,s),this.connectionStateChanged=i(this,"connectionStateChanged")}terminal;fitAddon;webLinksAddon;searchAddon;webglAddon;serializeAddon;imageAddon;channel;containerEl;domReady=!1;runtimeReady=!1;connected=!1;inputMode=r.Default;resizeObserver;resizeDebounceHandle;session_id;usernameBuffer="";passwordBuffer="";xtermImageSettings={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7};get el(){return s(this)}terminalOptions={termName:"xterm-256color",rendererType:"canvas",allowTransparency:!1,fontFamily:'"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace',fontSize:12,letterSpacing:0,lineHeight:1,allowProposedApi:!0,cursorBlink:!0,cursorWidth:1,theme:{background:"#0b1021",foreground:"#e2e8f0",cursor:"#67e8f9"},scrollback:1e4,fastScrollModifier:"shift",fastScrollSensitivity:5,bellStyle:"sound",convertEol:!1,disableStdin:!1,rightClickSelectsWord:!0,drawBoldTextInBrightColors:!0,minimumContrastRatio:1,windowsMode:!1,macOptionIsMeta:!1,altClickMovesCursor:!0};serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;token;onNodeIdChange(t,i){this.reset_session_state(),this.terminal.reset(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,i){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(){await n(),this.setup_terminal(),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.resizeDebounceHandle&&(clearTimeout(this.resizeDebounceHandle),this.resizeDebounceHandle=void 0),this.resizeObserver&&this.resizeObserver.disconnect(),this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms(),this.destroy_terminal()}is_terminal_open(){return Boolean(this.connected&&this.containerEl&&this.terminal.element)}fit_terminal_safely(){if(this.fitAddon&&this.is_terminal_open())try{this.fitAddon.fit()}catch(t){console.warn("Skipping terminal fit before renderer is ready:",t)}}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.containerEl&&this.terminal&&this.channel&&this.connect()}setup_terminal(){this.terminal=new Mr(this.terminalOptions),this.fitAddon=new yr,this.terminal.loadAddon(this.fitAddon),this.webLinksAddon=new Dr,this.terminal.loadAddon(this.webLinksAddon),this.searchAddon=new Ln,this.terminal.loadAddon(this.searchAddon),this.serializeAddon=new Ga,this.terminal.loadAddon(this.serializeAddon),this.imageAddon=new Du(this.xtermImageSettings),this.terminal.loadAddon(this.imageAddon);try{this.webglAddon=new Qa,this.terminal.loadAddon(this.webglAddon)}catch(t){console.warn("WebGL addon not available or failed to load:",t)}"function"==typeof this.terminal.onResize&&this.terminal.onResize((()=>{this.send_ssh_terminal_resize()}))}destroy_terminal(){this.terminal&&(this.terminal.reset(),"function"==typeof this.terminal.dispose&&this.terminal.dispose())}open_comms(){this.channel=this.serverId?new o(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new o(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([l.Connected]),this.channel.authenticate(this.token,this.nodeId)})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([l.Disconnected]),this.terminal.reset()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([l.Error,t])})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:i}=t.data;switch(i.type){case a.Error:this.handle_error(i);break;case a.AuthSuccess:this.handle_auth_success(i);break;case a.TunnelOpened:this.handle_tunnel_opened(i);break;case a.TunnelClosed:this.handle_tunnel_closed(i);break;case a.TunnelData:this.handle_tunnel_data(i);break;default:console.warn("Unknown protocol message type:",i)}}))}send_ssh_terminal_resize(){if(!this.containerEl)return void console.warn("Cannot send terminal resize: container element not available");if(!this.nodeId)return void console.warn("Cannot send terminal resize: node_id is missing");if(!this.channel)return void console.warn("Cannot send terminal resize: channel is not initialized");if(!this.channel.is_connected())return void console.warn("Cannot send terminal resize: channel not connected");if(!this.session_id)return void console.warn("Cannot send terminal resize: session_id is missing");this.fit_terminal_safely();const t=this.terminal?.cols??0,i=this.terminal?.rows??0,s=this.containerEl.clientWidth??0,e=this.containerEl.clientHeight??0;if(t<=0||i<=0||s<=0||e<=0)console.warn(`Cannot send terminal resize: invalid terminal dimensions cols=${t}, rows=${i}, px_width=${s}, px_height=${e}`);else try{console.log(`Sending terminal resize: cols=${t}, rows=${i}, px_width=${s}, px_height=${e}`),this.channel.send_ssh_terminal_resize(this.nodeId,this.session_id,t,i,s,e)}catch(t){console.error("Failed to send terminal resize:",t)}}send_ssh_data(t){this.channel.is_connected()&&this.session_id&&this.channel.send_ssh_tunnel_data(this.nodeId,this.session_id,t)}handle_error(t){switch(t.kind){case u.Generic:case u.Authentication:this.terminal.reset(),this.terminal.write(t.message+"\r\n"),this.terminal.focus(),this.usernameBuffer="",this.passwordBuffer="";break;case u.RequiresUsernamePassword:case u.RequiresUsername:this.terminal.reset(),this.inputMode=r.Username,this.usernameBuffer="",this.terminal.write("Enter your username: "),this.terminal.focus();break;case u.RequiresPassword:this.terminal.reset(),this.inputMode=r.Password,this.passwordBuffer="",this.terminal.write("Enter your password: "),this.terminal.focus();break;default:console.warn("Unknown error kind:",t)}}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}cancel_credential_entry(){this.inputMode=r.Default,this.clear_creds_buffer(),this.terminal.writeln("Authentication cancelled."),this.terminal.reset(),this.close_comms()}clear_creds_buffer(){this.usernameBuffer="",this.passwordBuffer=""}reset_session_state(){this.session_id=void 0,this.inputMode=r.Default,this.clear_creds_buffer()}handle_auth_success(t){this.clear_creds_buffer(),this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_ssh_tunnel(this.nodeId)}handle_tunnel_opened(t){this.session_id=t.sid,this.terminal.reset(),this.fit_terminal_safely(),this.send_ssh_terminal_resize()}handle_tunnel_data(t){this.terminal.write(new Uint8Array(t.data))}handle_tunnel_closed(t){this.session_id=void 0,this.inputMode=r.Default,this.clear_creds_buffer(),this.terminal.reset(),this.terminal.writeln("Connection closed."),this.close_comms()}connect(){const t=this.containerEl;console.log("Attempting to connect terminal to container:",t),t&&(this.terminal.open(t),console.log("Terminal opened in container"),this.connected=!0,this.fit_terminal_safely(),this.terminal.focus(),this.terminal.onData(this.handle_terminal_data.bind(this)),this.channel.connect(),this.setup_resize_observer(),console.log("Terminal connected and ready"))}setup_resize_observer(){this.resizeObserver=new ResizeObserver((()=>{console.log("Container resized, fitting terminal"),this.resizeDebounceHandle&&clearTimeout(this.resizeDebounceHandle),this.resizeDebounceHandle=setTimeout((()=>{this.fit_terminal_safely(),this.send_ssh_terminal_resize()}),100)})),this.resizeObserver.observe(this.containerEl??this.el)}handle_terminal_data(t){switch(this.inputMode){case r.Username:this.handle_username_input(t);break;case r.Password:this.handle_password_input(t);break;case r.Default:this.send_ssh_data(t)}}handle_username_input(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submit_username()):""===t?(this.terminal.write("^C\r\n"),void this.cancel_credential_entry()):void(""!==t?t>=" "&&t<="~"&&(this.usernameBuffer+=t,this.terminal.write(t)):this.usernameBuffer.length&&(this.usernameBuffer=this.usernameBuffer.slice(0,-1),this.terminal.write("\b \b")))}submit_username(){if(!this.channel.is_connected())return;const t=this.usernameBuffer.trim();if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your username: "),void(this.usernameBuffer="");this.inputMode=r.Default,this.channel.open_ssh_tunnel(this.nodeId,t)}handle_password_input(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submit_password()):""===t?(this.terminal.write("^C\r\n"),void this.cancel_credential_entry()):void(""!==t?t>=" "&&t<="~"&&(this.passwordBuffer+=t,this.terminal.write("*")):this.passwordBuffer.length&&(this.passwordBuffer=this.passwordBuffer.slice(0,-1),this.terminal.write("\b \b")))}submit_password(){if(!this.channel.is_connected())return;const t=this.passwordBuffer;if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your password: "),void(this.passwordBuffer="");this.inputMode=r.Default,this.channel.open_ssh_tunnel(this.nodeId,this.usernameBuffer.trim(),t),this.passwordBuffer="",this.usernameBuffer=""}render(){return e(h,{key:"0df9307a490dc566e41be1e1d169f8862f8569b9"},e("div",{key:"c63a16718ef4a559b880c6058bf482db4aeb6af1",id:"ccc",ref:t=>this.containerEl=t}))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};Lu.style=".xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#FFF;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1 !important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px !important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:rgba(0,0,0,0);transition:opacity 100ms linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity 800ms linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden}:host #ccc{width:100%;height:100%;min-width:0;min-height:0;overflow:hidden}";export{Lu as phirepass_terminal}
|
|
49
|
+
*/function eu(t,i){let s,e=this,h=!1;return function(){return h||(h=!0,i||(s=t.apply(e,arguments))),s}}(t=>{t.isLessThan=function(t){return t<0},t.isLessThanOrEqual=function(t){return t<=0},t.isGreaterThan=function(t){return t>0},t.isNeitherLessOrGreaterThan=function(t){return 0===t},t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Ha||={}),(t=>{function i(t){return t&&"object"==typeof t&&"function"==typeof t[Symbol.iterator]}t.is=i;let s=Object.freeze([]);function*e(t){yield t}t.empty=function(){return s},t.single=e,t.wrap=function(t){return i(t)?t:e(t)},t.from=function(t){return t||s},t.reverse=function*(t){for(let i=t.length-1;i>=0;i--)yield t[i]},t.isEmpty=function(t){return!t||!0===t[Symbol.iterator]().next().done},t.first=function(t){return t[Symbol.iterator]().next().value},t.some=function(t,i){let s=0;for(let e of t)if(i(e,s++))return!0;return!1},t.find=function(t,i){for(let s of t)if(i(s))return s},t.filter=function*(t,i){for(let s of t)i(s)&&(yield s)},t.map=function*(t,i){let s=0;for(let e of t)yield i(e,s++)},t.flatMap=function*(t,i){let s=0;for(let e of t)yield*i(e,s++)},t.concat=function*(...t){for(let i of t)yield*i},t.reduce=function(t,i,s){let e=s;for(let s of t)e=i(e,s);return e},t.slice=function*(t,i,s=t.length){for(i<0&&(i+=t.length),s<0?s+=t.length:s>t.length&&(s=t.length);i<s;i++)yield t[i]},t.consume=function(i,s=Number.POSITIVE_INFINITY){let e=[];if(0===s)return[e,i];let h=i[Symbol.iterator]();for(let i=0;i<s;i++){let i=h.next();if(i.done)return[e,t.empty()];e.push(i.value)}return[e,{[Symbol.iterator]:()=>h}]},t.asyncToArray=async function(t){let i=[];for await(let s of t)i.push(s);return Promise.resolve(i)}})(Ta||={});var hu=class t{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{!function(t){if(Ta.is(t)){let i=[];for(let s of t)if(s)try{s.dispose()}catch(t){i.push(t)}if(1===i.length)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}t&&t.dispose()}(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?t.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&this._toDispose.delete(t)}};hu.DISABLE_DISPOSED_WARNING=!1;var ru=hu,nu=class{constructor(){this._store=new ru}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};nu.None=Object.freeze({dispose(){}});var ou=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},lu=class t extends nu{constructor(t){super(),this._terminal=t,this._optionsRefresh=this._register(new ou),this._oldOpen=this._terminal._core.open,this._terminal._core.open=t=>{this._oldOpen?.call(this._terminal._core,t),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange((t=>{"fontSize"===t&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))})),this._register(function(t){return{dispose:eu((()=>{t()}))}}((()=>{this.removeLayerFromDom(),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this.canvas=void 0,this._ctx=void 0,this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0})))}static createCanvas(t,i,s){let e=(t||document).createElement("canvas");return e.width=0|i,e.height=0|s,e}static createImageData(t,i,s,e){if("function"!=typeof ImageData){let h=t.createImageData(i,s);return e&&h.data.set(new Uint8ClampedArray(e,0,i*s*4)),h}return e?new ImageData(new Uint8ClampedArray(e,0,i*s*4),i,s):new ImageData(i,s)}static createImageBitmap(t){return"function"!=typeof createImageBitmap?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&-1!==this.cellSize.height&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._renderService?.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,i){this._ctx?.clearRect(0,t*(this.dimensions?.css.cell.height||0),this.dimensions?.css.canvas.width||0,(++i-t)*(this.dimensions?.css.cell.height||0))}clearAll(){this._ctx?.clearRect(0,0,this.canvas?.width||0,this.canvas?.height||0)}draw(t,i,s,e,h=1){if(!this._ctx)return;let{width:r,height:n}=this.cellSize;if(-1===r||-1===n)return;this._rescaleImage(t,r,n);let o=t.actual,l=Math.ceil(o.width/r),a=i%l*r,u=Math.floor(i/l)*n,c=s*r,A=e*n,f=h*r+a>o.width?o.width-a:h*r,d=u+n>o.height?o.height-u:n;this._ctx.drawImage(o,Math.floor(a),Math.floor(u),Math.ceil(f),Math.ceil(d),Math.floor(c),Math.floor(A),Math.ceil(f),Math.ceil(d))}extractTile(i,s){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h)return;this._rescaleImage(i,e,h);let r=i.actual,n=Math.ceil(r.width/e),o=s%n*e,l=Math.floor(s/n)*h,a=e+o>r.width?r.width-o:e,u=l+h>r.height?r.height-l:h,c=t.createCanvas(this.document,a,u),A=c.getContext("2d");return A?(A.drawImage(r,Math.floor(o),Math.floor(l),Math.floor(a),Math.floor(u),0,0,Math.floor(a),Math.floor(u)),c):void 0}drawPlaceholder(t,i,s=1){if(this._ctx){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h||(this._placeholder?h>=this._placeholder.height&&this._createPlaceHolder(h+1):this._createPlaceHolder(Math.max(h+1,24)),!this._placeholder))return;this._ctx.drawImage(this._placeholderBitmap||this._placeholder,t*e,i*h%2?0:1,e*s,h,t*e,i*h,e*s,h)}}rescaleCanvas(){this.canvas&&(this.canvas.width!==this.dimensions.css.canvas.width||this.canvas.height!==this.dimensions.css.canvas.height)&&(this.canvas.width=this.dimensions.css.canvas.width||0,this.canvas.height=this.dimensions.css.canvas.height||0)}_rescaleImage(i,s,e){if(s===i.actualCellSize.width&&e===i.actualCellSize.height)return;let{width:h,height:r}=i.origCellSize;if(s===h&&e===r)return i.actual=i.orig,i.actualCellSize.width=h,void(i.actualCellSize.height=r);let n=t.createCanvas(this.document,Math.ceil(i.orig.width*s/h),Math.ceil(i.orig.height*e/r)),o=n.getContext("2d");o&&(o.drawImage(i.orig,0,0,n.width,n.height),i.actual=n,i.actualCellSize.width=s,i.actualCellSize.height=e)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{this.removeLayerFromDom(),this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(){this.document&&this._terminal._core.screenElement?this.canvas||(this.canvas=t.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0),this.canvas.classList.add("xterm-image-layer"),this._terminal._core.screenElement.appendChild(this.canvas),this._ctx=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0}),this.clearAll()):console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement")}removeLayerFromDom(){this.canvas&&(this._ctx=void 0,this.canvas.remove(),this.canvas=void 0)}_createPlaceHolder(i=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let s=32,e=t.createCanvas(this.document,s,i),h=e.getContext("2d",{alpha:!1});if(!h)return;let r=t.createImageData(h,s,i),n=new Uint32Array(r.data.buffer),o=(0,su.toRGBA8888)(0,0,0),l=(0,su.toRGBA8888)(255,255,255);n.fill(o);for(let t=0;t<i;++t){let i=t%2,e=t*s;for(let t=0;t<s;t+=2)n[e+t+i]=l}h.putImageData(r,0,0);let a=screen.width+s-1&-32||4096;this._placeholder=t.createCanvas(this.document,a,i);let u=this._placeholder.getContext("2d",{alpha:!1});if(u){for(let t=0;t<a;t+=s)u.drawImage(e,t,0);t.createImageBitmap(this._placeholder).then((t=>this._placeholderBitmap=t))}else this._placeholder=void 0}get document(){return this._terminal._core._coreBrowserService?.window.document}},au={width:7,height:14},uu=class t{constructor(t=0,i=0,s=-1,e=-1){this.imageId=s,this.tileId=e,this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(t){this._ext&=-67108864,this._ext|=67108863&t}get underlineVariantOffset(){let t=(3758096384&this._ext)>>29;return t<0?4294967288^t:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new t(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId&&-1===this.imageId}},cu=new uu,Au=class{constructor(t,i,s){this._terminal=t,this._renderer=i,this._opts=s,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(t){console.error(t.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let t of this._images.values())t.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return 4*this._pixelLimit/1e6}setLimit(t){if(t<.5||t>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=t/4*1e6>>>0,this._evictOldest(0)}getUsage(){return 4*this._getStoredPixels()/1e6}_getStoredPixels(){let t=0;for(let i of this._images.values())i.orig&&(t+=i.orig.width*i.orig.height,i.actual&&i.actual!==i.orig&&(t+=i.actual.width*i.actual.height));return t}_delImg(t){let i=this._images.get(t);this._images.delete(t),i&&window.ImageBitmap&&i.orig instanceof ImageBitmap&&i.orig.close()}wipeAlternate(){let t=[];for(let[i,s]of this._images.entries())"alternate"===s.bufferType&&(s.marker?.dispose(),t.push(i));for(let i of t)this._delImg(i);this._needsFullClear=!0,this._fullyCleared=!1}advanceCursor(t){if(this._opts.sixelScrolling){let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=au);let s=Math.ceil(t/i.height);for(let t=1;t<s;++t)this._terminal._core._inputHandler.lineFeed()}}addImage(t){this._evictOldest(t.width*t.height);let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=au);let s=Math.ceil(t.width/i.width),e=Math.ceil(t.height/i.height),h=++this._lastId,r=this._terminal._core.buffer,n=this._terminal.cols,o=this._terminal.rows,l=r.x,a=r.y,u=l,c=0;this._opts.sixelScrolling||(r.x=0,r.y=0,u=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y);for(let t=0;t<e;++t){let i=r.lines.get(r.y+r.ybase);for(let e=0;e<s&&!(u+e>=n);++e)this._writeToCell(i,u+e,h,t*s+e),c++;if(this._opts.sixelScrolling)t<e-1&&this._terminal._core._inputHandler.lineFeed();else if(++r.y>=o)break;r.x=u}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y),this._opts.sixelScrolling?r.x=u:(r.x=l,r.y=a);let A=[];for(let[t,i]of this._images.entries())i.tileCount<1&&(i.marker?.dispose(),A.push(t));for(let t of A)this._delImg(t);let f=this._terminal.registerMarker(0);f?.onDispose((()=>{this._images.get(h)&&this._delImg(h)})),"alternate"===this._terminal.buffer.active.type&&this._evictOnAlternate();let d={orig:t,origCellSize:i,actual:t,actualCellSize:{...i},marker:f||void 0,tileCount:c,bufferType:this._terminal.buffer.active.type};this._images.set(h,d)}render(t){if(!this._renderer.canvas&&this._images.size&&(this._renderer.insertLayerToDom(),!this._renderer.canvas))return;if(this._renderer.rescaleCanvas(),!this._images.size)return this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),void(this._renderer.canvas&&this._renderer.removeLayerFromDom());this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:i,end:s}=t,e=this._terminal._core.buffer,h=this._terminal._core.cols;this._renderer.clearLines(i,s);for(let t=i;t<=s;++t){let i=e.lines.get(t+e.ydisp);if(!i)return;for(let s=0;s<h;++s)if(268435456&i.getBg(s)){let e=i._extendedAttrs[s]||cu,r=e.imageId;if(void 0===r||-1===r)continue;let n=this._images.get(r);if(-1!==e.tileId){let o=e.tileId,l=s,a=1;for(;++s<h&&268435456&i.getBg(s)&&(e=i._extendedAttrs[s]||cu)&&e.imageId===r&&e.tileId===o+a;)a++;s--,n?n.actual&&this._renderer.draw(n,o,l,t,a):this._opts.showPlaceholder&&this._renderer.drawPlaceholder(l,t,a),this._fullyCleared=!1}}}}viewportResize(t){if(!this._images.size)return void(this._viewportMetrics=t);if(this._viewportMetrics.cols>=t.cols)return void(this._viewportMetrics=t);let i=this._terminal._core.buffer,s=i.lines.length,e=this._viewportMetrics.cols-1;for(let h=0;h<s;++h){let s=i.lines.get(h);if(268435456&s.getBg(e)){let i=s._extendedAttrs[e]||cu,h=i.imageId;if(void 0===h||-1===h)continue;let r=this._images.get(h);if(!r)continue;let n=Math.ceil((r.actual?.width||0)/r.actualCellSize.width);if(i.tileId%n+1>=n)continue;let o=!1;for(let i=e+1;i>t.cols;++i)if(4194303&s._data[3*i+0]){o=!0;break}if(o)continue;let l=Math.min(t.cols,n-i.tileId%n+e),a=i.tileId;for(let t=e+1;t<l;++t)this._writeToCell(s,t,h,++a),r.tileCount++}}this._viewportMetrics=t}getImageAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||cu;if(i.imageId&&-1!==i.imageId){let t=this._images.get(i.imageId)?.orig;if(window.ImageBitmap&&t instanceof ImageBitmap){let i=lu.createCanvas(window.document,t.width,t.height);return i.getContext("2d")?.drawImage(t,0,0,t.width,t.height),i}return t}}}extractTileAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||cu;if(i.imageId&&-1!==i.imageId&&-1!==i.tileId){let t=this._images.get(i.imageId);if(t)return this._renderer.extractTile(t,i.tileId)}}}_evictOldest(t){let i=this._getStoredPixels(),s=i;for(;this._pixelLimit<s+t&&this._images.size;){let t=this._images.get(++this._lowestId);t&&t.orig&&(s-=t.orig.width*t.orig.height,t.actual&&t.orig!==t.actual&&(s-=t.actual.width*t.actual.height),t.marker?.dispose(),this._delImg(this._lowestId))}return i-s}_writeToCell(t,i,s,e){if(268435456&t._data[3*i+2]){let h=t._extendedAttrs[i];if(h){if(void 0!==h.imageId){let t=this._images.get(h.imageId);return t&&t.tileCount--,h.imageId=s,void(h.tileId=e)}return void(t._extendedAttrs[i]=new uu(h.ext,h.urlId,s,e))}}t._data[3*i+2]|=268435456,t._extendedAttrs[i]=new uu(0,0,s,e)}_evictOnAlternate(){for(let t of this._images.values())"alternate"===t.bufferType&&(t.tileCount=0);let t=this._terminal._core.buffer;for(let i=0;i<this._terminal.rows;++i){let s=t.lines.get(i);if(s)for(let t=0;t<this._terminal.cols;++t)if(268435456&s._data[3*t+2]){let i=s._extendedAttrs[t]?.imageId;if(i){let t=this._images.get(i);t&&t.tileCount++}}}let i=[];for(let[t,s]of this._images.entries())"alternate"===s.bufferType&&!s.tileCount&&(s.marker?.dispose(),i.push(t));for(let t of i)this._delImg(t)}},fu=Ya(Va());function du(t){let i="";for(let s=0;s<t.length;++s)i+=String.fromCharCode(t[s]);return i}function gu(t){let i=0;for(let s=0;s<t.length;++s){if(t[s]<48||t[s]>57)throw new Error("illegal char");i=10*i+t[s]-48}return i}function wu(t){let i=du(t);if(!i.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return i}var pu={inline:gu,size:gu,name:function(t){if(typeof Buffer<"u")return Buffer.from(du(t),"base64").toString();let i=atob(du(t)),s=new Uint8Array(i.length);for(let t=0;t<s.length;++t)s[t]=i.charCodeAt(t);return(new TextDecoder).decode(s)},width:wu,height:wu,preserveAspectRatio:gu},Cu=[70,105,108,101],mu=1024,Iu=class{constructor(){this.state=0,this._buffer=new Uint32Array(mu),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}parse(t,i,s){let e=this.state,h=this._position,r=this._buffer;if(1===e||4===e||0===e&&h>6)return-1;for(let n=i;n<s;++n){let i=t[n];switch(i){case 59:if(!this._storeValue(h))return this._a();e=2,h=0;break;case 61:if(0===e){for(let t=0;t<Cu.length;++t)if(r[t]!==Cu[t])return this._a();e=2,h=0}else if(2===e){if(!this._storeKey(h))return this._a();e=3,h=0}else if(3===e){if(h>=mu)return this._a();r[h++]=i}break;case 58:return 3!==e||this._storeValue(h)?(this.state=4,n+1):this._a();default:if(h>=mu)return this._a();r[h++]=i}}return this.state=e,this._position=h,-2}_a(){return this.state=1,-1}_storeKey(t){let i=du(this._buffer.subarray(0,t));return!!i&&(this._key=i,this.fields[i]=null,!0)}_storeValue(t){if(this._key){try{let i=this._buffer.slice(0,t);this.fields[this._key]=pu[this._key]?pu[this._key](i):i}catch{return!1}return!0}return!1}},vu={mime:"unsupported",width:0,height:0},Bu={name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},Mu=class{constructor(t,i,s,e){this._opts=t,this._renderer=i,this._storage=s,this._coreTerminal=e,this._aborted=!1,this._hp=new Iu,this._header=Bu,this._dec=new fu.default(4194304),this._metrics=vu}reset(){}start(){this._aborted=!1,this._header=Bu,this._metrics=vu,this._hp.reset()}put(t,i,s){if(!this._aborted)if(4===this._hp.state)this._dec.put(t,i,s)&&(this._dec.release(),this._aborted=!0);else{let e=this._hp.parse(t,i,s);if(-1===e)return void(this._aborted=!0);if(e>0){if(this._header=Object.assign({},Bu,this._hp.fields),!this._header.inline||!this._header.size||this._header.size>this._opts.iipSizeLimit)return void(this._aborted=!0);this._dec.init(this._header.size),this._dec.put(t,e,s)&&(this._dec.release(),this._aborted=!0)}}}end(t){if(this._aborted)return!0;let i=0,s=0,e=!0;if((e=t)&&(e=!this._dec.end())&&(this._metrics=function(t){if(t.length<24)return vu;let i=new Uint32Array(t.buffer,t.byteOffset,6);if(1196314761===i[0]&&169478669===i[1]&&1380206665===i[3])return{mime:"image/png",width:t[16]<<24|t[17]<<16|t[18]<<8|t[19],height:t[20]<<24|t[21]<<16|t[22]<<8|t[23]};if(255===t[0]&&216===t[1]&&255===t[2]){let[i,s]=function(t){let i=t.length,s=4,e=t[s]<<8|t[s+1];for(;;){if(s+=e,s>=i)return[0,0];if(255!==t[s])return[0,0];if(192===t[s+1]||194===t[s+1])return s+8<i?[t[s+7]<<8|t[s+8],t[s+5]<<8|t[s+6]]:[0,0];s+=2,e=t[s]<<8|t[s+1]}}(t);return{mime:"image/jpeg",width:i,height:s}}return 944130375!==i[0]||55!==t[4]&&57!==t[4]||97!==t[5]?vu:{mime:"image/gif",width:t[7]<<8|t[6],height:t[9]<<8|t[8]}}(this._dec.data8),(e="unsupported"!==this._metrics.mime)&&(i=this._metrics.width,s=this._metrics.height,(e=i&&s&&i*s<this._opts.pixelLimit)&&([i,s]=this._resize(i,s).map(Math.floor),e=i&&s&&i*s<this._opts.pixelLimit))),!e)return this._dec.release(),!0;let h=new Blob([this._dec.data8],{type:this._metrics.mime});if(this._dec.release(),!window.createImageBitmap){let t=URL.createObjectURL(h),e=new Image;return new Promise((h=>{e.addEventListener("load",(()=>{URL.revokeObjectURL(t);let r=lu.createCanvas(window.document,i,s);r.getContext("2d")?.drawImage(e,0,0,i,s),this._storage.addImage(r),h(!0)})),e.src=t,setTimeout((()=>h(!0)),1e3)}))}return createImageBitmap(h,{resizeWidth:i,resizeHeight:s}).then((t=>(this._storage.addImage(t),!0)))}_resize(t,i){let s=this._renderer.dimensions?.css.cell.width||au.width,e=this._renderer.dimensions?.css.cell.height||au.height,h=this._renderer.dimensions?.css.canvas.width||s*this._coreTerminal.cols,r=this._renderer.dimensions?.css.canvas.height||e*this._coreTerminal.rows,n=this._dim(this._header.width,h,s),o=this._dim(this._header.height,r,e);if(!n&&!o){let s=Math.min(h/t,(r-e)/i);return s<1?[t*s,i*s]:[t,i]}return n?!this._header.preserveAspectRatio&&n&&o?[n,o]:[n,i*n/t]:[t*o/i,o]}_dim(t,i,s){return"auto"===t?0:t.endsWith("%")?parseInt(t.slice(0,-1))*i/100:t.endsWith("px")?parseInt(t.slice(0,-2)):parseInt(t)*s}},yu=Ya(Za()),Qu=Ya(iu()),Eu=yu.PALETTE_ANSI_256;Eu.set(yu.PALETTE_VT340_COLOR);var bu=class{constructor(t,i,s){this._opts=t,this._storage=i,this._coreTerminal=s,this._size=0,this._aborted=!1,(0,Qu.DecoderAsync)({memoryLimit:4*this._opts.pixelLimit,palette:Eu,paletteLimit:this._opts.sixelPaletteLimit}).then((t=>this._dec=t))}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Eu,this._opts.sixelPaletteLimit))}hook(t){if(this._size=0,this._aborted=!1,this._dec){let i=1===t.params[1]?0:function(t,i){let s=0;if(!i)return s;if(t.isInverse())if(t.isFgDefault())s=ku(i.foreground.rgba);else if(t.isFgRGB()){let i=t.constructor.toColorRGB(t.getFgColor());s=(0,yu.toRGBA8888)(...i)}else s=ku(i.ansi[t.getFgColor()].rgba);else if(t.isBgDefault())s=ku(i.background.rgba);else if(t.isBgRGB()){let i=t.constructor.toColorRGB(t.getBgColor());s=(0,yu.toRGBA8888)(...i)}else s=ku(i.ansi[t.getBgColor()].rgba);return s}(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(i,null,this._opts.sixelPaletteLimit)}}put(t,i,s){if(!this._aborted&&this._dec){if(this._size+=s-i,this._size>this._opts.sixelSizeLimit)return console.warn("SIXEL: too much data, aborting"),this._aborted=!0,void this._dec.release();try{this._dec.decode(t,i,s)}catch(t){console.warn(`SIXEL: error while decoding image - ${t}`),this._aborted=!0,this._dec.release()}}}unhook(t){if(this._aborted||!t||!this._dec)return!0;let i=this._dec.width,s=this._dec.height;if(!i||!s)return s&&this._storage.advanceCursor(s),!0;let e=lu.createCanvas(void 0,i,s);return e.getContext("2d")?.putImageData(new ImageData(this._dec.data8,i,s),0,0),this._dec.memoryUsage>4194304&&this._dec.release(),this._storage.addImage(e),!0}};function ku(t){return yu.BIG_ENDIAN?t:(255&t)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255}var xu={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7},Du=class{constructor(t){this._disposables=[],this._handlers=new Map,this._opts=Object.assign({},xu,t),this._defaultOpts=Object.assign({},xu,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear()}_disposeLater(...t){for(let i of t)this._disposables.push(i)}activate(t){if(this._terminal=t,this._renderer=new lu(t),this._storage=new Au(t,this._renderer,this._opts),this._opts.enableSizeReports){let i=t.options.windowOptions||{};i.getWinSizePixels=!0,i.getCellSizePixels=!0,i.getWinSizeChars=!0,t.options.windowOptions=i}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},(t=>this._decset(t))),t.parser.registerCsiHandler({prefix:"?",final:"l"},(t=>this._decrst(t))),t.parser.registerCsiHandler({final:"c"},(t=>this._da1(t))),t.parser.registerCsiHandler({prefix:"?",final:"S"},(t=>this._xtermGraphicsAttributes(t))),t.onRender((t=>this._storage?.render(t))),t.parser.registerCsiHandler({intermediates:"!",final:"p"},(()=>this.reset())),t.parser.registerEscHandler({final:"c"},(()=>this.reset())),t._core._inputHandler.onRequestReset((()=>this.reset())),t.buffer.onBufferChange((()=>this._storage?.wipeAlternate())),t.onResize((t=>this._storage?.viewportResize(t)))),this._opts.sixelSupport){let i=new bu(this._opts,this._storage,t);this._handlers.set("sixel",i),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},i))}if(this._opts.iipSupport){let i=new Mu(this._opts,this._renderer,this._storage,t);this._handlers.set("iip",i),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,i))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,i){return this._storage?.getImageAtBufferCell(t,i)}extractTileAtBufferCell(t,i){return this._storage?.extractTileAtBufferCell(t,i)}_report(t){this._terminal?._core.coreService.triggerDataEvent(t)}_decset(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return!!t[0]||!!this._opts.sixelSupport&&(this._report("[?62;4;9;22c"),!0)}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(1===t[0])switch(t[1]){case 1:return this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let t of this._handlers.values())t.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=4096?(this._opts.sixelPaletteLimit=t[2],this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`[?${t[0]};2S`),!0;case 4:return this._report(`[?${t[0]};0;4096S`),!0;default:return this._report(`[?${t[0]};2S`),!0}if(2===t[0])switch(t[1]){case 1:let i=this._renderer?.dimensions?.css.canvas.width,s=this._renderer?.dimensions?.css.canvas.height;if(!i||!s){let t=au;i=(this._terminal?.cols||80)*t.width,s=(this._terminal?.rows||24)*t.height}if(i*s<this._opts.pixelLimit)this._report(`[?${t[0]};0;${i.toFixed(0)};${s.toFixed(0)}S`);else{let i=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`[?${t[0]};0;${i};${i}S`)}return!0;case 4:let e=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`[?${t[0]};0;${e};${e}S`),!0;default:return this._report(`[?${t[0]};2S`),!0}return this._report(`[?${t[0]};1S`),!0}};const Lu=class{constructor(s){t(this,s),this.connectionStateChanged=i(this,"connectionStateChanged")}terminal;fitAddon;webLinksAddon;searchAddon;webglAddon;serializeAddon;imageAddon;channel;containerEl;domReady=!1;runtimeReady=!1;connected=!1;inputMode=r.Default;resizeObserver;resizeDebounceHandle;session_id;usernameBuffer="";passwordBuffer="";xtermImageSettings={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7};get el(){return s(this)}terminalOptions={termName:"xterm-256color",rendererType:"canvas",allowTransparency:!1,fontFamily:'"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace',fontSize:12,letterSpacing:0,lineHeight:1,allowProposedApi:!0,cursorBlink:!0,cursorWidth:1,theme:{background:"#0b1021",foreground:"#e2e8f0",cursor:"#67e8f9"},scrollback:1e4,fastScrollModifier:"shift",fastScrollSensitivity:5,bellStyle:"sound",convertEol:!1,disableStdin:!1,rightClickSelectsWord:!0,drawBoldTextInBrightColors:!0,minimumContrastRatio:1,windowsMode:!1,macOptionIsMeta:!1,altClickMovesCursor:!0};serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;token;onNodeIdChange(t,i){this.reset_session_state(),this.terminal.reset(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,i){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(){await n(),this.setup_terminal(),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.resizeDebounceHandle&&(clearTimeout(this.resizeDebounceHandle),this.resizeDebounceHandle=void 0),this.resizeObserver&&this.resizeObserver.disconnect(),this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms(),this.destroy_terminal()}is_terminal_open(){return Boolean(this.connected&&this.containerEl&&this.terminal.element)}fit_terminal_safely(){if(this.fitAddon&&this.is_terminal_open())try{this.fitAddon.fit()}catch(t){console.warn("Skipping terminal fit before renderer is ready:",t)}}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.containerEl&&this.terminal&&this.channel&&this.connect()}setup_terminal(){this.terminal=new Mr(this.terminalOptions),this.fitAddon=new yr,this.terminal.loadAddon(this.fitAddon),this.webLinksAddon=new Dr,this.terminal.loadAddon(this.webLinksAddon),this.searchAddon=new Ln,this.terminal.loadAddon(this.searchAddon),this.serializeAddon=new Ga,this.terminal.loadAddon(this.serializeAddon),this.imageAddon=new Du(this.xtermImageSettings),this.terminal.loadAddon(this.imageAddon);try{this.webglAddon=new Qa,this.terminal.loadAddon(this.webglAddon)}catch(t){console.warn("WebGL addon not available or failed to load:",t)}"function"==typeof this.terminal.onResize&&this.terminal.onResize((()=>{this.send_ssh_terminal_resize()}))}destroy_terminal(){this.terminal&&(this.terminal.reset(),"function"==typeof this.terminal.dispose&&this.terminal.dispose())}open_comms(){this.channel=this.serverId?new o(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new o(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([l.Connected]),this.channel.authenticate(this.token,this.nodeId)})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([l.Disconnected]),this.terminal.reset()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([l.Error,t])})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:i}=t.data;switch(i.type){case a.Error:this.handle_error(i);break;case a.AuthSuccess:this.handle_auth_success(i);break;case a.TunnelOpened:this.handle_tunnel_opened(i);break;case a.TunnelClosed:this.handle_tunnel_closed(i);break;case a.TunnelData:this.handle_tunnel_data(i);break;default:console.warn("Unknown protocol message type:",i)}}))}send_ssh_terminal_resize(){if(!this.containerEl)return void console.warn("Cannot send terminal resize: container element not available");if(!this.nodeId)return void console.warn("Cannot send terminal resize: node_id is missing");if(!this.channel)return void console.warn("Cannot send terminal resize: channel is not initialized");if(!this.channel.is_connected())return void console.warn("Cannot send terminal resize: channel not connected");if(!this.session_id)return void console.warn("Cannot send terminal resize: session_id is missing");this.fit_terminal_safely();const t=this.terminal?.cols??0,i=this.terminal?.rows??0,s=this.containerEl.clientWidth??0,e=this.containerEl.clientHeight??0;if(t<=0||i<=0||s<=0||e<=0)console.warn(`Cannot send terminal resize: invalid terminal dimensions cols=${t}, rows=${i}, px_width=${s}, px_height=${e}`);else try{console.log(`Sending terminal resize: cols=${t}, rows=${i}, px_width=${s}, px_height=${e}`),this.channel.send_ssh_terminal_resize(this.nodeId,this.session_id,t,i,s,e)}catch(t){console.error("Failed to send terminal resize:",t)}}send_ssh_data(t){this.channel.is_connected()&&this.session_id&&this.channel.send_ssh_tunnel_data(this.nodeId,this.session_id,t)}handle_error(t){switch(t.kind){case u.Generic:case u.Authentication:this.terminal.reset(),this.terminal.write(t.message+"\r\n"),this.terminal.focus(),this.usernameBuffer="",this.passwordBuffer="";break;case u.RequiresUsernamePassword:case u.RequiresUsername:this.terminal.reset(),this.inputMode=r.Username,this.usernameBuffer="",this.terminal.write("Enter your username: "),this.terminal.focus();break;case u.RequiresPassword:this.terminal.reset(),this.inputMode=r.Password,this.passwordBuffer="",this.terminal.write("Enter your password: "),this.terminal.focus();break;default:console.warn("Unknown error kind:",t)}}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}cancel_credential_entry(){this.inputMode=r.Default,this.clear_creds_buffer(),this.terminal.writeln("Authentication cancelled."),this.terminal.reset(),this.close_comms()}clear_creds_buffer(){this.usernameBuffer="",this.passwordBuffer=""}reset_session_state(){this.session_id=void 0,this.inputMode=r.Default,this.clear_creds_buffer()}handle_auth_success(t){this.clear_creds_buffer(),this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_ssh_tunnel(this.nodeId)}handle_tunnel_opened(t){this.session_id=t.sid,this.terminal.reset(),this.fit_terminal_safely(),this.send_ssh_terminal_resize()}handle_tunnel_data(t){this.terminal.write(new Uint8Array(t.data))}handle_tunnel_closed(t){this.session_id=void 0,this.inputMode=r.Default,this.clear_creds_buffer(),this.terminal.reset(),this.terminal.writeln("Connection closed."),this.close_comms()}connect(){const t=this.containerEl;console.log("Attempting to connect terminal to container:",t),t&&(this.terminal.open(t),console.log("Terminal opened in container"),this.connected=!0,this.fit_terminal_safely(),this.terminal.focus(),this.terminal.onData(this.handle_terminal_data.bind(this)),this.channel.connect(),this.setup_resize_observer(),console.log("Terminal connected and ready"))}setup_resize_observer(){this.resizeObserver=new ResizeObserver((()=>{console.log("Container resized, fitting terminal"),this.resizeDebounceHandle&&clearTimeout(this.resizeDebounceHandle),this.resizeDebounceHandle=setTimeout((()=>{this.fit_terminal_safely(),this.send_ssh_terminal_resize()}),100)})),this.resizeObserver.observe(this.containerEl??this.el)}handle_terminal_data(t){switch(this.inputMode){case r.Username:this.handle_username_input(t);break;case r.Password:this.handle_password_input(t);break;case r.Default:this.send_ssh_data(t)}}handle_username_input(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submit_username()):""===t?(this.terminal.write("^C\r\n"),void this.cancel_credential_entry()):void(""!==t?t>=" "&&t<="~"&&(this.usernameBuffer+=t,this.terminal.write(t)):this.usernameBuffer.length&&(this.usernameBuffer=this.usernameBuffer.slice(0,-1),this.terminal.write("\b \b")))}submit_username(){if(!this.channel.is_connected())return;const t=this.usernameBuffer.trim();if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your username: "),void(this.usernameBuffer="");this.inputMode=r.Default,this.channel.open_ssh_tunnel(this.nodeId,t)}handle_password_input(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submit_password()):""===t?(this.terminal.write("^C\r\n"),void this.cancel_credential_entry()):void(""!==t?t>=" "&&t<="~"&&(this.passwordBuffer+=t,this.terminal.write("*")):this.passwordBuffer.length&&(this.passwordBuffer=this.passwordBuffer.slice(0,-1),this.terminal.write("\b \b")))}submit_password(){if(!this.channel.is_connected())return;const t=this.passwordBuffer;if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your password: "),void(this.passwordBuffer="");this.inputMode=r.Default,this.channel.open_ssh_tunnel(this.nodeId,this.usernameBuffer.trim(),t),this.passwordBuffer="",this.usernameBuffer=""}render(){return e(h,{key:"641344887f33ba9c4c8aa98186b84a92ebb020e7"},e("div",{key:"558aebfd21575d5dbdaacf03335485941373679a",id:"ccc",ref:t=>this.containerEl=t}))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};Lu.style=".xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#FFF;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1 !important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px !important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:rgba(0,0,0,0);transition:opacity 100ms linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity 800ms linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden}:host #ccc{width:100%;height:100%;min-width:0;min-height:0;overflow:hidden}";export{Lu as phirepass_terminal}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();P.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=R(n,P.__wbindgen_export,P.__wbindgen_export2),o=N,c=R(t,P.__wbindgen_export,P.__wbindgen_export2);P.channel_authenticate(this.__wbg_ptr,r,o,c,N,S(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){P.channel_connect(this.__wbg_ptr)}disconnect(){P.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==P.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==P.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=R(n,P.__wbindgen_export,P.__wbindgen_export2),o=N,c=R(t,P.__wbindgen_export,P.__wbindgen_export2),i=N;var s=S(e)?0:R(e,P.__wbindgen_export,P.__wbindgen_export2);const u=P.channel_new(r,o,c,i,s,N);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){P.channel_on_connection_close(this.__wbg_ptr,S(n)?0:u(n))}on_connection_error(n){P.channel_on_connection_error(this.__wbg_ptr,S(n)?0:u(n))}on_connection_message(n){P.channel_on_connection_message(this.__wbg_ptr,S(n)?0:u(n))}on_connection_open(n){P.channel_on_connection_open(this.__wbg_ptr,S(n)?0:u(n))}on_protocol_message(n){P.channel_on_protocol_message(this.__wbg_ptr,S(n)?0:u(n))}open_sftp_tunnel(n,t,e,r){const o=R(n,P.__wbindgen_export,P.__wbindgen_export2),c=N;var i=S(t)?0:R(t,P.__wbindgen_export,P.__wbindgen_export2),s=N,_=S(e)?0:R(e,P.__wbindgen_export,P.__wbindgen_export2);P.channel_open_sftp_tunnel(this.__wbg_ptr,o,c,i,s,_,N,S(r)?Number.MAX_SAFE_INTEGER:r>>>0)}open_ssh_tunnel(n,t,e,r){const o=R(n,P.__wbindgen_export,P.__wbindgen_export2),c=N;var i=S(t)?0:R(t,P.__wbindgen_export,P.__wbindgen_export2),s=N,_=S(e)?0:R(e,P.__wbindgen_export,P.__wbindgen_export2);P.channel_open_ssh_tunnel(this.__wbg_ptr,o,c,i,s,_,N,S(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_delete(n,t,e,r,o){const c=R(n,P.__wbindgen_export,P.__wbindgen_export2),i=N,s=R(e,P.__wbindgen_export,P.__wbindgen_export2),_=N,u=R(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_delete(this.__wbg_ptr,c,i,t,s,_,u,N,S(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_chunk(n,t,e,r,o){const c=R(n,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_download_chunk(this.__wbg_ptr,c,N,t,e,r,S(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const c=R(n,P.__wbindgen_export,P.__wbindgen_export2),i=N,s=R(e,P.__wbindgen_export,P.__wbindgen_export2),_=N,u=R(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_download_start(this.__wbg_ptr,c,i,t,s,_,u,N,S(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=R(n,P.__wbindgen_export,P.__wbindgen_export2),c=N,i=R(e,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_list_data(this.__wbg_ptr,o,c,t,i,N,S(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_upload_chunk(n,t,e,r,o,c,i){const s=R(n,P.__wbindgen_export,P.__wbindgen_export2),_=N,u=function(n){const t=(0,P.__wbindgen_export)(1*n.length,1)>>>0;return h().set(n,t/1),N=n.length,t}(c);P.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,N,S(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_sftp_upload_start(n,t,e,r,o,c,i){const s=R(n,P.__wbindgen_export,P.__wbindgen_export2),_=N,u=R(e,P.__wbindgen_export,P.__wbindgen_export2),a=N,f=R(r,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,N,o,c,S(i)?Number.MAX_SAFE_INTEGER:i>>>0)}send_ssh_terminal_resize(n,t,e,r,o,c){const i=R(n,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_ssh_terminal_resize(this.__wbg_ptr,i,N,t,e,r,o,c)}send_ssh_tunnel_data(n,t,e){const r=R(n,P.__wbindgen_export,P.__wbindgen_export2),o=N,c=R(e,P.__wbindgen_export,P.__wbindgen_export2);P.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,c,N)}start_heartbeat(n){P.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){P.channel_stop_heartbeat(this.__wbg_ptr)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_3639a60ed15f87e7:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=R(String(p(t)),P.__wbindgen_export,P.__wbindgen_export2),r=N;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_07cb72cfcc952e2b:function(n,t){const e=R(f(p(t)),P.__wbindgen_export,P.__wbindgen_export2),r=N;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_965592073e5d848c:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=S(r)?0:R(r,P.__wbindgen_export,P.__wbindgen_export2),c=N;d().setInt32(n+4,c,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_9c75d47bf9e7731e:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_158e43e869788cdc:function(n){p(n)._wbg_cb_unref()},__wbg_call_a41d6421b30a32c5:function(){return y((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_call_add9e5a76382e668:function(){return y((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(T(n)))},__wbg_close_931d0c62e2aab92c:function(){return y((function(n){p(n).close()}),arguments)},__wbg_data_4a14fad4c5f216c4:function(n){return u(p(n).data)},__wbg_from_ff141b1e4c69b979:function(n){return u(Array.from(p(n)))},__wbg_info_b32d86aa057de44b:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_eab9f28fbec23477:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_ba3c032602efe310:function(n){return p(n).length},__wbg_new_2fad8ca02fd00684:function(){return u(new Object)},__wbg_new_3baa8d9866155c79:function(){return u(new Array)},__wbg_new_8454eee672b2ba6e:function(n){return u(new Uint8Array(p(n)))},__wbg_new_with_str_sequence_d90cb07368a00c61:function(){return y((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_fd4050e806e1d519:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_60a5366c0bb22a7d:function(n,t){return p(n).push(p(t))},__wbg_readyState_be3cc9403da6c6ae:function(n){return p(n).readyState},__wbg_send_c422d0aa0cb71d09:function(){return y((function(n,t,e){p(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return y((function(n,t){return u(setInterval(p(n),t))}),arguments)},__wbg_set_6be42768c690e380:function(n,t,e){p(n)[T(t)]=T(e)},__wbg_set_binaryType_8564bdba0fbec720:function(n,t){p(n).binaryType=s[t]},__wbg_set_f614f6a0608d1d1d:function(n,t,e){p(n)[t>>>0]=T(e)},__wbg_set_onclose_f756840519cd20b5:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_02f33de339f1fa31:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_d2ff0c1d20584625:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_1da8a4f65e6180d2:function(n,t){p(n).onopen=p(t)},__wbg_warn_a5241bed60363932:function(n,t){console.warn(w(n,t))},__wbindgen_cast_0000000000000001:function(n,t){return u(v(n,t,o))},__wbindgen_cast_0000000000000002:function(n,t){return u(v(n,t,c))},__wbindgen_cast_0000000000000003:function(n,t){return u(v(n,t,i))},__wbindgen_cast_0000000000000004:function(n,t){return u(v(n,t,r))},__wbindgen_cast_0000000000000005:function(n){return u(n)},__wbindgen_cast_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_cast_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_cast_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(p(n))},__wbindgen_object_drop_ref:function(n){T(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){P.__wasm_bindgen_func_elem_40(n,t)}function o(n,t,e){P.__wasm_bindgen_func_elem_42(n,t,u(e))}function c(n,t,e){P.__wasm_bindgen_func_elem_42_1(n,t,u(e))}function i(n,t,e){P.__wasm_bindgen_func_elem_42_2(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>P.__wbg_channel_free(n,1)));function u(n){A===m.length&&m.push(m.length+1);const t=A;return A=m[t],m[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>P.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==P.memory.buffer)&&(l=new DataView(P.memory.buffer)),l}function w(n,t){return function(n,t){return F+=t,F>=j&&(U=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),U.decode(),F=t),U.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(P.memory.buffer)),g}function p(n){return m[n]}function y(n,t){try{return n.apply(this,t)}catch(n){P.__wbindgen_export3(u(n))}}let m=new Array(1024).fill(void 0);m.push(void 0,null,!0,!1);let A=m.length;function S(n){return null==n}function v(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(P.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function R(n,t,e){if(void 0===e){const e=O.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),N=e.length,r}let r=n.length,o=t(r,1)>>>0;const c=h();let i=0;for(;i<r;i++){const t=n.charCodeAt(i);if(t>127)break;c[o+i]=t}if(i!==r){0!==i&&(n=n.slice(i)),o=e(o,r,r=i+3*n.length,1)>>>0;const t=h().subarray(o+i,o+r);i+=O.encodeInto(n,t).written,o=e(o,r,i,1)>>>0}return N=i,o}function T(n){const t=p(n);return function(n){n<1028||(m[n]=A,A=n)}(n),t}let U=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});U.decode();const j=2146435072;let F=0;const O=new TextEncoder;"encodeInto"in O||(O.encodeInto=function(n,t){const e=O.encode(n);return t.set(e),{read:n.length,written:e.length}});let P,N=0;async function q(n){if(void 0!==P)return P;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!n.ok||!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return P=n.exports,l=null,g=null,P}(r)}var I,W,k;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck"}(I||(I={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(W||(W={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(k||(k={}));export{n as C,t as E,W as I,I as P,q as _,k as a}
|