@lvce-editor/renderer-process 29.2.0 → 29.3.0
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/rendererProcessMain.js +159 -92
- package/package.json +1 -1
|
@@ -99,7 +99,7 @@ const writeText = async text => {
|
|
|
99
99
|
const toClipboardItem = options => {
|
|
100
100
|
return new ClipboardItem(options);
|
|
101
101
|
};
|
|
102
|
-
const write$
|
|
102
|
+
const write$2 = async itemOptions => {
|
|
103
103
|
const items = itemOptions.map(toClipboardItem);
|
|
104
104
|
await navigator.clipboard.write(items);
|
|
105
105
|
};
|
|
@@ -3445,7 +3445,7 @@ const hydrate$3 = async () => {
|
|
|
3445
3445
|
};
|
|
3446
3446
|
|
|
3447
3447
|
// TODO needed?
|
|
3448
|
-
const dispose$
|
|
3448
|
+
const dispose$j = () => {
|
|
3449
3449
|
if (state$7.rpc) {
|
|
3450
3450
|
// @ts-expect-error
|
|
3451
3451
|
state$7.rpc.dispose();
|
|
@@ -3470,7 +3470,7 @@ const invokeAndTransfer = (method, ...params) => {
|
|
|
3470
3470
|
|
|
3471
3471
|
const RendererWorker = {
|
|
3472
3472
|
__proto__: null,
|
|
3473
|
-
dispose: dispose$
|
|
3473
|
+
dispose: dispose$j,
|
|
3474
3474
|
hydrate: hydrate$3,
|
|
3475
3475
|
invoke: invoke$1,
|
|
3476
3476
|
invokeAndTransfer,
|
|
@@ -3645,7 +3645,7 @@ const createWithOptions = (type, message, options) => {
|
|
|
3645
3645
|
const $Notification = create$NotificationWithOptions(message, options);
|
|
3646
3646
|
append$1($Notification);
|
|
3647
3647
|
};
|
|
3648
|
-
const dispose$
|
|
3648
|
+
const dispose$i = id => {
|
|
3649
3649
|
// const $Notification = state.$Notifications
|
|
3650
3650
|
};
|
|
3651
3651
|
|
|
@@ -3782,7 +3782,7 @@ const getElement = () => {
|
|
|
3782
3782
|
return state$4.$PreviousFocusElement;
|
|
3783
3783
|
};
|
|
3784
3784
|
|
|
3785
|
-
const focus$
|
|
3785
|
+
const focus$e = $Element => {
|
|
3786
3786
|
if ($Element === document.activeElement) {
|
|
3787
3787
|
return;
|
|
3788
3788
|
}
|
|
@@ -3881,7 +3881,7 @@ const getLevel = $Menu => {
|
|
|
3881
3881
|
// @ts-expect-error
|
|
3882
3882
|
return state$3.$$Menus.indexOf($Menu);
|
|
3883
3883
|
};
|
|
3884
|
-
const handleMouseDown$
|
|
3884
|
+
const handleMouseDown$4 = event => {
|
|
3885
3885
|
const $Target = event.target;
|
|
3886
3886
|
const $Menu = $Target.closest('.Menu');
|
|
3887
3887
|
const index = findIndex($Menu, $Target);
|
|
@@ -3958,7 +3958,7 @@ const create$Menu$1 = () => {
|
|
|
3958
3958
|
$Menu.tabIndex = -1;
|
|
3959
3959
|
// $ContextMenu.onmousedown = contextMenuHandleMouseDown
|
|
3960
3960
|
// TODO mousedown vs click? (click is usually better but mousedown is faster, why wait 100ms?)
|
|
3961
|
-
$Menu.addEventListener(MouseDown, handleMouseDown$
|
|
3961
|
+
$Menu.addEventListener(MouseDown, handleMouseDown$4);
|
|
3962
3962
|
$Menu.addEventListener(MouseEnter, handleMouseEnter, {
|
|
3963
3963
|
capture: true
|
|
3964
3964
|
});
|
|
@@ -4031,7 +4031,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
|
|
|
4031
4031
|
state$3.$$Menus.push($Menu);
|
|
4032
4032
|
append$1($Menu);
|
|
4033
4033
|
if (level === 0) {
|
|
4034
|
-
focus$
|
|
4034
|
+
focus$e($Menu);
|
|
4035
4035
|
send('Focus.setFocus', FocusMenu);
|
|
4036
4036
|
}
|
|
4037
4037
|
};
|
|
@@ -4908,14 +4908,14 @@ const create$t = (uri, top, left) => {
|
|
|
4908
4908
|
const update = (state, uri) => {
|
|
4909
4909
|
state.$ImagePreviewImage.uri = uri;
|
|
4910
4910
|
};
|
|
4911
|
-
const dispose$
|
|
4911
|
+
const dispose$h = state => {
|
|
4912
4912
|
remove$1(state.$ImagePreview);
|
|
4913
4913
|
};
|
|
4914
4914
|
|
|
4915
4915
|
const ImagePreview$1 = {
|
|
4916
4916
|
__proto__: null,
|
|
4917
4917
|
create: create$t,
|
|
4918
|
-
dispose: dispose$
|
|
4918
|
+
dispose: dispose$h,
|
|
4919
4919
|
showError,
|
|
4920
4920
|
update
|
|
4921
4921
|
};
|
|
@@ -4938,7 +4938,7 @@ const get$ItemFromEvent = event => {
|
|
|
4938
4938
|
}
|
|
4939
4939
|
return undefined;
|
|
4940
4940
|
};
|
|
4941
|
-
const handleMouseDown$
|
|
4941
|
+
const handleMouseDown$3 = event => {
|
|
4942
4942
|
const {
|
|
4943
4943
|
button,
|
|
4944
4944
|
clientX,
|
|
@@ -4978,7 +4978,7 @@ const ViewletActivityBarEvents = {
|
|
|
4978
4978
|
handleBlur: handleBlur$8,
|
|
4979
4979
|
handleContextMenu: handleContextMenu$6,
|
|
4980
4980
|
handleFocus: handleFocus$8,
|
|
4981
|
-
handleMouseDown: handleMouseDown$
|
|
4981
|
+
handleMouseDown: handleMouseDown$3,
|
|
4982
4982
|
returnValue: returnValue$8
|
|
4983
4983
|
};
|
|
4984
4984
|
|
|
@@ -5061,7 +5061,7 @@ forwardViewletCommand('handleListBlur');
|
|
|
5061
5061
|
forwardViewletCommand('handleListFocus');
|
|
5062
5062
|
const handleMenuClick$1 = forwardViewletCommand('handleMenuClick');
|
|
5063
5063
|
const handleMenuMouseOver$1 = forwardViewletCommand('handleMenuMouseOver');
|
|
5064
|
-
const handleMouseDown$
|
|
5064
|
+
const handleMouseDown$2 = forwardViewletCommand('handleMouseDown');
|
|
5065
5065
|
forwardViewletCommand('handleMouseMove');
|
|
5066
5066
|
const handleMouseOut$1 = forwardViewletCommand('handleMouseOut');
|
|
5067
5067
|
const handleMouseOver$1 = forwardViewletCommand('handleMouseOver');
|
|
@@ -5101,6 +5101,7 @@ forwardViewletCommand('moveRectangleSelectionPx');
|
|
|
5101
5101
|
forwardViewletCommand('moveSelectionPx');
|
|
5102
5102
|
forwardViewletCommand('paste');
|
|
5103
5103
|
forwardViewletCommand('replaceAll');
|
|
5104
|
+
const resize = forwardViewletCommand('resize');
|
|
5104
5105
|
const selectIndex = forwardViewletCommand('selectIndex');
|
|
5105
5106
|
forwardViewletCommand('setDelta');
|
|
5106
5107
|
forwardViewletCommand('toggleMatchCase');
|
|
@@ -5146,7 +5147,7 @@ const create$s = () => {
|
|
|
5146
5147
|
$Viewlet
|
|
5147
5148
|
};
|
|
5148
5149
|
};
|
|
5149
|
-
const dispose$
|
|
5150
|
+
const dispose$g = state => {};
|
|
5150
5151
|
const refresh$4 = () => {};
|
|
5151
5152
|
const setTime = (state, time) => {
|
|
5152
5153
|
object(state);
|
|
@@ -5157,7 +5158,7 @@ const setTime = (state, time) => {
|
|
|
5157
5158
|
const ViewletClock = {
|
|
5158
5159
|
__proto__: null,
|
|
5159
5160
|
create: create$s,
|
|
5160
|
-
dispose: dispose$
|
|
5161
|
+
dispose: dispose$g,
|
|
5161
5162
|
refresh: refresh$4,
|
|
5162
5163
|
setTime
|
|
5163
5164
|
};
|
|
@@ -5353,7 +5354,7 @@ const setValue$2 = (state, value) => {
|
|
|
5353
5354
|
const $Input = $Viewlet.querySelector(':scope input');
|
|
5354
5355
|
$Input.value = value;
|
|
5355
5356
|
};
|
|
5356
|
-
const focus$
|
|
5357
|
+
const focus$d = state => {
|
|
5357
5358
|
const {
|
|
5358
5359
|
$Viewlet
|
|
5359
5360
|
} = state;
|
|
@@ -5364,7 +5365,7 @@ const focus$c = state => {
|
|
|
5364
5365
|
const ViewletDefineKeyBinding = {
|
|
5365
5366
|
__proto__: null,
|
|
5366
5367
|
Events: ViewletDefineKeyBindingEvents,
|
|
5367
|
-
focus: focus$
|
|
5368
|
+
focus: focus$d,
|
|
5368
5369
|
setValue: setValue$2
|
|
5369
5370
|
};
|
|
5370
5371
|
|
|
@@ -5751,10 +5752,10 @@ const appendWidget$5 = state => {
|
|
|
5751
5752
|
} = state;
|
|
5752
5753
|
append$1($Viewlet);
|
|
5753
5754
|
};
|
|
5754
|
-
const dispose$
|
|
5755
|
+
const dispose$f = state => {
|
|
5755
5756
|
remove$1(state.$Viewlet);
|
|
5756
5757
|
};
|
|
5757
|
-
const focus$
|
|
5758
|
+
const focus$c = (state, key, source) => {
|
|
5758
5759
|
if (!key) {
|
|
5759
5760
|
return;
|
|
5760
5761
|
}
|
|
@@ -5777,8 +5778,8 @@ const ViewletEditorCodeGenerator = {
|
|
|
5777
5778
|
__proto__: null,
|
|
5778
5779
|
Events: ViewletEditorCodeGeneratorEvents,
|
|
5779
5780
|
appendWidget: appendWidget$5,
|
|
5780
|
-
dispose: dispose$
|
|
5781
|
-
focus: focus$
|
|
5781
|
+
dispose: dispose$f,
|
|
5782
|
+
focus: focus$c,
|
|
5782
5783
|
setBounds: setBounds$9
|
|
5783
5784
|
};
|
|
5784
5785
|
|
|
@@ -5948,7 +5949,7 @@ const setDom$8 = (state, dom) => {
|
|
|
5948
5949
|
// TODO recycle nodes
|
|
5949
5950
|
// TODO set right aria attributes on $EditorInput
|
|
5950
5951
|
};
|
|
5951
|
-
const dispose$
|
|
5952
|
+
const dispose$e = state => {
|
|
5952
5953
|
remove$1(state.$Viewlet);
|
|
5953
5954
|
// state.$EditorInput.removeAttribute('aria-activedescendant')
|
|
5954
5955
|
};
|
|
@@ -5980,7 +5981,7 @@ const ViewletEditorCompletion = {
|
|
|
5980
5981
|
__proto__: null,
|
|
5981
5982
|
attachEvents: attachEvents$5,
|
|
5982
5983
|
create: create$n,
|
|
5983
|
-
dispose: dispose$
|
|
5984
|
+
dispose: dispose$e,
|
|
5984
5985
|
handleError: handleError$5,
|
|
5985
5986
|
setBounds: setBounds$8,
|
|
5986
5987
|
setContentHeight,
|
|
@@ -6028,7 +6029,7 @@ const appendWidget$4 = state => {
|
|
|
6028
6029
|
} = state;
|
|
6029
6030
|
append$1($Viewlet);
|
|
6030
6031
|
};
|
|
6031
|
-
const dispose$
|
|
6032
|
+
const dispose$d = state => {
|
|
6032
6033
|
remove$1(state.$Viewlet);
|
|
6033
6034
|
};
|
|
6034
6035
|
const setBounds$7 = (state, x, y, width, height) => {
|
|
@@ -6044,7 +6045,7 @@ const ViewletEditorCompletionDetails = {
|
|
|
6044
6045
|
appendWidget: appendWidget$4,
|
|
6045
6046
|
attachEvents: attachEvents$4,
|
|
6046
6047
|
create: create$m,
|
|
6047
|
-
dispose: dispose$
|
|
6048
|
+
dispose: dispose$d,
|
|
6048
6049
|
setBounds: setBounds$7,
|
|
6049
6050
|
setDom: setDom$7
|
|
6050
6051
|
};
|
|
@@ -6299,7 +6300,7 @@ const create$j = () => {
|
|
|
6299
6300
|
$Viewlet
|
|
6300
6301
|
};
|
|
6301
6302
|
};
|
|
6302
|
-
const dispose$
|
|
6303
|
+
const dispose$c = state => {};
|
|
6303
6304
|
const refresh$3 = (state, context) => {
|
|
6304
6305
|
object(state);
|
|
6305
6306
|
string(context.content);
|
|
@@ -6309,7 +6310,7 @@ const refresh$3 = (state, context) => {
|
|
|
6309
6310
|
const ViewletEditorPlainText = {
|
|
6310
6311
|
__proto__: null,
|
|
6311
6312
|
create: create$j,
|
|
6312
|
-
dispose: dispose$
|
|
6313
|
+
dispose: dispose$c,
|
|
6313
6314
|
refresh: refresh$3
|
|
6314
6315
|
};
|
|
6315
6316
|
|
|
@@ -6337,7 +6338,7 @@ const appendWidget$2 = state => {
|
|
|
6337
6338
|
} = state;
|
|
6338
6339
|
append$1($Viewlet);
|
|
6339
6340
|
};
|
|
6340
|
-
const dispose$
|
|
6341
|
+
const dispose$b = state => {
|
|
6341
6342
|
remove$1(state.$Viewlet);
|
|
6342
6343
|
};
|
|
6343
6344
|
|
|
@@ -6345,7 +6346,7 @@ const ViewletEditorSourceActions = {
|
|
|
6345
6346
|
__proto__: null,
|
|
6346
6347
|
Events: ViewletEditorSourceActionsEvents,
|
|
6347
6348
|
appendWidget: appendWidget$2,
|
|
6348
|
-
dispose: dispose$
|
|
6349
|
+
dispose: dispose$b,
|
|
6349
6350
|
setBounds: setBounds$4
|
|
6350
6351
|
};
|
|
6351
6352
|
|
|
@@ -6406,14 +6407,14 @@ const create$g = () => {
|
|
|
6406
6407
|
};
|
|
6407
6408
|
};
|
|
6408
6409
|
const refresh$2 = (state, context) => {};
|
|
6409
|
-
const focus$
|
|
6410
|
-
const dispose$
|
|
6410
|
+
const focus$b = state => {};
|
|
6411
|
+
const dispose$a = state => {};
|
|
6411
6412
|
|
|
6412
6413
|
const ViewletEmpty = {
|
|
6413
6414
|
__proto__: null,
|
|
6414
6415
|
create: create$g,
|
|
6415
|
-
dispose: dispose$
|
|
6416
|
-
focus: focus$
|
|
6416
|
+
dispose: dispose$a,
|
|
6417
|
+
focus: focus$b,
|
|
6417
6418
|
refresh: refresh$2
|
|
6418
6419
|
};
|
|
6419
6420
|
|
|
@@ -6607,7 +6608,7 @@ const create$d = () => {
|
|
|
6607
6608
|
$Viewlet
|
|
6608
6609
|
};
|
|
6609
6610
|
};
|
|
6610
|
-
const focus$
|
|
6611
|
+
const focus$a = (state, key, source) => {
|
|
6611
6612
|
if (!key) {
|
|
6612
6613
|
return;
|
|
6613
6614
|
}
|
|
@@ -6653,7 +6654,7 @@ const setBounds$2 = (state, x, y, width, height) => {
|
|
|
6653
6654
|
} = state;
|
|
6654
6655
|
setBounds$a($Viewlet, x, y, width, height);
|
|
6655
6656
|
};
|
|
6656
|
-
const dispose$
|
|
6657
|
+
const dispose$9 = state => {
|
|
6657
6658
|
remove$1(state.$Viewlet);
|
|
6658
6659
|
};
|
|
6659
6660
|
const Events$3 = ViewletFindWidgetEvents;
|
|
@@ -6663,8 +6664,8 @@ const ViewletFindWidget = {
|
|
|
6663
6664
|
Events: Events$3,
|
|
6664
6665
|
appendWidget: appendWidget$1,
|
|
6665
6666
|
create: create$d,
|
|
6666
|
-
dispose: dispose$
|
|
6667
|
-
focus: focus$
|
|
6667
|
+
dispose: dispose$9,
|
|
6668
|
+
focus: focus$a,
|
|
6668
6669
|
setBounds: setBounds$2,
|
|
6669
6670
|
setDom: setDom$3,
|
|
6670
6671
|
setValue: setValue$1
|
|
@@ -6711,7 +6712,7 @@ const handleError$3 = (state, message) => {
|
|
|
6711
6712
|
} = state;
|
|
6712
6713
|
$Message.textContent = message;
|
|
6713
6714
|
};
|
|
6714
|
-
const focus$
|
|
6715
|
+
const focus$9 = state => {
|
|
6715
6716
|
const {
|
|
6716
6717
|
$Locations
|
|
6717
6718
|
} = state;
|
|
@@ -6723,7 +6724,7 @@ const focus$8 = state => {
|
|
|
6723
6724
|
const ViewletImplementations = {
|
|
6724
6725
|
__proto__: null,
|
|
6725
6726
|
Events: ViewletLocationsEvents,
|
|
6726
|
-
focus: focus$
|
|
6727
|
+
focus: focus$9,
|
|
6727
6728
|
handleError: handleError$3,
|
|
6728
6729
|
setFocusedIndex: setFocusedIndex$1
|
|
6729
6730
|
};
|
|
@@ -7099,9 +7100,9 @@ const handleError$2 = (state, error) => {
|
|
|
7099
7100
|
string(error);
|
|
7100
7101
|
state.content.textContent = error;
|
|
7101
7102
|
};
|
|
7102
|
-
const focus$
|
|
7103
|
+
const focus$8 = state => {
|
|
7103
7104
|
object(state);
|
|
7104
|
-
focus$
|
|
7105
|
+
focus$e(state.$ViewletOutputContent);
|
|
7105
7106
|
send('Focus.setFocus', FocusOutput);
|
|
7106
7107
|
};
|
|
7107
7108
|
|
|
@@ -7114,15 +7115,15 @@ const disposeFindWidget = state => {
|
|
|
7114
7115
|
return;
|
|
7115
7116
|
}
|
|
7116
7117
|
};
|
|
7117
|
-
const dispose$
|
|
7118
|
+
const dispose$8 = state => {};
|
|
7118
7119
|
|
|
7119
7120
|
const ViewletOutput = {
|
|
7120
7121
|
__proto__: null,
|
|
7121
7122
|
clear: clear$1,
|
|
7122
7123
|
create: create$b,
|
|
7123
|
-
dispose: dispose$
|
|
7124
|
+
dispose: dispose$8,
|
|
7124
7125
|
disposeFindWidget,
|
|
7125
|
-
focus: focus$
|
|
7126
|
+
focus: focus$8,
|
|
7126
7127
|
handleError: handleError$2,
|
|
7127
7128
|
openFindWidget,
|
|
7128
7129
|
setText
|
|
@@ -7235,14 +7236,14 @@ const setTabsDom$1 = (state, dom) => {
|
|
|
7235
7236
|
};
|
|
7236
7237
|
|
|
7237
7238
|
// TODO add test for focus method
|
|
7238
|
-
const focus$
|
|
7239
|
+
const focus$7 = state => {
|
|
7239
7240
|
object(state);
|
|
7240
7241
|
if (!state.currentViewlet) {
|
|
7241
7242
|
return;
|
|
7242
7243
|
}
|
|
7243
7244
|
state.currentViewlet.factory.focus(state.currentViewlet.state);
|
|
7244
7245
|
};
|
|
7245
|
-
const dispose$
|
|
7246
|
+
const dispose$7 = state => {
|
|
7246
7247
|
if (state.$PanelContent) {
|
|
7247
7248
|
state.$PanelContent.remove();
|
|
7248
7249
|
state.$PanelContent = undefined;
|
|
@@ -7288,8 +7289,8 @@ const ViewletPanel = {
|
|
|
7288
7289
|
__proto__: null,
|
|
7289
7290
|
attachEvents: attachEvents$1,
|
|
7290
7291
|
create: create$a,
|
|
7291
|
-
dispose: dispose$
|
|
7292
|
-
focus: focus$
|
|
7292
|
+
dispose: dispose$7,
|
|
7293
|
+
focus: focus$7,
|
|
7293
7294
|
setActionsDom: setActionsDom$1,
|
|
7294
7295
|
setSelectedIndex,
|
|
7295
7296
|
setTabsDom: setTabsDom$1
|
|
@@ -7298,7 +7299,7 @@ const ViewletPanel = {
|
|
|
7298
7299
|
const ViewletReferences = {
|
|
7299
7300
|
__proto__: null,
|
|
7300
7301
|
Events: ViewletLocationsEvents,
|
|
7301
|
-
focus: focus$
|
|
7302
|
+
focus: focus$9,
|
|
7302
7303
|
handleError: handleError$3,
|
|
7303
7304
|
setFocusedIndex: setFocusedIndex$1
|
|
7304
7305
|
};
|
|
@@ -7387,7 +7388,7 @@ const attachEvents = state => {
|
|
|
7387
7388
|
[Click]: handleHeaderClick
|
|
7388
7389
|
});
|
|
7389
7390
|
};
|
|
7390
|
-
const dispose$
|
|
7391
|
+
const dispose$6 = state => {
|
|
7391
7392
|
object(state);
|
|
7392
7393
|
state.$Sidebar.replaceChildren();
|
|
7393
7394
|
};
|
|
@@ -7415,7 +7416,7 @@ const setActionsDom = (state, actions, parentId, eventMap = {}) => {
|
|
|
7415
7416
|
}
|
|
7416
7417
|
state.$Actions = $NewViewlet;
|
|
7417
7418
|
};
|
|
7418
|
-
const focus$
|
|
7419
|
+
const focus$6 = async () => {
|
|
7419
7420
|
// await
|
|
7420
7421
|
};
|
|
7421
7422
|
|
|
@@ -7423,8 +7424,8 @@ const ViewletSidebar = {
|
|
|
7423
7424
|
__proto__: null,
|
|
7424
7425
|
attachEvents,
|
|
7425
7426
|
create: create$8,
|
|
7426
|
-
dispose: dispose$
|
|
7427
|
-
focus: focus$
|
|
7427
|
+
dispose: dispose$6,
|
|
7428
|
+
focus: focus$6,
|
|
7428
7429
|
setActionsDom,
|
|
7429
7430
|
setTitle
|
|
7430
7431
|
};
|
|
@@ -7607,7 +7608,7 @@ const ViewletSourceControlEvents = {
|
|
|
7607
7608
|
handleWheel: handleWheel$2
|
|
7608
7609
|
};
|
|
7609
7610
|
|
|
7610
|
-
const focus$
|
|
7611
|
+
const focus$5 = state => {
|
|
7611
7612
|
const {
|
|
7612
7613
|
$Viewlet
|
|
7613
7614
|
} = state;
|
|
@@ -7617,7 +7618,7 @@ const focus$4 = state => {
|
|
|
7617
7618
|
const ViewletSourceControl = {
|
|
7618
7619
|
__proto__: null,
|
|
7619
7620
|
Events: ViewletSourceControlEvents,
|
|
7620
|
-
focus: focus$
|
|
7621
|
+
focus: focus$5
|
|
7621
7622
|
};
|
|
7622
7623
|
|
|
7623
7624
|
const handleClick$2 = event => {
|
|
@@ -7653,7 +7654,7 @@ const setDom$2 = (state, dom) => {
|
|
|
7653
7654
|
} = state;
|
|
7654
7655
|
renderInto($Viewlet, dom, ViewletStatusBarEvents);
|
|
7655
7656
|
};
|
|
7656
|
-
const focus$
|
|
7657
|
+
const focus$4 = state => {
|
|
7657
7658
|
object(state);
|
|
7658
7659
|
const {
|
|
7659
7660
|
$Viewlet
|
|
@@ -7664,7 +7665,7 @@ const focus$3 = state => {
|
|
|
7664
7665
|
const ViewletStatusBar = {
|
|
7665
7666
|
__proto__: null,
|
|
7666
7667
|
create: create$7,
|
|
7667
|
-
focus: focus$
|
|
7668
|
+
focus: focus$4,
|
|
7668
7669
|
setDom: setDom$2
|
|
7669
7670
|
};
|
|
7670
7671
|
|
|
@@ -7822,8 +7823,8 @@ const ViewletTitleBarMenuBarEvents = {
|
|
|
7822
7823
|
};
|
|
7823
7824
|
|
|
7824
7825
|
const activeId = 'TitleBarEntryActive';
|
|
7825
|
-
const dispose$
|
|
7826
|
-
const focus$
|
|
7826
|
+
const dispose$5 = state => {};
|
|
7827
|
+
const focus$3 = state => {
|
|
7827
7828
|
const {
|
|
7828
7829
|
$TitleBarMenuBar
|
|
7829
7830
|
} = state;
|
|
@@ -8059,8 +8060,8 @@ const ViewletTitleBarMenuBar = {
|
|
|
8059
8060
|
__proto__: null,
|
|
8060
8061
|
Events: ViewletTitleBarMenuBarEvents,
|
|
8061
8062
|
closeMenu,
|
|
8062
|
-
dispose: dispose$
|
|
8063
|
-
focus: focus$
|
|
8063
|
+
dispose: dispose$5,
|
|
8064
|
+
focus: focus$3,
|
|
8064
8065
|
openMenu,
|
|
8065
8066
|
setFocusedIndex,
|
|
8066
8067
|
setMenus
|
|
@@ -8078,8 +8079,8 @@ const ViewletTitleBar = {
|
|
|
8078
8079
|
__proto__: null,
|
|
8079
8080
|
Events: ViewletTitleBarMenuBarEvents,
|
|
8080
8081
|
closeMenu,
|
|
8081
|
-
dispose: dispose$
|
|
8082
|
-
focus: focus$
|
|
8082
|
+
dispose: dispose$5,
|
|
8083
|
+
focus: focus$3,
|
|
8083
8084
|
openMenu,
|
|
8084
8085
|
setFocused,
|
|
8085
8086
|
setFocusedIndex,
|
|
@@ -8389,7 +8390,7 @@ const invoke = (viewletId, method, ...args) => {
|
|
|
8389
8390
|
}
|
|
8390
8391
|
return instance.factory[method](instance.state, ...args);
|
|
8391
8392
|
};
|
|
8392
|
-
const focus$
|
|
8393
|
+
const focus$2 = viewletId => {
|
|
8393
8394
|
if (location.search.includes('traceFocus')) {
|
|
8394
8395
|
// eslint-disable-next-line no-console
|
|
8395
8396
|
console.trace(`focus ${viewletId}`);
|
|
@@ -8650,7 +8651,7 @@ const attachWindowEvents = () => {
|
|
|
8650
8651
|
const sendMultiple = commands => {
|
|
8651
8652
|
executeCommands(commands);
|
|
8652
8653
|
};
|
|
8653
|
-
const dispose$
|
|
8654
|
+
const dispose$4 = id => {
|
|
8654
8655
|
try {
|
|
8655
8656
|
number(id);
|
|
8656
8657
|
const instance = get$a(id);
|
|
@@ -8874,8 +8875,8 @@ const commandHandlers = {
|
|
|
8874
8875
|
'Viewlet.create': create$4,
|
|
8875
8876
|
'Viewlet.createFunctionalRoot': createFunctionalRoot,
|
|
8876
8877
|
'Viewlet.createPlaceholder': createPlaceholder,
|
|
8877
|
-
'Viewlet.dispose': dispose$
|
|
8878
|
-
'Viewlet.focus': focus$
|
|
8878
|
+
'Viewlet.dispose': dispose$4,
|
|
8879
|
+
'Viewlet.focus': focus$2,
|
|
8879
8880
|
'Viewlet.focusElementByName': focusElementByName,
|
|
8880
8881
|
'Viewlet.focusSelector': focusSelector,
|
|
8881
8882
|
'Viewlet.handleError': handleError$1,
|
|
@@ -9079,7 +9080,7 @@ const setPort = (uid, port, origin, portType) => {
|
|
|
9079
9080
|
params: [port, portType]
|
|
9080
9081
|
}, origin, [port]);
|
|
9081
9082
|
};
|
|
9082
|
-
const dispose$
|
|
9083
|
+
const dispose$3 = uid => {
|
|
9083
9084
|
const $Iframe = get$1(uid);
|
|
9084
9085
|
$Iframe.remove();
|
|
9085
9086
|
remove(uid);
|
|
@@ -9090,7 +9091,7 @@ const commandMap = {
|
|
|
9090
9091
|
'ClipBoard.execCopy': execCopy,
|
|
9091
9092
|
'ClipBoard.read': read,
|
|
9092
9093
|
'ClipBoard.readText': readText,
|
|
9093
|
-
'ClipBoard.write': write$
|
|
9094
|
+
'ClipBoard.write': write$2,
|
|
9094
9095
|
'ClipBoard.writeImage': writeImage,
|
|
9095
9096
|
'ClipBoard.writeText': writeText,
|
|
9096
9097
|
'ConfirmPrompt.prompt': confirm$1,
|
|
@@ -9125,7 +9126,7 @@ const commandMap = {
|
|
|
9125
9126
|
'Meta.setThemeColor': setThemeColor,
|
|
9126
9127
|
'Notification.create': create$v,
|
|
9127
9128
|
'Notification.createWithOptions': createWithOptions,
|
|
9128
|
-
'Notification.dispose': dispose$
|
|
9129
|
+
'Notification.dispose': dispose$i,
|
|
9129
9130
|
'OffscreenCanvas.create': create$u,
|
|
9130
9131
|
'OffscreenCanvas.create2': create2,
|
|
9131
9132
|
'Open.openUrl': openUrl,
|
|
@@ -9148,9 +9149,9 @@ const commandMap = {
|
|
|
9148
9149
|
'TestFrameWork.transferToWebView': transferToWebView,
|
|
9149
9150
|
'Viewlet.addKeyBindings': addKeyBindings,
|
|
9150
9151
|
'Viewlet.appendViewlet': appendViewlet,
|
|
9151
|
-
'Viewlet.dispose': dispose$
|
|
9152
|
+
'Viewlet.dispose': dispose$4,
|
|
9152
9153
|
'Viewlet.executeCommands': executeCommands,
|
|
9153
|
-
'Viewlet.focus': focus$
|
|
9154
|
+
'Viewlet.focus': focus$2,
|
|
9154
9155
|
'Viewlet.focusElementByName': focusElementByName,
|
|
9155
9156
|
'Viewlet.focusSelector': focusSelector,
|
|
9156
9157
|
'Viewlet.handleError': handleError$1,
|
|
@@ -9169,7 +9170,7 @@ const commandMap = {
|
|
|
9169
9170
|
'WebStorage.setJsonObjects': setJsonObjects,
|
|
9170
9171
|
'WebView.appendOnly': appendOnly,
|
|
9171
9172
|
'WebView.create': create$3,
|
|
9172
|
-
'WebView.dispose': dispose$
|
|
9173
|
+
'WebView.dispose': dispose$3,
|
|
9173
9174
|
'WebView.load': load,
|
|
9174
9175
|
'WebView.loadOnly': loadOnly,
|
|
9175
9176
|
'WebView.setPort': setPort,
|
|
@@ -9315,7 +9316,7 @@ const appendWidget = state => {
|
|
|
9315
9316
|
} = state;
|
|
9316
9317
|
append$1($Viewlet);
|
|
9317
9318
|
};
|
|
9318
|
-
const dispose$
|
|
9319
|
+
const dispose$2 = state => {
|
|
9319
9320
|
remove$1(state.$Viewlet);
|
|
9320
9321
|
};
|
|
9321
9322
|
|
|
@@ -9323,7 +9324,7 @@ const ViewletEditorRename = {
|
|
|
9323
9324
|
__proto__: null,
|
|
9324
9325
|
Events: ViewletEditorRenameEvents,
|
|
9325
9326
|
appendWidget,
|
|
9326
|
-
dispose: dispose$
|
|
9327
|
+
dispose: dispose$2,
|
|
9327
9328
|
setBounds
|
|
9328
9329
|
};
|
|
9329
9330
|
|
|
@@ -9737,9 +9738,9 @@ const handleBlur = event => {
|
|
|
9737
9738
|
const uid = fromEvent(event);
|
|
9738
9739
|
handleBlur$7(uid);
|
|
9739
9740
|
};
|
|
9740
|
-
const handleMouseDown = (event, ...args) => {
|
|
9741
|
+
const handleMouseDown$1 = (event, ...args) => {
|
|
9741
9742
|
const uid = fromEvent(event);
|
|
9742
|
-
handleMouseDown$
|
|
9743
|
+
handleMouseDown$2(uid, ...args);
|
|
9743
9744
|
};
|
|
9744
9745
|
const handleKeyDown = (event, ...args) => {
|
|
9745
9746
|
const uid = fromEvent(event);
|
|
@@ -9754,7 +9755,7 @@ const create$1 = () => {
|
|
|
9754
9755
|
terminal: undefined
|
|
9755
9756
|
};
|
|
9756
9757
|
};
|
|
9757
|
-
const setTerminal = (state, canvasCursorId, canvasTextId) => {
|
|
9758
|
+
const setTerminal$1 = (state, canvasCursorId, canvasTextId) => {
|
|
9758
9759
|
const canvasText = get$4(canvasTextId);
|
|
9759
9760
|
const canvasCursor = get$4(canvasCursorId);
|
|
9760
9761
|
const {
|
|
@@ -9778,7 +9779,7 @@ const setTerminal = (state, canvasCursorId, canvasTextId) => {
|
|
|
9778
9779
|
}, ...args);
|
|
9779
9780
|
},
|
|
9780
9781
|
handleMouseDown: (...args) => {
|
|
9781
|
-
handleMouseDown({
|
|
9782
|
+
handleMouseDown$1({
|
|
9782
9783
|
target: $Viewlet
|
|
9783
9784
|
}, ...args);
|
|
9784
9785
|
}
|
|
@@ -9794,13 +9795,13 @@ const focusTextArea = state => {
|
|
|
9794
9795
|
const refresh = (state, context) => {
|
|
9795
9796
|
// state.element.textContent = context.text
|
|
9796
9797
|
};
|
|
9797
|
-
const dispose = state => {
|
|
9798
|
+
const dispose$1 = state => {
|
|
9798
9799
|
// TODO unregister callback
|
|
9799
9800
|
// SharedProcess.unregisterChannel(channel )
|
|
9800
9801
|
|
|
9801
9802
|
window.removeEventListener('resize', state.handleUpdate);
|
|
9802
9803
|
};
|
|
9803
|
-
const focus = state => {
|
|
9804
|
+
const focus$1 = state => {
|
|
9804
9805
|
object(state);
|
|
9805
9806
|
const {
|
|
9806
9807
|
terminal
|
|
@@ -9824,28 +9825,28 @@ const reduce = (state, action) => {
|
|
|
9824
9825
|
}
|
|
9825
9826
|
}
|
|
9826
9827
|
};
|
|
9827
|
-
const write = (state, data) => {
|
|
9828
|
+
const write$1 = (state, data) => {
|
|
9828
9829
|
if (!isUint8Array(data)) {
|
|
9829
9830
|
throw new TypeError(`data must be of type Uint8Array`);
|
|
9830
9831
|
}
|
|
9831
9832
|
};
|
|
9832
9833
|
const Commands = {
|
|
9833
|
-
9922: write
|
|
9834
|
+
9922: write$1
|
|
9834
9835
|
};
|
|
9835
9836
|
|
|
9836
9837
|
const ViewletTerminal = {
|
|
9837
9838
|
__proto__: null,
|
|
9838
9839
|
Commands,
|
|
9839
9840
|
create: create$1,
|
|
9840
|
-
dispose,
|
|
9841
|
-
focus,
|
|
9841
|
+
dispose: dispose$1,
|
|
9842
|
+
focus: focus$1,
|
|
9842
9843
|
focusTextArea,
|
|
9843
9844
|
reduce,
|
|
9844
9845
|
reduceFocus,
|
|
9845
9846
|
reduceWrite,
|
|
9846
9847
|
refresh,
|
|
9847
|
-
setTerminal,
|
|
9848
|
-
write
|
|
9848
|
+
setTerminal: setTerminal$1,
|
|
9849
|
+
write: write$1
|
|
9849
9850
|
};
|
|
9850
9851
|
|
|
9851
9852
|
/**
|
|
@@ -9881,19 +9882,85 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
9881
9882
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===xl+1&&(this._liveRegion.textContent+=_i.get())));}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0;}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e);}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows);}_renderRows(e,i){let r=this._terminal.buffer,n=r.lines.length.toString();for(let o=e;o<=i;o++){let l=r.lines.get(r.ydisp+o),a=[],u=l?.translateToString(true,void 0,void 0,a)||"",h=(r.ydisp+o+1).toString(),c=this._rowElements[o];c&&(u.length===0?(c.textContent="\xA0",this._rowColumns.set(c,[0,1])):(c.textContent=u,this._rowColumns.set(c,a)),c.setAttribute("aria-posinset",h),c.setAttribute("aria-setsize",n),this._alignRowWidth(c));}this._announceCharacters();}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="");}_handleBoundaryFocus(e,i){let r=e.target,n=this._rowElements[i===0?1:this._rowElements.length-2],o=r.getAttribute("aria-posinset"),l=i===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let a,u;if(i===0?(a=r,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(a=this._rowElements.shift(),u=r,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h);}else {let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h);}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation();}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let o=({node:u,offset:h})=>{let c=u instanceof Text?u.parentNode:u,d=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(c);if(!_)return console.warn("columns is null. Race condition?"),null;let p=h<_.length?_[h]:_.slice(-1)[0]+1;return p>=this._terminal.cols&&(++d,p=0),{row:d,column:p}},l=o(i),a=o(r);if(!(!l||!a)){if(l.row>a.row||l.row===a.row&&l.column>=a.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(a.row-l.row)*this._terminal.cols-l.column+a.column);}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions();}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e]);}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`;}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,r=this._rowColumns.get(e)?.slice(-1)?.[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/i})`;}};Tt=M([S(1,xt),S(2,ae),S(3,ce)],Tt);var hi=class extends D{constructor(e,i,r,n,o){super();this._element=e;this._mouseService=i;this._renderService=r;this._bufferService=n;this._linkProviderService=o;this._linkCacheDisposables=[];this._isMouseOut=true;this._wasResized=false;this._activeLine=-1;this._onShowLinkUnderline=this._register(new v);this.onShowLinkUnderline=this._onShowLinkUnderline.event;this._onHideLinkUnderline=this._register(new v);this.onHideLinkUnderline=this._onHideLinkUnderline.event;this._register(C(()=>{Ne(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear();})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=true;})),this._register(L(this._element,"mouseleave",()=>{this._isMouseOut=true,this._clearCurrentLink();})),this._register(L(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(L(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(L(this._element,"mouseup",this._handleMouseUp.bind(this)));}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=false;let r=e.composedPath();for(let n=0;n<r.length;n++){let o=r[n];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||i.x!==this._lastBufferCell.x||i.y!==this._lastBufferCell.y)&&(this._handleHover(i),this._lastBufferCell=i);}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,false),this._wasResized=false;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,true));}_askForLink(e,i){(!this._activeProviderReplies||!i)&&(this._activeProviderReplies?.forEach(n=>{n?.forEach(o=>{o.link.dispose&&o.link.dispose();});}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=false;for(let[n,o]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):o.provideLinks(e.y,l=>{if(this._isMouseOut)return;let a=l?.map(u=>({link:u}));this._activeProviderReplies?.set(n,a),r=this._checkLinkProviderResult(n,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies);});}_removeIntersectingLinks(e,i){let r=new Set;for(let n=0;n<i.size;n++){let o=i.get(n);if(o)for(let l=0;l<o.length;l++){let a=o[l],u=a.link.range.start.y<e?0:a.link.range.start.x,h=a.link.range.end.y>e?this._bufferService.cols:a.link.range.end.x;for(let c=u;c<=h;c++){if(r.has(c)){o.splice(l--,1);break}r.add(c);}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),o=false;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(o=true);if(!o&&n){let l=n.find(a=>this._linkAtPosition(a.link,i));l&&(r=true,this._handleNewLink(l));}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let l=0;l<this._activeProviderReplies.size;l++){let a=this._activeProviderReplies.get(l)?.find(u=>this._linkAtPosition(u.link,i));if(a){r=true,this._handleNewLink(a);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink;}_handleMouseUp(e){if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&Ec(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text);}_clearCurrentLink(e,i){!this._currentLink||!this._lastMouseEvent||(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ne(this._linkCacheDisposables),this._linkCacheDisposables.length=0);}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?true:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?true:e.link.decorations.pointerCursor},isHovered:true},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r));}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r));}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(n,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,false);}})));}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=true,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,true),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text);}_fireUnderlineEvent(e,i){let r=e.range,n=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o);}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=false,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,false),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text);}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,o=i.y*this._bufferService.cols+i.x;return r<=o&&o<=n}_positionFromMouseEvent(e,i,r){let n=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(n)return {x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,n,o){return {x1:e,y1:i,x2:r,y2:n,cols:this._bufferService.cols,fg:o}}};hi=M([S(1,Dt),S(2,ce),S(3,F),S(4,lr)],hi);function Ec(s,t){return s.text===t.text&&s.range.start.x===t.range.start.x&&s.range.start.y===t.range.start.y&&s.range.end.x===t.range.end.x&&s.range.end.y===t.range.end.y}var yn=class extends Sn{constructor(e={}){super(e);this._linkifier=this._register(new ye);this.browser=tn;this._keyDownHandled=false;this._keyDownSeen=false;this._keyPressHandled=false;this._unprocessedDeadKey=false;this._accessibilityManager=this._register(new ye);this._onCursorMove=this._register(new v);this.onCursorMove=this._onCursorMove.event;this._onKey=this._register(new v);this.onKey=this._onKey.event;this._onRender=this._register(new v);this.onRender=this._onRender.event;this._onSelectionChange=this._register(new v);this.onSelectionChange=this._onSelectionChange.event;this._onTitleChange=this._register(new v);this.onTitleChange=this._onTitleChange.event;this._onBell=this._register(new v);this.onBell=this._onBell.event;this._onFocus=this._register(new v);this._onBlur=this._register(new v);this._onA11yCharEmitter=this._register(new v);this._onA11yTabEmitter=this._register(new v);this._onWillOpen=this._register(new v);this._setup(),this._decorationService=this._instantiationService.createInstance(Tn),this._instantiationService.setService(Be,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Qr),this._instantiationService.setService(lr,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wt)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register($.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register($.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register($.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register($.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(C(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element);}));}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let r,n="";switch(i.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+i.index;}switch(i.type){case 0:let o=U.toColorRGB(r==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${b.ESC}]${n};${ml(o)}${fs.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[i.index]=j.toColor(...i.color));else {let l=r;this._themeService.modifyColors(a=>a[l]=j.toColor(...i.color));}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0;}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:true});}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Tt,this)):this._accessibilityManager.clear();}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(b.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire();}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(b.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire();}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,o=i.getWidth(r),l=this._renderService.dimensions.css.cell.width*o,a=this.buffer.y*this._renderService.dimensions.css.cell.height,u=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=a+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5";}_initGlobal(){this._bindKeys(),this._register(L(this.element,"copy",i=>{this.hasSelection()&&Vs(i,this._selectionService);}));let e=i=>qs(i,this.textarea,this.coreService,this.optionsService);this._register(L(this.textarea,"paste",e)),this._register(L(this.element,"paste",e)),Ss?this._register(L(this.element,"mousedown",i=>{i.button===2&&Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord);})):this._register(L(this.element,"contextmenu",i=>{Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord);})),Bi&&this._register(L(this.element,"auxclick",i=>{i.button===1&&Mn(i,this.textarea,this.screenElement);}));}_bindKeys(){this._register(L(this.textarea,"keyup",e=>this._keyUp(e),true)),this._register(L(this.textarea,"keydown",e=>this._keyDown(e),true)),this._register(L(this.textarea,"keypress",e=>this._keyPress(e),true)),this._register(L(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(L(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(L(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(L(this.textarea,"input",e=>this._inputEvent(e),true)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()));}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(L(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",mi.get()),Ts||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Jr,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ae,this._coreBrowserService),this._register(L(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(L(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(jt,this._document,this._helperContainer),this._instantiationService.setService(nt,this._charSizeService),this._themeService=this._instantiationService.createInstance(ti),this._instantiationService.setService(Re,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ct),this._instantiationService.setService(or,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Qt,this.rows,this.screenElement)),this._instantiationService.setService(ce,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance($t,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Xt),this._instantiationService.setService(Dt,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(hi,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element);}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea();})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(zt,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,false),this.refresh(0,this.rows-1);})),this._selectionService=this._register(this._instantiationService.createInstance(ei,this.element,this.screenElement,n)),this._instantiationService.setService(Qs,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select();})),this._register($.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync();})),this._register(this._instantiationService.createInstance(Gt,this.screenElement)),this._register(L(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Tt,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bt,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bt,this._viewportElement,this.screenElement)));}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse();}_createRenderer(){return this._instantiationService.createInstance(Yt,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(l){let a=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!a)return false;let u,h;switch(l.overrideType||l.type){case "mousemove":h=32,l.buttons===void 0?(u=3,l.button!==void 0&&(u=l.button<3?l.button:3)):u=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case "mouseup":h=0,u=l.button<3?l.button:3;break;case "mousedown":h=1,u=l.button<3?l.button:3;break;case "wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===false)return false;let c=l.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return false;h=c<0?0:1,u=4;break;default:return false}return h===void 0||u===void 0||u>4?false:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:u,action:h,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,true)),mousedrag:l=>{l.buttons&&r(l);},mousemove:l=>{l.buttons||r(l);}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(i.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(i.addEventListener("wheel",o.wheel,{passive:false}),n.wheel=o.wheel):(i.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null);})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(L(i,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(L(i,"wheel",l=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===false)return false;if(!this.buffer.hasScrollback){if(l.deltaY===0)return false;if(e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(l,true);let h=b.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,true),this.cancel(l,true)}}},{passive:false}));}refresh(e,i){this._renderService?.refreshRows(e,i);}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select");}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=true,this.refresh(this.buffer.y,this.buffer.y));}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1);}scrollPages(e){this.scrollLines(e*(this.rows-1));}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp);}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,true):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i);}paste(e){Cn(e,this.textarea,this.coreService,this.optionsService);}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e;}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e;}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1);}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:false}select(e,i,r){this._selectionService.setSelection(e,i,r);}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return {start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection();}selectAll(){this._selectionService?.selectAll();}selectLines(e,i){this._selectionService?.selectLines(e,i);}_keyDown(e){if(this._keyDownHandled=false,this._keyDownSeen=true,this._customKeyEventHandler&&this._customKeyEventHandler(e)===false)return false;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(true),false;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=true);let r=Il(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,true)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,true),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return true;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=false,true;if((r.key===b.ETX||r.key===b.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,true),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,true);this._keyDownHandled=true;}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=false,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===false)&&(Tc(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=false);}_keyPress(e){let i;if(this._keyPressHandled=false,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===false)return false;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return false;return !i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?false:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,true),this._keyPressHandled=true,this._unprocessedDeadKey=false,true)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return false;this._unprocessedDeadKey=false;let i=e.data;return this.coreService.triggerDataEvent(i,true),this.cancel(e),true}return false}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i);}_afterResize(e,i){this._charSizeService?.measure();}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(X));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1);}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1);}clearTextureAtlas(){this._renderService?.clearTextureAtlas();}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(b.ESC+"[I"):this.coreService.triggerDataEvent(b.ESC+"[O");}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${b.ESC}[4;${r};${i}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${b.ESC}[6;${o};${n}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),false}};function Tc(s){return s.keyCode===16||s.keyCode===17||s.keyCode===18}var xn=class{constructor(){this._addons=[];}dispose(){for(let t=this._addons.length-1;t>=0;t--)this._addons[t].instance.dispose();}loadAddon(t,e){let i={instance:e,dispose:e.dispose,isDisposed:false};this._addons.push(i),e.dispose=()=>this._wrappedAddonDispose(i),e.activate(t);}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===t){e=i;break}if(e===-1)throw new Error("Could not dispose an addon that has not been loaded");t.isDisposed=true,t.dispose.apply(t.instance),this._addons.splice(e,1);}};var wn=class{constructor(t){this._line=t;}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(t,e){if(!(t<0||t>=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new q)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}};var Ji=class{constructor(t,e){this._buffer=t;this.type=e;}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new wn(e)}getNullCell(){return new q}};var Dn=class extends D{constructor(e){super();this._core=e;this._onBufferChange=this._register(new v);this.onBufferChange=this._onBufferChange.event;this._normal=new Ji(this._core.buffers.normal,"normal"),this._alternate=new Ji(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active));}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}};var Rn=class{constructor(t){this._core=t;}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}};var Ln=class{constructor(t){this._core=t;}register(t){this._core.unicodeService.register(t);}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t;}};var Ic=["cols","rows"],Ue=0,Dl=class extends D{constructor(t){super(),this._core=this._register(new yn(t)),this._addonManager=this._register(new xn),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,n)=>{this._checkReadonlyOptions(r),this._core.options[r]=n;};for(let r in this._core.options){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,n);}}_checkReadonlyOptions(t){if(Ic.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Rn(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Ln(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Dn(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case "X10":e="x10";break;case "VT200":e="vt200";break;case "DRAG":e="drag";break;case "ANY":e="any";break}return {applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e];}blur(){this._core.blur();}focus(){this._core.focus();}input(t,e=true){this._core.input(t,e);}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e);}open(t){this._core.open(t);}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t);}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t);}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t);}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i);}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection();}selectAll(){this._core.selectAll();}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e);}dispose(){super.dispose();}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t);}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t);}scrollToTop(){this._core.scrollToTop();}scrollToBottom(){this._core.scrollToBottom();}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t);}clear(){this._core.clear();}write(t,e){this._core.write(t,e);}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
9882
9883
|
`,e);}paste(t){this._core.paste(t);}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e);}reset(){this._core.reset();}clearTextureAtlas(){this._core.clearTextureAtlas();}loadAddon(t){this._addonManager.loadAddon(this,t);}static get strings(){return {get promptLabel(){return mi.get()},set promptLabel(t){mi.set(t);},get tooMuchOutput(){return _i.get()},set tooMuchOutput(t){_i.set(t);}}}_verifyIntegers(...t){for(Ue of t)if(Ue===1/0||isNaN(Ue)||Ue%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(Ue of t)if(Ue&&(Ue===1/0||isNaN(Ue)||Ue%1!==0||Ue<0))throw new Error("This API only accepts positive integers")}};
|
|
9883
9884
|
|
|
9885
|
+
const defaultColumns = 80;
|
|
9886
|
+
const defaultRows = 24;
|
|
9887
|
+
const createTerminal = () => {
|
|
9888
|
+
return new Dl({
|
|
9889
|
+
cols: defaultColumns,
|
|
9890
|
+
convertEol: true,
|
|
9891
|
+
cursorBlink: true,
|
|
9892
|
+
rows: defaultRows
|
|
9893
|
+
});
|
|
9894
|
+
};
|
|
9884
9895
|
const create = () => {
|
|
9885
9896
|
const $Viewlet = document.createElement('div');
|
|
9886
|
-
|
|
9887
|
-
term.open($Viewlet);
|
|
9888
|
-
term.write('Hello from \u{1B}[1;3;31mxterm.js\u{1B}[0m $ ');
|
|
9897
|
+
$Viewlet.className = 'Viewlet Terminal XtermTerminal';
|
|
9889
9898
|
return {
|
|
9890
|
-
$Viewlet
|
|
9899
|
+
$Viewlet,
|
|
9900
|
+
disposables: [],
|
|
9901
|
+
terminal: undefined
|
|
9891
9902
|
};
|
|
9892
9903
|
};
|
|
9904
|
+
const setTerminal = (state, uid) => {
|
|
9905
|
+
if (state.terminal) {
|
|
9906
|
+
return;
|
|
9907
|
+
}
|
|
9908
|
+
const terminal = createTerminal();
|
|
9909
|
+
const inputDisposable = terminal.onData(data => {
|
|
9910
|
+
handleInput$6(uid, data);
|
|
9911
|
+
});
|
|
9912
|
+
const resizeDisposable = terminal.onResize(({
|
|
9913
|
+
cols,
|
|
9914
|
+
rows
|
|
9915
|
+
}) => {
|
|
9916
|
+
resize(uid, {
|
|
9917
|
+
columns: cols,
|
|
9918
|
+
rows
|
|
9919
|
+
});
|
|
9920
|
+
});
|
|
9921
|
+
terminal.open(state.$Viewlet);
|
|
9922
|
+
state.terminal = terminal;
|
|
9923
|
+
state.disposables = [inputDisposable, resizeDisposable];
|
|
9924
|
+
};
|
|
9925
|
+
const write = (state, data) => {
|
|
9926
|
+
const {
|
|
9927
|
+
terminal
|
|
9928
|
+
} = state;
|
|
9929
|
+
if (!terminal) {
|
|
9930
|
+
return;
|
|
9931
|
+
}
|
|
9932
|
+
terminal.write(data);
|
|
9933
|
+
};
|
|
9934
|
+
const focus = state => {
|
|
9935
|
+
object(state);
|
|
9936
|
+
const {
|
|
9937
|
+
terminal
|
|
9938
|
+
} = state;
|
|
9939
|
+
if (!terminal) {
|
|
9940
|
+
return;
|
|
9941
|
+
}
|
|
9942
|
+
terminal.focus();
|
|
9943
|
+
};
|
|
9944
|
+
const handleMouseDown = state => {
|
|
9945
|
+
focus(state);
|
|
9946
|
+
};
|
|
9947
|
+
const dispose = state => {
|
|
9948
|
+
for (const disposable of state.disposables) {
|
|
9949
|
+
disposable.dispose();
|
|
9950
|
+
}
|
|
9951
|
+
state.disposables = [];
|
|
9952
|
+
state.terminal?.dispose();
|
|
9953
|
+
state.terminal = undefined;
|
|
9954
|
+
};
|
|
9893
9955
|
|
|
9894
9956
|
const ViewletTerminal2 = {
|
|
9895
9957
|
__proto__: null,
|
|
9896
|
-
create
|
|
9958
|
+
create,
|
|
9959
|
+
dispose,
|
|
9960
|
+
focus,
|
|
9961
|
+
handleMouseDown,
|
|
9962
|
+
setTerminal,
|
|
9963
|
+
write
|
|
9897
9964
|
};
|
|
9898
9965
|
|
|
9899
9966
|
// based on https://github.com/microsoft/vscode/blob/5f87632829dc3ac80203e2377727935184399431/src/vs/base/browser/ui/aria/aria.ts (License MIT)
|