@lvce-editor/editor-worker 19.3.0 → 19.5.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/editorWorkerMain.js +155 -112
- package/dist/editorWorkerMain.min.js +1 -1
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4151,18 +4151,18 @@ const createEditor = async ({
|
|
|
4151
4151
|
});
|
|
4152
4152
|
};
|
|
4153
4153
|
|
|
4154
|
-
const isEqual$
|
|
4154
|
+
const isEqual$3 = (oldState, newState) => {
|
|
4155
4155
|
return oldState.rowHeight === newState.rowHeight && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
4156
4156
|
};
|
|
4157
4157
|
|
|
4158
|
-
const isEqual$
|
|
4158
|
+
const isEqual$2 = (oldState, newState) => {
|
|
4159
4159
|
if (!newState.focused) {
|
|
4160
4160
|
return true;
|
|
4161
4161
|
}
|
|
4162
4162
|
return oldState.focused === newState.focused && oldState.focus === newState.focus;
|
|
4163
4163
|
};
|
|
4164
4164
|
|
|
4165
|
-
const isEqual = (oldState, newState) => {
|
|
4165
|
+
const isEqual$1 = (oldState, newState) => {
|
|
4166
4166
|
return oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos;
|
|
4167
4167
|
};
|
|
4168
4168
|
|
|
@@ -4170,9 +4170,14 @@ const RenderFocus = 6;
|
|
|
4170
4170
|
const RenderFocusContext = 7;
|
|
4171
4171
|
const RenderCss = 11;
|
|
4172
4172
|
const RenderIncremental = 12;
|
|
4173
|
+
const RenderWidgets = 13;
|
|
4173
4174
|
|
|
4174
|
-
const
|
|
4175
|
-
|
|
4175
|
+
const isEqual = (oldState, newState) => {
|
|
4176
|
+
return oldState.widgets === newState.widgets;
|
|
4177
|
+
};
|
|
4178
|
+
|
|
4179
|
+
const modules = [isEqual$1, isEqual$2, isEqual$2, isEqual$3, isEqual];
|
|
4180
|
+
const numbers = [RenderIncremental, RenderFocus, RenderFocusContext, RenderCss, RenderWidgets];
|
|
4176
4181
|
|
|
4177
4182
|
const diff = (oldState, newState) => {
|
|
4178
4183
|
const diffResult = [];
|
|
@@ -7191,7 +7196,7 @@ const dispose = async () => {
|
|
|
7191
7196
|
// await rpc.dispose()
|
|
7192
7197
|
};
|
|
7193
7198
|
|
|
7194
|
-
const getEditor = editorUid => {
|
|
7199
|
+
const getEditor$1 = editorUid => {
|
|
7195
7200
|
const instance = get$7(editorUid);
|
|
7196
7201
|
if (!instance) {
|
|
7197
7202
|
throw new Error(`editor ${editorUid} not found`);
|
|
@@ -7206,7 +7211,7 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
7206
7211
|
const {
|
|
7207
7212
|
uid
|
|
7208
7213
|
} = state;
|
|
7209
|
-
const editor = getEditor(parentUid);
|
|
7214
|
+
const editor = getEditor$1(parentUid);
|
|
7210
7215
|
const {
|
|
7211
7216
|
height,
|
|
7212
7217
|
width,
|
|
@@ -8110,7 +8115,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
8110
8115
|
const tokenizer = getTokenizer(languageId);
|
|
8111
8116
|
const newTokenizerId = tokenizerId + 1;
|
|
8112
8117
|
set$3(newTokenizerId, tokenizer);
|
|
8113
|
-
const latest = getEditor(editor.uid);
|
|
8118
|
+
const latest = getEditor$1(editor.uid);
|
|
8114
8119
|
if (!latest) {
|
|
8115
8120
|
return editor;
|
|
8116
8121
|
}
|
|
@@ -8119,7 +8124,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
8119
8124
|
differences,
|
|
8120
8125
|
textInfos
|
|
8121
8126
|
} = await getVisible$1(editor, syncIncremental);
|
|
8122
|
-
const latest2 = getEditor(editor.uid);
|
|
8127
|
+
const latest2 = getEditor$1(editor.uid);
|
|
8123
8128
|
if (!latest2) {
|
|
8124
8129
|
return editor;
|
|
8125
8130
|
}
|
|
@@ -9214,6 +9219,8 @@ const getWidgetInvoke = widgetId => {
|
|
|
9214
9219
|
}
|
|
9215
9220
|
};
|
|
9216
9221
|
|
|
9222
|
+
const Close = 'Close';
|
|
9223
|
+
|
|
9217
9224
|
const updateWidget = (editor, widgetId, newState) => {
|
|
9218
9225
|
// TODO avoid closure
|
|
9219
9226
|
const isWidget = widget => {
|
|
@@ -9237,11 +9244,40 @@ const updateWidget = (editor, widgetId, newState) => {
|
|
|
9237
9244
|
};
|
|
9238
9245
|
};
|
|
9239
9246
|
|
|
9247
|
+
const getEditorByWidgetUid = (widgetUid, widgetId) => {
|
|
9248
|
+
for (const key of getKeys$2()) {
|
|
9249
|
+
const editor = get$7(Number(key)).newState;
|
|
9250
|
+
const widgets = editor.widgets || [];
|
|
9251
|
+
for (const widget of widgets) {
|
|
9252
|
+
if (widget.id === widgetId && widget.newState.uid === widgetUid) {
|
|
9253
|
+
return editor;
|
|
9254
|
+
}
|
|
9255
|
+
}
|
|
9256
|
+
}
|
|
9257
|
+
return undefined;
|
|
9258
|
+
};
|
|
9259
|
+
const getEditor = (editorOrUid, widgetId) => {
|
|
9260
|
+
if (editorOrUid && editorOrUid.widgets) {
|
|
9261
|
+
return editorOrUid;
|
|
9262
|
+
}
|
|
9263
|
+
const instance = get$7(editorOrUid);
|
|
9264
|
+
if (instance && instance.newState && instance.newState.widgets) {
|
|
9265
|
+
return instance.newState;
|
|
9266
|
+
}
|
|
9267
|
+
return getEditorByWidgetUid(editorOrUid, widgetId);
|
|
9268
|
+
};
|
|
9240
9269
|
const createFn = (key, name, widgetId) => {
|
|
9241
9270
|
const isWidget = widget => {
|
|
9242
9271
|
return widget.id === widgetId;
|
|
9243
9272
|
};
|
|
9244
|
-
const
|
|
9273
|
+
const isClose = args => {
|
|
9274
|
+
return key === 'close' || key === 'handleClickButton' && args.includes(Close);
|
|
9275
|
+
};
|
|
9276
|
+
const fn = async (editorOrUid, ...args) => {
|
|
9277
|
+
const editor = getEditor(editorOrUid, widgetId);
|
|
9278
|
+
if (!editor) {
|
|
9279
|
+
return editorOrUid;
|
|
9280
|
+
}
|
|
9245
9281
|
const childIndex = editor.widgets.findIndex(isWidget);
|
|
9246
9282
|
if (childIndex === -1) {
|
|
9247
9283
|
return editor;
|
|
@@ -9256,12 +9292,22 @@ const createFn = (key, name, widgetId) => {
|
|
|
9256
9292
|
await invoke(`${name}.${key}`, uid, ...args);
|
|
9257
9293
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
9258
9294
|
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
9295
|
+
const latest = get$7(editor.uid).newState;
|
|
9296
|
+
if (isClose(args)) {
|
|
9297
|
+
const newEditor = {
|
|
9298
|
+
...latest,
|
|
9299
|
+
focused: true,
|
|
9300
|
+
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
9301
|
+
};
|
|
9302
|
+
set$8(editor.uid, latest, newEditor);
|
|
9303
|
+
return newEditor;
|
|
9304
|
+
}
|
|
9259
9305
|
const newState = {
|
|
9260
9306
|
...state,
|
|
9261
9307
|
commands
|
|
9262
9308
|
};
|
|
9263
|
-
const latest = get$7(editor.uid).newState;
|
|
9264
9309
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
9310
|
+
set$8(editor.uid, latest, newEditor);
|
|
9265
9311
|
return newEditor;
|
|
9266
9312
|
};
|
|
9267
9313
|
return fn;
|
|
@@ -9953,7 +9999,7 @@ const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...par
|
|
|
9953
9999
|
const isWidget = widget => {
|
|
9954
10000
|
return widget.id === widgetId;
|
|
9955
10001
|
};
|
|
9956
|
-
const latestEditor = getEditor(editor.uid);
|
|
10002
|
+
const latestEditor = getEditor$1(editor.uid);
|
|
9957
10003
|
const childIndex1 = latestEditor.widgets.findIndex(isWidget);
|
|
9958
10004
|
if (childIndex1 === -1) {
|
|
9959
10005
|
return latestEditor;
|
|
@@ -10039,54 +10085,54 @@ const FocusFindWidgetPreviousMatchButton = 50;
|
|
|
10039
10085
|
const FocusEditorCodeGenerator = 52;
|
|
10040
10086
|
|
|
10041
10087
|
const getPositionAtCursor = editorUid => {
|
|
10042
|
-
const editor = getEditor(editorUid);
|
|
10088
|
+
const editor = getEditor$1(editorUid);
|
|
10043
10089
|
return getPositionAtCursor$1(editor);
|
|
10044
10090
|
};
|
|
10045
10091
|
const getUri = editorUid => {
|
|
10046
|
-
const editor = getEditor(editorUid);
|
|
10092
|
+
const editor = getEditor$1(editorUid);
|
|
10047
10093
|
return editor.uri;
|
|
10048
10094
|
};
|
|
10049
10095
|
const getLanguageId = editorUid => {
|
|
10050
|
-
const editor = getEditor(editorUid);
|
|
10096
|
+
const editor = getEditor$1(editorUid);
|
|
10051
10097
|
return editor.languageId;
|
|
10052
10098
|
};
|
|
10053
10099
|
const getOffsetAtCursor = editorUid => {
|
|
10054
|
-
const editor = getEditor(editorUid);
|
|
10100
|
+
const editor = getEditor$1(editorUid);
|
|
10055
10101
|
return getOffsetAtCursor$1(editor);
|
|
10056
10102
|
};
|
|
10057
10103
|
const getWordAt = (editorUid, rowIndex, columnIndex) => {
|
|
10058
|
-
const editor = getEditor(editorUid);
|
|
10104
|
+
const editor = getEditor$1(editorUid);
|
|
10059
10105
|
const {
|
|
10060
10106
|
word
|
|
10061
10107
|
} = getWordAt$1(editor, rowIndex, columnIndex);
|
|
10062
10108
|
return word;
|
|
10063
10109
|
};
|
|
10064
10110
|
const getWordAtOffset2 = editorUid => {
|
|
10065
|
-
const editor = getEditor(editorUid);
|
|
10111
|
+
const editor = getEditor$1(editorUid);
|
|
10066
10112
|
const word = getWordAtOffset(editor);
|
|
10067
10113
|
return word;
|
|
10068
10114
|
};
|
|
10069
10115
|
const getWordBefore2 = (editorUid, rowIndex, columnIndex) => {
|
|
10070
|
-
const editor = getEditor(editorUid);
|
|
10116
|
+
const editor = getEditor$1(editorUid);
|
|
10071
10117
|
const word = getWordBefore(editor, rowIndex, columnIndex);
|
|
10072
10118
|
return word;
|
|
10073
10119
|
};
|
|
10074
10120
|
const getLines2 = editorUid => {
|
|
10075
|
-
const editor = getEditor(editorUid);
|
|
10121
|
+
const editor = getEditor$1(editorUid);
|
|
10076
10122
|
const {
|
|
10077
10123
|
lines
|
|
10078
10124
|
} = editor;
|
|
10079
10125
|
return lines;
|
|
10080
10126
|
};
|
|
10081
10127
|
const getSelections2 = editorUid => {
|
|
10082
|
-
const editor = getEditor(editorUid);
|
|
10128
|
+
const editor = getEditor$1(editorUid);
|
|
10083
10129
|
const {
|
|
10084
10130
|
selections
|
|
10085
10131
|
} = editor;
|
|
10086
10132
|
return selections;
|
|
10087
10133
|
};
|
|
10088
10134
|
const setSelections2 = async (editorUid, selections) => {
|
|
10089
|
-
const editor = getEditor(editorUid);
|
|
10135
|
+
const editor = getEditor$1(editorUid);
|
|
10090
10136
|
const newEditor = {
|
|
10091
10137
|
...editor,
|
|
10092
10138
|
selections
|
|
@@ -10095,7 +10141,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
10095
10141
|
set$8(editorUid, editor, newEditorWithDerivedState);
|
|
10096
10142
|
};
|
|
10097
10143
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
10098
|
-
const editor = getEditor(editorUid);
|
|
10144
|
+
const editor = getEditor$1(editorUid);
|
|
10099
10145
|
const invoke = getWidgetInvoke(widgetId);
|
|
10100
10146
|
const {
|
|
10101
10147
|
widgets
|
|
@@ -10122,7 +10168,7 @@ const closeFind2 = async editorUid => {
|
|
|
10122
10168
|
await closeWidget2(editorUid, Find, 'FindWidget', 0);
|
|
10123
10169
|
};
|
|
10124
10170
|
const applyEdits2 = async (editorUid, edits) => {
|
|
10125
|
-
const editor = getEditor(editorUid);
|
|
10171
|
+
const editor = getEditor$1(editorUid);
|
|
10126
10172
|
const newEditor = await applyEdit(editor, edits);
|
|
10127
10173
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10128
10174
|
set$8(editorUid, editor, newEditorWithDerivedState);
|
|
@@ -10132,7 +10178,7 @@ const getSourceActions = async editorUid => {
|
|
|
10132
10178
|
return actions;
|
|
10133
10179
|
};
|
|
10134
10180
|
const getDiagnostics$1 = async editorUid => {
|
|
10135
|
-
const editor = getEditor(editorUid);
|
|
10181
|
+
const editor = getEditor$1(editorUid);
|
|
10136
10182
|
const {
|
|
10137
10183
|
diagnostics
|
|
10138
10184
|
} = editor;
|
|
@@ -10670,7 +10716,7 @@ const getQuickPickMenuEntries = () => {
|
|
|
10670
10716
|
};
|
|
10671
10717
|
|
|
10672
10718
|
const getSelections = editorUid => {
|
|
10673
|
-
const editor = getEditor(editorUid);
|
|
10719
|
+
const editor = getEditor$1(editorUid);
|
|
10674
10720
|
const {
|
|
10675
10721
|
selections
|
|
10676
10722
|
} = editor;
|
|
@@ -10679,7 +10725,7 @@ const getSelections = editorUid => {
|
|
|
10679
10725
|
|
|
10680
10726
|
const getText = editorUid => {
|
|
10681
10727
|
number(editorUid);
|
|
10682
|
-
const editor = getEditor(editorUid);
|
|
10728
|
+
const editor = getEditor$1(editorUid);
|
|
10683
10729
|
const {
|
|
10684
10730
|
lines
|
|
10685
10731
|
} = editor;
|
|
@@ -11723,19 +11769,9 @@ const getDom = state => {
|
|
|
11723
11769
|
}
|
|
11724
11770
|
return getEditorVirtualDom(state);
|
|
11725
11771
|
};
|
|
11726
|
-
const isFastScroll = (oldState, newState) => {
|
|
11727
|
-
return Math.abs(newState.minLineY - oldState.minLineY) > 1;
|
|
11728
|
-
};
|
|
11729
11772
|
const renderIncremental = (oldState, newState) => {
|
|
11730
11773
|
const oldDom = oldState.initial ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
11731
11774
|
const newDom = getDom(newState);
|
|
11732
|
-
if (isFastScroll(oldState, newState)) {
|
|
11733
|
-
set(newState.uid, newDom);
|
|
11734
|
-
return [SetPatches, newState.uid, [{
|
|
11735
|
-
nodes: newDom,
|
|
11736
|
-
type: 6
|
|
11737
|
-
}]];
|
|
11738
|
-
}
|
|
11739
11775
|
const patches = diffTree(oldDom, newDom);
|
|
11740
11776
|
if (patches.length === 0) {
|
|
11741
11777
|
return [];
|
|
@@ -11744,6 +11780,79 @@ const renderIncremental = (oldState, newState) => {
|
|
|
11744
11780
|
return [SetPatches, newState.uid, patches];
|
|
11745
11781
|
};
|
|
11746
11782
|
|
|
11783
|
+
const addWidget = widget => {
|
|
11784
|
+
const module = get$6(widget.id);
|
|
11785
|
+
if (!module) {
|
|
11786
|
+
throw new Error('unsupported widget');
|
|
11787
|
+
}
|
|
11788
|
+
return module.add(widget);
|
|
11789
|
+
};
|
|
11790
|
+
const renderWidget = widget => {
|
|
11791
|
+
const module = get$6(widget.id);
|
|
11792
|
+
if (!module) {
|
|
11793
|
+
throw new Error('unsupported widget');
|
|
11794
|
+
}
|
|
11795
|
+
return module.render(widget);
|
|
11796
|
+
};
|
|
11797
|
+
const removeWidget = widget => {
|
|
11798
|
+
const module = get$6(widget.id);
|
|
11799
|
+
if (!module) {
|
|
11800
|
+
throw new Error('unsupported widget');
|
|
11801
|
+
}
|
|
11802
|
+
return module.remove(widget);
|
|
11803
|
+
};
|
|
11804
|
+
|
|
11805
|
+
const renderWidgets$1 = (oldState, newState) => {
|
|
11806
|
+
const addedWidgets = [];
|
|
11807
|
+
const changedWidgets = [];
|
|
11808
|
+
const removedWidgets = [];
|
|
11809
|
+
const oldWidgets = oldState.widgets || [];
|
|
11810
|
+
const newWidgets = newState.widgets || [];
|
|
11811
|
+
const oldWidgetMap = Object.create(null);
|
|
11812
|
+
const newWidgetMap = Object.create(null);
|
|
11813
|
+
for (const oldWidget of oldWidgets) {
|
|
11814
|
+
oldWidgetMap[oldWidget.id] = oldWidget;
|
|
11815
|
+
}
|
|
11816
|
+
for (const newWidget of newWidgets) {
|
|
11817
|
+
newWidgetMap[newWidget.id] = newWidget;
|
|
11818
|
+
}
|
|
11819
|
+
for (const oldWidget of oldWidgets) {
|
|
11820
|
+
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
11821
|
+
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
11822
|
+
} else {
|
|
11823
|
+
removedWidgets.push(oldWidget);
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
for (const newWidget of newWidgets) {
|
|
11827
|
+
if (Object.hasOwn(oldWidgetMap, newWidget.id)) ; else {
|
|
11828
|
+
addedWidgets.push(newWidget);
|
|
11829
|
+
}
|
|
11830
|
+
}
|
|
11831
|
+
const addCommands = [];
|
|
11832
|
+
for (const addedWidget of addedWidgets) {
|
|
11833
|
+
const childCommands = addWidget(addedWidget);
|
|
11834
|
+
if (childCommands.length > 0) {
|
|
11835
|
+
addCommands.push(...childCommands);
|
|
11836
|
+
}
|
|
11837
|
+
}
|
|
11838
|
+
const changeCommands = [];
|
|
11839
|
+
for (const changedWidget of changedWidgets) {
|
|
11840
|
+
const childCommands = renderWidget(changedWidget);
|
|
11841
|
+
if (childCommands.length > 0) {
|
|
11842
|
+
changeCommands.push(...childCommands);
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11845
|
+
const removeCommands = [];
|
|
11846
|
+
for (const removedWidget of removedWidgets) {
|
|
11847
|
+
const childCommands = removeWidget(removedWidget);
|
|
11848
|
+
if (childCommands.length > 0) {
|
|
11849
|
+
removeCommands.push(...childCommands);
|
|
11850
|
+
}
|
|
11851
|
+
}
|
|
11852
|
+
const allCommands = [...addCommands, ...changeCommands, ...removeCommands];
|
|
11853
|
+
return allCommands.filter(item => item[0] !== 'Viewlet.setFocusContext');
|
|
11854
|
+
};
|
|
11855
|
+
|
|
11747
11856
|
const getRenderer = diffType => {
|
|
11748
11857
|
switch (diffType) {
|
|
11749
11858
|
case RenderCss:
|
|
@@ -11754,6 +11863,8 @@ const getRenderer = diffType => {
|
|
|
11754
11863
|
return renderFocusContext$1;
|
|
11755
11864
|
case RenderIncremental:
|
|
11756
11865
|
return renderIncremental;
|
|
11866
|
+
case RenderWidgets:
|
|
11867
|
+
return renderWidgets$1;
|
|
11757
11868
|
default:
|
|
11758
11869
|
throw new Error('unknown renderer');
|
|
11759
11870
|
}
|
|
@@ -11765,7 +11876,11 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
11765
11876
|
const fn = getRenderer(item);
|
|
11766
11877
|
const result = fn(oldState, newState);
|
|
11767
11878
|
if (result.length > 0) {
|
|
11768
|
-
|
|
11879
|
+
if (item === RenderWidgets) {
|
|
11880
|
+
commands.push(...result);
|
|
11881
|
+
} else {
|
|
11882
|
+
commands.push(result);
|
|
11883
|
+
}
|
|
11769
11884
|
}
|
|
11770
11885
|
}
|
|
11771
11886
|
return commands;
|
|
@@ -11781,28 +11896,6 @@ const render2 = (uid, diffResult) => {
|
|
|
11781
11896
|
return commands;
|
|
11782
11897
|
};
|
|
11783
11898
|
|
|
11784
|
-
const addWidget = widget => {
|
|
11785
|
-
const module = get$6(widget.id);
|
|
11786
|
-
if (!module) {
|
|
11787
|
-
throw new Error('unsupported widget');
|
|
11788
|
-
}
|
|
11789
|
-
return module.add(widget);
|
|
11790
|
-
};
|
|
11791
|
-
const renderWidget = widget => {
|
|
11792
|
-
const module = get$6(widget.id);
|
|
11793
|
-
if (!module) {
|
|
11794
|
-
throw new Error('unsupported widget');
|
|
11795
|
-
}
|
|
11796
|
-
return module.render(widget);
|
|
11797
|
-
};
|
|
11798
|
-
const removeWidget = widget => {
|
|
11799
|
-
const module = get$6(widget.id);
|
|
11800
|
-
if (!module) {
|
|
11801
|
-
throw new Error('unsupported widget');
|
|
11802
|
-
}
|
|
11803
|
-
return module.remove(widget);
|
|
11804
|
-
};
|
|
11805
|
-
|
|
11806
11899
|
const renderLines = {
|
|
11807
11900
|
apply(oldState, newState) {
|
|
11808
11901
|
const {
|
|
@@ -11840,7 +11933,7 @@ const renderSelections = {
|
|
|
11840
11933
|
};
|
|
11841
11934
|
const renderCss = {
|
|
11842
11935
|
apply: renderCss$1,
|
|
11843
|
-
isEqual: isEqual$
|
|
11936
|
+
isEqual: isEqual$3
|
|
11844
11937
|
};
|
|
11845
11938
|
const renderFocus$1 = {
|
|
11846
11939
|
apply: (oldState, newState) => [/* method */'setFocused', newState.focused],
|
|
@@ -11886,57 +11979,7 @@ const renderGutterInfo = {
|
|
|
11886
11979
|
isEqual: (oldState, newState) => oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
11887
11980
|
};
|
|
11888
11981
|
const renderWidgets = {
|
|
11889
|
-
apply
|
|
11890
|
-
const addedWidgets = [];
|
|
11891
|
-
const changedWidgets = [];
|
|
11892
|
-
const removedWidgets = [];
|
|
11893
|
-
const oldWidgets = oldState.widgets || [];
|
|
11894
|
-
const newWidgets = newState.widgets || [];
|
|
11895
|
-
const oldWidgetMap = Object.create(null);
|
|
11896
|
-
const newWidgetMap = Object.create(null);
|
|
11897
|
-
for (const oldWidget of oldWidgets) {
|
|
11898
|
-
oldWidgetMap[oldWidget.id] = oldWidget;
|
|
11899
|
-
}
|
|
11900
|
-
for (const newWidget of newWidgets) {
|
|
11901
|
-
newWidgetMap[newWidget.id] = newWidget;
|
|
11902
|
-
}
|
|
11903
|
-
for (const oldWidget of oldWidgets) {
|
|
11904
|
-
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
11905
|
-
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
11906
|
-
} else {
|
|
11907
|
-
removedWidgets.push(oldWidget);
|
|
11908
|
-
}
|
|
11909
|
-
}
|
|
11910
|
-
for (const newWidget of newWidgets) {
|
|
11911
|
-
if (Object.hasOwn(oldWidgetMap, newWidget.id)) ; else {
|
|
11912
|
-
addedWidgets.push(newWidget);
|
|
11913
|
-
}
|
|
11914
|
-
}
|
|
11915
|
-
const addCommands = [];
|
|
11916
|
-
for (const addedWidget of addedWidgets) {
|
|
11917
|
-
const childCommands = addWidget(addedWidget);
|
|
11918
|
-
if (childCommands.length > 0) {
|
|
11919
|
-
addCommands.push(...childCommands);
|
|
11920
|
-
}
|
|
11921
|
-
}
|
|
11922
|
-
const changeCommands = [];
|
|
11923
|
-
for (const changedWidget of changedWidgets) {
|
|
11924
|
-
const childCommands = renderWidget(changedWidget);
|
|
11925
|
-
if (childCommands.length > 0) {
|
|
11926
|
-
changeCommands.push(...childCommands);
|
|
11927
|
-
}
|
|
11928
|
-
}
|
|
11929
|
-
const removeCommands = [];
|
|
11930
|
-
for (const removedWidget of removedWidgets) {
|
|
11931
|
-
const childCommands = removeWidget(removedWidget);
|
|
11932
|
-
if (childCommands.length > 0) {
|
|
11933
|
-
removeCommands.push(...childCommands);
|
|
11934
|
-
}
|
|
11935
|
-
}
|
|
11936
|
-
const allCommands = [...addCommands, ...changeCommands, ...removeCommands];
|
|
11937
|
-
const filteredCommands = allCommands.filter(item => item[0] !== 'Viewlet.setFocusContext');
|
|
11938
|
-
return filteredCommands;
|
|
11939
|
-
},
|
|
11982
|
+
apply: renderWidgets$1,
|
|
11940
11983
|
isEqual: (oldState, newState) => oldState.widgets === newState.widgets,
|
|
11941
11984
|
multiple: true
|
|
11942
11985
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=t=>{const n=t.indexOf(".");return t.slice(n+1)};const n=()=>{const n=Object.create(null);const e={};return{clear(){for(const t of Object.keys(n)){delete n[t]}},diff(t,e,o){const{oldState:s,scheduledState:c}=n[t];const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n(s,c)){r.push(o[t])}}return r},dispose(t){delete n[t]},get(t){return n[t]},getCommandIds(){const n=Object.keys(e);const o=n.map(t);return o},getKeys(){return Object.keys(n).map(Number)},registerCommands(t){Object.assign(e,t)},set(t,e,o,s){n[t]={newState:o,oldState:e,scheduledState:s??o}},wrapCommand(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);if(c===r||s===r){return}const i=n[e];const a={...i.newState,...r};n[e]={newState:a,oldState:i.oldState,scheduledState:a}};return e},wrapGetter(t){const e=(e,...o)=>{const{newState:s}=n[e];return t(s,...o)};return e},wrapLoadContent(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);const{error:i,state:a}=r;if(c===a||s===a){return{error:i}}const d=n[e];const l={...d.newState,...a};n[e]={newState:l,oldState:d.oldState,scheduledState:l};return{error:i}};return e}}};const e=()=>{globalThis.close()};class o extends Error{constructor(t){super(t);this.name="AssertionError"}}const s=1;const c=2;const r=3;const i=4;const a=5;const d=6;const l=7;const u=8;const f=t=>{switch(typeof t){case"number":return c;case"function":return d;case"string":return i;case"object":if(t===null){return l}if(Array.isArray(t)){return r}return s;case"boolean":return a;default:return u}};const h=t=>{const n=f(t);if(n!==s){throw new o("expected value to be of type object")}};const g=t=>{const n=f(t);if(n!==c){throw new o("expected value to be of type number")}};const m=t=>{const n=f(t);if(n!==r){throw new o("expected value to be of type array")}};const w=t=>{const n=f(t);if(n!==i){throw new o("expected value to be of type string")}};const p=t=>{const n=f(t);if(n!==a){throw new o("expected value to be of type boolean")}};const y=t=>{if(t.startsWith("Error: ")){return t.slice("Error: ".length)}if(t.startsWith("VError: ")){return t.slice("VError: ".length)}return t};const x=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const E="\n";const I=(t,n=undefined)=>t.indexOf(E,n);const k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=x(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const v=t=>t&&t instanceof MessagePort;const C=t=>t&&t.constructor&&t.constructor.name==="MessagePortMain";const b=t=>typeof OffscreenCanvas!=="undefined"&&t instanceof OffscreenCanvas;const M=(t,n)=>t?.constructor?.name===n;const L=t=>M(t,"Socket");const A=[v,C,b,L];const P=t=>{for(const n of A){if(n(t)){return true}}return false};const F=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){F(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){F(o,n,e)}return}};const W=t=>{const n=[];F(t,n,P);return n};const T=t=>{const n=(...n)=>{const e=t.getData(...n);t.dispatchEvent(new MessageEvent("message",{data:e}))};t.onMessage(n);const e=n=>{t.dispatchEvent(new Event("close"))};t.onClose(e)};class R extends EventTarget{constructor(t){super();this._rawIpc=t;T(this)}}const D="E_INCOMPATIBLE_NATIVE_MODULE";const O="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const B="ERR_MODULE_NOT_FOUND";const N="\n";const H=t=>t.join(N);const z=/^\s+at/;const U=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!U.test(t);const Y=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!$(t[e])){break}}return{actualMessage:t[n-1],rest:t.slice(n,e)}};const _=t=>t.split(N);const V=/^Error: The module '.*'$/;const j=/^\s* at/;const q=t=>V.test(t);const G=t=>j.test(t);const X=t=>{const n=_(t);const e=n.findIndex(q);const o=e+n.slice(e).findIndex(G,e);const s=n.slice(e,o);const c=s.join(" ").slice("Error: ".length);return c};const Z=t=>t.includes("[ERR_MODULE_NOT_FOUND]");const Q=t=>{const n=_(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const K=t=>{if(!t){return false}return t.includes("ERR_MODULE_NOT_FOUND")};const J=t=>{if(!t){return false}return t.includes("SyntaxError: Cannot use import statement outside a module")};const tt=/^innerError Error: Cannot find module '.*.node'/;const nt=/was compiled against a different Node.js version/;const et=t=>tt.test(t)&&nt.test(t);const ot=t=>{const n=X(t);return{code:D,message:`Incompatible native node module: ${n}`}};const st=()=>({code:O,message:`ES Modules are not supported in electron`});const ct=(t,n)=>{if(et(n)){return ot(n)}if(J(n)){return st()}if(K(n)){return Q(n)}const e=_(n);const{actualMessage:o,rest:s}=Y(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const xt=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const Et=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){xt(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!v(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=Et(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class vt extends R{getData=at;send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){this._rawIpc.close()}onMessage(t){this._rawIpc.addEventListener("message",t)}onClose(t){}}const Ct=t=>new vt(t);const bt={__proto__:null,create:kt,signal:St,wrap:Ct};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const Lt=Object.create(null);const At=t=>{Object.assign(Lt,t)};const Pt=t=>Lt[t];const Ft=(t,...n)=>{const e=Pt(t);if(!e){throw new Mt(t)}return e(...n)};const Wt="2.0";const Tt=Object.create(null);const Rt=t=>Tt[t];const Dt=t=>{delete Tt[t]};class Ot extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Bt="\n";const Nt="DOMException";const Ht="ReferenceError";const zt="SyntaxError";const Ut="TypeError";const $t=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case Ut:return TypeError;default:return Error}}if(t.startsWith("TypeError: ")){return TypeError}if(t.startsWith("SyntaxError: ")){return SyntaxError}if(t.startsWith("ReferenceError: ")){return ReferenceError}return Error};const Yt=(t,n,e)=>{const o=$t(t,n);if(o===DOMException&&e){return new o(t,e)}if(o===Error){const n=new Error(t);if(e&&e!=="VError"){n.name=e}return n}return new o(t)};const _t=t=>t.join(Bt);const Vt=t=>t.split(Bt);const jt=()=>{const t=3;const n=_t(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Bt,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Bt+n}return n};const Xt=-32601;const Zt=-32001;const Qt=t=>{const n=jt();if(t&&t instanceof Error){if(typeof t.stack==="string"){t.stack=t.stack+Bt+n}return t}if(t&&t.code&&t.code===Xt){const e=new Ot(t.message);const o=Gt(t);e.stack=o+Bt+n;return e}if(t&&t.message){const e=Yt(t.message,t.type,t.name);if(t.data){if(t.data.stack&&t.data.type&&t.message){e.stack=t.data.type+": "+t.message+Bt+t.data.stack+Bt+n}else if(t.data.stack){e.stack=t.data.stack}if(t.data.codeFrame){e.codeFrame=t.data.codeFrame}if(t.data.code){e.code=t.data.code}if(t.data.type){e.name=t.data.type}}else{if(t.stack){const n=e.stack||"";const o=qt(n);const s=Gt(t);e.stack=s+n.slice(o)}if(t.codeFrame){e.codeFrame=t.codeFrame}}return e}if(typeof t==="string"){return new Error(`JsonRpc Error: ${t}`)}return new Error(`JsonRpc Error: ${t}`)};const Kt=t=>{if("error"in t){const n=Qt(t.error);throw n}if("result"in t){return t.result}throw new Ot("unexpected response message")};const Jt=(...t)=>{console.warn(...t)};const tn=(t,n)=>{const e=Rt(t);if(!e){console.log(n);Jt(`callback ${t} may already be disposed`);return}e(n);Dt(t)};const nn="E_COMMAND_NOT_FOUND";const en=t=>{if(t&&t.type){return t.type}if(t&&t.constructor&&t.constructor.name){return t.constructor.name}return undefined};const on=t=>t.trim().startsWith("at ");const sn=t=>{const n=t.stack||"";const e=n.indexOf("\n");if(e!==-1&&!on(n.slice(0,e))){return n.slice(e+1)}return n};const cn=(t,n)=>{if(t&&t.code===nn){return{code:Xt,data:t.stack,message:t.message}}return{code:Zt,data:{code:n.code,codeFrame:n.codeFrame,name:n.name,stack:sn(n),type:en(n)},message:n.message}};const rn=(t,n)=>({error:n,id:t,jsonrpc:Wt});const an=(t,n,e,o)=>{const s=e(n);o(n,s);const c=cn(n,s);return rn(t,c)};const dn=(t,n)=>({id:t.id,jsonrpc:Wt,result:n??null});const ln=(t,n)=>{const e=n??null;return dn(t,e)};const un=(t,n)=>({error:{code:Zt,data:n,message:n.message},id:t,jsonrpc:Wt});const fn=async(t,n,e,o,s,c)=>{try{const o=c(t.method)?await e(t.method,n,...t.params):await e(t.method,...t.params);return ln(t,o)}catch(e){if(n.canUseSimpleErrorResponse){return un(t.id,e)}return an(t.id,e,o,s)}};const hn=t=>t;const gn=()=>{};const mn=()=>false;const wn=tn;const pn=t=>{if(t.length===1){const n=t[0];return{execute:n.execute,ipc:n.ipc,logError:n.logError||gn,message:n.message,preparePrettyError:n.preparePrettyError||hn,requiresSocket:n.requiresSocket||mn,resolve:n.resolve||wn}}return{execute:t[2],ipc:t[0],logError:t[5],message:t[1],preparePrettyError:t[4],requiresSocket:t[6],resolve:t[3]}};const yn=async(...t)=>{const n=pn(t);const{execute:e,ipc:o,logError:s,message:c,preparePrettyError:r,requiresSocket:i,resolve:a}=n;if("id"in c){if("method"in c){const t=await fn(c,o,e,r,s,i);try{o.send(t)}catch(t){const n=an(c.id,t,r,s);o.send(n)}return}a(c.id,c);return}if("method"in c){await fn(c,o,e,r,s,i);return}throw new Ot("unexpected message")};const xn="2.0";const En=(t,n)=>({jsonrpc:xn,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:xn,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const vn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const Cn=async(t,n,e,o,s)=>{const{id:c,promise:r}=vn(t);const i=In(c,e,o);if(s&&n.sendAndTransfer){n.sendAndTransfer(i)}else{n.send(i)}const a=await r;return Kt(a)};const bn=t=>{const n=Object.create(null);t._resolve=(t,e)=>{const o=n[t];if(!o){console.warn(`callback ${t} may already be disposed`);return}o(e);delete n[t]};const e={async dispose(){await(t?.dispose())},invoke(e,...o){return Cn(n,t,e,o,false)},invokeAndTransfer(e,...o){return Cn(n,t,e,o,true)},ipc:t,send(n,...e){const o=En(n,e);t.send(o)}};return e};const Mn=()=>false;const Ln=t=>t;const An=()=>{};const Pn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Ft;return yn(t.target,t.data,e,t.target._resolve,Ln,An,n)};const Fn=t=>{if("addEventListener"in t){t.addEventListener("message",Pn)}else if("on"in t){t.on("message",Pn)}};const Wn=async(t,n)=>{const e=await t.listen(n);if(t.signal){t.signal(e)}const o=t.wrap(e);return o};const Tn=async({commandMap:t,isMessagePortOpen:n=true,messagePort:e})=>{At(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Fn(s);const c=bn(s);e.start();return c};const Rn=async({commandMap:t,isMessagePortOpen:n,send:e})=>{const{port1:o,port2:s}=new MessageChannel;await e(o);return Tn({commandMap:t,isMessagePortOpen:n,messagePort:s})};const Dn=t=>{let n;const e=()=>{if(!n){n=t()}return n};return{async dispose(){const t=await e();await t.dispose()},async invoke(t,...n){const o=await e();return o.invoke(t,...n)},async invokeAndTransfer(t,...n){const o=await e();return o.invokeAndTransfer(t,...n)},async send(t,...n){const o=await e();o.send(t,...n)}}};const On=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const Bn=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Nn=async({commandMap:t})=>{At(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Hn=({commandMap:t})=>{const n=[];const e=(e,...o)=>{n.push([e,...o]);const s=t[e];if(!s){throw new Error(`command ${e} not found`)}return s(...o)};const o={invocations:n,invoke:e,invokeAndTransfer:e};return o};const zn=Object.create(null);const Un=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const Yn=t=>{delete zn[t]};const _n=t=>({async dispose(){const n=$n(t);await n.dispose()},invoke(n,...e){const o=$n(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=$n(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});Un(t,e);e[Symbol.dispose]=()=>{Yn(t)};return e},set(n){Un(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const xe=43;const Ee=50;const Ie=52;const ke=54;const Se=58;const ve=59;const Ce=60;const be=68;const Me=87;const Le=88;const Ae=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Oe=6;const Be=7;const Ne=8;const He=1<<11>>>0;const ze=1<<10>>>0;const Ue=1<<9>>>0;const $e=3;const Ye=22;const _e=1;const Ve=0;const je=301;const qe=55;const Ge=99;const Xe=44;const Ze=9006;const Qe=7009;const Ke=300;const Je=4561;const to=1;const no="Viewlet.focusSelector";const eo="Viewlet.setCss";const oo="Viewlet.setFocusContext";const so="Viewlet.setPatches";const co=12;const{invoke:ro,set:io}=_n(Xe);const ao={__proto__:null,invoke:ro,set:io};const{invoke:lo,set:uo}=_n(Ze);const fo=(t,n)=>lo("Extensions.getLanguages",t,n);const{invoke:ho,set:go}=_n(Je);const mo=async(t,n)=>ho("Open.openUrl",t,n);const{invoke:wo,set:po}=_n(Qe);const{invoke:yo,invokeAndTransfer:xo,set:Eo}=_n(to);const Io=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await yo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const So=async t=>yo("FileSystem.readFile",t);const vo=async()=>yo("Layout.handleWorkspaceRefresh");const Co=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const bo=async t=>{await yo("ClipBoard.writeText",t)};const Mo=async()=>yo("ClipBoard.readText");const Lo=(t,n,e)=>yo("ExtensionHostManagement.activateByEvent",t,n,e);const Ao=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Po=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Fo=async t=>await yo("Preferences.get",t);const Wo=async(t,n,e)=>{await yo("Main.openUri",t,n,e)};const To=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Ro={__proto__:null,activateByEvent:Lo,getPreference:Fo,handleWorkspaceRefresh:vo,invoke:yo,invokeAndTransfer:xo,openUri:Wo,readClipBoardText:Mo,readFile:So,sendMessagePortToExtensionHostWorker:Co,sendMessagePortToExtensionManagementWorker:Po,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:To,sendMessagePortToTextMeasurementWorker:Ao,set:Eo,showContextMenu2:Io,writeClipBoardText:bo};const{invoke:Do,set:Oo}=_n(Ke);const Bo={__proto__:null,invoke:Do,set:Oo};const No=t=>{let n;let e;const o=async()=>{const n=await e();Un(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=$n(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=$n(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const Ho=async(t,n,e)=>{w(t);await Lo(t,n,e)};const zo=t=>t;const Uo=6;const $o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:Uo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const Yo=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return $o(t,n)};const _o={};const Vo=()=>{if(!_o.workerPromise){_o.workerPromise=Yo()}return _o.workerPromise};const jo=async(t,...n)=>{const e=await Vo();return await e.invoke(t,...n)};const qo=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await jo("ColorPicker.create",o,c,r,s,e,n);await jo("ColorPicker.loadContent",o);const i=await jo("ColorPicker.diff2",o);const a=await jo("ColorPicker.render2",o,i);return{...t,commands:a}};const Go=n();const{getCommandIds:Xo,registerCommands:Zo,wrapGetter:Qo}=Go;const Ko=t=>Go.get(t);const Jo=()=>{const t=Go.getKeys();return t.map(String)};const ts=(t,n,e)=>{Go.set(t,n,e)};const ns=[];const es=41;const os=9;const ss=0;const cs=16;const rs=51;const is=11;const as=38;const ds=52;const ls=(t,n,e,o,s,c,r,i)=>{g(t);const a={additionalFocus:0,assetDir:i,charWidth:0,columnWidth:0,completionState:"",completionTriggerCharacters:[],completionUid:0,cursorInfos:[],cursorWidth:2,debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:false,differences:[],embeds:[],finalDeltaY:0,finalY:0,focus:0,focused:false,focusKey:ss,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:ns,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled:false,isSelecting:false,itemHeight:20,languageId:"",letterSpacing:0,lineCache:[],lineNumbers:false,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfLines:0,numberOfVisibleLines:0,platform:r,primarySelectionIndex:0,redoStack:[],rowHeight:0,savedSelections:[],scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ts(t,a,a)};const us="compositionUpdate";const fs="contentEditableInput";const hs="delete";const gs="deleteHorizontalRight";const ms="deleteLeft";const ws="editorCut";const ps="editorPasteText";const ys="editorSnippet";const xs="editorType";const Es="editorTypeWithAutoClosing";const Is="format";const ks="indentLess";const Ss="indentMore";const vs="insertLineBreak";const Cs="lineComment";const bs="rename";const Ms="toggleBlockComment";const Ls=Object.create(null);const As=(t,n)=>{Ls[t]=n};const Ps=t=>Ls[t];const Fs=t=>Ps(t);const Ws=async(t,n,e)=>{const o=Fs(n.id);if(e.length===1&&e[0].origin===xs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ms&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Ts=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ws(t,s,n)}return o};const Rs=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Ds="Link";const Os="Function";const Bs="Parameter";const Ns="Type";const Hs="VariableName";const zs="Class";const Us=1;const $s=2816;const Ys=2817;const _s=2824;const Vs=2825;const js=2956;const qs=2857;const Gs=3072;const Xs=3073;const Zs=3077;const Qs=3088;const Ks=1792;const Js=1793;const tc=512;const nc=513;const ec=769;const oc=1024;const sc=1536;const cc=1537;const rc=1544;const ic=1545;const ac=2048;const dc=2049;const lc=2056;const uc=2057;const fc=2064;const hc=2080;const gc=2081;const mc=2088;const wc=2089;const pc=2313;const yc=2560;const xc=2561;const Ec=2569;const Ic=2584;const kc=256;const Sc=257;const vc=272;const Cc=t=>{switch(t){case Us:return Ds;case oc:case sc:case cc:case rc:case ic:case tc:case nc:case ec:return Ns;case Ks:case Js:return Bs;case ac:case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case xc:case Ec:case Ic:return Hs;case kc:case Sc:case vc:return zs;case $s:case Ys:case _s:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:return Os;default:return`Unknown-${t}`}};const bc=t=>structuredClone(t);const Mc=t=>bc(t);const Lc={warned:[]};const Ac=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Pc=(t,n)=>{if(Lc.warned.includes(n)){return}Lc.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Fc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Pc(t,n);c.tokens=Ac(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Wc={TopLevelContent:1};const Tc={Text:1};const Rc={[Tc.Text]:"Text"};const Dc={state:Wc.TopLevelContent};const Oc=true;const Bc=(t,n)=>({state:n.state,tokens:[Tc.Text,t.length]});const Nc={__proto__:null,State:Wc,TokenMap:Rc,TokenType:Tc,hasArrayReturn:Oc,initialLineState:Dc,tokenizeLine:Bc};const Hc={enabled:false};const zc=t=>{Hc.enabled=t};const Uc=()=>Hc.enabled;const{invoke:$c,set:Yc}=Bo;const _c={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const Vc=t=>Object.hasOwn(_c.tokenizers,t);const jc=(t,n)=>{_c.tokenizers[t]=n};const qc=t=>_c.tokenizers[t];const Gc=(t,n)=>{_c.tokenizePaths[t]=n};const Xc=t=>_c.tokenizePaths[t]||"";const Zc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Gc(n.id,n.tokenize)}}};const Qc=t=>Object.hasOwn(_c.pending,t);const Kc=Object.create(null);const Jc=(t,n)=>{Kc[t]=n};const tr=t=>Kc[t]||{};const nr=async(t,n)=>{if(!n){return}Gc(t,n);if(Uc()){const e=await $c("Tokenizer.load",t,n);Jc(t,e);return}try{const e=await import(n);if(typeof e.tokenizeLine!=="function"){console.warn(`tokenizer.tokenizeLine should be a function in "${n}"`);return}if(!e.TokenMap||typeof e.TokenMap!=="object"||Array.isArray(e.TokenMap)){console.warn(`tokenizer.TokenMap should be an object in "${n}"`);return}Jc(t,e.TokenMap);jc(t,e)}catch(t){console.error(t)}};const er=t=>{if(Vc(t)){return qc(t)}if(Qc(t)){return Nc}return Nc};const or=Object.create(null);const sr=(t,n)=>{or[t]=n};const cr=t=>or[t]||Nc;const rr=(t,n,e,o,s,c,r)=>{const i=er(e);if(o!==n.length&&i&&i!==Nc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Fc(t,i.tokenizeLine,d,c[e]||Mc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=rr(t,d,l.embeddedLanguage,l.embeddedLanguageStart,l.embeddedLanguageEnd,c,r);if(n?.isFull){return n}}return{isFull:a,result:l,TokenMap:i.TokenMap}}r.push(e);c[e]=undefined;return{isFull:false,result:{},TokenMap:[]}};const ir=(t,n,e,o)=>{const s=[];const c=[];const r=Object.create(null);for(const i of o){const o=e[i+1];const a=n[i];if(o.embeddedLanguage){const{embeddedLanguage:n,embeddedLanguageEnd:e,embeddedLanguageStart:i}=o;if(a.length===0){const t={tokens:[]};o.embeddedResultIndex=c.length;c.push({isFull:true,result:t,TokenMap:[]})}else{o.embeddedResultIndex=c.length;c.push(rr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const ar=(t,n,e)=>t<n?n:e;const dr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=cr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=ar(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Mc(l):c[t];const e=r[t];const o=Fc(s,u,e,n,d);c[t+1]=o;if(o.embeddedLanguage){o.embeddedResultIndex=w.length;w.push(t)}}const p=c.slice(n+1,e+1);if(w.length>0){const{embeddedResults:n,tokenizersToLoad:e}=ir(s,r,c,w);t.invalidStartIndex=0;return{embeddedResults:n,tokenizersToLoad:e,tokens:p}}t.invalidStartIndex=Math.max(o,h);return{embeddedResults:m,tokenizersToLoad:g,tokens:p}};const lr=Object.create(null);const ur=async(t,n,e,o)=>{if(Uc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(lr[o]===r){i=false;a=[]}else{lr[o]=r}const d={invalidStartIndex:s,languageId:c};return $c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return $c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return dr(t,n,e)};const fr=async t=>{for(const n of t){const t=Xc(n);await nr(n,t)}};const hr=".";const gr='"';const mr="";const wr="\n";const pr=" ";const yr="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(yr,()=>pr.repeat(e))}return t};const Er=t=>t.includes(yr);const Ir=(t,n,e)=>{const o=t.length;const s=e.length;t.length=o+s;for(let e=o-1;e>=n;e--){t[e+s]=t[e]}for(let o=0;o<s;o++){t[o+n]=e[o]}};const kr=(t,n,e,o)=>{const s=t.splice(n,e);Ir(t,n,o);return s};const Sr=t=>t.join("\n");const vr=/^\s+/;const Cr=t=>{const n=t.match(vr);if(!n){return""}return n[0]};const br=(t,n)=>{h(t);m(n);const e=[...t.lines];let o=0;for(const s of n){const n=s.start.rowIndex+o;const c=s.end.rowIndex+o;const r=s.start.columnIndex;const i=s.end.columnIndex;const{deleted:a,inserted:d}=s;g(n);g(c);g(r);g(i);m(d);m(a);if(n===c){const o=e[n];if(d.length===0){const t=o.slice(0,r);const s=o.slice(i);e[n]=t+s}else if(d.length===1){let t=o.slice(0,r);if(r>o.length){t+=" ".repeat(r-o.length)}const s=o.slice(i);const c=d[0];e[n]=t+c+s}else{const s=o.slice(0,r)+d[0];const c=d.at(-1)+o.slice(i);kr(e,n,a.length,[s,...d.slice(1,-1),c]);t.maxLineY=Math.min(t.numberOfVisibleLines,e.length)}}else{const o=e[n].slice(0,r)+d[0];if(d.length===1){const t=c>=e.length?"":e[c].slice(i);kr(e,n,a.length,[o+t])}else{const t=d.slice(1,-1);const s=d.at(-1)+(c>=e.length?"":e[c].slice(i));kr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Mr=(t,n)=>t.lines[n];const Lr=t=>Sr(t.lines);const Ar=(t,n)=>{h(t);const e=n.start.rowIndex;const o=n.start.columnIndex;const s=Math.min(n.end.rowIndex,t.lines.length-1);const c=n.end.columnIndex;if(e===s){return[t.lines[e].slice(o,c)]}const r=[t.lines[e].slice(o),...t.lines.slice(e+1,s),t.lines[s].slice(0,c)];return r};const Pr=async(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Fr=(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Wr=(t,n)=>{const{lines:e}=t;let o=0;let s=0;let c=0;while(o<e.length&&c<n){c+=e[o].length+1;o++}if(c>n){o--;c-=e[o].length+1;s=n-c}else{s=c-n}return{columnIndex:s,rowIndex:o}};const Tr=10;const Rr=(t,n)=>{let e=0;let o=0;let s=0;const c=t.length;for(let r=0;r<c;r+=2){const c=t[r+1];o+=c;e=o;if(e>=n){e-=c;o-=c;s=r;break}}return{end:o,start:e,startIndex:s}};const Dr=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Or=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const Br=(t,n,e,o,s,c,r,i,a,d,l,u)=>{const f=[];const h=new Map;for(let t=0;t<o.length;t+=4){const n=o[t];const c=o[t+1];const r=o[t+2];const i=n-s;const a=i+c;if(i<e.length&&a>0){const t=Cc(r);if(t){h.set(Math.max(0,i),{className:t,end:Math.min(e.length,a)})}}}const g=t[n.embeddedResultIndex];const m=g.result.tokens;const w=g.TokenMap;const p=m.length;let{end:y,start:x,startIndex:E}=Rr(m,l);const I=Hr(x,d,a);for(let t=E;t<p;t+=2){const n=m[t];const o=m[t+1];const s=x+o;const i=Dr(h,x,s);if(i){let t=x;while(t<s){const o=Or(h,t);let i;let a;let d;if(o){i=Math.min(s,o.end);a=e.slice(t,i);const c=w[n]||"Unknown";d=`Token ${c} ${o.className}`}else{let o=s;for(const[n]of h){if(n>t&&n<s){o=Math.min(o,n)}}i=o;a=e.slice(t,i);d=`Token ${w[n]||"Unknown"}`}const l=xr(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(x,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}x=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Nr=(t,n,e)=>{if(t===0){return{maxOffset:Math.ceil(n/e),minOffset:0}}const o=Math.ceil(t/e);const s=o+Math.ceil(n/e);return{maxOffset:s,minOffset:o}};const Hr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const zr=(t,n,e,o,s,c,r,i,a,d,l,u,f)=>{const h=[];const g=new Map;for(let n=0;n<o.length;n+=4){const e=o[n];const s=o[n+1];const r=o[n+2];const i=e-c;const a=i+s;if(i<t.length&&a>0){const n=Cc(r);if(n){g.set(Math.max(0,i),{className:n,end:Math.min(t.length,a)})}}}const{tokens:m}=n;let{end:w,start:p,startIndex:y}=Rr(m,u);const x=Hr(p,l,d);const E=m.length;for(let n=y;n<E;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Dr(g,p,c);if(a){let n=p;while(n<c){const o=Or(g,n);let a;let d;let l;if(o){a=Math.min(c,o.end);d=t.slice(n,a);const r=s[e]||"Unknown";l=`Token ${r} ${o.className}`}else{let o=c;for(const[t]of g){if(t>n&&t<c){o=Math.min(o,t)}}a=o;d=t.slice(n,a);l=`Token ${s[e]||"Unknown"}`}const u=xr(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=xr(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:x,lineInfo:h}};const Ur=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Nr(d,a,l);if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Br(e,n,t,o,c,r,i,a,d,l,f,u)}}return zr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const $r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=tr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Er(s);const f=[];for(let t=0;t<u.length;t+=4){const n=u[t];const e=u[t+1];const o=u[t+2];const c=u[t+3];if(n>=m&&n<m+s.length){f.push(n,e,o,c)}}const{difference:p,lineInfo:y}=Ur(s,n[t-o],e,f,g,m,c,w,r,i,a);d.push(y);l.push(p);m+=s.length+1}return{differences:l,result:d}};const Yr=async(t,n)=>{const{charWidth:e,deltaX:o,lines:s,minLineY:c,numberOfVisibleLines:r,width:i}=t;const a=Math.min(c+r,s.length);let{embeddedResults:d,tokenizersToLoad:l,tokens:u}=await ur(t,c,a,n);for(let e=0;l.length>0&&e<Tr;e++){await fr(l);const e=await ur(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Pr(t,c,0);const h=e;const{differences:g,result:m}=$r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const _r=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const Vr=_r;const jr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const qr=(t,n)=>{if(t>n){return 0}return t**2/n};const Gr=(t,n,e)=>{const o=n/2;if(e<=o){return{handleOffset:e,percent:0}}if(e<=t-o){return{handleOffset:o,percent:(e-o)/(t-n)}}return{handleOffset:n-t+e,percent:1}};const Xr={enabled:false};const Zr=t=>{Xr.enabled=t};const Qr=()=>Xr.enabled;const Kr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Rs(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=Vr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Qr();const{differences:w,textInfos:p}=await Yr(f,m);const y={...f,differences:w,textInfos:p};return y};const Jr=async(t,n)=>{if(!n.undoStack){return ns}if(t.undoStack===n.undoStack){return ns}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await $c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return ns};const ti=(t,n)=>t.matchAll(n).toArray();const ni=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ei=/^(?:https?|ftp|ftps|file):\/\//;const oi=/^www\./;const si=t=>{const n=ti(t,ni);const e=[];for(const t of n){const n=t[0];if(ei.test(n)||oi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const ci=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=si(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Us,0)}o+=t.length+1}return n};const ri=(t,n)=>{const{decorations:e,lines:o}=t;for(let t=0;t<e.length;t+=4){const s=e[t];const c=e[t+1];const r=e[t+2];if(r===Us&&n>=s&&n<s+c){let t=0;for(const n of o){const e=n.length+1;if(t+e>s){const e=s-t;const o=n.slice(e,e+c);return o}t+=e}}}return undefined};const ii=1;const ai=Object.create(null);const di=(t,n)=>{g(t);g(n);if(!Object.hasOwn(ai,t)){ai[t]=[]}if(!ai[t].includes(n)){ai[t].push(n)}};const li=(t,n)=>{g(t);g(n);if(Object.hasOwn(ai,t)){const e=ai[t].indexOf(n);if(e!==-1){ai[t].splice(e,1)}}};const ui=t=>{g(t);return ai[t]||[]};const fi=async(t,n,...e)=>{g(t);w(n);const o=ui(t);const s=o.map(async t=>{try{const o=$n(t);if(o){await o.invoke(n,...e)}}catch(n){console.warn(`Failed to notify listener ${t}:`,n)}});await Promise.all(s)};const hi=(t,n,e=t.columnWidth)=>{const o=n.x??t.x;const s=n.y??t.y;const c=n.width??t.width;const r=n.height??t.height;const i=Math.floor(r/t.itemHeight);const a=t.lines.length;const d=Math.max(a-i,0);const l=d*t.itemHeight;const u=Math.min(t.deltaY,l);const f=Math.floor(u/t.itemHeight);const h=Math.min(f+i,a);const g=a*t.rowHeight;const m=jr(r,g,t.minimumSliderSize);return{...t,columnWidth:e,deltaY:u,finalDeltaY:l,finalY:d,height:r,maxLineY:h,minLineY:f,numberOfVisibleLines:i,scrollBarHeight:m,width:c,x:o,y:s}};const gi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:mi}=Ro;const wi=async t=>{try{await mi("Main.handleModifiedStatusChange",t,true)}catch{}};const pi=(t,n)=>{const e=t[n];const o=t[n+1];const s=t[n+2];const c=t[n+3];if(e>s||e===s&&o>=c){return[s,c,e,o,1]}return[e,o,s,c,0]};const yi=t=>{let n=0;for(const e of t){if(e===yr){n++}}return n};const xi=/^\p{ASCII}*$/u;const Ei=t=>xi.test(t);const Ii=async(t,n)=>t.length*n;const ki=async(t,n,e,o,s,c,r)=>{const i=await wo("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Si=async(t,n,e,o,s,c,r)=>{if(c&&Ei(t)){return await Ii(t,r)}return await ki(t,n,e,o,s,c,r)};const vi=async(t,n,e,o,s,c,r,i,a,d,l,u=0)=>{if(!t){return 0}w(t);g(i);g(a);g(d);p(c);g(l);g(u);if(n===0){return 0}if(n*l>d){return d}const f=Er(t);const h=xr(t,f,i);const m=yi(t.slice(0,n));const y=h.slice(0,n+m);const x=await Si(y,e,o,s,r,c,l);return x-a+u};const Ci=(t,n,e)=>(t-n)*e;const bi=t=>`${t}px`;const Mi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Li=t=>new Uint32Array(t);const Ai=t=>Li(t.length);const Pi=(t,n)=>{const e=Ai(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=pi(t,o);n(e,o,s,c,r,i)}return e};const Fi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n(o,s,c,r)}};const Wi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Ti=(t,n,e,o)=>t===e&&n===o;const Ri=(t,n,e,o)=>t===e;const Di=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(!n(o,s,c,r)){return false}}return true};const Oi=t=>Di(t,Ti);const Bi=t=>Di(t,Ri);const Ni=(t,n)=>{const e=Li(t.length*4);let o=0;for(const s of t){const{end:t,start:c}=n(s);e[o++]=c.rowIndex;e[o++]=c.columnIndex;e[o++]=t.rowIndex;e[o++]=t.columnIndex}return e};const Hi=[];const zi=(t,n)=>{if(!n){return Hi}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${bi(o)} ${bi(s)}`)}return e};const Ui=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push(bi(o),bi(s),bi(c),bi(r))}return n};const $i=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const x=o;const E=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=pi(w,t);if(r<g||o>h){continue}const S=r-g;const v=c[S];const C=f[r];const b=await vi(C,I,d,a,i,l,u,p,E,y,x,v);const M=Ci(r,g,m);if(Ti(o,s,r,I)&&b>0){n.push(b,M);continue}const L=Ci(o,g,m);const A=o-g;const P=c[A];if(o===r){const t=await vi(C,s,d,a,i,l,u,p,E,y,x,P);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,L,o,m)}else{if(o>=g){const t=f[o];const c=await vi(t,s,d,a,i,l,u,p,E,y,x,P);const r=await vi(t,t.length,d,a,i,l,u,p,E,y,x,P);const h=Ci(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=Ci(n,g,m);const s=n-g;const r=c[s];const h=await vi(t,t.length,d,a,i,l,u,p,E,y,x,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:zi(n,r),selectionInfos:Ui(e)}};const Yi=t=>{const{inserted:n,start:e}=t;const o=e.rowIndex;const s=e.columnIndex;const c=n.length;if(c===1){const t={columnIndex:n.at(-1).length+s,rowIndex:o+c-1};return{end:t,start:t}}const r={columnIndex:s,rowIndex:o+c-1};return{end:r,start:r}};const _i=(t,n)=>{h(t);return{...t,selections:n}};const Vi=(t,n)=>{h(t);m(n);const e=Ni(n,Yi);return e};const ji=(t,n)=>Kr(t,n);const qi=(t,n)=>ji(t,t.deltaY+n);const Gi=t=>t.origin===Es;const Xi=(t,n)=>{const{autoClosingRanges:e=[]}=t;const o=[];const s=n[0];const c=s.start.rowIndex;const r=s.start.columnIndex;const i=s.end.rowIndex;const a=s.end.columnIndex;for(let t=0;t<e.length;t+=4){const n=e[t];const d=e[t+1];const l=e[t+2];const u=e[t+3];if(i===l&&a===u||c===n&&r>=d&&i===l&&a<=u){const t=s.inserted[0].length-s.deleted[0].length;o.push(n,d,l,u+t)}}if(Gi(s)){o.push(c,r+1,i,a+1)}return o};const Zi=(t,n)=>_i(t,n);const Qi=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=br(t,n);const s={...t,lines:o};const c=e||Vi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=Xi(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=ci(a);const l={...a,decorations:d};ts(t.uid,t,l);if(!t.modified){await wi(t.uri)}try{await fi(ii,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await Jr(t,l);const f=await Ts(l,n);const g={...l,...f,incrementalEdits:u};if(u!==ns){return g}const w=Qr();const{differences:p,textInfos:y}=await Yr(g,w);return{...g,differences:p,textInfos:y}};const Ki=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=br(t,n);const o={...t,lines:e};const s=Vi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await Jr(t,r);const a={...r,incrementalEdits:i};if(i!==ns){return a}const d=Qr();const{differences:l,textInfos:u}=await Yr(a,d);return{...a,differences:l,textInfos:u}};const Ji=async(t,n)=>{const e=br(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await Jr(t,s);const r={...s,incrementalEdits:c};if(c!==ns){return r}const i=Qr();const{differences:a,textInfos:d}=await Yr(r,i);return{...r,differences:a,textInfos:d}};const ta=t=>t.selections&&t.selections.length>0;const na=(t,n,e,o,s,c)=>hi(t,{height:s,width:o,x:n,y:e},c);const ea=(t,n)=>{const e=gi(n);const{itemHeight:o,minimumSliderSize:s,numberOfVisibleLines:c}=t;const r=e.length;const i=Math.min(c,r);const a=Math.max(r-c,0);const d=a*o;const l=e.length*t.rowHeight;const u=jr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const oa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:ns,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const sa="ExtensionHostHover.execute";const ca="ExtensionHost.executeTabCompletionProvider";const ra="ExtensionHostTextDocument.syncFull";const{invoke:ia,set:aa}=ao;const da=t=>{w(t);return t.lastIndexOf(hr)};const la=(t,n)=>t.lastIndexOf(hr,n);const ua=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const fa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ha=(t,n)=>{w(t);const e=da(t);const o=t.slice(e);const s=o.toLowerCase();const c=ua(n,s);if(c){return c}const r=t.toLowerCase();const i=la(t,e-1);const a=t.slice(i);const d=ua(n,a);if(d){return d}const l=fa(n,r);if(l){return l}return"unknown"};const ga=async(t,n)=>{g(t);w(n);const e=await fo(t,n);return e};const ma=async(t,n,e,o)=>await Si("a",t,n,e,o,false,0);const wa=async t=>{const n=await Fo(t);return n};const pa="onDiagnostic";const ya="onHover";const xa="onTabCompletion";const Ea=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await Ho(a,n,i);const d=await ia(s,e.uid,...t);return d};const Ia=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const ka=async t=>{const n=Ia(t);return lo("Extensions.executeDiagnosticProvider",n)};const Sa=async t=>{const n=await ka(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Ea({args:[],assetDir:e,editor:t,event:pa,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const va=t=>t.type;const Ca=async(t,n)=>{const e=[];const{charWidth:o,fontFamily:s,fontSize:c,fontWeight:r,isMonospaceFont:i,letterSpacing:a,lines:d,minLineY:l,rowHeight:u,tabSize:f,width:h}=t;for(const t of n){const{columnIndex:n,endColumnIndex:g,rowIndex:m}=t;const w=g-n;const p=w*o;const y=0;const x=0;const E=await vi(d[m],n,r,c,s,i,a,f,x,h,o,y);const I=Ci(m,l,u)-u;e.push({height:u,type:va(t),width:p,x:E,y:I})}return e};const ba=(t,n)=>{const e=ci(t);const o=[...e,...n];const s=[];for(let t=0;t<o.length;t+=4){s.push({length:o[t+1],modifiers:o[t+3],offset:o[t],type:o[t+2]})}s.sort((t,n)=>t.offset-n.offset);const c=[];for(const t of s){c.push(t.offset,t.length,t.type,t.modifiers)}return c};const Ma=async t=>{try{const n=Lr(t);await ia(ra,t.uri,t.id,t.languageId,n);const e=await Sa(t);const o=Ko(t.id);if(!o){return t}const s=await Ca(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=ba(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ts(t.id,o.oldState,i);await yo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const La=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:x,letterSpacing:E,lineNumbers:I,lineToReveal:k,links:S,platform:v,rowHeight:C,savedDeltaY:b,savedSelections:M,tabSize:L,uri:A,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await ma(i,r,c,E);const D=await ga(v,t);const O=ha(A,D);const B={assetDir:t,charWidth:R,columnWidth:0,completionState:"",completionTriggerCharacters:e,completionUid:0,cursorInfos:[],cursorWidth:2,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:s,differences:[],finalDeltaY:0,finalY:0,focused:false,focusKey:ss,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:ns,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:O,letterSpacing:E,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:v,primarySelectionIndex:0,redoStack:[],rowHeight:C,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:L,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:A,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const N=na(B,W,T,F,d,9);const H=ea(N,o);let z;if(k&&n){const t=k*C;z=await Kr(H,t)}else{z=await Kr(H,0)}const U=ci(z);const $={...z,decorations:U};const Y=Qr();const{differences:_,textInfos:V}=await Yr($,Y);const j={...$,differences:_,focus:co,focused:true,textInfos:V};ts(u,oa,j);await ia(ra,A,u,x,o);if(s){await Ma(j)}const q=await wa("editor.completionsOnType");const G=Boolean(q);ts(u,oa,{...j,completionsOnType:G})};const Aa=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.deltaX===n.deltaX&&t.longestLineWidth===n.longestLineWidth&&t.minimumSliderSize===n.minimumSliderSize&&t.width===n.width&&t.scrollBarHeight===n.scrollBarHeight;const Pa=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Fa=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.selectionInfos===n.selectionInfos;const Wa=6;const Ta=7;const Ra=11;const Da=12;const Oa=[Fa,Pa,Pa,Aa];const Ba=[Da,Wa,Ta,Ra];const Na=(t,n)=>{const e=[];for(let o=0;o<Oa.length;o++){const s=Oa[o];if(!s(t,n)){e.push(Ba[o])}}return e};const Ha=t=>{const{newState:n,oldState:e}=Ko(t);const o=Na(e,n);return o};const za=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(e===0&&o!==0){n.push(o-1,s,o-1,s)}n.push(o,s,c,r)}return new Uint32Array(n)};const Ua=t=>{const{selections:n}=t;const e=za(n);return{...t,selections:e}};const $a=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];e.push(s,c,r,i);if(o===t.length-4&&r<n){e.push(r+1,i,r+1,i)}}return new Uint32Array(e)};const Ya=t=>{const{lines:n,selections:e}=t;const o=$a(e,n.length);return{...t,selections:o}};const _a=(t,n)=>{const e=[];for(const o of n){const n=Wr(t,o.startOffset);const s=Wr(t,o.endOffset);const c=Ar(t,{end:s,start:n});const r={deleted:c,end:s,inserted:gi(o.inserted),origin:Is,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Va=(...t)=>{console.warn(...t)};const ja=(...t)=>{console.error(...t)};const qa=(t,n)=>{if(!Array.isArray(n)){Va("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=_a(t,n);return Qi(t,e)};const Ga=async(t,n)=>{h(t);m(n);return Qi(t,n)};const Xa=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Wr(t,n.offset);const s=Wr(t,n.offset+n.deleted);const c=Ar(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:bs,start:o};e.push(r)}}}return e};const Za=async(t,n)=>{h(t);m(n);const e=Xa(t,n);if(e.length===0){return t}return Qi(t,e)};const Qa=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const Ka=(t,n,e,o)=>{const s=[];const c=n.length;for(let r=0;r<c;r+=4){const[c,i,a,d]=pi(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Ar(t,f),end:u,inserted:e,origin:o,start:l})}return s};const Ja=(t,n,e)=>{const{selections:o}=t;return Ka(t,o,n,e)};const td=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Si(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const nd=()=>"Segmenter"in Intl;const ed=()=>{const t=new Intl.Segmenter;return{at(n,e){const o=t.segment(n);return o.containing(e)},getSegments:n=>t.segment(n),modelIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(s>=e){return t.index}s++}return n.length},visualIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(t.index>=e){return s}s++}return s}}};const od=async(t,n,e,o,s,c,r,i)=>{const a=ed();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Si(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const sd=(t,n)=>{const e=Math.round(t/n);return e};const cd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===yr){o-=e-1}}return o};const rd=async(t,n,e,o,s,c,r,i,a)=>{w(t);g(n);g(e);w(o);g(s);p(c);g(r);g(i);g(a);const d=sd(a,r);const l=Er(t);const u=cd(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Si(h,n,e,o,s,c,r);const y=Ei(t);if(y){if(Math.abs(a-m)<r/2){return u}return await td(t,u,r,a,n,e,o,s,c,r)}return await od(t,u,r,a,n,e,o,s)};const id=async(t,n,e)=>{h(t);g(n);g(e);const{charWidth:o,deltaX:s,deltaY:c,fontFamily:r,fontSize:i,fontWeight:a,isMonospaceFont:d,letterSpacing:l,lines:u,rowHeight:f,tabSize:m,x:w,y:p}=t;const y=Math.floor((e-p+c)/f);if(y<0){return{columnIndex:0,rowIndex:0}}const x=n-w+s;const E=Rs(y,0,u.length-1);const I=u[E];const k=await rd(I,a,i,r,l,d,o,m,x);return{columnIndex:k,rowIndex:E}};const ad=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const dd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const ld={timeout:-1};const ud=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=ad(t,n,e);const r=dd(t,n);const i=o;await yo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{hd(t)};ld.timeout=setTimeout(n,3e3)}return t};const fd=async(t,n,e,o)=>ud(t,n,e,o,true);const hd=async t=>{clearTimeout(ld.timeout);ld.timeout=-1;return t};const gd=String;const md=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const wd=async(t,n)=>{try{const e=Fr(t,t.cursor);const o=await yo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=md(n);const o=n+e;const s=Ja(t,[o],xs);return Qi(t,s)}const s=Ja(t,[n],xs);return Qi(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return fd(t,e,gd(n))}};const pd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Li(4);Wi(e,0,n[0],n[1]);return Zi(t,e)};const yd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const xd=(t,n)=>{const e=yd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const Ed=t=>t.id===Fe;const Id=t=>{const{widgets:n}=t;const e=n.findIndex(Ed);if(e===-1){return t}const o=xd(n,Fe);return{...t,focused:true,widgets:o}};const kd=t=>t.id===De;const Sd=t=>{const{widgets:n}=t;const e=n.findIndex(kd);if(e===-1){return t}const o=xd(n,De);return{...t,focused:true,widgets:o}};const vd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await $o(t,n);await e.invoke("Rename.initialize");return e};const Cd={};const bd=()=>{if(!Cd.workerPromise){Cd.workerPromise=vd()}return Cd.workerPromise};const Md=async(t,...n)=>{const e=await bd();return await e.invoke(t,...n)};const Ld=t=>t.id===Be;const Ad=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Ld);if(o===-1){return t}const s=e[o];await Md("Rename.close",s.newState.uid);const c=Ko(n);const{newState:r}=c;return r};const Pd=t=>t.id===Ne;const Fd=t=>{const{widgets:n}=t;const e=n.findIndex(Pd);if(e===-1){return t}const o=xd(n,Ne);return{...t,widgets:o}};const Wd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Td=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Wd(r,t)){return e}const i=o();i.newState.editorUid=e.uid;const a=await s(i.newState,e.uid);a.editorUid=e.uid;const d={...i,newState:a};const l=[...r,d];const u=!c;const f={...e,additionalFocus:c?0:n,focus:c?n:co,focused:u,widgets:l};return f};const Rd=()=>Math.random();const Dd=()=>{const t=Rd();const n={id:We,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const Od=(t,n)=>qo(t,n);const Bd=async t=>Td(We,es,t,Dd,Od);const Nd={compositionText:"",isComposing:false};const Hd=(t,n)=>{Nd.isComposing=true;return t};const zd=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];const a=c-Nd.compositionText.length;e.push({deleted:[Nd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:us,start:{columnIndex:a,rowIndex:s}})}return e};const Ud=(t,n)=>{const{selections:e}=t;const o=zd(e,n);Nd.compositionText=n;return Qi(t,o)};const $d=(t,n)=>{const{selections:e}=t;const o=zd(e,n);Nd.isComposing=false;Nd.compositionText="";return Qi(t,o)};const Yd=async t=>{try{w(t);await bo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const _d=(t,n,e,o,s,c)=>{if(n){const n=t[s].length;return{end:{columnIndex:n,rowIndex:e},start:{columnIndex:0,rowIndex:e}}}return{end:{columnIndex:c,rowIndex:s},start:{columnIndex:o,rowIndex:e}}};const Vd=(t,n,e,o)=>t===e&&n===o;const jd=async t=>{if(!ta(t)){return t}const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=e[2];const r=e[3];const i=Vd(o,s,c,r);const a=_d(n,i,o,s,c,r);const d=Ar(t,a);const l=Sr(d);const u=i?"\n"+l:l;await Yd(u);return t};const qd=t=>{const{selections:n}=t;const e=[];for(let t=0;t<n.length;t+=4){const o=n[t];g(o);e.push(o)}const o=[...new Set(e)].toSorted((t,n)=>t-n);const s=o.map(n=>{const e={columnIndex:0,rowIndex:n};return{deleted:[""],end:e,inserted:[Mr(t,n),""],start:e}});const c=new Uint32Array(o.length*4);for(let t=0;t<o.length;t++){const n=o[t]+t+1;c[t*4]=n;c[t*4+1]=0;c[t*4+2]=n;c[t*4+3]=0}return Qi(t,s,c)};const Gd=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Mr(t,e),""],start:o}];return Qi(t,s)};const Xd=(t,n,e,o)=>{if(n===0){if(t===0){return{columnIndex:0,rowIndex:0}}return{columnIndex:e[t-1].length,rowIndex:t-1}}const s=o(e[t],n);return{columnIndex:n-s,rowIndex:t}};const Zd=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const Qd=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Kd=(t,n,e,o,s,c)=>{if(o===0){if(e===0){t[n]=0;t[n+1]=0}else{t[n]=e-1;t[n+1]=s[e-1].length}}else{const r=c(s[e],o);t[n]=e;t[n+1]=o-r}};const Jd=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);if(c===i&&r===a){if(c===0&&r===0){o[s]=0;o[s+1]=0;o[s+2]=0;o[s+3]=0}else{Kd(o,s,c,r,n,e);Kd(o,s+2,c,r,n,e)}}else{Qd(o,s,t[s],t[s+1])}}return o};const tl=(t,n)=>{const{lines:e,selections:o}=t;const s=Jd(o,e,n);return Zi(t,s)};const nl=(t,n)=>{if(!nd()){return 1}if(n>t.length){return 1}const e=ed();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const el=()=>2;const ol=(t,n)=>{if(!nd()){return 1}const e=ed();const o=e.at(t,n);return o.segment.length};const sl=t=>t===pr||t===yr;const cl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!sl(t[e])){return n-e}}return n};const rl=(t,n)=>t.length-n;const il=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const al=/(?<![A-Z])[A-Z]+\s*$/;const dl=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const ll=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const ul=/\s+$/;const fl=/[^a-zA-Z\d]+\s*$/;const hl=[al,dl,ll,ul,fl];const gl=(t,n)=>{const e=t.slice(0,n);return il(e,hl)};const ml=/^\s*[\u{C0}-\u{17F}\w]+/iu;const wl=/^[^a-zA-Z\d]+\w*/;const pl=[ml,wl];const yl=(t,n)=>{const e=t.slice(n);return il(e,pl)};const xl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const El=/(?=[A-Z]+)[A-Z][a-z]+$/;const Il=/[A-Z]+[a-z]+\d?\s*$/;const kl=/[A-Z]+\d*\s*$/;const Sl=/[a-z]+\d*\s*$/;const vl=/[A-Z]*[a-z]+_+\s*$/;const Cl=/(?<![A-Z])[A-Z]_+\s*$/;const bl=/[a-z]+\s*$/;const Ml=/[^a-zA-Z\d\s]+\s*$/;const Ll=[xl,El,Il,kl,Sl,vl,Cl,bl,Ml];const Al=(t,n)=>{const e=t.slice(0,n);return il(e,Ll)};const Pl=/^\s*[a-z]+\d?/;const Fl=/^\s*[A-Z]{2}[a-z\d]+/;const Wl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Tl=/^\s*[A-Z]+[a-z]*\d*/;const Rl=/^\s*_+[a-z]*\d?/;const Dl=/^\s*[^\da-zA-Z\s]+/;const Ol=[Pl,Wl,Tl,Rl,Dl];const Bl=[Pl,Fl,Wl,Tl,Rl,Dl];const Nl=/[A-Z]/;const Hl=(t,n)=>{const e=t.slice(n);if(Nl.test(t[n-1])){return il(e,Ol)}return il(e,Bl)};const zl=t=>tl(t,nl);const Ul=(t,n,e)=>{const{rowIndex:o}=t;const{columnIndex:s}=t;if(s>=n[o].length){if(o>=n.length){return t}return{columnIndex:0,rowIndex:o+1}}const c=e(n[o],s);return{columnIndex:s+c,rowIndex:o}};const $l=(t,n,e,o,s,c)=>{if(e>=s.length){return}const r=s[e];if(o>=r.length){t[n]=t[n+2]=e+1;t[n+1]=t[n+3]=0}else{const s=c(r,o);t[n]=t[n+2]=e;t[n+1]=t[n+3]=o+s}};const Yl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);if(c===i&&r===a){$l(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const _l=(t,n)=>{const{lines:e,selections:o}=t;const s=Yl(o,e,n);return Zi(t,s)};const Vl=t=>_l(t,ol);const jl=(t,n,e,o,s,c)=>{Wi(t,n,s+1,c)};const ql=t=>Pi(t,jl);const Gl=t=>{const{selections:n}=t;const e=ql(n);return Zi(t,e)};const Xl=t=>_l(t,rl);const Zl=t=>tl(t,cl);const Ql=(t,n,e)=>{h(t);g(n);g(e);const o=Mi(n,e,n,e);return Zi(t,o)};const Kl=(t,n,e,o,s,c)=>{if(e===0){Wi(t,n,0,0)}else{Wi(t,n,e-1,o)}};const Jl=t=>Pi(t,Kl);const tu=(t,n,e,o)=>{const{selections:s}=t;const c=Jl(s);return Zi(t,c)};const nu=t=>tu(t);const eu=t=>tl(t,gl);const ou=t=>tl(t,Al);const su=t=>_l(t,Hl);const cu=t=>_l(t,yl);const ru=async t=>{const{lines:n,selections:e}=t;const[o]=e;const s=n[o];const c=new Uint32Array([o,0,o,s.length]);const r=Ka(t,c,[""],ws);const i=new Uint32Array([o,0,o,0]);await Yd(s);return Qi(t,r,i)};const iu=async t=>{const{selections:n}=t;const[e,o,s,c]=n;const r=Ja(t,[""],ws);const i=new Uint32Array([e,o,s,c]);const a=Sr(r[0].deleted);await Yd(a);return Qi(t,r,i)};const au=async t=>{const{selections:n}=t;const[e,o,s,c]=n;if(Ti(e,o,s,c)){return ru(t)}return iu(t)};const du=t=>{const{lines:n}=t;const e=n.length-1;const o=n.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Ar(t,{end:c,start:s}),end:c,inserted:[""],origin:hs,start:s}];return Qi(t,r)};const lu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=Xd(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Ar({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ms,start:i})};Fi(n,s);return o};const uu=(t,n,e,o,s)=>{if(!Ti(n,e,o,s)){return false}if(e<1){return false}for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];if(n===s&&e===c){return true}}return false};const fu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=pi(n,e);if(!uu(t,o,s,c,r)){return false}}return true};const hu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=lu(n,e,el);return Qi(t,o)};const gu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(fu(e,s)){return hu(t)}if(Oi(s)){const e=lu(o,s,n);return Qi(t,e)}const c=Ja(t,[""],ms);return Qi(t,c)};const mu=t=>gu(t,cl);const wu=(t,n)=>{const{selections:e}=t;if(Oi(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=pi(e,c);const a={columnIndex:i,rowIndex:r};const d=Ul(a,s,n);o.push({deleted:Ar(t,{end:d,start:a}),end:d,inserted:[""],origin:gs,start:a})}return o}const o=Ja(t,[""],gs);return o};const pu=(t,n)=>{const e=wu(t,n);return Qi(t,e)};const yu=t=>pu(t,rl);const xu=t=>{const n=gu(t,nl);return n};const Eu=t=>pu(t,ol);const Iu=t=>{const n=gu(t,gl);return n};const ku=t=>{const n=gu(t,Al);return n};const Su=t=>pu(t,Hl);const vu=t=>pu(t,yl);const Cu=async t=>{await yo("SideBar.show","References",true);return t};const bu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return lo("Extensions.executeFormattingProvider",n)};const Mu="Failed to execute formatting provider: FormattingError:";const Lu=t=>t&&t instanceof Error&&t.message.startsWith(Mu);const Au="Failed to execute formatting provider: FormattingError:";const Pu=async t=>{try{const n=await bu(t);return qa(t,n)}catch(n){if(Lu(n)){console.error("Formatting Error:",n.message.slice(Au.length));return t}console.error(n);const e=String(n);await ud(t,0,0,e,true);return t}};const Fu=/^[\w\-]+/;const Wu=/[\w\-]+$/;const Tu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Wu);const s=t.slice(n);const c=s.match(Fu);let r=mr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const Ru=(t,n)=>{const e=t.slice(0,n);const o=e.match(Wu);if(o){return o[0]}return mr};const Du=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Tu(s,e)};const Ou=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Ru(s,e)};const Bu=async(t,n)=>{const e=await yo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Nu={};const Hu=/\{(PH\d+)\}/g;const zu=(t,n=Nu)=>{if(n===Nu){return t}const e=(t,e)=>n[e];return t.replaceAll(Hu,e)};const Uu="Copy";const $u="Cut";const Yu="Editor: Close Color Picker";const _u="Editor: Copy Line Down";const Vu="Editor: Copy Line Up";const ju="Editor: Format Document (forced)";const qu="Editor: Go To Definition";const Gu="Editor: Go To Type Definition";const Xu="Editor: Indent";const Zu="Editor: Open Color Picker";const Qu="Editor: Select All Occurrences";const Ku="Editor: Select Down";const Ju="Editor: Select Inside String";const tf="Editor: Select Next Occurrence";const nf="Editor: Select Up";const ef="Show Hover";const of="Editor: Sort Lines Ascending";const sf="Editor: Toggle Comment";const cf="Editor: Unindent";const rf="Enter Code";const af="Escape to close";const df="Find All Implementations";const lf="Find All References";const uf="Format Document";const ff="Go to Definition";const hf="Go to Type Definition";const gf="Move Line Down";const mf="Move Line Up";const wf="No definition found";const pf="No definition found for '{PH1}'";const yf="No type definition found";const xf="No type definition found for '{PH1}'";const Ef="Paste";const If="Source Action";const kf="Toggle Block Comment";const Sf=()=>zu(ff);const vf=()=>zu(wf);const Cf=t=>zu(pf,{PH1:t});const bf=t=>zu(xf,{PH1:t});const Mf=()=>zu(yf);const Lf=()=>zu(If);const Af=()=>zu(af);const Pf=()=>zu(rf);const Ff=()=>zu(hf);const Wf=()=>zu(lf);const Tf=()=>zu(df);const Rf=()=>zu($u);const Df=()=>zu(Uu);const Of=()=>zu(Ef);const Bf=()=>zu(kf);const Nf=()=>zu(mf);const Hf=()=>zu(gf);const zf=()=>zu(uf);const Uf=()=>zu(ef);const $f=()=>zu(ju);const Yf=()=>zu(tf);const _f=()=>zu(Qu);const Vf=()=>zu(qu);const jf=()=>zu(Gu);const qf=()=>zu(Ju);const Gf=()=>zu(Xu);const Xf=()=>zu(cf);const Zf=()=>zu(of);const Qf=()=>zu(sf);const Kf=()=>zu(nf);const Jf=()=>zu(Ku);const th=()=>zu(Zu);const nh=()=>zu(Yu);const eh=()=>zu(_u);const oh=()=>zu(Vu);const sh=async({editor:t,getErrorMessage:n,getLocation:e,getNoLocationFoundMessage:o,isNoProviderFoundError:s})=>{const{selections:c}=t;const r=c[0];const i=c[1];try{const n=await e(t,r,i);if(!n){const n=Du(t,r,i);const e=o(n);return ud(t,r,i,e,false)}if(typeof n.uri!=="string"||typeof n.startOffset!=="number"||typeof n.endOffset!=="number"){return t}const{uri:s}=n;if(s===t.uri){const e=Wr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return Zi(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await Wo(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await ud(t,r,i,o,false);return t}const o=n(e);await ud(t,r,i,o,true);return t}};const ch=async(t,n,e)=>{const o=Fr(t,n,e);const s=await Bu(t,o);return s};const rh=t=>{if(t.word){return Cf(t.word)}return vf()};const ih=String;const ah=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const dh=async t=>sh({editor:t,getErrorMessage:ih,getLocation:ch,getNoLocationFoundMessage:rh,isNoProviderFoundError:ah});const lh=t=>{if(t.word){return bf(t.word)}return Mf()};const uh=async(t,n)=>{const e=await yo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const fh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await uh(t,o);return s};const hh=String;const gh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const mh=async(t,n=true)=>sh({editor:t,getErrorMessage:hh,getLocation:fh,getNoLocationFoundMessage:lh,isNoProviderFoundError:gh});const wh=t=>{switch(t){case De:return true;default:return false}};const ph=t=>{if(t.length===0){return t}return t.filter(wh)};const yh=async(t,n)=>{await mo(t,n)};const xh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Fr(t,s,o);const r=ri(t,c);if(r){await yh(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await dh(i);return a};const Eh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=pi(e,o);if(s===n.rowIndex&&c===n.columnIndex&&r===n.rowIndex&&i===n.columnIndex){const n=new Uint32Array(e.length-4);n.set(e.subarray(0,o),0);n.set(e.subarray(o+4),o);return Zi(t,n)}}const o=new Uint32Array(e.length+4);o.set(e,0);const s=e.length;o[s]=n.rowIndex;o[s+1]=n.columnIndex;o[s+2]=n.rowIndex;o[s+3]=n.columnIndex;return Zi(t,o)};const Ih=1;const kh=2;const Sh=(t,n)=>{const e=ph(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const vh=t=>{switch(t){case kh:return xh;case Ih:return Eh;default:return Sh}};const Ch=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=vh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const bh=3;const Mh=async(t,n,e,o)=>{const{uid:s}=t;await Io(s,bh,e,o,{menuId:bh});return t};const Lh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Ah=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Ph=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Ah);const r=s.match(Lh);const i=e-(c?c[0].length:0);const a=e+(r?r[0].length:0);const d=new Uint32Array([n,i,n,a]);return d};const Fh=(t,n,e)=>{const o=Mr(t,n);const s=Ph(o,n,e);return Zi(t,s)};const Wh=async(t,n,e,o)=>{const s=await id(t,e,o);return Fh(t,s.rowIndex,s.columnIndex)};const Th=t=>{if(t.focused&&t.focus===co){return t}return{...t,additionalFocus:0,focus:co,focused:true}};const Rh=1;const Dh=2;const Oh=3;const Bh=(t,n)=>{if(t){return kh}if(n){return Ih}return 0};const Nh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await id(t,e,o);return Ch(t,n,s.rowIndex,s.columnIndex)};const Hh=(t,n)=>new Uint32Array([n,0,n,t.length]);const zh=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Mr(t,e);const s=Hh(o,e);return Zi(t,s)};const Uh=(t,n,e,o)=>{h(t);g(e);g(o);return zh(t)};const $h=async(t,n,e,o,s,c,r)=>{const i=Bh(e,o);let a;switch(r){case Dh:a=await Wh(t,i,s,c);break;case Rh:a=await Nh(t,i,s,c);break;case Oh:a=Uh(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Yh={editor:undefined,timeout:-1,x:0,y:0};const _h=()=>Yh;const Vh=(t,n,e,o)=>{Yh.editor=t;Yh.timeout=n;Yh.x=e;Yh.y=o};const jh=async(t,n)=>{};const qh=async()=>{const{editor:t,x:n,y:e}=_h();await id(t,n,e);await jh()};const Gh=300;const Xh=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=_h();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(qh,Gh);Vh(t,s,n,e);return t};const Zh=(t,n)=>{let e=0;for(let o=0;o<t.length;o++){const s=t[o];e+=s.length;if(e>=n){return o}}return-1};const Qh=async(t,n,e)=>{h(t);g(n);g(e);const o=await id(t,n,e);const s=Fr(t,o.rowIndex,o.columnIndex);try{const n=await Bu(t,s);if(!n){return t}const e=Wr(t,n.startOffset);Wr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=Zh(o.tokens,e.columnIndex);if(c===-1){return t}return t}catch(n){if(n&&n.message.startsWith("Failed to execute definition provider: No definition provider found")){return t}throw n}};const Kh=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const Jh=(t,n,e)=>{const o=Kh(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Ar(t,s),end:s.end,inserted:[n],origin:fs,start:s.start}];return c};const tg=(t,n,e)=>{const o=Jh(t,n,e);return Qi(t,o)};const ng=(t,n)=>{const e=Kh(t,n);return Zi(t,e)};const eg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const og=async(t,n,e,o,s,c,r)=>t;const sg=(t,n)=>t;const cg=async(t,n,e)=>{await id(t,n,e)};const rg=t=>{globalThis.requestAnimationFrame(t)};const ig=(t,n)=>t.selections!==n.selections||t.focused!==n.focused||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.differences!==n.differences||t.charWidth!==n.charWidth||t.cursorWidth!==n.cursorWidth||t.fontFamily!==n.fontFamily||t.fontSize!==n.fontSize||t.fontWeight!==n.fontWeight||t.isMonospaceFont!==n.isMonospaceFont||t.letterSpacing!==n.letterSpacing||t.lines!==n.lines||t.rowHeight!==n.rowHeight||t.tabSize!==n.tabSize||t.width!==n.width;const ag=(t,n)=>{if(t.textInfos!==n.textInfos||t.differences!==n.differences){return false}return t.lines!==n.lines||t.tokenizerId!==n.tokenizerId||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.decorations!==n.decorations||t.embeds!==n.embeds||t.deltaX!==n.deltaX||t.width!==n.width||t.highlightedLine!==n.highlightedLine||t.debugEnabled!==n.debugEnabled};const dg=async(t,n)=>{let e=n;if(ag(t,n)){const t=Qr();const{differences:o,textInfos:s}=await Yr(n,t);e={...n,differences:o,textInfos:s}}if(!ig(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await $i(e);return{...e,cursorInfos:o,selectionInfos:s}};const lg=-1;const ug=0;const fg=1;const hg=(t,n)=>{if(t.rowIndex>n.rowIndex){return fg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return fg}if(t.columnIndex<n.columnIndex){return lg}return ug}return lg};const gg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const mg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const wg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const pg=(t,n)=>{switch(hg(n,t)){case ug:return mg(t,n);case fg:return wg(t,n);case lg:return gg(t,n);default:throw new Error("unexpected comparison result")}};const yg=(t,n)=>{const e=t.selectionAnchorPosition;const o=pg(e,n);return Zi(t,o)};const xg=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=e-o;if(n.rowIndex<o){const e=n.rowIndex;const o=n.rowIndex+c;const r=n.rowIndex*s;const i=t.selectionAnchorPosition;const a=new Uint32Array([n.rowIndex-1,n.columnIndex,i.rowIndex,i.columnIndex]);return{...t,deltaY:r,maxLineY:o,minLineY:e,selections:a}}if(n.rowIndex>e){const c=e-o;const r=n.rowIndex-c;const i=n.rowIndex;const a=r*s;const d=t.selectionAnchorPosition;const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const Eg=async t=>{const n=Ko(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=xg(e,o);if(e===s){return}const c=o.rowIndex<e.minLineY?-1:1;const r={...s,selectionAutoMovePosition:{columnIndex:o.columnIndex,rowIndex:o.rowIndex+c}};const i=await dg(e,r);ts(e.uid,e,i);rg(()=>Eg(t))};const Ig=async(t,n,e)=>{h(t);g(n);g(e);const o=await id(t,n,e);const s=yg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){rg(()=>Eg(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const kg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return cg(t,n,e)}return Ig(t,n,e)};const Sg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const vg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Cg=(t,n)=>{const{handleOffsetX:e,longestLineWidth:o,width:s,x:c}=t;if(s>o){return{...t,deltaX:0,scrollBarWidth:0}}const r=20;const i=Rs(n,c,c+s);const a=i-c-e;const d=qr(s,o);const l=o-s+r;const u=vg(s,d,a);const f=Rs(u,0,1);const h=f*l;return{...t,deltaX:h}};const bg=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=qr(s,o);const a=s-i;const d=_r(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Gr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Mg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Lg=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Mg(t,c);const i=r*e;const a=await ji(t,i);return a};const Ag=Lg;const Pg=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=Vr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Gr(s,c,i);const f=u*o;const h=await ji(t,f);return{...h,handleOffset:l}};const Fg=(t,n)=>{};const Wg={deltaY:0,touchOffsetY:0};const Tg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Wg.touchOffsetY=e.y;Wg.deltaY=t.deltaY};const Rg=(t,n)=>qi(t,n);const Dg=(t,n)=>ji(t,n);const Og=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Rg(t,o)}const c=Rs(s+e,0,Infinity);return{...Rg(t,o),deltaX:c}};const Bg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Wg.deltaY+(Wg.touchOffsetY-e.y);Dg(t,o)};const Ng=(t,n,e,o)=>Og(t,n,e,o);const Hg=t=>{const n=[];const e=[];for(let n=0;n<t.length;n+=4){const o=t[n];const s=t[n+2];for(let t=o;t<=s;t++){e.push(t)}}for(const t of e){n.push({deleted:[" "],end:{columnIndex:2,rowIndex:t},inserted:[""],origin:ks,start:{columnIndex:0,rowIndex:t}})}return n};const zg=t=>{const{selections:n}=t;const e=Hg(n);return Qi(t,e)};const Ug=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+2];for(let t=o;t<=s;t++){n.push(t)}}const e=Array.from(n,t=>({deleted:[""],end:{columnIndex:0,rowIndex:t},inserted:[" "],origin:Ss,start:{columnIndex:0,rowIndex:t}}));return e};const $g=t=>{const{selections:n}=t;const e=Ug(n);return Qi(t,e)};const Yg=async t=>yo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const _g=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Vg=(t,n)=>{if(!n){return false}return n.test(t)};const jg=(t,n,e)=>{const o=[];const s=[];const c=_g(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=pi(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(Ti(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=Cr(e);if(Vg(e,c)){o.push({deleted:Ar({lines:t},f),end:u,inserted:["",a+" ",a],origin:vs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Ar({lines:t},f),end:u,inserted:["",a],origin:vs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Ar({lines:t},f),end:u,inserted:["",""],origin:vs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const qg=async t=>{const{lines:n,selections:e}=t;const o=await Yg(t);const{changes:s,selectionChanges:c}=jg(n,e,o);return Qi(t,s,c)};const Gg=2;const Xg=0;const Zg=()=>{const t=Rd();const n={id:Fe,newState:{focused:true,focusSource:Gg,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:Xg,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const Qg=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const Kg=async t=>{const n=true;return Td(Fe,ds,t,Zg,Qg,n)};const Jg=()=>{const t=Rd();const n={id:Te,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const{invoke:tm,setFactory:nm}=No(je);const em=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await tm("Completions.create",o,c,r,s,e,n,a);await tm("Completions.loadContent",o);const d=await tm("Completions.diff2",o);const l=await tm("Completions.render2",o,d);return{...t,commands:l}};const om=async t=>{const n=false;return Td(Te,os,t,Jg,em,n)};const sm=()=>{const t=Rd();const n={id:De,newState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0}};return n};const cm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return $o(t,n)};const rm=9002;const im=async()=>{if($n(rm)){return}const t=await cm();Un(rm,t)};const am=async(t,...n)=>{const e=$n(rm);return await e.invoke(t,...n)};const dm=async()=>{const t=$n(rm);Yn(rm);if(t){await t.dispose()}};const lm=t=>{const n=Ko(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const um=async(t,n)=>{const{uid:e}=t;const o=lm(n);const{height:s,width:c,x:r,y:i}=o;await im();await am("FindWidget.create",e,r,i,c,s,n);await am("FindWidget.loadContent",e);const a=await am("FindWidget.diff2",e);const d=await am("FindWidget.render2",e,a);return{...t,commands:d}};const fm=(t,n)=>um(t,n);const hm=async t=>{const n=true;return Td(De,cs,t,sm,fm,n)};const gm=async t=>hm(t);const mm=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=ad(t,e,o);const c=dd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const wm=()=>{const t=Rd();const n={id:Be,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const pm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Md("Rename.create",o,c,r,s,e,n,a);await Md("Rename.loadContent",o);const d=await Md("Rename.diff2",o);const l=await Md("Rename.render2",o,d);return{...t,commands:l}};const ym=async t=>{const{columnIndex:n,rowIndex:e}=mm(t);const{word:o}=Du(t,e,n);if(!o){return t}const s=true;return Td(Be,is,t,wm,pm,s)};const xm=async t=>{const n=await Ea({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Em=async t=>{const n=await xm(t);return qa(t,n)};const Im=(t,n)=>{const e=gi(n);const o=Ja(t,e,ps);return Qi(t,o)};const km=async t=>{const n=await Mo();w(n);return Im(t,n)};const Sm=t=>{const{redoStack:n=[]}=t;if(n.length===0){return t}const e=n.at(-1);const o={...t,redoStack:n.slice(0,-1),undoStack:[...t.undoStack,e]};return Ki(o,e)};const vm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Cm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=vm(t);if(t.codeFrame){return{codeFrame:t.codeFrame,message:n,stack:t.stack,type:t.constructor.name}}return{category:t.category,codeFrame:t.originalCodeFrame,message:n,stack:t.originalStack,stderr:t.stderr}};const bm=/\((.*):(\d+):(\d+)\)$/;const Mm=/at (.*):(\d+):(\d+)$/;const Lm=t=>{for(const n of t){if(bm.test(n)||Mm.test(n)){return n}}return""};const Am=async t=>{try{const n=gi(t.stack);const e=Lm(n);let o=e.match(bm);if(!o){o=e.match(Mm)}if(!o){return t}const s=Sr(n.slice(1));const c=vm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Pm=async t=>{if(t&&t.message&&t.codeFrame){return Cm(t)}if(t&&t.stack){return Am(t)}return t};const Fm=t=>{if(t&&t.type&&t.message&&t.codeFrame){return`${t.type}: ${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.message&&t.codeFrame){return`${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.type&&t.message){return`${t.type}: ${t.message}\n${t.stack}`}if(t&&t.stack){return t.stack}if(t===null){return null}return String(t)};const Wm=async t=>{const n=await Pm(t);const e=Fm(n);console.error(e);return n};const Tm=async t=>{try{await Wm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const Rm=async t=>t;const Dm=t=>t.startsWith("untitled:");const Om=async(t,n)=>{await yo("FileSystem.writeFile",t,n)};const Bm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await ho("Open.showSaveDialog",n,[],t);if(e){return""}return o};const Nm=async(t,n,e)=>{const o=await Bm(e);if(!o){return}await yo("FileSystem.writeFile",o,n);await vo();await yo("Main.handleUriChange",t,o);return o};const Hm=async t=>{try{const{platform:n,uri:e}=t;const o=await Rm(t);const s=Lr(o);if(Dm(e)){const t=await Nm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await Om(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await Tm(e);return t}};const zm=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Mi(e,o,s,c);return Zi(t,r)};const Um=(t,n,e)=>{const o=Ai(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);Kd(o,s+2,c,r,n,e);Zd(o,s,i,a)}return o};const $m=(t,n)=>{const{lines:e,selections:o}=t;const s=Um(o,e,n);return Zi(t,s)};const Ym=t=>{$m(t,cl)};const _m=/[a-zA-Z\d]/;const Vm=t=>_m.test(t);const jm=t=>Vm(t)||t==="_";const qm=(t,n)=>{for(let e=n-1;e>=0;e--){if(!jm(t[e])){return e+1}}return 0};const Gm=(t,n)=>{for(let e=n;e<t.length;e++){if(!jm(t[e])){return e}}return t.length};const Xm=(t,n,e)=>{const o=t[n];const s=qm(o,e);const c=Gm(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const Zm=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const Qm=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const Km=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(Zm(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const Jm=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=Xm(t,c,r);if(e.start===e.end){return n}const o=Qm(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=Qm(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=Km(t,i);return a};const tw=t=>{const{lines:n,selections:e}=t;const o=Jm(n,e);return Zi(t,o)};const nw=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);const d=n[i];o[s]=c;o[s+1]=r;if(a>=d.length){o[s+2]=i+1;o[s+3]=0}else{const t=e(d,a);o[s+2]=i;o[s+3]=a+t}}return o};const ew=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=nw(o,e,n);return Zi(t,s)};const ow=t=>ew(t,rl);const sw=t=>$m(t,nl);const cw=t=>ew(t,ol);const rw=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=pi(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const iw=t=>{const{lines:n,selections:e}=t;const o=rw(n,e);return Zi(t,o)};const aw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=pi(n,o);if(s===r&&c===i){const n=s;let r=c;let a=i;const d=t[n];while(r>0&&d[r]!==gr){r--}r++;while(a<d.length&&d[a]!==gr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const dw=t=>{const{selections:n}=t;const{lines:e}=t;const o=aw(e,n);return Zi(t,o)};const lw=async(t,n)=>{const e=await yo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const uw=async t=>{const{selections:n}=t;const e=await lw(t,n);return Zi(t,e)};const fw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const hw=t=>{const{lines:n}=t;const{selections:e}=t;if(Oi(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=pi(e,o);const a=Xm(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if(Bi(t.selections)){return fw(t.lines,t.selections)}return undefined};const gw=(t,n,e,o)=>e>=t&&o<=n;const mw=t=>{const n=hw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(gw(t.minLineY,t.maxLineY,s,c)){return Zi(t,o)}return Qi(t,[],o)};const ww=t=>t;const pw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=pi(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const yw=t=>{const{lines:n,selections:e}=t;const o=pw(n,e);return Zi(t,o)};const xw=t=>$m(t,gl);const Ew=t=>ew(t,yl);const Iw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const kw=async(t,n,e)=>{const{tokenizerId:o}=t;Gc(n,e);await nr(n,e);const s=er(n);const c=o+1;sr(c,s);const r=lm(t.uid);if(!r){return t}const i=Qr();const{differences:a,textInfos:d}=await Yr(t,i);const l=lm(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Sw=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const vw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Ar(t,{end:c,start:s}),end:c,inserted:gi(n),origin:xs,start:s}];return Qi(t,r)};const Cw=()=>{const t=Rd();const n={id:Oe,newState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0}};return n};const bw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await $o(t,n,e);return o};const Mw={};const Lw=()=>{if(!Mw.workerPromise){Mw.workerPromise=bw()}return Mw.workerPromise};const Aw=async(t,...n)=>{const e=await Lw();return await e.invoke(t,...n)};const Pw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Aw("Hover.create",o,c,r,s,e,n,a);await Aw("Hover.loadContent",o);const d=await Aw("Hover.diff2",o);const l=await Aw("Hover.render2",o,d);return{...t,commands:l}};const Fw=async t=>{const n=false;return Td(Oe,rs,t,Cw,Pw,n)};const Ww="EditorHover";const Tw=async t=>{await yo("Viewlet.openWidget",Ww);return t};const Rw=()=>{const t=Rd();const n={id:Ne,newState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0}};return n};const Dw=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await $o(t,n,e);return o};const Ow={};const Bw=()=>{if(!Ow.workerPromise){Ow.workerPromise=Dw()}return Ow.workerPromise};const Nw=async(t,...n)=>{const e=await Bw();return await e.invoke(t,...n)};const Hw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Nw("SourceActions.create",o,c,r,s,e,n,a);await Nw("SourceActions.loadContent",o);const d=await Nw("SourceActions.diff2",o);const l=await Nw("SourceActions.render2",o,d);return{...t,commands:l}};const zw=async t=>Td(Ne,as,t,Rw,Hw);const Uw=(t,n)=>t.localeCompare(n);const $w=t=>{const n=[...t];n.sort(Uw);return n};const Yw="sort-lines-ascending";const _w=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=$w(h);s.push({deleted:Ar({lines:t},f),end:u,inserted:g,origin:Yw,start:l})}return s};const Vw=t=>{const{lines:n,selections:e}=t;const o=_w(n,e);return Qi(t,o)};const jw=async(t,n)=>Ea({args:[n],editor:t,event:xa,method:ca,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const qw=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Fr(t,e,o);return s};const Gw=async t=>{const n=qw(t);const e=await jw(t,n);return e};const Xw=(t,n,e)=>{const o=gi(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=pi(n,r);if(o.length>1){const n=Mr({lines:t},i);const r=Cr(n);const u=[o[0],...o.slice(1).map(t=>r+t)];const f=[""];s.push({deleted:f,end:{columnIndex:l,rowIndex:d},inserted:u,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}});const h=o.at(-1);c.push(d+o.length-f.length,l+h.length,d+o.length-f.length,l+h.length)}else{const t=o[0];const n=t.indexOf("$0");if(n===-1){const t=a-e.deleted;c.push(i,t,i,t);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:o,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}else{const n=t.replace("$0","");const o=l+2;c.push(i,o,i,o);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:[n],origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const Zw=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=Xw(e,o,n);return Qi(t,s,c)};const Qw=String;const Kw=async t=>{try{const n=await Gw(t);if(!n){return t}return Zw(t,n)}catch(n){await Tm(n);const e=t.selections[0];const o=t.selections[1];return fd(t,e,o,Qw(n))}};const Jw=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await Ho(`onLanguage:${t.languageId}`,e,o);const s=await ia(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Yg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const tp=/^\s+/;const np=/\s+$/;const ep=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Ms,start:{columnIndex:n,rowIndex:t}});const op=(t,n,e,o,s,c,r)=>{if(n===o){return[ep(t,e,c),ep(t,s-c.length,r)]}return[ep(n,e,c),ep(o,s,r)]};const sp=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Mr(t,o);const c=t.lines.length;let r=o;let i=-1;const a=n[0];const d=n[1];while(r<c){const n=Mr(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Mr(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...op(o,u,l,r,i,a,d))}else{const t=s.match(tp);const n=s.match(np);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:Ms,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Ms,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const cp=async t=>{const n=qw(t);const e=await Jw(t,n);if(!e){return t}const o=sp(t,e);return Ji(t,o)};const rp=async t=>{const n=await Yg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const ip=/^\s+/;const ap=(t,n,e)=>{const o=n.match(ip);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:Cs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:Cs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:Cs,start:{columnIndex:s,rowIndex:t}}};const dp=async t=>{const n=await rp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Mr(e,o);const c=[ap(o,s,n)];return Qi(t,c)};const lp=async t=>{try{const n=await dp(t);if(t!==n){return n}return cp(t)}catch(n){ja(n);await ud(t,0,0,String(n),true);return t}};const up=async(t,n)=>{const e=Ja(t,[n],xs);const o=await Qi(t,e);if(o.completionsOnType){const t=await om(o);return t}return o};const fp="/";const hp="{";const gp="}";const mp="(";const wp=")";const pp="[";const yp="]";const xp="???";const Ep="'";const Ip='"';const kp="`";const Sp=t=>{switch(t){case hp:return gp;case mp:return wp;case pp:return yp;default:return xp}};const vp=(t,n)=>{const e=Sp(n);const o=n+e;const s=Ja(t,[o],Es);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return Qi(t,s,c)};const Cp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return Zi(t,e)};const bp=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(fu(e,o)){return Cp(t)}return up(t,n)};const Mp=(t,n)=>{const e=n+n;const o=Ja(t,[e],Es);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return Qi(t,o,s)};const Lp=async(t,n)=>{const e=Fr(t,t.selections[0],t.selections[1]);const o=await yo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=Ja(t,[n],xs);return Qi(t,e)}const s=Ja(t,[o.inserted],xs);return Qi(t,s)};const Ap=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case fp:if(s){return Lp(t,n)}break;case gp:case wp:case yp:if(e){return bp(t,n)}break;case hp:case mp:case pp:if(e){return vp(t,n)}break;case kp:case Ip:case Ep:if(o){return Mp(t,n)}break}const c=up(t,n);return c};const Pp=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const Fp=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Pp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return Ki(s,o)};const Wp=t=>t;const Tp=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const Rp=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,Tp(t.id)]);c.push(...o);if(Tp(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const Dp=t=>{switch(t){case We:return jo;case Te:return tm;case De:return am;case Oe:return Aw;case Be:return Md;case Ne:return Nw;default:return undefined}};const Op=(t,n,e)=>{const o=t=>t.id===n;const s=t.widgets.findIndex(o);if(s===-1){return t}const c=t.widgets[s];const r={...c,newState:e,oldState:c.newState};const i=[...t.widgets.slice(0,s),r,...t.widgets.slice(s+1)];return{...t,widgets:i}};const Bp=(t,n,e)=>{const o=t=>t.id===e;const s=async(s,...c)=>{const r=s.widgets.findIndex(o);if(r===-1){return s}const i=s.widgets[r];const a=i.newState;const{uid:d}=a;const l=Dp(e);await l(`${n}.${t}`,d,...c);const u=await l(`${n}.diff2`,d);const f=await l(`${n}.render2`,d,u);const h={...a,commands:f};const g=Ko(s.uid).newState;const m=Op(g,e,h);return m};return s};const Np=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=Bp(s,n,e)}return o};const Hp="Viewlet.appendToBody";const zp="focus";const Up="Viewlet.registerEventListeners";const $p="Viewlet.setSelectionByName";const Yp="Viewlet.setValueByName";const _p="Viewlet.setFocusContext";const Vp="setBounds";const jp="Viewlet.setBounds";const qp="Viewlet.setCss";const Gp="Viewlet.setDom2";const Xp="Viewlet.setUid";const Zp=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Qp=[Gp,qp,Hp,jp,Up,$p,Yp,_p,Xp,"Viewlet.focusSelector"];const Kp=t=>{const n=Zp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Qp.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Jp=t=>Rp(t,"EditorCompletion",Kp);const ty=t=>[["Viewlet.dispose",t.newState.uid]];const{close:ny,closeDetails:ey,focusFirst:oy,focusIndex:sy,focusLast:cy,focusNext:ry,focusPrevious:iy,handleEditorBlur:ay,handleEditorClick:dy,handleEditorDeleteLeft:ly,handleEditorType:uy,handlePointerDown:fy,handleWheel:hy,openDetails:gy,selectCurrent:my,selectIndex:wy,toggleDetails:py}=Np(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const yy={__proto__:null,add:Jp,close:ny,closeDetails:ey,focusFirst:oy,focusIndex:sy,focusLast:cy,focusNext:ry,focusPrevious:iy,handleEditorBlur:ay,handleEditorClick:dy,handleEditorDeleteLeft:ly,handleEditorType:uy,handlePointerDown:fy,handleWheel:hy,openDetails:gy,remove:ty,render:Kp,selectCurrent:my,selectIndex:wy,toggleDetails:py};const xy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Ey=[Gp,qp,Hp,jp,Up,$p,Yp,_p,Xp,"Viewlet.focusSelector"];const Iy=t=>{const n=xy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Ey.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const ky=t=>Rp(t,"FindWidget",Iy);const Sy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:vy,focusCloseButton:Cy,focusFind:by,focusNext:My,focusNextElement:Ly,focusNextMatchButton:Ay,focusPrevious:Py,focusPreviousElement:Fy,focusPreviousMatchButton:Wy,focusReplace:Ty,focusReplaceAllButton:Ry,focusReplaceButton:Dy,focusToggleReplace:Oy,handleBlur:By,handleClickButton:Ny,handleFocus:Hy,handleInput:zy,handleReplaceFocus:Uy,handleReplaceInput:$y,handleToggleReplaceFocus:Yy,replace:_y,replaceAll:Vy,toggleMatchCase:jy,toggleMatchWholeWord:qy,togglePreserveCase:Gy,toggleReplace:Xy,toggleUseRegularExpression:Zy}=Np(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const Qy={__proto__:null,add:ky,close:vy,focusCloseButton:Cy,focusFind:by,focusNext:My,focusNextElement:Ly,focusNextMatchButton:Ay,focusPrevious:Py,focusPreviousElement:Fy,focusPreviousMatchButton:Wy,focusReplace:Ty,focusReplaceAllButton:Ry,focusReplaceButton:Dy,focusToggleReplace:Oy,handleBlur:By,handleClickButton:Ny,handleFocus:Hy,handleInput:zy,handleReplaceFocus:Uy,handleReplaceInput:$y,handleToggleReplaceFocus:Yy,remove:Sy,render:Iy,replace:_y,replaceAll:Vy,toggleMatchCase:jy,toggleMatchWholeWord:qy,togglePreserveCase:Gy,toggleReplace:Xy,toggleUseRegularExpression:Zy};const Ky=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const Jy=async(t,n)=>{const e=Ky(t);return lo("Extensions.executeHoverProvider",e,n)};const tx=async(t,n)=>{h(t);g(n);const e=await Jy(t,n);if(e){return e}return Ea({args:[n],editor:t,event:ya,method:sa,noProviderFoundMessage:"No hover provider found"})};const nx=async(t,n)=>{h(t);g(n);const e=await tx(t,n);return e};const ex=async(t,n,e,o,s)=>100;const ox=(t,n,e)=>{const o=n.length;let s=0;let c=0;const r=[];for(let i=0;i<o;i+=2){const o=n[i];const a=n[i+1];s+=a;const d=t.slice(c,s);const l=`Token ${e[o]||"Unknown"}`;const u=d;r.push(u,l);c=s}return r};const sx=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Mc(c);for(const n of t){const t=Fc(e,r,n,a,s);const{tokens:c}=t;const d=ox(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const cx=async(t,n,e)=>{await nr(n,e);const o=er(n);const s=gi(t);const c=sx(s,o,n);return c};const rx=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const ix=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const ax="typescript";const dx=(t,n,e,o)=>{const s=ad(t,n,e);const c=t.height-dd(t,n)+t.y+40;return{x:s,y:c}};const lx=async(t,n)=>{g(t);const e=Ko(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=rx(n,s);const i=Fr(o,r,c);const a=await nx(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await cx(d,l||ax,f);const m=Ou(o,r,c);const w=c-m.length;await ex();const{x:p,y:y}=dx(o,r,w);const x=o.diagnostics||[];const E=ix(x,r);return{documentation:u,lineInfos:h,matchingDiagnostics:E,x:p,y:y}};const ux=async(t,n,e)=>{const o=await lx(t,e);if(!o){return n}const{documentation:s,lineInfos:c,matchingDiagnostics:r,x:i,y:a}=o;return{...n,diagnostics:r,documentation:s,lineInfos:c,x:i,y:a}};const fx=(t,n,e)=>t;const hx=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const gx=(t,n,e)=>t;const mx="CodeGeneratorInput";const wx="CodeGeneratorMessage";const px="CodeGeneratorWidget";const yx="DiagnosticError";const xx="DiagnosticWarning";const Ex="CompletionDetailCloseButton";const Ix="CompletionDetailContent";const kx="Diagnostic";const Sx="EditorCursor";const vx="EditorRow";const Cx="EditorRowHighlighted";const bx="EditorSelection";const Mx="HoverDisplayString";const Lx="HoverDocumentation";const Ax="HoverEditorRow";const Px="HoverProblem";const Fx="HoverProblemDetail";const Wx="HoverProblemMessage";const Tx="IconClose";const Rx="InputBox";const Dx="MaskIcon";const Ox="Viewlet";const Bx=1;const Nx=2;const Hx=9;const zx=10;const Ux=11;const $x=12;const Yx=13;const _x=14;const Vx=15;const jx=18;const qx=19;const Gx=20;const Xx=21;const Zx=22;const Qx=23;const Kx=26;const Jx=27;const tE=28;const nE=29;const eE=30;const oE=31;const sE=32;const cE=33;const rE=4;const iE=6;const aE=8;const dE=12;const lE=62;const uE=t=>({childCount:0,text:t,type:dE});const fE=t=>{const n=[{childCount:t.length/2,className:Ax,type:rE}];for(let e=0;e<t.length;e+=2){const o=t[e];const s=t[e+1];n.push({childCount:1,className:s,type:aE},uE(o))}return n};const hE=t=>{const n=t.flatMap(fE);return n};const gE={childCount:1,className:Wx,type:aE};const mE={childCount:1,className:Fx,type:aE};const wE=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const pE=(t,n,e)=>{const o=[];o.push({childCount:wE(t,n,e)+1,className:"Viewlet EditorHover",type:rE});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${Mx} ${Px}`,type:rE});for(const t of e){o.push(gE,uE(t.message),mE,uE(`${t.source} (${t.code})`))}}if(t.length>0){const n=hE(t);o.push({childCount:t.length,className:Mx,type:rE},...n)}if(n){o.push({childCount:1,className:Lx,type:rE},uE(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:Kx,type:rE});return o};const yE={apply(t,n){const e=pE(n.lineInfos,n.documentation,n.diagnostics);return[Gp,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const xE={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Vp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const EE=[yE,xE];const IE=(t,n)=>{const e=[];for(const o of EE){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const kE=[Gp,qp,Hp,jp,Up,$p,Yp,_p,Xp,"Viewlet.focusSelector"];const SE=t=>{const n=Zp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(kE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const vE=t=>Rp(t,"EditorRename",SE);const CE=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:bE,close:ME,handleInput:LE}=Np(["handleInput","close","accept"],"Rename",Be);const AE={__proto__:null,accept:bE,add:vE,close:ME,handleInput:LE,remove:CE,render:SE};const PE=t=>structuredClone(t);const FE=(t,n)=>{const e={...t,focusedIndex:n};return e};const WE=t=>{const n=t.focusedIndex+1;return FE(t,n)};const TE=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const RE=[Gp,qp,Hp,jp,Up,$p,Yp,_p,Xp,"Viewlet.focusSelector"];const DE=t=>{const n=Zp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(RE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const OE=t=>Rp(t,"EditorSourceActions",DE);const BE=TE;const{close:NE,closeDetails:HE,focusFirst:zE,focusIndex:UE,focusLast:$E,focusNext:YE,focusPrevious:_E,handleWheel:VE,selectCurrent:jE,selectIndex:qE,selectItem:GE,toggleDetails:XE}=Np(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const ZE={__proto__:null,add:OE,close:NE,closeDetails:HE,focusFirst:zE,focusIndex:UE,focusLast:$E,focusNext:YE,focusPrevious:_E,handleWheel:VE,remove:BE,render:DE,selectCurrent:jE,selectIndex:qE,selectItem:GE,toggleDetails:XE};const QE=async(t,n,e,o,s,...c)=>{const r=Dp(s);const i=e.slice(n.length+1);const a=t.widgets.find(t=>t.id===s);if(!a){return t}const{uid:d}=a.newState;g(d);await r(`${n}.${i}`,d,...c);const l=t=>t.id===s;const u=lm(t.uid);const f=u.widgets.findIndex(l);if(f===-1){return u}const h=await r(`${n}.diff2`,d);const m=await r(`${n}.render2`,d,h);const w=t.widgets.findIndex(l);if(w===-1){return u}const p=u.widgets[w];const y={...p.newState,commands:m};const x=Op(u,s,y);return x};const KE=(t,n)=>t.filter(t=>t.languageId===n);const JE=async t=>{if(!t){return[]}const{newState:n}=Ko(t);const{languageId:e}=n;const o=await yo("GetEditorSourceActions.getEditorSourceActions");const s=KE(o,e);return s};const tI=/[\w\-]+$/;const nI=t=>{const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=n[o];const r=c.slice(0,s);const i=r.match(tI);if(i){return i[0]}return""};const eI=async t=>{await yo("Focus.setFocus",t)};const oI=async t=>{if(!t){return}await yo("Focus.removeAdditionalFocus",t)};const sI=12;const cI=9;const rI=11;const iI=12;const aI=16;const dI=38;const lI=43;const uI=46;const fI=47;const hI=48;const gI=49;const mI=50;const wI=52;const pI=t=>{const n=lm(t);return mm(n)};const yI=t=>{const n=lm(t);return n.uri};const xI=t=>{const n=lm(t);return n.languageId};const EI=t=>{const n=lm(t);return qw(n)};const II=(t,n,e)=>{const o=lm(t);const{word:s}=Du(o,n,e);return s};const kI=t=>{const n=lm(t);const e=nI(n);return e};const SI=(t,n,e)=>{const o=lm(t);const s=Ou(o,n,e);return s};const vI=t=>{const n=lm(t);const{lines:e}=n;return e};const CI=t=>{const n=lm(t);const{selections:e}=n;return e};const bI=async(t,n)=>{const e=lm(t);const o={...e,selections:n};const s=await dg(e,o);ts(t,e,s)};const MI=async(t,n,e,o)=>{const s=lm(t);const c=Dp(n);const{widgets:r}=s;const i=r.findIndex(t=>t.id===n);if(i===-1){return}await c(`${e}.dispose`);const a=[...r.slice(0,i),...r.slice(i+1)];const d={...s,focused:true,widgets:a};const l=await dg(s,d);ts(t,s,l);await eI(iI);if(o){await oI(o)}};const LI=async t=>{await MI(t,De,"FindWidget",0)};const AI=async(t,n)=>{const e=lm(t);const o=await Ga(e,n);const s=await dg(e,o);ts(t,e,s)};const PI=async t=>{const n=await JE(t);return n};const FI=async t=>{const n=lm(t);const{diagnostics:e}=n;return e};const WI=async(t,n)=>{await wo("TextMeasurement.ensureFont",t,n)};const TI=()=>[{command:"Editor.closeSourceAction",key:ee,when:dI},{command:"EditorSourceActions.focusNext",key:de,when:dI},{command:"EditorSourceActions.focusPrevious",key:ie,when:dI},{command:"EditorSourceActions.focusFirst",key:ce,when:dI},{command:"EditorSourceActions.focusLast",key:se,when:dI},{command:"EditorSourceActions.selectCurrent",key:ne,when:dI},{command:"FindWidget.focusNext",key:ne,when:aI},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:aI},{command:"FindWidget.focusPrevious",key:ze|Ce,when:aI},{command:"FindWidget.focusNext",key:Ce,when:aI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:aI},{command:"FindWidget.focusReplace",key:te,when:aI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:lI},{command:"FindWidget.replaceAll",key:Ue|He|ne,when:lI},{command:"FindWidget.focusNextMatchButton",key:te,when:mI},{command:"FindWidget.focusReplace",key:ze|te,when:mI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:gI},{command:"FindWidget.focusCloseButton",key:te,when:gI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:hI},{command:"FindWidget.focusReplaceButton",key:te,when:hI},{command:"FindWidget.focusFind",key:ze|te,when:lI},{command:"FindWidget.focusReplaceAllButton",key:te,when:uI},{command:"FindWidget.focusCloseButton",key:ze|te,when:uI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:fI},{command:"EditorCompletion.focusNext",key:de,when:cI},{command:"EditorCompletion.focusPrevious",key:ie,when:cI},{command:"EditorCompletion.selectCurrent",key:ne,when:cI},{command:"EditorCompletion.close",key:ee,when:cI},{command:"EditorCompletion.focusLast",key:se,when:cI},{command:"EditorCompletion.focusFirst",key:ce,when:cI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:cI},{command:"Editor.cursorWordRight",key:He|ae,when:iI},{command:"Editor.cursorWordLeft",key:He|re,when:iI},{command:"Editor.deleteWordPartLeft",key:Ue|Jn,when:iI},{command:"Editor.deleteWordPartRight",key:Ue|le,when:iI},{command:"Editor.deleteWordLeft",key:He|Jn,when:iI},{command:"Editor.deleteWordRight",key:He|le,when:iI},{command:"Editor.selectNextOccurrence",key:He|he,when:iI},{command:"Editor.openColorPicker",key:He|we,when:iI},{command:"Editor.showSourceActions3",key:He|Me,when:iI},{command:"Editor.handleTab",key:te,when:iI},{command:"Editor.unindent",key:ze|te,when:iI},{command:"Editor.indentLess",key:He|Ae,when:iI},{command:"Editor.closeFind",key:ee,when:aI},{command:"Editor.openFind2",key:He|ge,when:iI},{command:"Editor.openCodeGenerator",key:He|pe,when:iI},{command:"Editor.closeCodeGenerator",key:ee,when:wI},{command:"EditorCodeGenerator.accept",key:ne,when:wI},{command:"Editor.indentMore",key:He|Pe,when:iI},{command:"Editor.selectCharacterLeft",key:ze|re,when:iI},{command:"Editor.selectWordLeft",key:He|ze|re,when:iI},{command:"Editor.selectCharacterRight",key:ze|ae,when:iI},{command:"Editor.selectWordRight",key:He|ze|ae,when:iI},{command:"Editor.selectLine",key:He|ye,when:iI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:iI},{command:"Editor.deleteAllRight",key:He|ze|le,when:iI},{command:"Editor.cancelSelection",key:ee,when:iI},{command:"Editor.undo",key:He|ke,when:iI},{command:"Editor.cursorLeft",key:re,when:iI},{command:"Editor.cursorRight",key:ae,when:iI},{command:"Editor.cursorUp",key:ie,when:iI},{command:"Editor.cursorDown",key:de,when:iI},{command:"Editor.deleteLeft",key:Jn,when:iI},{command:"Editor.deleteRight",key:le,when:iI},{command:"Editor.insertLineBreak",key:ne,when:iI},{command:"Editor.copyLineDown",key:He|ze|he,when:iI},{command:"Editor.moveLineDown",key:He|ze|de,when:iI},{command:"Editor.moveLineUp",key:He|ze|ie,when:iI},{command:"Editor.openCompletion",key:He|oe,when:iI},{command:"Editor.openRename",key:Se,when:iI},{command:"EditorRename.accept",key:ne,when:rI},{command:"Editor.closeRename",key:ee,when:rI},{command:"Editor.cursorHome",key:ce,when:iI},{command:"Editor.cursorEnd",key:se,when:iI},{command:"Editor.toggleComment",key:He|Le,when:iI},{command:"Editor.copy",key:He|fe,when:iI},{command:"Editor.selectAll",key:He|ue,when:iI},{command:"Editor.showHover2",key:He|me,when:iI},{command:"Editor.cut",key:He|Ie,when:iI},{command:"Editor.paste",key:He|Ee,when:iI},{command:"Editor.cursorWordPartLeft",key:Ue|re,when:iI},{command:"Editor.cursorWordPartRight",key:Ue|ae,when:iI},{command:"Editor.selectAllOccurrences",key:Ue|ve,when:iI},{command:"Editor.addCursorAbove",key:Ue|ze|ie,when:iI},{command:"Editor.addCursorBelow",key:Ue|ze|de,when:iI},{command:"Editor.findAllReferences",key:Ue|ze|be,when:iI},{command:"Editor.organizeImports",key:Ue|ze|xe,when:iI},{command:"Editor.selectionGrow",key:He|ze|oe,when:sI}];const RI=()=>Jo();const DI={CommandPalette:"Command Palette"};const OI=()=>zu(DI.CommandPalette);const BI={command:"",flags:_e,id:"separator",label:""};const NI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Sf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Ff()},BI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Wf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Tf()},BI,{command:"Editor.format",flags:Ve,id:"format",label:zf()},{command:"Editor.showSourceActions2",flags:Ve,id:Ye,label:Lf()},BI,{command:"Editor.cut",flags:Ve,id:"cut",label:Rf()},{command:"Editor.copy",flags:Ve,id:"copy",label:Df()},{command:"Editor.paste",flags:Ve,id:"paste",label:Of()},BI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:OI()}];const HI=()=>[$e];const zI=t=>Sa(t);const UI=async()=>{const t=Jo();const n=t.map(t=>{const n=parseInt(t);const e=Ko(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(zI));const s=o.flat();return s};const $I=()=>[{id:"Editor.format",label:zf()},{id:"Editor.showHover",label:Uf()},{id:"Editor.formatForced",label:$f()},{id:"Editor.selectNextOccurrence",label:Yf()},{id:"Editor.selectAllOccurrences",label:_f()},{id:"Editor.goToDefinition",label:Vf()},{id:"Editor.goToTypeDefinition",label:jf()},{id:"Editor.selectInsideString",label:qf()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:Gf()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:Xf()},{id:"Editor.sortLinesAscending",label:Zf()},{id:"Editor.toggleComment",label:Qf()},{id:"Editor.selectUp",label:Kf()},{id:"Editor.selectDown",label:Jf()},{id:"Editor.toggleBlockComment",label:Bf()},{id:"Editor.openColorPicker",label:th()},{id:"Editor.closeColorPicker",label:nh()},{id:"Editor.copyLineDown",label:eh()},{id:"Editor.copyLineUp",label:oh()},{id:"Editor.moveLineDown",label:Hf()},{id:"Editor.moveLineUp",label:Nf()},{id:"Editor.showSourceActions2",label:Lf()}];const YI=t=>{const n=lm(t);const{selections:e}=n;return e};const _I=t=>{g(t);const n=lm(t);const{lines:e}=n;return e.join(wr)};const VI="insertText";const jI=(t,n,e)=>{switch(n){case VI:return Ap(t,e);default:return t}};const qI=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const GI=(t,n)=>Zw(t,n);const XI=async t=>{const n=await Gw(t);if(!n){return t}return GI(t,n)};const ZI=async()=>{await dm();await im()};const QI=t=>{switch(t){case De:return`FindWidget`;default:return""}};const KI=async t=>{const n=Object.create(null);for(const e of t){const t=Ko(parseInt(e));const{widgets:o}=t.newState;for(const t of o){const o=Dp(t.id);const s=`${e}:${t.newState.uid}`;const c=QI(t.id);const r=await o(`${c}.saveState`,t.newState.uid);n[s]=r}}return n};const JI=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Ko(t);const{widgets:c}=s.newState;const r=[];for(const e of c){const s=Dp(e.id);const c=`${o}:${e.newState.uid}`;const i=n[c]||{};const a=QI(e.id);await s(`${a}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await s(`${a}.loadContent`,e.newState.uid,i);const d=await s(`${a}.diff2`,e.newState.uid);const l=await s(`${a}.render2`,e.newState.uid,d);const u={...e,newState:{...e.newState,commands:l}};r.push(u)}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const tk={isReloading:false};const nk=async()=>{if(tk.isReloading){return}tk.isReloading=true;const t=Jo();const n=await KI(t);await ZI();const e=await JI(t,n);for(const t of e){ts(t.newState.uid,t.oldState,t.newState)}await yo(`Editor.rerender`);tk.isReloading=false};const ek=async t=>{try{await To(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const ok=async()=>{try{const t=await Rn({commandMap:{},send:ek});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const sk=async(t,n)=>{if(t){zc(true);const t=await ok();Yc(t)}if(n){Zr(true)}};const ck=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await $o(t,n,e);return o};const rk=async(t,n)=>{nm(ck);await sk(t,n)};const ik="editor.lineHeight";const ak="editor.fontSize";const dk="editor.fontFamily";const lk="editor.letterSpacing";const uk="editor.tabSize";const fk="editor.lineNumbers";const hk="editor.diagnostics";const gk="editor.quickSuggestions";const mk="editor.autoClosingQuotes";const wk="editor.autoclosingBrackets";const pk="editor.fontWeight";const yk=async()=>Boolean(await wa(wk));const xk=async()=>Boolean(await wa(mk));const Ek=async()=>Boolean(await wa(gk));const Ik=async()=>true;const kk=async()=>await wa(ik)||20;const Sk=async()=>await wa(ak)||15;const vk=async()=>await wa(dk)||"Fira Code";const Ck=async()=>await wa(lk)??.5;const bk=async()=>await wa(uk)||2;const Mk=async()=>await wa(fk)??false;const Lk=async()=>[".","/"];const Ak=async()=>await wa(hk)??false;const Pk=async()=>await wa(pk)??400;const Fk=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([Ak(),vk(),Sk(),Pk(),yk(),xk(),Ik(),Ek(),Mk(),kk(),bk(),Ck(),Lk()]);return{completionTriggerCharacters:f,diagnosticsEnabled:t,fontFamily:n,fontSize:e,fontWeight:o,isAutoClosingBracketsEnabled:s,isAutoClosingQuotesEnabled:c,isAutoClosingTagsEnabled:r,isQuickSuggestionsEnabled:i,letterSpacing:u,lineNumbers:a,rowHeight:d,tabSize:l}};const Wk=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const Tk=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k}=await Fk();const S=await ma(g,h,f,x);const v=await ga(c,e);Zc(v);const C=ha(r,v);const b=Wk(v,C);await nr(C,b);const M=er(C);const L=t.tokenizerId+1;sr(L,M);const A={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:C,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k,tokenizerId:L};const P=await So(r);const F=na(A,a,d,i,o,9);const W=ea(F,P);let T=W;const R=ci(T);const D={...T,decorations:R};const O=Qr();const{differences:B,textInfos:N}=await Yr(D,O);const H={...D,differences:B,focus:co,focused:true,textInfos:N};await ia(ra,r,s,C,P);if(u){await Ma(H)}const z=await wa("editor.completionsOnType");const U=Boolean(z);const $={...H,completionsOnType:U,initial:false};return $};const Rk=t=>t;const Dk=t=>t;const Ok=(t,n)=>{g(t);g(n);di(t,n)};const Bk=(t,n,e,o,s)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n --ScrollBarWidth: ${o}px;\n --ScrollBarLeft: ${s}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n.Editor .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`;const Nk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const Hk=(t,n)=>{const{deltaX:e,deltaY:o,finalDeltaY:s,height:c,longestLineWidth:r,minimumSliderSize:i,rowHeight:a,scrollBarHeight:d,uid:l,width:u}=n;const f=Vr(o,s,c,d);const h=jr(u,r,i);const g=Nk(e,r,u);const m=Bk(a,d,f,h,g);return[eo,l,m]};const zk=(t,n)=>{const e=".EditorInput textarea";return[no,n.uid,e]};const Uk=(t,n)=>[oo,n.uid,co];const $k=1;const Yk=2;const _k=3;const Vk=4;const jk=6;const qk=7;const Gk=8;const Xk=9;const Zk=10;const Qk=11;const Kk=t=>t!=="type"&&t!=="childCount";const Jk=t=>{const n=Object.keys(t).filter(Kk);return n};const tS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=nS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const nS=(t,n,e)=>{if(e===0){return{children:[],nodesConsumed:0}}const o=[];let s=n;let c=e;let r=0;while(c>0&&s<t.length){const n=t[s];const e=n.childCount||0;const{children:i,nodesConsumed:a}=nS(t,s+1,e);o.push({node:n,children:i});const d=1+a;s+=d;r+=d;c--}return{children:o,nodesConsumed:r}};const eS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:Qk,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:$k,value:n.text})}return e}const o=Jk(t);const s=Jk(n);for(const o of s){if(t[o]!==n[o]){e.push({type:_k,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:Vk,key:t})}}return e};const oS=t=>{const n=[t.node];for(const e of t.children){n.push(...oS(e))}return n};const sS=(t,n,e)=>{if(n===-1){t.push({type:qk,index:e});return e}if(n!==e){t.push({type:Zk,index:e})}return e};const cS=(t,n)=>{if(n>=0){t.push({type:Gk})}return-1};const rS=(t,n)=>{n.push({type:jk,nodes:oS(t)})};const iS=(t,n)=>{n.push({type:Yk,nodes:oS(t)})};const aS=(t,n,e,o,s)=>{const c=eS(t.node,n.node);if(c===null){const t=sS(e,o,s);iS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=sS(e,o,s);if(c.length>0){e.push(...c)}if(r){lS(t.children,n.children,e)}return i};const dS=(t,n,e)=>{const o=eS(t.node,n.node);if(o===null){iS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){lS(t.children,n.children,e)}};const lS=(t,n,e)=>{const o=Math.max(t.length,n.length);let s=-1;const c=[];for(let r=0;r<o;r++){const o=t[r];const i=n[r];if(!o&&!i){continue}if(!o){s=cS(e,s);rS(i,e);continue}if(!i){c.push(r);continue}s=aS(o,i,e,s,r)}cS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:Xk,index:c[t]})}};const uS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){dS(t[0],n[0],e);return}lS(t,n,e)};const fS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==qk&&o.type!==Gk&&o.type!==Zk){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const hS=(t,n)=>{const e=tS(t);const o=tS(n);const s=[];uS(e,o,s,[]);return fS(s)};const gS=()=>[{childCount:1,className:"EditorInput",type:rE},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:Bx,onBlur:Nx,onCompositionEnd:zx,onCompositionStart:Ux,onCompositionUpdate:$x,onCut:_x,onFocus:Vx,onPaste:Gx,role:"textbox",spellcheck:false,type:lE,wrap:"off"}];const mS=t=>{const n=Array.from(t,t=>({childCount:0,className:Sx,translate:t,type:rE}));return n};const wS=t=>{const n=mS([...t]);return[{childCount:t.length,className:"LayerCursor",type:rE},...n]};const pS="error";const yS="warning";const xS=t=>{switch(t){case pS:return yx;case yS:return xx;default:return yx}};const ES=(...t)=>t.filter(Boolean).join(" ");const IS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=xS(e);return[{childCount:0,className:ES(kx,r),height:n,left:s,top:c,type:rE,width:o}]};const kS=t=>{const n=t.flatMap(IS);return n};const SS=t=>{const n=kS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:rE},...n]};const vS=(t,n,e=true,o=-1)=>{const s=[];for(let e=0;e<t.length;e++){const c=t[e];const r=n[e];let i=vx;if(e===o){i+=" "+Cx}s.push({childCount:c.length/2,className:i,translate:bi(r),type:rE});for(let t=0;t<c.length;t+=2){const n=c[t];const e=c[t+1];s.push({childCount:1,className:e,type:aE},uE(n))}}return s};const CS=(t,n,e=true,o=-1)=>{const s=vS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:jx,onPointerDown:Xx,onWheel:cE,type:rE},...s]};const bS=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push({childCount:0,className:bx,height:r,left:o,top:s,type:rE,width:c})}return n};const MS=t=>{const n=bS(t);return[{childCount:t.length/4,className:"Selections",type:rE},...n]};const LS=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:rE},...MS(t),...CS(n,e,o,s),...wS(c),...SS(r)];const AS=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:rE},...kS([...t])];const PS=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:Yx,onPointerDown:eE,type:rE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:rE},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:Jx,type:rE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:rE}];const FS=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onMouseMove:qx,type:rE},...gS(),...LS(r,i,e,s,o,t,n),...AS(c),...PS()];const WS=t=>[{childCount:1,className:"LineNumber",type:aE},uE(t)];const TS=t=>{const n=t.flatMap(WS);return n};const RS=t=>{const n=TS([...t]);return[{childCount:t.length,className:"Gutter",type:rE},...n]};const DS=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,scrollBarDiagnostics:r=[],selectionInfos:i=[],textInfos:a})=>{const d=c?RS(o):[];return[{childCount:c?2:1,className:"Viewlet Editor",onContextMenu:Yx,role:"code",type:rE},...d,...FS({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:r,selectionInfos:i,textInfos:a})]};const OS=new Map;const BS=t=>OS.get(t);const NS=(t,n)=>{OS.set(t,n)};const HS=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return DS(t)};const zS=(t,n)=>Math.abs(n.minLineY-t.minLineY)>1;const US=(t,n)=>{const e=t.initial?HS(t):BS(n.uid)||HS(t);const o=HS(n);if(zS(t,n)){NS(n.uid,o);return[so,n.uid,[{nodes:o,type:6}]]}const s=hS(e,o);if(s.length===0){return[]}NS(n.uid,o);return[so,n.uid,s]};const $S=t=>{switch(t){case Ra:return Hk;case Wa:return zk;case Ta:return Uk;case Da:return US;default:throw new Error("unknown renderer")}};const YS=(t,n,e)=>{const o=[];for(const s of e){const e=$S(s);const c=e(t,n);if(c.length>0){o.push(c)}}return o};const _S=(t,n)=>{const{newState:e,oldState:o}=Ko(t);ts(t,e,e);const s=YS(o,e,n);return s};const VS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const jS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const qS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const GS={apply(t,n){const{incrementalEdits:e}=n;if(e!==ns){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=vS(s,o,true,i);return["setText",a]},isEqual:(t,n)=>t.lines===n.lines&&t.tokenizerId===n.tokenizerId&&t.minLineY===n.minLineY&&t.decorations===n.decorations&&t.embeds===n.embeds&&t.deltaX===n.deltaX&&t.width===n.width&&t.highlightedLine===n.highlightedLine&&t.debugEnabled===n.debugEnabled};const XS={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=mS(e);const c=bS(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const ZS={apply:Hk,isEqual:Aa};const QS={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const KS={apply:(t,n)=>[oo,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const JS={apply(t,n){if(n.additionalFocus){return["Viewlet.setAdditionalFocus",n.uid,n.additionalFocus]}return["viewlet.unsetAdditionalFocus",n.uid,n.additionalFocus]},isEqual:(t,n)=>t.additionalFocus===n.additionalFocus};const tv={apply(t,n){const e=kS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const nv={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;if(!e){return[]}const c=[];for(let t=s;t<o;t++){c.push(t+1)}const r=TS(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const ev={apply(t,n){const e=[];const o=[];const s=[];const c=t.widgets||[];const r=n.widgets||[];const i=Object.create(null);const a=Object.create(null);for(const t of c){i[t.id]=t}for(const t of r){a[t.id]=t}for(const t of c){if(Object.hasOwn(a,t.id)){o.push(a[t.id])}else{s.push(t)}}for(const t of r){if(Object.hasOwn(i,t.id));else{e.push(t)}}const d=[];for(const t of e){const n=VS(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=jS(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=qS(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];const h=f.filter(t=>t[0]!=="Viewlet.setFocusContext");return h},isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const ov=[GS,XS,ZS,QS,tv,nv,ev,KS,JS];const sv=async t=>{const n=Ko(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ts(t,e,e);for(const t of ov){if(t.isEqual(o,e)){continue}const n=await t.apply(o,e);if(t.multiple){s.push(...n)}else if(n.length>0){s.push(n)}}return s};const cv=()=>[{name:Vx,params:["handleFocus"]},{name:qx,params:["handleMouseMove",Xn,Zn,qn]},{name:Nx,params:["handleBlur"]},{name:Bx,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:Ux,params:["compositionStart","event.data"]},{name:$x,params:["compositionUpdate","event.data"]},{name:zx,params:["compositionEnd","event.data"]},{name:_x,params:["cut"],preventDefault:true},{name:Gx,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:jx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:Xx,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[Zx,Qx]},{name:Zx,params:["handlePointerMove",Xn,Zn,qn]},{name:Qx,params:["handlePointerUp"]},{name:cE,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:Yx,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:eE,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[oE,sE]},{name:oE,params:["handleScrollBarVerticalPointerMove",Zn]},{name:sE,params:["handlePointerUp"]},{name:Jx,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[tE,nE]},{name:tE,params:["handleScrollBarHorizontalMove",Xn]},{name:nE,params:["handlePointerUp"]}];const rv=(t,n)=>{const{lines:e}=t;return{lines:e}};const iv=async(t,n,e)=>{await Co(t,e)};const av=async(t,n)=>{await Po(t,n)};const dv=(t,n)=>t;const lv=(t,n)=>{g(t);g(n);li(t,n)};const uv=async(t,...n)=>{const e=$n(qe);return e.invoke(t,...n)};const fv=async t=>{const n=await uv("RunAndDebug.getHighlight",t);return n};const hv=()=>{const t=Jo();return parseInt(t[0])};const gv=async t=>{const n=await fv(t);const e=hv();const o=Ko(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ts(e,c,r);await yo("Editor.rerender",e)};const mv=t=>async(n,...e)=>{const o=Ko(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await dg(s,c);ts(n,s,r);return r};const wv={"ActivateByEvent.activateByEvent":Ho,"CodeGenerator.accept":zo,"ColorPicker.loadContent":qo,"Editor.addCursorAbove":mv(Ua),"Editor.addCursorBelow":mv(Ya),"Editor.applyDocumentEdits":mv(qa),"Editor.applyEdit":mv(Ga),"Editor.applyEdit2":AI,"Editor.applyWorkspaceEdit":mv(Za),"Editor.braceCompletion":mv(wd),"Editor.cancelSelection":mv(pd),"Editor.closeCodeGenerator":mv(Id),"Editor.closeFind":mv(Sd),"Editor.closeFind2":LI,"Editor.closeRename":mv(Ad),"Editor.closeSourceAction":mv(Fd),"Editor.closeWidget2":MI,"Editor.compositionEnd":mv($d),"Editor.compositionStart":mv(Hd),"Editor.compositionUpdate":mv(Ud),"Editor.contextMenu":mv(Mh),"Editor.copy":mv(jd),"Editor.copyLineDown":mv(qd),"Editor.copyLineUp":mv(Gd),"Editor.create":La,"Editor.create2":ls,"Editor.cursorCharacterLeft":mv(zl),"Editor.cursorCharacterRight":mv(Vl),"Editor.cursorDown":mv(Gl),"Editor.cursorEnd":mv(Xl),"Editor.cursorHome":mv(Zl),"Editor.cursorLeft":mv(zl),"Editor.cursorRight":mv(Vl),"Editor.cursorSet":mv(Ql),"Editor.cursorUp":mv(nu),"Editor.cursorWordLeft":mv(eu),"Editor.cursorWordPartLeft":mv(ou),"Editor.cursorWordPartRight":mv(su),"Editor.cursorWordRight":mv(cu),"Editor.cut":mv(au),"Editor.deleteAll":mv(du),"Editor.deleteAllLeft":mv(mu),"Editor.deleteAllRight":mv(yu),"Editor.deleteCharacterLeft":mv(xu),"Editor.deleteCharacterRight":mv(Eu),"Editor.deleteHorizontalRight":mv(pu),"Editor.deleteLeft":mv(xu),"Editor.deleteRight":mv(Eu),"Editor.deleteWordLeft":mv(Iu),"Editor.deleteWordPartLeft":mv(ku),"Editor.deleteWordPartRight":mv(Su),"Editor.deleteWordRight":mv(vu),"Editor.diff2":Ha,"Editor.executeWidgetCommand":mv(QE),"Editor.findAllReferences":mv(Cu),"Editor.format":mv(Pu),"Editor.getCommandIds":Xo,"Editor.getDiagnostics":FI,"Editor.getKeyBindings":TI,"Editor.getKeys":RI,"Editor.getLanguageId":xI,"Editor.getLines2":vI,"Editor.getMenuEntries":NI,"Editor.getMenuEntries2":NI,"Editor.getMenuIds":HI,"Editor.getOffsetAtCursor":EI,"Editor.getPositionAtCursor":pI,"Editor.getProblems":UI,"Editor.getQuickPickMenuEntries":$I,"Editor.getSelections":YI,"Editor.getSelections2":CI,"Editor.getSourceActions":PI,"Editor.getText":_I,"Editor.getUri":yI,"Editor.getWordAt":Du,"Editor.getWordAt2":II,"Editor.getWordAtOffset2":kI,"Editor.getWordBefore":Ou,"Editor.getWordBefore2":SI,"Editor.goToDefinition":mv(dh),"Editor.goToTypeDefinition":mv(mh),"Editor.handleBeforeInput":mv(jI),"Editor.handleBeforeInputFromContentEditable":mv(tg),"Editor.handleBlur":mv(Qa),"Editor.handleClickAtPosition":mv(Ch),"Editor.handleContextMenu":mv(Mh),"Editor.handleDoubleClick":mv(Wh),"Editor.handleFocus":mv(Th),"Editor.handleMouseDown":mv($h),"Editor.handleMouseMove":mv(Xh),"Editor.handleMouseMoveWithAltKey":mv(Qh),"Editor.handleNativeSelectionChange":ng,"Editor.handlePointerCaptureLost":mv(eg),"Editor.handlePointerDown":mv(og),"Editor.handlePointerMove":mv(kg),"Editor.handlePointerUp":mv(Sg),"Editor.handleScrollBarClick":Pg,"Editor.handleScrollBarHorizontalMove":mv(Cg),"Editor.handleScrollBarHorizontalPointerDown":mv(bg),"Editor.handleScrollBarMove":mv(Lg),"Editor.handleScrollBarPointerDown":mv(Pg),"Editor.handleScrollBarVerticalMove":mv(Ag),"Editor.handleScrollBarVerticalPointerDown":mv(Pg),"Editor.handleScrollBarVerticalPointerMove":mv(Ag),"Editor.handleSingleClick":mv(Nh),"Editor.handleTab":mv(XI),"Editor.handleTouchEnd":mv(Fg),"Editor.handleTouchMove":mv(Bg),"Editor.handleTouchStart":mv(Tg),"Editor.handleTripleClick":mv(Uh),"Editor.handleWheel":mv(Ng),"Editor.hotReload":nk,"Editor.indendLess":mv(zg),"Editor.indentMore":mv($g),"Editor.insertLineBreak":mv(qg),"Editor.loadContent":mv(Tk),"Editor.moveLineDown":mv(Rk),"Editor.moveLineUp":mv(Dk),"Editor.moveRectangleSelection":mv(sg),"Editor.moveRectangleSelectionPx":mv(cg),"Editor.moveSelection":mv(yg),"Editor.moveSelectionPx":mv(Ig),"Editor.offsetAt":Fr,"Editor.openCodeGenerator":mv(Kg),"Editor.openColorPicker":mv(Bd),"Editor.openCompletion":mv(om),"Editor.openFind":mv(gm),"Editor.openFind2":mv(hm),"Editor.openRename":mv(ym),"Editor.organizeImports":mv(Em),"Editor.paste":mv(km),"Editor.pasteText":mv(Im),"Editor.redo":mv(Sm),"Editor.render":sv,"Editor.render2":_S,"Editor.renderEventListeners":cv,"Editor.replaceRange":mv(Ka),"Editor.rerender":mv(PE),"Editor.save":mv(Hm),"Editor.saveState":Qo(rv),"Editor.selectAll":mv(zm),"Editor.selectAllLeft":mv(Ym),"Editor.selectAllOccurrences":mv(tw),"Editor.selectAllRight":mv(ow),"Editor.selectCharacterLeft":mv(sw),"Editor.selectCharacterRight":mv(cw),"Editor.selectDown":mv(iw),"Editor.selectInsideString":mv(dw),"Editor.selectionGrow":mv(uw),"Editor.selectLine":mv(zh),"Editor.selectNextOccurrence":mv(mw),"Editor.selectPreviousOccurrence":mv(ww),"Editor.selectUp":mv(yw),"Editor.selectWord":mv(Fh),"Editor.selectWordLeft":mv(xw),"Editor.selectWordRight":mv(Ew),"Editor.setDebugEnabled":mv(dv),"Editor.setDecorations":mv(Iw),"Editor.setDelta":mv(Og),"Editor.setDeltaY":mv(Rg),"Editor.setLanguageId":mv(kw),"Editor.setSelections":mv(Sw),"Editor.setSelections2":bI,"Editor.setText":mv(vw),"Editor.showHover":Tw,"Editor.showHover2":Fw,"Editor.showSourceActions":zw,"Editor.showSourceActions2":zw,"Editor.showSourceActions3":zw,"Editor.sortLinesAscending":mv(Vw),"Editor.tabCompletion":mv(Kw),"Editor.terminate":e,"Editor.toggleBlockComment":mv(cp),"Editor.toggleComment":mv(lp),"Editor.toggleLineComment":mv(dp),"Editor.type":mv(up),"Editor.typeWithAutoClosing":mv(Ap),"Editor.undo":mv(Fp),"Editor.unIndent":mv(Wp),"Editor.updateDebugInfo":gv,"Editor.updateDiagnostics":mv(Ma),"EditorCompletion.close":ny,"EditorCompletion.closeDetails":ey,"EditorCompletion.focusFirst":oy,"EditorCompletion.focusIndex":sy,"EditorCompletion.focusNext":ry,"EditorCompletion.focusPrevious":iy,"EditorCompletion.handleEditorBlur":ay,"EditorCompletion.handleEditorClick":dy,"EditorCompletion.handleEditorDeleteLeft":ly,"EditorCompletion.handleEditorType":uy,"EditorCompletion.handlePointerDown":fy,"EditorCompletion.handleWheel":hy,"EditorCompletion.openDetails":gy,"EditorCompletion.selectCurrent":my,"EditorCompletion.selectIndex":wy,"EditorCompletion.toggleDetails":py,"EditorRename.accept":bE,"EditorRename.close":ME,"EditorRename.handleInput":LE,"EditorSourceAction.close":NE,"EditorSourceAction.closeDetails":HE,"EditorSourceAction.focusFirst":zE,"EditorSourceAction.focusIndex":UE,"EditorSourceAction.focusNext":YE,"EditorSourceAction.focusPrevious":_E,"EditorSourceAction.handleWheel":VE,"EditorSourceAction.selectCurrent":jE,"EditorSourceAction.selectIndex":qE,"EditorSourceAction.selectItem":GE,"EditorSourceAction.toggleDetails":XE,"EditorSourceActions.focusNext":WE,"ExtensionHostManagement.activateByEvent":Ho,"FindWidget.close":vy,"FindWidget.focusCloseButton":Cy,"FindWidget.focusFind":by,"FindWidget.focusNext":My,"FindWidget.focusNextElement":Ly,"FindWidget.focusNextMatchButton":Ay,"FindWidget.focusPrevious":Py,"FindWidget.focusPreviousElement":Fy,"FindWidget.focusPreviousMatchButton":Wy,"FindWidget.focusReplace":Ty,"FindWidget.focusReplaceAllButton":Ry,"FindWidget.focusReplaceButton":Dy,"FindWidget.focusToggleReplace":Oy,"FindWidget.handleBlur":By,"FindWidget.handleClickButton":Ny,"FindWidget.handleFocus":Hy,"FindWidget.handleInput":zy,"FindWidget.handleReplaceFocus":Uy,"FindWidget.handleReplaceInput":$y,"FindWidget.handleToggleReplaceFocus":Yy,"FindWidget.loadContent":um,"FindWidget.replace":_y,"FindWidget.replaceAll":Vy,"FindWidget.toggleMatchCase":jy,"FindWidget.toggleMatchWholeWord":qy,"FindWidget.togglePreserveCase":Gy,"FindWidget.toggleReplace":Xy,"FindWidget.toggleUseRegularExpression":Zy,"Font.ensure":WI,"HandleMessagePort.handleMessagePort":qI,"Hover.getHoverInfo":lx,"Hover.handleSashPointerDown":fx,"Hover.handleSashPointerMove":hx,"Hover.handleSashPointerUp":gx,"Hover.loadContent":ux,"Hover.render":IE,"Initialize.initialize":rk,"Listener.register":Ok,"Listener.registerListener":di,"Listener.unregister":lv,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":iv,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":av};for(const[t,n]of Object.entries(wv)){if(t.startsWith("Editor.")){wv["EditorText"+t.slice("Editor".length)]=n}}const pv=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await iv(n,t,Ge)}});return n};const yv=async()=>{const t=await pv();aa(t)};const xv=async()=>{const t=await On({commandMap:{},async send(t){await Po(t,Ge)}});return t};const Ev=async()=>{try{const t=await xv();uo(t)}catch{}};const Iv=t=>ko(t);const kv=async()=>{const t=await On({commandMap:{},send:Iv});go(t)};const Sv=async()=>{const t=await Nn({commandMap:wv});Eo(t)};const vv=t=>Ao(t);const Cv=async()=>{const t=await On({commandMap:{},send:vv});po(t)};const bv=async()=>{Zo(wv);await Promise.all([Sv(),yv(),Ev(),Cv(),kv()])};const Mv="CodeGeneratorInput";const Lv=t=>{const n=Af();const e=Pf();return[{childCount:2,className:ES(Ox,px),type:rE},{childCount:0,className:ES(mx,Rx),name:Mv,placeholder:e,type:iE},{childCount:1,className:wx,type:rE},uE(n)]};const Av={apply(t,n){const e=Lv();return[Gp,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const Pv={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Vp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const Fv={apply:(t,n)=>[zp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const Wv=[Av,Pv,Fv];const Tv=(t,n)=>{const e=[];for(const o of Wv){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const Rv=t=>{const n=Tv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===Gp){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Dv=t=>Rp(t,"EditorCodeGenerator",Rv);const Ov=TE;const Bv={__proto__:null,add:Dv,remove:Ov,render:Rv};const Nv=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Hv=[Gp,qp,Hp,jp,Up,Xp];const zv=t=>{const n=Nv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Hv.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Uv=t=>Rp(t,"ColorPicker",zv);const $v=TE;const Yv={};const _v={__proto__:null,Commands:Yv,add:Uv,remove:$v,render:zv};const Vv=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:rE},{childCount:1,className:Ix,type:rE},uE(t),{childCount:1,className:Ex,onClick:Hx,type:rE},{childCount:0,className:`${Dx} ${Tx}`,type:rE}];return n};const jv=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const qv={apply(t,n){const e=Vv(n.content);return[Gp,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const Gv={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Vp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const Xv=[qv,Gv];const Zv=(t,n)=>jv(Xv,t,n);const Qv=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const Kv=t=>Qv(t,Te);const Jv=t=>{const n=Zv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===Gp){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const tC=t=>Rp(t,"EditorCompletionDetails",Jv);const nC=TE;const eC=(t,n)=>{const e=Kv(t);if(!e){return t}const{x:o}=mm(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const oC=(t,n)=>eC(t,n);const sC=(t,n)=>eC(t,n);const cC={__proto__:null,add:tC,handleEditorDeleteLeft:sC,handleEditorType:oC,remove:nC,render:Jv};const rC=[Gp,qp,Hp,jp,Up,$p,Yp,_p,Xp,"Viewlet.focusSelector"];const iC=t=>{const n=Zp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(rC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const aC=t=>Rp(t,"EditorCompletion",iC);const dC=t=>[["Viewlet.dispose",t.newState.uid]];const{close:lC}=Np(["close"],"",Oe);const uC={__proto__:null,add:aC,close:lC,remove:dC,render:iC};const fC=()=>{As(We,_v);As(Te,yy);As(Re,cC);As(De,Qy);As(Oe,uC);As(Be,AE);As(Ne,ZE);As(Fe,Bv)};const hC=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const gC=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const mC=t=>{t.addEventListener("error",gC);t.addEventListener("unhandledrejection",hC)};const wC=async()=>{mC(globalThis);await bv();fC()};wC();
|
|
1
|
+
const t=t=>{const n=t.indexOf(".");return t.slice(n+1)};const n=()=>{const n=Object.create(null);const e={};return{clear(){for(const t of Object.keys(n)){delete n[t]}},diff(t,e,o){const{oldState:s,scheduledState:c}=n[t];const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n(s,c)){r.push(o[t])}}return r},dispose(t){delete n[t]},get(t){return n[t]},getCommandIds(){const n=Object.keys(e);const o=n.map(t);return o},getKeys(){return Object.keys(n).map(Number)},registerCommands(t){Object.assign(e,t)},set(t,e,o,s){n[t]={newState:o,oldState:e,scheduledState:s??o}},wrapCommand(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);if(c===r||s===r){return}const i=n[e];const a={...i.newState,...r};n[e]={newState:a,oldState:i.oldState,scheduledState:a}};return e},wrapGetter(t){const e=(e,...o)=>{const{newState:s}=n[e];return t(s,...o)};return e},wrapLoadContent(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);const{error:i,state:a}=r;if(c===a||s===a){return{error:i}}const d=n[e];const l={...d.newState,...a};n[e]={newState:l,oldState:d.oldState,scheduledState:l};return{error:i}};return e}}};const e=()=>{globalThis.close()};class o extends Error{constructor(t){super(t);this.name="AssertionError"}}const s=1;const c=2;const r=3;const i=4;const a=5;const d=6;const l=7;const u=8;const f=t=>{switch(typeof t){case"number":return c;case"function":return d;case"string":return i;case"object":if(t===null){return l}if(Array.isArray(t)){return r}return s;case"boolean":return a;default:return u}};const h=t=>{const n=f(t);if(n!==s){throw new o("expected value to be of type object")}};const g=t=>{const n=f(t);if(n!==c){throw new o("expected value to be of type number")}};const m=t=>{const n=f(t);if(n!==r){throw new o("expected value to be of type array")}};const w=t=>{const n=f(t);if(n!==i){throw new o("expected value to be of type string")}};const p=t=>{const n=f(t);if(n!==a){throw new o("expected value to be of type boolean")}};const y=t=>{if(t.startsWith("Error: ")){return t.slice("Error: ".length)}if(t.startsWith("VError: ")){return t.slice("VError: ".length)}return t};const x=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const E="\n";const I=(t,n=undefined)=>t.indexOf(E,n);const k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=x(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const C=t=>t&&t instanceof MessagePort;const v=t=>t&&t.constructor&&t.constructor.name==="MessagePortMain";const b=t=>typeof OffscreenCanvas!=="undefined"&&t instanceof OffscreenCanvas;const M=(t,n)=>t?.constructor?.name===n;const A=t=>M(t,"Socket");const L=[C,v,b,A];const P=t=>{for(const n of L){if(n(t)){return true}}return false};const F=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){F(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){F(o,n,e)}return}};const W=t=>{const n=[];F(t,n,P);return n};const T=t=>{const n=(...n)=>{const e=t.getData(...n);t.dispatchEvent(new MessageEvent("message",{data:e}))};t.onMessage(n);const e=n=>{t.dispatchEvent(new Event("close"))};t.onClose(e)};class R extends EventTarget{constructor(t){super();this._rawIpc=t;T(this)}}const D="E_INCOMPATIBLE_NATIVE_MODULE";const O="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const B="ERR_MODULE_NOT_FOUND";const N="\n";const H=t=>t.join(N);const z=/^\s+at/;const U=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!U.test(t);const _=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!$(t[e])){break}}return{actualMessage:t[n-1],rest:t.slice(n,e)}};const Y=t=>t.split(N);const V=/^Error: The module '.*'$/;const j=/^\s* at/;const q=t=>V.test(t);const G=t=>j.test(t);const X=t=>{const n=Y(t);const e=n.findIndex(q);const o=e+n.slice(e).findIndex(G,e);const s=n.slice(e,o);const c=s.join(" ").slice("Error: ".length);return c};const Z=t=>t.includes("[ERR_MODULE_NOT_FOUND]");const Q=t=>{const n=Y(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const K=t=>{if(!t){return false}return t.includes("ERR_MODULE_NOT_FOUND")};const J=t=>{if(!t){return false}return t.includes("SyntaxError: Cannot use import statement outside a module")};const tt=/^innerError Error: Cannot find module '.*.node'/;const nt=/was compiled against a different Node.js version/;const et=t=>tt.test(t)&&nt.test(t);const ot=t=>{const n=X(t);return{code:D,message:`Incompatible native node module: ${n}`}};const st=()=>({code:O,message:`ES Modules are not supported in electron`});const ct=(t,n)=>{if(et(n)){return ot(n)}if(J(n)){return st()}if(K(n)){return Q(n)}const e=Y(n);const{actualMessage:o,rest:s}=_(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const xt=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const Et=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){xt(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!C(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=Et(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class Ct extends R{getData=at;send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){this._rawIpc.close()}onMessage(t){this._rawIpc.addEventListener("message",t)}onClose(t){}}const vt=t=>new Ct(t);const bt={__proto__:null,create:kt,signal:St,wrap:vt};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const At=Object.create(null);const Lt=t=>{Object.assign(At,t)};const Pt=t=>At[t];const Ft=(t,...n)=>{const e=Pt(t);if(!e){throw new Mt(t)}return e(...n)};const Wt="2.0";const Tt=Object.create(null);const Rt=t=>Tt[t];const Dt=t=>{delete Tt[t]};class Ot extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Bt="\n";const Nt="DOMException";const Ht="ReferenceError";const zt="SyntaxError";const Ut="TypeError";const $t=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case Ut:return TypeError;default:return Error}}if(t.startsWith("TypeError: ")){return TypeError}if(t.startsWith("SyntaxError: ")){return SyntaxError}if(t.startsWith("ReferenceError: ")){return ReferenceError}return Error};const _t=(t,n,e)=>{const o=$t(t,n);if(o===DOMException&&e){return new o(t,e)}if(o===Error){const n=new Error(t);if(e&&e!=="VError"){n.name=e}return n}return new o(t)};const Yt=t=>t.join(Bt);const Vt=t=>t.split(Bt);const jt=()=>{const t=3;const n=Yt(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Bt,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Bt+n}return n};const Xt=-32601;const Zt=-32001;const Qt=t=>{const n=jt();if(t&&t instanceof Error){if(typeof t.stack==="string"){t.stack=t.stack+Bt+n}return t}if(t&&t.code&&t.code===Xt){const e=new Ot(t.message);const o=Gt(t);e.stack=o+Bt+n;return e}if(t&&t.message){const e=_t(t.message,t.type,t.name);if(t.data){if(t.data.stack&&t.data.type&&t.message){e.stack=t.data.type+": "+t.message+Bt+t.data.stack+Bt+n}else if(t.data.stack){e.stack=t.data.stack}if(t.data.codeFrame){e.codeFrame=t.data.codeFrame}if(t.data.code){e.code=t.data.code}if(t.data.type){e.name=t.data.type}}else{if(t.stack){const n=e.stack||"";const o=qt(n);const s=Gt(t);e.stack=s+n.slice(o)}if(t.codeFrame){e.codeFrame=t.codeFrame}}return e}if(typeof t==="string"){return new Error(`JsonRpc Error: ${t}`)}return new Error(`JsonRpc Error: ${t}`)};const Kt=t=>{if("error"in t){const n=Qt(t.error);throw n}if("result"in t){return t.result}throw new Ot("unexpected response message")};const Jt=(...t)=>{console.warn(...t)};const tn=(t,n)=>{const e=Rt(t);if(!e){console.log(n);Jt(`callback ${t} may already be disposed`);return}e(n);Dt(t)};const nn="E_COMMAND_NOT_FOUND";const en=t=>{if(t&&t.type){return t.type}if(t&&t.constructor&&t.constructor.name){return t.constructor.name}return undefined};const on=t=>t.trim().startsWith("at ");const sn=t=>{const n=t.stack||"";const e=n.indexOf("\n");if(e!==-1&&!on(n.slice(0,e))){return n.slice(e+1)}return n};const cn=(t,n)=>{if(t&&t.code===nn){return{code:Xt,data:t.stack,message:t.message}}return{code:Zt,data:{code:n.code,codeFrame:n.codeFrame,name:n.name,stack:sn(n),type:en(n)},message:n.message}};const rn=(t,n)=>({error:n,id:t,jsonrpc:Wt});const an=(t,n,e,o)=>{const s=e(n);o(n,s);const c=cn(n,s);return rn(t,c)};const dn=(t,n)=>({id:t.id,jsonrpc:Wt,result:n??null});const ln=(t,n)=>{const e=n??null;return dn(t,e)};const un=(t,n)=>({error:{code:Zt,data:n,message:n.message},id:t,jsonrpc:Wt});const fn=async(t,n,e,o,s,c)=>{try{const o=c(t.method)?await e(t.method,n,...t.params):await e(t.method,...t.params);return ln(t,o)}catch(e){if(n.canUseSimpleErrorResponse){return un(t.id,e)}return an(t.id,e,o,s)}};const hn=t=>t;const gn=()=>{};const mn=()=>false;const wn=tn;const pn=t=>{if(t.length===1){const n=t[0];return{execute:n.execute,ipc:n.ipc,logError:n.logError||gn,message:n.message,preparePrettyError:n.preparePrettyError||hn,requiresSocket:n.requiresSocket||mn,resolve:n.resolve||wn}}return{execute:t[2],ipc:t[0],logError:t[5],message:t[1],preparePrettyError:t[4],requiresSocket:t[6],resolve:t[3]}};const yn=async(...t)=>{const n=pn(t);const{execute:e,ipc:o,logError:s,message:c,preparePrettyError:r,requiresSocket:i,resolve:a}=n;if("id"in c){if("method"in c){const t=await fn(c,o,e,r,s,i);try{o.send(t)}catch(t){const n=an(c.id,t,r,s);o.send(n)}return}a(c.id,c);return}if("method"in c){await fn(c,o,e,r,s,i);return}throw new Ot("unexpected message")};const xn="2.0";const En=(t,n)=>({jsonrpc:xn,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:xn,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const Cn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const vn=async(t,n,e,o,s)=>{const{id:c,promise:r}=Cn(t);const i=In(c,e,o);if(s&&n.sendAndTransfer){n.sendAndTransfer(i)}else{n.send(i)}const a=await r;return Kt(a)};const bn=t=>{const n=Object.create(null);t._resolve=(t,e)=>{const o=n[t];if(!o){console.warn(`callback ${t} may already be disposed`);return}o(e);delete n[t]};const e={async dispose(){await(t?.dispose())},invoke(e,...o){return vn(n,t,e,o,false)},invokeAndTransfer(e,...o){return vn(n,t,e,o,true)},ipc:t,send(n,...e){const o=En(n,e);t.send(o)}};return e};const Mn=()=>false;const An=t=>t;const Ln=()=>{};const Pn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Ft;return yn(t.target,t.data,e,t.target._resolve,An,Ln,n)};const Fn=t=>{if("addEventListener"in t){t.addEventListener("message",Pn)}else if("on"in t){t.on("message",Pn)}};const Wn=async(t,n)=>{const e=await t.listen(n);if(t.signal){t.signal(e)}const o=t.wrap(e);return o};const Tn=async({commandMap:t,isMessagePortOpen:n=true,messagePort:e})=>{Lt(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Fn(s);const c=bn(s);e.start();return c};const Rn=async({commandMap:t,isMessagePortOpen:n,send:e})=>{const{port1:o,port2:s}=new MessageChannel;await e(o);return Tn({commandMap:t,isMessagePortOpen:n,messagePort:s})};const Dn=t=>{let n;const e=()=>{if(!n){n=t()}return n};return{async dispose(){const t=await e();await t.dispose()},async invoke(t,...n){const o=await e();return o.invoke(t,...n)},async invokeAndTransfer(t,...n){const o=await e();return o.invokeAndTransfer(t,...n)},async send(t,...n){const o=await e();o.send(t,...n)}}};const On=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const Bn=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Nn=async({commandMap:t})=>{Lt(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Hn=({commandMap:t})=>{const n=[];const e=(e,...o)=>{n.push([e,...o]);const s=t[e];if(!s){throw new Error(`command ${e} not found`)}return s(...o)};const o={invocations:n,invoke:e,invokeAndTransfer:e};return o};const zn=Object.create(null);const Un=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const _n=t=>{delete zn[t]};const Yn=t=>({async dispose(){const n=$n(t);await n.dispose()},invoke(n,...e){const o=$n(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=$n(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});Un(t,e);e[Symbol.dispose]=()=>{_n(t)};return e},set(n){Un(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const xe=43;const Ee=50;const Ie=52;const ke=54;const Se=58;const Ce=59;const ve=60;const be=68;const Me=87;const Ae=88;const Le=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Oe=6;const Be=7;const Ne=8;const He=1<<11>>>0;const ze=1<<10>>>0;const Ue=1<<9>>>0;const $e=3;const _e=22;const Ye=1;const Ve=0;const je=301;const qe=55;const Ge=99;const Xe=44;const Ze=9006;const Qe=7009;const Ke=300;const Je=4561;const to=1;const no="Viewlet.focusSelector";const eo="Viewlet.setCss";const oo="Viewlet.setFocusContext";const so="Viewlet.setPatches";const co=12;const{invoke:ro,set:io}=Yn(Xe);const ao={__proto__:null,invoke:ro,set:io};const{invoke:lo,set:uo}=Yn(Ze);const fo=(t,n)=>lo("Extensions.getLanguages",t,n);const{invoke:ho,set:go}=Yn(Je);const mo=async(t,n)=>ho("Open.openUrl",t,n);const{invoke:wo,set:po}=Yn(Qe);const{invoke:yo,invokeAndTransfer:xo,set:Eo}=Yn(to);const Io=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await yo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const So=async t=>yo("FileSystem.readFile",t);const Co=async()=>yo("Layout.handleWorkspaceRefresh");const vo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const bo=async t=>{await yo("ClipBoard.writeText",t)};const Mo=async()=>yo("ClipBoard.readText");const Ao=(t,n,e)=>yo("ExtensionHostManagement.activateByEvent",t,n,e);const Lo=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Po=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Fo=async t=>await yo("Preferences.get",t);const Wo=async(t,n,e)=>{await yo("Main.openUri",t,n,e)};const To=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Ro={__proto__:null,activateByEvent:Ao,getPreference:Fo,handleWorkspaceRefresh:Co,invoke:yo,invokeAndTransfer:xo,openUri:Wo,readClipBoardText:Mo,readFile:So,sendMessagePortToExtensionHostWorker:vo,sendMessagePortToExtensionManagementWorker:Po,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:To,sendMessagePortToTextMeasurementWorker:Lo,set:Eo,showContextMenu2:Io,writeClipBoardText:bo};const{invoke:Do,set:Oo}=Yn(Ke);const Bo={__proto__:null,invoke:Do,set:Oo};const No=t=>{let n;let e;const o=async()=>{const n=await e();Un(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=$n(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=$n(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const Ho=async(t,n,e)=>{w(t);await Ao(t,n,e)};const zo=t=>t;const Uo=6;const $o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:Uo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const _o=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return $o(t,n)};const Yo={};const Vo=()=>{if(!Yo.workerPromise){Yo.workerPromise=_o()}return Yo.workerPromise};const jo=async(t,...n)=>{const e=await Vo();return await e.invoke(t,...n)};const qo=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await jo("ColorPicker.create",o,c,r,s,e,n);await jo("ColorPicker.loadContent",o);const i=await jo("ColorPicker.diff2",o);const a=await jo("ColorPicker.render2",o,i);return{...t,commands:a}};const Go=n();const{getCommandIds:Xo,registerCommands:Zo,wrapGetter:Qo}=Go;const Ko=t=>Go.get(t);const Jo=()=>{const t=Go.getKeys();return t.map(String)};const ts=(t,n,e)=>{Go.set(t,n,e)};const ns=[];const es=41;const os=9;const ss=0;const cs=16;const rs=51;const is=11;const as=38;const ds=52;const ls=(t,n,e,o,s,c,r,i)=>{g(t);const a={additionalFocus:0,assetDir:i,charWidth:0,columnWidth:0,completionState:"",completionTriggerCharacters:[],completionUid:0,cursorInfos:[],cursorWidth:2,debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:false,differences:[],embeds:[],finalDeltaY:0,finalY:0,focus:0,focused:false,focusKey:ss,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:ns,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled:false,isSelecting:false,itemHeight:20,languageId:"",letterSpacing:0,lineCache:[],lineNumbers:false,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfLines:0,numberOfVisibleLines:0,platform:r,primarySelectionIndex:0,redoStack:[],rowHeight:0,savedSelections:[],scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ts(t,a,a)};const us="compositionUpdate";const fs="contentEditableInput";const hs="delete";const gs="deleteHorizontalRight";const ms="deleteLeft";const ws="editorCut";const ps="editorPasteText";const ys="editorSnippet";const xs="editorType";const Es="editorTypeWithAutoClosing";const Is="format";const ks="indentLess";const Ss="indentMore";const Cs="insertLineBreak";const vs="lineComment";const bs="rename";const Ms="toggleBlockComment";const As=Object.create(null);const Ls=(t,n)=>{As[t]=n};const Ps=t=>As[t];const Fs=t=>Ps(t);const Ws=async(t,n,e)=>{const o=Fs(n.id);if(e.length===1&&e[0].origin===xs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ms&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Ts=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ws(t,s,n)}return o};const Rs=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Ds="Link";const Os="Function";const Bs="Parameter";const Ns="Type";const Hs="VariableName";const zs="Class";const Us=1;const $s=2816;const _s=2817;const Ys=2824;const Vs=2825;const js=2956;const qs=2857;const Gs=3072;const Xs=3073;const Zs=3077;const Qs=3088;const Ks=1792;const Js=1793;const tc=512;const nc=513;const ec=769;const oc=1024;const sc=1536;const cc=1537;const rc=1544;const ic=1545;const ac=2048;const dc=2049;const lc=2056;const uc=2057;const fc=2064;const hc=2080;const gc=2081;const mc=2088;const wc=2089;const pc=2313;const yc=2560;const xc=2561;const Ec=2569;const Ic=2584;const kc=256;const Sc=257;const Cc=272;const vc=t=>{switch(t){case Us:return Ds;case oc:case sc:case cc:case rc:case ic:case tc:case nc:case ec:return Ns;case Ks:case Js:return Bs;case ac:case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case xc:case Ec:case Ic:return Hs;case kc:case Sc:case Cc:return zs;case $s:case _s:case Ys:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:return Os;default:return`Unknown-${t}`}};const bc=t=>structuredClone(t);const Mc=t=>bc(t);const Ac={warned:[]};const Lc=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Pc=(t,n)=>{if(Ac.warned.includes(n)){return}Ac.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Fc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Pc(t,n);c.tokens=Lc(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Wc={TopLevelContent:1};const Tc={Text:1};const Rc={[Tc.Text]:"Text"};const Dc={state:Wc.TopLevelContent};const Oc=true;const Bc=(t,n)=>({state:n.state,tokens:[Tc.Text,t.length]});const Nc={__proto__:null,State:Wc,TokenMap:Rc,TokenType:Tc,hasArrayReturn:Oc,initialLineState:Dc,tokenizeLine:Bc};const Hc={enabled:false};const zc=t=>{Hc.enabled=t};const Uc=()=>Hc.enabled;const{invoke:$c,set:_c}=Bo;const Yc={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const Vc=t=>Object.hasOwn(Yc.tokenizers,t);const jc=(t,n)=>{Yc.tokenizers[t]=n};const qc=t=>Yc.tokenizers[t];const Gc=(t,n)=>{Yc.tokenizePaths[t]=n};const Xc=t=>Yc.tokenizePaths[t]||"";const Zc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Gc(n.id,n.tokenize)}}};const Qc=t=>Object.hasOwn(Yc.pending,t);const Kc=Object.create(null);const Jc=(t,n)=>{Kc[t]=n};const tr=t=>Kc[t]||{};const nr=async(t,n)=>{if(!n){return}Gc(t,n);if(Uc()){const e=await $c("Tokenizer.load",t,n);Jc(t,e);return}try{const e=await import(n);if(typeof e.tokenizeLine!=="function"){console.warn(`tokenizer.tokenizeLine should be a function in "${n}"`);return}if(!e.TokenMap||typeof e.TokenMap!=="object"||Array.isArray(e.TokenMap)){console.warn(`tokenizer.TokenMap should be an object in "${n}"`);return}Jc(t,e.TokenMap);jc(t,e)}catch(t){console.error(t)}};const er=t=>{if(Vc(t)){return qc(t)}if(Qc(t)){return Nc}return Nc};const or=Object.create(null);const sr=(t,n)=>{or[t]=n};const cr=t=>or[t]||Nc;const rr=(t,n,e,o,s,c,r)=>{const i=er(e);if(o!==n.length&&i&&i!==Nc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Fc(t,i.tokenizeLine,d,c[e]||Mc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=rr(t,d,l.embeddedLanguage,l.embeddedLanguageStart,l.embeddedLanguageEnd,c,r);if(n?.isFull){return n}}return{isFull:a,result:l,TokenMap:i.TokenMap}}r.push(e);c[e]=undefined;return{isFull:false,result:{},TokenMap:[]}};const ir=(t,n,e,o)=>{const s=[];const c=[];const r=Object.create(null);for(const i of o){const o=e[i+1];const a=n[i];if(o.embeddedLanguage){const{embeddedLanguage:n,embeddedLanguageEnd:e,embeddedLanguageStart:i}=o;if(a.length===0){const t={tokens:[]};o.embeddedResultIndex=c.length;c.push({isFull:true,result:t,TokenMap:[]})}else{o.embeddedResultIndex=c.length;c.push(rr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const ar=(t,n,e)=>t<n?n:e;const dr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=cr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=ar(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Mc(l):c[t];const e=r[t];const o=Fc(s,u,e,n,d);c[t+1]=o;if(o.embeddedLanguage){o.embeddedResultIndex=w.length;w.push(t)}}const p=c.slice(n+1,e+1);if(w.length>0){const{embeddedResults:n,tokenizersToLoad:e}=ir(s,r,c,w);t.invalidStartIndex=0;return{embeddedResults:n,tokenizersToLoad:e,tokens:p}}t.invalidStartIndex=Math.max(o,h);return{embeddedResults:m,tokenizersToLoad:g,tokens:p}};const lr=Object.create(null);const ur=async(t,n,e,o)=>{if(Uc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(lr[o]===r){i=false;a=[]}else{lr[o]=r}const d={invalidStartIndex:s,languageId:c};return $c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return $c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return dr(t,n,e)};const fr=async t=>{for(const n of t){const t=Xc(n);await nr(n,t)}};const hr=".";const gr='"';const mr="";const wr="\n";const pr=" ";const yr="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(yr,()=>pr.repeat(e))}return t};const Er=t=>t.includes(yr);const Ir=(t,n,e)=>{const o=t.length;const s=e.length;t.length=o+s;for(let e=o-1;e>=n;e--){t[e+s]=t[e]}for(let o=0;o<s;o++){t[o+n]=e[o]}};const kr=(t,n,e,o)=>{const s=t.splice(n,e);Ir(t,n,o);return s};const Sr=t=>t.join("\n");const Cr=/^\s+/;const vr=t=>{const n=t.match(Cr);if(!n){return""}return n[0]};const br=(t,n)=>{h(t);m(n);const e=[...t.lines];let o=0;for(const s of n){const n=s.start.rowIndex+o;const c=s.end.rowIndex+o;const r=s.start.columnIndex;const i=s.end.columnIndex;const{deleted:a,inserted:d}=s;g(n);g(c);g(r);g(i);m(d);m(a);if(n===c){const o=e[n];if(d.length===0){const t=o.slice(0,r);const s=o.slice(i);e[n]=t+s}else if(d.length===1){let t=o.slice(0,r);if(r>o.length){t+=" ".repeat(r-o.length)}const s=o.slice(i);const c=d[0];e[n]=t+c+s}else{const s=o.slice(0,r)+d[0];const c=d.at(-1)+o.slice(i);kr(e,n,a.length,[s,...d.slice(1,-1),c]);t.maxLineY=Math.min(t.numberOfVisibleLines,e.length)}}else{const o=e[n].slice(0,r)+d[0];if(d.length===1){const t=c>=e.length?"":e[c].slice(i);kr(e,n,a.length,[o+t])}else{const t=d.slice(1,-1);const s=d.at(-1)+(c>=e.length?"":e[c].slice(i));kr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Mr=(t,n)=>t.lines[n];const Ar=t=>Sr(t.lines);const Lr=(t,n)=>{h(t);const e=n.start.rowIndex;const o=n.start.columnIndex;const s=Math.min(n.end.rowIndex,t.lines.length-1);const c=n.end.columnIndex;if(e===s){return[t.lines[e].slice(o,c)]}const r=[t.lines[e].slice(o),...t.lines.slice(e+1,s),t.lines[s].slice(0,c)];return r};const Pr=async(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Fr=(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Wr=(t,n)=>{const{lines:e}=t;let o=0;let s=0;let c=0;while(o<e.length&&c<n){c+=e[o].length+1;o++}if(c>n){o--;c-=e[o].length+1;s=n-c}else{s=c-n}return{columnIndex:s,rowIndex:o}};const Tr=10;const Rr=(t,n)=>{let e=0;let o=0;let s=0;const c=t.length;for(let r=0;r<c;r+=2){const c=t[r+1];o+=c;e=o;if(e>=n){e-=c;o-=c;s=r;break}}return{end:o,start:e,startIndex:s}};const Dr=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Or=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const Br=(t,n,e,o,s,c,r,i,a,d,l,u)=>{const f=[];const h=new Map;for(let t=0;t<o.length;t+=4){const n=o[t];const c=o[t+1];const r=o[t+2];const i=n-s;const a=i+c;if(i<e.length&&a>0){const t=vc(r);if(t){h.set(Math.max(0,i),{className:t,end:Math.min(e.length,a)})}}}const g=t[n.embeddedResultIndex];const m=g.result.tokens;const w=g.TokenMap;const p=m.length;let{end:y,start:x,startIndex:E}=Rr(m,l);const I=Hr(x,d,a);for(let t=E;t<p;t+=2){const n=m[t];const o=m[t+1];const s=x+o;const i=Dr(h,x,s);if(i){let t=x;while(t<s){const o=Or(h,t);let i;let a;let d;if(o){i=Math.min(s,o.end);a=e.slice(t,i);const c=w[n]||"Unknown";d=`Token ${c} ${o.className}`}else{let o=s;for(const[n]of h){if(n>t&&n<s){o=Math.min(o,n)}}i=o;a=e.slice(t,i);d=`Token ${w[n]||"Unknown"}`}const l=xr(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(x,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}x=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Nr=(t,n,e)=>{if(t===0){return{maxOffset:Math.ceil(n/e),minOffset:0}}const o=Math.ceil(t/e);const s=o+Math.ceil(n/e);return{maxOffset:s,minOffset:o}};const Hr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const zr=(t,n,e,o,s,c,r,i,a,d,l,u,f)=>{const h=[];const g=new Map;for(let n=0;n<o.length;n+=4){const e=o[n];const s=o[n+1];const r=o[n+2];const i=e-c;const a=i+s;if(i<t.length&&a>0){const n=vc(r);if(n){g.set(Math.max(0,i),{className:n,end:Math.min(t.length,a)})}}}const{tokens:m}=n;let{end:w,start:p,startIndex:y}=Rr(m,u);const x=Hr(p,l,d);const E=m.length;for(let n=y;n<E;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Dr(g,p,c);if(a){let n=p;while(n<c){const o=Or(g,n);let a;let d;let l;if(o){a=Math.min(c,o.end);d=t.slice(n,a);const r=s[e]||"Unknown";l=`Token ${r} ${o.className}`}else{let o=c;for(const[t]of g){if(t>n&&t<c){o=Math.min(o,t)}}a=o;d=t.slice(n,a);l=`Token ${s[e]||"Unknown"}`}const u=xr(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=xr(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:x,lineInfo:h}};const Ur=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Nr(d,a,l);if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Br(e,n,t,o,c,r,i,a,d,l,f,u)}}return zr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const $r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=tr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Er(s);const f=[];for(let t=0;t<u.length;t+=4){const n=u[t];const e=u[t+1];const o=u[t+2];const c=u[t+3];if(n>=m&&n<m+s.length){f.push(n,e,o,c)}}const{difference:p,lineInfo:y}=Ur(s,n[t-o],e,f,g,m,c,w,r,i,a);d.push(y);l.push(p);m+=s.length+1}return{differences:l,result:d}};const _r=async(t,n)=>{const{charWidth:e,deltaX:o,lines:s,minLineY:c,numberOfVisibleLines:r,width:i}=t;const a=Math.min(c+r,s.length);let{embeddedResults:d,tokenizersToLoad:l,tokens:u}=await ur(t,c,a,n);for(let e=0;l.length>0&&e<Tr;e++){await fr(l);const e=await ur(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Pr(t,c,0);const h=e;const{differences:g,result:m}=$r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const Yr=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const Vr=Yr;const jr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const qr=(t,n)=>{if(t>n){return 0}return t**2/n};const Gr=(t,n,e)=>{const o=n/2;if(e<=o){return{handleOffset:e,percent:0}}if(e<=t-o){return{handleOffset:o,percent:(e-o)/(t-n)}}return{handleOffset:n-t+e,percent:1}};const Xr={enabled:false};const Zr=t=>{Xr.enabled=t};const Qr=()=>Xr.enabled;const Kr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Rs(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=Vr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Qr();const{differences:w,textInfos:p}=await _r(f,m);const y={...f,differences:w,textInfos:p};return y};const Jr=async(t,n)=>{if(!n.undoStack){return ns}if(t.undoStack===n.undoStack){return ns}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await $c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return ns};const ti=(t,n)=>t.matchAll(n).toArray();const ni=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ei=/^(?:https?|ftp|ftps|file):\/\//;const oi=/^www\./;const si=t=>{const n=ti(t,ni);const e=[];for(const t of n){const n=t[0];if(ei.test(n)||oi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const ci=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=si(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Us,0)}o+=t.length+1}return n};const ri=(t,n)=>{const{decorations:e,lines:o}=t;for(let t=0;t<e.length;t+=4){const s=e[t];const c=e[t+1];const r=e[t+2];if(r===Us&&n>=s&&n<s+c){let t=0;for(const n of o){const e=n.length+1;if(t+e>s){const e=s-t;const o=n.slice(e,e+c);return o}t+=e}}}return undefined};const ii=1;const ai=Object.create(null);const di=(t,n)=>{g(t);g(n);if(!Object.hasOwn(ai,t)){ai[t]=[]}if(!ai[t].includes(n)){ai[t].push(n)}};const li=(t,n)=>{g(t);g(n);if(Object.hasOwn(ai,t)){const e=ai[t].indexOf(n);if(e!==-1){ai[t].splice(e,1)}}};const ui=t=>{g(t);return ai[t]||[]};const fi=async(t,n,...e)=>{g(t);w(n);const o=ui(t);const s=o.map(async t=>{try{const o=$n(t);if(o){await o.invoke(n,...e)}}catch(n){console.warn(`Failed to notify listener ${t}:`,n)}});await Promise.all(s)};const hi=(t,n,e=t.columnWidth)=>{const o=n.x??t.x;const s=n.y??t.y;const c=n.width??t.width;const r=n.height??t.height;const i=Math.floor(r/t.itemHeight);const a=t.lines.length;const d=Math.max(a-i,0);const l=d*t.itemHeight;const u=Math.min(t.deltaY,l);const f=Math.floor(u/t.itemHeight);const h=Math.min(f+i,a);const g=a*t.rowHeight;const m=jr(r,g,t.minimumSliderSize);return{...t,columnWidth:e,deltaY:u,finalDeltaY:l,finalY:d,height:r,maxLineY:h,minLineY:f,numberOfVisibleLines:i,scrollBarHeight:m,width:c,x:o,y:s}};const gi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:mi}=Ro;const wi=async t=>{try{await mi("Main.handleModifiedStatusChange",t,true)}catch{}};const pi=(t,n)=>{const e=t[n];const o=t[n+1];const s=t[n+2];const c=t[n+3];if(e>s||e===s&&o>=c){return[s,c,e,o,1]}return[e,o,s,c,0]};const yi=t=>{let n=0;for(const e of t){if(e===yr){n++}}return n};const xi=/^\p{ASCII}*$/u;const Ei=t=>xi.test(t);const Ii=async(t,n)=>t.length*n;const ki=async(t,n,e,o,s,c,r)=>{const i=await wo("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Si=async(t,n,e,o,s,c,r)=>{if(c&&Ei(t)){return await Ii(t,r)}return await ki(t,n,e,o,s,c,r)};const Ci=async(t,n,e,o,s,c,r,i,a,d,l,u=0)=>{if(!t){return 0}w(t);g(i);g(a);g(d);p(c);g(l);g(u);if(n===0){return 0}if(n*l>d){return d}const f=Er(t);const h=xr(t,f,i);const m=yi(t.slice(0,n));const y=h.slice(0,n+m);const x=await Si(y,e,o,s,r,c,l);return x-a+u};const vi=(t,n,e)=>(t-n)*e;const bi=t=>`${t}px`;const Mi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Ai=t=>new Uint32Array(t);const Li=t=>Ai(t.length);const Pi=(t,n)=>{const e=Li(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=pi(t,o);n(e,o,s,c,r,i)}return e};const Fi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n(o,s,c,r)}};const Wi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Ti=(t,n,e,o)=>t===e&&n===o;const Ri=(t,n,e,o)=>t===e;const Di=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(!n(o,s,c,r)){return false}}return true};const Oi=t=>Di(t,Ti);const Bi=t=>Di(t,Ri);const Ni=(t,n)=>{const e=Ai(t.length*4);let o=0;for(const s of t){const{end:t,start:c}=n(s);e[o++]=c.rowIndex;e[o++]=c.columnIndex;e[o++]=t.rowIndex;e[o++]=t.columnIndex}return e};const Hi=[];const zi=(t,n)=>{if(!n){return Hi}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${bi(o)} ${bi(s)}`)}return e};const Ui=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push(bi(o),bi(s),bi(c),bi(r))}return n};const $i=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const x=o;const E=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=pi(w,t);if(r<g||o>h){continue}const S=r-g;const C=c[S];const v=f[r];const b=await Ci(v,I,d,a,i,l,u,p,E,y,x,C);const M=vi(r,g,m);if(Ti(o,s,r,I)&&b>0){n.push(b,M);continue}const A=vi(o,g,m);const L=o-g;const P=c[L];if(o===r){const t=await Ci(v,s,d,a,i,l,u,p,E,y,x,P);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,A,o,m)}else{if(o>=g){const t=f[o];const c=await Ci(t,s,d,a,i,l,u,p,E,y,x,P);const r=await Ci(t,t.length,d,a,i,l,u,p,E,y,x,P);const h=vi(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=vi(n,g,m);const s=n-g;const r=c[s];const h=await Ci(t,t.length,d,a,i,l,u,p,E,y,x,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:zi(n,r),selectionInfos:Ui(e)}};const _i=t=>{const{inserted:n,start:e}=t;const o=e.rowIndex;const s=e.columnIndex;const c=n.length;if(c===1){const t={columnIndex:n.at(-1).length+s,rowIndex:o+c-1};return{end:t,start:t}}const r={columnIndex:s,rowIndex:o+c-1};return{end:r,start:r}};const Yi=(t,n)=>{h(t);return{...t,selections:n}};const Vi=(t,n)=>{h(t);m(n);const e=Ni(n,_i);return e};const ji=(t,n)=>Kr(t,n);const qi=(t,n)=>ji(t,t.deltaY+n);const Gi=t=>t.origin===Es;const Xi=(t,n)=>{const{autoClosingRanges:e=[]}=t;const o=[];const s=n[0];const c=s.start.rowIndex;const r=s.start.columnIndex;const i=s.end.rowIndex;const a=s.end.columnIndex;for(let t=0;t<e.length;t+=4){const n=e[t];const d=e[t+1];const l=e[t+2];const u=e[t+3];if(i===l&&a===u||c===n&&r>=d&&i===l&&a<=u){const t=s.inserted[0].length-s.deleted[0].length;o.push(n,d,l,u+t)}}if(Gi(s)){o.push(c,r+1,i,a+1)}return o};const Zi=(t,n)=>Yi(t,n);const Qi=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=br(t,n);const s={...t,lines:o};const c=e||Vi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=Xi(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=ci(a);const l={...a,decorations:d};ts(t.uid,t,l);if(!t.modified){await wi(t.uri)}try{await fi(ii,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await Jr(t,l);const f=await Ts(l,n);const g={...l,...f,incrementalEdits:u};if(u!==ns){return g}const w=Qr();const{differences:p,textInfos:y}=await _r(g,w);return{...g,differences:p,textInfos:y}};const Ki=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=br(t,n);const o={...t,lines:e};const s=Vi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await Jr(t,r);const a={...r,incrementalEdits:i};if(i!==ns){return a}const d=Qr();const{differences:l,textInfos:u}=await _r(a,d);return{...a,differences:l,textInfos:u}};const Ji=async(t,n)=>{const e=br(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await Jr(t,s);const r={...s,incrementalEdits:c};if(c!==ns){return r}const i=Qr();const{differences:a,textInfos:d}=await _r(r,i);return{...r,differences:a,textInfos:d}};const ta=t=>t.selections&&t.selections.length>0;const na=(t,n,e,o,s,c)=>hi(t,{height:s,width:o,x:n,y:e},c);const ea=(t,n)=>{const e=gi(n);const{itemHeight:o,minimumSliderSize:s,numberOfVisibleLines:c}=t;const r=e.length;const i=Math.min(c,r);const a=Math.max(r-c,0);const d=a*o;const l=e.length*t.rowHeight;const u=jr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const oa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:ns,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const sa="ExtensionHostHover.execute";const ca="ExtensionHost.executeTabCompletionProvider";const ra="ExtensionHostTextDocument.syncFull";const{invoke:ia,set:aa}=ao;const da=t=>{w(t);return t.lastIndexOf(hr)};const la=(t,n)=>t.lastIndexOf(hr,n);const ua=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const fa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ha=(t,n)=>{w(t);const e=da(t);const o=t.slice(e);const s=o.toLowerCase();const c=ua(n,s);if(c){return c}const r=t.toLowerCase();const i=la(t,e-1);const a=t.slice(i);const d=ua(n,a);if(d){return d}const l=fa(n,r);if(l){return l}return"unknown"};const ga=async(t,n)=>{g(t);w(n);const e=await fo(t,n);return e};const ma=async(t,n,e,o)=>await Si("a",t,n,e,o,false,0);const wa=async t=>{const n=await Fo(t);return n};const pa="onDiagnostic";const ya="onHover";const xa="onTabCompletion";const Ea=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await Ho(a,n,i);const d=await ia(s,e.uid,...t);return d};const Ia=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Ar(t),uri:t.uri});const ka=async t=>{const n=Ia(t);return lo("Extensions.executeDiagnosticProvider",n)};const Sa=async t=>{const n=await ka(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Ea({args:[],assetDir:e,editor:t,event:pa,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const Ca=t=>t.type;const va=async(t,n)=>{const e=[];const{charWidth:o,fontFamily:s,fontSize:c,fontWeight:r,isMonospaceFont:i,letterSpacing:a,lines:d,minLineY:l,rowHeight:u,tabSize:f,width:h}=t;for(const t of n){const{columnIndex:n,endColumnIndex:g,rowIndex:m}=t;const w=g-n;const p=w*o;const y=0;const x=0;const E=await Ci(d[m],n,r,c,s,i,a,f,x,h,o,y);const I=vi(m,l,u)-u;e.push({height:u,type:Ca(t),width:p,x:E,y:I})}return e};const ba=(t,n)=>{const e=ci(t);const o=[...e,...n];const s=[];for(let t=0;t<o.length;t+=4){s.push({length:o[t+1],modifiers:o[t+3],offset:o[t],type:o[t+2]})}s.sort((t,n)=>t.offset-n.offset);const c=[];for(const t of s){c.push(t.offset,t.length,t.type,t.modifiers)}return c};const Ma=async t=>{try{const n=Ar(t);await ia(ra,t.uri,t.id,t.languageId,n);const e=await Sa(t);const o=Ko(t.id);if(!o){return t}const s=await va(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=ba(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ts(t.id,o.oldState,i);await yo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const Aa=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:x,letterSpacing:E,lineNumbers:I,lineToReveal:k,links:S,platform:C,rowHeight:v,savedDeltaY:b,savedSelections:M,tabSize:A,uri:L,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await ma(i,r,c,E);const D=await ga(C,t);const O=ha(L,D);const B={assetDir:t,charWidth:R,columnWidth:0,completionState:"",completionTriggerCharacters:e,completionUid:0,cursorInfos:[],cursorWidth:2,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:s,differences:[],finalDeltaY:0,finalY:0,focused:false,focusKey:ss,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:ns,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:O,letterSpacing:E,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:C,primarySelectionIndex:0,redoStack:[],rowHeight:v,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:A,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:L,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const N=na(B,W,T,F,d,9);const H=ea(N,o);let z;if(k&&n){const t=k*v;z=await Kr(H,t)}else{z=await Kr(H,0)}const U=ci(z);const $={...z,decorations:U};const _=Qr();const{differences:Y,textInfos:V}=await _r($,_);const j={...$,differences:Y,focus:co,focused:true,textInfos:V};ts(u,oa,j);await ia(ra,L,u,x,o);if(s){await Ma(j)}const q=await wa("editor.completionsOnType");const G=Boolean(q);ts(u,oa,{...j,completionsOnType:G})};const La=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.deltaX===n.deltaX&&t.longestLineWidth===n.longestLineWidth&&t.minimumSliderSize===n.minimumSliderSize&&t.width===n.width&&t.scrollBarHeight===n.scrollBarHeight;const Pa=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Fa=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.selectionInfos===n.selectionInfos;const Wa=6;const Ta=7;const Ra=11;const Da=12;const Oa=13;const Ba=(t,n)=>t.widgets===n.widgets;const Na=[Fa,Pa,Pa,La,Ba];const Ha=[Da,Wa,Ta,Ra,Oa];const za=(t,n)=>{const e=[];for(let o=0;o<Na.length;o++){const s=Na[o];if(!s(t,n)){e.push(Ha[o])}}return e};const Ua=t=>{const{newState:n,oldState:e}=Ko(t);const o=za(e,n);return o};const $a=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(e===0&&o!==0){n.push(o-1,s,o-1,s)}n.push(o,s,c,r)}return new Uint32Array(n)};const _a=t=>{const{selections:n}=t;const e=$a(n);return{...t,selections:e}};const Ya=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];e.push(s,c,r,i);if(o===t.length-4&&r<n){e.push(r+1,i,r+1,i)}}return new Uint32Array(e)};const Va=t=>{const{lines:n,selections:e}=t;const o=Ya(e,n.length);return{...t,selections:o}};const ja=(t,n)=>{const e=[];for(const o of n){const n=Wr(t,o.startOffset);const s=Wr(t,o.endOffset);const c=Lr(t,{end:s,start:n});const r={deleted:c,end:s,inserted:gi(o.inserted),origin:Is,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const qa=(...t)=>{console.warn(...t)};const Ga=(...t)=>{console.error(...t)};const Xa=(t,n)=>{if(!Array.isArray(n)){qa("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=ja(t,n);return Qi(t,e)};const Za=async(t,n)=>{h(t);m(n);return Qi(t,n)};const Qa=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Wr(t,n.offset);const s=Wr(t,n.offset+n.deleted);const c=Lr(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:bs,start:o};e.push(r)}}}return e};const Ka=async(t,n)=>{h(t);m(n);const e=Qa(t,n);if(e.length===0){return t}return Qi(t,e)};const Ja=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const td=(t,n,e,o)=>{const s=[];const c=n.length;for(let r=0;r<c;r+=4){const[c,i,a,d]=pi(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Lr(t,f),end:u,inserted:e,origin:o,start:l})}return s};const nd=(t,n,e)=>{const{selections:o}=t;return td(t,o,n,e)};const ed=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Si(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const od=()=>"Segmenter"in Intl;const sd=()=>{const t=new Intl.Segmenter;return{at(n,e){const o=t.segment(n);return o.containing(e)},getSegments:n=>t.segment(n),modelIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(s>=e){return t.index}s++}return n.length},visualIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(t.index>=e){return s}s++}return s}}};const cd=async(t,n,e,o,s,c,r,i)=>{const a=sd();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Si(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const rd=(t,n)=>{const e=Math.round(t/n);return e};const id=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===yr){o-=e-1}}return o};const ad=async(t,n,e,o,s,c,r,i,a)=>{w(t);g(n);g(e);w(o);g(s);p(c);g(r);g(i);g(a);const d=rd(a,r);const l=Er(t);const u=id(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Si(h,n,e,o,s,c,r);const y=Ei(t);if(y){if(Math.abs(a-m)<r/2){return u}return await ed(t,u,r,a,n,e,o,s,c,r)}return await cd(t,u,r,a,n,e,o,s)};const dd=async(t,n,e)=>{h(t);g(n);g(e);const{charWidth:o,deltaX:s,deltaY:c,fontFamily:r,fontSize:i,fontWeight:a,isMonospaceFont:d,letterSpacing:l,lines:u,rowHeight:f,tabSize:m,x:w,y:p}=t;const y=Math.floor((e-p+c)/f);if(y<0){return{columnIndex:0,rowIndex:0}}const x=n-w+s;const E=Rs(y,0,u.length-1);const I=u[E];const k=await ad(I,a,i,r,l,d,o,m,x);return{columnIndex:k,rowIndex:E}};const ld=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const ud=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const fd={timeout:-1};const hd=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=ld(t,n,e);const r=ud(t,n);const i=o;await yo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{md(t)};fd.timeout=setTimeout(n,3e3)}return t};const gd=async(t,n,e,o)=>hd(t,n,e,o,true);const md=async t=>{clearTimeout(fd.timeout);fd.timeout=-1;return t};const wd=String;const pd=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const yd=async(t,n)=>{try{const e=Fr(t,t.cursor);const o=await yo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=pd(n);const o=n+e;const s=nd(t,[o],xs);return Qi(t,s)}const s=nd(t,[n],xs);return Qi(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return gd(t,e,wd(n))}};const xd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Ai(4);Wi(e,0,n[0],n[1]);return Zi(t,e)};const Ed=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const Id=(t,n)=>{const e=Ed(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const kd=t=>t.id===Fe;const Sd=t=>{const{widgets:n}=t;const e=n.findIndex(kd);if(e===-1){return t}const o=Id(n,Fe);return{...t,focused:true,widgets:o}};const Cd=t=>t.id===De;const vd=t=>{const{widgets:n}=t;const e=n.findIndex(Cd);if(e===-1){return t}const o=Id(n,De);return{...t,focused:true,widgets:o}};const bd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await $o(t,n);await e.invoke("Rename.initialize");return e};const Md={};const Ad=()=>{if(!Md.workerPromise){Md.workerPromise=bd()}return Md.workerPromise};const Ld=async(t,...n)=>{const e=await Ad();return await e.invoke(t,...n)};const Pd=t=>t.id===Be;const Fd=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Pd);if(o===-1){return t}const s=e[o];await Ld("Rename.close",s.newState.uid);const c=Ko(n);const{newState:r}=c;return r};const Wd=t=>t.id===Ne;const Td=t=>{const{widgets:n}=t;const e=n.findIndex(Wd);if(e===-1){return t}const o=Id(n,Ne);return{...t,widgets:o}};const Rd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Dd=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Rd(r,t)){return e}const i=o();i.newState.editorUid=e.uid;const a=await s(i.newState,e.uid);a.editorUid=e.uid;const d={...i,newState:a};const l=[...r,d];const u=!c;const f={...e,additionalFocus:c?0:n,focus:c?n:co,focused:u,widgets:l};return f};const Od=()=>Math.random();const Bd=()=>{const t=Od();const n={id:We,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const Nd=(t,n)=>qo(t,n);const Hd=async t=>Dd(We,es,t,Bd,Nd);const zd={compositionText:"",isComposing:false};const Ud=(t,n)=>{zd.isComposing=true;return t};const $d=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];const a=c-zd.compositionText.length;e.push({deleted:[zd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:us,start:{columnIndex:a,rowIndex:s}})}return e};const _d=(t,n)=>{const{selections:e}=t;const o=$d(e,n);zd.compositionText=n;return Qi(t,o)};const Yd=(t,n)=>{const{selections:e}=t;const o=$d(e,n);zd.isComposing=false;zd.compositionText="";return Qi(t,o)};const Vd=async t=>{try{w(t);await bo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const jd=(t,n,e,o,s,c)=>{if(n){const n=t[s].length;return{end:{columnIndex:n,rowIndex:e},start:{columnIndex:0,rowIndex:e}}}return{end:{columnIndex:c,rowIndex:s},start:{columnIndex:o,rowIndex:e}}};const qd=(t,n,e,o)=>t===e&&n===o;const Gd=async t=>{if(!ta(t)){return t}const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=e[2];const r=e[3];const i=qd(o,s,c,r);const a=jd(n,i,o,s,c,r);const d=Lr(t,a);const l=Sr(d);const u=i?"\n"+l:l;await Vd(u);return t};const Xd=t=>{const{selections:n}=t;const e=[];for(let t=0;t<n.length;t+=4){const o=n[t];g(o);e.push(o)}const o=[...new Set(e)].toSorted((t,n)=>t-n);const s=o.map(n=>{const e={columnIndex:0,rowIndex:n};return{deleted:[""],end:e,inserted:[Mr(t,n),""],start:e}});const c=new Uint32Array(o.length*4);for(let t=0;t<o.length;t++){const n=o[t]+t+1;c[t*4]=n;c[t*4+1]=0;c[t*4+2]=n;c[t*4+3]=0}return Qi(t,s,c)};const Zd=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Mr(t,e),""],start:o}];return Qi(t,s)};const Qd=(t,n,e,o)=>{if(n===0){if(t===0){return{columnIndex:0,rowIndex:0}}return{columnIndex:e[t-1].length,rowIndex:t-1}}const s=o(e[t],n);return{columnIndex:n-s,rowIndex:t}};const Kd=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const Jd=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const tl=(t,n,e,o,s,c)=>{if(o===0){if(e===0){t[n]=0;t[n+1]=0}else{t[n]=e-1;t[n+1]=s[e-1].length}}else{const r=c(s[e],o);t[n]=e;t[n+1]=o-r}};const nl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);if(c===i&&r===a){if(c===0&&r===0){o[s]=0;o[s+1]=0;o[s+2]=0;o[s+3]=0}else{tl(o,s,c,r,n,e);tl(o,s+2,c,r,n,e)}}else{Jd(o,s,t[s],t[s+1])}}return o};const el=(t,n)=>{const{lines:e,selections:o}=t;const s=nl(o,e,n);return Zi(t,s)};const ol=(t,n)=>{if(!od()){return 1}if(n>t.length){return 1}const e=sd();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const sl=()=>2;const cl=(t,n)=>{if(!od()){return 1}const e=sd();const o=e.at(t,n);return o.segment.length};const rl=t=>t===pr||t===yr;const il=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!rl(t[e])){return n-e}}return n};const al=(t,n)=>t.length-n;const dl=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const ll=/(?<![A-Z])[A-Z]+\s*$/;const ul=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const fl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const hl=/\s+$/;const gl=/[^a-zA-Z\d]+\s*$/;const ml=[ll,ul,fl,hl,gl];const wl=(t,n)=>{const e=t.slice(0,n);return dl(e,ml)};const pl=/^\s*[\u{C0}-\u{17F}\w]+/iu;const yl=/^[^a-zA-Z\d]+\w*/;const xl=[pl,yl];const El=(t,n)=>{const e=t.slice(n);return dl(e,xl)};const Il=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const kl=/(?=[A-Z]+)[A-Z][a-z]+$/;const Sl=/[A-Z]+[a-z]+\d?\s*$/;const Cl=/[A-Z]+\d*\s*$/;const vl=/[a-z]+\d*\s*$/;const bl=/[A-Z]*[a-z]+_+\s*$/;const Ml=/(?<![A-Z])[A-Z]_+\s*$/;const Al=/[a-z]+\s*$/;const Ll=/[^a-zA-Z\d\s]+\s*$/;const Pl=[Il,kl,Sl,Cl,vl,bl,Ml,Al,Ll];const Fl=(t,n)=>{const e=t.slice(0,n);return dl(e,Pl)};const Wl=/^\s*[a-z]+\d?/;const Tl=/^\s*[A-Z]{2}[a-z\d]+/;const Rl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Dl=/^\s*[A-Z]+[a-z]*\d*/;const Ol=/^\s*_+[a-z]*\d?/;const Bl=/^\s*[^\da-zA-Z\s]+/;const Nl=[Wl,Rl,Dl,Ol,Bl];const Hl=[Wl,Tl,Rl,Dl,Ol,Bl];const zl=/[A-Z]/;const Ul=(t,n)=>{const e=t.slice(n);if(zl.test(t[n-1])){return dl(e,Nl)}return dl(e,Hl)};const $l=t=>el(t,ol);const _l=(t,n,e)=>{const{rowIndex:o}=t;const{columnIndex:s}=t;if(s>=n[o].length){if(o>=n.length){return t}return{columnIndex:0,rowIndex:o+1}}const c=e(n[o],s);return{columnIndex:s+c,rowIndex:o}};const Yl=(t,n,e,o,s,c)=>{if(e>=s.length){return}const r=s[e];if(o>=r.length){t[n]=t[n+2]=e+1;t[n+1]=t[n+3]=0}else{const s=c(r,o);t[n]=t[n+2]=e;t[n+1]=t[n+3]=o+s}};const Vl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);if(c===i&&r===a){Yl(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const jl=(t,n)=>{const{lines:e,selections:o}=t;const s=Vl(o,e,n);return Zi(t,s)};const ql=t=>jl(t,cl);const Gl=(t,n,e,o,s,c)=>{Wi(t,n,s+1,c)};const Xl=t=>Pi(t,Gl);const Zl=t=>{const{selections:n}=t;const e=Xl(n);return Zi(t,e)};const Ql=t=>jl(t,al);const Kl=t=>el(t,il);const Jl=(t,n,e)=>{h(t);g(n);g(e);const o=Mi(n,e,n,e);return Zi(t,o)};const tu=(t,n,e,o,s,c)=>{if(e===0){Wi(t,n,0,0)}else{Wi(t,n,e-1,o)}};const nu=t=>Pi(t,tu);const eu=(t,n,e,o)=>{const{selections:s}=t;const c=nu(s);return Zi(t,c)};const ou=t=>eu(t);const su=t=>el(t,wl);const cu=t=>el(t,Fl);const ru=t=>jl(t,Ul);const iu=t=>jl(t,El);const au=async t=>{const{lines:n,selections:e}=t;const[o]=e;const s=n[o];const c=new Uint32Array([o,0,o,s.length]);const r=td(t,c,[""],ws);const i=new Uint32Array([o,0,o,0]);await Vd(s);return Qi(t,r,i)};const du=async t=>{const{selections:n}=t;const[e,o,s,c]=n;const r=nd(t,[""],ws);const i=new Uint32Array([e,o,s,c]);const a=Sr(r[0].deleted);await Vd(a);return Qi(t,r,i)};const lu=async t=>{const{selections:n}=t;const[e,o,s,c]=n;if(Ti(e,o,s,c)){return au(t)}return du(t)};const uu=t=>{const{lines:n}=t;const e=n.length-1;const o=n.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Lr(t,{end:c,start:s}),end:c,inserted:[""],origin:hs,start:s}];return Qi(t,r)};const fu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=Qd(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Lr({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ms,start:i})};Fi(n,s);return o};const hu=(t,n,e,o,s)=>{if(!Ti(n,e,o,s)){return false}if(e<1){return false}for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];if(n===s&&e===c){return true}}return false};const gu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=pi(n,e);if(!hu(t,o,s,c,r)){return false}}return true};const mu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=fu(n,e,sl);return Qi(t,o)};const wu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(gu(e,s)){return mu(t)}if(Oi(s)){const e=fu(o,s,n);return Qi(t,e)}const c=nd(t,[""],ms);return Qi(t,c)};const pu=t=>wu(t,il);const yu=(t,n)=>{const{selections:e}=t;if(Oi(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=pi(e,c);const a={columnIndex:i,rowIndex:r};const d=_l(a,s,n);o.push({deleted:Lr(t,{end:d,start:a}),end:d,inserted:[""],origin:gs,start:a})}return o}const o=nd(t,[""],gs);return o};const xu=(t,n)=>{const e=yu(t,n);return Qi(t,e)};const Eu=t=>xu(t,al);const Iu=t=>{const n=wu(t,ol);return n};const ku=t=>xu(t,cl);const Su=t=>{const n=wu(t,wl);return n};const Cu=t=>{const n=wu(t,Fl);return n};const vu=t=>xu(t,Ul);const bu=t=>xu(t,El);const Mu=async t=>{await yo("SideBar.show","References",true);return t};const Au=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Ar(t),uri:t.uri};return lo("Extensions.executeFormattingProvider",n)};const Lu="Failed to execute formatting provider: FormattingError:";const Pu=t=>t&&t instanceof Error&&t.message.startsWith(Lu);const Fu="Failed to execute formatting provider: FormattingError:";const Wu=async t=>{try{const n=await Au(t);return Xa(t,n)}catch(n){if(Pu(n)){console.error("Formatting Error:",n.message.slice(Fu.length));return t}console.error(n);const e=String(n);await hd(t,0,0,e,true);return t}};const Tu=/^[\w\-]+/;const Ru=/[\w\-]+$/;const Du=(t,n)=>{const e=t.slice(0,n);const o=e.match(Ru);const s=t.slice(n);const c=s.match(Tu);let r=mr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const Ou=(t,n)=>{const e=t.slice(0,n);const o=e.match(Ru);if(o){return o[0]}return mr};const Bu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Du(s,e)};const Nu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Ou(s,e)};const Hu=async(t,n)=>{const e=await yo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const zu={};const Uu=/\{(PH\d+)\}/g;const $u=(t,n=zu)=>{if(n===zu){return t}const e=(t,e)=>n[e];return t.replaceAll(Uu,e)};const _u="Copy";const Yu="Cut";const Vu="Editor: Close Color Picker";const ju="Editor: Copy Line Down";const qu="Editor: Copy Line Up";const Gu="Editor: Format Document (forced)";const Xu="Editor: Go To Definition";const Zu="Editor: Go To Type Definition";const Qu="Editor: Indent";const Ku="Editor: Open Color Picker";const Ju="Editor: Select All Occurrences";const tf="Editor: Select Down";const nf="Editor: Select Inside String";const ef="Editor: Select Next Occurrence";const of="Editor: Select Up";const sf="Show Hover";const cf="Editor: Sort Lines Ascending";const rf="Editor: Toggle Comment";const af="Editor: Unindent";const df="Enter Code";const lf="Escape to close";const uf="Find All Implementations";const ff="Find All References";const hf="Format Document";const gf="Go to Definition";const mf="Go to Type Definition";const wf="Move Line Down";const pf="Move Line Up";const yf="No definition found";const xf="No definition found for '{PH1}'";const Ef="No type definition found";const If="No type definition found for '{PH1}'";const kf="Paste";const Sf="Source Action";const Cf="Toggle Block Comment";const vf=()=>$u(gf);const bf=()=>$u(yf);const Mf=t=>$u(xf,{PH1:t});const Af=t=>$u(If,{PH1:t});const Lf=()=>$u(Ef);const Pf=()=>$u(Sf);const Ff=()=>$u(lf);const Wf=()=>$u(df);const Tf=()=>$u(mf);const Rf=()=>$u(ff);const Df=()=>$u(uf);const Of=()=>$u(Yu);const Bf=()=>$u(_u);const Nf=()=>$u(kf);const Hf=()=>$u(Cf);const zf=()=>$u(pf);const Uf=()=>$u(wf);const $f=()=>$u(hf);const _f=()=>$u(sf);const Yf=()=>$u(Gu);const Vf=()=>$u(ef);const jf=()=>$u(Ju);const qf=()=>$u(Xu);const Gf=()=>$u(Zu);const Xf=()=>$u(nf);const Zf=()=>$u(Qu);const Qf=()=>$u(af);const Kf=()=>$u(cf);const Jf=()=>$u(rf);const th=()=>$u(of);const nh=()=>$u(tf);const eh=()=>$u(Ku);const oh=()=>$u(Vu);const sh=()=>$u(ju);const ch=()=>$u(qu);const rh=async({editor:t,getErrorMessage:n,getLocation:e,getNoLocationFoundMessage:o,isNoProviderFoundError:s})=>{const{selections:c}=t;const r=c[0];const i=c[1];try{const n=await e(t,r,i);if(!n){const n=Bu(t,r,i);const e=o(n);return hd(t,r,i,e,false)}if(typeof n.uri!=="string"||typeof n.startOffset!=="number"||typeof n.endOffset!=="number"){return t}const{uri:s}=n;if(s===t.uri){const e=Wr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return Zi(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await Wo(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await hd(t,r,i,o,false);return t}const o=n(e);await hd(t,r,i,o,true);return t}};const ih=async(t,n,e)=>{const o=Fr(t,n,e);const s=await Hu(t,o);return s};const ah=t=>{if(t.word){return Mf(t.word)}return bf()};const dh=String;const lh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const uh=async t=>rh({editor:t,getErrorMessage:dh,getLocation:ih,getNoLocationFoundMessage:ah,isNoProviderFoundError:lh});const fh=t=>{if(t.word){return Af(t.word)}return Lf()};const hh=async(t,n)=>{const e=await yo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const gh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await hh(t,o);return s};const mh=String;const wh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const ph=async(t,n=true)=>rh({editor:t,getErrorMessage:mh,getLocation:gh,getNoLocationFoundMessage:fh,isNoProviderFoundError:wh});const yh=t=>{switch(t){case De:return true;default:return false}};const xh=t=>{if(t.length===0){return t}return t.filter(yh)};const Eh=async(t,n)=>{await mo(t,n)};const Ih=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Fr(t,s,o);const r=ri(t,c);if(r){await Eh(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await uh(i);return a};const kh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=pi(e,o);if(s===n.rowIndex&&c===n.columnIndex&&r===n.rowIndex&&i===n.columnIndex){const n=new Uint32Array(e.length-4);n.set(e.subarray(0,o),0);n.set(e.subarray(o+4),o);return Zi(t,n)}}const o=new Uint32Array(e.length+4);o.set(e,0);const s=e.length;o[s]=n.rowIndex;o[s+1]=n.columnIndex;o[s+2]=n.rowIndex;o[s+3]=n.columnIndex;return Zi(t,o)};const Sh=1;const Ch=2;const vh=(t,n)=>{const e=xh(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const bh=t=>{switch(t){case Ch:return Ih;case Sh:return kh;default:return vh}};const Mh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=bh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Ah=3;const Lh=async(t,n,e,o)=>{const{uid:s}=t;await Io(s,Ah,e,o,{menuId:Ah});return t};const Ph=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Fh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Wh=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Fh);const r=s.match(Ph);const i=e-(c?c[0].length:0);const a=e+(r?r[0].length:0);const d=new Uint32Array([n,i,n,a]);return d};const Th=(t,n,e)=>{const o=Mr(t,n);const s=Wh(o,n,e);return Zi(t,s)};const Rh=async(t,n,e,o)=>{const s=await dd(t,e,o);return Th(t,s.rowIndex,s.columnIndex)};const Dh=t=>{if(t.focused&&t.focus===co){return t}return{...t,additionalFocus:0,focus:co,focused:true}};const Oh=1;const Bh=2;const Nh=3;const Hh=(t,n)=>{if(t){return Ch}if(n){return Sh}return 0};const zh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await dd(t,e,o);return Mh(t,n,s.rowIndex,s.columnIndex)};const Uh=(t,n)=>new Uint32Array([n,0,n,t.length]);const $h=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Mr(t,e);const s=Uh(o,e);return Zi(t,s)};const _h=(t,n,e,o)=>{h(t);g(e);g(o);return $h(t)};const Yh=async(t,n,e,o,s,c,r)=>{const i=Hh(e,o);let a;switch(r){case Bh:a=await Rh(t,i,s,c);break;case Oh:a=await zh(t,i,s,c);break;case Nh:a=_h(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Vh={editor:undefined,timeout:-1,x:0,y:0};const jh=()=>Vh;const qh=(t,n,e,o)=>{Vh.editor=t;Vh.timeout=n;Vh.x=e;Vh.y=o};const Gh=async(t,n)=>{};const Xh=async()=>{const{editor:t,x:n,y:e}=jh();await dd(t,n,e);await Gh()};const Zh=300;const Qh=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=jh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(Xh,Zh);qh(t,s,n,e);return t};const Kh=(t,n)=>{let e=0;for(let o=0;o<t.length;o++){const s=t[o];e+=s.length;if(e>=n){return o}}return-1};const Jh=async(t,n,e)=>{h(t);g(n);g(e);const o=await dd(t,n,e);const s=Fr(t,o.rowIndex,o.columnIndex);try{const n=await Hu(t,s);if(!n){return t}const e=Wr(t,n.startOffset);Wr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=Kh(o.tokens,e.columnIndex);if(c===-1){return t}return t}catch(n){if(n&&n.message.startsWith("Failed to execute definition provider: No definition provider found")){return t}throw n}};const tg=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const ng=(t,n,e)=>{const o=tg(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Lr(t,s),end:s.end,inserted:[n],origin:fs,start:s.start}];return c};const eg=(t,n,e)=>{const o=ng(t,n,e);return Qi(t,o)};const og=(t,n)=>{const e=tg(t,n);return Zi(t,e)};const sg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const cg=async(t,n,e,o,s,c,r)=>t;const rg=(t,n)=>t;const ig=async(t,n,e)=>{await dd(t,n,e)};const ag=t=>{globalThis.requestAnimationFrame(t)};const dg=(t,n)=>t.selections!==n.selections||t.focused!==n.focused||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.differences!==n.differences||t.charWidth!==n.charWidth||t.cursorWidth!==n.cursorWidth||t.fontFamily!==n.fontFamily||t.fontSize!==n.fontSize||t.fontWeight!==n.fontWeight||t.isMonospaceFont!==n.isMonospaceFont||t.letterSpacing!==n.letterSpacing||t.lines!==n.lines||t.rowHeight!==n.rowHeight||t.tabSize!==n.tabSize||t.width!==n.width;const lg=(t,n)=>{if(t.textInfos!==n.textInfos||t.differences!==n.differences){return false}return t.lines!==n.lines||t.tokenizerId!==n.tokenizerId||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.decorations!==n.decorations||t.embeds!==n.embeds||t.deltaX!==n.deltaX||t.width!==n.width||t.highlightedLine!==n.highlightedLine||t.debugEnabled!==n.debugEnabled};const ug=async(t,n)=>{let e=n;if(lg(t,n)){const t=Qr();const{differences:o,textInfos:s}=await _r(n,t);e={...n,differences:o,textInfos:s}}if(!dg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await $i(e);return{...e,cursorInfos:o,selectionInfos:s}};const fg=-1;const hg=0;const gg=1;const mg=(t,n)=>{if(t.rowIndex>n.rowIndex){return gg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return gg}if(t.columnIndex<n.columnIndex){return fg}return hg}return fg};const wg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const pg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const yg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const xg=(t,n)=>{switch(mg(n,t)){case hg:return pg(t,n);case gg:return yg(t,n);case fg:return wg(t,n);default:throw new Error("unexpected comparison result")}};const Eg=(t,n)=>{const e=t.selectionAnchorPosition;const o=xg(e,n);return Zi(t,o)};const Ig=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=e-o;if(n.rowIndex<o){const e=n.rowIndex;const o=n.rowIndex+c;const r=n.rowIndex*s;const i=t.selectionAnchorPosition;const a=new Uint32Array([n.rowIndex-1,n.columnIndex,i.rowIndex,i.columnIndex]);return{...t,deltaY:r,maxLineY:o,minLineY:e,selections:a}}if(n.rowIndex>e){const c=e-o;const r=n.rowIndex-c;const i=n.rowIndex;const a=r*s;const d=t.selectionAnchorPosition;const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const kg=async t=>{const n=Ko(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=Ig(e,o);if(e===s){return}const c=o.rowIndex<e.minLineY?-1:1;const r={...s,selectionAutoMovePosition:{columnIndex:o.columnIndex,rowIndex:o.rowIndex+c}};const i=await ug(e,r);ts(e.uid,e,i);ag(()=>kg(t))};const Sg=async(t,n,e)=>{h(t);g(n);g(e);const o=await dd(t,n,e);const s=Eg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){ag(()=>kg(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const Cg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return ig(t,n,e)}return Sg(t,n,e)};const vg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const bg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Mg=(t,n)=>{const{handleOffsetX:e,longestLineWidth:o,width:s,x:c}=t;if(s>o){return{...t,deltaX:0,scrollBarWidth:0}}const r=20;const i=Rs(n,c,c+s);const a=i-c-e;const d=qr(s,o);const l=o-s+r;const u=bg(s,d,a);const f=Rs(u,0,1);const h=f*l;return{...t,deltaX:h}};const Ag=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=qr(s,o);const a=s-i;const d=Yr(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Gr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Lg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Pg=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Lg(t,c);const i=r*e;const a=await ji(t,i);return a};const Fg=Pg;const Wg=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=Vr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Gr(s,c,i);const f=u*o;const h=await ji(t,f);return{...h,handleOffset:l}};const Tg=(t,n)=>{};const Rg={deltaY:0,touchOffsetY:0};const Dg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Rg.touchOffsetY=e.y;Rg.deltaY=t.deltaY};const Og=(t,n)=>qi(t,n);const Bg=(t,n)=>ji(t,n);const Ng=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Og(t,o)}const c=Rs(s+e,0,Infinity);return{...Og(t,o),deltaX:c}};const Hg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Rg.deltaY+(Rg.touchOffsetY-e.y);Bg(t,o)};const zg=(t,n,e,o)=>Ng(t,n,e,o);const Ug=t=>{const n=[];const e=[];for(let n=0;n<t.length;n+=4){const o=t[n];const s=t[n+2];for(let t=o;t<=s;t++){e.push(t)}}for(const t of e){n.push({deleted:[" "],end:{columnIndex:2,rowIndex:t},inserted:[""],origin:ks,start:{columnIndex:0,rowIndex:t}})}return n};const $g=t=>{const{selections:n}=t;const e=Ug(n);return Qi(t,e)};const _g=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+2];for(let t=o;t<=s;t++){n.push(t)}}const e=Array.from(n,t=>({deleted:[""],end:{columnIndex:0,rowIndex:t},inserted:[" "],origin:Ss,start:{columnIndex:0,rowIndex:t}}));return e};const Yg=t=>{const{selections:n}=t;const e=_g(n);return Qi(t,e)};const Vg=async t=>yo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const jg=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const qg=(t,n)=>{if(!n){return false}return n.test(t)};const Gg=(t,n,e)=>{const o=[];const s=[];const c=jg(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=pi(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(Ti(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=vr(e);if(qg(e,c)){o.push({deleted:Lr({lines:t},f),end:u,inserted:["",a+" ",a],origin:Cs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Lr({lines:t},f),end:u,inserted:["",a],origin:Cs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Lr({lines:t},f),end:u,inserted:["",""],origin:Cs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const Xg=async t=>{const{lines:n,selections:e}=t;const o=await Vg(t);const{changes:s,selectionChanges:c}=Gg(n,e,o);return Qi(t,s,c)};const Zg=2;const Qg=0;const Kg=()=>{const t=Od();const n={id:Fe,newState:{focused:true,focusSource:Zg,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:Qg,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const Jg=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const tm=async t=>{const n=true;return Dd(Fe,ds,t,Kg,Jg,n)};const nm=()=>{const t=Od();const n={id:Te,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const{invoke:em,setFactory:om}=No(je);const sm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await em("Completions.create",o,c,r,s,e,n,a);await em("Completions.loadContent",o);const d=await em("Completions.diff2",o);const l=await em("Completions.render2",o,d);return{...t,commands:l}};const cm=async t=>{const n=false;return Dd(Te,os,t,nm,sm,n)};const rm=()=>{const t=Od();const n={id:De,newState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0}};return n};const im=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return $o(t,n)};const am=9002;const dm=async()=>{if($n(am)){return}const t=await im();Un(am,t)};const lm=async(t,...n)=>{const e=$n(am);return await e.invoke(t,...n)};const um=async()=>{const t=$n(am);_n(am);if(t){await t.dispose()}};const fm=t=>{const n=Ko(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const hm=async(t,n)=>{const{uid:e}=t;const o=fm(n);const{height:s,width:c,x:r,y:i}=o;await dm();await lm("FindWidget.create",e,r,i,c,s,n);await lm("FindWidget.loadContent",e);const a=await lm("FindWidget.diff2",e);const d=await lm("FindWidget.render2",e,a);return{...t,commands:d}};const gm=(t,n)=>hm(t,n);const mm=async t=>{const n=true;return Dd(De,cs,t,rm,gm,n)};const wm=async t=>mm(t);const pm=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=ld(t,e,o);const c=ud(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const ym=()=>{const t=Od();const n={id:Be,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const xm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Ld("Rename.create",o,c,r,s,e,n,a);await Ld("Rename.loadContent",o);const d=await Ld("Rename.diff2",o);const l=await Ld("Rename.render2",o,d);return{...t,commands:l}};const Em=async t=>{const{columnIndex:n,rowIndex:e}=pm(t);const{word:o}=Bu(t,e,n);if(!o){return t}const s=true;return Dd(Be,is,t,ym,xm,s)};const Im=async t=>{const n=await Ea({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const km=async t=>{const n=await Im(t);return Xa(t,n)};const Sm=(t,n)=>{const e=gi(n);const o=nd(t,e,ps);return Qi(t,o)};const Cm=async t=>{const n=await Mo();w(n);return Sm(t,n)};const vm=t=>{const{redoStack:n=[]}=t;if(n.length===0){return t}const e=n.at(-1);const o={...t,redoStack:n.slice(0,-1),undoStack:[...t.undoStack,e]};return Ki(o,e)};const bm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Mm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=bm(t);if(t.codeFrame){return{codeFrame:t.codeFrame,message:n,stack:t.stack,type:t.constructor.name}}return{category:t.category,codeFrame:t.originalCodeFrame,message:n,stack:t.originalStack,stderr:t.stderr}};const Am=/\((.*):(\d+):(\d+)\)$/;const Lm=/at (.*):(\d+):(\d+)$/;const Pm=t=>{for(const n of t){if(Am.test(n)||Lm.test(n)){return n}}return""};const Fm=async t=>{try{const n=gi(t.stack);const e=Pm(n);let o=e.match(Am);if(!o){o=e.match(Lm)}if(!o){return t}const s=Sr(n.slice(1));const c=bm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Wm=async t=>{if(t&&t.message&&t.codeFrame){return Mm(t)}if(t&&t.stack){return Fm(t)}return t};const Tm=t=>{if(t&&t.type&&t.message&&t.codeFrame){return`${t.type}: ${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.message&&t.codeFrame){return`${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.type&&t.message){return`${t.type}: ${t.message}\n${t.stack}`}if(t&&t.stack){return t.stack}if(t===null){return null}return String(t)};const Rm=async t=>{const n=await Wm(t);const e=Tm(n);console.error(e);return n};const Dm=async t=>{try{await Rm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const Om=async t=>t;const Bm=t=>t.startsWith("untitled:");const Nm=async(t,n)=>{await yo("FileSystem.writeFile",t,n)};const Hm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await ho("Open.showSaveDialog",n,[],t);if(e){return""}return o};const zm=async(t,n,e)=>{const o=await Hm(e);if(!o){return}await yo("FileSystem.writeFile",o,n);await Co();await yo("Main.handleUriChange",t,o);return o};const Um=async t=>{try{const{platform:n,uri:e}=t;const o=await Om(t);const s=Ar(o);if(Bm(e)){const t=await zm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await Nm(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await Dm(e);return t}};const $m=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Mi(e,o,s,c);return Zi(t,r)};const _m=(t,n,e)=>{const o=Li(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);tl(o,s+2,c,r,n,e);Kd(o,s,i,a)}return o};const Ym=(t,n)=>{const{lines:e,selections:o}=t;const s=_m(o,e,n);return Zi(t,s)};const Vm=t=>{Ym(t,il)};const jm=/[a-zA-Z\d]/;const qm=t=>jm.test(t);const Gm=t=>qm(t)||t==="_";const Xm=(t,n)=>{for(let e=n-1;e>=0;e--){if(!Gm(t[e])){return e+1}}return 0};const Zm=(t,n)=>{for(let e=n;e<t.length;e++){if(!Gm(t[e])){return e}}return t.length};const Qm=(t,n,e)=>{const o=t[n];const s=Xm(o,e);const c=Zm(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const Km=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const Jm=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const tw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(Km(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const nw=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=Qm(t,c,r);if(e.start===e.end){return n}const o=Jm(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=Jm(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=tw(t,i);return a};const ew=t=>{const{lines:n,selections:e}=t;const o=nw(n,e);return Zi(t,o)};const ow=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);const d=n[i];o[s]=c;o[s+1]=r;if(a>=d.length){o[s+2]=i+1;o[s+3]=0}else{const t=e(d,a);o[s+2]=i;o[s+3]=a+t}}return o};const sw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=ow(o,e,n);return Zi(t,s)};const cw=t=>sw(t,al);const rw=t=>Ym(t,ol);const iw=t=>sw(t,cl);const aw=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=pi(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const dw=t=>{const{lines:n,selections:e}=t;const o=aw(n,e);return Zi(t,o)};const lw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=pi(n,o);if(s===r&&c===i){const n=s;let r=c;let a=i;const d=t[n];while(r>0&&d[r]!==gr){r--}r++;while(a<d.length&&d[a]!==gr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const uw=t=>{const{selections:n}=t;const{lines:e}=t;const o=lw(e,n);return Zi(t,o)};const fw=async(t,n)=>{const e=await yo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const hw=async t=>{const{selections:n}=t;const e=await fw(t,n);return Zi(t,e)};const gw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const mw=t=>{const{lines:n}=t;const{selections:e}=t;if(Oi(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=pi(e,o);const a=Qm(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if(Bi(t.selections)){return gw(t.lines,t.selections)}return undefined};const ww=(t,n,e,o)=>e>=t&&o<=n;const pw=t=>{const n=mw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(ww(t.minLineY,t.maxLineY,s,c)){return Zi(t,o)}return Qi(t,[],o)};const yw=t=>t;const xw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=pi(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const Ew=t=>{const{lines:n,selections:e}=t;const o=xw(n,e);return Zi(t,o)};const Iw=t=>Ym(t,wl);const kw=t=>sw(t,El);const Sw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Cw=async(t,n,e)=>{const{tokenizerId:o}=t;Gc(n,e);await nr(n,e);const s=er(n);const c=o+1;sr(c,s);const r=fm(t.uid);if(!r){return t}const i=Qr();const{differences:a,textInfos:d}=await _r(t,i);const l=fm(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const vw=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const bw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Lr(t,{end:c,start:s}),end:c,inserted:gi(n),origin:xs,start:s}];return Qi(t,r)};const Mw=()=>{const t=Od();const n={id:Oe,newState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0}};return n};const Aw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await $o(t,n,e);return o};const Lw={};const Pw=()=>{if(!Lw.workerPromise){Lw.workerPromise=Aw()}return Lw.workerPromise};const Fw=async(t,...n)=>{const e=await Pw();return await e.invoke(t,...n)};const Ww=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Fw("Hover.create",o,c,r,s,e,n,a);await Fw("Hover.loadContent",o);const d=await Fw("Hover.diff2",o);const l=await Fw("Hover.render2",o,d);return{...t,commands:l}};const Tw=async t=>{const n=false;return Dd(Oe,rs,t,Mw,Ww,n)};const Rw="EditorHover";const Dw=async t=>{await yo("Viewlet.openWidget",Rw);return t};const Ow=()=>{const t=Od();const n={id:Ne,newState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0}};return n};const Bw=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await $o(t,n,e);return o};const Nw={};const Hw=()=>{if(!Nw.workerPromise){Nw.workerPromise=Bw()}return Nw.workerPromise};const zw=async(t,...n)=>{const e=await Hw();return await e.invoke(t,...n)};const Uw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await zw("SourceActions.create",o,c,r,s,e,n,a);await zw("SourceActions.loadContent",o);const d=await zw("SourceActions.diff2",o);const l=await zw("SourceActions.render2",o,d);return{...t,commands:l}};const $w=async t=>Dd(Ne,as,t,Ow,Uw);const _w=(t,n)=>t.localeCompare(n);const Yw=t=>{const n=[...t];n.sort(_w);return n};const Vw="sort-lines-ascending";const jw=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=Yw(h);s.push({deleted:Lr({lines:t},f),end:u,inserted:g,origin:Vw,start:l})}return s};const qw=t=>{const{lines:n,selections:e}=t;const o=jw(n,e);return Qi(t,o)};const Gw=async(t,n)=>Ea({args:[n],editor:t,event:xa,method:ca,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const Xw=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Fr(t,e,o);return s};const Zw=async t=>{const n=Xw(t);const e=await Gw(t,n);return e};const Qw=(t,n,e)=>{const o=gi(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=pi(n,r);if(o.length>1){const n=Mr({lines:t},i);const r=vr(n);const u=[o[0],...o.slice(1).map(t=>r+t)];const f=[""];s.push({deleted:f,end:{columnIndex:l,rowIndex:d},inserted:u,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}});const h=o.at(-1);c.push(d+o.length-f.length,l+h.length,d+o.length-f.length,l+h.length)}else{const t=o[0];const n=t.indexOf("$0");if(n===-1){const t=a-e.deleted;c.push(i,t,i,t);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:o,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}else{const n=t.replace("$0","");const o=l+2;c.push(i,o,i,o);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:[n],origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const Kw=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=Qw(e,o,n);return Qi(t,s,c)};const Jw=String;const tp=async t=>{try{const n=await Zw(t);if(!n){return t}return Kw(t,n)}catch(n){await Dm(n);const e=t.selections[0];const o=t.selections[1];return gd(t,e,o,Jw(n))}};const np=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await Ho(`onLanguage:${t.languageId}`,e,o);const s=await ia(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Vg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const ep=/^\s+/;const op=/\s+$/;const sp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Ms,start:{columnIndex:n,rowIndex:t}});const cp=(t,n,e,o,s,c,r)=>{if(n===o){return[sp(t,e,c),sp(t,s-c.length,r)]}return[sp(n,e,c),sp(o,s,r)]};const rp=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Mr(t,o);const c=t.lines.length;let r=o;let i=-1;const a=n[0];const d=n[1];while(r<c){const n=Mr(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Mr(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...cp(o,u,l,r,i,a,d))}else{const t=s.match(ep);const n=s.match(op);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:Ms,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Ms,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const ip=async t=>{const n=Xw(t);const e=await np(t,n);if(!e){return t}const o=rp(t,e);return Ji(t,o)};const ap=async t=>{const n=await Vg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const dp=/^\s+/;const lp=(t,n,e)=>{const o=n.match(dp);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:vs,start:{columnIndex:s,rowIndex:t}}};const up=async t=>{const n=await ap(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Mr(e,o);const c=[lp(o,s,n)];return Qi(t,c)};const fp=async t=>{try{const n=await up(t);if(t!==n){return n}return ip(t)}catch(n){Ga(n);await hd(t,0,0,String(n),true);return t}};const hp=async(t,n)=>{const e=nd(t,[n],xs);const o=await Qi(t,e);if(o.completionsOnType){const t=await cm(o);return t}return o};const gp="/";const mp="{";const wp="}";const pp="(";const yp=")";const xp="[";const Ep="]";const Ip="???";const kp="'";const Sp='"';const Cp="`";const vp=t=>{switch(t){case mp:return wp;case pp:return yp;case xp:return Ep;default:return Ip}};const bp=(t,n)=>{const e=vp(n);const o=n+e;const s=nd(t,[o],Es);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return Qi(t,s,c)};const Mp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return Zi(t,e)};const Ap=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(gu(e,o)){return Mp(t)}return hp(t,n)};const Lp=(t,n)=>{const e=n+n;const o=nd(t,[e],Es);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return Qi(t,o,s)};const Pp=async(t,n)=>{const e=Fr(t,t.selections[0],t.selections[1]);const o=await yo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=nd(t,[n],xs);return Qi(t,e)}const s=nd(t,[o.inserted],xs);return Qi(t,s)};const Fp=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case gp:if(s){return Pp(t,n)}break;case wp:case yp:case Ep:if(e){return Ap(t,n)}break;case mp:case pp:case xp:if(e){return bp(t,n)}break;case Cp:case Sp:case kp:if(o){return Lp(t,n)}break}const c=hp(t,n);return c};const Wp=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const Tp=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Wp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return Ki(s,o)};const Rp=t=>t;const Dp=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const Op=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,Dp(t.id)]);c.push(...o);if(Dp(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const Bp=t=>{switch(t){case We:return jo;case Te:return em;case De:return lm;case Oe:return Fw;case Be:return Ld;case Ne:return zw;default:return undefined}};const Np="Close";const Hp=(t,n,e)=>{const o=t=>t.id===n;const s=t.widgets.findIndex(o);if(s===-1){return t}const c=t.widgets[s];const r={...c,newState:e,oldState:c.newState};const i=[...t.widgets.slice(0,s),r,...t.widgets.slice(s+1)];return{...t,widgets:i}};const zp=(t,n)=>{for(const e of Jo()){const o=Ko(Number(e)).newState;const s=o.widgets||[];for(const e of s){if(e.id===n&&e.newState.uid===t){return o}}}return undefined};const Up=(t,n)=>{if(t&&t.widgets){return t}const e=Ko(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return zp(t,n)};const $p=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(Np);const c=async(c,...r)=>{const i=Up(c,e);if(!i){return c}const a=i.widgets.findIndex(o);if(a===-1){return i}const d=i.widgets[a];const l=d.newState;const{uid:u}=l;const f=Bp(e);await f(`${n}.${t}`,u,...r);const h=await f(`${n}.diff2`,u);const g=await f(`${n}.render2`,u,h);const m=Ko(i.uid).newState;if(s(r)){const t={...m,focused:true,widgets:Id(m.widgets,e)};ts(i.uid,m,t);return t}const w={...l,commands:g};const p=Hp(m,e,w);ts(i.uid,m,p);return p};return c};const _p=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=$p(s,n,e)}return o};const Yp="Viewlet.appendToBody";const Vp="focus";const jp="Viewlet.registerEventListeners";const qp="Viewlet.setSelectionByName";const Gp="Viewlet.setValueByName";const Xp="Viewlet.setFocusContext";const Zp="setBounds";const Qp="Viewlet.setBounds";const Kp="Viewlet.setCss";const Jp="Viewlet.setDom2";const ty="Viewlet.setUid";const ny=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const ey=[Jp,Kp,Yp,Qp,jp,qp,Gp,Xp,ty,"Viewlet.focusSelector"];const oy=t=>{const n=ny(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(ey.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const sy=t=>Op(t,"EditorCompletion",oy);const cy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:ry,closeDetails:iy,focusFirst:ay,focusIndex:dy,focusLast:ly,focusNext:uy,focusPrevious:fy,handleEditorBlur:hy,handleEditorClick:gy,handleEditorDeleteLeft:my,handleEditorType:wy,handlePointerDown:py,handleWheel:yy,openDetails:xy,selectCurrent:Ey,selectIndex:Iy,toggleDetails:ky}=_p(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Sy={__proto__:null,add:sy,close:ry,closeDetails:iy,focusFirst:ay,focusIndex:dy,focusLast:ly,focusNext:uy,focusPrevious:fy,handleEditorBlur:hy,handleEditorClick:gy,handleEditorDeleteLeft:my,handleEditorType:wy,handlePointerDown:py,handleWheel:yy,openDetails:xy,remove:cy,render:oy,selectCurrent:Ey,selectIndex:Iy,toggleDetails:ky};const Cy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const vy=[Jp,Kp,Yp,Qp,jp,qp,Gp,Xp,ty,"Viewlet.focusSelector"];const by=t=>{const n=Cy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(vy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const My=t=>Op(t,"FindWidget",by);const Ay=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ly,focusCloseButton:Py,focusFind:Fy,focusNext:Wy,focusNextElement:Ty,focusNextMatchButton:Ry,focusPrevious:Dy,focusPreviousElement:Oy,focusPreviousMatchButton:By,focusReplace:Ny,focusReplaceAllButton:Hy,focusReplaceButton:zy,focusToggleReplace:Uy,handleBlur:$y,handleClickButton:_y,handleFocus:Yy,handleInput:Vy,handleReplaceFocus:jy,handleReplaceInput:qy,handleToggleReplaceFocus:Gy,replace:Xy,replaceAll:Zy,toggleMatchCase:Qy,toggleMatchWholeWord:Ky,togglePreserveCase:Jy,toggleReplace:tx,toggleUseRegularExpression:nx}=_p(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const ex={__proto__:null,add:My,close:Ly,focusCloseButton:Py,focusFind:Fy,focusNext:Wy,focusNextElement:Ty,focusNextMatchButton:Ry,focusPrevious:Dy,focusPreviousElement:Oy,focusPreviousMatchButton:By,focusReplace:Ny,focusReplaceAllButton:Hy,focusReplaceButton:zy,focusToggleReplace:Uy,handleBlur:$y,handleClickButton:_y,handleFocus:Yy,handleInput:Vy,handleReplaceFocus:jy,handleReplaceInput:qy,handleToggleReplaceFocus:Gy,remove:Ay,render:by,replace:Xy,replaceAll:Zy,toggleMatchCase:Qy,toggleMatchWholeWord:Ky,togglePreserveCase:Jy,toggleReplace:tx,toggleUseRegularExpression:nx};const ox=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Ar(t),uri:t.uri});const sx=async(t,n)=>{const e=ox(t);return lo("Extensions.executeHoverProvider",e,n)};const cx=async(t,n)=>{h(t);g(n);const e=await sx(t,n);if(e){return e}return Ea({args:[n],editor:t,event:ya,method:sa,noProviderFoundMessage:"No hover provider found"})};const rx=async(t,n)=>{h(t);g(n);const e=await cx(t,n);return e};const ix=async(t,n,e,o,s)=>100;const ax=(t,n,e)=>{const o=n.length;let s=0;let c=0;const r=[];for(let i=0;i<o;i+=2){const o=n[i];const a=n[i+1];s+=a;const d=t.slice(c,s);const l=`Token ${e[o]||"Unknown"}`;const u=d;r.push(u,l);c=s}return r};const dx=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Mc(c);for(const n of t){const t=Fc(e,r,n,a,s);const{tokens:c}=t;const d=ax(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const lx=async(t,n,e)=>{await nr(n,e);const o=er(n);const s=gi(t);const c=dx(s,o,n);return c};const ux=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const fx=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const hx="typescript";const gx=(t,n,e,o)=>{const s=ld(t,n,e);const c=t.height-ud(t,n)+t.y+40;return{x:s,y:c}};const mx=async(t,n)=>{g(t);const e=Ko(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=ux(n,s);const i=Fr(o,r,c);const a=await rx(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await lx(d,l||hx,f);const m=Nu(o,r,c);const w=c-m.length;await ix();const{x:p,y:y}=gx(o,r,w);const x=o.diagnostics||[];const E=fx(x,r);return{documentation:u,lineInfos:h,matchingDiagnostics:E,x:p,y:y}};const wx=async(t,n,e)=>{const o=await mx(t,e);if(!o){return n}const{documentation:s,lineInfos:c,matchingDiagnostics:r,x:i,y:a}=o;return{...n,diagnostics:r,documentation:s,lineInfos:c,x:i,y:a}};const px=(t,n,e)=>t;const yx=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const xx=(t,n,e)=>t;const Ex="CodeGeneratorInput";const Ix="CodeGeneratorMessage";const kx="CodeGeneratorWidget";const Sx="DiagnosticError";const Cx="DiagnosticWarning";const vx="CompletionDetailCloseButton";const bx="CompletionDetailContent";const Mx="Diagnostic";const Ax="EditorCursor";const Lx="EditorRow";const Px="EditorRowHighlighted";const Fx="EditorSelection";const Wx="HoverDisplayString";const Tx="HoverDocumentation";const Rx="HoverEditorRow";const Dx="HoverProblem";const Ox="HoverProblemDetail";const Bx="HoverProblemMessage";const Nx="IconClose";const Hx="InputBox";const zx="MaskIcon";const Ux="Viewlet";const $x=1;const _x=2;const Yx=9;const Vx=10;const jx=11;const qx=12;const Gx=13;const Xx=14;const Zx=15;const Qx=18;const Kx=19;const Jx=20;const tE=21;const nE=22;const eE=23;const oE=26;const sE=27;const cE=28;const rE=29;const iE=30;const aE=31;const dE=32;const lE=33;const uE=4;const fE=6;const hE=8;const gE=12;const mE=62;const wE=t=>({childCount:0,text:t,type:gE});const pE=t=>{const n=[{childCount:t.length/2,className:Rx,type:uE}];for(let e=0;e<t.length;e+=2){const o=t[e];const s=t[e+1];n.push({childCount:1,className:s,type:hE},wE(o))}return n};const yE=t=>{const n=t.flatMap(pE);return n};const xE={childCount:1,className:Bx,type:hE};const EE={childCount:1,className:Ox,type:hE};const IE=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const kE=(t,n,e)=>{const o=[];o.push({childCount:IE(t,n,e)+1,className:"Viewlet EditorHover",type:uE});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${Wx} ${Dx}`,type:uE});for(const t of e){o.push(xE,wE(t.message),EE,wE(`${t.source} (${t.code})`))}}if(t.length>0){const n=yE(t);o.push({childCount:t.length,className:Wx,type:uE},...n)}if(n){o.push({childCount:1,className:Tx,type:uE},wE(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:oE,type:uE});return o};const SE={apply(t,n){const e=kE(n.lineInfos,n.documentation,n.diagnostics);return[Jp,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const CE={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Zp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const vE=[SE,CE];const bE=(t,n)=>{const e=[];for(const o of vE){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const ME=[Jp,Kp,Yp,Qp,jp,qp,Gp,Xp,ty,"Viewlet.focusSelector"];const AE=t=>{const n=ny(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(ME.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const LE=t=>Op(t,"EditorRename",AE);const PE=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:FE,close:WE,handleInput:TE}=_p(["handleInput","close","accept"],"Rename",Be);const RE={__proto__:null,accept:FE,add:LE,close:WE,handleInput:TE,remove:PE,render:AE};const DE=t=>structuredClone(t);const OE=(t,n)=>{const e={...t,focusedIndex:n};return e};const BE=t=>{const n=t.focusedIndex+1;return OE(t,n)};const NE=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const HE=[Jp,Kp,Yp,Qp,jp,qp,Gp,Xp,ty,"Viewlet.focusSelector"];const zE=t=>{const n=ny(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(HE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const UE=t=>Op(t,"EditorSourceActions",zE);const $E=NE;const{close:_E,closeDetails:YE,focusFirst:VE,focusIndex:jE,focusLast:qE,focusNext:GE,focusPrevious:XE,handleWheel:ZE,selectCurrent:QE,selectIndex:KE,selectItem:JE,toggleDetails:tI}=_p(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const nI={__proto__:null,add:UE,close:_E,closeDetails:YE,focusFirst:VE,focusIndex:jE,focusLast:qE,focusNext:GE,focusPrevious:XE,handleWheel:ZE,remove:$E,render:zE,selectCurrent:QE,selectIndex:KE,selectItem:JE,toggleDetails:tI};const eI=async(t,n,e,o,s,...c)=>{const r=Bp(s);const i=e.slice(n.length+1);const a=t.widgets.find(t=>t.id===s);if(!a){return t}const{uid:d}=a.newState;g(d);await r(`${n}.${i}`,d,...c);const l=t=>t.id===s;const u=fm(t.uid);const f=u.widgets.findIndex(l);if(f===-1){return u}const h=await r(`${n}.diff2`,d);const m=await r(`${n}.render2`,d,h);const w=t.widgets.findIndex(l);if(w===-1){return u}const p=u.widgets[w];const y={...p.newState,commands:m};const x=Hp(u,s,y);return x};const oI=(t,n)=>t.filter(t=>t.languageId===n);const sI=async t=>{if(!t){return[]}const{newState:n}=Ko(t);const{languageId:e}=n;const o=await yo("GetEditorSourceActions.getEditorSourceActions");const s=oI(o,e);return s};const cI=/[\w\-]+$/;const rI=t=>{const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=n[o];const r=c.slice(0,s);const i=r.match(cI);if(i){return i[0]}return""};const iI=async t=>{await yo("Focus.setFocus",t)};const aI=async t=>{if(!t){return}await yo("Focus.removeAdditionalFocus",t)};const dI=12;const lI=9;const uI=11;const fI=12;const hI=16;const gI=38;const mI=43;const wI=46;const pI=47;const yI=48;const xI=49;const EI=50;const II=52;const kI=t=>{const n=fm(t);return pm(n)};const SI=t=>{const n=fm(t);return n.uri};const CI=t=>{const n=fm(t);return n.languageId};const vI=t=>{const n=fm(t);return Xw(n)};const bI=(t,n,e)=>{const o=fm(t);const{word:s}=Bu(o,n,e);return s};const MI=t=>{const n=fm(t);const e=rI(n);return e};const AI=(t,n,e)=>{const o=fm(t);const s=Nu(o,n,e);return s};const LI=t=>{const n=fm(t);const{lines:e}=n;return e};const PI=t=>{const n=fm(t);const{selections:e}=n;return e};const FI=async(t,n)=>{const e=fm(t);const o={...e,selections:n};const s=await ug(e,o);ts(t,e,s)};const WI=async(t,n,e,o)=>{const s=fm(t);const c=Bp(n);const{widgets:r}=s;const i=r.findIndex(t=>t.id===n);if(i===-1){return}await c(`${e}.dispose`);const a=[...r.slice(0,i),...r.slice(i+1)];const d={...s,focused:true,widgets:a};const l=await ug(s,d);ts(t,s,l);await iI(fI);if(o){await aI(o)}};const TI=async t=>{await WI(t,De,"FindWidget",0)};const RI=async(t,n)=>{const e=fm(t);const o=await Za(e,n);const s=await ug(e,o);ts(t,e,s)};const DI=async t=>{const n=await sI(t);return n};const OI=async t=>{const n=fm(t);const{diagnostics:e}=n;return e};const BI=async(t,n)=>{await wo("TextMeasurement.ensureFont",t,n)};const NI=()=>[{command:"Editor.closeSourceAction",key:ee,when:gI},{command:"EditorSourceActions.focusNext",key:de,when:gI},{command:"EditorSourceActions.focusPrevious",key:ie,when:gI},{command:"EditorSourceActions.focusFirst",key:ce,when:gI},{command:"EditorSourceActions.focusLast",key:se,when:gI},{command:"EditorSourceActions.selectCurrent",key:ne,when:gI},{command:"FindWidget.focusNext",key:ne,when:hI},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:hI},{command:"FindWidget.focusPrevious",key:ze|ve,when:hI},{command:"FindWidget.focusNext",key:ve,when:hI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:hI},{command:"FindWidget.focusReplace",key:te,when:hI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:mI},{command:"FindWidget.replaceAll",key:Ue|He|ne,when:mI},{command:"FindWidget.focusNextMatchButton",key:te,when:EI},{command:"FindWidget.focusReplace",key:ze|te,when:EI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:xI},{command:"FindWidget.focusCloseButton",key:te,when:xI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:yI},{command:"FindWidget.focusReplaceButton",key:te,when:yI},{command:"FindWidget.focusFind",key:ze|te,when:mI},{command:"FindWidget.focusReplaceAllButton",key:te,when:wI},{command:"FindWidget.focusCloseButton",key:ze|te,when:wI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:pI},{command:"EditorCompletion.focusNext",key:de,when:lI},{command:"EditorCompletion.focusPrevious",key:ie,when:lI},{command:"EditorCompletion.selectCurrent",key:ne,when:lI},{command:"EditorCompletion.close",key:ee,when:lI},{command:"EditorCompletion.focusLast",key:se,when:lI},{command:"EditorCompletion.focusFirst",key:ce,when:lI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:lI},{command:"Editor.cursorWordRight",key:He|ae,when:fI},{command:"Editor.cursorWordLeft",key:He|re,when:fI},{command:"Editor.deleteWordPartLeft",key:Ue|Jn,when:fI},{command:"Editor.deleteWordPartRight",key:Ue|le,when:fI},{command:"Editor.deleteWordLeft",key:He|Jn,when:fI},{command:"Editor.deleteWordRight",key:He|le,when:fI},{command:"Editor.selectNextOccurrence",key:He|he,when:fI},{command:"Editor.openColorPicker",key:He|we,when:fI},{command:"Editor.showSourceActions3",key:He|Me,when:fI},{command:"Editor.handleTab",key:te,when:fI},{command:"Editor.unindent",key:ze|te,when:fI},{command:"Editor.indentLess",key:He|Le,when:fI},{command:"Editor.closeFind",key:ee,when:hI},{command:"Editor.openFind2",key:He|ge,when:fI},{command:"Editor.openCodeGenerator",key:He|pe,when:fI},{command:"Editor.closeCodeGenerator",key:ee,when:II},{command:"EditorCodeGenerator.accept",key:ne,when:II},{command:"Editor.indentMore",key:He|Pe,when:fI},{command:"Editor.selectCharacterLeft",key:ze|re,when:fI},{command:"Editor.selectWordLeft",key:He|ze|re,when:fI},{command:"Editor.selectCharacterRight",key:ze|ae,when:fI},{command:"Editor.selectWordRight",key:He|ze|ae,when:fI},{command:"Editor.selectLine",key:He|ye,when:fI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:fI},{command:"Editor.deleteAllRight",key:He|ze|le,when:fI},{command:"Editor.cancelSelection",key:ee,when:fI},{command:"Editor.undo",key:He|ke,when:fI},{command:"Editor.cursorLeft",key:re,when:fI},{command:"Editor.cursorRight",key:ae,when:fI},{command:"Editor.cursorUp",key:ie,when:fI},{command:"Editor.cursorDown",key:de,when:fI},{command:"Editor.deleteLeft",key:Jn,when:fI},{command:"Editor.deleteRight",key:le,when:fI},{command:"Editor.insertLineBreak",key:ne,when:fI},{command:"Editor.copyLineDown",key:He|ze|he,when:fI},{command:"Editor.moveLineDown",key:He|ze|de,when:fI},{command:"Editor.moveLineUp",key:He|ze|ie,when:fI},{command:"Editor.openCompletion",key:He|oe,when:fI},{command:"Editor.openRename",key:Se,when:fI},{command:"EditorRename.accept",key:ne,when:uI},{command:"Editor.closeRename",key:ee,when:uI},{command:"Editor.cursorHome",key:ce,when:fI},{command:"Editor.cursorEnd",key:se,when:fI},{command:"Editor.toggleComment",key:He|Ae,when:fI},{command:"Editor.copy",key:He|fe,when:fI},{command:"Editor.selectAll",key:He|ue,when:fI},{command:"Editor.showHover2",key:He|me,when:fI},{command:"Editor.cut",key:He|Ie,when:fI},{command:"Editor.paste",key:He|Ee,when:fI},{command:"Editor.cursorWordPartLeft",key:Ue|re,when:fI},{command:"Editor.cursorWordPartRight",key:Ue|ae,when:fI},{command:"Editor.selectAllOccurrences",key:Ue|Ce,when:fI},{command:"Editor.addCursorAbove",key:Ue|ze|ie,when:fI},{command:"Editor.addCursorBelow",key:Ue|ze|de,when:fI},{command:"Editor.findAllReferences",key:Ue|ze|be,when:fI},{command:"Editor.organizeImports",key:Ue|ze|xe,when:fI},{command:"Editor.selectionGrow",key:He|ze|oe,when:dI}];const HI=()=>Jo();const zI={CommandPalette:"Command Palette"};const UI=()=>$u(zI.CommandPalette);const $I={command:"",flags:Ye,id:"separator",label:""};const _I=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:vf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Tf()},$I,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Rf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Df()},$I,{command:"Editor.format",flags:Ve,id:"format",label:$f()},{command:"Editor.showSourceActions2",flags:Ve,id:_e,label:Pf()},$I,{command:"Editor.cut",flags:Ve,id:"cut",label:Of()},{command:"Editor.copy",flags:Ve,id:"copy",label:Bf()},{command:"Editor.paste",flags:Ve,id:"paste",label:Nf()},$I,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:UI()}];const YI=()=>[$e];const VI=t=>Sa(t);const jI=async()=>{const t=Jo();const n=t.map(t=>{const n=parseInt(t);const e=Ko(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(VI));const s=o.flat();return s};const qI=()=>[{id:"Editor.format",label:$f()},{id:"Editor.showHover",label:_f()},{id:"Editor.formatForced",label:Yf()},{id:"Editor.selectNextOccurrence",label:Vf()},{id:"Editor.selectAllOccurrences",label:jf()},{id:"Editor.goToDefinition",label:qf()},{id:"Editor.goToTypeDefinition",label:Gf()},{id:"Editor.selectInsideString",label:Xf()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:Zf()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:Qf()},{id:"Editor.sortLinesAscending",label:Kf()},{id:"Editor.toggleComment",label:Jf()},{id:"Editor.selectUp",label:th()},{id:"Editor.selectDown",label:nh()},{id:"Editor.toggleBlockComment",label:Hf()},{id:"Editor.openColorPicker",label:eh()},{id:"Editor.closeColorPicker",label:oh()},{id:"Editor.copyLineDown",label:sh()},{id:"Editor.copyLineUp",label:ch()},{id:"Editor.moveLineDown",label:Uf()},{id:"Editor.moveLineUp",label:zf()},{id:"Editor.showSourceActions2",label:Pf()}];const GI=t=>{const n=fm(t);const{selections:e}=n;return e};const XI=t=>{g(t);const n=fm(t);const{lines:e}=n;return e.join(wr)};const ZI="insertText";const QI=(t,n,e)=>{switch(n){case ZI:return Fp(t,e);default:return t}};const KI=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const JI=(t,n)=>Kw(t,n);const tk=async t=>{const n=await Zw(t);if(!n){return t}return JI(t,n)};const nk=async()=>{await um();await dm()};const ek=t=>{switch(t){case De:return`FindWidget`;default:return""}};const ok=async t=>{const n=Object.create(null);for(const e of t){const t=Ko(parseInt(e));const{widgets:o}=t.newState;for(const t of o){const o=Bp(t.id);const s=`${e}:${t.newState.uid}`;const c=ek(t.id);const r=await o(`${c}.saveState`,t.newState.uid);n[s]=r}}return n};const sk=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Ko(t);const{widgets:c}=s.newState;const r=[];for(const e of c){const s=Bp(e.id);const c=`${o}:${e.newState.uid}`;const i=n[c]||{};const a=ek(e.id);await s(`${a}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await s(`${a}.loadContent`,e.newState.uid,i);const d=await s(`${a}.diff2`,e.newState.uid);const l=await s(`${a}.render2`,e.newState.uid,d);const u={...e,newState:{...e.newState,commands:l}};r.push(u)}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const ck={isReloading:false};const rk=async()=>{if(ck.isReloading){return}ck.isReloading=true;const t=Jo();const n=await ok(t);await nk();const e=await sk(t,n);for(const t of e){ts(t.newState.uid,t.oldState,t.newState)}await yo(`Editor.rerender`);ck.isReloading=false};const ik=async t=>{try{await To(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const ak=async()=>{try{const t=await Rn({commandMap:{},send:ik});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const dk=async(t,n)=>{if(t){zc(true);const t=await ak();_c(t)}if(n){Zr(true)}};const lk=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await $o(t,n,e);return o};const uk=async(t,n)=>{om(lk);await dk(t,n)};const fk="editor.lineHeight";const hk="editor.fontSize";const gk="editor.fontFamily";const mk="editor.letterSpacing";const wk="editor.tabSize";const pk="editor.lineNumbers";const yk="editor.diagnostics";const xk="editor.quickSuggestions";const Ek="editor.autoClosingQuotes";const Ik="editor.autoclosingBrackets";const kk="editor.fontWeight";const Sk=async()=>Boolean(await wa(Ik));const Ck=async()=>Boolean(await wa(Ek));const vk=async()=>Boolean(await wa(xk));const bk=async()=>true;const Mk=async()=>await wa(fk)||20;const Ak=async()=>await wa(hk)||15;const Lk=async()=>await wa(gk)||"Fira Code";const Pk=async()=>await wa(mk)??.5;const Fk=async()=>await wa(wk)||2;const Wk=async()=>await wa(pk)??false;const Tk=async()=>[".","/"];const Rk=async()=>await wa(yk)??false;const Dk=async()=>await wa(kk)??400;const Ok=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([Rk(),Lk(),Ak(),Dk(),Sk(),Ck(),bk(),vk(),Wk(),Mk(),Fk(),Pk(),Tk()]);return{completionTriggerCharacters:f,diagnosticsEnabled:t,fontFamily:n,fontSize:e,fontWeight:o,isAutoClosingBracketsEnabled:s,isAutoClosingQuotesEnabled:c,isAutoClosingTagsEnabled:r,isQuickSuggestionsEnabled:i,letterSpacing:u,lineNumbers:a,rowHeight:d,tabSize:l}};const Bk=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const Nk=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k}=await Ok();const S=await ma(g,h,f,x);const C=await ga(c,e);Zc(C);const v=ha(r,C);const b=Bk(C,v);await nr(v,b);const M=er(v);const A=t.tokenizerId+1;sr(A,M);const L={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:v,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k,tokenizerId:A};const P=await So(r);const F=na(L,a,d,i,o,9);const W=ea(F,P);let T=W;const R=ci(T);const D={...T,decorations:R};const O=Qr();const{differences:B,textInfos:N}=await _r(D,O);const H={...D,differences:B,focus:co,focused:true,textInfos:N};await ia(ra,r,s,v,P);if(u){await Ma(H)}const z=await wa("editor.completionsOnType");const U=Boolean(z);const $={...H,completionsOnType:U,initial:false};return $};const Hk=t=>t;const zk=t=>t;const Uk=(t,n)=>{g(t);g(n);di(t,n)};const $k=(t,n,e,o,s)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n --ScrollBarWidth: ${o}px;\n --ScrollBarLeft: ${s}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n.Editor .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`;const _k=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const Yk=(t,n)=>{const{deltaX:e,deltaY:o,finalDeltaY:s,height:c,longestLineWidth:r,minimumSliderSize:i,rowHeight:a,scrollBarHeight:d,uid:l,width:u}=n;const f=Vr(o,s,c,d);const h=jr(u,r,i);const g=_k(e,r,u);const m=$k(a,d,f,h,g);return[eo,l,m]};const Vk=(t,n)=>{const e=".EditorInput textarea";return[no,n.uid,e]};const jk=(t,n)=>[oo,n.uid,co];const qk=1;const Gk=2;const Xk=3;const Zk=4;const Qk=6;const Kk=7;const Jk=8;const tS=9;const nS=10;const eS=11;const oS=t=>t!=="type"&&t!=="childCount";const sS=t=>{const n=Object.keys(t).filter(oS);return n};const cS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=rS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const rS=(t,n,e)=>{if(e===0){return{children:[],nodesConsumed:0}}const o=[];let s=n;let c=e;let r=0;while(c>0&&s<t.length){const n=t[s];const e=n.childCount||0;const{children:i,nodesConsumed:a}=rS(t,s+1,e);o.push({node:n,children:i});const d=1+a;s+=d;r+=d;c--}return{children:o,nodesConsumed:r}};const iS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:eS,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:qk,value:n.text})}return e}const o=sS(t);const s=sS(n);for(const o of s){if(t[o]!==n[o]){e.push({type:Xk,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:Zk,key:t})}}return e};const aS=t=>{const n=[t.node];for(const e of t.children){n.push(...aS(e))}return n};const dS=(t,n,e)=>{if(n===-1){t.push({type:Kk,index:e});return e}if(n!==e){t.push({type:nS,index:e})}return e};const lS=(t,n)=>{if(n>=0){t.push({type:Jk})}return-1};const uS=(t,n)=>{n.push({type:Qk,nodes:aS(t)})};const fS=(t,n)=>{n.push({type:Gk,nodes:aS(t)})};const hS=(t,n,e,o,s)=>{const c=iS(t.node,n.node);if(c===null){const t=dS(e,o,s);fS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=dS(e,o,s);if(c.length>0){e.push(...c)}if(r){mS(t.children,n.children,e)}return i};const gS=(t,n,e)=>{const o=iS(t.node,n.node);if(o===null){fS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){mS(t.children,n.children,e)}};const mS=(t,n,e)=>{const o=Math.max(t.length,n.length);let s=-1;const c=[];for(let r=0;r<o;r++){const o=t[r];const i=n[r];if(!o&&!i){continue}if(!o){s=lS(e,s);uS(i,e);continue}if(!i){c.push(r);continue}s=hS(o,i,e,s,r)}lS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:tS,index:c[t]})}};const wS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){gS(t[0],n[0],e);return}mS(t,n,e)};const pS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==Kk&&o.type!==Jk&&o.type!==nS){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const yS=(t,n)=>{const e=cS(t);const o=cS(n);const s=[];wS(e,o,s,[]);return pS(s)};const xS=()=>[{childCount:1,className:"EditorInput",type:uE},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:$x,onBlur:_x,onCompositionEnd:Vx,onCompositionStart:jx,onCompositionUpdate:qx,onCut:Xx,onFocus:Zx,onPaste:Jx,role:"textbox",spellcheck:false,type:mE,wrap:"off"}];const ES=t=>{const n=Array.from(t,t=>({childCount:0,className:Ax,translate:t,type:uE}));return n};const IS=t=>{const n=ES([...t]);return[{childCount:t.length,className:"LayerCursor",type:uE},...n]};const kS="error";const SS="warning";const CS=t=>{switch(t){case kS:return Sx;case SS:return Cx;default:return Sx}};const vS=(...t)=>t.filter(Boolean).join(" ");const bS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=CS(e);return[{childCount:0,className:vS(Mx,r),height:n,left:s,top:c,type:uE,width:o}]};const MS=t=>{const n=t.flatMap(bS);return n};const AS=t=>{const n=MS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:uE},...n]};const LS=(t,n,e=true,o=-1)=>{const s=[];for(let e=0;e<t.length;e++){const c=t[e];const r=n[e];let i=Lx;if(e===o){i+=" "+Px}s.push({childCount:c.length/2,className:i,translate:bi(r),type:uE});for(let t=0;t<c.length;t+=2){const n=c[t];const e=c[t+1];s.push({childCount:1,className:e,type:hE},wE(n))}}return s};const PS=(t,n,e=true,o=-1)=>{const s=LS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:Qx,onPointerDown:tE,onWheel:lE,type:uE},...s]};const FS=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push({childCount:0,className:Fx,height:r,left:o,top:s,type:uE,width:c})}return n};const WS=t=>{const n=FS(t);return[{childCount:t.length/4,className:"Selections",type:uE},...n]};const TS=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:uE},...WS(t),...PS(n,e,o,s),...IS(c),...AS(r)];const RS=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:uE},...MS([...t])];const DS=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:Gx,onPointerDown:iE,type:uE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:uE},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:sE,type:uE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:uE}];const OS=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onMouseMove:Kx,type:uE},...xS(),...TS(r,i,e,s,o,t,n),...RS(c),...DS()];const BS=t=>[{childCount:1,className:"LineNumber",type:hE},wE(t)];const NS=t=>{const n=t.flatMap(BS);return n};const HS=t=>{const n=NS([...t]);return[{childCount:t.length,className:"Gutter",type:uE},...n]};const zS=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,scrollBarDiagnostics:r=[],selectionInfos:i=[],textInfos:a})=>{const d=c?HS(o):[];return[{childCount:c?2:1,className:"Viewlet Editor",onContextMenu:Gx,role:"code",type:uE},...d,...OS({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:r,selectionInfos:i,textInfos:a})]};const US=new Map;const $S=t=>US.get(t);const _S=(t,n)=>{US.set(t,n)};const YS=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return zS(t)};const VS=(t,n)=>{const e=t.initial?YS(t):$S(n.uid)||YS(t);const o=YS(n);const s=yS(e,o);if(s.length===0){return[]}_S(n.uid,o);return[so,n.uid,s]};const jS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const qS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const GS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const XS=(t,n)=>{const e=[];const o=[];const s=[];const c=t.widgets||[];const r=n.widgets||[];const i=Object.create(null);const a=Object.create(null);for(const t of c){i[t.id]=t}for(const t of r){a[t.id]=t}for(const t of c){if(Object.hasOwn(a,t.id)){o.push(a[t.id])}else{s.push(t)}}for(const t of r){if(Object.hasOwn(i,t.id));else{e.push(t)}}const d=[];for(const t of e){const n=jS(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=qS(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=GS(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const ZS=t=>{switch(t){case Ra:return Yk;case Wa:return Vk;case Ta:return jk;case Da:return VS;case Oa:return XS;default:throw new Error("unknown renderer")}};const QS=(t,n,e)=>{const o=[];for(const s of e){const e=ZS(s);const c=e(t,n);if(c.length>0){if(s===Oa){o.push(...c)}else{o.push(c)}}}return o};const KS=(t,n)=>{const{newState:e,oldState:o}=Ko(t);ts(t,e,e);const s=QS(o,e,n);return s};const JS={apply(t,n){const{incrementalEdits:e}=n;if(e!==ns){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=LS(s,o,true,i);return["setText",a]},isEqual:(t,n)=>t.lines===n.lines&&t.tokenizerId===n.tokenizerId&&t.minLineY===n.minLineY&&t.decorations===n.decorations&&t.embeds===n.embeds&&t.deltaX===n.deltaX&&t.width===n.width&&t.highlightedLine===n.highlightedLine&&t.debugEnabled===n.debugEnabled};const tC={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=ES(e);const c=FS(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const nC={apply:Yk,isEqual:La};const eC={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const oC={apply:(t,n)=>[oo,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const sC={apply(t,n){if(n.additionalFocus){return["Viewlet.setAdditionalFocus",n.uid,n.additionalFocus]}return["viewlet.unsetAdditionalFocus",n.uid,n.additionalFocus]},isEqual:(t,n)=>t.additionalFocus===n.additionalFocus};const cC={apply(t,n){const e=MS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const rC={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;if(!e){return[]}const c=[];for(let t=s;t<o;t++){c.push(t+1)}const r=NS(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const iC={apply:XS,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const aC=[JS,tC,nC,eC,cC,rC,iC,oC,sC];const dC=async t=>{const n=Ko(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ts(t,e,e);for(const t of aC){if(t.isEqual(o,e)){continue}const n=await t.apply(o,e);if(t.multiple){s.push(...n)}else if(n.length>0){s.push(n)}}return s};const lC=()=>[{name:Zx,params:["handleFocus"]},{name:Kx,params:["handleMouseMove",Xn,Zn,qn]},{name:_x,params:["handleBlur"]},{name:$x,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:jx,params:["compositionStart","event.data"]},{name:qx,params:["compositionUpdate","event.data"]},{name:Vx,params:["compositionEnd","event.data"]},{name:Xx,params:["cut"],preventDefault:true},{name:Jx,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:Qx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:tE,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[nE,eE]},{name:nE,params:["handlePointerMove",Xn,Zn,qn]},{name:eE,params:["handlePointerUp"]},{name:lE,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:Gx,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:iE,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[aE,dE]},{name:aE,params:["handleScrollBarVerticalPointerMove",Zn]},{name:dE,params:["handlePointerUp"]},{name:sE,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[cE,rE]},{name:cE,params:["handleScrollBarHorizontalMove",Xn]},{name:rE,params:["handlePointerUp"]}];const uC=(t,n)=>{const{lines:e}=t;return{lines:e}};const fC=async(t,n,e)=>{await vo(t,e)};const hC=async(t,n)=>{await Po(t,n)};const gC=(t,n)=>t;const mC=(t,n)=>{g(t);g(n);li(t,n)};const wC=async(t,...n)=>{const e=$n(qe);return e.invoke(t,...n)};const pC=async t=>{const n=await wC("RunAndDebug.getHighlight",t);return n};const yC=()=>{const t=Jo();return parseInt(t[0])};const xC=async t=>{const n=await pC(t);const e=yC();const o=Ko(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ts(e,c,r);await yo("Editor.rerender",e)};const EC=t=>async(n,...e)=>{const o=Ko(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await ug(s,c);ts(n,s,r);return r};const IC={"ActivateByEvent.activateByEvent":Ho,"CodeGenerator.accept":zo,"ColorPicker.loadContent":qo,"Editor.addCursorAbove":EC(_a),"Editor.addCursorBelow":EC(Va),"Editor.applyDocumentEdits":EC(Xa),"Editor.applyEdit":EC(Za),"Editor.applyEdit2":RI,"Editor.applyWorkspaceEdit":EC(Ka),"Editor.braceCompletion":EC(yd),"Editor.cancelSelection":EC(xd),"Editor.closeCodeGenerator":EC(Sd),"Editor.closeFind":EC(vd),"Editor.closeFind2":TI,"Editor.closeRename":EC(Fd),"Editor.closeSourceAction":EC(Td),"Editor.closeWidget2":WI,"Editor.compositionEnd":EC(Yd),"Editor.compositionStart":EC(Ud),"Editor.compositionUpdate":EC(_d),"Editor.contextMenu":EC(Lh),"Editor.copy":EC(Gd),"Editor.copyLineDown":EC(Xd),"Editor.copyLineUp":EC(Zd),"Editor.create":Aa,"Editor.create2":ls,"Editor.cursorCharacterLeft":EC($l),"Editor.cursorCharacterRight":EC(ql),"Editor.cursorDown":EC(Zl),"Editor.cursorEnd":EC(Ql),"Editor.cursorHome":EC(Kl),"Editor.cursorLeft":EC($l),"Editor.cursorRight":EC(ql),"Editor.cursorSet":EC(Jl),"Editor.cursorUp":EC(ou),"Editor.cursorWordLeft":EC(su),"Editor.cursorWordPartLeft":EC(cu),"Editor.cursorWordPartRight":EC(ru),"Editor.cursorWordRight":EC(iu),"Editor.cut":EC(lu),"Editor.deleteAll":EC(uu),"Editor.deleteAllLeft":EC(pu),"Editor.deleteAllRight":EC(Eu),"Editor.deleteCharacterLeft":EC(Iu),"Editor.deleteCharacterRight":EC(ku),"Editor.deleteHorizontalRight":EC(xu),"Editor.deleteLeft":EC(Iu),"Editor.deleteRight":EC(ku),"Editor.deleteWordLeft":EC(Su),"Editor.deleteWordPartLeft":EC(Cu),"Editor.deleteWordPartRight":EC(vu),"Editor.deleteWordRight":EC(bu),"Editor.diff2":Ua,"Editor.executeWidgetCommand":EC(eI),"Editor.findAllReferences":EC(Mu),"Editor.format":EC(Wu),"Editor.getCommandIds":Xo,"Editor.getDiagnostics":OI,"Editor.getKeyBindings":NI,"Editor.getKeys":HI,"Editor.getLanguageId":CI,"Editor.getLines2":LI,"Editor.getMenuEntries":_I,"Editor.getMenuEntries2":_I,"Editor.getMenuIds":YI,"Editor.getOffsetAtCursor":vI,"Editor.getPositionAtCursor":kI,"Editor.getProblems":jI,"Editor.getQuickPickMenuEntries":qI,"Editor.getSelections":GI,"Editor.getSelections2":PI,"Editor.getSourceActions":DI,"Editor.getText":XI,"Editor.getUri":SI,"Editor.getWordAt":Bu,"Editor.getWordAt2":bI,"Editor.getWordAtOffset2":MI,"Editor.getWordBefore":Nu,"Editor.getWordBefore2":AI,"Editor.goToDefinition":EC(uh),"Editor.goToTypeDefinition":EC(ph),"Editor.handleBeforeInput":EC(QI),"Editor.handleBeforeInputFromContentEditable":EC(eg),"Editor.handleBlur":EC(Ja),"Editor.handleClickAtPosition":EC(Mh),"Editor.handleContextMenu":EC(Lh),"Editor.handleDoubleClick":EC(Rh),"Editor.handleFocus":EC(Dh),"Editor.handleMouseDown":EC(Yh),"Editor.handleMouseMove":EC(Qh),"Editor.handleMouseMoveWithAltKey":EC(Jh),"Editor.handleNativeSelectionChange":og,"Editor.handlePointerCaptureLost":EC(sg),"Editor.handlePointerDown":EC(cg),"Editor.handlePointerMove":EC(Cg),"Editor.handlePointerUp":EC(vg),"Editor.handleScrollBarClick":Wg,"Editor.handleScrollBarHorizontalMove":EC(Mg),"Editor.handleScrollBarHorizontalPointerDown":EC(Ag),"Editor.handleScrollBarMove":EC(Pg),"Editor.handleScrollBarPointerDown":EC(Wg),"Editor.handleScrollBarVerticalMove":EC(Fg),"Editor.handleScrollBarVerticalPointerDown":EC(Wg),"Editor.handleScrollBarVerticalPointerMove":EC(Fg),"Editor.handleSingleClick":EC(zh),"Editor.handleTab":EC(tk),"Editor.handleTouchEnd":EC(Tg),"Editor.handleTouchMove":EC(Hg),"Editor.handleTouchStart":EC(Dg),"Editor.handleTripleClick":EC(_h),"Editor.handleWheel":EC(zg),"Editor.hotReload":rk,"Editor.indendLess":EC($g),"Editor.indentMore":EC(Yg),"Editor.insertLineBreak":EC(Xg),"Editor.loadContent":EC(Nk),"Editor.moveLineDown":EC(Hk),"Editor.moveLineUp":EC(zk),"Editor.moveRectangleSelection":EC(rg),"Editor.moveRectangleSelectionPx":EC(ig),"Editor.moveSelection":EC(Eg),"Editor.moveSelectionPx":EC(Sg),"Editor.offsetAt":Fr,"Editor.openCodeGenerator":EC(tm),"Editor.openColorPicker":EC(Hd),"Editor.openCompletion":EC(cm),"Editor.openFind":EC(wm),"Editor.openFind2":EC(mm),"Editor.openRename":EC(Em),"Editor.organizeImports":EC(km),"Editor.paste":EC(Cm),"Editor.pasteText":EC(Sm),"Editor.redo":EC(vm),"Editor.render":dC,"Editor.render2":KS,"Editor.renderEventListeners":lC,"Editor.replaceRange":EC(td),"Editor.rerender":EC(DE),"Editor.save":EC(Um),"Editor.saveState":Qo(uC),"Editor.selectAll":EC($m),"Editor.selectAllLeft":EC(Vm),"Editor.selectAllOccurrences":EC(ew),"Editor.selectAllRight":EC(cw),"Editor.selectCharacterLeft":EC(rw),"Editor.selectCharacterRight":EC(iw),"Editor.selectDown":EC(dw),"Editor.selectInsideString":EC(uw),"Editor.selectionGrow":EC(hw),"Editor.selectLine":EC($h),"Editor.selectNextOccurrence":EC(pw),"Editor.selectPreviousOccurrence":EC(yw),"Editor.selectUp":EC(Ew),"Editor.selectWord":EC(Th),"Editor.selectWordLeft":EC(Iw),"Editor.selectWordRight":EC(kw),"Editor.setDebugEnabled":EC(gC),"Editor.setDecorations":EC(Sw),"Editor.setDelta":EC(Ng),"Editor.setDeltaY":EC(Og),"Editor.setLanguageId":EC(Cw),"Editor.setSelections":EC(vw),"Editor.setSelections2":FI,"Editor.setText":EC(bw),"Editor.showHover":Dw,"Editor.showHover2":Tw,"Editor.showSourceActions":$w,"Editor.showSourceActions2":$w,"Editor.showSourceActions3":$w,"Editor.sortLinesAscending":EC(qw),"Editor.tabCompletion":EC(tp),"Editor.terminate":e,"Editor.toggleBlockComment":EC(ip),"Editor.toggleComment":EC(fp),"Editor.toggleLineComment":EC(up),"Editor.type":EC(hp),"Editor.typeWithAutoClosing":EC(Fp),"Editor.undo":EC(Tp),"Editor.unIndent":EC(Rp),"Editor.updateDebugInfo":xC,"Editor.updateDiagnostics":EC(Ma),"EditorCompletion.close":ry,"EditorCompletion.closeDetails":iy,"EditorCompletion.focusFirst":ay,"EditorCompletion.focusIndex":dy,"EditorCompletion.focusNext":uy,"EditorCompletion.focusPrevious":fy,"EditorCompletion.handleEditorBlur":hy,"EditorCompletion.handleEditorClick":gy,"EditorCompletion.handleEditorDeleteLeft":my,"EditorCompletion.handleEditorType":wy,"EditorCompletion.handlePointerDown":py,"EditorCompletion.handleWheel":yy,"EditorCompletion.openDetails":xy,"EditorCompletion.selectCurrent":Ey,"EditorCompletion.selectIndex":Iy,"EditorCompletion.toggleDetails":ky,"EditorRename.accept":FE,"EditorRename.close":WE,"EditorRename.handleInput":TE,"EditorSourceAction.close":_E,"EditorSourceAction.closeDetails":YE,"EditorSourceAction.focusFirst":VE,"EditorSourceAction.focusIndex":jE,"EditorSourceAction.focusNext":GE,"EditorSourceAction.focusPrevious":XE,"EditorSourceAction.handleWheel":ZE,"EditorSourceAction.selectCurrent":QE,"EditorSourceAction.selectIndex":KE,"EditorSourceAction.selectItem":JE,"EditorSourceAction.toggleDetails":tI,"EditorSourceActions.focusNext":BE,"ExtensionHostManagement.activateByEvent":Ho,"FindWidget.close":Ly,"FindWidget.focusCloseButton":Py,"FindWidget.focusFind":Fy,"FindWidget.focusNext":Wy,"FindWidget.focusNextElement":Ty,"FindWidget.focusNextMatchButton":Ry,"FindWidget.focusPrevious":Dy,"FindWidget.focusPreviousElement":Oy,"FindWidget.focusPreviousMatchButton":By,"FindWidget.focusReplace":Ny,"FindWidget.focusReplaceAllButton":Hy,"FindWidget.focusReplaceButton":zy,"FindWidget.focusToggleReplace":Uy,"FindWidget.handleBlur":$y,"FindWidget.handleClickButton":_y,"FindWidget.handleFocus":Yy,"FindWidget.handleInput":Vy,"FindWidget.handleReplaceFocus":jy,"FindWidget.handleReplaceInput":qy,"FindWidget.handleToggleReplaceFocus":Gy,"FindWidget.loadContent":hm,"FindWidget.replace":Xy,"FindWidget.replaceAll":Zy,"FindWidget.toggleMatchCase":Qy,"FindWidget.toggleMatchWholeWord":Ky,"FindWidget.togglePreserveCase":Jy,"FindWidget.toggleReplace":tx,"FindWidget.toggleUseRegularExpression":nx,"Font.ensure":BI,"HandleMessagePort.handleMessagePort":KI,"Hover.getHoverInfo":mx,"Hover.handleSashPointerDown":px,"Hover.handleSashPointerMove":yx,"Hover.handleSashPointerUp":xx,"Hover.loadContent":wx,"Hover.render":bE,"Initialize.initialize":uk,"Listener.register":Uk,"Listener.registerListener":di,"Listener.unregister":mC,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":fC,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":hC};for(const[t,n]of Object.entries(IC)){if(t.startsWith("Editor.")){IC["EditorText"+t.slice("Editor".length)]=n}}const kC=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await fC(n,t,Ge)}});return n};const SC=async()=>{const t=await kC();aa(t)};const CC=async()=>{const t=await On({commandMap:{},async send(t){await Po(t,Ge)}});return t};const vC=async()=>{try{const t=await CC();uo(t)}catch{}};const bC=t=>ko(t);const MC=async()=>{const t=await On({commandMap:{},send:bC});go(t)};const AC=async()=>{const t=await Nn({commandMap:IC});Eo(t)};const LC=t=>Lo(t);const PC=async()=>{const t=await On({commandMap:{},send:LC});po(t)};const FC=async()=>{Zo(IC);await Promise.all([AC(),SC(),vC(),PC(),MC()])};const WC="CodeGeneratorInput";const TC=t=>{const n=Ff();const e=Wf();return[{childCount:2,className:vS(Ux,kx),type:uE},{childCount:0,className:vS(Ex,Hx),name:WC,placeholder:e,type:fE},{childCount:1,className:Ix,type:uE},wE(n)]};const RC={apply(t,n){const e=TC();return[Jp,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const DC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Zp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const OC={apply:(t,n)=>[Vp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const BC=[RC,DC,OC];const NC=(t,n)=>{const e=[];for(const o of BC){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const HC=t=>{const n=NC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===Jp){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const zC=t=>Op(t,"EditorCodeGenerator",HC);const UC=NE;const $C={__proto__:null,add:zC,remove:UC,render:HC};const _C=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const YC=[Jp,Kp,Yp,Qp,jp,ty];const VC=t=>{const n=_C(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(YC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const jC=t=>Op(t,"ColorPicker",VC);const qC=NE;const GC={};const XC={__proto__:null,Commands:GC,add:jC,remove:qC,render:VC};const ZC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:uE},{childCount:1,className:bx,type:uE},wE(t),{childCount:1,className:vx,onClick:Yx,type:uE},{childCount:0,className:`${zx} ${Nx}`,type:uE}];return n};const QC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const KC={apply(t,n){const e=ZC(n.content);return[Jp,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const JC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Zp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const tv=[KC,JC];const nv=(t,n)=>QC(tv,t,n);const ev=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const ov=t=>ev(t,Te);const sv=t=>{const n=nv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===Jp){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const cv=t=>Op(t,"EditorCompletionDetails",sv);const rv=NE;const iv=(t,n)=>{const e=ov(t);if(!e){return t}const{x:o}=pm(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const av=(t,n)=>iv(t,n);const dv=(t,n)=>iv(t,n);const lv={__proto__:null,add:cv,handleEditorDeleteLeft:dv,handleEditorType:av,remove:rv,render:sv};const uv=[Jp,Kp,Yp,Qp,jp,qp,Gp,Xp,ty,"Viewlet.focusSelector"];const fv=t=>{const n=ny(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(uv.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const hv=t=>Op(t,"EditorCompletion",fv);const gv=t=>[["Viewlet.dispose",t.newState.uid]];const{close:mv}=_p(["close"],"",Oe);const wv={__proto__:null,add:hv,close:mv,remove:gv,render:fv};const pv=()=>{Ls(We,XC);Ls(Te,Sy);Ls(Re,lv);Ls(De,ex);Ls(Oe,wv);Ls(Be,RE);Ls(Ne,nI);Ls(Fe,$C)};const yv=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const xv=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const Ev=t=>{t.addEventListener("error",xv);t.addEventListener("unhandledrejection",yv)};const Iv=async()=>{Ev(globalThis);await FC();pv()};Iv();
|