ADAPT-Chase commited on
Commit
1382a98
·
verified ·
1 Parent(s): a512ef8

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/browser.js +54 -0
  2. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js +32 -0
  3. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/contextmenu.js +5 -0
  4. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js +195 -0
  5. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dnd.js +26 -0
  6. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dom.js +1525 -0
  7. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/domObservable.js +15 -0
  8. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js +1569 -0
  9. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/event.js +20 -0
  10. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js +250 -0
  11. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fonts.js +14 -0
  12. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js +167 -0
  13. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js +80 -0
  14. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/history.js +5 -0
  15. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/iframe.js +85 -0
  16. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js +122 -0
  17. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js +814 -0
  18. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js +146 -0
  19. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/performance.js +220 -0
  20. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js +85 -0
  21. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/touch.js +268 -0
  22. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js +24 -0
  23. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js +373 -0
  24. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css +117 -0
  25. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js +417 -0
  26. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css +9 -0
  27. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js +81 -0
  28. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css +36 -0
  29. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js +1 -0
  30. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css +174 -0
  31. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js +215 -0
  32. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +33 -0
  33. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css +25 -0
  34. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  35. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codiconStyles.js +6 -0
  36. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css +16 -0
  37. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js +292 -0
  38. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css +24 -0
  39. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js +35 -0
  40. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.css +155 -0
  41. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.js +1 -0
  42. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css +46 -0
  43. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js +139 -0
  44. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +107 -0
  45. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css +70 -0
  46. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js +293 -0
  47. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js +50 -0
  48. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/replaceInput.js +173 -0
  49. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js +133 -0
  50. novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hover.js +6 -0
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/browser.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { mainWindow } from './window.js';
6
+ class WindowManager {
7
+ constructor() {
8
+ // --- Zoom Factor
9
+ this.mapWindowIdToZoomFactor = new Map();
10
+ }
11
+ static { this.INSTANCE = new WindowManager(); }
12
+ getZoomFactor(targetWindow) {
13
+ return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;
14
+ }
15
+ getWindowId(targetWindow) {
16
+ return targetWindow.vscodeWindowId;
17
+ }
18
+ }
19
+ export function addMatchMediaChangeListener(targetWindow, query, callback) {
20
+ if (typeof query === 'string') {
21
+ query = targetWindow.matchMedia(query);
22
+ }
23
+ query.addEventListener('change', callback);
24
+ }
25
+ /** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
26
+ export function getZoomFactor(targetWindow) {
27
+ return WindowManager.INSTANCE.getZoomFactor(targetWindow);
28
+ }
29
+ const userAgent = navigator.userAgent;
30
+ export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
31
+ export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
32
+ export const isChrome = (userAgent.indexOf('Chrome') >= 0);
33
+ export const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));
34
+ export const isWebkitWebView = (!isChrome && !isSafari && isWebKit);
35
+ export const isElectron = (userAgent.indexOf('Electron/') >= 0);
36
+ export const isAndroid = (userAgent.indexOf('Android') >= 0);
37
+ let standalone = false;
38
+ if (typeof mainWindow.matchMedia === 'function') {
39
+ const standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');
40
+ const fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');
41
+ standalone = standaloneMatchMedia.matches;
42
+ addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {
43
+ // entering fullscreen would change standaloneMatchMedia.matches to false
44
+ // if standalone is true (running as PWA) and entering fullscreen, skip this change
45
+ if (standalone && fullScreenMatchMedia.matches) {
46
+ return;
47
+ }
48
+ // otherwise update standalone (browser to PWA or PWA to browser)
49
+ standalone = matches;
50
+ });
51
+ }
52
+ export function isStandalone() {
53
+ return standalone;
54
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as browser from './browser.js';
6
+ import { mainWindow } from './window.js';
7
+ import * as platform from '../common/platform.js';
8
+ /**
9
+ * Browser feature we can support in current platform, browser and environment.
10
+ */
11
+ export const BrowserFeatures = {
12
+ clipboard: {
13
+ writeText: (platform.isNative
14
+ || (document.queryCommandSupported && document.queryCommandSupported('copy'))
15
+ || !!(navigator && navigator.clipboard && navigator.clipboard.writeText)),
16
+ readText: (platform.isNative
17
+ || !!(navigator && navigator.clipboard && navigator.clipboard.readText))
18
+ },
19
+ keyboard: (() => {
20
+ if (platform.isNative || browser.isStandalone()) {
21
+ return 0 /* KeyboardSupport.Always */;
22
+ }
23
+ if (navigator.keyboard || browser.isSafari) {
24
+ return 1 /* KeyboardSupport.FullScreen */;
25
+ }
26
+ return 2 /* KeyboardSupport.None */;
27
+ })(),
28
+ // 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be
29
+ // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
30
+ touch: 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0,
31
+ pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)
32
+ };
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/contextmenu.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export {};
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { createTrustedTypesPolicy } from './trustedTypes.js';
6
+ import { onUnexpectedError } from '../common/errors.js';
7
+ import { COI, FileAccess } from '../common/network.js';
8
+ import { logOnceWebWorkerWarning, SimpleWorkerClient } from '../common/worker/simpleWorker.js';
9
+ import { Disposable, toDisposable } from '../common/lifecycle.js';
10
+ import { coalesce } from '../common/arrays.js';
11
+ import { getNLSLanguage, getNLSMessages } from '../../nls.js';
12
+ // ESM-comment-begin
13
+ // const isESM = false;
14
+ // ESM-comment-end
15
+ // ESM-uncomment-begin
16
+ const isESM = true;
17
+ // ESM-uncomment-end
18
+ // Reuse the trusted types policy defined from worker bootstrap
19
+ // when available.
20
+ // Refs https://github.com/microsoft/vscode/issues/222193
21
+ let ttPolicy;
22
+ if (typeof self === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope' && globalThis.workerttPolicy !== undefined) {
23
+ ttPolicy = globalThis.workerttPolicy;
24
+ }
25
+ else {
26
+ ttPolicy = createTrustedTypesPolicy('defaultWorkerFactory', { createScriptURL: value => value });
27
+ }
28
+ function getWorker(esmWorkerLocation, label) {
29
+ const monacoEnvironment = globalThis.MonacoEnvironment;
30
+ if (monacoEnvironment) {
31
+ if (typeof monacoEnvironment.getWorker === 'function') {
32
+ return monacoEnvironment.getWorker('workerMain.js', label);
33
+ }
34
+ if (typeof monacoEnvironment.getWorkerUrl === 'function') {
35
+ const workerUrl = monacoEnvironment.getWorkerUrl('workerMain.js', label);
36
+ return new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) : workerUrl, { name: label, type: isESM ? 'module' : undefined });
37
+ }
38
+ }
39
+ // ESM-comment-begin
40
+ // if (typeof require === 'function') {
41
+ // const workerMainLocation = require.toUrl('vs/base/worker/workerMain.js'); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321
42
+ // const factoryModuleId = 'vs/base/worker/defaultWorkerFactory.js';
43
+ // const workerBaseUrl = require.toUrl(factoryModuleId).slice(0, -factoryModuleId.length); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321
44
+ // const workerUrl = getWorkerBootstrapUrl(label, workerMainLocation, workerBaseUrl);
45
+ // return new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) as unknown as string : workerUrl, { name: label, type: isESM ? 'module' : undefined });
46
+ // }
47
+ // ESM-comment-end
48
+ if (esmWorkerLocation) {
49
+ const workerUrl = getWorkerBootstrapUrl(label, esmWorkerLocation.toString(true));
50
+ const worker = new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) : workerUrl, { name: label, type: isESM ? 'module' : undefined });
51
+ if (isESM) {
52
+ return whenESMWorkerReady(worker);
53
+ }
54
+ else {
55
+ return worker;
56
+ }
57
+ }
58
+ throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);
59
+ }
60
+ function getWorkerBootstrapUrl(label, workerScriptUrl, workerBaseUrl) {
61
+ const workerScriptUrlIsAbsolute = /^((http:)|(https:)|(file:)|(vscode-file:))/.test(workerScriptUrl);
62
+ if (workerScriptUrlIsAbsolute && workerScriptUrl.substring(0, globalThis.origin.length) !== globalThis.origin) {
63
+ // this is the cross-origin case
64
+ // i.e. the webpage is running at a different origin than where the scripts are loaded from
65
+ }
66
+ else {
67
+ const start = workerScriptUrl.lastIndexOf('?');
68
+ const end = workerScriptUrl.lastIndexOf('#', start);
69
+ const params = start > 0
70
+ ? new URLSearchParams(workerScriptUrl.substring(start + 1, ~end ? end : undefined))
71
+ : new URLSearchParams();
72
+ COI.addSearchParam(params, true, true);
73
+ const search = params.toString();
74
+ if (!search) {
75
+ workerScriptUrl = `${workerScriptUrl}#${label}`;
76
+ }
77
+ else {
78
+ workerScriptUrl = `${workerScriptUrl}?${params.toString()}#${label}`;
79
+ }
80
+ }
81
+ if (!isESM && !workerScriptUrlIsAbsolute) {
82
+ // we have to convert relative script URLs to the origin because importScripts
83
+ // does not work unless the script URL is absolute
84
+ workerScriptUrl = new URL(workerScriptUrl, globalThis.origin).toString();
85
+ }
86
+ const blob = new Blob([coalesce([
87
+ `/*${label}*/`,
88
+ workerBaseUrl ? `globalThis.MonacoEnvironment = { baseUrl: '${workerBaseUrl}' };` : undefined,
89
+ `globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(getNLSMessages())};`,
90
+ `globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(getNLSLanguage())};`,
91
+ `globalThis._VSCODE_FILE_ROOT = '${globalThis._VSCODE_FILE_ROOT}';`,
92
+ `const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });`,
93
+ `globalThis.workerttPolicy = ttPolicy;`,
94
+ isESM ? `await import(ttPolicy?.createScriptURL('${workerScriptUrl}') ?? '${workerScriptUrl}');` : `importScripts(ttPolicy?.createScriptURL('${workerScriptUrl}') ?? '${workerScriptUrl}');`,
95
+ isESM ? `globalThis.postMessage({ type: 'vscode-worker-ready' });` : undefined, // in ESM signal we are ready after the async import
96
+ `/*${label}*/`
97
+ ]).join('')], { type: 'application/javascript' });
98
+ return URL.createObjectURL(blob);
99
+ }
100
+ function whenESMWorkerReady(worker) {
101
+ return new Promise((resolve, reject) => {
102
+ worker.onmessage = function (e) {
103
+ if (e.data.type === 'vscode-worker-ready') {
104
+ worker.onmessage = null;
105
+ resolve(worker);
106
+ }
107
+ };
108
+ worker.onerror = reject;
109
+ });
110
+ }
111
+ function isPromiseLike(obj) {
112
+ if (typeof obj.then === 'function') {
113
+ return true;
114
+ }
115
+ return false;
116
+ }
117
+ /**
118
+ * A worker that uses HTML5 web workers so that is has
119
+ * its own global scope and its own thread.
120
+ */
121
+ class WebWorker extends Disposable {
122
+ constructor(esmWorkerLocation, amdModuleId, id, label, onMessageCallback, onErrorCallback) {
123
+ super();
124
+ this.id = id;
125
+ this.label = label;
126
+ const workerOrPromise = getWorker(esmWorkerLocation, label);
127
+ if (isPromiseLike(workerOrPromise)) {
128
+ this.worker = workerOrPromise;
129
+ }
130
+ else {
131
+ this.worker = Promise.resolve(workerOrPromise);
132
+ }
133
+ this.postMessage(amdModuleId, []);
134
+ this.worker.then((w) => {
135
+ w.onmessage = function (ev) {
136
+ onMessageCallback(ev.data);
137
+ };
138
+ w.onmessageerror = onErrorCallback;
139
+ if (typeof w.addEventListener === 'function') {
140
+ w.addEventListener('error', onErrorCallback);
141
+ }
142
+ });
143
+ this._register(toDisposable(() => {
144
+ this.worker?.then(w => {
145
+ w.onmessage = null;
146
+ w.onmessageerror = null;
147
+ w.removeEventListener('error', onErrorCallback);
148
+ w.terminate();
149
+ });
150
+ this.worker = null;
151
+ }));
152
+ }
153
+ getId() {
154
+ return this.id;
155
+ }
156
+ postMessage(message, transfer) {
157
+ this.worker?.then(w => {
158
+ try {
159
+ w.postMessage(message, transfer);
160
+ }
161
+ catch (err) {
162
+ onUnexpectedError(err);
163
+ onUnexpectedError(new Error(`FAILED to post message to '${this.label}'-worker`, { cause: err }));
164
+ }
165
+ });
166
+ }
167
+ }
168
+ export class WorkerDescriptor {
169
+ constructor(amdModuleId, label) {
170
+ this.amdModuleId = amdModuleId;
171
+ this.label = label;
172
+ this.esmModuleLocation = (isESM ? FileAccess.asBrowserUri(`${amdModuleId}.esm.js`) : undefined);
173
+ }
174
+ }
175
+ class DefaultWorkerFactory {
176
+ static { this.LAST_WORKER_ID = 0; }
177
+ constructor() {
178
+ this._webWorkerFailedBeforeError = false;
179
+ }
180
+ create(desc, onMessageCallback, onErrorCallback) {
181
+ const workerId = (++DefaultWorkerFactory.LAST_WORKER_ID);
182
+ if (this._webWorkerFailedBeforeError) {
183
+ throw this._webWorkerFailedBeforeError;
184
+ }
185
+ return new WebWorker(desc.esmModuleLocation, desc.amdModuleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => {
186
+ logOnceWebWorkerWarning(err);
187
+ this._webWorkerFailedBeforeError = err;
188
+ onErrorCallback(err);
189
+ });
190
+ }
191
+ }
192
+ export function createWebWorker(arg0, arg1) {
193
+ const workerDescriptor = (typeof arg0 === 'string' ? new WorkerDescriptor(arg0, arg1) : arg0);
194
+ return new SimpleWorkerClient(new DefaultWorkerFactory(), workerDescriptor);
195
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dnd.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Mimes } from '../common/mime.js';
2
+ // Common data transfers
3
+ export const DataTransfers = {
4
+ /**
5
+ * Application specific resource transfer type
6
+ */
7
+ RESOURCES: 'ResourceURLs',
8
+ /**
9
+ * Browser specific transfer type to download
10
+ */
11
+ DOWNLOAD_URL: 'DownloadURL',
12
+ /**
13
+ * Browser specific transfer type for files
14
+ */
15
+ FILES: 'Files',
16
+ /**
17
+ * Typically transfer type for copy/paste transfers.
18
+ */
19
+ TEXT: Mimes.text,
20
+ /**
21
+ * Internal type used to pass around text/uri-list data.
22
+ *
23
+ * This is needed to work around https://bugs.chromium.org/p/chromium/issues/detail?id=239745.
24
+ */
25
+ INTERNAL_URI_LIST: 'application/vnd.code.uri-list',
26
+ };
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dom.js ADDED
@@ -0,0 +1,1525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as browser from './browser.js';
6
+ import { BrowserFeatures } from './canIUse.js';
7
+ import { StandardKeyboardEvent } from './keyboardEvent.js';
8
+ import { StandardMouseEvent } from './mouseEvent.js';
9
+ import { AbstractIdleValue, IntervalTimer, _runWhenIdle } from '../common/async.js';
10
+ import { onUnexpectedError } from '../common/errors.js';
11
+ import * as event from '../common/event.js';
12
+ import * as dompurify from './dompurify/dompurify.js';
13
+ import { Disposable, DisposableStore, toDisposable } from '../common/lifecycle.js';
14
+ import { FileAccess, RemoteAuthorities } from '../common/network.js';
15
+ import * as platform from '../common/platform.js';
16
+ import { hash } from '../common/hash.js';
17
+ import { ensureCodeWindow, mainWindow } from './window.js';
18
+ //# region Multi-Window Support Utilities
19
+ export const { registerWindow, getWindow, getDocument, getWindows, getWindowsCount, getWindowId, getWindowById, hasWindow, onDidRegisterWindow, onWillUnregisterWindow, onDidUnregisterWindow } = (function () {
20
+ const windows = new Map();
21
+ ensureCodeWindow(mainWindow, 1);
22
+ const mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };
23
+ windows.set(mainWindow.vscodeWindowId, mainWindowRegistration);
24
+ const onDidRegisterWindow = new event.Emitter();
25
+ const onDidUnregisterWindow = new event.Emitter();
26
+ const onWillUnregisterWindow = new event.Emitter();
27
+ function getWindowById(windowId, fallbackToMain) {
28
+ const window = typeof windowId === 'number' ? windows.get(windowId) : undefined;
29
+ return window ?? (fallbackToMain ? mainWindowRegistration : undefined);
30
+ }
31
+ return {
32
+ onDidRegisterWindow: onDidRegisterWindow.event,
33
+ onWillUnregisterWindow: onWillUnregisterWindow.event,
34
+ onDidUnregisterWindow: onDidUnregisterWindow.event,
35
+ registerWindow(window) {
36
+ if (windows.has(window.vscodeWindowId)) {
37
+ return Disposable.None;
38
+ }
39
+ const disposables = new DisposableStore();
40
+ const registeredWindow = {
41
+ window,
42
+ disposables: disposables.add(new DisposableStore())
43
+ };
44
+ windows.set(window.vscodeWindowId, registeredWindow);
45
+ disposables.add(toDisposable(() => {
46
+ windows.delete(window.vscodeWindowId);
47
+ onDidUnregisterWindow.fire(window);
48
+ }));
49
+ disposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {
50
+ onWillUnregisterWindow.fire(window);
51
+ }));
52
+ onDidRegisterWindow.fire(registeredWindow);
53
+ return disposables;
54
+ },
55
+ getWindows() {
56
+ return windows.values();
57
+ },
58
+ getWindowsCount() {
59
+ return windows.size;
60
+ },
61
+ getWindowId(targetWindow) {
62
+ return targetWindow.vscodeWindowId;
63
+ },
64
+ hasWindow(windowId) {
65
+ return windows.has(windowId);
66
+ },
67
+ getWindowById,
68
+ getWindow(e) {
69
+ const candidateNode = e;
70
+ if (candidateNode?.ownerDocument?.defaultView) {
71
+ return candidateNode.ownerDocument.defaultView.window;
72
+ }
73
+ const candidateEvent = e;
74
+ if (candidateEvent?.view) {
75
+ return candidateEvent.view.window;
76
+ }
77
+ return mainWindow;
78
+ },
79
+ getDocument(e) {
80
+ const candidateNode = e;
81
+ return getWindow(candidateNode).document;
82
+ }
83
+ };
84
+ })();
85
+ //#endregion
86
+ export function clearNode(node) {
87
+ while (node.firstChild) {
88
+ node.firstChild.remove();
89
+ }
90
+ }
91
+ class DomListener {
92
+ constructor(node, type, handler, options) {
93
+ this._node = node;
94
+ this._type = type;
95
+ this._handler = handler;
96
+ this._options = (options || false);
97
+ this._node.addEventListener(this._type, this._handler, this._options);
98
+ }
99
+ dispose() {
100
+ if (!this._handler) {
101
+ // Already disposed
102
+ return;
103
+ }
104
+ this._node.removeEventListener(this._type, this._handler, this._options);
105
+ // Prevent leakers from holding on to the dom or handler func
106
+ this._node = null;
107
+ this._handler = null;
108
+ }
109
+ }
110
+ export function addDisposableListener(node, type, handler, useCaptureOrOptions) {
111
+ return new DomListener(node, type, handler, useCaptureOrOptions);
112
+ }
113
+ function _wrapAsStandardMouseEvent(targetWindow, handler) {
114
+ return function (e) {
115
+ return handler(new StandardMouseEvent(targetWindow, e));
116
+ };
117
+ }
118
+ function _wrapAsStandardKeyboardEvent(handler) {
119
+ return function (e) {
120
+ return handler(new StandardKeyboardEvent(e));
121
+ };
122
+ }
123
+ export const addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {
124
+ let wrapHandler = handler;
125
+ if (type === 'click' || type === 'mousedown' || type === 'contextmenu') {
126
+ wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);
127
+ }
128
+ else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {
129
+ wrapHandler = _wrapAsStandardKeyboardEvent(handler);
130
+ }
131
+ return addDisposableListener(node, type, wrapHandler, useCapture);
132
+ };
133
+ export const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node, handler, useCapture) {
134
+ const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);
135
+ return addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);
136
+ };
137
+ export const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node, handler, useCapture) {
138
+ const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);
139
+ return addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);
140
+ };
141
+ export function addDisposableGenericMouseDownListener(node, handler, useCapture) {
142
+ return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);
143
+ }
144
+ export function addDisposableGenericMouseUpListener(node, handler, useCapture) {
145
+ return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);
146
+ }
147
+ /**
148
+ * Execute the callback the next time the browser is idle, returning an
149
+ * {@link IDisposable} that will cancel the callback when disposed. This wraps
150
+ * [requestIdleCallback] so it will fallback to [setTimeout] if the environment
151
+ * doesn't support it.
152
+ *
153
+ * @param targetWindow The window for which to run the idle callback
154
+ * @param callback The callback to run when idle, this includes an
155
+ * [IdleDeadline] that provides the time alloted for the idle callback by the
156
+ * browser. Not respecting this deadline will result in a degraded user
157
+ * experience.
158
+ * @param timeout A timeout at which point to queue no longer wait for an idle
159
+ * callback but queue it on the regular event loop (like setTimeout). Typically
160
+ * this should not be used.
161
+ *
162
+ * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline
163
+ * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
164
+ * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout
165
+ */
166
+ export function runWhenWindowIdle(targetWindow, callback, timeout) {
167
+ return _runWhenIdle(targetWindow, callback, timeout);
168
+ }
169
+ /**
170
+ * An implementation of the "idle-until-urgent"-strategy as introduced
171
+ * here: https://philipwalton.com/articles/idle-until-urgent/
172
+ */
173
+ export class WindowIdleValue extends AbstractIdleValue {
174
+ constructor(targetWindow, executor) {
175
+ super(targetWindow, executor);
176
+ }
177
+ }
178
+ /**
179
+ * Schedule a callback to be run at the next animation frame.
180
+ * This allows multiple parties to register callbacks that should run at the next animation frame.
181
+ * If currently in an animation frame, `runner` will be executed immediately.
182
+ * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).
183
+ */
184
+ export let runAtThisOrScheduleAtNextAnimationFrame;
185
+ /**
186
+ * Schedule a callback to be run at the next animation frame.
187
+ * This allows multiple parties to register callbacks that should run at the next animation frame.
188
+ * If currently in an animation frame, `runner` will be executed at the next animation frame.
189
+ * @return token that can be used to cancel the scheduled runner.
190
+ */
191
+ export let scheduleAtNextAnimationFrame;
192
+ export class WindowIntervalTimer extends IntervalTimer {
193
+ /**
194
+ *
195
+ * @param node The optional node from which the target window is determined
196
+ */
197
+ constructor(node) {
198
+ super();
199
+ this.defaultTarget = node && getWindow(node);
200
+ }
201
+ cancelAndSet(runner, interval, targetWindow) {
202
+ return super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);
203
+ }
204
+ }
205
+ class AnimationFrameQueueItem {
206
+ constructor(runner, priority = 0) {
207
+ this._runner = runner;
208
+ this.priority = priority;
209
+ this._canceled = false;
210
+ }
211
+ dispose() {
212
+ this._canceled = true;
213
+ }
214
+ execute() {
215
+ if (this._canceled) {
216
+ return;
217
+ }
218
+ try {
219
+ this._runner();
220
+ }
221
+ catch (e) {
222
+ onUnexpectedError(e);
223
+ }
224
+ }
225
+ // Sort by priority (largest to lowest)
226
+ static sort(a, b) {
227
+ return b.priority - a.priority;
228
+ }
229
+ }
230
+ (function () {
231
+ /**
232
+ * The runners scheduled at the next animation frame
233
+ */
234
+ const NEXT_QUEUE = new Map();
235
+ /**
236
+ * The runners scheduled at the current animation frame
237
+ */
238
+ const CURRENT_QUEUE = new Map();
239
+ /**
240
+ * A flag to keep track if the native requestAnimationFrame was already called
241
+ */
242
+ const animFrameRequested = new Map();
243
+ /**
244
+ * A flag to indicate if currently handling a native requestAnimationFrame callback
245
+ */
246
+ const inAnimationFrameRunner = new Map();
247
+ const animationFrameRunner = (targetWindowId) => {
248
+ animFrameRequested.set(targetWindowId, false);
249
+ const currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];
250
+ CURRENT_QUEUE.set(targetWindowId, currentQueue);
251
+ NEXT_QUEUE.set(targetWindowId, []);
252
+ inAnimationFrameRunner.set(targetWindowId, true);
253
+ while (currentQueue.length > 0) {
254
+ currentQueue.sort(AnimationFrameQueueItem.sort);
255
+ const top = currentQueue.shift();
256
+ top.execute();
257
+ }
258
+ inAnimationFrameRunner.set(targetWindowId, false);
259
+ };
260
+ scheduleAtNextAnimationFrame = (targetWindow, runner, priority = 0) => {
261
+ const targetWindowId = getWindowId(targetWindow);
262
+ const item = new AnimationFrameQueueItem(runner, priority);
263
+ let nextQueue = NEXT_QUEUE.get(targetWindowId);
264
+ if (!nextQueue) {
265
+ nextQueue = [];
266
+ NEXT_QUEUE.set(targetWindowId, nextQueue);
267
+ }
268
+ nextQueue.push(item);
269
+ if (!animFrameRequested.get(targetWindowId)) {
270
+ animFrameRequested.set(targetWindowId, true);
271
+ targetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));
272
+ }
273
+ return item;
274
+ };
275
+ runAtThisOrScheduleAtNextAnimationFrame = (targetWindow, runner, priority) => {
276
+ const targetWindowId = getWindowId(targetWindow);
277
+ if (inAnimationFrameRunner.get(targetWindowId)) {
278
+ const item = new AnimationFrameQueueItem(runner, priority);
279
+ let currentQueue = CURRENT_QUEUE.get(targetWindowId);
280
+ if (!currentQueue) {
281
+ currentQueue = [];
282
+ CURRENT_QUEUE.set(targetWindowId, currentQueue);
283
+ }
284
+ currentQueue.push(item);
285
+ return item;
286
+ }
287
+ else {
288
+ return scheduleAtNextAnimationFrame(targetWindow, runner, priority);
289
+ }
290
+ };
291
+ })();
292
+ export function getComputedStyle(el) {
293
+ return getWindow(el).getComputedStyle(el, null);
294
+ }
295
+ export function getClientArea(element, fallback) {
296
+ const elWindow = getWindow(element);
297
+ const elDocument = elWindow.document;
298
+ // Try with DOM clientWidth / clientHeight
299
+ if (element !== elDocument.body) {
300
+ return new Dimension(element.clientWidth, element.clientHeight);
301
+ }
302
+ // If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight
303
+ if (platform.isIOS && elWindow?.visualViewport) {
304
+ return new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);
305
+ }
306
+ // Try innerWidth / innerHeight
307
+ if (elWindow?.innerWidth && elWindow.innerHeight) {
308
+ return new Dimension(elWindow.innerWidth, elWindow.innerHeight);
309
+ }
310
+ // Try with document.body.clientWidth / document.body.clientHeight
311
+ if (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {
312
+ return new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);
313
+ }
314
+ // Try with document.documentElement.clientWidth / document.documentElement.clientHeight
315
+ if (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {
316
+ return new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);
317
+ }
318
+ if (fallback) {
319
+ return getClientArea(fallback);
320
+ }
321
+ throw new Error('Unable to figure out browser width and height');
322
+ }
323
+ class SizeUtils {
324
+ // Adapted from WinJS
325
+ // Converts a CSS positioning string for the specified element to pixels.
326
+ static convertToPixels(element, value) {
327
+ return parseFloat(value) || 0;
328
+ }
329
+ static getDimension(element, cssPropertyName, jsPropertyName) {
330
+ const computedStyle = getComputedStyle(element);
331
+ const value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';
332
+ return SizeUtils.convertToPixels(element, value);
333
+ }
334
+ static getBorderLeftWidth(element) {
335
+ return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');
336
+ }
337
+ static getBorderRightWidth(element) {
338
+ return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');
339
+ }
340
+ static getBorderTopWidth(element) {
341
+ return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');
342
+ }
343
+ static getBorderBottomWidth(element) {
344
+ return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');
345
+ }
346
+ static getPaddingLeft(element) {
347
+ return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');
348
+ }
349
+ static getPaddingRight(element) {
350
+ return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');
351
+ }
352
+ static getPaddingTop(element) {
353
+ return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');
354
+ }
355
+ static getPaddingBottom(element) {
356
+ return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');
357
+ }
358
+ static getMarginLeft(element) {
359
+ return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');
360
+ }
361
+ static getMarginTop(element) {
362
+ return SizeUtils.getDimension(element, 'margin-top', 'marginTop');
363
+ }
364
+ static getMarginRight(element) {
365
+ return SizeUtils.getDimension(element, 'margin-right', 'marginRight');
366
+ }
367
+ static getMarginBottom(element) {
368
+ return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');
369
+ }
370
+ }
371
+ export class Dimension {
372
+ static { this.None = new Dimension(0, 0); }
373
+ constructor(width, height) {
374
+ this.width = width;
375
+ this.height = height;
376
+ }
377
+ with(width = this.width, height = this.height) {
378
+ if (width !== this.width || height !== this.height) {
379
+ return new Dimension(width, height);
380
+ }
381
+ else {
382
+ return this;
383
+ }
384
+ }
385
+ static is(obj) {
386
+ return typeof obj === 'object' && typeof obj.height === 'number' && typeof obj.width === 'number';
387
+ }
388
+ static lift(obj) {
389
+ if (obj instanceof Dimension) {
390
+ return obj;
391
+ }
392
+ else {
393
+ return new Dimension(obj.width, obj.height);
394
+ }
395
+ }
396
+ static equals(a, b) {
397
+ if (a === b) {
398
+ return true;
399
+ }
400
+ if (!a || !b) {
401
+ return false;
402
+ }
403
+ return a.width === b.width && a.height === b.height;
404
+ }
405
+ }
406
+ export function getTopLeftOffset(element) {
407
+ // Adapted from WinJS.Utilities.getPosition
408
+ // and added borders to the mix
409
+ let offsetParent = element.offsetParent;
410
+ let top = element.offsetTop;
411
+ let left = element.offsetLeft;
412
+ while ((element = element.parentNode) !== null
413
+ && element !== element.ownerDocument.body
414
+ && element !== element.ownerDocument.documentElement) {
415
+ top -= element.scrollTop;
416
+ const c = isShadowRoot(element) ? null : getComputedStyle(element);
417
+ if (c) {
418
+ left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;
419
+ }
420
+ if (element === offsetParent) {
421
+ left += SizeUtils.getBorderLeftWidth(element);
422
+ top += SizeUtils.getBorderTopWidth(element);
423
+ top += element.offsetTop;
424
+ left += element.offsetLeft;
425
+ offsetParent = element.offsetParent;
426
+ }
427
+ }
428
+ return {
429
+ left: left,
430
+ top: top
431
+ };
432
+ }
433
+ export function size(element, width, height) {
434
+ if (typeof width === 'number') {
435
+ element.style.width = `${width}px`;
436
+ }
437
+ if (typeof height === 'number') {
438
+ element.style.height = `${height}px`;
439
+ }
440
+ }
441
+ /**
442
+ * Returns the position of a dom node relative to the entire page.
443
+ */
444
+ export function getDomNodePagePosition(domNode) {
445
+ const bb = domNode.getBoundingClientRect();
446
+ const window = getWindow(domNode);
447
+ return {
448
+ left: bb.left + window.scrollX,
449
+ top: bb.top + window.scrollY,
450
+ width: bb.width,
451
+ height: bb.height
452
+ };
453
+ }
454
+ /**
455
+ * Returns the effective zoom on a given element before window zoom level is applied
456
+ */
457
+ export function getDomNodeZoomLevel(domNode) {
458
+ let testElement = domNode;
459
+ let zoom = 1.0;
460
+ do {
461
+ const elementZoomLevel = getComputedStyle(testElement).zoom;
462
+ if (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {
463
+ zoom *= elementZoomLevel;
464
+ }
465
+ testElement = testElement.parentElement;
466
+ } while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);
467
+ return zoom;
468
+ }
469
+ // Adapted from WinJS
470
+ // Gets the width of the element, including margins.
471
+ export function getTotalWidth(element) {
472
+ const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);
473
+ return element.offsetWidth + margin;
474
+ }
475
+ export function getContentWidth(element) {
476
+ const border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);
477
+ const padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);
478
+ return element.offsetWidth - border - padding;
479
+ }
480
+ // Adapted from WinJS
481
+ // Gets the height of the content of the specified element. The content height does not include borders or padding.
482
+ export function getContentHeight(element) {
483
+ const border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);
484
+ const padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);
485
+ return element.offsetHeight - border - padding;
486
+ }
487
+ // Adapted from WinJS
488
+ // Gets the height of the element, including its margins.
489
+ export function getTotalHeight(element) {
490
+ const margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);
491
+ return element.offsetHeight + margin;
492
+ }
493
+ // ----------------------------------------------------------------------------------------
494
+ export function isAncestor(testChild, testAncestor) {
495
+ return Boolean(testAncestor?.contains(testChild));
496
+ }
497
+ export function findParentWithClass(node, clazz, stopAtClazzOrNode) {
498
+ while (node && node.nodeType === node.ELEMENT_NODE) {
499
+ if (node.classList.contains(clazz)) {
500
+ return node;
501
+ }
502
+ if (stopAtClazzOrNode) {
503
+ if (typeof stopAtClazzOrNode === 'string') {
504
+ if (node.classList.contains(stopAtClazzOrNode)) {
505
+ return null;
506
+ }
507
+ }
508
+ else {
509
+ if (node === stopAtClazzOrNode) {
510
+ return null;
511
+ }
512
+ }
513
+ }
514
+ node = node.parentNode;
515
+ }
516
+ return null;
517
+ }
518
+ export function hasParentWithClass(node, clazz, stopAtClazzOrNode) {
519
+ return !!findParentWithClass(node, clazz, stopAtClazzOrNode);
520
+ }
521
+ export function isShadowRoot(node) {
522
+ return (node && !!node.host && !!node.mode);
523
+ }
524
+ export function isInShadowDOM(domNode) {
525
+ return !!getShadowRoot(domNode);
526
+ }
527
+ export function getShadowRoot(domNode) {
528
+ while (domNode.parentNode) {
529
+ if (domNode === domNode.ownerDocument?.body) {
530
+ // reached the body
531
+ return null;
532
+ }
533
+ domNode = domNode.parentNode;
534
+ }
535
+ return isShadowRoot(domNode) ? domNode : null;
536
+ }
537
+ /**
538
+ * Returns the active element across all child windows
539
+ * based on document focus. Falls back to the main
540
+ * window if no window has focus.
541
+ */
542
+ export function getActiveElement() {
543
+ let result = getActiveDocument().activeElement;
544
+ while (result?.shadowRoot) {
545
+ result = result.shadowRoot.activeElement;
546
+ }
547
+ return result;
548
+ }
549
+ /**
550
+ * Returns true if the focused window active element matches
551
+ * the provided element. Falls back to the main window if no
552
+ * window has focus.
553
+ */
554
+ export function isActiveElement(element) {
555
+ return getActiveElement() === element;
556
+ }
557
+ /**
558
+ * Returns true if the focused window active element is contained in
559
+ * `ancestor`. Falls back to the main window if no window has focus.
560
+ */
561
+ export function isAncestorOfActiveElement(ancestor) {
562
+ return isAncestor(getActiveElement(), ancestor);
563
+ }
564
+ /**
565
+ * Returns the active document across main and child windows.
566
+ * Prefers the window with focus, otherwise falls back to
567
+ * the main windows document.
568
+ */
569
+ export function getActiveDocument() {
570
+ if (getWindowsCount() <= 1) {
571
+ return mainWindow.document;
572
+ }
573
+ const documents = Array.from(getWindows()).map(({ window }) => window.document);
574
+ return documents.find(doc => doc.hasFocus()) ?? mainWindow.document;
575
+ }
576
+ /**
577
+ * Returns the active window across main and child windows.
578
+ * Prefers the window with focus, otherwise falls back to
579
+ * the main window.
580
+ */
581
+ export function getActiveWindow() {
582
+ const document = getActiveDocument();
583
+ return (document.defaultView?.window ?? mainWindow);
584
+ }
585
+ const globalStylesheets = new Map();
586
+ /**
587
+ * A version of createStyleSheet which has a unified API to initialize/set the style content.
588
+ */
589
+ export function createStyleSheet2() {
590
+ return new WrappedStyleElement();
591
+ }
592
+ class WrappedStyleElement {
593
+ constructor() {
594
+ this._currentCssStyle = '';
595
+ this._styleSheet = undefined;
596
+ }
597
+ setStyle(cssStyle) {
598
+ if (cssStyle === this._currentCssStyle) {
599
+ return;
600
+ }
601
+ this._currentCssStyle = cssStyle;
602
+ if (!this._styleSheet) {
603
+ this._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);
604
+ }
605
+ else {
606
+ this._styleSheet.innerText = cssStyle;
607
+ }
608
+ }
609
+ dispose() {
610
+ if (this._styleSheet) {
611
+ this._styleSheet.remove();
612
+ this._styleSheet = undefined;
613
+ }
614
+ }
615
+ }
616
+ export function createStyleSheet(container = mainWindow.document.head, beforeAppend, disposableStore) {
617
+ const style = document.createElement('style');
618
+ style.type = 'text/css';
619
+ style.media = 'screen';
620
+ beforeAppend?.(style);
621
+ container.appendChild(style);
622
+ if (disposableStore) {
623
+ disposableStore.add(toDisposable(() => style.remove()));
624
+ }
625
+ // With <head> as container, the stylesheet becomes global and is tracked
626
+ // to support auxiliary windows to clone the stylesheet.
627
+ if (container === mainWindow.document.head) {
628
+ const globalStylesheetClones = new Set();
629
+ globalStylesheets.set(style, globalStylesheetClones);
630
+ for (const { window: targetWindow, disposables } of getWindows()) {
631
+ if (targetWindow === mainWindow) {
632
+ continue; // main window is already tracked
633
+ }
634
+ const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));
635
+ disposableStore?.add(cloneDisposable);
636
+ }
637
+ }
638
+ return style;
639
+ }
640
+ function cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, targetWindow) {
641
+ const disposables = new DisposableStore();
642
+ const clone = globalStylesheet.cloneNode(true);
643
+ targetWindow.document.head.appendChild(clone);
644
+ disposables.add(toDisposable(() => clone.remove()));
645
+ for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {
646
+ clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);
647
+ }
648
+ disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {
649
+ clone.textContent = globalStylesheet.textContent;
650
+ }));
651
+ globalStylesheetClones.add(clone);
652
+ disposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));
653
+ return disposables;
654
+ }
655
+ export const sharedMutationObserver = new class {
656
+ constructor() {
657
+ this.mutationObservers = new Map();
658
+ }
659
+ observe(target, disposables, options) {
660
+ let mutationObserversPerTarget = this.mutationObservers.get(target);
661
+ if (!mutationObserversPerTarget) {
662
+ mutationObserversPerTarget = new Map();
663
+ this.mutationObservers.set(target, mutationObserversPerTarget);
664
+ }
665
+ const optionsHash = hash(options);
666
+ let mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);
667
+ if (!mutationObserverPerOptions) {
668
+ const onDidMutate = new event.Emitter();
669
+ const observer = new MutationObserver(mutations => onDidMutate.fire(mutations));
670
+ observer.observe(target, options);
671
+ const resolvedMutationObserverPerOptions = mutationObserverPerOptions = {
672
+ users: 1,
673
+ observer,
674
+ onDidMutate: onDidMutate.event
675
+ };
676
+ disposables.add(toDisposable(() => {
677
+ resolvedMutationObserverPerOptions.users -= 1;
678
+ if (resolvedMutationObserverPerOptions.users === 0) {
679
+ onDidMutate.dispose();
680
+ observer.disconnect();
681
+ mutationObserversPerTarget?.delete(optionsHash);
682
+ if (mutationObserversPerTarget?.size === 0) {
683
+ this.mutationObservers.delete(target);
684
+ }
685
+ }
686
+ }));
687
+ mutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);
688
+ }
689
+ else {
690
+ mutationObserverPerOptions.users += 1;
691
+ }
692
+ return mutationObserverPerOptions.onDidMutate;
693
+ }
694
+ };
695
+ let _sharedStyleSheet = null;
696
+ function getSharedStyleSheet() {
697
+ if (!_sharedStyleSheet) {
698
+ _sharedStyleSheet = createStyleSheet();
699
+ }
700
+ return _sharedStyleSheet;
701
+ }
702
+ function getDynamicStyleSheetRules(style) {
703
+ if (style?.sheet?.rules) {
704
+ // Chrome, IE
705
+ return style.sheet.rules;
706
+ }
707
+ if (style?.sheet?.cssRules) {
708
+ // FF
709
+ return style.sheet.cssRules;
710
+ }
711
+ return [];
712
+ }
713
+ export function createCSSRule(selector, cssText, style = getSharedStyleSheet()) {
714
+ if (!style || !cssText) {
715
+ return;
716
+ }
717
+ style.sheet?.insertRule(`${selector} {${cssText}}`, 0);
718
+ // Apply rule also to all cloned global stylesheets
719
+ for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {
720
+ createCSSRule(selector, cssText, clonedGlobalStylesheet);
721
+ }
722
+ }
723
+ export function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {
724
+ if (!style) {
725
+ return;
726
+ }
727
+ const rules = getDynamicStyleSheetRules(style);
728
+ const toDelete = [];
729
+ for (let i = 0; i < rules.length; i++) {
730
+ const rule = rules[i];
731
+ if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {
732
+ toDelete.push(i);
733
+ }
734
+ }
735
+ for (let i = toDelete.length - 1; i >= 0; i--) {
736
+ style.sheet?.deleteRule(toDelete[i]);
737
+ }
738
+ // Remove rules also from all cloned global stylesheets
739
+ for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {
740
+ removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);
741
+ }
742
+ }
743
+ function isCSSStyleRule(rule) {
744
+ return typeof rule.selectorText === 'string';
745
+ }
746
+ export function isHTMLElement(e) {
747
+ // eslint-disable-next-line no-restricted-syntax
748
+ return e instanceof HTMLElement || e instanceof getWindow(e).HTMLElement;
749
+ }
750
+ export function isHTMLAnchorElement(e) {
751
+ // eslint-disable-next-line no-restricted-syntax
752
+ return e instanceof HTMLAnchorElement || e instanceof getWindow(e).HTMLAnchorElement;
753
+ }
754
+ export function isSVGElement(e) {
755
+ // eslint-disable-next-line no-restricted-syntax
756
+ return e instanceof SVGElement || e instanceof getWindow(e).SVGElement;
757
+ }
758
+ export function isMouseEvent(e) {
759
+ // eslint-disable-next-line no-restricted-syntax
760
+ return e instanceof MouseEvent || e instanceof getWindow(e).MouseEvent;
761
+ }
762
+ export function isKeyboardEvent(e) {
763
+ // eslint-disable-next-line no-restricted-syntax
764
+ return e instanceof KeyboardEvent || e instanceof getWindow(e).KeyboardEvent;
765
+ }
766
+ export const EventType = {
767
+ // Mouse
768
+ CLICK: 'click',
769
+ AUXCLICK: 'auxclick',
770
+ DBLCLICK: 'dblclick',
771
+ MOUSE_UP: 'mouseup',
772
+ MOUSE_DOWN: 'mousedown',
773
+ MOUSE_OVER: 'mouseover',
774
+ MOUSE_MOVE: 'mousemove',
775
+ MOUSE_OUT: 'mouseout',
776
+ MOUSE_ENTER: 'mouseenter',
777
+ MOUSE_LEAVE: 'mouseleave',
778
+ MOUSE_WHEEL: 'wheel',
779
+ POINTER_UP: 'pointerup',
780
+ POINTER_DOWN: 'pointerdown',
781
+ POINTER_MOVE: 'pointermove',
782
+ POINTER_LEAVE: 'pointerleave',
783
+ CONTEXT_MENU: 'contextmenu',
784
+ WHEEL: 'wheel',
785
+ // Keyboard
786
+ KEY_DOWN: 'keydown',
787
+ KEY_PRESS: 'keypress',
788
+ KEY_UP: 'keyup',
789
+ // HTML Document
790
+ LOAD: 'load',
791
+ BEFORE_UNLOAD: 'beforeunload',
792
+ UNLOAD: 'unload',
793
+ PAGE_SHOW: 'pageshow',
794
+ PAGE_HIDE: 'pagehide',
795
+ PASTE: 'paste',
796
+ ABORT: 'abort',
797
+ ERROR: 'error',
798
+ RESIZE: 'resize',
799
+ SCROLL: 'scroll',
800
+ FULLSCREEN_CHANGE: 'fullscreenchange',
801
+ WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',
802
+ // Form
803
+ SELECT: 'select',
804
+ CHANGE: 'change',
805
+ SUBMIT: 'submit',
806
+ RESET: 'reset',
807
+ FOCUS: 'focus',
808
+ FOCUS_IN: 'focusin',
809
+ FOCUS_OUT: 'focusout',
810
+ BLUR: 'blur',
811
+ INPUT: 'input',
812
+ // Local Storage
813
+ STORAGE: 'storage',
814
+ // Drag
815
+ DRAG_START: 'dragstart',
816
+ DRAG: 'drag',
817
+ DRAG_ENTER: 'dragenter',
818
+ DRAG_LEAVE: 'dragleave',
819
+ DRAG_OVER: 'dragover',
820
+ DROP: 'drop',
821
+ DRAG_END: 'dragend',
822
+ // Animation
823
+ ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',
824
+ ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',
825
+ ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'
826
+ };
827
+ export function isEventLike(obj) {
828
+ const candidate = obj;
829
+ return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');
830
+ }
831
+ export const EventHelper = {
832
+ stop: (e, cancelBubble) => {
833
+ e.preventDefault();
834
+ if (cancelBubble) {
835
+ e.stopPropagation();
836
+ }
837
+ return e;
838
+ }
839
+ };
840
+ export function saveParentsScrollTop(node) {
841
+ const r = [];
842
+ for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
843
+ r[i] = node.scrollTop;
844
+ node = node.parentNode;
845
+ }
846
+ return r;
847
+ }
848
+ export function restoreParentsScrollTop(node, state) {
849
+ for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
850
+ if (node.scrollTop !== state[i]) {
851
+ node.scrollTop = state[i];
852
+ }
853
+ node = node.parentNode;
854
+ }
855
+ }
856
+ class FocusTracker extends Disposable {
857
+ static hasFocusWithin(element) {
858
+ if (isHTMLElement(element)) {
859
+ const shadowRoot = getShadowRoot(element);
860
+ const activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);
861
+ return isAncestor(activeElement, element);
862
+ }
863
+ else {
864
+ const window = element;
865
+ return isAncestor(window.document.activeElement, window.document);
866
+ }
867
+ }
868
+ constructor(element) {
869
+ super();
870
+ this._onDidFocus = this._register(new event.Emitter());
871
+ this.onDidFocus = this._onDidFocus.event;
872
+ this._onDidBlur = this._register(new event.Emitter());
873
+ this.onDidBlur = this._onDidBlur.event;
874
+ let hasFocus = FocusTracker.hasFocusWithin(element);
875
+ let loosingFocus = false;
876
+ const onFocus = () => {
877
+ loosingFocus = false;
878
+ if (!hasFocus) {
879
+ hasFocus = true;
880
+ this._onDidFocus.fire();
881
+ }
882
+ };
883
+ const onBlur = () => {
884
+ if (hasFocus) {
885
+ loosingFocus = true;
886
+ (isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {
887
+ if (loosingFocus) {
888
+ loosingFocus = false;
889
+ hasFocus = false;
890
+ this._onDidBlur.fire();
891
+ }
892
+ }, 0);
893
+ }
894
+ };
895
+ this._refreshStateHandler = () => {
896
+ const currentNodeHasFocus = FocusTracker.hasFocusWithin(element);
897
+ if (currentNodeHasFocus !== hasFocus) {
898
+ if (hasFocus) {
899
+ onBlur();
900
+ }
901
+ else {
902
+ onFocus();
903
+ }
904
+ }
905
+ };
906
+ this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));
907
+ this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));
908
+ if (isHTMLElement(element)) {
909
+ this._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));
910
+ this._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));
911
+ }
912
+ }
913
+ }
914
+ /**
915
+ * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.
916
+ *
917
+ * @param element The `HTMLElement` or `Window` to track focus changes on.
918
+ * @returns An `IFocusTracker` instance.
919
+ */
920
+ export function trackFocus(element) {
921
+ return new FocusTracker(element);
922
+ }
923
+ export function after(sibling, child) {
924
+ sibling.after(child);
925
+ return child;
926
+ }
927
+ export function append(parent, ...children) {
928
+ parent.append(...children);
929
+ if (children.length === 1 && typeof children[0] !== 'string') {
930
+ return children[0];
931
+ }
932
+ }
933
+ export function prepend(parent, child) {
934
+ parent.insertBefore(child, parent.firstChild);
935
+ return child;
936
+ }
937
+ /**
938
+ * Removes all children from `parent` and appends `children`
939
+ */
940
+ export function reset(parent, ...children) {
941
+ parent.innerText = '';
942
+ append(parent, ...children);
943
+ }
944
+ const SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;
945
+ export var Namespace;
946
+ (function (Namespace) {
947
+ Namespace["HTML"] = "http://www.w3.org/1999/xhtml";
948
+ Namespace["SVG"] = "http://www.w3.org/2000/svg";
949
+ })(Namespace || (Namespace = {}));
950
+ function _$(namespace, description, attrs, ...children) {
951
+ const match = SELECTOR_REGEX.exec(description);
952
+ if (!match) {
953
+ throw new Error('Bad use of emmet');
954
+ }
955
+ const tagName = match[1] || 'div';
956
+ let result;
957
+ if (namespace !== Namespace.HTML) {
958
+ result = document.createElementNS(namespace, tagName);
959
+ }
960
+ else {
961
+ result = document.createElement(tagName);
962
+ }
963
+ if (match[3]) {
964
+ result.id = match[3];
965
+ }
966
+ if (match[4]) {
967
+ result.className = match[4].replace(/\./g, ' ').trim();
968
+ }
969
+ if (attrs) {
970
+ Object.entries(attrs).forEach(([name, value]) => {
971
+ if (typeof value === 'undefined') {
972
+ return;
973
+ }
974
+ if (/^on\w+$/.test(name)) {
975
+ result[name] = value;
976
+ }
977
+ else if (name === 'selected') {
978
+ if (value) {
979
+ result.setAttribute(name, 'true');
980
+ }
981
+ }
982
+ else {
983
+ result.setAttribute(name, value);
984
+ }
985
+ });
986
+ }
987
+ result.append(...children);
988
+ return result;
989
+ }
990
+ export function $(description, attrs, ...children) {
991
+ return _$(Namespace.HTML, description, attrs, ...children);
992
+ }
993
+ $.SVG = function (description, attrs, ...children) {
994
+ return _$(Namespace.SVG, description, attrs, ...children);
995
+ };
996
+ export function setVisibility(visible, ...elements) {
997
+ if (visible) {
998
+ show(...elements);
999
+ }
1000
+ else {
1001
+ hide(...elements);
1002
+ }
1003
+ }
1004
+ export function show(...elements) {
1005
+ for (const element of elements) {
1006
+ element.style.display = '';
1007
+ element.removeAttribute('aria-hidden');
1008
+ }
1009
+ }
1010
+ export function hide(...elements) {
1011
+ for (const element of elements) {
1012
+ element.style.display = 'none';
1013
+ element.setAttribute('aria-hidden', 'true');
1014
+ }
1015
+ }
1016
+ /**
1017
+ * Find a value usable for a dom node size such that the likelihood that it would be
1018
+ * displayed with constant screen pixels size is as high as possible.
1019
+ *
1020
+ * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio
1021
+ * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps"
1022
+ * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.
1023
+ */
1024
+ export function computeScreenAwareSize(window, cssPx) {
1025
+ const screenPx = window.devicePixelRatio * cssPx;
1026
+ return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;
1027
+ }
1028
+ /**
1029
+ * Open safely a new window. This is the best way to do so, but you cannot tell
1030
+ * if the window was opened or if it was blocked by the browser's popup blocker.
1031
+ * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.
1032
+ *
1033
+ * See https://github.com/microsoft/monaco-editor/issues/601
1034
+ * To protect against malicious code in the linked site, particularly phishing attempts,
1035
+ * the window.opener should be set to null to prevent the linked site from having access
1036
+ * to change the location of the current page.
1037
+ * See https://mathiasbynens.github.io/rel-noopener/
1038
+ */
1039
+ export function windowOpenNoOpener(url) {
1040
+ // By using 'noopener' in the `windowFeatures` argument, the newly created window will
1041
+ // not be able to use `window.opener` to reach back to the current page.
1042
+ // See https://stackoverflow.com/a/46958731
1043
+ // See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener
1044
+ // However, this also doesn't allow us to realize if the browser blocked
1045
+ // the creation of the window.
1046
+ mainWindow.open(url, '_blank', 'noopener');
1047
+ }
1048
+ export function animate(targetWindow, fn) {
1049
+ const step = () => {
1050
+ fn();
1051
+ stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);
1052
+ };
1053
+ let stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);
1054
+ return toDisposable(() => stepDisposable.dispose());
1055
+ }
1056
+ RemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http');
1057
+ /**
1058
+ * returns url('...')
1059
+ */
1060
+ export function asCSSUrl(uri) {
1061
+ if (!uri) {
1062
+ return `url('')`;
1063
+ }
1064
+ return `url('${FileAccess.uriToBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`;
1065
+ }
1066
+ export function asCSSPropertyValue(value) {
1067
+ return `'${value.replace(/'/g, '%27')}'`;
1068
+ }
1069
+ export function asCssValueWithDefault(cssPropertyValue, dflt) {
1070
+ if (cssPropertyValue !== undefined) {
1071
+ const variableMatch = cssPropertyValue.match(/^\s*var\((.+)\)$/);
1072
+ if (variableMatch) {
1073
+ const varArguments = variableMatch[1].split(',', 2);
1074
+ if (varArguments.length === 2) {
1075
+ dflt = asCssValueWithDefault(varArguments[1].trim(), dflt);
1076
+ }
1077
+ return `var(${varArguments[0]}, ${dflt})`;
1078
+ }
1079
+ return cssPropertyValue;
1080
+ }
1081
+ return dflt;
1082
+ }
1083
+ // -- sanitize and trusted html
1084
+ /**
1085
+ * Hooks dompurify using `afterSanitizeAttributes` to check that all `href` and `src`
1086
+ * attributes are valid.
1087
+ */
1088
+ export function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, allowDataImages = false) {
1089
+ // https://github.com/cure53/DOMPurify/blob/main/demos/hooks-scheme-allowlist.html
1090
+ // build an anchor to map URLs to
1091
+ const anchor = document.createElement('a');
1092
+ dompurify.addHook('afterSanitizeAttributes', (node) => {
1093
+ // check all href/src attributes for validity
1094
+ for (const attr of ['href', 'src']) {
1095
+ if (node.hasAttribute(attr)) {
1096
+ const attrValue = node.getAttribute(attr);
1097
+ if (attr === 'href' && attrValue.startsWith('#')) {
1098
+ // Allow fragment links
1099
+ continue;
1100
+ }
1101
+ anchor.href = attrValue;
1102
+ if (!allowedProtocols.includes(anchor.protocol.replace(/:$/, ''))) {
1103
+ if (allowDataImages && attr === 'src' && anchor.href.startsWith('data:')) {
1104
+ continue;
1105
+ }
1106
+ node.removeAttribute(attr);
1107
+ }
1108
+ }
1109
+ }
1110
+ });
1111
+ return toDisposable(() => {
1112
+ dompurify.removeHook('afterSanitizeAttributes');
1113
+ });
1114
+ }
1115
+ /**
1116
+ * List of safe, non-input html tags.
1117
+ */
1118
+ export const basicMarkupHtmlTags = Object.freeze([
1119
+ 'a',
1120
+ 'abbr',
1121
+ 'b',
1122
+ 'bdo',
1123
+ 'blockquote',
1124
+ 'br',
1125
+ 'caption',
1126
+ 'cite',
1127
+ 'code',
1128
+ 'col',
1129
+ 'colgroup',
1130
+ 'dd',
1131
+ 'del',
1132
+ 'details',
1133
+ 'dfn',
1134
+ 'div',
1135
+ 'dl',
1136
+ 'dt',
1137
+ 'em',
1138
+ 'figcaption',
1139
+ 'figure',
1140
+ 'h1',
1141
+ 'h2',
1142
+ 'h3',
1143
+ 'h4',
1144
+ 'h5',
1145
+ 'h6',
1146
+ 'hr',
1147
+ 'i',
1148
+ 'img',
1149
+ 'input',
1150
+ 'ins',
1151
+ 'kbd',
1152
+ 'label',
1153
+ 'li',
1154
+ 'mark',
1155
+ 'ol',
1156
+ 'p',
1157
+ 'pre',
1158
+ 'q',
1159
+ 'rp',
1160
+ 'rt',
1161
+ 'ruby',
1162
+ 'samp',
1163
+ 'small',
1164
+ 'small',
1165
+ 'source',
1166
+ 'span',
1167
+ 'strike',
1168
+ 'strong',
1169
+ 'sub',
1170
+ 'summary',
1171
+ 'sup',
1172
+ 'table',
1173
+ 'tbody',
1174
+ 'td',
1175
+ 'tfoot',
1176
+ 'th',
1177
+ 'thead',
1178
+ 'time',
1179
+ 'tr',
1180
+ 'tt',
1181
+ 'u',
1182
+ 'ul',
1183
+ 'var',
1184
+ 'video',
1185
+ 'wbr',
1186
+ ]);
1187
+ const defaultDomPurifyConfig = Object.freeze({
1188
+ ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'],
1189
+ ALLOWED_ATTR: ['href', 'data-href', 'data-command', 'target', 'title', 'name', 'src', 'alt', 'class', 'id', 'role', 'tabindex', 'style', 'data-code', 'width', 'height', 'align', 'x-dispatch', 'required', 'checked', 'placeholder', 'type', 'start'],
1190
+ RETURN_DOM: false,
1191
+ RETURN_DOM_FRAGMENT: false,
1192
+ RETURN_TRUSTED_TYPE: true
1193
+ });
1194
+ export class ModifierKeyEmitter extends event.Emitter {
1195
+ constructor() {
1196
+ super();
1197
+ this._subscriptions = new DisposableStore();
1198
+ this._keyStatus = {
1199
+ altKey: false,
1200
+ shiftKey: false,
1201
+ ctrlKey: false,
1202
+ metaKey: false
1203
+ };
1204
+ this._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));
1205
+ }
1206
+ registerListeners(window, disposables) {
1207
+ disposables.add(addDisposableListener(window, 'keydown', e => {
1208
+ if (e.defaultPrevented) {
1209
+ return;
1210
+ }
1211
+ const event = new StandardKeyboardEvent(e);
1212
+ // If Alt-key keydown event is repeated, ignore it #112347
1213
+ // Only known to be necessary for Alt-Key at the moment #115810
1214
+ if (event.keyCode === 6 /* KeyCode.Alt */ && e.repeat) {
1215
+ return;
1216
+ }
1217
+ if (e.altKey && !this._keyStatus.altKey) {
1218
+ this._keyStatus.lastKeyPressed = 'alt';
1219
+ }
1220
+ else if (e.ctrlKey && !this._keyStatus.ctrlKey) {
1221
+ this._keyStatus.lastKeyPressed = 'ctrl';
1222
+ }
1223
+ else if (e.metaKey && !this._keyStatus.metaKey) {
1224
+ this._keyStatus.lastKeyPressed = 'meta';
1225
+ }
1226
+ else if (e.shiftKey && !this._keyStatus.shiftKey) {
1227
+ this._keyStatus.lastKeyPressed = 'shift';
1228
+ }
1229
+ else if (event.keyCode !== 6 /* KeyCode.Alt */) {
1230
+ this._keyStatus.lastKeyPressed = undefined;
1231
+ }
1232
+ else {
1233
+ return;
1234
+ }
1235
+ this._keyStatus.altKey = e.altKey;
1236
+ this._keyStatus.ctrlKey = e.ctrlKey;
1237
+ this._keyStatus.metaKey = e.metaKey;
1238
+ this._keyStatus.shiftKey = e.shiftKey;
1239
+ if (this._keyStatus.lastKeyPressed) {
1240
+ this._keyStatus.event = e;
1241
+ this.fire(this._keyStatus);
1242
+ }
1243
+ }, true));
1244
+ disposables.add(addDisposableListener(window, 'keyup', e => {
1245
+ if (e.defaultPrevented) {
1246
+ return;
1247
+ }
1248
+ if (!e.altKey && this._keyStatus.altKey) {
1249
+ this._keyStatus.lastKeyReleased = 'alt';
1250
+ }
1251
+ else if (!e.ctrlKey && this._keyStatus.ctrlKey) {
1252
+ this._keyStatus.lastKeyReleased = 'ctrl';
1253
+ }
1254
+ else if (!e.metaKey && this._keyStatus.metaKey) {
1255
+ this._keyStatus.lastKeyReleased = 'meta';
1256
+ }
1257
+ else if (!e.shiftKey && this._keyStatus.shiftKey) {
1258
+ this._keyStatus.lastKeyReleased = 'shift';
1259
+ }
1260
+ else {
1261
+ this._keyStatus.lastKeyReleased = undefined;
1262
+ }
1263
+ if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {
1264
+ this._keyStatus.lastKeyPressed = undefined;
1265
+ }
1266
+ this._keyStatus.altKey = e.altKey;
1267
+ this._keyStatus.ctrlKey = e.ctrlKey;
1268
+ this._keyStatus.metaKey = e.metaKey;
1269
+ this._keyStatus.shiftKey = e.shiftKey;
1270
+ if (this._keyStatus.lastKeyReleased) {
1271
+ this._keyStatus.event = e;
1272
+ this.fire(this._keyStatus);
1273
+ }
1274
+ }, true));
1275
+ disposables.add(addDisposableListener(window.document.body, 'mousedown', () => {
1276
+ this._keyStatus.lastKeyPressed = undefined;
1277
+ }, true));
1278
+ disposables.add(addDisposableListener(window.document.body, 'mouseup', () => {
1279
+ this._keyStatus.lastKeyPressed = undefined;
1280
+ }, true));
1281
+ disposables.add(addDisposableListener(window.document.body, 'mousemove', e => {
1282
+ if (e.buttons) {
1283
+ this._keyStatus.lastKeyPressed = undefined;
1284
+ }
1285
+ }, true));
1286
+ disposables.add(addDisposableListener(window, 'blur', () => {
1287
+ this.resetKeyStatus();
1288
+ }));
1289
+ }
1290
+ get keyStatus() {
1291
+ return this._keyStatus;
1292
+ }
1293
+ /**
1294
+ * Allows to explicitly reset the key status based on more knowledge (#109062)
1295
+ */
1296
+ resetKeyStatus() {
1297
+ this.doResetKeyStatus();
1298
+ this.fire(this._keyStatus);
1299
+ }
1300
+ doResetKeyStatus() {
1301
+ this._keyStatus = {
1302
+ altKey: false,
1303
+ shiftKey: false,
1304
+ ctrlKey: false,
1305
+ metaKey: false
1306
+ };
1307
+ }
1308
+ static getInstance() {
1309
+ if (!ModifierKeyEmitter.instance) {
1310
+ ModifierKeyEmitter.instance = new ModifierKeyEmitter();
1311
+ }
1312
+ return ModifierKeyEmitter.instance;
1313
+ }
1314
+ dispose() {
1315
+ super.dispose();
1316
+ this._subscriptions.dispose();
1317
+ }
1318
+ }
1319
+ export class DragAndDropObserver extends Disposable {
1320
+ constructor(element, callbacks) {
1321
+ super();
1322
+ this.element = element;
1323
+ this.callbacks = callbacks;
1324
+ // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE
1325
+ // calls see https://github.com/microsoft/vscode/issues/14470
1326
+ // when the element has child elements where the events are fired
1327
+ // repeadedly.
1328
+ this.counter = 0;
1329
+ // Allows to measure the duration of the drag operation.
1330
+ this.dragStartTime = 0;
1331
+ this.registerListeners();
1332
+ }
1333
+ registerListeners() {
1334
+ if (this.callbacks.onDragStart) {
1335
+ this._register(addDisposableListener(this.element, EventType.DRAG_START, (e) => {
1336
+ this.callbacks.onDragStart?.(e);
1337
+ }));
1338
+ }
1339
+ if (this.callbacks.onDrag) {
1340
+ this._register(addDisposableListener(this.element, EventType.DRAG, (e) => {
1341
+ this.callbacks.onDrag?.(e);
1342
+ }));
1343
+ }
1344
+ this._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e) => {
1345
+ this.counter++;
1346
+ this.dragStartTime = e.timeStamp;
1347
+ this.callbacks.onDragEnter?.(e);
1348
+ }));
1349
+ this._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e) => {
1350
+ e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
1351
+ this.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);
1352
+ }));
1353
+ this._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e) => {
1354
+ this.counter--;
1355
+ if (this.counter === 0) {
1356
+ this.dragStartTime = 0;
1357
+ this.callbacks.onDragLeave?.(e);
1358
+ }
1359
+ }));
1360
+ this._register(addDisposableListener(this.element, EventType.DRAG_END, (e) => {
1361
+ this.counter = 0;
1362
+ this.dragStartTime = 0;
1363
+ this.callbacks.onDragEnd?.(e);
1364
+ }));
1365
+ this._register(addDisposableListener(this.element, EventType.DROP, (e) => {
1366
+ this.counter = 0;
1367
+ this.dragStartTime = 0;
1368
+ this.callbacks.onDrop?.(e);
1369
+ }));
1370
+ }
1371
+ }
1372
+ const H_REGEX = /(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;
1373
+ export function h(tag, ...args) {
1374
+ let attributes;
1375
+ let children;
1376
+ if (Array.isArray(args[0])) {
1377
+ attributes = {};
1378
+ children = args[0];
1379
+ }
1380
+ else {
1381
+ attributes = args[0] || {};
1382
+ children = args[1];
1383
+ }
1384
+ const match = H_REGEX.exec(tag);
1385
+ if (!match || !match.groups) {
1386
+ throw new Error('Bad use of h');
1387
+ }
1388
+ const tagName = match.groups['tag'] || 'div';
1389
+ const el = document.createElement(tagName);
1390
+ if (match.groups['id']) {
1391
+ el.id = match.groups['id'];
1392
+ }
1393
+ const classNames = [];
1394
+ if (match.groups['class']) {
1395
+ for (const className of match.groups['class'].split('.')) {
1396
+ if (className !== '') {
1397
+ classNames.push(className);
1398
+ }
1399
+ }
1400
+ }
1401
+ if (attributes.className !== undefined) {
1402
+ for (const className of attributes.className.split('.')) {
1403
+ if (className !== '') {
1404
+ classNames.push(className);
1405
+ }
1406
+ }
1407
+ }
1408
+ if (classNames.length > 0) {
1409
+ el.className = classNames.join(' ');
1410
+ }
1411
+ const result = {};
1412
+ if (match.groups['name']) {
1413
+ result[match.groups['name']] = el;
1414
+ }
1415
+ if (children) {
1416
+ for (const c of children) {
1417
+ if (isHTMLElement(c)) {
1418
+ el.appendChild(c);
1419
+ }
1420
+ else if (typeof c === 'string') {
1421
+ el.append(c);
1422
+ }
1423
+ else if ('root' in c) {
1424
+ Object.assign(result, c);
1425
+ el.appendChild(c.root);
1426
+ }
1427
+ }
1428
+ }
1429
+ for (const [key, value] of Object.entries(attributes)) {
1430
+ if (key === 'className') {
1431
+ continue;
1432
+ }
1433
+ else if (key === 'style') {
1434
+ for (const [cssKey, cssValue] of Object.entries(value)) {
1435
+ el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue);
1436
+ }
1437
+ }
1438
+ else if (key === 'tabIndex') {
1439
+ el.tabIndex = value;
1440
+ }
1441
+ else {
1442
+ el.setAttribute(camelCaseToHyphenCase(key), value.toString());
1443
+ }
1444
+ }
1445
+ result['root'] = el;
1446
+ return result;
1447
+ }
1448
+ export function svgElem(tag, ...args) {
1449
+ let attributes;
1450
+ let children;
1451
+ if (Array.isArray(args[0])) {
1452
+ attributes = {};
1453
+ children = args[0];
1454
+ }
1455
+ else {
1456
+ attributes = args[0] || {};
1457
+ children = args[1];
1458
+ }
1459
+ const match = H_REGEX.exec(tag);
1460
+ if (!match || !match.groups) {
1461
+ throw new Error('Bad use of h');
1462
+ }
1463
+ const tagName = match.groups['tag'] || 'div';
1464
+ const el = document.createElementNS('http://www.w3.org/2000/svg', tagName);
1465
+ if (match.groups['id']) {
1466
+ el.id = match.groups['id'];
1467
+ }
1468
+ const classNames = [];
1469
+ if (match.groups['class']) {
1470
+ for (const className of match.groups['class'].split('.')) {
1471
+ if (className !== '') {
1472
+ classNames.push(className);
1473
+ }
1474
+ }
1475
+ }
1476
+ if (attributes.className !== undefined) {
1477
+ for (const className of attributes.className.split('.')) {
1478
+ if (className !== '') {
1479
+ classNames.push(className);
1480
+ }
1481
+ }
1482
+ }
1483
+ if (classNames.length > 0) {
1484
+ el.className = classNames.join(' ');
1485
+ }
1486
+ const result = {};
1487
+ if (match.groups['name']) {
1488
+ result[match.groups['name']] = el;
1489
+ }
1490
+ if (children) {
1491
+ for (const c of children) {
1492
+ if (isHTMLElement(c)) {
1493
+ el.appendChild(c);
1494
+ }
1495
+ else if (typeof c === 'string') {
1496
+ el.append(c);
1497
+ }
1498
+ else if ('root' in c) {
1499
+ Object.assign(result, c);
1500
+ el.appendChild(c.root);
1501
+ }
1502
+ }
1503
+ }
1504
+ for (const [key, value] of Object.entries(attributes)) {
1505
+ if (key === 'className') {
1506
+ continue;
1507
+ }
1508
+ else if (key === 'style') {
1509
+ for (const [cssKey, cssValue] of Object.entries(value)) {
1510
+ el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue);
1511
+ }
1512
+ }
1513
+ else if (key === 'tabIndex') {
1514
+ el.tabIndex = value;
1515
+ }
1516
+ else {
1517
+ el.setAttribute(camelCaseToHyphenCase(key), value.toString());
1518
+ }
1519
+ }
1520
+ result['root'] = el;
1521
+ return result;
1522
+ }
1523
+ function camelCaseToHyphenCase(str) {
1524
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
1525
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/domObservable.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { createStyleSheet2 } from './dom.js';
6
+ import { DisposableStore } from '../common/lifecycle.js';
7
+ import { autorun } from '../common/observable.js';
8
+ export function createStyleSheetFromObservable(css) {
9
+ const store = new DisposableStore();
10
+ const w = store.add(createStyleSheet2());
11
+ store.add(autorun(reader => {
12
+ w.setStyle(css.read(reader));
13
+ }));
14
+ return store;
15
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js ADDED
@@ -0,0 +1,1569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */
2
+
3
+ const {
4
+ entries,
5
+ setPrototypeOf,
6
+ isFrozen,
7
+ getPrototypeOf,
8
+ getOwnPropertyDescriptor
9
+ } = Object;
10
+ let {
11
+ freeze,
12
+ seal,
13
+ create
14
+ } = Object; // eslint-disable-line import/no-mutable-exports
15
+ let {
16
+ apply,
17
+ construct
18
+ } = typeof Reflect !== 'undefined' && Reflect;
19
+ if (!freeze) {
20
+ freeze = function freeze(x) {
21
+ return x;
22
+ };
23
+ }
24
+ if (!seal) {
25
+ seal = function seal(x) {
26
+ return x;
27
+ };
28
+ }
29
+ if (!apply) {
30
+ apply = function apply(fun, thisValue, args) {
31
+ return fun.apply(thisValue, args);
32
+ };
33
+ }
34
+ if (!construct) {
35
+ construct = function construct(Func, args) {
36
+ return new Func(...args);
37
+ };
38
+ }
39
+ const arrayForEach = unapply(Array.prototype.forEach);
40
+ const arrayPop = unapply(Array.prototype.pop);
41
+ const arrayPush = unapply(Array.prototype.push);
42
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
43
+ const stringToString = unapply(String.prototype.toString);
44
+ const stringMatch = unapply(String.prototype.match);
45
+ const stringReplace = unapply(String.prototype.replace);
46
+ const stringIndexOf = unapply(String.prototype.indexOf);
47
+ const stringTrim = unapply(String.prototype.trim);
48
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
49
+ const regExpTest = unapply(RegExp.prototype.test);
50
+ const typeErrorCreate = unconstruct(TypeError);
51
+
52
+ /**
53
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
54
+ *
55
+ * @param {Function} func - The function to be wrapped and called.
56
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
57
+ */
58
+ function unapply(func) {
59
+ return function (thisArg) {
60
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
61
+ args[_key - 1] = arguments[_key];
62
+ }
63
+ return apply(func, thisArg, args);
64
+ };
65
+ }
66
+
67
+ /**
68
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
69
+ *
70
+ * @param {Function} func - The constructor function to be wrapped and called.
71
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
72
+ */
73
+ function unconstruct(func) {
74
+ return function () {
75
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
76
+ args[_key2] = arguments[_key2];
77
+ }
78
+ return construct(func, args);
79
+ };
80
+ }
81
+
82
+ /**
83
+ * Add properties to a lookup table
84
+ *
85
+ * @param {Object} set - The set to which elements will be added.
86
+ * @param {Array} array - The array containing elements to be added to the set.
87
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
88
+ * @returns {Object} The modified set with added elements.
89
+ */
90
+ function addToSet(set, array) {
91
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
92
+ if (setPrototypeOf) {
93
+ // Make 'in' and truthy checks like Boolean(set.constructor)
94
+ // independent of any properties defined on Object.prototype.
95
+ // Prevent prototype setters from intercepting set as a this value.
96
+ setPrototypeOf(set, null);
97
+ }
98
+ let l = array.length;
99
+ while (l--) {
100
+ let element = array[l];
101
+ if (typeof element === 'string') {
102
+ const lcElement = transformCaseFunc(element);
103
+ if (lcElement !== element) {
104
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
105
+ if (!isFrozen(array)) {
106
+ array[l] = lcElement;
107
+ }
108
+ element = lcElement;
109
+ }
110
+ }
111
+ set[element] = true;
112
+ }
113
+ return set;
114
+ }
115
+
116
+ /**
117
+ * Clean up an array to harden against CSPP
118
+ *
119
+ * @param {Array} array - The array to be cleaned.
120
+ * @returns {Array} The cleaned version of the array
121
+ */
122
+ function cleanArray(array) {
123
+ for (let index = 0; index < array.length; index++) {
124
+ const isPropertyExist = objectHasOwnProperty(array, index);
125
+ if (!isPropertyExist) {
126
+ array[index] = null;
127
+ }
128
+ }
129
+ return array;
130
+ }
131
+
132
+ /**
133
+ * Shallow clone an object
134
+ *
135
+ * @param {Object} object - The object to be cloned.
136
+ * @returns {Object} A new object that copies the original.
137
+ */
138
+ function clone(object) {
139
+ const newObject = create(null);
140
+ for (const [property, value] of entries(object)) {
141
+ const isPropertyExist = objectHasOwnProperty(object, property);
142
+ if (isPropertyExist) {
143
+ if (Array.isArray(value)) {
144
+ newObject[property] = cleanArray(value);
145
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
146
+ newObject[property] = clone(value);
147
+ } else {
148
+ newObject[property] = value;
149
+ }
150
+ }
151
+ }
152
+ return newObject;
153
+ }
154
+
155
+ /**
156
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
157
+ *
158
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
159
+ * @param {String} prop - The property name for which to find the getter function.
160
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
161
+ */
162
+ function lookupGetter(object, prop) {
163
+ while (object !== null) {
164
+ const desc = getOwnPropertyDescriptor(object, prop);
165
+ if (desc) {
166
+ if (desc.get) {
167
+ return unapply(desc.get);
168
+ }
169
+ if (typeof desc.value === 'function') {
170
+ return unapply(desc.value);
171
+ }
172
+ }
173
+ object = getPrototypeOf(object);
174
+ }
175
+ function fallbackValue() {
176
+ return null;
177
+ }
178
+ return fallbackValue;
179
+ }
180
+
181
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
182
+
183
+ // SVG
184
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
185
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
186
+
187
+ // List of SVG elements that are disallowed by default.
188
+ // We still need to know them so that we can do namespace
189
+ // checks properly in case one wants to add them to
190
+ // allow-list.
191
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
192
+ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
193
+
194
+ // Similarly to SVG, we want to know all MathML elements,
195
+ // even those that we disallow by default.
196
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
197
+ const text = freeze(['#text']);
198
+
199
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
200
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
201
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
202
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
203
+
204
+ // eslint-disable-next-line unicorn/better-regex
205
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
206
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
207
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
208
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
209
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
210
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
211
+ );
212
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
213
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
214
+ );
215
+ const DOCTYPE_NAME = seal(/^html$/i);
216
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
217
+
218
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
219
+ __proto__: null,
220
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
221
+ ERB_EXPR: ERB_EXPR,
222
+ TMPLIT_EXPR: TMPLIT_EXPR,
223
+ DATA_ATTR: DATA_ATTR,
224
+ ARIA_ATTR: ARIA_ATTR,
225
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
226
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
227
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
228
+ DOCTYPE_NAME: DOCTYPE_NAME,
229
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT
230
+ });
231
+
232
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
233
+ const NODE_TYPE = {
234
+ element: 1,
235
+ attribute: 2,
236
+ text: 3,
237
+ cdataSection: 4,
238
+ entityReference: 5,
239
+ // Deprecated
240
+ entityNode: 6,
241
+ // Deprecated
242
+ progressingInstruction: 7,
243
+ comment: 8,
244
+ document: 9,
245
+ documentType: 10,
246
+ documentFragment: 11,
247
+ notation: 12 // Deprecated
248
+ };
249
+ const getGlobal = function getGlobal() {
250
+ return typeof window === 'undefined' ? null : window;
251
+ };
252
+
253
+ /**
254
+ * Creates a no-op policy for internal use only.
255
+ * Don't export this function outside this module!
256
+ * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.
257
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
258
+ * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types
259
+ * are not supported or creating the policy failed).
260
+ */
261
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
262
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
263
+ return null;
264
+ }
265
+
266
+ // Allow the callers to control the unique policy name
267
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
268
+ // Policy creation with duplicate names throws in Trusted Types.
269
+ let suffix = null;
270
+ const ATTR_NAME = 'data-tt-policy-suffix';
271
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
272
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
273
+ }
274
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
275
+ try {
276
+ return trustedTypes.createPolicy(policyName, {
277
+ createHTML(html) {
278
+ return html;
279
+ },
280
+ createScriptURL(scriptUrl) {
281
+ return scriptUrl;
282
+ }
283
+ });
284
+ } catch (_) {
285
+ // Policy creation failed (most likely another DOMPurify script has
286
+ // already run). Skip creating the policy, as this will only cause errors
287
+ // if TT are enforced.
288
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
289
+ return null;
290
+ }
291
+ };
292
+ function createDOMPurify() {
293
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
294
+ const DOMPurify = root => createDOMPurify(root);
295
+
296
+ /**
297
+ * Version label, exposed for easier checks
298
+ * if DOMPurify is up to date or not
299
+ */
300
+ DOMPurify.version = '3.1.7';
301
+
302
+ /**
303
+ * Array of elements that DOMPurify removed during sanitation.
304
+ * Empty if nothing was removed.
305
+ */
306
+ DOMPurify.removed = [];
307
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
308
+ // Not running in a browser, provide a factory function
309
+ // so that you can pass your own Window
310
+ DOMPurify.isSupported = false;
311
+ return DOMPurify;
312
+ }
313
+ let {
314
+ document
315
+ } = window;
316
+ const originalDocument = document;
317
+ const currentScript = originalDocument.currentScript;
318
+ const {
319
+ DocumentFragment,
320
+ HTMLTemplateElement,
321
+ Node,
322
+ Element,
323
+ NodeFilter,
324
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
325
+ HTMLFormElement,
326
+ DOMParser,
327
+ trustedTypes
328
+ } = window;
329
+ const ElementPrototype = Element.prototype;
330
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
331
+ const remove = lookupGetter(ElementPrototype, 'remove');
332
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
333
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
334
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
335
+
336
+ // As per issue #47, the web-components registry is inherited by a
337
+ // new document created via createHTMLDocument. As per the spec
338
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
339
+ // a new empty registry is used when creating a template contents owner
340
+ // document, so we use that as our parent document to ensure nothing
341
+ // is inherited.
342
+ if (typeof HTMLTemplateElement === 'function') {
343
+ const template = document.createElement('template');
344
+ if (template.content && template.content.ownerDocument) {
345
+ document = template.content.ownerDocument;
346
+ }
347
+ }
348
+ let trustedTypesPolicy;
349
+ let emptyHTML = '';
350
+ const {
351
+ implementation,
352
+ createNodeIterator,
353
+ createDocumentFragment,
354
+ getElementsByTagName
355
+ } = document;
356
+ const {
357
+ importNode
358
+ } = originalDocument;
359
+ let hooks = {};
360
+
361
+ /**
362
+ * Expose whether this browser supports running the full DOMPurify.
363
+ */
364
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
365
+ const {
366
+ MUSTACHE_EXPR,
367
+ ERB_EXPR,
368
+ TMPLIT_EXPR,
369
+ DATA_ATTR,
370
+ ARIA_ATTR,
371
+ IS_SCRIPT_OR_DATA,
372
+ ATTR_WHITESPACE,
373
+ CUSTOM_ELEMENT
374
+ } = EXPRESSIONS;
375
+ let {
376
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
377
+ } = EXPRESSIONS;
378
+
379
+ /**
380
+ * We consider the elements and attributes below to be safe. Ideally
381
+ * don't add any new ones but feel free to remove unwanted ones.
382
+ */
383
+
384
+ /* allowed element names */
385
+ let ALLOWED_TAGS = null;
386
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
387
+
388
+ /* Allowed attribute names */
389
+ let ALLOWED_ATTR = null;
390
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
391
+
392
+ /*
393
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
394
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
395
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
396
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
397
+ */
398
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
399
+ tagNameCheck: {
400
+ writable: true,
401
+ configurable: false,
402
+ enumerable: true,
403
+ value: null
404
+ },
405
+ attributeNameCheck: {
406
+ writable: true,
407
+ configurable: false,
408
+ enumerable: true,
409
+ value: null
410
+ },
411
+ allowCustomizedBuiltInElements: {
412
+ writable: true,
413
+ configurable: false,
414
+ enumerable: true,
415
+ value: false
416
+ }
417
+ }));
418
+
419
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
420
+ let FORBID_TAGS = null;
421
+
422
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
423
+ let FORBID_ATTR = null;
424
+
425
+ /* Decide if ARIA attributes are okay */
426
+ let ALLOW_ARIA_ATTR = true;
427
+
428
+ /* Decide if custom data attributes are okay */
429
+ let ALLOW_DATA_ATTR = true;
430
+
431
+ /* Decide if unknown protocols are okay */
432
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
433
+
434
+ /* Decide if self-closing tags in attributes are allowed.
435
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
436
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
437
+
438
+ /* Output should be safe for common template engines.
439
+ * This means, DOMPurify removes data attributes, mustaches and ERB
440
+ */
441
+ let SAFE_FOR_TEMPLATES = false;
442
+
443
+ /* Output should be safe even for XML used within HTML and alike.
444
+ * This means, DOMPurify removes comments when containing risky content.
445
+ */
446
+ let SAFE_FOR_XML = true;
447
+
448
+ /* Decide if document with <html>... should be returned */
449
+ let WHOLE_DOCUMENT = false;
450
+
451
+ /* Track whether config is already set on this instance of DOMPurify. */
452
+ let SET_CONFIG = false;
453
+
454
+ /* Decide if all elements (e.g. style, script) must be children of
455
+ * document.body. By default, browsers might move them to document.head */
456
+ let FORCE_BODY = false;
457
+
458
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
459
+ * string (or a TrustedHTML object if Trusted Types are supported).
460
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
461
+ */
462
+ let RETURN_DOM = false;
463
+
464
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
465
+ * string (or a TrustedHTML object if Trusted Types are supported) */
466
+ let RETURN_DOM_FRAGMENT = false;
467
+
468
+ /* Try to return a Trusted Type object instead of a string, return a string in
469
+ * case Trusted Types are not supported */
470
+ let RETURN_TRUSTED_TYPE = false;
471
+
472
+ /* Output should be free from DOM clobbering attacks?
473
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
474
+ */
475
+ let SANITIZE_DOM = true;
476
+
477
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
478
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
479
+ *
480
+ * HTML/DOM spec rules that enable DOM Clobbering:
481
+ * - Named Access on Window (§7.3.3)
482
+ * - DOM Tree Accessors (§3.1.5)
483
+ * - Form Element Parent-Child Relations (§4.10.3)
484
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
485
+ * - HTMLCollection (§4.2.10.2)
486
+ *
487
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
488
+ * with a constant string, i.e., `user-content-`
489
+ */
490
+ let SANITIZE_NAMED_PROPS = false;
491
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
492
+
493
+ /* Keep element content when removing element? */
494
+ let KEEP_CONTENT = true;
495
+
496
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
497
+ * of importing it into a new Document and returning a sanitized copy */
498
+ let IN_PLACE = false;
499
+
500
+ /* Allow usage of profiles like html, svg and mathMl */
501
+ let USE_PROFILES = {};
502
+
503
+ /* Tags to ignore content of when KEEP_CONTENT is true */
504
+ let FORBID_CONTENTS = null;
505
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
506
+
507
+ /* Tags that are safe for data: URIs */
508
+ let DATA_URI_TAGS = null;
509
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
510
+
511
+ /* Attributes safe for values like "javascript:" */
512
+ let URI_SAFE_ATTRIBUTES = null;
513
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
514
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
515
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
516
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
517
+ /* Document namespace */
518
+ let NAMESPACE = HTML_NAMESPACE;
519
+ let IS_EMPTY_INPUT = false;
520
+
521
+ /* Allowed XHTML+XML namespaces */
522
+ let ALLOWED_NAMESPACES = null;
523
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
524
+
525
+ /* Parsing of strict XHTML documents */
526
+ let PARSER_MEDIA_TYPE = null;
527
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
528
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
529
+ let transformCaseFunc = null;
530
+
531
+ /* Keep a reference to config to pass to hooks */
532
+ let CONFIG = null;
533
+
534
+ /* Ideally, do not touch anything below this line */
535
+ /* ______________________________________________ */
536
+
537
+ const formElement = document.createElement('form');
538
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
539
+ return testValue instanceof RegExp || testValue instanceof Function;
540
+ };
541
+
542
+ /**
543
+ * _parseConfig
544
+ *
545
+ * @param {Object} cfg optional config literal
546
+ */
547
+ // eslint-disable-next-line complexity
548
+ const _parseConfig = function _parseConfig() {
549
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
550
+ if (CONFIG && CONFIG === cfg) {
551
+ return;
552
+ }
553
+
554
+ /* Shield configuration object from tampering */
555
+ if (!cfg || typeof cfg !== 'object') {
556
+ cfg = {};
557
+ }
558
+
559
+ /* Shield configuration object from prototype pollution */
560
+ cfg = clone(cfg);
561
+ PARSER_MEDIA_TYPE =
562
+ // eslint-disable-next-line unicorn/prefer-includes
563
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
564
+
565
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
566
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
567
+
568
+ /* Set configuration parameters */
569
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
570
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
571
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
572
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
573
+ // eslint-disable-line indent
574
+ cfg.ADD_URI_SAFE_ATTR,
575
+ // eslint-disable-line indent
576
+ transformCaseFunc // eslint-disable-line indent
577
+ ) // eslint-disable-line indent
578
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
579
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
580
+ // eslint-disable-line indent
581
+ cfg.ADD_DATA_URI_TAGS,
582
+ // eslint-disable-line indent
583
+ transformCaseFunc // eslint-disable-line indent
584
+ ) // eslint-disable-line indent
585
+ : DEFAULT_DATA_URI_TAGS;
586
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
587
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
588
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
589
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
590
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
591
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
592
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
593
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
594
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
595
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
596
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
597
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
598
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
599
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
600
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
601
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
602
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
603
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
604
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
605
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
606
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
607
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
608
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
609
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
610
+ }
611
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
612
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
613
+ }
614
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
615
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
616
+ }
617
+ if (SAFE_FOR_TEMPLATES) {
618
+ ALLOW_DATA_ATTR = false;
619
+ }
620
+ if (RETURN_DOM_FRAGMENT) {
621
+ RETURN_DOM = true;
622
+ }
623
+
624
+ /* Parse profile info */
625
+ if (USE_PROFILES) {
626
+ ALLOWED_TAGS = addToSet({}, text);
627
+ ALLOWED_ATTR = [];
628
+ if (USE_PROFILES.html === true) {
629
+ addToSet(ALLOWED_TAGS, html$1);
630
+ addToSet(ALLOWED_ATTR, html);
631
+ }
632
+ if (USE_PROFILES.svg === true) {
633
+ addToSet(ALLOWED_TAGS, svg$1);
634
+ addToSet(ALLOWED_ATTR, svg);
635
+ addToSet(ALLOWED_ATTR, xml);
636
+ }
637
+ if (USE_PROFILES.svgFilters === true) {
638
+ addToSet(ALLOWED_TAGS, svgFilters);
639
+ addToSet(ALLOWED_ATTR, svg);
640
+ addToSet(ALLOWED_ATTR, xml);
641
+ }
642
+ if (USE_PROFILES.mathMl === true) {
643
+ addToSet(ALLOWED_TAGS, mathMl$1);
644
+ addToSet(ALLOWED_ATTR, mathMl);
645
+ addToSet(ALLOWED_ATTR, xml);
646
+ }
647
+ }
648
+
649
+ /* Merge configuration parameters */
650
+ if (cfg.ADD_TAGS) {
651
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
652
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
653
+ }
654
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
655
+ }
656
+ if (cfg.ADD_ATTR) {
657
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
658
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
659
+ }
660
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
661
+ }
662
+ if (cfg.ADD_URI_SAFE_ATTR) {
663
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
664
+ }
665
+ if (cfg.FORBID_CONTENTS) {
666
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
667
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
668
+ }
669
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
670
+ }
671
+
672
+ /* Add #text in case KEEP_CONTENT is set to true */
673
+ if (KEEP_CONTENT) {
674
+ ALLOWED_TAGS['#text'] = true;
675
+ }
676
+
677
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
678
+ if (WHOLE_DOCUMENT) {
679
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
680
+ }
681
+
682
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
683
+ if (ALLOWED_TAGS.table) {
684
+ addToSet(ALLOWED_TAGS, ['tbody']);
685
+ delete FORBID_TAGS.tbody;
686
+ }
687
+ if (cfg.TRUSTED_TYPES_POLICY) {
688
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
689
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
690
+ }
691
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
692
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
693
+ }
694
+
695
+ // Overwrite existing TrustedTypes policy.
696
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
697
+
698
+ // Sign local variables required by `sanitize`.
699
+ emptyHTML = trustedTypesPolicy.createHTML('');
700
+ } else {
701
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
702
+ if (trustedTypesPolicy === undefined) {
703
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
704
+ }
705
+
706
+ // If creating the internal policy succeeded sign internal variables.
707
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
708
+ emptyHTML = trustedTypesPolicy.createHTML('');
709
+ }
710
+ }
711
+
712
+ // Prevent further manipulation of configuration.
713
+ // Not available in IE8, Safari 5, etc.
714
+ if (freeze) {
715
+ freeze(cfg);
716
+ }
717
+ CONFIG = cfg;
718
+ };
719
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
720
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
721
+
722
+ // Certain elements are allowed in both SVG and HTML
723
+ // namespace. We need to specify them explicitly
724
+ // so that they don't get erroneously deleted from
725
+ // HTML namespace.
726
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
727
+
728
+ /* Keep track of all possible SVG and MathML tags
729
+ * so that we can perform the namespace checks
730
+ * correctly. */
731
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
732
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
733
+
734
+ /**
735
+ * @param {Element} element a DOM element whose namespace is being checked
736
+ * @returns {boolean} Return false if the element has a
737
+ * namespace that a spec-compliant parser would never
738
+ * return. Return true otherwise.
739
+ */
740
+ const _checkValidNamespace = function _checkValidNamespace(element) {
741
+ let parent = getParentNode(element);
742
+
743
+ // In JSDOM, if we're inside shadow DOM, then parentNode
744
+ // can be null. We just simulate parent in this case.
745
+ if (!parent || !parent.tagName) {
746
+ parent = {
747
+ namespaceURI: NAMESPACE,
748
+ tagName: 'template'
749
+ };
750
+ }
751
+ const tagName = stringToLowerCase(element.tagName);
752
+ const parentTagName = stringToLowerCase(parent.tagName);
753
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
754
+ return false;
755
+ }
756
+ if (element.namespaceURI === SVG_NAMESPACE) {
757
+ // The only way to switch from HTML namespace to SVG
758
+ // is via <svg>. If it happens via any other tag, then
759
+ // it should be killed.
760
+ if (parent.namespaceURI === HTML_NAMESPACE) {
761
+ return tagName === 'svg';
762
+ }
763
+
764
+ // The only way to switch from MathML to SVG is via`
765
+ // svg if parent is either <annotation-xml> or MathML
766
+ // text integration points.
767
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
768
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
769
+ }
770
+
771
+ // We only allow elements that are defined in SVG
772
+ // spec. All others are disallowed in SVG namespace.
773
+ return Boolean(ALL_SVG_TAGS[tagName]);
774
+ }
775
+ if (element.namespaceURI === MATHML_NAMESPACE) {
776
+ // The only way to switch from HTML namespace to MathML
777
+ // is via <math>. If it happens via any other tag, then
778
+ // it should be killed.
779
+ if (parent.namespaceURI === HTML_NAMESPACE) {
780
+ return tagName === 'math';
781
+ }
782
+
783
+ // The only way to switch from SVG to MathML is via
784
+ // <math> and HTML integration points
785
+ if (parent.namespaceURI === SVG_NAMESPACE) {
786
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
787
+ }
788
+
789
+ // We only allow elements that are defined in MathML
790
+ // spec. All others are disallowed in MathML namespace.
791
+ return Boolean(ALL_MATHML_TAGS[tagName]);
792
+ }
793
+ if (element.namespaceURI === HTML_NAMESPACE) {
794
+ // The only way to switch from SVG to HTML is via
795
+ // HTML integration points, and from MathML to HTML
796
+ // is via MathML text integration points
797
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
798
+ return false;
799
+ }
800
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
801
+ return false;
802
+ }
803
+
804
+ // We disallow tags that are specific for MathML
805
+ // or SVG and should never appear in HTML namespace
806
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
807
+ }
808
+
809
+ // For XHTML and XML documents that support custom namespaces
810
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
811
+ return true;
812
+ }
813
+
814
+ // The code should never reach this place (this means
815
+ // that the element somehow got namespace that is not
816
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
817
+ // Return false just in case.
818
+ return false;
819
+ };
820
+
821
+ /**
822
+ * _forceRemove
823
+ *
824
+ * @param {Node} node a DOM node
825
+ */
826
+ const _forceRemove = function _forceRemove(node) {
827
+ arrayPush(DOMPurify.removed, {
828
+ element: node
829
+ });
830
+ try {
831
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
832
+ getParentNode(node).removeChild(node);
833
+ } catch (_) {
834
+ remove(node);
835
+ }
836
+ };
837
+
838
+ /**
839
+ * _removeAttribute
840
+ *
841
+ * @param {String} name an Attribute name
842
+ * @param {Node} node a DOM node
843
+ */
844
+ const _removeAttribute = function _removeAttribute(name, node) {
845
+ try {
846
+ arrayPush(DOMPurify.removed, {
847
+ attribute: node.getAttributeNode(name),
848
+ from: node
849
+ });
850
+ } catch (_) {
851
+ arrayPush(DOMPurify.removed, {
852
+ attribute: null,
853
+ from: node
854
+ });
855
+ }
856
+ node.removeAttribute(name);
857
+
858
+ // We void attribute values for unremovable "is"" attributes
859
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
860
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
861
+ try {
862
+ _forceRemove(node);
863
+ } catch (_) { }
864
+ } else {
865
+ try {
866
+ node.setAttribute(name, '');
867
+ } catch (_) { }
868
+ }
869
+ }
870
+ };
871
+
872
+ /**
873
+ * _initDocument
874
+ *
875
+ * @param {String} dirty a string of dirty markup
876
+ * @return {Document} a DOM, filled with the dirty markup
877
+ */
878
+ const _initDocument = function _initDocument(dirty) {
879
+ /* Create a HTML document */
880
+ let doc = null;
881
+ let leadingWhitespace = null;
882
+ if (FORCE_BODY) {
883
+ dirty = '<remove></remove>' + dirty;
884
+ } else {
885
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
886
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
887
+ leadingWhitespace = matches && matches[0];
888
+ }
889
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
890
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
891
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
892
+ }
893
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
894
+ /*
895
+ * Use the DOMParser API by default, fallback later if needs be
896
+ * DOMParser not work for svg when has multiple root element.
897
+ */
898
+ if (NAMESPACE === HTML_NAMESPACE) {
899
+ try {
900
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
901
+ } catch (_) { }
902
+ }
903
+
904
+ /* Use createHTMLDocument in case DOMParser is not available */
905
+ if (!doc || !doc.documentElement) {
906
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
907
+ try {
908
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
909
+ } catch (_) {
910
+ // Syntax error if dirtyPayload is invalid xml
911
+ }
912
+ }
913
+ const body = doc.body || doc.documentElement;
914
+ if (dirty && leadingWhitespace) {
915
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
916
+ }
917
+
918
+ /* Work on whole document or just its body */
919
+ if (NAMESPACE === HTML_NAMESPACE) {
920
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
921
+ }
922
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
923
+ };
924
+
925
+ /**
926
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
927
+ *
928
+ * @param {Node} root The root element or node to start traversing on.
929
+ * @return {NodeIterator} The created NodeIterator
930
+ */
931
+ const _createNodeIterator = function _createNodeIterator(root) {
932
+ return createNodeIterator.call(root.ownerDocument || root, root,
933
+ // eslint-disable-next-line no-bitwise
934
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
935
+ };
936
+
937
+ /**
938
+ * _isClobbered
939
+ *
940
+ * @param {Node} elm element to check for clobbering attacks
941
+ * @return {Boolean} true if clobbered, false if safe
942
+ */
943
+ const _isClobbered = function _isClobbered(elm) {
944
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
945
+ };
946
+
947
+ /**
948
+ * Checks whether the given object is a DOM node.
949
+ *
950
+ * @param {Node} object object to check whether it's a DOM node
951
+ * @return {Boolean} true is object is a DOM node
952
+ */
953
+ const _isNode = function _isNode(object) {
954
+ return typeof Node === 'function' && object instanceof Node;
955
+ };
956
+
957
+ /**
958
+ * _executeHook
959
+ * Execute user configurable hooks
960
+ *
961
+ * @param {String} entryPoint Name of the hook's entry point
962
+ * @param {Node} currentNode node to work on with the hook
963
+ * @param {Object} data additional hook parameters
964
+ */
965
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
966
+ if (!hooks[entryPoint]) {
967
+ return;
968
+ }
969
+ arrayForEach(hooks[entryPoint], hook => {
970
+ hook.call(DOMPurify, currentNode, data, CONFIG);
971
+ });
972
+ };
973
+
974
+ /**
975
+ * _sanitizeElements
976
+ *
977
+ * @protect nodeName
978
+ * @protect textContent
979
+ * @protect removeChild
980
+ *
981
+ * @param {Node} currentNode to check for permission to exist
982
+ * @return {Boolean} true if node was killed, false if left alive
983
+ */
984
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
985
+ let content = null;
986
+
987
+ /* Execute a hook if present */
988
+ _executeHook('beforeSanitizeElements', currentNode, null);
989
+
990
+ /* Check if element is clobbered or can clobber */
991
+ if (_isClobbered(currentNode)) {
992
+ _forceRemove(currentNode);
993
+ return true;
994
+ }
995
+
996
+ /* Now let's check the element's type and name */
997
+ const tagName = transformCaseFunc(currentNode.nodeName);
998
+
999
+ /* Execute a hook if present */
1000
+ _executeHook('uponSanitizeElement', currentNode, {
1001
+ tagName,
1002
+ allowedTags: ALLOWED_TAGS
1003
+ });
1004
+
1005
+ /* Detect mXSS attempts abusing namespace confusion */
1006
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1007
+ _forceRemove(currentNode);
1008
+ return true;
1009
+ }
1010
+
1011
+ /* Remove any occurrence of processing instructions */
1012
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
1013
+ _forceRemove(currentNode);
1014
+ return true;
1015
+ }
1016
+
1017
+ /* Remove any kind of possibly harmful comments */
1018
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
1019
+ _forceRemove(currentNode);
1020
+ return true;
1021
+ }
1022
+
1023
+ /* Remove element if anything forbids its presence */
1024
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1025
+ /* Check if we have a custom element to handle */
1026
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1027
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1028
+ return false;
1029
+ }
1030
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1031
+ return false;
1032
+ }
1033
+ }
1034
+
1035
+ /* Keep content except for bad-listed elements */
1036
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1037
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1038
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1039
+ if (childNodes && parentNode) {
1040
+ const childCount = childNodes.length;
1041
+ for (let i = childCount - 1; i >= 0; --i) {
1042
+ const childClone = cloneNode(childNodes[i], true);
1043
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
1044
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
1045
+ }
1046
+ }
1047
+ }
1048
+ _forceRemove(currentNode);
1049
+ return true;
1050
+ }
1051
+
1052
+ /* Check whether element has a valid namespace */
1053
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1054
+ _forceRemove(currentNode);
1055
+ return true;
1056
+ }
1057
+
1058
+ /* Make sure that older browsers don't get fallback-tag mXSS */
1059
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1060
+ _forceRemove(currentNode);
1061
+ return true;
1062
+ }
1063
+
1064
+ /* Sanitize element content to be template-safe */
1065
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1066
+ /* Get the element's text content */
1067
+ content = currentNode.textContent;
1068
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1069
+ content = stringReplace(content, expr, ' ');
1070
+ });
1071
+ if (currentNode.textContent !== content) {
1072
+ arrayPush(DOMPurify.removed, {
1073
+ element: currentNode.cloneNode()
1074
+ });
1075
+ currentNode.textContent = content;
1076
+ }
1077
+ }
1078
+
1079
+ /* Execute a hook if present */
1080
+ _executeHook('afterSanitizeElements', currentNode, null);
1081
+ return false;
1082
+ };
1083
+
1084
+ /**
1085
+ * _isValidAttribute
1086
+ *
1087
+ * @param {string} lcTag Lowercase tag name of containing element.
1088
+ * @param {string} lcName Lowercase attribute name.
1089
+ * @param {string} value Attribute value.
1090
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
1091
+ */
1092
+ // eslint-disable-next-line complexity
1093
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1094
+ /* Make sure attribute cannot clobber */
1095
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1096
+ return false;
1097
+ }
1098
+
1099
+ /* Allow valid data-* attributes: At least one character after "-"
1100
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1101
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1102
+ We don't need to check the value; it's always URI safe. */
1103
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)); else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)); else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1104
+ if (
1105
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1106
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1107
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1108
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
1109
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1110
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1111
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))); else {
1112
+ return false;
1113
+ }
1114
+ /* Check value is safe. First, is attr inert? If so, is safe */
1115
+ } else if (URI_SAFE_ATTRIBUTES[lcName]); else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))); else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]); else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))); else if (value) {
1116
+ return false;
1117
+ } else;
1118
+ return true;
1119
+ };
1120
+
1121
+ /**
1122
+ * _isBasicCustomElement
1123
+ * checks if at least one dash is included in tagName, and it's not the first char
1124
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1125
+ *
1126
+ * @param {string} tagName name of the tag of the node to sanitize
1127
+ * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1128
+ */
1129
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1130
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
1131
+ };
1132
+
1133
+ /**
1134
+ * _sanitizeAttributes
1135
+ *
1136
+ * @protect attributes
1137
+ * @protect nodeName
1138
+ * @protect removeAttribute
1139
+ * @protect setAttribute
1140
+ *
1141
+ * @param {Node} currentNode to sanitize
1142
+ */
1143
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1144
+ /* Execute a hook if present */
1145
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
1146
+ const {
1147
+ attributes
1148
+ } = currentNode;
1149
+
1150
+ /* Check if we have attributes; if not we might have a text node */
1151
+ if (!attributes) {
1152
+ return;
1153
+ }
1154
+ const hookEvent = {
1155
+ attrName: '',
1156
+ attrValue: '',
1157
+ keepAttr: true,
1158
+ allowedAttributes: ALLOWED_ATTR
1159
+ };
1160
+ let l = attributes.length;
1161
+
1162
+ /* Go backwards over all attributes; safely remove bad ones */
1163
+ while (l--) {
1164
+ const attr = attributes[l];
1165
+ const {
1166
+ name,
1167
+ namespaceURI,
1168
+ value: attrValue
1169
+ } = attr;
1170
+ const lcName = transformCaseFunc(name);
1171
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
1172
+
1173
+ /* Execute a hook if present */
1174
+ hookEvent.attrName = lcName;
1175
+ hookEvent.attrValue = value;
1176
+ hookEvent.keepAttr = true;
1177
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1178
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1179
+ value = hookEvent.attrValue;
1180
+
1181
+ /* Did the hooks approve of the attribute? */
1182
+ if (hookEvent.forceKeepAttr) {
1183
+ continue;
1184
+ }
1185
+
1186
+ /* Remove attribute */
1187
+ _removeAttribute(name, currentNode);
1188
+
1189
+ /* Did the hooks approve of the attribute? */
1190
+ if (!hookEvent.keepAttr) {
1191
+ continue;
1192
+ }
1193
+
1194
+ /* Work around a security issue in jQuery 3.0 */
1195
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1196
+ _removeAttribute(name, currentNode);
1197
+ continue;
1198
+ }
1199
+
1200
+ /* Sanitize attribute content to be template-safe */
1201
+ if (SAFE_FOR_TEMPLATES) {
1202
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1203
+ value = stringReplace(value, expr, ' ');
1204
+ });
1205
+ }
1206
+
1207
+ /* Is `value` valid for this attribute? */
1208
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1209
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1210
+ continue;
1211
+ }
1212
+
1213
+ /* Full DOM Clobbering protection via namespace isolation,
1214
+ * Prefix id and name attributes with `user-content-`
1215
+ */
1216
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1217
+ // Remove the attribute with this value
1218
+ _removeAttribute(name, currentNode);
1219
+
1220
+ // Prefix the value and later re-create the attribute with the sanitized value
1221
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1222
+ }
1223
+
1224
+ /* Work around a security issue with comments inside attributes */
1225
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
1226
+ _removeAttribute(name, currentNode);
1227
+ continue;
1228
+ }
1229
+
1230
+ /* Handle attributes that require Trusted Types */
1231
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1232
+ if (namespaceURI); else {
1233
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1234
+ case 'TrustedHTML':
1235
+ {
1236
+ value = trustedTypesPolicy.createHTML(value);
1237
+ break;
1238
+ }
1239
+ case 'TrustedScriptURL':
1240
+ {
1241
+ value = trustedTypesPolicy.createScriptURL(value);
1242
+ break;
1243
+ }
1244
+ }
1245
+ }
1246
+ }
1247
+
1248
+ /* Handle invalid data-* attribute set by try-catching it */
1249
+ try {
1250
+ if (namespaceURI) {
1251
+ currentNode.setAttributeNS(namespaceURI, name, value);
1252
+ } else {
1253
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1254
+ currentNode.setAttribute(name, value);
1255
+ }
1256
+ if (_isClobbered(currentNode)) {
1257
+ _forceRemove(currentNode);
1258
+ } else {
1259
+ arrayPop(DOMPurify.removed);
1260
+ }
1261
+ } catch (_) { }
1262
+ }
1263
+
1264
+ /* Execute a hook if present */
1265
+ _executeHook('afterSanitizeAttributes', currentNode, null);
1266
+ };
1267
+
1268
+ /**
1269
+ * _sanitizeShadowDOM
1270
+ *
1271
+ * @param {DocumentFragment} fragment to iterate over recursively
1272
+ */
1273
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1274
+ let shadowNode = null;
1275
+ const shadowIterator = _createNodeIterator(fragment);
1276
+
1277
+ /* Execute a hook if present */
1278
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
1279
+ while (shadowNode = shadowIterator.nextNode()) {
1280
+ /* Execute a hook if present */
1281
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
1282
+
1283
+ /* Sanitize tags and elements */
1284
+ if (_sanitizeElements(shadowNode)) {
1285
+ continue;
1286
+ }
1287
+
1288
+ /* Deep shadow DOM detected */
1289
+ if (shadowNode.content instanceof DocumentFragment) {
1290
+ _sanitizeShadowDOM(shadowNode.content);
1291
+ }
1292
+
1293
+ /* Check attributes, sanitize if necessary */
1294
+ _sanitizeAttributes(shadowNode);
1295
+ }
1296
+
1297
+ /* Execute a hook if present */
1298
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
1299
+ };
1300
+
1301
+ /**
1302
+ * Sanitize
1303
+ * Public method providing core sanitation functionality
1304
+ *
1305
+ * @param {String|Node} dirty string or DOM node
1306
+ * @param {Object} cfg object
1307
+ */
1308
+ // eslint-disable-next-line complexity
1309
+ DOMPurify.sanitize = function (dirty) {
1310
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1311
+ let body = null;
1312
+ let importedNode = null;
1313
+ let currentNode = null;
1314
+ let returnNode = null;
1315
+ /* Make sure we have a string to sanitize.
1316
+ DO NOT return early, as this will return the wrong type if
1317
+ the user has requested a DOM object rather than a string */
1318
+ IS_EMPTY_INPUT = !dirty;
1319
+ if (IS_EMPTY_INPUT) {
1320
+ dirty = '<!-->';
1321
+ }
1322
+
1323
+ /* Stringify, in case dirty is an object */
1324
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1325
+ if (typeof dirty.toString === 'function') {
1326
+ dirty = dirty.toString();
1327
+ if (typeof dirty !== 'string') {
1328
+ throw typeErrorCreate('dirty is not a string, aborting');
1329
+ }
1330
+ } else {
1331
+ throw typeErrorCreate('toString is not a function');
1332
+ }
1333
+ }
1334
+
1335
+ /* Return dirty HTML if DOMPurify cannot run */
1336
+ if (!DOMPurify.isSupported) {
1337
+ return dirty;
1338
+ }
1339
+
1340
+ /* Assign config vars */
1341
+ if (!SET_CONFIG) {
1342
+ _parseConfig(cfg);
1343
+ }
1344
+
1345
+ /* Clean up removed elements */
1346
+ DOMPurify.removed = [];
1347
+
1348
+ /* Check if dirty is correctly typed for IN_PLACE */
1349
+ if (typeof dirty === 'string') {
1350
+ IN_PLACE = false;
1351
+ }
1352
+ if (IN_PLACE) {
1353
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1354
+ if (dirty.nodeName) {
1355
+ const tagName = transformCaseFunc(dirty.nodeName);
1356
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1357
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1358
+ }
1359
+ }
1360
+ } else if (dirty instanceof Node) {
1361
+ /* If dirty is a DOM element, append to an empty document to avoid
1362
+ elements being stripped by the parser */
1363
+ body = _initDocument('<!---->');
1364
+ importedNode = body.ownerDocument.importNode(dirty, true);
1365
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
1366
+ /* Node is already a body, use as is */
1367
+ body = importedNode;
1368
+ } else if (importedNode.nodeName === 'HTML') {
1369
+ body = importedNode;
1370
+ } else {
1371
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1372
+ body.appendChild(importedNode);
1373
+ }
1374
+ } else {
1375
+ /* Exit directly if we have nothing to do */
1376
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1377
+ // eslint-disable-next-line unicorn/prefer-includes
1378
+ dirty.indexOf('<') === -1) {
1379
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1380
+ }
1381
+
1382
+ /* Initialize the document to work on */
1383
+ body = _initDocument(dirty);
1384
+
1385
+ /* Check we have a DOM node from the data */
1386
+ if (!body) {
1387
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1388
+ }
1389
+ }
1390
+
1391
+ /* Remove first element node (ours) if FORCE_BODY is set */
1392
+ if (body && FORCE_BODY) {
1393
+ _forceRemove(body.firstChild);
1394
+ }
1395
+
1396
+ /* Get node iterator */
1397
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1398
+
1399
+ /* Now start iterating over the created document */
1400
+ while (currentNode = nodeIterator.nextNode()) {
1401
+ /* Sanitize tags and elements */
1402
+ if (_sanitizeElements(currentNode)) {
1403
+ continue;
1404
+ }
1405
+
1406
+ /* Shadow DOM detected, sanitize it */
1407
+ if (currentNode.content instanceof DocumentFragment) {
1408
+ _sanitizeShadowDOM(currentNode.content);
1409
+ }
1410
+
1411
+ /* Check attributes, sanitize if necessary */
1412
+ _sanitizeAttributes(currentNode);
1413
+ }
1414
+
1415
+ /* If we sanitized `dirty` in-place, return it. */
1416
+ if (IN_PLACE) {
1417
+ return dirty;
1418
+ }
1419
+
1420
+ /* Return sanitized string or DOM */
1421
+ if (RETURN_DOM) {
1422
+ if (RETURN_DOM_FRAGMENT) {
1423
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1424
+ while (body.firstChild) {
1425
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1426
+ returnNode.appendChild(body.firstChild);
1427
+ }
1428
+ } else {
1429
+ returnNode = body;
1430
+ }
1431
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1432
+ /*
1433
+ AdoptNode() is not used because internal state is not reset
1434
+ (e.g. the past names map of a HTMLFormElement), this is safe
1435
+ in theory but we would rather not risk another attack vector.
1436
+ The state that is cloned by importNode() is explicitly defined
1437
+ by the specs.
1438
+ */
1439
+ returnNode = importNode.call(originalDocument, returnNode, true);
1440
+ }
1441
+ return returnNode;
1442
+ }
1443
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1444
+
1445
+ /* Serialize doctype if allowed */
1446
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1447
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1448
+ }
1449
+
1450
+ /* Sanitize final string template-safe */
1451
+ if (SAFE_FOR_TEMPLATES) {
1452
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1453
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
1454
+ });
1455
+ }
1456
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1457
+ };
1458
+
1459
+ /**
1460
+ * Public method to set the configuration once
1461
+ * setConfig
1462
+ *
1463
+ * @param {Object} cfg configuration object
1464
+ */
1465
+ DOMPurify.setConfig = function () {
1466
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1467
+ _parseConfig(cfg);
1468
+ SET_CONFIG = true;
1469
+ };
1470
+
1471
+ /**
1472
+ * Public method to remove the configuration
1473
+ * clearConfig
1474
+ *
1475
+ */
1476
+ DOMPurify.clearConfig = function () {
1477
+ CONFIG = null;
1478
+ SET_CONFIG = false;
1479
+ };
1480
+
1481
+ /**
1482
+ * Public method to check if an attribute value is valid.
1483
+ * Uses last set config, if any. Otherwise, uses config defaults.
1484
+ * isValidAttribute
1485
+ *
1486
+ * @param {String} tag Tag name of containing element.
1487
+ * @param {String} attr Attribute name.
1488
+ * @param {String} value Attribute value.
1489
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1490
+ */
1491
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1492
+ /* Initialize shared config vars if necessary. */
1493
+ if (!CONFIG) {
1494
+ _parseConfig({});
1495
+ }
1496
+ const lcTag = transformCaseFunc(tag);
1497
+ const lcName = transformCaseFunc(attr);
1498
+ return _isValidAttribute(lcTag, lcName, value);
1499
+ };
1500
+
1501
+ /**
1502
+ * AddHook
1503
+ * Public method to add DOMPurify hooks
1504
+ *
1505
+ * @param {String} entryPoint entry point for the hook to add
1506
+ * @param {Function} hookFunction function to execute
1507
+ */
1508
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1509
+ if (typeof hookFunction !== 'function') {
1510
+ return;
1511
+ }
1512
+ hooks[entryPoint] = hooks[entryPoint] || [];
1513
+ arrayPush(hooks[entryPoint], hookFunction);
1514
+ };
1515
+
1516
+ /**
1517
+ * RemoveHook
1518
+ * Public method to remove a DOMPurify hook at a given entryPoint
1519
+ * (pops it from the stack of hooks if more are present)
1520
+ *
1521
+ * @param {String} entryPoint entry point for the hook to remove
1522
+ * @return {Function} removed(popped) hook
1523
+ */
1524
+ DOMPurify.removeHook = function (entryPoint) {
1525
+ if (hooks[entryPoint]) {
1526
+ return arrayPop(hooks[entryPoint]);
1527
+ }
1528
+ };
1529
+
1530
+ /**
1531
+ * RemoveHooks
1532
+ * Public method to remove all DOMPurify hooks at a given entryPoint
1533
+ *
1534
+ * @param {String} entryPoint entry point for the hooks to remove
1535
+ */
1536
+ DOMPurify.removeHooks = function (entryPoint) {
1537
+ if (hooks[entryPoint]) {
1538
+ hooks[entryPoint] = [];
1539
+ }
1540
+ };
1541
+
1542
+ /**
1543
+ * RemoveAllHooks
1544
+ * Public method to remove all DOMPurify hooks
1545
+ */
1546
+ DOMPurify.removeAllHooks = function () {
1547
+ hooks = {};
1548
+ };
1549
+ return DOMPurify;
1550
+ }
1551
+ var purify = createDOMPurify();
1552
+
1553
+ // ESM-comment-begin
1554
+ // define(function () { return purify; });
1555
+ // ESM-comment-end
1556
+
1557
+ // ESM-uncomment-begin
1558
+ export default purify;
1559
+ export const version = purify.version;
1560
+ export const isSupported = purify.isSupported;
1561
+ export const sanitize = purify.sanitize;
1562
+ export const setConfig = purify.setConfig;
1563
+ export const clearConfig = purify.clearConfig;
1564
+ export const isValidAttribute = purify.isValidAttribute;
1565
+ export const addHook = purify.addHook;
1566
+ export const removeHook = purify.removeHook;
1567
+ export const removeHooks = purify.removeHooks;
1568
+ export const removeAllHooks = purify.removeAllHooks;
1569
+ // ESM-uncomment-end
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/event.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { Emitter } from '../common/event.js';
6
+ export class DomEmitter {
7
+ get event() {
8
+ return this.emitter.event;
9
+ }
10
+ constructor(element, type, useCapture) {
11
+ const fn = (e) => this.emitter.fire(e);
12
+ this.emitter = new Emitter({
13
+ onWillAddFirstListener: () => element.addEventListener(type, fn, useCapture),
14
+ onDidRemoveLastListener: () => element.removeEventListener(type, fn, useCapture)
15
+ });
16
+ }
17
+ dispose() {
18
+ this.emitter.dispose();
19
+ }
20
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export class FastDomNode {
6
+ constructor(domNode) {
7
+ this.domNode = domNode;
8
+ this._maxWidth = '';
9
+ this._width = '';
10
+ this._height = '';
11
+ this._top = '';
12
+ this._left = '';
13
+ this._bottom = '';
14
+ this._right = '';
15
+ this._paddingLeft = '';
16
+ this._fontFamily = '';
17
+ this._fontWeight = '';
18
+ this._fontSize = '';
19
+ this._fontStyle = '';
20
+ this._fontFeatureSettings = '';
21
+ this._fontVariationSettings = '';
22
+ this._textDecoration = '';
23
+ this._lineHeight = '';
24
+ this._letterSpacing = '';
25
+ this._className = '';
26
+ this._display = '';
27
+ this._position = '';
28
+ this._visibility = '';
29
+ this._color = '';
30
+ this._backgroundColor = '';
31
+ this._layerHint = false;
32
+ this._contain = 'none';
33
+ this._boxShadow = '';
34
+ }
35
+ setMaxWidth(_maxWidth) {
36
+ const maxWidth = numberAsPixels(_maxWidth);
37
+ if (this._maxWidth === maxWidth) {
38
+ return;
39
+ }
40
+ this._maxWidth = maxWidth;
41
+ this.domNode.style.maxWidth = this._maxWidth;
42
+ }
43
+ setWidth(_width) {
44
+ const width = numberAsPixels(_width);
45
+ if (this._width === width) {
46
+ return;
47
+ }
48
+ this._width = width;
49
+ this.domNode.style.width = this._width;
50
+ }
51
+ setHeight(_height) {
52
+ const height = numberAsPixels(_height);
53
+ if (this._height === height) {
54
+ return;
55
+ }
56
+ this._height = height;
57
+ this.domNode.style.height = this._height;
58
+ }
59
+ setTop(_top) {
60
+ const top = numberAsPixels(_top);
61
+ if (this._top === top) {
62
+ return;
63
+ }
64
+ this._top = top;
65
+ this.domNode.style.top = this._top;
66
+ }
67
+ setLeft(_left) {
68
+ const left = numberAsPixels(_left);
69
+ if (this._left === left) {
70
+ return;
71
+ }
72
+ this._left = left;
73
+ this.domNode.style.left = this._left;
74
+ }
75
+ setBottom(_bottom) {
76
+ const bottom = numberAsPixels(_bottom);
77
+ if (this._bottom === bottom) {
78
+ return;
79
+ }
80
+ this._bottom = bottom;
81
+ this.domNode.style.bottom = this._bottom;
82
+ }
83
+ setRight(_right) {
84
+ const right = numberAsPixels(_right);
85
+ if (this._right === right) {
86
+ return;
87
+ }
88
+ this._right = right;
89
+ this.domNode.style.right = this._right;
90
+ }
91
+ setPaddingLeft(_paddingLeft) {
92
+ const paddingLeft = numberAsPixels(_paddingLeft);
93
+ if (this._paddingLeft === paddingLeft) {
94
+ return;
95
+ }
96
+ this._paddingLeft = paddingLeft;
97
+ this.domNode.style.paddingLeft = this._paddingLeft;
98
+ }
99
+ setFontFamily(fontFamily) {
100
+ if (this._fontFamily === fontFamily) {
101
+ return;
102
+ }
103
+ this._fontFamily = fontFamily;
104
+ this.domNode.style.fontFamily = this._fontFamily;
105
+ }
106
+ setFontWeight(fontWeight) {
107
+ if (this._fontWeight === fontWeight) {
108
+ return;
109
+ }
110
+ this._fontWeight = fontWeight;
111
+ this.domNode.style.fontWeight = this._fontWeight;
112
+ }
113
+ setFontSize(_fontSize) {
114
+ const fontSize = numberAsPixels(_fontSize);
115
+ if (this._fontSize === fontSize) {
116
+ return;
117
+ }
118
+ this._fontSize = fontSize;
119
+ this.domNode.style.fontSize = this._fontSize;
120
+ }
121
+ setFontStyle(fontStyle) {
122
+ if (this._fontStyle === fontStyle) {
123
+ return;
124
+ }
125
+ this._fontStyle = fontStyle;
126
+ this.domNode.style.fontStyle = this._fontStyle;
127
+ }
128
+ setFontFeatureSettings(fontFeatureSettings) {
129
+ if (this._fontFeatureSettings === fontFeatureSettings) {
130
+ return;
131
+ }
132
+ this._fontFeatureSettings = fontFeatureSettings;
133
+ this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;
134
+ }
135
+ setFontVariationSettings(fontVariationSettings) {
136
+ if (this._fontVariationSettings === fontVariationSettings) {
137
+ return;
138
+ }
139
+ this._fontVariationSettings = fontVariationSettings;
140
+ this.domNode.style.fontVariationSettings = this._fontVariationSettings;
141
+ }
142
+ setTextDecoration(textDecoration) {
143
+ if (this._textDecoration === textDecoration) {
144
+ return;
145
+ }
146
+ this._textDecoration = textDecoration;
147
+ this.domNode.style.textDecoration = this._textDecoration;
148
+ }
149
+ setLineHeight(_lineHeight) {
150
+ const lineHeight = numberAsPixels(_lineHeight);
151
+ if (this._lineHeight === lineHeight) {
152
+ return;
153
+ }
154
+ this._lineHeight = lineHeight;
155
+ this.domNode.style.lineHeight = this._lineHeight;
156
+ }
157
+ setLetterSpacing(_letterSpacing) {
158
+ const letterSpacing = numberAsPixels(_letterSpacing);
159
+ if (this._letterSpacing === letterSpacing) {
160
+ return;
161
+ }
162
+ this._letterSpacing = letterSpacing;
163
+ this.domNode.style.letterSpacing = this._letterSpacing;
164
+ }
165
+ setClassName(className) {
166
+ if (this._className === className) {
167
+ return;
168
+ }
169
+ this._className = className;
170
+ this.domNode.className = this._className;
171
+ }
172
+ toggleClassName(className, shouldHaveIt) {
173
+ this.domNode.classList.toggle(className, shouldHaveIt);
174
+ this._className = this.domNode.className;
175
+ }
176
+ setDisplay(display) {
177
+ if (this._display === display) {
178
+ return;
179
+ }
180
+ this._display = display;
181
+ this.domNode.style.display = this._display;
182
+ }
183
+ setPosition(position) {
184
+ if (this._position === position) {
185
+ return;
186
+ }
187
+ this._position = position;
188
+ this.domNode.style.position = this._position;
189
+ }
190
+ setVisibility(visibility) {
191
+ if (this._visibility === visibility) {
192
+ return;
193
+ }
194
+ this._visibility = visibility;
195
+ this.domNode.style.visibility = this._visibility;
196
+ }
197
+ setColor(color) {
198
+ if (this._color === color) {
199
+ return;
200
+ }
201
+ this._color = color;
202
+ this.domNode.style.color = this._color;
203
+ }
204
+ setBackgroundColor(backgroundColor) {
205
+ if (this._backgroundColor === backgroundColor) {
206
+ return;
207
+ }
208
+ this._backgroundColor = backgroundColor;
209
+ this.domNode.style.backgroundColor = this._backgroundColor;
210
+ }
211
+ setLayerHinting(layerHint) {
212
+ if (this._layerHint === layerHint) {
213
+ return;
214
+ }
215
+ this._layerHint = layerHint;
216
+ this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';
217
+ }
218
+ setBoxShadow(boxShadow) {
219
+ if (this._boxShadow === boxShadow) {
220
+ return;
221
+ }
222
+ this._boxShadow = boxShadow;
223
+ this.domNode.style.boxShadow = boxShadow;
224
+ }
225
+ setContain(contain) {
226
+ if (this._contain === contain) {
227
+ return;
228
+ }
229
+ this._contain = contain;
230
+ this.domNode.style.contain = this._contain;
231
+ }
232
+ setAttribute(name, value) {
233
+ this.domNode.setAttribute(name, value);
234
+ }
235
+ removeAttribute(name) {
236
+ this.domNode.removeAttribute(name);
237
+ }
238
+ appendChild(child) {
239
+ this.domNode.appendChild(child.domNode);
240
+ }
241
+ removeChild(child) {
242
+ this.domNode.removeChild(child.domNode);
243
+ }
244
+ }
245
+ function numberAsPixels(value) {
246
+ return (typeof value === 'number' ? `${value}px` : value);
247
+ }
248
+ export function createFastDomNode(domNode) {
249
+ return new FastDomNode(domNode);
250
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fonts.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { isMacintosh, isWindows } from '../common/platform.js';
6
+ /**
7
+ * The best font-family to be used in CSS based on the platform:
8
+ * - Windows: Segoe preferred, fallback to sans-serif
9
+ * - macOS: standard system font, fallback to sans-serif
10
+ * - Linux: standard system font preferred, fallback to Ubuntu fonts
11
+ *
12
+ * Note: this currently does not adjust for different locales.
13
+ */
14
+ export const DEFAULT_FONT_FAMILY = isWindows ? '"Segoe WPC", "Segoe UI", sans-serif' : isMacintosh ? '-apple-system, BlinkMacSystemFont, sans-serif' : 'system-ui, "Ubuntu", "Droid Sans", sans-serif';
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as DOM from './dom.js';
6
+ export function renderText(text, options = {}) {
7
+ const element = createElement(options);
8
+ element.textContent = text;
9
+ return element;
10
+ }
11
+ export function renderFormattedText(formattedText, options = {}) {
12
+ const element = createElement(options);
13
+ _renderFormattedText(element, parseFormattedText(formattedText, !!options.renderCodeSegments), options.actionHandler, options.renderCodeSegments);
14
+ return element;
15
+ }
16
+ export function createElement(options) {
17
+ const tagName = options.inline ? 'span' : 'div';
18
+ const element = document.createElement(tagName);
19
+ if (options.className) {
20
+ element.className = options.className;
21
+ }
22
+ return element;
23
+ }
24
+ class StringStream {
25
+ constructor(source) {
26
+ this.source = source;
27
+ this.index = 0;
28
+ }
29
+ eos() {
30
+ return this.index >= this.source.length;
31
+ }
32
+ next() {
33
+ const next = this.peek();
34
+ this.advance();
35
+ return next;
36
+ }
37
+ peek() {
38
+ return this.source[this.index];
39
+ }
40
+ advance() {
41
+ this.index++;
42
+ }
43
+ }
44
+ function _renderFormattedText(element, treeNode, actionHandler, renderCodeSegments) {
45
+ let child;
46
+ if (treeNode.type === 2 /* FormatType.Text */) {
47
+ child = document.createTextNode(treeNode.content || '');
48
+ }
49
+ else if (treeNode.type === 3 /* FormatType.Bold */) {
50
+ child = document.createElement('b');
51
+ }
52
+ else if (treeNode.type === 4 /* FormatType.Italics */) {
53
+ child = document.createElement('i');
54
+ }
55
+ else if (treeNode.type === 7 /* FormatType.Code */ && renderCodeSegments) {
56
+ child = document.createElement('code');
57
+ }
58
+ else if (treeNode.type === 5 /* FormatType.Action */ && actionHandler) {
59
+ const a = document.createElement('a');
60
+ actionHandler.disposables.add(DOM.addStandardDisposableListener(a, 'click', (event) => {
61
+ actionHandler.callback(String(treeNode.index), event);
62
+ }));
63
+ child = a;
64
+ }
65
+ else if (treeNode.type === 8 /* FormatType.NewLine */) {
66
+ child = document.createElement('br');
67
+ }
68
+ else if (treeNode.type === 1 /* FormatType.Root */) {
69
+ child = element;
70
+ }
71
+ if (child && element !== child) {
72
+ element.appendChild(child);
73
+ }
74
+ if (child && Array.isArray(treeNode.children)) {
75
+ treeNode.children.forEach((nodeChild) => {
76
+ _renderFormattedText(child, nodeChild, actionHandler, renderCodeSegments);
77
+ });
78
+ }
79
+ }
80
+ function parseFormattedText(content, parseCodeSegments) {
81
+ const root = {
82
+ type: 1 /* FormatType.Root */,
83
+ children: []
84
+ };
85
+ let actionViewItemIndex = 0;
86
+ let current = root;
87
+ const stack = [];
88
+ const stream = new StringStream(content);
89
+ while (!stream.eos()) {
90
+ let next = stream.next();
91
+ const isEscapedFormatType = (next === '\\' && formatTagType(stream.peek(), parseCodeSegments) !== 0 /* FormatType.Invalid */);
92
+ if (isEscapedFormatType) {
93
+ next = stream.next(); // unread the backslash if it escapes a format tag type
94
+ }
95
+ if (!isEscapedFormatType && isFormatTag(next, parseCodeSegments) && next === stream.peek()) {
96
+ stream.advance();
97
+ if (current.type === 2 /* FormatType.Text */) {
98
+ current = stack.pop();
99
+ }
100
+ const type = formatTagType(next, parseCodeSegments);
101
+ if (current.type === type || (current.type === 5 /* FormatType.Action */ && type === 6 /* FormatType.ActionClose */)) {
102
+ current = stack.pop();
103
+ }
104
+ else {
105
+ const newCurrent = {
106
+ type: type,
107
+ children: []
108
+ };
109
+ if (type === 5 /* FormatType.Action */) {
110
+ newCurrent.index = actionViewItemIndex;
111
+ actionViewItemIndex++;
112
+ }
113
+ current.children.push(newCurrent);
114
+ stack.push(current);
115
+ current = newCurrent;
116
+ }
117
+ }
118
+ else if (next === '\n') {
119
+ if (current.type === 2 /* FormatType.Text */) {
120
+ current = stack.pop();
121
+ }
122
+ current.children.push({
123
+ type: 8 /* FormatType.NewLine */
124
+ });
125
+ }
126
+ else {
127
+ if (current.type !== 2 /* FormatType.Text */) {
128
+ const textCurrent = {
129
+ type: 2 /* FormatType.Text */,
130
+ content: next
131
+ };
132
+ current.children.push(textCurrent);
133
+ stack.push(current);
134
+ current = textCurrent;
135
+ }
136
+ else {
137
+ current.content += next;
138
+ }
139
+ }
140
+ }
141
+ if (current.type === 2 /* FormatType.Text */) {
142
+ current = stack.pop();
143
+ }
144
+ if (stack.length) {
145
+ // incorrectly formatted string literal
146
+ }
147
+ return root;
148
+ }
149
+ function isFormatTag(char, supportCodeSegments) {
150
+ return formatTagType(char, supportCodeSegments) !== 0 /* FormatType.Invalid */;
151
+ }
152
+ function formatTagType(char, supportCodeSegments) {
153
+ switch (char) {
154
+ case '*':
155
+ return 3 /* FormatType.Bold */;
156
+ case '_':
157
+ return 4 /* FormatType.Italics */;
158
+ case '[':
159
+ return 5 /* FormatType.Action */;
160
+ case ']':
161
+ return 6 /* FormatType.ActionClose */;
162
+ case '`':
163
+ return supportCodeSegments ? 7 /* FormatType.Code */ : 0 /* FormatType.Invalid */;
164
+ default:
165
+ return 0 /* FormatType.Invalid */;
166
+ }
167
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as dom from './dom.js';
6
+ import { DisposableStore, toDisposable } from '../common/lifecycle.js';
7
+ export class GlobalPointerMoveMonitor {
8
+ constructor() {
9
+ this._hooks = new DisposableStore();
10
+ this._pointerMoveCallback = null;
11
+ this._onStopCallback = null;
12
+ }
13
+ dispose() {
14
+ this.stopMonitoring(false);
15
+ this._hooks.dispose();
16
+ }
17
+ stopMonitoring(invokeStopCallback, browserEvent) {
18
+ if (!this.isMonitoring()) {
19
+ // Not monitoring
20
+ return;
21
+ }
22
+ // Unhook
23
+ this._hooks.clear();
24
+ this._pointerMoveCallback = null;
25
+ const onStopCallback = this._onStopCallback;
26
+ this._onStopCallback = null;
27
+ if (invokeStopCallback && onStopCallback) {
28
+ onStopCallback(browserEvent);
29
+ }
30
+ }
31
+ isMonitoring() {
32
+ return !!this._pointerMoveCallback;
33
+ }
34
+ startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {
35
+ if (this.isMonitoring()) {
36
+ this.stopMonitoring(false);
37
+ }
38
+ this._pointerMoveCallback = pointerMoveCallback;
39
+ this._onStopCallback = onStopCallback;
40
+ let eventSource = initialElement;
41
+ try {
42
+ initialElement.setPointerCapture(pointerId);
43
+ this._hooks.add(toDisposable(() => {
44
+ try {
45
+ initialElement.releasePointerCapture(pointerId);
46
+ }
47
+ catch (err) {
48
+ // See https://github.com/microsoft/vscode/issues/161731
49
+ //
50
+ // `releasePointerCapture` sometimes fails when being invoked with the exception:
51
+ // DOMException: Failed to execute 'releasePointerCapture' on 'Element':
52
+ // No active pointer with the given id is found.
53
+ //
54
+ // There's no need to do anything in case of failure
55
+ }
56
+ }));
57
+ }
58
+ catch (err) {
59
+ // See https://github.com/microsoft/vscode/issues/144584
60
+ // See https://github.com/microsoft/vscode/issues/146947
61
+ // `setPointerCapture` sometimes fails when being invoked
62
+ // from a `mousedown` listener on macOS and Windows
63
+ // and it always fails on Linux with the exception:
64
+ // DOMException: Failed to execute 'setPointerCapture' on 'Element':
65
+ // No active pointer with the given id is found.
66
+ // In case of failure, we bind the listeners on the window
67
+ eventSource = dom.getWindow(initialElement);
68
+ }
69
+ this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_MOVE, (e) => {
70
+ if (e.buttons !== initialButtons) {
71
+ // Buttons state has changed in the meantime
72
+ this.stopMonitoring(true);
73
+ return;
74
+ }
75
+ e.preventDefault();
76
+ this._pointerMoveCallback(e);
77
+ }));
78
+ this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_UP, (e) => this.stopMonitoring(true)));
79
+ }
80
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/history.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export {};
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/iframe.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ const sameOriginWindowChainCache = new WeakMap();
6
+ function getParentWindowIfSameOrigin(w) {
7
+ if (!w.parent || w.parent === w) {
8
+ return null;
9
+ }
10
+ // Cannot really tell if we have access to the parent window unless we try to access something in it
11
+ try {
12
+ const location = w.location;
13
+ const parentLocation = w.parent.location;
14
+ if (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {
15
+ return null;
16
+ }
17
+ }
18
+ catch (e) {
19
+ return null;
20
+ }
21
+ return w.parent;
22
+ }
23
+ export class IframeUtils {
24
+ /**
25
+ * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).
26
+ * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.
27
+ */
28
+ static getSameOriginWindowChain(targetWindow) {
29
+ let windowChainCache = sameOriginWindowChainCache.get(targetWindow);
30
+ if (!windowChainCache) {
31
+ windowChainCache = [];
32
+ sameOriginWindowChainCache.set(targetWindow, windowChainCache);
33
+ let w = targetWindow;
34
+ let parent;
35
+ do {
36
+ parent = getParentWindowIfSameOrigin(w);
37
+ if (parent) {
38
+ windowChainCache.push({
39
+ window: new WeakRef(w),
40
+ iframeElement: w.frameElement || null
41
+ });
42
+ }
43
+ else {
44
+ windowChainCache.push({
45
+ window: new WeakRef(w),
46
+ iframeElement: null
47
+ });
48
+ }
49
+ w = parent;
50
+ } while (w);
51
+ }
52
+ return windowChainCache.slice(0);
53
+ }
54
+ /**
55
+ * Returns the position of `childWindow` relative to `ancestorWindow`
56
+ */
57
+ static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {
58
+ if (!ancestorWindow || childWindow === ancestorWindow) {
59
+ return {
60
+ top: 0,
61
+ left: 0
62
+ };
63
+ }
64
+ let top = 0, left = 0;
65
+ const windowChain = this.getSameOriginWindowChain(childWindow);
66
+ for (const windowChainEl of windowChain) {
67
+ const windowInChain = windowChainEl.window.deref();
68
+ top += windowInChain?.scrollY ?? 0;
69
+ left += windowInChain?.scrollX ?? 0;
70
+ if (windowInChain === ancestorWindow) {
71
+ break;
72
+ }
73
+ if (!windowChainEl.iframeElement) {
74
+ break;
75
+ }
76
+ const boundingRect = windowChainEl.iframeElement.getBoundingClientRect();
77
+ top += boundingRect.top;
78
+ left += boundingRect.left;
79
+ }
80
+ return {
81
+ top: top,
82
+ left: left
83
+ };
84
+ }
85
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as browser from './browser.js';
6
+ import { EVENT_KEY_CODE_MAP, KeyCodeUtils } from '../common/keyCodes.js';
7
+ import { KeyCodeChord } from '../common/keybindings.js';
8
+ import * as platform from '../common/platform.js';
9
+ function extractKeyCode(e) {
10
+ if (e.charCode) {
11
+ // "keypress" events mostly
12
+ const char = String.fromCharCode(e.charCode).toUpperCase();
13
+ return KeyCodeUtils.fromString(char);
14
+ }
15
+ const keyCode = e.keyCode;
16
+ // browser quirks
17
+ if (keyCode === 3) {
18
+ return 7 /* KeyCode.PauseBreak */;
19
+ }
20
+ else if (browser.isFirefox) {
21
+ switch (keyCode) {
22
+ case 59: return 85 /* KeyCode.Semicolon */;
23
+ case 60:
24
+ if (platform.isLinux) {
25
+ return 97 /* KeyCode.IntlBackslash */;
26
+ }
27
+ break;
28
+ case 61: return 86 /* KeyCode.Equal */;
29
+ // based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys
30
+ case 107: return 109 /* KeyCode.NumpadAdd */;
31
+ case 109: return 111 /* KeyCode.NumpadSubtract */;
32
+ case 173: return 88 /* KeyCode.Minus */;
33
+ case 224:
34
+ if (platform.isMacintosh) {
35
+ return 57 /* KeyCode.Meta */;
36
+ }
37
+ break;
38
+ }
39
+ }
40
+ else if (browser.isWebKit) {
41
+ if (platform.isMacintosh && keyCode === 93) {
42
+ // the two meta keys in the Mac have different key codes (91 and 93)
43
+ return 57 /* KeyCode.Meta */;
44
+ }
45
+ else if (!platform.isMacintosh && keyCode === 92) {
46
+ return 57 /* KeyCode.Meta */;
47
+ }
48
+ }
49
+ // cross browser keycodes:
50
+ return EVENT_KEY_CODE_MAP[keyCode] || 0 /* KeyCode.Unknown */;
51
+ }
52
+ const ctrlKeyMod = (platform.isMacintosh ? 256 /* KeyMod.WinCtrl */ : 2048 /* KeyMod.CtrlCmd */);
53
+ const altKeyMod = 512 /* KeyMod.Alt */;
54
+ const shiftKeyMod = 1024 /* KeyMod.Shift */;
55
+ const metaKeyMod = (platform.isMacintosh ? 2048 /* KeyMod.CtrlCmd */ : 256 /* KeyMod.WinCtrl */);
56
+ export class StandardKeyboardEvent {
57
+ constructor(source) {
58
+ this._standardKeyboardEventBrand = true;
59
+ const e = source;
60
+ this.browserEvent = e;
61
+ this.target = e.target;
62
+ this.ctrlKey = e.ctrlKey;
63
+ this.shiftKey = e.shiftKey;
64
+ this.altKey = e.altKey;
65
+ this.metaKey = e.metaKey;
66
+ this.altGraphKey = e.getModifierState?.('AltGraph');
67
+ this.keyCode = extractKeyCode(e);
68
+ this.code = e.code;
69
+ // console.info(e.type + ": keyCode: " + e.keyCode + ", which: " + e.which + ", charCode: " + e.charCode + ", detail: " + e.detail + " ====> " + this.keyCode + ' -- ' + KeyCode[this.keyCode]);
70
+ this.ctrlKey = this.ctrlKey || this.keyCode === 5 /* KeyCode.Ctrl */;
71
+ this.altKey = this.altKey || this.keyCode === 6 /* KeyCode.Alt */;
72
+ this.shiftKey = this.shiftKey || this.keyCode === 4 /* KeyCode.Shift */;
73
+ this.metaKey = this.metaKey || this.keyCode === 57 /* KeyCode.Meta */;
74
+ this._asKeybinding = this._computeKeybinding();
75
+ this._asKeyCodeChord = this._computeKeyCodeChord();
76
+ // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);
77
+ }
78
+ preventDefault() {
79
+ if (this.browserEvent && this.browserEvent.preventDefault) {
80
+ this.browserEvent.preventDefault();
81
+ }
82
+ }
83
+ stopPropagation() {
84
+ if (this.browserEvent && this.browserEvent.stopPropagation) {
85
+ this.browserEvent.stopPropagation();
86
+ }
87
+ }
88
+ toKeyCodeChord() {
89
+ return this._asKeyCodeChord;
90
+ }
91
+ equals(other) {
92
+ return this._asKeybinding === other;
93
+ }
94
+ _computeKeybinding() {
95
+ let key = 0 /* KeyCode.Unknown */;
96
+ if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) {
97
+ key = this.keyCode;
98
+ }
99
+ let result = 0;
100
+ if (this.ctrlKey) {
101
+ result |= ctrlKeyMod;
102
+ }
103
+ if (this.altKey) {
104
+ result |= altKeyMod;
105
+ }
106
+ if (this.shiftKey) {
107
+ result |= shiftKeyMod;
108
+ }
109
+ if (this.metaKey) {
110
+ result |= metaKeyMod;
111
+ }
112
+ result |= key;
113
+ return result;
114
+ }
115
+ _computeKeyCodeChord() {
116
+ let key = 0 /* KeyCode.Unknown */;
117
+ if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) {
118
+ key = this.keyCode;
119
+ }
120
+ return new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);
121
+ }
122
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js ADDED
@@ -0,0 +1,814 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as DOM from './dom.js';
6
+ import * as dompurify from './dompurify/dompurify.js';
7
+ import { DomEmitter } from './event.js';
8
+ import { createElement } from './formattedTextRenderer.js';
9
+ import { StandardKeyboardEvent } from './keyboardEvent.js';
10
+ import { StandardMouseEvent } from './mouseEvent.js';
11
+ import { renderLabelWithIcons } from './ui/iconLabel/iconLabels.js';
12
+ import { onUnexpectedError } from '../common/errors.js';
13
+ import { Event } from '../common/event.js';
14
+ import { escapeDoubleQuotes, parseHrefAndDimensions, removeMarkdownEscapes } from '../common/htmlContent.js';
15
+ import { markdownEscapeEscapedIcons } from '../common/iconLabels.js';
16
+ import { defaultGenerator } from '../common/idGenerator.js';
17
+ import { Lazy } from '../common/lazy.js';
18
+ import { DisposableStore, toDisposable } from '../common/lifecycle.js';
19
+ import * as marked from '../common/marked/marked.js';
20
+ import { parse } from '../common/marshalling.js';
21
+ import { FileAccess, Schemas } from '../common/network.js';
22
+ import { cloneAndChange } from '../common/objects.js';
23
+ import { dirname, resolvePath } from '../common/resources.js';
24
+ import { escape } from '../common/strings.js';
25
+ import { URI } from '../common/uri.js';
26
+ const defaultMarkedRenderers = Object.freeze({
27
+ image: ({ href, title, text }) => {
28
+ let dimensions = [];
29
+ let attributes = [];
30
+ if (href) {
31
+ ({ href, dimensions } = parseHrefAndDimensions(href));
32
+ attributes.push(`src="${escapeDoubleQuotes(href)}"`);
33
+ }
34
+ if (text) {
35
+ attributes.push(`alt="${escapeDoubleQuotes(text)}"`);
36
+ }
37
+ if (title) {
38
+ attributes.push(`title="${escapeDoubleQuotes(title)}"`);
39
+ }
40
+ if (dimensions.length) {
41
+ attributes = attributes.concat(dimensions);
42
+ }
43
+ return '<img ' + attributes.join(' ') + '>';
44
+ },
45
+ paragraph({ tokens }) {
46
+ return `<p>${this.parser.parseInline(tokens)}</p>`;
47
+ },
48
+ link({ href, title, tokens }) {
49
+ let text = this.parser.parseInline(tokens);
50
+ if (typeof href !== 'string') {
51
+ return '';
52
+ }
53
+ // Remove markdown escapes. Workaround for https://github.com/chjj/marked/issues/829
54
+ if (href === text) { // raw link case
55
+ text = removeMarkdownEscapes(text);
56
+ }
57
+ title = typeof title === 'string' ? escapeDoubleQuotes(removeMarkdownEscapes(title)) : '';
58
+ href = removeMarkdownEscapes(href);
59
+ // HTML Encode href
60
+ href = href.replace(/&/g, '&amp;')
61
+ .replace(/</g, '&lt;')
62
+ .replace(/>/g, '&gt;')
63
+ .replace(/"/g, '&quot;')
64
+ .replace(/'/g, '&#39;');
65
+ return `<a href="${href}" title="${title || href}" draggable="false">${text}</a>`;
66
+ },
67
+ });
68
+ /**
69
+ * Low-level way create a html element from a markdown string.
70
+ *
71
+ * **Note** that for most cases you should be using [`MarkdownRenderer`](./src/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.ts)
72
+ * which comes with support for pretty code block rendering and which uses the default way of handling links.
73
+ */
74
+ export function renderMarkdown(markdown, options = {}, markedOptions = {}) {
75
+ const disposables = new DisposableStore();
76
+ let isDisposed = false;
77
+ const element = createElement(options);
78
+ const _uriMassage = function (part) {
79
+ let data;
80
+ try {
81
+ data = parse(decodeURIComponent(part));
82
+ }
83
+ catch (e) {
84
+ // ignore
85
+ }
86
+ if (!data) {
87
+ return part;
88
+ }
89
+ data = cloneAndChange(data, value => {
90
+ if (markdown.uris && markdown.uris[value]) {
91
+ return URI.revive(markdown.uris[value]);
92
+ }
93
+ else {
94
+ return undefined;
95
+ }
96
+ });
97
+ return encodeURIComponent(JSON.stringify(data));
98
+ };
99
+ const _href = function (href, isDomUri) {
100
+ const data = markdown.uris && markdown.uris[href];
101
+ let uri = URI.revive(data);
102
+ if (isDomUri) {
103
+ if (href.startsWith(Schemas.data + ':')) {
104
+ return href;
105
+ }
106
+ if (!uri) {
107
+ uri = URI.parse(href);
108
+ }
109
+ // this URI will end up as "src"-attribute of a dom node
110
+ // and because of that special rewriting needs to be done
111
+ // so that the URI uses a protocol that's understood by
112
+ // browsers (like http or https)
113
+ return FileAccess.uriToBrowserUri(uri).toString(true);
114
+ }
115
+ if (!uri) {
116
+ return href;
117
+ }
118
+ if (URI.parse(href).toString() === uri.toString()) {
119
+ return href; // no transformation performed
120
+ }
121
+ if (uri.query) {
122
+ uri = uri.with({ query: _uriMassage(uri.query) });
123
+ }
124
+ return uri.toString();
125
+ };
126
+ const renderer = new marked.Renderer();
127
+ renderer.image = defaultMarkedRenderers.image;
128
+ renderer.link = defaultMarkedRenderers.link;
129
+ renderer.paragraph = defaultMarkedRenderers.paragraph;
130
+ // Will collect [id, renderedElement] tuples
131
+ const codeBlocks = [];
132
+ const syncCodeBlocks = [];
133
+ if (options.codeBlockRendererSync) {
134
+ renderer.code = ({ text, lang }) => {
135
+ const id = defaultGenerator.nextId();
136
+ const value = options.codeBlockRendererSync(postProcessCodeBlockLanguageId(lang), text);
137
+ syncCodeBlocks.push([id, value]);
138
+ return `<div class="code" data-code="${id}">${escape(text)}</div>`;
139
+ };
140
+ }
141
+ else if (options.codeBlockRenderer) {
142
+ renderer.code = ({ text, lang }) => {
143
+ const id = defaultGenerator.nextId();
144
+ const value = options.codeBlockRenderer(postProcessCodeBlockLanguageId(lang), text);
145
+ codeBlocks.push(value.then(element => [id, element]));
146
+ return `<div class="code" data-code="${id}">${escape(text)}</div>`;
147
+ };
148
+ }
149
+ if (options.actionHandler) {
150
+ const _activateLink = function (event) {
151
+ let target = event.target;
152
+ if (target.tagName !== 'A') {
153
+ target = target.parentElement;
154
+ if (!target || target.tagName !== 'A') {
155
+ return;
156
+ }
157
+ }
158
+ try {
159
+ let href = target.dataset['href'];
160
+ if (href) {
161
+ if (markdown.baseUri) {
162
+ href = resolveWithBaseUri(URI.from(markdown.baseUri), href);
163
+ }
164
+ options.actionHandler.callback(href, event);
165
+ }
166
+ }
167
+ catch (err) {
168
+ onUnexpectedError(err);
169
+ }
170
+ finally {
171
+ event.preventDefault();
172
+ }
173
+ };
174
+ const onClick = options.actionHandler.disposables.add(new DomEmitter(element, 'click'));
175
+ const onAuxClick = options.actionHandler.disposables.add(new DomEmitter(element, 'auxclick'));
176
+ options.actionHandler.disposables.add(Event.any(onClick.event, onAuxClick.event)(e => {
177
+ const mouseEvent = new StandardMouseEvent(DOM.getWindow(element), e);
178
+ if (!mouseEvent.leftButton && !mouseEvent.middleButton) {
179
+ return;
180
+ }
181
+ _activateLink(mouseEvent);
182
+ }));
183
+ options.actionHandler.disposables.add(DOM.addDisposableListener(element, 'keydown', (e) => {
184
+ const keyboardEvent = new StandardKeyboardEvent(e);
185
+ if (!keyboardEvent.equals(10 /* KeyCode.Space */) && !keyboardEvent.equals(3 /* KeyCode.Enter */)) {
186
+ return;
187
+ }
188
+ _activateLink(keyboardEvent);
189
+ }));
190
+ }
191
+ if (!markdown.supportHtml) {
192
+ // Note: we always pass the output through dompurify after this so that we don't rely on
193
+ // marked for real sanitization.
194
+ renderer.html = ({ text }) => {
195
+ if (options.sanitizerOptions?.replaceWithPlaintext) {
196
+ return escape(text);
197
+ }
198
+ const match = markdown.isTrusted ? text.match(/^(<span[^>]+>)|(<\/\s*span>)$/) : undefined;
199
+ return match ? text : '';
200
+ };
201
+ }
202
+ markedOptions.renderer = renderer;
203
+ // values that are too long will freeze the UI
204
+ let value = markdown.value ?? '';
205
+ if (value.length > 100_000) {
206
+ value = `${value.substr(0, 100_000)}…`;
207
+ }
208
+ // escape theme icons
209
+ if (markdown.supportThemeIcons) {
210
+ value = markdownEscapeEscapedIcons(value);
211
+ }
212
+ let renderedMarkdown;
213
+ if (options.fillInIncompleteTokens) {
214
+ // The defaults are applied by parse but not lexer()/parser(), and they need to be present
215
+ const opts = {
216
+ ...marked.defaults,
217
+ ...markedOptions
218
+ };
219
+ const tokens = marked.lexer(value, opts);
220
+ const newTokens = fillInIncompleteTokens(tokens);
221
+ renderedMarkdown = marked.parser(newTokens, opts);
222
+ }
223
+ else {
224
+ renderedMarkdown = marked.parse(value, { ...markedOptions, async: false });
225
+ }
226
+ // Rewrite theme icons
227
+ if (markdown.supportThemeIcons) {
228
+ const elements = renderLabelWithIcons(renderedMarkdown);
229
+ renderedMarkdown = elements.map(e => typeof e === 'string' ? e : e.outerHTML).join('');
230
+ }
231
+ const htmlParser = new DOMParser();
232
+ const markdownHtmlDoc = htmlParser.parseFromString(sanitizeRenderedMarkdown({ isTrusted: markdown.isTrusted, ...options.sanitizerOptions }, renderedMarkdown), 'text/html');
233
+ markdownHtmlDoc.body.querySelectorAll('img, audio, video, source')
234
+ .forEach(img => {
235
+ const src = img.getAttribute('src'); // Get the raw 'src' attribute value as text, not the resolved 'src'
236
+ if (src) {
237
+ let href = src;
238
+ try {
239
+ if (markdown.baseUri) { // absolute or relative local path, or file: uri
240
+ href = resolveWithBaseUri(URI.from(markdown.baseUri), href);
241
+ }
242
+ }
243
+ catch (err) { }
244
+ img.setAttribute('src', _href(href, true));
245
+ if (options.remoteImageIsAllowed) {
246
+ const uri = URI.parse(href);
247
+ if (uri.scheme !== Schemas.file && uri.scheme !== Schemas.data && !options.remoteImageIsAllowed(uri)) {
248
+ img.replaceWith(DOM.$('', undefined, img.outerHTML));
249
+ }
250
+ }
251
+ }
252
+ });
253
+ markdownHtmlDoc.body.querySelectorAll('a')
254
+ .forEach(a => {
255
+ const href = a.getAttribute('href'); // Get the raw 'href' attribute value as text, not the resolved 'href'
256
+ a.setAttribute('href', ''); // Clear out href. We use the `data-href` for handling clicks instead
257
+ if (!href
258
+ || /^data:|javascript:/i.test(href)
259
+ || (/^command:/i.test(href) && !markdown.isTrusted)
260
+ || /^command:(\/\/\/)?_workbench\.downloadResource/i.test(href)) {
261
+ // drop the link
262
+ a.replaceWith(...a.childNodes);
263
+ }
264
+ else {
265
+ let resolvedHref = _href(href, false);
266
+ if (markdown.baseUri) {
267
+ resolvedHref = resolveWithBaseUri(URI.from(markdown.baseUri), href);
268
+ }
269
+ a.dataset.href = resolvedHref;
270
+ }
271
+ });
272
+ element.innerHTML = sanitizeRenderedMarkdown({ isTrusted: markdown.isTrusted, ...options.sanitizerOptions }, markdownHtmlDoc.body.innerHTML);
273
+ if (codeBlocks.length > 0) {
274
+ Promise.all(codeBlocks).then((tuples) => {
275
+ if (isDisposed) {
276
+ return;
277
+ }
278
+ const renderedElements = new Map(tuples);
279
+ const placeholderElements = element.querySelectorAll(`div[data-code]`);
280
+ for (const placeholderElement of placeholderElements) {
281
+ const renderedElement = renderedElements.get(placeholderElement.dataset['code'] ?? '');
282
+ if (renderedElement) {
283
+ DOM.reset(placeholderElement, renderedElement);
284
+ }
285
+ }
286
+ options.asyncRenderCallback?.();
287
+ });
288
+ }
289
+ else if (syncCodeBlocks.length > 0) {
290
+ const renderedElements = new Map(syncCodeBlocks);
291
+ const placeholderElements = element.querySelectorAll(`div[data-code]`);
292
+ for (const placeholderElement of placeholderElements) {
293
+ const renderedElement = renderedElements.get(placeholderElement.dataset['code'] ?? '');
294
+ if (renderedElement) {
295
+ DOM.reset(placeholderElement, renderedElement);
296
+ }
297
+ }
298
+ }
299
+ // signal size changes for image tags
300
+ if (options.asyncRenderCallback) {
301
+ for (const img of element.getElementsByTagName('img')) {
302
+ const listener = disposables.add(DOM.addDisposableListener(img, 'load', () => {
303
+ listener.dispose();
304
+ options.asyncRenderCallback();
305
+ }));
306
+ }
307
+ }
308
+ return {
309
+ element,
310
+ dispose: () => {
311
+ isDisposed = true;
312
+ disposables.dispose();
313
+ }
314
+ };
315
+ }
316
+ function postProcessCodeBlockLanguageId(lang) {
317
+ if (!lang) {
318
+ return '';
319
+ }
320
+ const parts = lang.split(/[\s+|:|,|\{|\?]/, 1);
321
+ if (parts.length) {
322
+ return parts[0];
323
+ }
324
+ return lang;
325
+ }
326
+ function resolveWithBaseUri(baseUri, href) {
327
+ const hasScheme = /^\w[\w\d+.-]*:/.test(href);
328
+ if (hasScheme) {
329
+ return href;
330
+ }
331
+ if (baseUri.path.endsWith('/')) {
332
+ return resolvePath(baseUri, href).toString();
333
+ }
334
+ else {
335
+ return resolvePath(dirname(baseUri), href).toString();
336
+ }
337
+ }
338
+ const selfClosingTags = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
339
+ function sanitizeRenderedMarkdown(options, renderedMarkdown) {
340
+ const { config, allowedSchemes } = getSanitizerOptions(options);
341
+ const store = new DisposableStore();
342
+ store.add(addDompurifyHook('uponSanitizeAttribute', (element, e) => {
343
+ if (e.attrName === 'style' || e.attrName === 'class') {
344
+ if (element.tagName === 'SPAN') {
345
+ if (e.attrName === 'style') {
346
+ e.keepAttr = /^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(border-radius:[0-9]+px;)?$/.test(e.attrValue);
347
+ return;
348
+ }
349
+ else if (e.attrName === 'class') {
350
+ e.keepAttr = /^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(e.attrValue);
351
+ return;
352
+ }
353
+ }
354
+ e.keepAttr = false;
355
+ return;
356
+ }
357
+ else if (element.tagName === 'INPUT' && element.attributes.getNamedItem('type')?.value === 'checkbox') {
358
+ if ((e.attrName === 'type' && e.attrValue === 'checkbox') || e.attrName === 'disabled' || e.attrName === 'checked') {
359
+ e.keepAttr = true;
360
+ return;
361
+ }
362
+ e.keepAttr = false;
363
+ }
364
+ }));
365
+ store.add(addDompurifyHook('uponSanitizeElement', (element, e) => {
366
+ if (e.tagName === 'input') {
367
+ if (element.attributes.getNamedItem('type')?.value === 'checkbox') {
368
+ element.setAttribute('disabled', '');
369
+ }
370
+ else if (!options.replaceWithPlaintext) {
371
+ element.remove();
372
+ }
373
+ }
374
+ if (options.replaceWithPlaintext && !e.allowedTags[e.tagName] && e.tagName !== 'body') {
375
+ if (element.parentElement) {
376
+ let startTagText;
377
+ let endTagText;
378
+ if (e.tagName === '#comment') {
379
+ startTagText = `<!--${element.textContent}-->`;
380
+ }
381
+ else {
382
+ const isSelfClosing = selfClosingTags.includes(e.tagName);
383
+ const attrString = element.attributes.length ?
384
+ ' ' + Array.from(element.attributes)
385
+ .map(attr => `${attr.name}="${attr.value}"`)
386
+ .join(' ')
387
+ : '';
388
+ startTagText = `<${e.tagName}${attrString}>`;
389
+ if (!isSelfClosing) {
390
+ endTagText = `</${e.tagName}>`;
391
+ }
392
+ }
393
+ const fragment = document.createDocumentFragment();
394
+ const textNode = element.parentElement.ownerDocument.createTextNode(startTagText);
395
+ fragment.appendChild(textNode);
396
+ const endTagTextNode = endTagText ? element.parentElement.ownerDocument.createTextNode(endTagText) : undefined;
397
+ while (element.firstChild) {
398
+ fragment.appendChild(element.firstChild);
399
+ }
400
+ if (endTagTextNode) {
401
+ fragment.appendChild(endTagTextNode);
402
+ }
403
+ if (element.nodeType === Node.COMMENT_NODE) {
404
+ // Workaround for https://github.com/cure53/DOMPurify/issues/1005
405
+ // The comment will be deleted in the next phase. However if we try to remove it now, it will cause
406
+ // an exception. Instead we insert the text node before the comment.
407
+ element.parentElement.insertBefore(fragment, element);
408
+ }
409
+ else {
410
+ element.parentElement.replaceChild(fragment, element);
411
+ }
412
+ }
413
+ }
414
+ }));
415
+ store.add(DOM.hookDomPurifyHrefAndSrcSanitizer(allowedSchemes));
416
+ try {
417
+ return dompurify.sanitize(renderedMarkdown, { ...config, RETURN_TRUSTED_TYPE: true });
418
+ }
419
+ finally {
420
+ store.dispose();
421
+ }
422
+ }
423
+ export const allowedMarkdownAttr = [
424
+ 'align',
425
+ 'autoplay',
426
+ 'alt',
427
+ 'checked',
428
+ 'class',
429
+ 'colspan',
430
+ 'controls',
431
+ 'data-code',
432
+ 'data-href',
433
+ 'disabled',
434
+ 'draggable',
435
+ 'height',
436
+ 'href',
437
+ 'loop',
438
+ 'muted',
439
+ 'playsinline',
440
+ 'poster',
441
+ 'rowspan',
442
+ 'src',
443
+ 'style',
444
+ 'target',
445
+ 'title',
446
+ 'type',
447
+ 'width',
448
+ 'start',
449
+ ];
450
+ function getSanitizerOptions(options) {
451
+ const allowedSchemes = [
452
+ Schemas.http,
453
+ Schemas.https,
454
+ Schemas.mailto,
455
+ Schemas.data,
456
+ Schemas.file,
457
+ Schemas.vscodeFileResource,
458
+ Schemas.vscodeRemote,
459
+ Schemas.vscodeRemoteResource,
460
+ ];
461
+ if (options.isTrusted) {
462
+ allowedSchemes.push(Schemas.command);
463
+ }
464
+ return {
465
+ config: {
466
+ // allowedTags should included everything that markdown renders to.
467
+ // Since we have our own sanitize function for marked, it's possible we missed some tag so let dompurify make sure.
468
+ // HTML tags that can result from markdown are from reading https://spec.commonmark.org/0.29/
469
+ // HTML table tags that can result from markdown are from https://github.github.com/gfm/#tables-extension-
470
+ ALLOWED_TAGS: options.allowedTags ?? [...DOM.basicMarkupHtmlTags],
471
+ ALLOWED_ATTR: allowedMarkdownAttr,
472
+ ALLOW_UNKNOWN_PROTOCOLS: true,
473
+ },
474
+ allowedSchemes
475
+ };
476
+ }
477
+ /**
478
+ * Strips all markdown from `string`, if it's an IMarkdownString. For example
479
+ * `# Header` would be output as `Header`. If it's not, the string is returned.
480
+ */
481
+ export function renderStringAsPlaintext(string) {
482
+ return typeof string === 'string' ? string : renderMarkdownAsPlaintext(string);
483
+ }
484
+ /**
485
+ * Strips all markdown from `markdown`. For example `# Header` would be output as `Header`.
486
+ * provide @param withCodeBlocks to retain code blocks
487
+ */
488
+ export function renderMarkdownAsPlaintext(markdown, withCodeBlocks) {
489
+ // values that are too long will freeze the UI
490
+ let value = markdown.value ?? '';
491
+ if (value.length > 100_000) {
492
+ value = `${value.substr(0, 100_000)}…`;
493
+ }
494
+ const html = marked.parse(value, { async: false, renderer: withCodeBlocks ? plainTextWithCodeBlocksRenderer.value : plainTextRenderer.value }).replace(/&(#\d+|[a-zA-Z]+);/g, m => unescapeInfo.get(m) ?? m);
495
+ return sanitizeRenderedMarkdown({ isTrusted: false }, html).toString();
496
+ }
497
+ const unescapeInfo = new Map([
498
+ ['&quot;', '"'],
499
+ ['&nbsp;', ' '],
500
+ ['&amp;', '&'],
501
+ ['&#39;', '\''],
502
+ ['&lt;', '<'],
503
+ ['&gt;', '>'],
504
+ ]);
505
+ function createRenderer() {
506
+ const renderer = new marked.Renderer();
507
+ renderer.code = ({ text }) => {
508
+ return text;
509
+ };
510
+ renderer.blockquote = ({ text }) => {
511
+ return text + '\n';
512
+ };
513
+ renderer.html = (_) => {
514
+ return '';
515
+ };
516
+ renderer.heading = function ({ tokens }) {
517
+ return this.parser.parseInline(tokens) + '\n';
518
+ };
519
+ renderer.hr = () => {
520
+ return '';
521
+ };
522
+ renderer.list = function ({ items }) {
523
+ return items.map(x => this.listitem(x)).join('\n') + '\n';
524
+ };
525
+ renderer.listitem = ({ text }) => {
526
+ return text + '\n';
527
+ };
528
+ renderer.paragraph = function ({ tokens }) {
529
+ return this.parser.parseInline(tokens) + '\n';
530
+ };
531
+ renderer.table = function ({ header, rows }) {
532
+ return header.map(cell => this.tablecell(cell)).join(' ') + '\n' + rows.map(cells => cells.map(cell => this.tablecell(cell)).join(' ')).join('\n') + '\n';
533
+ };
534
+ renderer.tablerow = ({ text }) => {
535
+ return text;
536
+ };
537
+ renderer.tablecell = function ({ tokens }) {
538
+ return this.parser.parseInline(tokens);
539
+ };
540
+ renderer.strong = ({ text }) => {
541
+ return text;
542
+ };
543
+ renderer.em = ({ text }) => {
544
+ return text;
545
+ };
546
+ renderer.codespan = ({ text }) => {
547
+ return text;
548
+ };
549
+ renderer.br = (_) => {
550
+ return '\n';
551
+ };
552
+ renderer.del = ({ text }) => {
553
+ return text;
554
+ };
555
+ renderer.image = (_) => {
556
+ return '';
557
+ };
558
+ renderer.text = ({ text }) => {
559
+ return text;
560
+ };
561
+ renderer.link = ({ text }) => {
562
+ return text;
563
+ };
564
+ return renderer;
565
+ }
566
+ const plainTextRenderer = new Lazy((withCodeBlocks) => createRenderer());
567
+ const plainTextWithCodeBlocksRenderer = new Lazy(() => {
568
+ const renderer = createRenderer();
569
+ renderer.code = ({ text }) => {
570
+ return `\n\`\`\`\n${text}\n\`\`\`\n`;
571
+ };
572
+ return renderer;
573
+ });
574
+ function mergeRawTokenText(tokens) {
575
+ let mergedTokenText = '';
576
+ tokens.forEach(token => {
577
+ mergedTokenText += token.raw;
578
+ });
579
+ return mergedTokenText;
580
+ }
581
+ function completeSingleLinePattern(token) {
582
+ if (!token.tokens) {
583
+ return undefined;
584
+ }
585
+ for (let i = token.tokens.length - 1; i >= 0; i--) {
586
+ const subtoken = token.tokens[i];
587
+ if (subtoken.type === 'text') {
588
+ const lines = subtoken.raw.split('\n');
589
+ const lastLine = lines[lines.length - 1];
590
+ if (lastLine.includes('`')) {
591
+ return completeCodespan(token);
592
+ }
593
+ else if (lastLine.includes('**')) {
594
+ return completeDoublestar(token);
595
+ }
596
+ else if (lastLine.match(/\*\w/)) {
597
+ return completeStar(token);
598
+ }
599
+ else if (lastLine.match(/(^|\s)__\w/)) {
600
+ return completeDoubleUnderscore(token);
601
+ }
602
+ else if (lastLine.match(/(^|\s)_\w/)) {
603
+ return completeUnderscore(token);
604
+ }
605
+ else if (
606
+ // Text with start of link target
607
+ hasLinkTextAndStartOfLinkTarget(lastLine) ||
608
+ // This token doesn't have the link text, eg if it contains other markdown constructs that are in other subtokens.
609
+ // But some preceding token does have an unbalanced [ at least
610
+ hasStartOfLinkTargetAndNoLinkText(lastLine) && token.tokens.slice(0, i).some(t => t.type === 'text' && t.raw.match(/\[[^\]]*$/))) {
611
+ const nextTwoSubTokens = token.tokens.slice(i + 1);
612
+ // A markdown link can look like
613
+ // [link text](https://microsoft.com "more text")
614
+ // Where "more text" is a title for the link or an argument to a vscode command link
615
+ if (
616
+ // If the link was parsed as a link, then look for a link token and a text token with a quote
617
+ nextTwoSubTokens[0]?.type === 'link' && nextTwoSubTokens[1]?.type === 'text' && nextTwoSubTokens[1].raw.match(/^ *"[^"]*$/) ||
618
+ // And if the link was not parsed as a link (eg command link), just look for a single quote in this token
619
+ lastLine.match(/^[^"]* +"[^"]*$/)) {
620
+ return completeLinkTargetArg(token);
621
+ }
622
+ return completeLinkTarget(token);
623
+ }
624
+ // Contains the start of link text, and no following tokens contain the link target
625
+ else if (lastLine.match(/(^|\s)\[\w*/)) {
626
+ return completeLinkText(token);
627
+ }
628
+ }
629
+ }
630
+ return undefined;
631
+ }
632
+ function hasLinkTextAndStartOfLinkTarget(str) {
633
+ return !!str.match(/(^|\s)\[.*\]\(\w*/);
634
+ }
635
+ function hasStartOfLinkTargetAndNoLinkText(str) {
636
+ return !!str.match(/^[^\[]*\]\([^\)]*$/);
637
+ }
638
+ function completeListItemPattern(list) {
639
+ // Patch up this one list item
640
+ const lastListItem = list.items[list.items.length - 1];
641
+ const lastListSubToken = lastListItem.tokens ? lastListItem.tokens[lastListItem.tokens.length - 1] : undefined;
642
+ /*
643
+ Example list token structures:
644
+
645
+ list
646
+ list_item
647
+ text
648
+ text
649
+ codespan
650
+ link
651
+ list_item
652
+ text
653
+ code // Complete indented codeblock
654
+ list_item
655
+ text
656
+ space
657
+ text
658
+ text // Incomplete indented codeblock
659
+ list_item
660
+ text
661
+ list // Nested list
662
+ list_item
663
+ text
664
+ text
665
+
666
+ Contrast with paragraph:
667
+ paragraph
668
+ text
669
+ codespan
670
+ */
671
+ let newToken;
672
+ if (lastListSubToken?.type === 'text' && !('inRawBlock' in lastListItem)) { // Why does Tag have a type of 'text'
673
+ newToken = completeSingleLinePattern(lastListSubToken);
674
+ }
675
+ if (!newToken || newToken.type !== 'paragraph') { // 'text' item inside the list item turns into paragraph
676
+ // Nothing to fix, or not a pattern we were expecting
677
+ return;
678
+ }
679
+ const previousListItemsText = mergeRawTokenText(list.items.slice(0, -1));
680
+ // Grabbing the `- ` or `1. ` or `* ` off the list item because I can't find a better way to do this
681
+ const lastListItemLead = lastListItem.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];
682
+ if (!lastListItemLead) {
683
+ // Is badly formatted
684
+ return;
685
+ }
686
+ const newListItemText = lastListItemLead +
687
+ mergeRawTokenText(lastListItem.tokens.slice(0, -1)) +
688
+ newToken.raw;
689
+ const newList = marked.lexer(previousListItemsText + newListItemText)[0];
690
+ if (newList.type !== 'list') {
691
+ // Something went wrong
692
+ return;
693
+ }
694
+ return newList;
695
+ }
696
+ const maxIncompleteTokensFixRounds = 3;
697
+ export function fillInIncompleteTokens(tokens) {
698
+ for (let i = 0; i < maxIncompleteTokensFixRounds; i++) {
699
+ const newTokens = fillInIncompleteTokensOnce(tokens);
700
+ if (newTokens) {
701
+ tokens = newTokens;
702
+ }
703
+ else {
704
+ break;
705
+ }
706
+ }
707
+ return tokens;
708
+ }
709
+ function fillInIncompleteTokensOnce(tokens) {
710
+ let i;
711
+ let newTokens;
712
+ for (i = 0; i < tokens.length; i++) {
713
+ const token = tokens[i];
714
+ if (token.type === 'paragraph' && token.raw.match(/(\n|^)\|/)) {
715
+ newTokens = completeTable(tokens.slice(i));
716
+ break;
717
+ }
718
+ if (i === tokens.length - 1 && token.type === 'list') {
719
+ const newListToken = completeListItemPattern(token);
720
+ if (newListToken) {
721
+ newTokens = [newListToken];
722
+ break;
723
+ }
724
+ }
725
+ if (i === tokens.length - 1 && token.type === 'paragraph') {
726
+ // Only operates on a single token, because any newline that follows this should break these patterns
727
+ const newToken = completeSingleLinePattern(token);
728
+ if (newToken) {
729
+ newTokens = [newToken];
730
+ break;
731
+ }
732
+ }
733
+ }
734
+ if (newTokens) {
735
+ const newTokensList = [
736
+ ...tokens.slice(0, i),
737
+ ...newTokens
738
+ ];
739
+ newTokensList.links = tokens.links;
740
+ return newTokensList;
741
+ }
742
+ return null;
743
+ }
744
+ function completeCodespan(token) {
745
+ return completeWithString(token, '`');
746
+ }
747
+ function completeStar(tokens) {
748
+ return completeWithString(tokens, '*');
749
+ }
750
+ function completeUnderscore(tokens) {
751
+ return completeWithString(tokens, '_');
752
+ }
753
+ function completeLinkTarget(tokens) {
754
+ return completeWithString(tokens, ')');
755
+ }
756
+ function completeLinkTargetArg(tokens) {
757
+ return completeWithString(tokens, '")');
758
+ }
759
+ function completeLinkText(tokens) {
760
+ return completeWithString(tokens, '](https://microsoft.com)');
761
+ }
762
+ function completeDoublestar(tokens) {
763
+ return completeWithString(tokens, '**');
764
+ }
765
+ function completeDoubleUnderscore(tokens) {
766
+ return completeWithString(tokens, '__');
767
+ }
768
+ function completeWithString(tokens, closingString) {
769
+ const mergedRawText = mergeRawTokenText(Array.isArray(tokens) ? tokens : [tokens]);
770
+ // If it was completed correctly, this should be a single token.
771
+ // Expecting either a Paragraph or a List
772
+ return marked.lexer(mergedRawText + closingString)[0];
773
+ }
774
+ function completeTable(tokens) {
775
+ const mergedRawText = mergeRawTokenText(tokens);
776
+ const lines = mergedRawText.split('\n');
777
+ let numCols; // The number of line1 col headers
778
+ let hasSeparatorRow = false;
779
+ for (let i = 0; i < lines.length; i++) {
780
+ const line = lines[i].trim();
781
+ if (typeof numCols === 'undefined' && line.match(/^\s*\|/)) {
782
+ const line1Matches = line.match(/(\|[^\|]+)(?=\||$)/g);
783
+ if (line1Matches) {
784
+ numCols = line1Matches.length;
785
+ }
786
+ }
787
+ else if (typeof numCols === 'number') {
788
+ if (line.match(/^\s*\|/)) {
789
+ if (i !== lines.length - 1) {
790
+ // We got the line1 header row, and the line2 separator row, but there are more lines, and it wasn't parsed as a table!
791
+ // That's strange and means that the table is probably malformed in the source, so I won't try to patch it up.
792
+ return undefined;
793
+ }
794
+ // Got a line2 separator row- partial or complete, doesn't matter, we'll replace it with a correct one
795
+ hasSeparatorRow = true;
796
+ }
797
+ else {
798
+ // The line after the header row isn't a valid separator row, so the table is malformed, don't fix it up
799
+ return undefined;
800
+ }
801
+ }
802
+ }
803
+ if (typeof numCols === 'number' && numCols > 0) {
804
+ const prefixText = hasSeparatorRow ? lines.slice(0, -1).join('\n') : mergedRawText;
805
+ const line1EndsInPipe = !!prefixText.match(/\|\s*$/);
806
+ const newRawText = prefixText + (line1EndsInPipe ? '' : '|') + `\n|${' --- |'.repeat(numCols)}`;
807
+ return marked.lexer(newRawText);
808
+ }
809
+ return undefined;
810
+ }
811
+ function addDompurifyHook(hook, cb) {
812
+ dompurify.addHook(hook, cb);
813
+ return toDisposable(() => dompurify.removeHook(hook));
814
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as browser from './browser.js';
6
+ import { IframeUtils } from './iframe.js';
7
+ import * as platform from '../common/platform.js';
8
+ export class StandardMouseEvent {
9
+ constructor(targetWindow, e) {
10
+ this.timestamp = Date.now();
11
+ this.browserEvent = e;
12
+ this.leftButton = e.button === 0;
13
+ this.middleButton = e.button === 1;
14
+ this.rightButton = e.button === 2;
15
+ this.buttons = e.buttons;
16
+ this.target = e.target;
17
+ this.detail = e.detail || 1;
18
+ if (e.type === 'dblclick') {
19
+ this.detail = 2;
20
+ }
21
+ this.ctrlKey = e.ctrlKey;
22
+ this.shiftKey = e.shiftKey;
23
+ this.altKey = e.altKey;
24
+ this.metaKey = e.metaKey;
25
+ if (typeof e.pageX === 'number') {
26
+ this.posx = e.pageX;
27
+ this.posy = e.pageY;
28
+ }
29
+ else {
30
+ // Probably hit by MSGestureEvent
31
+ this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;
32
+ this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;
33
+ }
34
+ // Find the position of the iframe this code is executing in relative to the iframe where the event was captured.
35
+ const iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);
36
+ this.posx -= iframeOffsets.left;
37
+ this.posy -= iframeOffsets.top;
38
+ }
39
+ preventDefault() {
40
+ this.browserEvent.preventDefault();
41
+ }
42
+ stopPropagation() {
43
+ this.browserEvent.stopPropagation();
44
+ }
45
+ }
46
+ export class StandardWheelEvent {
47
+ constructor(e, deltaX = 0, deltaY = 0) {
48
+ this.browserEvent = e || null;
49
+ this.target = e ? (e.target || e.targetNode || e.srcElement) : null;
50
+ this.deltaY = deltaY;
51
+ this.deltaX = deltaX;
52
+ let shouldFactorDPR = false;
53
+ if (browser.isChrome) {
54
+ // Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event.
55
+ // See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61
56
+ const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
57
+ const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;
58
+ shouldFactorDPR = chromeMajorVersion <= 122;
59
+ }
60
+ if (e) {
61
+ // Old (deprecated) wheel events
62
+ const e1 = e;
63
+ const e2 = e;
64
+ const devicePixelRatio = e.view?.devicePixelRatio || 1;
65
+ // vertical delta scroll
66
+ if (typeof e1.wheelDeltaY !== 'undefined') {
67
+ if (shouldFactorDPR) {
68
+ // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928
69
+ this.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);
70
+ }
71
+ else {
72
+ this.deltaY = e1.wheelDeltaY / 120;
73
+ }
74
+ }
75
+ else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
76
+ this.deltaY = -e2.detail / 3;
77
+ }
78
+ else if (e.type === 'wheel') {
79
+ // Modern wheel event
80
+ // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
81
+ const ev = e;
82
+ if (ev.deltaMode === ev.DOM_DELTA_LINE) {
83
+ // the deltas are expressed in lines
84
+ if (browser.isFirefox && !platform.isMacintosh) {
85
+ this.deltaY = -e.deltaY / 3;
86
+ }
87
+ else {
88
+ this.deltaY = -e.deltaY;
89
+ }
90
+ }
91
+ else {
92
+ this.deltaY = -e.deltaY / 40;
93
+ }
94
+ }
95
+ // horizontal delta scroll
96
+ if (typeof e1.wheelDeltaX !== 'undefined') {
97
+ if (browser.isSafari && platform.isWindows) {
98
+ this.deltaX = -(e1.wheelDeltaX / 120);
99
+ }
100
+ else if (shouldFactorDPR) {
101
+ // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928
102
+ this.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);
103
+ }
104
+ else {
105
+ this.deltaX = e1.wheelDeltaX / 120;
106
+ }
107
+ }
108
+ else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
109
+ this.deltaX = -e.detail / 3;
110
+ }
111
+ else if (e.type === 'wheel') {
112
+ // Modern wheel event
113
+ // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
114
+ const ev = e;
115
+ if (ev.deltaMode === ev.DOM_DELTA_LINE) {
116
+ // the deltas are expressed in lines
117
+ if (browser.isFirefox && !platform.isMacintosh) {
118
+ this.deltaX = -e.deltaX / 3;
119
+ }
120
+ else {
121
+ this.deltaX = -e.deltaX;
122
+ }
123
+ }
124
+ else {
125
+ this.deltaX = -e.deltaX / 40;
126
+ }
127
+ }
128
+ // Assume a vertical scroll if nothing else worked
129
+ if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
130
+ if (shouldFactorDPR) {
131
+ // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928
132
+ this.deltaY = e.wheelDelta / (120 * devicePixelRatio);
133
+ }
134
+ else {
135
+ this.deltaY = e.wheelDelta / 120;
136
+ }
137
+ }
138
+ }
139
+ }
140
+ preventDefault() {
141
+ this.browserEvent?.preventDefault();
142
+ }
143
+ stopPropagation() {
144
+ this.browserEvent?.stopPropagation();
145
+ }
146
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/performance.js ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export var inputLatency;
6
+ (function (inputLatency) {
7
+ const totalKeydownTime = { total: 0, min: Number.MAX_VALUE, max: 0 };
8
+ const totalInputTime = { ...totalKeydownTime };
9
+ const totalRenderTime = { ...totalKeydownTime };
10
+ const totalInputLatencyTime = { ...totalKeydownTime };
11
+ let measurementsCount = 0;
12
+ const state = {
13
+ keydown: 0 /* EventPhase.Before */,
14
+ input: 0 /* EventPhase.Before */,
15
+ render: 0 /* EventPhase.Before */,
16
+ };
17
+ /**
18
+ * Record the start of the keydown event.
19
+ */
20
+ function onKeyDown() {
21
+ /** Direct Check C. See explanation in {@link recordIfFinished} */
22
+ recordIfFinished();
23
+ performance.mark('inputlatency/start');
24
+ performance.mark('keydown/start');
25
+ state.keydown = 1 /* EventPhase.InProgress */;
26
+ queueMicrotask(markKeyDownEnd);
27
+ }
28
+ inputLatency.onKeyDown = onKeyDown;
29
+ /**
30
+ * Mark the end of the keydown event.
31
+ */
32
+ function markKeyDownEnd() {
33
+ if (state.keydown === 1 /* EventPhase.InProgress */) {
34
+ performance.mark('keydown/end');
35
+ state.keydown = 2 /* EventPhase.Finished */;
36
+ }
37
+ }
38
+ /**
39
+ * Record the start of the beforeinput event.
40
+ */
41
+ function onBeforeInput() {
42
+ performance.mark('input/start');
43
+ state.input = 1 /* EventPhase.InProgress */;
44
+ /** Schedule Task A. See explanation in {@link recordIfFinished} */
45
+ scheduleRecordIfFinishedTask();
46
+ }
47
+ inputLatency.onBeforeInput = onBeforeInput;
48
+ /**
49
+ * Record the start of the input event.
50
+ */
51
+ function onInput() {
52
+ if (state.input === 0 /* EventPhase.Before */) {
53
+ // it looks like we didn't receive a `beforeinput`
54
+ onBeforeInput();
55
+ }
56
+ queueMicrotask(markInputEnd);
57
+ }
58
+ inputLatency.onInput = onInput;
59
+ function markInputEnd() {
60
+ if (state.input === 1 /* EventPhase.InProgress */) {
61
+ performance.mark('input/end');
62
+ state.input = 2 /* EventPhase.Finished */;
63
+ }
64
+ }
65
+ /**
66
+ * Record the start of the keyup event.
67
+ */
68
+ function onKeyUp() {
69
+ /** Direct Check D. See explanation in {@link recordIfFinished} */
70
+ recordIfFinished();
71
+ }
72
+ inputLatency.onKeyUp = onKeyUp;
73
+ /**
74
+ * Record the start of the selectionchange event.
75
+ */
76
+ function onSelectionChange() {
77
+ /** Direct Check E. See explanation in {@link recordIfFinished} */
78
+ recordIfFinished();
79
+ }
80
+ inputLatency.onSelectionChange = onSelectionChange;
81
+ /**
82
+ * Record the start of the animation frame performing the rendering.
83
+ */
84
+ function onRenderStart() {
85
+ // Render may be triggered during input, but we only measure the following animation frame
86
+ if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 0 /* EventPhase.Before */) {
87
+ // Only measure the first render after keyboard input
88
+ performance.mark('render/start');
89
+ state.render = 1 /* EventPhase.InProgress */;
90
+ queueMicrotask(markRenderEnd);
91
+ /** Schedule Task B. See explanation in {@link recordIfFinished} */
92
+ scheduleRecordIfFinishedTask();
93
+ }
94
+ }
95
+ inputLatency.onRenderStart = onRenderStart;
96
+ /**
97
+ * Mark the end of the animation frame performing the rendering.
98
+ */
99
+ function markRenderEnd() {
100
+ if (state.render === 1 /* EventPhase.InProgress */) {
101
+ performance.mark('render/end');
102
+ state.render = 2 /* EventPhase.Finished */;
103
+ }
104
+ }
105
+ function scheduleRecordIfFinishedTask() {
106
+ // Here we can safely assume that the `setTimeout` will not be
107
+ // artificially delayed by 4ms because we schedule it from
108
+ // event handlers
109
+ setTimeout(recordIfFinished);
110
+ }
111
+ /**
112
+ * Record the input latency sample if input handling and rendering are finished.
113
+ *
114
+ * The challenge here is that we want to record the latency in such a way that it includes
115
+ * also the layout and painting work the browser does during the animation frame task.
116
+ *
117
+ * Simply scheduling a new task (via `setTimeout`) from the animation frame task would
118
+ * schedule the new task at the end of the task queue (after other code that uses `setTimeout`),
119
+ * so we need to use multiple strategies to make sure our task runs before others:
120
+ *
121
+ * We schedule tasks (A and B):
122
+ * - we schedule a task A (via a `setTimeout` call) when the input starts in `markInputStart`.
123
+ * If the animation frame task is scheduled quickly by the browser, then task A has a very good
124
+ * chance of being the very first task after the animation frame and thus will record the input latency.
125
+ * - however, if the animation frame task is scheduled a bit later, then task A might execute
126
+ * before the animation frame task. We therefore schedule another task B from `markRenderStart`.
127
+ *
128
+ * We do direct checks in browser event handlers (C, D, E):
129
+ * - if the browser has multiple keydown events queued up, they will be scheduled before the `setTimeout` tasks,
130
+ * so we do a direct check in the keydown event handler (C).
131
+ * - depending on timing, sometimes the animation frame is scheduled even before the `keyup` event, so we
132
+ * do a direct check there too (E).
133
+ * - the browser oftentimes emits a `selectionchange` event after an `input`, so we do a direct check there (D).
134
+ */
135
+ function recordIfFinished() {
136
+ if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 2 /* EventPhase.Finished */) {
137
+ performance.mark('inputlatency/end');
138
+ performance.measure('keydown', 'keydown/start', 'keydown/end');
139
+ performance.measure('input', 'input/start', 'input/end');
140
+ performance.measure('render', 'render/start', 'render/end');
141
+ performance.measure('inputlatency', 'inputlatency/start', 'inputlatency/end');
142
+ addMeasure('keydown', totalKeydownTime);
143
+ addMeasure('input', totalInputTime);
144
+ addMeasure('render', totalRenderTime);
145
+ addMeasure('inputlatency', totalInputLatencyTime);
146
+ // console.info(
147
+ // `input latency=${performance.getEntriesByName('inputlatency')[0].duration.toFixed(1)} [` +
148
+ // `keydown=${performance.getEntriesByName('keydown')[0].duration.toFixed(1)}, ` +
149
+ // `input=${performance.getEntriesByName('input')[0].duration.toFixed(1)}, ` +
150
+ // `render=${performance.getEntriesByName('render')[0].duration.toFixed(1)}` +
151
+ // `]`
152
+ // );
153
+ measurementsCount++;
154
+ reset();
155
+ }
156
+ }
157
+ function addMeasure(entryName, cumulativeMeasurement) {
158
+ const duration = performance.getEntriesByName(entryName)[0].duration;
159
+ cumulativeMeasurement.total += duration;
160
+ cumulativeMeasurement.min = Math.min(cumulativeMeasurement.min, duration);
161
+ cumulativeMeasurement.max = Math.max(cumulativeMeasurement.max, duration);
162
+ }
163
+ /**
164
+ * Clear the current sample.
165
+ */
166
+ function reset() {
167
+ performance.clearMarks('keydown/start');
168
+ performance.clearMarks('keydown/end');
169
+ performance.clearMarks('input/start');
170
+ performance.clearMarks('input/end');
171
+ performance.clearMarks('render/start');
172
+ performance.clearMarks('render/end');
173
+ performance.clearMarks('inputlatency/start');
174
+ performance.clearMarks('inputlatency/end');
175
+ performance.clearMeasures('keydown');
176
+ performance.clearMeasures('input');
177
+ performance.clearMeasures('render');
178
+ performance.clearMeasures('inputlatency');
179
+ state.keydown = 0 /* EventPhase.Before */;
180
+ state.input = 0 /* EventPhase.Before */;
181
+ state.render = 0 /* EventPhase.Before */;
182
+ }
183
+ /**
184
+ * Gets all input latency samples and clears the internal buffers to start recording a new set
185
+ * of samples.
186
+ */
187
+ function getAndClearMeasurements() {
188
+ if (measurementsCount === 0) {
189
+ return undefined;
190
+ }
191
+ // Assemble the result
192
+ const result = {
193
+ keydown: cumulativeToFinalMeasurement(totalKeydownTime),
194
+ input: cumulativeToFinalMeasurement(totalInputTime),
195
+ render: cumulativeToFinalMeasurement(totalRenderTime),
196
+ total: cumulativeToFinalMeasurement(totalInputLatencyTime),
197
+ sampleCount: measurementsCount
198
+ };
199
+ // Clear the cumulative measurements
200
+ clearCumulativeMeasurement(totalKeydownTime);
201
+ clearCumulativeMeasurement(totalInputTime);
202
+ clearCumulativeMeasurement(totalRenderTime);
203
+ clearCumulativeMeasurement(totalInputLatencyTime);
204
+ measurementsCount = 0;
205
+ return result;
206
+ }
207
+ inputLatency.getAndClearMeasurements = getAndClearMeasurements;
208
+ function cumulativeToFinalMeasurement(cumulative) {
209
+ return {
210
+ average: cumulative.total / measurementsCount,
211
+ max: cumulative.max,
212
+ min: cumulative.min,
213
+ };
214
+ }
215
+ function clearCumulativeMeasurement(cumulative) {
216
+ cumulative.total = 0;
217
+ cumulative.min = Number.MAX_VALUE;
218
+ cumulative.max = 0;
219
+ }
220
+ })(inputLatency || (inputLatency = {}));
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { getWindowId, onDidUnregisterWindow } from './dom.js';
6
+ import { Emitter, Event } from '../common/event.js';
7
+ import { Disposable, markAsSingleton } from '../common/lifecycle.js';
8
+ /**
9
+ * See https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes
10
+ */
11
+ class DevicePixelRatioMonitor extends Disposable {
12
+ constructor(targetWindow) {
13
+ super();
14
+ this._onDidChange = this._register(new Emitter());
15
+ this.onDidChange = this._onDidChange.event;
16
+ this._listener = () => this._handleChange(targetWindow, true);
17
+ this._mediaQueryList = null;
18
+ this._handleChange(targetWindow, false);
19
+ }
20
+ _handleChange(targetWindow, fireEvent) {
21
+ this._mediaQueryList?.removeEventListener('change', this._listener);
22
+ this._mediaQueryList = targetWindow.matchMedia(`(resolution: ${targetWindow.devicePixelRatio}dppx)`);
23
+ this._mediaQueryList.addEventListener('change', this._listener);
24
+ if (fireEvent) {
25
+ this._onDidChange.fire();
26
+ }
27
+ }
28
+ }
29
+ class PixelRatioMonitorImpl extends Disposable {
30
+ get value() {
31
+ return this._value;
32
+ }
33
+ constructor(targetWindow) {
34
+ super();
35
+ this._onDidChange = this._register(new Emitter());
36
+ this.onDidChange = this._onDidChange.event;
37
+ this._value = this._getPixelRatio(targetWindow);
38
+ const dprMonitor = this._register(new DevicePixelRatioMonitor(targetWindow));
39
+ this._register(dprMonitor.onDidChange(() => {
40
+ this._value = this._getPixelRatio(targetWindow);
41
+ this._onDidChange.fire(this._value);
42
+ }));
43
+ }
44
+ _getPixelRatio(targetWindow) {
45
+ const ctx = document.createElement('canvas').getContext('2d');
46
+ const dpr = targetWindow.devicePixelRatio || 1;
47
+ const bsr = ctx.webkitBackingStorePixelRatio ||
48
+ ctx.mozBackingStorePixelRatio ||
49
+ ctx.msBackingStorePixelRatio ||
50
+ ctx.oBackingStorePixelRatio ||
51
+ ctx.backingStorePixelRatio || 1;
52
+ return dpr / bsr;
53
+ }
54
+ }
55
+ class PixelRatioMonitorFacade {
56
+ constructor() {
57
+ this.mapWindowIdToPixelRatioMonitor = new Map();
58
+ }
59
+ _getOrCreatePixelRatioMonitor(targetWindow) {
60
+ const targetWindowId = getWindowId(targetWindow);
61
+ let pixelRatioMonitor = this.mapWindowIdToPixelRatioMonitor.get(targetWindowId);
62
+ if (!pixelRatioMonitor) {
63
+ pixelRatioMonitor = markAsSingleton(new PixelRatioMonitorImpl(targetWindow));
64
+ this.mapWindowIdToPixelRatioMonitor.set(targetWindowId, pixelRatioMonitor);
65
+ markAsSingleton(Event.once(onDidUnregisterWindow)(({ vscodeWindowId }) => {
66
+ if (vscodeWindowId === targetWindowId) {
67
+ pixelRatioMonitor?.dispose();
68
+ this.mapWindowIdToPixelRatioMonitor.delete(targetWindowId);
69
+ }
70
+ }));
71
+ }
72
+ return pixelRatioMonitor;
73
+ }
74
+ getInstance(targetWindow) {
75
+ return this._getOrCreatePixelRatioMonitor(targetWindow);
76
+ }
77
+ }
78
+ /**
79
+ * Returns the pixel ratio.
80
+ *
81
+ * This is useful for rendering <canvas> elements at native screen resolution or for being used as
82
+ * a cache key when storing font measurements. Fonts might render differently depending on resolution
83
+ * and any measurements need to be discarded for example when a window is moved from a monitor to another.
84
+ */
85
+ export const PixelRatio = new PixelRatioMonitorFacade();
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/touch.js ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ import * as DomUtils from './dom.js';
12
+ import { mainWindow } from './window.js';
13
+ import * as arrays from '../common/arrays.js';
14
+ import { memoize } from '../common/decorators.js';
15
+ import { Event as EventUtils } from '../common/event.js';
16
+ import { Disposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';
17
+ import { LinkedList } from '../common/linkedList.js';
18
+ export var EventType;
19
+ (function (EventType) {
20
+ EventType.Tap = '-monaco-gesturetap';
21
+ EventType.Change = '-monaco-gesturechange';
22
+ EventType.Start = '-monaco-gesturestart';
23
+ EventType.End = '-monaco-gesturesend';
24
+ EventType.Contextmenu = '-monaco-gesturecontextmenu';
25
+ })(EventType || (EventType = {}));
26
+ export class Gesture extends Disposable {
27
+ static { this.SCROLL_FRICTION = -0.005; }
28
+ static { this.HOLD_DELAY = 700; }
29
+ static { this.CLEAR_TAP_COUNT_TIME = 400; } // ms
30
+ constructor() {
31
+ super();
32
+ this.dispatched = false;
33
+ this.targets = new LinkedList();
34
+ this.ignoreTargets = new LinkedList();
35
+ this.activeTouches = {};
36
+ this.handle = null;
37
+ this._lastSetTapCountTime = 0;
38
+ this._register(EventUtils.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => {
39
+ disposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e) => this.onTouchStart(e), { passive: false }));
40
+ disposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e) => this.onTouchEnd(window, e)));
41
+ disposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e) => this.onTouchMove(e), { passive: false }));
42
+ }, { window: mainWindow, disposables: this._store }));
43
+ }
44
+ static addTarget(element) {
45
+ if (!Gesture.isTouchDevice()) {
46
+ return Disposable.None;
47
+ }
48
+ if (!Gesture.INSTANCE) {
49
+ Gesture.INSTANCE = markAsSingleton(new Gesture());
50
+ }
51
+ const remove = Gesture.INSTANCE.targets.push(element);
52
+ return toDisposable(remove);
53
+ }
54
+ static ignoreTarget(element) {
55
+ if (!Gesture.isTouchDevice()) {
56
+ return Disposable.None;
57
+ }
58
+ if (!Gesture.INSTANCE) {
59
+ Gesture.INSTANCE = markAsSingleton(new Gesture());
60
+ }
61
+ const remove = Gesture.INSTANCE.ignoreTargets.push(element);
62
+ return toDisposable(remove);
63
+ }
64
+ static isTouchDevice() {
65
+ // `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be
66
+ // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
67
+ return 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0;
68
+ }
69
+ dispose() {
70
+ if (this.handle) {
71
+ this.handle.dispose();
72
+ this.handle = null;
73
+ }
74
+ super.dispose();
75
+ }
76
+ onTouchStart(e) {
77
+ const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.
78
+ if (this.handle) {
79
+ this.handle.dispose();
80
+ this.handle = null;
81
+ }
82
+ for (let i = 0, len = e.targetTouches.length; i < len; i++) {
83
+ const touch = e.targetTouches.item(i);
84
+ this.activeTouches[touch.identifier] = {
85
+ id: touch.identifier,
86
+ initialTarget: touch.target,
87
+ initialTimeStamp: timestamp,
88
+ initialPageX: touch.pageX,
89
+ initialPageY: touch.pageY,
90
+ rollingTimestamps: [timestamp],
91
+ rollingPageX: [touch.pageX],
92
+ rollingPageY: [touch.pageY]
93
+ };
94
+ const evt = this.newGestureEvent(EventType.Start, touch.target);
95
+ evt.pageX = touch.pageX;
96
+ evt.pageY = touch.pageY;
97
+ this.dispatchEvent(evt);
98
+ }
99
+ if (this.dispatched) {
100
+ e.preventDefault();
101
+ e.stopPropagation();
102
+ this.dispatched = false;
103
+ }
104
+ }
105
+ onTouchEnd(targetWindow, e) {
106
+ const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.
107
+ const activeTouchCount = Object.keys(this.activeTouches).length;
108
+ for (let i = 0, len = e.changedTouches.length; i < len; i++) {
109
+ const touch = e.changedTouches.item(i);
110
+ if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {
111
+ console.warn('move of an UNKNOWN touch', touch);
112
+ continue;
113
+ }
114
+ const data = this.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp;
115
+ if (holdTime < Gesture.HOLD_DELAY
116
+ && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30
117
+ && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {
118
+ const evt = this.newGestureEvent(EventType.Tap, data.initialTarget);
119
+ evt.pageX = arrays.tail(data.rollingPageX);
120
+ evt.pageY = arrays.tail(data.rollingPageY);
121
+ this.dispatchEvent(evt);
122
+ }
123
+ else if (holdTime >= Gesture.HOLD_DELAY
124
+ && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30
125
+ && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {
126
+ const evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);
127
+ evt.pageX = arrays.tail(data.rollingPageX);
128
+ evt.pageY = arrays.tail(data.rollingPageY);
129
+ this.dispatchEvent(evt);
130
+ }
131
+ else if (activeTouchCount === 1) {
132
+ const finalX = arrays.tail(data.rollingPageX);
133
+ const finalY = arrays.tail(data.rollingPageY);
134
+ const deltaT = arrays.tail(data.rollingTimestamps) - data.rollingTimestamps[0];
135
+ const deltaX = finalX - data.rollingPageX[0];
136
+ const deltaY = finalY - data.rollingPageY[0];
137
+ // We need to get all the dispatch targets on the start of the inertia event
138
+ const dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));
139
+ this.inertia(targetWindow, dispatchTo, timestamp, // time now
140
+ Math.abs(deltaX) / deltaT, // speed
141
+ deltaX > 0 ? 1 : -1, // x direction
142
+ finalX, // x now
143
+ Math.abs(deltaY) / deltaT, // y speed
144
+ deltaY > 0 ? 1 : -1, // y direction
145
+ finalY // y now
146
+ );
147
+ }
148
+ this.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));
149
+ // forget about this touch
150
+ delete this.activeTouches[touch.identifier];
151
+ }
152
+ if (this.dispatched) {
153
+ e.preventDefault();
154
+ e.stopPropagation();
155
+ this.dispatched = false;
156
+ }
157
+ }
158
+ newGestureEvent(type, initialTarget) {
159
+ const event = document.createEvent('CustomEvent');
160
+ event.initEvent(type, false, true);
161
+ event.initialTarget = initialTarget;
162
+ event.tapCount = 0;
163
+ return event;
164
+ }
165
+ dispatchEvent(event) {
166
+ if (event.type === EventType.Tap) {
167
+ const currentTime = (new Date()).getTime();
168
+ let setTapCount = 0;
169
+ if (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {
170
+ setTapCount = 1;
171
+ }
172
+ else {
173
+ setTapCount = 2;
174
+ }
175
+ this._lastSetTapCountTime = currentTime;
176
+ event.tapCount = setTapCount;
177
+ }
178
+ else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {
179
+ // tap is canceled by scrolling or context menu
180
+ this._lastSetTapCountTime = 0;
181
+ }
182
+ if (event.initialTarget instanceof Node) {
183
+ for (const ignoreTarget of this.ignoreTargets) {
184
+ if (ignoreTarget.contains(event.initialTarget)) {
185
+ return;
186
+ }
187
+ }
188
+ const targets = [];
189
+ for (const target of this.targets) {
190
+ if (target.contains(event.initialTarget)) {
191
+ let depth = 0;
192
+ let now = event.initialTarget;
193
+ while (now && now !== target) {
194
+ depth++;
195
+ now = now.parentElement;
196
+ }
197
+ targets.push([depth, target]);
198
+ }
199
+ }
200
+ targets.sort((a, b) => a[0] - b[0]);
201
+ for (const [_, target] of targets) {
202
+ target.dispatchEvent(event);
203
+ this.dispatched = true;
204
+ }
205
+ }
206
+ }
207
+ inertia(targetWindow, dispatchTo, t1, vX, dirX, x, vY, dirY, y) {
208
+ this.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => {
209
+ const now = Date.now();
210
+ // velocity: old speed + accel_over_time
211
+ const deltaT = now - t1;
212
+ let delta_pos_x = 0, delta_pos_y = 0;
213
+ let stopped = true;
214
+ vX += Gesture.SCROLL_FRICTION * deltaT;
215
+ vY += Gesture.SCROLL_FRICTION * deltaT;
216
+ if (vX > 0) {
217
+ stopped = false;
218
+ delta_pos_x = dirX * vX * deltaT;
219
+ }
220
+ if (vY > 0) {
221
+ stopped = false;
222
+ delta_pos_y = dirY * vY * deltaT;
223
+ }
224
+ // dispatch translation event
225
+ const evt = this.newGestureEvent(EventType.Change);
226
+ evt.translationX = delta_pos_x;
227
+ evt.translationY = delta_pos_y;
228
+ dispatchTo.forEach(d => d.dispatchEvent(evt));
229
+ if (!stopped) {
230
+ this.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);
231
+ }
232
+ });
233
+ }
234
+ onTouchMove(e) {
235
+ const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.
236
+ for (let i = 0, len = e.changedTouches.length; i < len; i++) {
237
+ const touch = e.changedTouches.item(i);
238
+ if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {
239
+ console.warn('end of an UNKNOWN touch', touch);
240
+ continue;
241
+ }
242
+ const data = this.activeTouches[touch.identifier];
243
+ const evt = this.newGestureEvent(EventType.Change, data.initialTarget);
244
+ evt.translationX = touch.pageX - arrays.tail(data.rollingPageX);
245
+ evt.translationY = touch.pageY - arrays.tail(data.rollingPageY);
246
+ evt.pageX = touch.pageX;
247
+ evt.pageY = touch.pageY;
248
+ this.dispatchEvent(evt);
249
+ // only keep a few data points, to average the final speed
250
+ if (data.rollingPageX.length > 3) {
251
+ data.rollingPageX.shift();
252
+ data.rollingPageY.shift();
253
+ data.rollingTimestamps.shift();
254
+ }
255
+ data.rollingPageX.push(touch.pageX);
256
+ data.rollingPageY.push(touch.pageY);
257
+ data.rollingTimestamps.push(timestamp);
258
+ }
259
+ if (this.dispatched) {
260
+ e.preventDefault();
261
+ e.stopPropagation();
262
+ this.dispatched = false;
263
+ }
264
+ }
265
+ }
266
+ __decorate([
267
+ memoize
268
+ ], Gesture, "isTouchDevice", null);
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { onUnexpectedError } from '../common/errors.js';
6
+ export function createTrustedTypesPolicy(policyName, policyOptions) {
7
+ const monacoEnvironment = globalThis.MonacoEnvironment;
8
+ if (monacoEnvironment?.createTrustedTypesPolicy) {
9
+ try {
10
+ return monacoEnvironment.createTrustedTypesPolicy(policyName, policyOptions);
11
+ }
12
+ catch (err) {
13
+ onUnexpectedError(err);
14
+ return undefined;
15
+ }
16
+ }
17
+ try {
18
+ return globalThis.trustedTypes?.createPolicy(policyName, policyOptions);
19
+ }
20
+ catch (err) {
21
+ onUnexpectedError(err);
22
+ return undefined;
23
+ }
24
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { isFirefox } from '../../browser.js';
6
+ import { DataTransfers } from '../../dnd.js';
7
+ import { addDisposableListener, EventHelper, EventType } from '../../dom.js';
8
+ import { EventType as TouchEventType, Gesture } from '../../touch.js';
9
+ import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
10
+ import { SelectBox } from '../selectBox/selectBox.js';
11
+ import { Action, ActionRunner, Separator } from '../../../common/actions.js';
12
+ import { Disposable } from '../../../common/lifecycle.js';
13
+ import * as platform from '../../../common/platform.js';
14
+ import * as types from '../../../common/types.js';
15
+ import './actionbar.css';
16
+ import * as nls from '../../../../nls.js';
17
+ import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';
18
+ export class BaseActionViewItem extends Disposable {
19
+ get action() {
20
+ return this._action;
21
+ }
22
+ constructor(context, action, options = {}) {
23
+ super();
24
+ this.options = options;
25
+ this._context = context || this;
26
+ this._action = action;
27
+ if (action instanceof Action) {
28
+ this._register(action.onDidChange(event => {
29
+ if (!this.element) {
30
+ // we have not been rendered yet, so there
31
+ // is no point in updating the UI
32
+ return;
33
+ }
34
+ this.handleActionChangeEvent(event);
35
+ }));
36
+ }
37
+ }
38
+ handleActionChangeEvent(event) {
39
+ if (event.enabled !== undefined) {
40
+ this.updateEnabled();
41
+ }
42
+ if (event.checked !== undefined) {
43
+ this.updateChecked();
44
+ }
45
+ if (event.class !== undefined) {
46
+ this.updateClass();
47
+ }
48
+ if (event.label !== undefined) {
49
+ this.updateLabel();
50
+ this.updateTooltip();
51
+ }
52
+ if (event.tooltip !== undefined) {
53
+ this.updateTooltip();
54
+ }
55
+ }
56
+ get actionRunner() {
57
+ if (!this._actionRunner) {
58
+ this._actionRunner = this._register(new ActionRunner());
59
+ }
60
+ return this._actionRunner;
61
+ }
62
+ set actionRunner(actionRunner) {
63
+ this._actionRunner = actionRunner;
64
+ }
65
+ isEnabled() {
66
+ return this._action.enabled;
67
+ }
68
+ setActionContext(newContext) {
69
+ this._context = newContext;
70
+ }
71
+ render(container) {
72
+ const element = this.element = container;
73
+ this._register(Gesture.addTarget(container));
74
+ const enableDragging = this.options && this.options.draggable;
75
+ if (enableDragging) {
76
+ container.draggable = true;
77
+ if (isFirefox) {
78
+ // Firefox: requires to set a text data transfer to get going
79
+ this._register(addDisposableListener(container, EventType.DRAG_START, e => e.dataTransfer?.setData(DataTransfers.TEXT, this._action.label)));
80
+ }
81
+ }
82
+ this._register(addDisposableListener(element, TouchEventType.Tap, e => this.onClick(e, true))); // Preserve focus on tap #125470
83
+ this._register(addDisposableListener(element, EventType.MOUSE_DOWN, e => {
84
+ if (!enableDragging) {
85
+ EventHelper.stop(e, true); // do not run when dragging is on because that would disable it
86
+ }
87
+ if (this._action.enabled && e.button === 0) {
88
+ element.classList.add('active');
89
+ }
90
+ }));
91
+ if (platform.isMacintosh) {
92
+ // macOS: allow to trigger the button when holding Ctrl+key and pressing the
93
+ // main mouse button. This is for scenarios where e.g. some interaction forces
94
+ // the Ctrl+key to be pressed and hold but the user still wants to interact
95
+ // with the actions (for example quick access in quick navigation mode).
96
+ this._register(addDisposableListener(element, EventType.CONTEXT_MENU, e => {
97
+ if (e.button === 0 && e.ctrlKey === true) {
98
+ this.onClick(e);
99
+ }
100
+ }));
101
+ }
102
+ this._register(addDisposableListener(element, EventType.CLICK, e => {
103
+ EventHelper.stop(e, true);
104
+ // menus do not use the click event
105
+ if (!(this.options && this.options.isMenu)) {
106
+ this.onClick(e);
107
+ }
108
+ }));
109
+ this._register(addDisposableListener(element, EventType.DBLCLICK, e => {
110
+ EventHelper.stop(e, true);
111
+ }));
112
+ [EventType.MOUSE_UP, EventType.MOUSE_OUT].forEach(event => {
113
+ this._register(addDisposableListener(element, event, e => {
114
+ EventHelper.stop(e);
115
+ element.classList.remove('active');
116
+ }));
117
+ });
118
+ }
119
+ onClick(event, preserveFocus = false) {
120
+ EventHelper.stop(event, true);
121
+ const context = types.isUndefinedOrNull(this._context) ? this.options?.useEventAsContext ? event : { preserveFocus } : this._context;
122
+ this.actionRunner.run(this._action, context);
123
+ }
124
+ // Only set the tabIndex on the element once it is about to get focused
125
+ // That way this element wont be a tab stop when it is not needed #106441
126
+ focus() {
127
+ if (this.element) {
128
+ this.element.tabIndex = 0;
129
+ this.element.focus();
130
+ this.element.classList.add('focused');
131
+ }
132
+ }
133
+ blur() {
134
+ if (this.element) {
135
+ this.element.blur();
136
+ this.element.tabIndex = -1;
137
+ this.element.classList.remove('focused');
138
+ }
139
+ }
140
+ setFocusable(focusable) {
141
+ if (this.element) {
142
+ this.element.tabIndex = focusable ? 0 : -1;
143
+ }
144
+ }
145
+ get trapsArrowNavigation() {
146
+ return false;
147
+ }
148
+ updateEnabled() {
149
+ // implement in subclass
150
+ }
151
+ updateLabel() {
152
+ // implement in subclass
153
+ }
154
+ getClass() {
155
+ return this.action.class;
156
+ }
157
+ getTooltip() {
158
+ return this.action.tooltip;
159
+ }
160
+ updateTooltip() {
161
+ if (!this.element) {
162
+ return;
163
+ }
164
+ const title = this.getTooltip() ?? '';
165
+ this.updateAriaLabel();
166
+ if (this.options.hoverDelegate?.showNativeHover) {
167
+ /* While custom hover is not inside custom hover */
168
+ this.element.title = title;
169
+ }
170
+ else {
171
+ if (!this.customHover && title !== '') {
172
+ const hoverDelegate = this.options.hoverDelegate ?? getDefaultHoverDelegate('element');
173
+ this.customHover = this._store.add(getBaseLayerHoverDelegate().setupManagedHover(hoverDelegate, this.element, title));
174
+ }
175
+ else if (this.customHover) {
176
+ this.customHover.update(title);
177
+ }
178
+ }
179
+ }
180
+ updateAriaLabel() {
181
+ if (this.element) {
182
+ const title = this.getTooltip() ?? '';
183
+ this.element.setAttribute('aria-label', title);
184
+ }
185
+ }
186
+ updateClass() {
187
+ // implement in subclass
188
+ }
189
+ updateChecked() {
190
+ // implement in subclass
191
+ }
192
+ dispose() {
193
+ if (this.element) {
194
+ this.element.remove();
195
+ this.element = undefined;
196
+ }
197
+ this._context = undefined;
198
+ super.dispose();
199
+ }
200
+ }
201
+ export class ActionViewItem extends BaseActionViewItem {
202
+ constructor(context, action, options) {
203
+ super(context, action, options);
204
+ this.options = options;
205
+ this.options.icon = options.icon !== undefined ? options.icon : false;
206
+ this.options.label = options.label !== undefined ? options.label : true;
207
+ this.cssClass = '';
208
+ }
209
+ render(container) {
210
+ super.render(container);
211
+ types.assertType(this.element);
212
+ const label = document.createElement('a');
213
+ label.classList.add('action-label');
214
+ label.setAttribute('role', this.getDefaultAriaRole());
215
+ this.label = label;
216
+ this.element.appendChild(label);
217
+ if (this.options.label && this.options.keybinding) {
218
+ const kbLabel = document.createElement('span');
219
+ kbLabel.classList.add('keybinding');
220
+ kbLabel.textContent = this.options.keybinding;
221
+ this.element.appendChild(kbLabel);
222
+ }
223
+ this.updateClass();
224
+ this.updateLabel();
225
+ this.updateTooltip();
226
+ this.updateEnabled();
227
+ this.updateChecked();
228
+ }
229
+ getDefaultAriaRole() {
230
+ if (this._action.id === Separator.ID) {
231
+ return 'presentation'; // A separator is a presentation item
232
+ }
233
+ else {
234
+ if (this.options.isMenu) {
235
+ return 'menuitem';
236
+ }
237
+ else if (this.options.isTabList) {
238
+ return 'tab';
239
+ }
240
+ else {
241
+ return 'button';
242
+ }
243
+ }
244
+ }
245
+ // Only set the tabIndex on the element once it is about to get focused
246
+ // That way this element wont be a tab stop when it is not needed #106441
247
+ focus() {
248
+ if (this.label) {
249
+ this.label.tabIndex = 0;
250
+ this.label.focus();
251
+ }
252
+ }
253
+ blur() {
254
+ if (this.label) {
255
+ this.label.tabIndex = -1;
256
+ }
257
+ }
258
+ setFocusable(focusable) {
259
+ if (this.label) {
260
+ this.label.tabIndex = focusable ? 0 : -1;
261
+ }
262
+ }
263
+ updateLabel() {
264
+ if (this.options.label && this.label) {
265
+ this.label.textContent = this.action.label;
266
+ }
267
+ }
268
+ getTooltip() {
269
+ let title = null;
270
+ if (this.action.tooltip) {
271
+ title = this.action.tooltip;
272
+ }
273
+ else if (!this.options.label && this.action.label && this.options.icon) {
274
+ title = this.action.label;
275
+ if (this.options.keybinding) {
276
+ title = nls.localize({ key: 'titleLabel', comment: ['action title', 'action keybinding'] }, "{0} ({1})", title, this.options.keybinding);
277
+ }
278
+ }
279
+ return title ?? undefined;
280
+ }
281
+ updateClass() {
282
+ if (this.cssClass && this.label) {
283
+ this.label.classList.remove(...this.cssClass.split(' '));
284
+ }
285
+ if (this.options.icon) {
286
+ this.cssClass = this.getClass();
287
+ if (this.label) {
288
+ this.label.classList.add('codicon');
289
+ if (this.cssClass) {
290
+ this.label.classList.add(...this.cssClass.split(' '));
291
+ }
292
+ }
293
+ this.updateEnabled();
294
+ }
295
+ else {
296
+ this.label?.classList.remove('codicon');
297
+ }
298
+ }
299
+ updateEnabled() {
300
+ if (this.action.enabled) {
301
+ if (this.label) {
302
+ this.label.removeAttribute('aria-disabled');
303
+ this.label.classList.remove('disabled');
304
+ }
305
+ this.element?.classList.remove('disabled');
306
+ }
307
+ else {
308
+ if (this.label) {
309
+ this.label.setAttribute('aria-disabled', 'true');
310
+ this.label.classList.add('disabled');
311
+ }
312
+ this.element?.classList.add('disabled');
313
+ }
314
+ }
315
+ updateAriaLabel() {
316
+ if (this.label) {
317
+ const title = this.getTooltip() ?? '';
318
+ this.label.setAttribute('aria-label', title);
319
+ }
320
+ }
321
+ updateChecked() {
322
+ if (this.label) {
323
+ if (this.action.checked !== undefined) {
324
+ this.label.classList.toggle('checked', this.action.checked);
325
+ if (this.options.isTabList) {
326
+ this.label.setAttribute('aria-selected', this.action.checked ? 'true' : 'false');
327
+ }
328
+ else {
329
+ this.label.setAttribute('aria-checked', this.action.checked ? 'true' : 'false');
330
+ this.label.setAttribute('role', 'checkbox');
331
+ }
332
+ }
333
+ else {
334
+ this.label.classList.remove('checked');
335
+ this.label.removeAttribute(this.options.isTabList ? 'aria-selected' : 'aria-checked');
336
+ this.label.setAttribute('role', this.getDefaultAriaRole());
337
+ }
338
+ }
339
+ }
340
+ }
341
+ export class SelectActionViewItem extends BaseActionViewItem {
342
+ constructor(ctx, action, options, selected, contextViewProvider, styles, selectBoxOptions) {
343
+ super(ctx, action);
344
+ this.selectBox = new SelectBox(options, selected, contextViewProvider, styles, selectBoxOptions);
345
+ this.selectBox.setFocusable(false);
346
+ this._register(this.selectBox);
347
+ this.registerListeners();
348
+ }
349
+ select(index) {
350
+ this.selectBox.select(index);
351
+ }
352
+ registerListeners() {
353
+ this._register(this.selectBox.onDidSelect(e => this.runAction(e.selected, e.index)));
354
+ }
355
+ runAction(option, index) {
356
+ this.actionRunner.run(this._action, this.getActionContext(option, index));
357
+ }
358
+ getActionContext(option, index) {
359
+ return option;
360
+ }
361
+ setFocusable(focusable) {
362
+ this.selectBox.setFocusable(focusable);
363
+ }
364
+ focus() {
365
+ this.selectBox?.focus();
366
+ }
367
+ blur() {
368
+ this.selectBox?.blur();
369
+ }
370
+ render(container) {
371
+ this.selectBox.render(container);
372
+ }
373
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .monaco-action-bar {
7
+ white-space: nowrap;
8
+ height: 100%;
9
+ }
10
+
11
+ .monaco-action-bar .actions-container {
12
+ display: flex;
13
+ margin: 0 auto;
14
+ padding: 0;
15
+ height: 100%;
16
+ width: 100%;
17
+ align-items: center;
18
+ }
19
+
20
+ .monaco-action-bar.vertical .actions-container {
21
+ display: inline-block;
22
+ }
23
+
24
+ .monaco-action-bar .action-item {
25
+ display: block;
26
+ align-items: center;
27
+ justify-content: center;
28
+ cursor: pointer;
29
+ position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
30
+ }
31
+
32
+ .monaco-action-bar .action-item.disabled {
33
+ cursor: default;
34
+ }
35
+
36
+ .monaco-action-bar .action-item .icon,
37
+ .monaco-action-bar .action-item .codicon {
38
+ display: block;
39
+ }
40
+
41
+ .monaco-action-bar .action-item .codicon {
42
+ display: flex;
43
+ align-items: center;
44
+ width: 16px;
45
+ height: 16px;
46
+ }
47
+
48
+ .monaco-action-bar .action-label {
49
+ display: flex;
50
+ font-size: 11px;
51
+ padding: 3px;
52
+ border-radius: 5px;
53
+ }
54
+
55
+ .monaco-action-bar .action-item.disabled .action-label,
56
+ .monaco-action-bar .action-item.disabled .action-label::before,
57
+ .monaco-action-bar .action-item.disabled .action-label:hover {
58
+ color: var(--vscode-disabledForeground);
59
+ }
60
+
61
+ /* Vertical actions */
62
+
63
+ .monaco-action-bar.vertical {
64
+ text-align: left;
65
+ }
66
+
67
+ .monaco-action-bar.vertical .action-item {
68
+ display: block;
69
+ }
70
+
71
+ .monaco-action-bar.vertical .action-label.separator {
72
+ display: block;
73
+ border-bottom: 1px solid #bbb;
74
+ padding-top: 1px;
75
+ margin-left: .8em;
76
+ margin-right: .8em;
77
+ }
78
+
79
+ .monaco-action-bar .action-item .action-label.separator {
80
+ width: 1px;
81
+ height: 16px;
82
+ margin: 5px 4px !important;
83
+ cursor: default;
84
+ min-width: 1px;
85
+ padding: 0;
86
+ background-color: #bbb;
87
+ }
88
+
89
+ .secondary-actions .monaco-action-bar .action-label {
90
+ margin-left: 6px;
91
+ }
92
+
93
+ /* Action Items */
94
+ .monaco-action-bar .action-item.select-container {
95
+ overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */
96
+ flex: 1;
97
+ max-width: 170px;
98
+ min-width: 60px;
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ margin-right: 10px;
103
+ }
104
+
105
+ .monaco-action-bar .action-item.action-dropdown-item {
106
+ display: flex;
107
+ }
108
+
109
+ .monaco-action-bar .action-item.action-dropdown-item > .action-dropdown-item-separator {
110
+ display: flex;
111
+ align-items: center;
112
+ cursor: default;
113
+ }
114
+
115
+ .monaco-action-bar .action-item.action-dropdown-item > .action-dropdown-item-separator > div {
116
+ width: 1px;
117
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as DOM from '../../dom.js';
6
+ import { StandardKeyboardEvent } from '../../keyboardEvent.js';
7
+ import { ActionViewItem, BaseActionViewItem } from './actionViewItems.js';
8
+ import { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js';
9
+ import { ActionRunner, Separator } from '../../../common/actions.js';
10
+ import { Emitter } from '../../../common/event.js';
11
+ import { Disposable, DisposableMap, DisposableStore, dispose } from '../../../common/lifecycle.js';
12
+ import * as types from '../../../common/types.js';
13
+ import './actionbar.css';
14
+ export class ActionBar extends Disposable {
15
+ constructor(container, options = {}) {
16
+ super();
17
+ this._actionRunnerDisposables = this._register(new DisposableStore());
18
+ this.viewItemDisposables = this._register(new DisposableMap());
19
+ // Trigger Key Tracking
20
+ this.triggerKeyDown = false;
21
+ this.focusable = true;
22
+ this._onDidBlur = this._register(new Emitter());
23
+ this.onDidBlur = this._onDidBlur.event;
24
+ this._onDidCancel = this._register(new Emitter({ onWillAddFirstListener: () => this.cancelHasListener = true }));
25
+ this.onDidCancel = this._onDidCancel.event;
26
+ this.cancelHasListener = false;
27
+ this._onDidRun = this._register(new Emitter());
28
+ this.onDidRun = this._onDidRun.event;
29
+ this._onWillRun = this._register(new Emitter());
30
+ this.onWillRun = this._onWillRun.event;
31
+ this.options = options;
32
+ this._context = options.context ?? null;
33
+ this._orientation = this.options.orientation ?? 0 /* ActionsOrientation.HORIZONTAL */;
34
+ this._triggerKeys = {
35
+ keyDown: this.options.triggerKeys?.keyDown ?? false,
36
+ keys: this.options.triggerKeys?.keys ?? [3 /* KeyCode.Enter */, 10 /* KeyCode.Space */]
37
+ };
38
+ this._hoverDelegate = options.hoverDelegate ?? this._register(createInstantHoverDelegate());
39
+ if (this.options.actionRunner) {
40
+ this._actionRunner = this.options.actionRunner;
41
+ }
42
+ else {
43
+ this._actionRunner = new ActionRunner();
44
+ this._actionRunnerDisposables.add(this._actionRunner);
45
+ }
46
+ this._actionRunnerDisposables.add(this._actionRunner.onDidRun(e => this._onDidRun.fire(e)));
47
+ this._actionRunnerDisposables.add(this._actionRunner.onWillRun(e => this._onWillRun.fire(e)));
48
+ this.viewItems = [];
49
+ this.focusedItem = undefined;
50
+ this.domNode = document.createElement('div');
51
+ this.domNode.className = 'monaco-action-bar';
52
+ let previousKeys;
53
+ let nextKeys;
54
+ switch (this._orientation) {
55
+ case 0 /* ActionsOrientation.HORIZONTAL */:
56
+ previousKeys = [15 /* KeyCode.LeftArrow */];
57
+ nextKeys = [17 /* KeyCode.RightArrow */];
58
+ break;
59
+ case 1 /* ActionsOrientation.VERTICAL */:
60
+ previousKeys = [16 /* KeyCode.UpArrow */];
61
+ nextKeys = [18 /* KeyCode.DownArrow */];
62
+ this.domNode.className += ' vertical';
63
+ break;
64
+ }
65
+ this._register(DOM.addDisposableListener(this.domNode, DOM.EventType.KEY_DOWN, e => {
66
+ const event = new StandardKeyboardEvent(e);
67
+ let eventHandled = true;
68
+ const focusedItem = typeof this.focusedItem === 'number' ? this.viewItems[this.focusedItem] : undefined;
69
+ if (previousKeys && (event.equals(previousKeys[0]) || event.equals(previousKeys[1]))) {
70
+ eventHandled = this.focusPrevious();
71
+ }
72
+ else if (nextKeys && (event.equals(nextKeys[0]) || event.equals(nextKeys[1]))) {
73
+ eventHandled = this.focusNext();
74
+ }
75
+ else if (event.equals(9 /* KeyCode.Escape */) && this.cancelHasListener) {
76
+ this._onDidCancel.fire();
77
+ }
78
+ else if (event.equals(14 /* KeyCode.Home */)) {
79
+ eventHandled = this.focusFirst();
80
+ }
81
+ else if (event.equals(13 /* KeyCode.End */)) {
82
+ eventHandled = this.focusLast();
83
+ }
84
+ else if (event.equals(2 /* KeyCode.Tab */) && focusedItem instanceof BaseActionViewItem && focusedItem.trapsArrowNavigation) {
85
+ // Tab, so forcibly focus next #219199
86
+ eventHandled = this.focusNext(undefined, true);
87
+ }
88
+ else if (this.isTriggerKeyEvent(event)) {
89
+ // Staying out of the else branch even if not triggered
90
+ if (this._triggerKeys.keyDown) {
91
+ this.doTrigger(event);
92
+ }
93
+ else {
94
+ this.triggerKeyDown = true;
95
+ }
96
+ }
97
+ else {
98
+ eventHandled = false;
99
+ }
100
+ if (eventHandled) {
101
+ event.preventDefault();
102
+ event.stopPropagation();
103
+ }
104
+ }));
105
+ this._register(DOM.addDisposableListener(this.domNode, DOM.EventType.KEY_UP, e => {
106
+ const event = new StandardKeyboardEvent(e);
107
+ // Run action on Enter/Space
108
+ if (this.isTriggerKeyEvent(event)) {
109
+ if (!this._triggerKeys.keyDown && this.triggerKeyDown) {
110
+ this.triggerKeyDown = false;
111
+ this.doTrigger(event);
112
+ }
113
+ event.preventDefault();
114
+ event.stopPropagation();
115
+ }
116
+ // Recompute focused item
117
+ else if (event.equals(2 /* KeyCode.Tab */) || event.equals(1024 /* KeyMod.Shift */ | 2 /* KeyCode.Tab */) || event.equals(16 /* KeyCode.UpArrow */) || event.equals(18 /* KeyCode.DownArrow */) || event.equals(15 /* KeyCode.LeftArrow */) || event.equals(17 /* KeyCode.RightArrow */)) {
118
+ this.updateFocusedItem();
119
+ }
120
+ }));
121
+ this.focusTracker = this._register(DOM.trackFocus(this.domNode));
122
+ this._register(this.focusTracker.onDidBlur(() => {
123
+ if (DOM.getActiveElement() === this.domNode || !DOM.isAncestor(DOM.getActiveElement(), this.domNode)) {
124
+ this._onDidBlur.fire();
125
+ this.previouslyFocusedItem = this.focusedItem;
126
+ this.focusedItem = undefined;
127
+ this.triggerKeyDown = false;
128
+ }
129
+ }));
130
+ this._register(this.focusTracker.onDidFocus(() => this.updateFocusedItem()));
131
+ this.actionsList = document.createElement('ul');
132
+ this.actionsList.className = 'actions-container';
133
+ if (this.options.highlightToggledItems) {
134
+ this.actionsList.classList.add('highlight-toggled');
135
+ }
136
+ this.actionsList.setAttribute('role', this.options.ariaRole || 'toolbar');
137
+ if (this.options.ariaLabel) {
138
+ this.actionsList.setAttribute('aria-label', this.options.ariaLabel);
139
+ }
140
+ this.domNode.appendChild(this.actionsList);
141
+ container.appendChild(this.domNode);
142
+ }
143
+ refreshRole() {
144
+ if (this.length() >= 1) {
145
+ this.actionsList.setAttribute('role', this.options.ariaRole || 'toolbar');
146
+ }
147
+ else {
148
+ this.actionsList.setAttribute('role', 'presentation');
149
+ }
150
+ }
151
+ // Some action bars should not be focusable at times
152
+ // When an action bar is not focusable make sure to make all the elements inside it not focusable
153
+ // When an action bar is focusable again, make sure the first item can be focused
154
+ setFocusable(focusable) {
155
+ this.focusable = focusable;
156
+ if (this.focusable) {
157
+ const firstEnabled = this.viewItems.find(vi => vi instanceof BaseActionViewItem && vi.isEnabled());
158
+ if (firstEnabled instanceof BaseActionViewItem) {
159
+ firstEnabled.setFocusable(true);
160
+ }
161
+ }
162
+ else {
163
+ this.viewItems.forEach(vi => {
164
+ if (vi instanceof BaseActionViewItem) {
165
+ vi.setFocusable(false);
166
+ }
167
+ });
168
+ }
169
+ }
170
+ isTriggerKeyEvent(event) {
171
+ let ret = false;
172
+ this._triggerKeys.keys.forEach(keyCode => {
173
+ ret = ret || event.equals(keyCode);
174
+ });
175
+ return ret;
176
+ }
177
+ updateFocusedItem() {
178
+ for (let i = 0; i < this.actionsList.children.length; i++) {
179
+ const elem = this.actionsList.children[i];
180
+ if (DOM.isAncestor(DOM.getActiveElement(), elem)) {
181
+ this.focusedItem = i;
182
+ this.viewItems[this.focusedItem]?.showHover?.();
183
+ break;
184
+ }
185
+ }
186
+ }
187
+ get context() {
188
+ return this._context;
189
+ }
190
+ set context(context) {
191
+ this._context = context;
192
+ this.viewItems.forEach(i => i.setActionContext(context));
193
+ }
194
+ get actionRunner() {
195
+ return this._actionRunner;
196
+ }
197
+ set actionRunner(actionRunner) {
198
+ this._actionRunner = actionRunner;
199
+ // when setting a new `IActionRunner` make sure to dispose old listeners and
200
+ // start to forward events from the new listener
201
+ this._actionRunnerDisposables.clear();
202
+ this._actionRunnerDisposables.add(this._actionRunner.onDidRun(e => this._onDidRun.fire(e)));
203
+ this._actionRunnerDisposables.add(this._actionRunner.onWillRun(e => this._onWillRun.fire(e)));
204
+ this.viewItems.forEach(item => item.actionRunner = actionRunner);
205
+ }
206
+ getContainer() {
207
+ return this.domNode;
208
+ }
209
+ getAction(indexOrElement) {
210
+ // by index
211
+ if (typeof indexOrElement === 'number') {
212
+ return this.viewItems[indexOrElement]?.action;
213
+ }
214
+ // by element
215
+ if (DOM.isHTMLElement(indexOrElement)) {
216
+ while (indexOrElement.parentElement !== this.actionsList) {
217
+ if (!indexOrElement.parentElement) {
218
+ return undefined;
219
+ }
220
+ indexOrElement = indexOrElement.parentElement;
221
+ }
222
+ for (let i = 0; i < this.actionsList.childNodes.length; i++) {
223
+ if (this.actionsList.childNodes[i] === indexOrElement) {
224
+ return this.viewItems[i].action;
225
+ }
226
+ }
227
+ }
228
+ return undefined;
229
+ }
230
+ push(arg, options = {}) {
231
+ const actions = Array.isArray(arg) ? arg : [arg];
232
+ let index = types.isNumber(options.index) ? options.index : null;
233
+ actions.forEach((action) => {
234
+ const actionViewItemElement = document.createElement('li');
235
+ actionViewItemElement.className = 'action-item';
236
+ actionViewItemElement.setAttribute('role', 'presentation');
237
+ let item;
238
+ const viewItemOptions = { hoverDelegate: this._hoverDelegate, ...options, isTabList: this.options.ariaRole === 'tablist' };
239
+ if (this.options.actionViewItemProvider) {
240
+ item = this.options.actionViewItemProvider(action, viewItemOptions);
241
+ }
242
+ if (!item) {
243
+ item = new ActionViewItem(this.context, action, viewItemOptions);
244
+ }
245
+ // Prevent native context menu on actions
246
+ if (!this.options.allowContextMenu) {
247
+ this.viewItemDisposables.set(item, DOM.addDisposableListener(actionViewItemElement, DOM.EventType.CONTEXT_MENU, (e) => {
248
+ DOM.EventHelper.stop(e, true);
249
+ }));
250
+ }
251
+ item.actionRunner = this._actionRunner;
252
+ item.setActionContext(this.context);
253
+ item.render(actionViewItemElement);
254
+ if (this.focusable && item instanceof BaseActionViewItem && this.viewItems.length === 0) {
255
+ // We need to allow for the first enabled item to be focused on using tab navigation #106441
256
+ item.setFocusable(true);
257
+ }
258
+ if (index === null || index < 0 || index >= this.actionsList.children.length) {
259
+ this.actionsList.appendChild(actionViewItemElement);
260
+ this.viewItems.push(item);
261
+ }
262
+ else {
263
+ this.actionsList.insertBefore(actionViewItemElement, this.actionsList.children[index]);
264
+ this.viewItems.splice(index, 0, item);
265
+ index++;
266
+ }
267
+ });
268
+ if (typeof this.focusedItem === 'number') {
269
+ // After a clear actions might be re-added to simply toggle some actions. We should preserve focus #97128
270
+ this.focus(this.focusedItem);
271
+ }
272
+ this.refreshRole();
273
+ }
274
+ clear() {
275
+ if (this.isEmpty()) {
276
+ return;
277
+ }
278
+ this.viewItems = dispose(this.viewItems);
279
+ this.viewItemDisposables.clearAndDisposeAll();
280
+ DOM.clearNode(this.actionsList);
281
+ this.refreshRole();
282
+ }
283
+ length() {
284
+ return this.viewItems.length;
285
+ }
286
+ isEmpty() {
287
+ return this.viewItems.length === 0;
288
+ }
289
+ focus(arg) {
290
+ let selectFirst = false;
291
+ let index = undefined;
292
+ if (arg === undefined) {
293
+ selectFirst = true;
294
+ }
295
+ else if (typeof arg === 'number') {
296
+ index = arg;
297
+ }
298
+ else if (typeof arg === 'boolean') {
299
+ selectFirst = arg;
300
+ }
301
+ if (selectFirst && typeof this.focusedItem === 'undefined') {
302
+ const firstEnabled = this.viewItems.findIndex(item => item.isEnabled());
303
+ // Focus the first enabled item
304
+ this.focusedItem = firstEnabled === -1 ? undefined : firstEnabled;
305
+ this.updateFocus(undefined, undefined, true);
306
+ }
307
+ else {
308
+ if (index !== undefined) {
309
+ this.focusedItem = index;
310
+ }
311
+ this.updateFocus(undefined, undefined, true);
312
+ }
313
+ }
314
+ focusFirst() {
315
+ this.focusedItem = this.length() - 1;
316
+ return this.focusNext(true);
317
+ }
318
+ focusLast() {
319
+ this.focusedItem = 0;
320
+ return this.focusPrevious(true);
321
+ }
322
+ focusNext(forceLoop, forceFocus) {
323
+ if (typeof this.focusedItem === 'undefined') {
324
+ this.focusedItem = this.viewItems.length - 1;
325
+ }
326
+ else if (this.viewItems.length <= 1) {
327
+ return false;
328
+ }
329
+ const startIndex = this.focusedItem;
330
+ let item;
331
+ do {
332
+ if (!forceLoop && this.options.preventLoopNavigation && this.focusedItem + 1 >= this.viewItems.length) {
333
+ this.focusedItem = startIndex;
334
+ return false;
335
+ }
336
+ this.focusedItem = (this.focusedItem + 1) % this.viewItems.length;
337
+ item = this.viewItems[this.focusedItem];
338
+ } while (this.focusedItem !== startIndex && ((this.options.focusOnlyEnabledItems && !item.isEnabled()) || item.action.id === Separator.ID));
339
+ this.updateFocus(undefined, undefined, forceFocus);
340
+ return true;
341
+ }
342
+ focusPrevious(forceLoop) {
343
+ if (typeof this.focusedItem === 'undefined') {
344
+ this.focusedItem = 0;
345
+ }
346
+ else if (this.viewItems.length <= 1) {
347
+ return false;
348
+ }
349
+ const startIndex = this.focusedItem;
350
+ let item;
351
+ do {
352
+ this.focusedItem = this.focusedItem - 1;
353
+ if (this.focusedItem < 0) {
354
+ if (!forceLoop && this.options.preventLoopNavigation) {
355
+ this.focusedItem = startIndex;
356
+ return false;
357
+ }
358
+ this.focusedItem = this.viewItems.length - 1;
359
+ }
360
+ item = this.viewItems[this.focusedItem];
361
+ } while (this.focusedItem !== startIndex && ((this.options.focusOnlyEnabledItems && !item.isEnabled()) || item.action.id === Separator.ID));
362
+ this.updateFocus(true);
363
+ return true;
364
+ }
365
+ updateFocus(fromRight, preventScroll, forceFocus = false) {
366
+ if (typeof this.focusedItem === 'undefined') {
367
+ this.actionsList.focus({ preventScroll });
368
+ }
369
+ if (this.previouslyFocusedItem !== undefined && this.previouslyFocusedItem !== this.focusedItem) {
370
+ this.viewItems[this.previouslyFocusedItem]?.blur();
371
+ }
372
+ const actionViewItem = this.focusedItem !== undefined ? this.viewItems[this.focusedItem] : undefined;
373
+ if (actionViewItem) {
374
+ let focusItem = true;
375
+ if (!types.isFunction(actionViewItem.focus)) {
376
+ focusItem = false;
377
+ }
378
+ if (this.options.focusOnlyEnabledItems && types.isFunction(actionViewItem.isEnabled) && !actionViewItem.isEnabled()) {
379
+ focusItem = false;
380
+ }
381
+ if (actionViewItem.action.id === Separator.ID) {
382
+ focusItem = false;
383
+ }
384
+ if (!focusItem) {
385
+ this.actionsList.focus({ preventScroll });
386
+ this.previouslyFocusedItem = undefined;
387
+ }
388
+ else if (forceFocus || this.previouslyFocusedItem !== this.focusedItem) {
389
+ actionViewItem.focus(fromRight);
390
+ this.previouslyFocusedItem = this.focusedItem;
391
+ }
392
+ if (focusItem) {
393
+ actionViewItem.showHover?.();
394
+ }
395
+ }
396
+ }
397
+ doTrigger(event) {
398
+ if (typeof this.focusedItem === 'undefined') {
399
+ return; //nothing to focus
400
+ }
401
+ // trigger action
402
+ const actionViewItem = this.viewItems[this.focusedItem];
403
+ if (actionViewItem instanceof BaseActionViewItem) {
404
+ const context = (actionViewItem._context === null || actionViewItem._context === undefined) ? event : actionViewItem._context;
405
+ this.run(actionViewItem._action, context);
406
+ }
407
+ }
408
+ async run(action, context) {
409
+ await this._actionRunner.run(action, context);
410
+ }
411
+ dispose() {
412
+ this._context = undefined;
413
+ this.viewItems = dispose(this.viewItems);
414
+ this.getContainer().remove();
415
+ super.dispose();
416
+ }
417
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .monaco-aria-container {
7
+ position: absolute; /* try to hide from window but not from screen readers */
8
+ left:-999em;
9
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as dom from '../../dom.js';
6
+ import './aria.css';
7
+ // Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages #94233
8
+ const MAX_MESSAGE_LENGTH = 20000;
9
+ let ariaContainer;
10
+ let alertContainer;
11
+ let alertContainer2;
12
+ let statusContainer;
13
+ let statusContainer2;
14
+ export function setARIAContainer(parent) {
15
+ ariaContainer = document.createElement('div');
16
+ ariaContainer.className = 'monaco-aria-container';
17
+ const createAlertContainer = () => {
18
+ const element = document.createElement('div');
19
+ element.className = 'monaco-alert';
20
+ element.setAttribute('role', 'alert');
21
+ element.setAttribute('aria-atomic', 'true');
22
+ ariaContainer.appendChild(element);
23
+ return element;
24
+ };
25
+ alertContainer = createAlertContainer();
26
+ alertContainer2 = createAlertContainer();
27
+ const createStatusContainer = () => {
28
+ const element = document.createElement('div');
29
+ element.className = 'monaco-status';
30
+ element.setAttribute('aria-live', 'polite');
31
+ element.setAttribute('aria-atomic', 'true');
32
+ ariaContainer.appendChild(element);
33
+ return element;
34
+ };
35
+ statusContainer = createStatusContainer();
36
+ statusContainer2 = createStatusContainer();
37
+ parent.appendChild(ariaContainer);
38
+ }
39
+ /**
40
+ * Given the provided message, will make sure that it is read as alert to screen readers.
41
+ */
42
+ export function alert(msg) {
43
+ if (!ariaContainer) {
44
+ return;
45
+ }
46
+ // Use alternate containers such that duplicated messages get read out by screen readers #99466
47
+ if (alertContainer.textContent !== msg) {
48
+ dom.clearNode(alertContainer2);
49
+ insertMessage(alertContainer, msg);
50
+ }
51
+ else {
52
+ dom.clearNode(alertContainer);
53
+ insertMessage(alertContainer2, msg);
54
+ }
55
+ }
56
+ /**
57
+ * Given the provided message, will make sure that it is read as status to screen readers.
58
+ */
59
+ export function status(msg) {
60
+ if (!ariaContainer) {
61
+ return;
62
+ }
63
+ if (statusContainer.textContent !== msg) {
64
+ dom.clearNode(statusContainer2);
65
+ insertMessage(statusContainer, msg);
66
+ }
67
+ else {
68
+ dom.clearNode(statusContainer);
69
+ insertMessage(statusContainer2, msg);
70
+ }
71
+ }
72
+ function insertMessage(target, msg) {
73
+ dom.clearNode(target);
74
+ if (msg.length > MAX_MESSAGE_LENGTH) {
75
+ msg = msg.substr(0, MAX_MESSAGE_LENGTH);
76
+ }
77
+ target.textContent = msg;
78
+ // See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/
79
+ target.style.visibility = 'hidden';
80
+ target.style.visibility = 'visible';
81
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .monaco-breadcrumbs {
7
+ user-select: none;
8
+ -webkit-user-select: none;
9
+ display: flex;
10
+ flex-direction: row;
11
+ flex-wrap: nowrap;
12
+ justify-content: flex-start;
13
+ outline-style: none;
14
+ }
15
+
16
+ .monaco-breadcrumbs .monaco-breadcrumb-item {
17
+ display: flex;
18
+ align-items: center;
19
+ flex: 0 1 auto;
20
+ white-space: nowrap;
21
+ cursor: pointer;
22
+ align-self: center;
23
+ height: 100%;
24
+ outline: none;
25
+ }
26
+ .monaco-breadcrumbs.disabled .monaco-breadcrumb-item {
27
+ cursor: default;
28
+ }
29
+
30
+ .monaco-breadcrumbs .monaco-breadcrumb-item .codicon-breadcrumb-separator {
31
+ color: inherit;
32
+ }
33
+
34
+ .monaco-breadcrumbs .monaco-breadcrumb-item:first-of-type::before {
35
+ content: ' ';
36
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import './breadcrumbsWidget.css';
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .monaco-text-button {
7
+ box-sizing: border-box;
8
+ display: flex;
9
+ width: 100%;
10
+ padding: 4px;
11
+ border-radius: 2px;
12
+ text-align: center;
13
+ cursor: pointer;
14
+ justify-content: center;
15
+ align-items: center;
16
+ border: 1px solid var(--vscode-button-border, transparent);
17
+ line-height: 18px;
18
+ }
19
+
20
+ .monaco-text-button:focus {
21
+ outline-offset: 2px !important;
22
+ }
23
+
24
+ .monaco-text-button:hover {
25
+ text-decoration: none !important;
26
+ }
27
+
28
+ .monaco-button.disabled:focus,
29
+ .monaco-button.disabled {
30
+ opacity: 0.4 !important;
31
+ cursor: default;
32
+ }
33
+
34
+ .monaco-text-button .codicon {
35
+ margin: 0 0.2em;
36
+ color: inherit !important;
37
+ }
38
+
39
+ .monaco-text-button.monaco-text-button-with-short-label {
40
+ flex-direction: row;
41
+ flex-wrap: wrap;
42
+ padding: 0 4px;
43
+ overflow: hidden;
44
+ height: 28px;
45
+ }
46
+
47
+ .monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label {
48
+ flex-basis: 100%;
49
+ }
50
+
51
+ .monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label-short {
52
+ flex-grow: 1;
53
+ width: 0;
54
+ overflow: hidden;
55
+ }
56
+
57
+ .monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label,
58
+ .monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label-short {
59
+ display: flex;
60
+ justify-content: center;
61
+ align-items: center;
62
+ font-weight: normal;
63
+ font-style: inherit;
64
+ padding: 4px 0;
65
+ }
66
+
67
+ .monaco-button-dropdown {
68
+ display: flex;
69
+ cursor: pointer;
70
+ }
71
+
72
+ .monaco-button-dropdown.disabled {
73
+ cursor: default;
74
+ }
75
+
76
+ .monaco-button-dropdown > .monaco-button:focus {
77
+ outline-offset: -1px !important;
78
+ }
79
+
80
+ .monaco-button-dropdown.disabled > .monaco-button.disabled,
81
+ .monaco-button-dropdown.disabled > .monaco-button.disabled:focus,
82
+ .monaco-button-dropdown.disabled > .monaco-button-dropdown-separator {
83
+ opacity: 0.4 !important;
84
+ }
85
+
86
+ .monaco-button-dropdown > .monaco-button.monaco-text-button {
87
+ border-right-width: 0 !important;
88
+ }
89
+
90
+ .monaco-button-dropdown .monaco-button-dropdown-separator {
91
+ padding: 4px 0;
92
+ cursor: default;
93
+ }
94
+
95
+ .monaco-button-dropdown .monaco-button-dropdown-separator > div {
96
+ height: 100%;
97
+ width: 1px;
98
+ }
99
+
100
+ .monaco-button-dropdown > .monaco-button.monaco-dropdown-button {
101
+ border: 1px solid var(--vscode-button-border, transparent);
102
+ border-left-width: 0 !important;
103
+ border-radius: 0 2px 2px 0;
104
+ display: flex;
105
+ align-items: center;
106
+ }
107
+
108
+ .monaco-button-dropdown > .monaco-button.monaco-text-button {
109
+ border-radius: 2px 0 0 2px;
110
+ }
111
+
112
+ .monaco-description-button {
113
+ display: flex;
114
+ flex-direction: column;
115
+ align-items: center;
116
+ margin: 4px 5px; /* allows button focus outline to be visible */
117
+ }
118
+
119
+ .monaco-description-button .monaco-button-description {
120
+ font-style: italic;
121
+ font-size: 11px;
122
+ padding: 4px 20px;
123
+ }
124
+
125
+ .monaco-description-button .monaco-button-label,
126
+ .monaco-description-button .monaco-button-description {
127
+ display: flex;
128
+ justify-content: center;
129
+ align-items: center;
130
+ }
131
+
132
+ .monaco-description-button .monaco-button-label > .codicon,
133
+ .monaco-description-button .monaco-button-description > .codicon {
134
+ margin: 0 0.2em;
135
+ color: inherit !important;
136
+ }
137
+
138
+ /* default color styles - based on CSS variables */
139
+
140
+ .monaco-button.default-colors,
141
+ .monaco-button-dropdown.default-colors > .monaco-button{
142
+ color: var(--vscode-button-foreground);
143
+ background-color: var(--vscode-button-background);
144
+ }
145
+
146
+ .monaco-button.default-colors:hover,
147
+ .monaco-button-dropdown.default-colors > .monaco-button:hover {
148
+ background-color: var(--vscode-button-hoverBackground);
149
+ }
150
+
151
+ .monaco-button.default-colors.secondary,
152
+ .monaco-button-dropdown.default-colors > .monaco-button.secondary {
153
+ color: var(--vscode-button-secondaryForeground);
154
+ background-color: var(--vscode-button-secondaryBackground);
155
+ }
156
+
157
+ .monaco-button.default-colors.secondary:hover,
158
+ .monaco-button-dropdown.default-colors > .monaco-button.secondary:hover {
159
+ background-color: var(--vscode-button-secondaryHoverBackground);
160
+ }
161
+
162
+ .monaco-button-dropdown.default-colors .monaco-button-dropdown-separator {
163
+ background-color: var(--vscode-button-background);
164
+ border-top: 1px solid var(--vscode-button-border);
165
+ border-bottom: 1px solid var(--vscode-button-border);
166
+ }
167
+
168
+ .monaco-button-dropdown.default-colors .monaco-button.secondary + .monaco-button-dropdown-separator {
169
+ background-color: var(--vscode-button-secondaryBackground);
170
+ }
171
+
172
+ .monaco-button-dropdown.default-colors .monaco-button-dropdown-separator > div {
173
+ background-color: var(--vscode-button-separator);
174
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { addDisposableListener, EventHelper, EventType, reset, trackFocus } from '../../dom.js';
2
+ import { sanitize } from '../../dompurify/dompurify.js';
3
+ import { StandardKeyboardEvent } from '../../keyboardEvent.js';
4
+ import { renderMarkdown, renderStringAsPlaintext } from '../../markdownRenderer.js';
5
+ import { Gesture, EventType as TouchEventType } from '../../touch.js';
6
+ import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
7
+ import { renderLabelWithIcons } from '../iconLabel/iconLabels.js';
8
+ import { Color } from '../../../common/color.js';
9
+ import { Emitter } from '../../../common/event.js';
10
+ import { isMarkdownString, markdownStringEqual } from '../../../common/htmlContent.js';
11
+ import { Disposable } from '../../../common/lifecycle.js';
12
+ import { ThemeIcon } from '../../../common/themables.js';
13
+ import './button.css';
14
+ import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';
15
+ export const unthemedButtonStyles = {
16
+ buttonBackground: '#0E639C',
17
+ buttonHoverBackground: '#006BB3',
18
+ buttonSeparator: Color.white.toString(),
19
+ buttonForeground: Color.white.toString(),
20
+ buttonBorder: undefined,
21
+ buttonSecondaryBackground: undefined,
22
+ buttonSecondaryForeground: undefined,
23
+ buttonSecondaryHoverBackground: undefined
24
+ };
25
+ export class Button extends Disposable {
26
+ get onDidClick() { return this._onDidClick.event; }
27
+ constructor(container, options) {
28
+ super();
29
+ this._label = '';
30
+ this._onDidClick = this._register(new Emitter());
31
+ this._onDidEscape = this._register(new Emitter());
32
+ this.options = options;
33
+ this._element = document.createElement('a');
34
+ this._element.classList.add('monaco-button');
35
+ this._element.tabIndex = 0;
36
+ this._element.setAttribute('role', 'button');
37
+ this._element.classList.toggle('secondary', !!options.secondary);
38
+ const background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;
39
+ const foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;
40
+ this._element.style.color = foreground || '';
41
+ this._element.style.backgroundColor = background || '';
42
+ if (options.supportShortLabel) {
43
+ this._labelShortElement = document.createElement('div');
44
+ this._labelShortElement.classList.add('monaco-button-label-short');
45
+ this._element.appendChild(this._labelShortElement);
46
+ this._labelElement = document.createElement('div');
47
+ this._labelElement.classList.add('monaco-button-label');
48
+ this._element.appendChild(this._labelElement);
49
+ this._element.classList.add('monaco-text-button-with-short-label');
50
+ }
51
+ if (typeof options.title === 'string') {
52
+ this.setTitle(options.title);
53
+ }
54
+ if (typeof options.ariaLabel === 'string') {
55
+ this._element.setAttribute('aria-label', options.ariaLabel);
56
+ }
57
+ container.appendChild(this._element);
58
+ this._register(Gesture.addTarget(this._element));
59
+ [EventType.CLICK, TouchEventType.Tap].forEach(eventType => {
60
+ this._register(addDisposableListener(this._element, eventType, e => {
61
+ if (!this.enabled) {
62
+ EventHelper.stop(e);
63
+ return;
64
+ }
65
+ this._onDidClick.fire(e);
66
+ }));
67
+ });
68
+ this._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {
69
+ const event = new StandardKeyboardEvent(e);
70
+ let eventHandled = false;
71
+ if (this.enabled && (event.equals(3 /* KeyCode.Enter */) || event.equals(10 /* KeyCode.Space */))) {
72
+ this._onDidClick.fire(e);
73
+ eventHandled = true;
74
+ }
75
+ else if (event.equals(9 /* KeyCode.Escape */)) {
76
+ this._onDidEscape.fire(e);
77
+ this._element.blur();
78
+ eventHandled = true;
79
+ }
80
+ if (eventHandled) {
81
+ EventHelper.stop(event, true);
82
+ }
83
+ }));
84
+ this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {
85
+ if (!this._element.classList.contains('disabled')) {
86
+ this.updateBackground(true);
87
+ }
88
+ }));
89
+ this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {
90
+ this.updateBackground(false); // restore standard styles
91
+ }));
92
+ // Also set hover background when button is focused for feedback
93
+ this.focusTracker = this._register(trackFocus(this._element));
94
+ this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) {
95
+ this.updateBackground(true);
96
+ } }));
97
+ this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) {
98
+ this.updateBackground(false);
99
+ } }));
100
+ }
101
+ dispose() {
102
+ super.dispose();
103
+ this._element.remove();
104
+ }
105
+ getContentElements(content) {
106
+ const elements = [];
107
+ for (let segment of renderLabelWithIcons(content)) {
108
+ if (typeof (segment) === 'string') {
109
+ segment = segment.trim();
110
+ // Ignore empty segment
111
+ if (segment === '') {
112
+ continue;
113
+ }
114
+ // Convert string segments to <span> nodes
115
+ const node = document.createElement('span');
116
+ node.textContent = segment;
117
+ elements.push(node);
118
+ }
119
+ else {
120
+ elements.push(segment);
121
+ }
122
+ }
123
+ return elements;
124
+ }
125
+ updateBackground(hover) {
126
+ let background;
127
+ if (this.options.secondary) {
128
+ background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
129
+ }
130
+ else {
131
+ background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
132
+ }
133
+ if (background) {
134
+ this._element.style.backgroundColor = background;
135
+ }
136
+ }
137
+ get element() {
138
+ return this._element;
139
+ }
140
+ set label(value) {
141
+ if (this._label === value) {
142
+ return;
143
+ }
144
+ if (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) {
145
+ return;
146
+ }
147
+ this._element.classList.add('monaco-text-button');
148
+ const labelElement = this.options.supportShortLabel ? this._labelElement : this._element;
149
+ if (isMarkdownString(value)) {
150
+ const rendered = renderMarkdown(value, { inline: true });
151
+ rendered.dispose();
152
+ // Don't include outer `<p>`
153
+ const root = rendered.element.querySelector('p')?.innerHTML;
154
+ if (root) {
155
+ // Only allow a very limited set of inline html tags
156
+ const sanitized = sanitize(root, { ADD_TAGS: ['b', 'i', 'u', 'code', 'span'], ALLOWED_ATTR: ['class'], RETURN_TRUSTED_TYPE: true });
157
+ labelElement.innerHTML = sanitized;
158
+ }
159
+ else {
160
+ reset(labelElement);
161
+ }
162
+ }
163
+ else {
164
+ if (this.options.supportIcons) {
165
+ reset(labelElement, ...this.getContentElements(value));
166
+ }
167
+ else {
168
+ labelElement.textContent = value;
169
+ }
170
+ }
171
+ let title = '';
172
+ if (typeof this.options.title === 'string') {
173
+ title = this.options.title;
174
+ }
175
+ else if (this.options.title) {
176
+ title = renderStringAsPlaintext(value);
177
+ }
178
+ this.setTitle(title);
179
+ if (typeof this.options.ariaLabel === 'string') {
180
+ this._element.setAttribute('aria-label', this.options.ariaLabel);
181
+ }
182
+ else if (this.options.ariaLabel) {
183
+ this._element.setAttribute('aria-label', title);
184
+ }
185
+ this._label = value;
186
+ }
187
+ get label() {
188
+ return this._label;
189
+ }
190
+ set icon(icon) {
191
+ this._element.classList.add(...ThemeIcon.asClassNameArray(icon));
192
+ }
193
+ set enabled(value) {
194
+ if (value) {
195
+ this._element.classList.remove('disabled');
196
+ this._element.setAttribute('aria-disabled', String(false));
197
+ this._element.tabIndex = 0;
198
+ }
199
+ else {
200
+ this._element.classList.add('disabled');
201
+ this._element.setAttribute('aria-disabled', String(true));
202
+ }
203
+ }
204
+ get enabled() {
205
+ return !this._element.classList.contains('disabled');
206
+ }
207
+ setTitle(title) {
208
+ if (!this._hover && title !== '') {
209
+ this._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('mouse'), this._element, title));
210
+ }
211
+ else if (this._hover) {
212
+ this._hover.update(title);
213
+ }
214
+ }
215
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .codicon-wrench-subaction {
7
+ opacity: 0.5;
8
+ }
9
+
10
+ @keyframes codicon-spin {
11
+ 100% {
12
+ transform:rotate(360deg);
13
+ }
14
+ }
15
+
16
+ .codicon-sync.codicon-modifier-spin,
17
+ .codicon-loading.codicon-modifier-spin,
18
+ .codicon-gear.codicon-modifier-spin,
19
+ .codicon-notebook-state-executing.codicon-modifier-spin {
20
+ /* Use steps to throttle FPS to reduce CPU usage */
21
+ animation: codicon-spin 1.5s steps(30) infinite;
22
+ }
23
+
24
+ .codicon-modifier-disabled {
25
+ opacity: 0.4;
26
+ }
27
+
28
+ /* custom speed & easing for loading icon */
29
+ .codicon-loading,
30
+ .codicon-tree-item-loading::before {
31
+ animation-duration: 1s !important;
32
+ animation-timing-function: cubic-bezier(0.53, 0.21, 0.29, 0.67) !important;
33
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ @font-face {
7
+ font-family: "codicon";
8
+ font-display: block;
9
+ src: url(./codicon.ttf) format("truetype");
10
+ }
11
+
12
+ .codicon[class*='codicon-'] {
13
+ font: normal normal normal 16px/1 codicon;
14
+ display: inline-block;
15
+ text-decoration: none;
16
+ text-rendering: auto;
17
+ text-align: center;
18
+ text-transform: none;
19
+ -webkit-font-smoothing: antialiased;
20
+ -moz-osx-font-smoothing: grayscale;
21
+ user-select: none;
22
+ -webkit-user-select: none;
23
+ }
24
+
25
+ /* icon rules are dynamically created by the platform theme service (see iconsStyleSheet.ts) */
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf ADDED
Binary file (80.3 kB). View file
 
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codiconStyles.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import './codicon/codicon.css';
6
+ import './codicon/codicon-modifiers.css';
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .context-view {
7
+ position: absolute;
8
+ }
9
+
10
+ .context-view.fixed {
11
+ all: initial;
12
+ font-family: inherit;
13
+ font-size: 13px;
14
+ position: fixed;
15
+ color: inherit;
16
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { BrowserFeatures } from '../../canIUse.js';
6
+ import * as DOM from '../../dom.js';
7
+ import { Disposable, DisposableStore, toDisposable } from '../../../common/lifecycle.js';
8
+ import * as platform from '../../../common/platform.js';
9
+ import { Range } from '../../../common/range.js';
10
+ import './contextview.css';
11
+ export function isAnchor(obj) {
12
+ const anchor = obj;
13
+ return !!anchor && typeof anchor.x === 'number' && typeof anchor.y === 'number';
14
+ }
15
+ export var LayoutAnchorMode;
16
+ (function (LayoutAnchorMode) {
17
+ LayoutAnchorMode[LayoutAnchorMode["AVOID"] = 0] = "AVOID";
18
+ LayoutAnchorMode[LayoutAnchorMode["ALIGN"] = 1] = "ALIGN";
19
+ })(LayoutAnchorMode || (LayoutAnchorMode = {}));
20
+ /**
21
+ * Lays out a one dimensional view next to an anchor in a viewport.
22
+ *
23
+ * @returns The view offset within the viewport.
24
+ */
25
+ export function layout(viewportSize, viewSize, anchor) {
26
+ const layoutAfterAnchorBoundary = anchor.mode === LayoutAnchorMode.ALIGN ? anchor.offset : anchor.offset + anchor.size;
27
+ const layoutBeforeAnchorBoundary = anchor.mode === LayoutAnchorMode.ALIGN ? anchor.offset + anchor.size : anchor.offset;
28
+ if (anchor.position === 0 /* LayoutAnchorPosition.Before */) {
29
+ if (viewSize <= viewportSize - layoutAfterAnchorBoundary) {
30
+ return layoutAfterAnchorBoundary; // happy case, lay it out after the anchor
31
+ }
32
+ if (viewSize <= layoutBeforeAnchorBoundary) {
33
+ return layoutBeforeAnchorBoundary - viewSize; // ok case, lay it out before the anchor
34
+ }
35
+ return Math.max(viewportSize - viewSize, 0); // sad case, lay it over the anchor
36
+ }
37
+ else {
38
+ if (viewSize <= layoutBeforeAnchorBoundary) {
39
+ return layoutBeforeAnchorBoundary - viewSize; // happy case, lay it out before the anchor
40
+ }
41
+ if (viewSize <= viewportSize - layoutAfterAnchorBoundary) {
42
+ return layoutAfterAnchorBoundary; // ok case, lay it out after the anchor
43
+ }
44
+ return 0; // sad case, lay it over the anchor
45
+ }
46
+ }
47
+ export class ContextView extends Disposable {
48
+ static { this.BUBBLE_UP_EVENTS = ['click', 'keydown', 'focus', 'blur']; }
49
+ static { this.BUBBLE_DOWN_EVENTS = ['click']; }
50
+ constructor(container, domPosition) {
51
+ super();
52
+ this.container = null;
53
+ this.useFixedPosition = false;
54
+ this.useShadowDOM = false;
55
+ this.delegate = null;
56
+ this.toDisposeOnClean = Disposable.None;
57
+ this.toDisposeOnSetContainer = Disposable.None;
58
+ this.shadowRoot = null;
59
+ this.shadowRootHostElement = null;
60
+ this.view = DOM.$('.context-view');
61
+ DOM.hide(this.view);
62
+ this.setContainer(container, domPosition);
63
+ this._register(toDisposable(() => this.setContainer(null, 1 /* ContextViewDOMPosition.ABSOLUTE */)));
64
+ }
65
+ setContainer(container, domPosition) {
66
+ this.useFixedPosition = domPosition !== 1 /* ContextViewDOMPosition.ABSOLUTE */;
67
+ const usedShadowDOM = this.useShadowDOM;
68
+ this.useShadowDOM = domPosition === 3 /* ContextViewDOMPosition.FIXED_SHADOW */;
69
+ if (container === this.container && usedShadowDOM === this.useShadowDOM) {
70
+ return; // container is the same and no shadow DOM usage has changed
71
+ }
72
+ if (this.container) {
73
+ this.toDisposeOnSetContainer.dispose();
74
+ this.view.remove();
75
+ if (this.shadowRoot) {
76
+ this.shadowRoot = null;
77
+ this.shadowRootHostElement?.remove();
78
+ this.shadowRootHostElement = null;
79
+ }
80
+ this.container = null;
81
+ }
82
+ if (container) {
83
+ this.container = container;
84
+ if (this.useShadowDOM) {
85
+ this.shadowRootHostElement = DOM.$('.shadow-root-host');
86
+ this.container.appendChild(this.shadowRootHostElement);
87
+ this.shadowRoot = this.shadowRootHostElement.attachShadow({ mode: 'open' });
88
+ const style = document.createElement('style');
89
+ style.textContent = SHADOW_ROOT_CSS;
90
+ this.shadowRoot.appendChild(style);
91
+ this.shadowRoot.appendChild(this.view);
92
+ this.shadowRoot.appendChild(DOM.$('slot'));
93
+ }
94
+ else {
95
+ this.container.appendChild(this.view);
96
+ }
97
+ const toDisposeOnSetContainer = new DisposableStore();
98
+ ContextView.BUBBLE_UP_EVENTS.forEach(event => {
99
+ toDisposeOnSetContainer.add(DOM.addStandardDisposableListener(this.container, event, e => {
100
+ this.onDOMEvent(e, false);
101
+ }));
102
+ });
103
+ ContextView.BUBBLE_DOWN_EVENTS.forEach(event => {
104
+ toDisposeOnSetContainer.add(DOM.addStandardDisposableListener(this.container, event, e => {
105
+ this.onDOMEvent(e, true);
106
+ }, true));
107
+ });
108
+ this.toDisposeOnSetContainer = toDisposeOnSetContainer;
109
+ }
110
+ }
111
+ show(delegate) {
112
+ if (this.isVisible()) {
113
+ this.hide();
114
+ }
115
+ // Show static box
116
+ DOM.clearNode(this.view);
117
+ this.view.className = 'context-view monaco-component';
118
+ this.view.style.top = '0px';
119
+ this.view.style.left = '0px';
120
+ this.view.style.zIndex = `${2575 + (delegate.layer ?? 0)}`;
121
+ this.view.style.position = this.useFixedPosition ? 'fixed' : 'absolute';
122
+ DOM.show(this.view);
123
+ // Render content
124
+ this.toDisposeOnClean = delegate.render(this.view) || Disposable.None;
125
+ // Set active delegate
126
+ this.delegate = delegate;
127
+ // Layout
128
+ this.doLayout();
129
+ // Focus
130
+ this.delegate.focus?.();
131
+ }
132
+ getViewElement() {
133
+ return this.view;
134
+ }
135
+ layout() {
136
+ if (!this.isVisible()) {
137
+ return;
138
+ }
139
+ if (this.delegate.canRelayout === false && !(platform.isIOS && BrowserFeatures.pointerEvents)) {
140
+ this.hide();
141
+ return;
142
+ }
143
+ this.delegate?.layout?.();
144
+ this.doLayout();
145
+ }
146
+ doLayout() {
147
+ // Check that we still have a delegate - this.delegate.layout may have hidden
148
+ if (!this.isVisible()) {
149
+ return;
150
+ }
151
+ // Get anchor
152
+ const anchor = this.delegate.getAnchor();
153
+ // Compute around
154
+ let around;
155
+ // Get the element's position and size (to anchor the view)
156
+ if (DOM.isHTMLElement(anchor)) {
157
+ const elementPosition = DOM.getDomNodePagePosition(anchor);
158
+ // In areas where zoom is applied to the element or its ancestors, we need to adjust the size of the element
159
+ // e.g. The title bar has counter zoom behavior meaning it applies the inverse of zoom level.
160
+ // Window Zoom Level: 1.5, Title Bar Zoom: 1/1.5, Size Multiplier: 1.5
161
+ const zoom = DOM.getDomNodeZoomLevel(anchor);
162
+ around = {
163
+ top: elementPosition.top * zoom,
164
+ left: elementPosition.left * zoom,
165
+ width: elementPosition.width * zoom,
166
+ height: elementPosition.height * zoom
167
+ };
168
+ }
169
+ else if (isAnchor(anchor)) {
170
+ around = {
171
+ top: anchor.y,
172
+ left: anchor.x,
173
+ width: anchor.width || 1,
174
+ height: anchor.height || 2
175
+ };
176
+ }
177
+ else {
178
+ around = {
179
+ top: anchor.posy,
180
+ left: anchor.posx,
181
+ // We are about to position the context view where the mouse
182
+ // cursor is. To prevent the view being exactly under the mouse
183
+ // when showing and thus potentially triggering an action within,
184
+ // we treat the mouse location like a small sized block element.
185
+ width: 2,
186
+ height: 2
187
+ };
188
+ }
189
+ const viewSizeWidth = DOM.getTotalWidth(this.view);
190
+ const viewSizeHeight = DOM.getTotalHeight(this.view);
191
+ const anchorPosition = this.delegate.anchorPosition || 0 /* AnchorPosition.BELOW */;
192
+ const anchorAlignment = this.delegate.anchorAlignment || 0 /* AnchorAlignment.LEFT */;
193
+ const anchorAxisAlignment = this.delegate.anchorAxisAlignment || 0 /* AnchorAxisAlignment.VERTICAL */;
194
+ let top;
195
+ let left;
196
+ const activeWindow = DOM.getActiveWindow();
197
+ if (anchorAxisAlignment === 0 /* AnchorAxisAlignment.VERTICAL */) {
198
+ const verticalAnchor = { offset: around.top - activeWindow.pageYOffset, size: around.height, position: anchorPosition === 0 /* AnchorPosition.BELOW */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */ };
199
+ const horizontalAnchor = { offset: around.left, size: around.width, position: anchorAlignment === 0 /* AnchorAlignment.LEFT */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */, mode: LayoutAnchorMode.ALIGN };
200
+ top = layout(activeWindow.innerHeight, viewSizeHeight, verticalAnchor) + activeWindow.pageYOffset;
201
+ // if view intersects vertically with anchor, we must avoid the anchor
202
+ if (Range.intersects({ start: top, end: top + viewSizeHeight }, { start: verticalAnchor.offset, end: verticalAnchor.offset + verticalAnchor.size })) {
203
+ horizontalAnchor.mode = LayoutAnchorMode.AVOID;
204
+ }
205
+ left = layout(activeWindow.innerWidth, viewSizeWidth, horizontalAnchor);
206
+ }
207
+ else {
208
+ const horizontalAnchor = { offset: around.left, size: around.width, position: anchorAlignment === 0 /* AnchorAlignment.LEFT */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */ };
209
+ const verticalAnchor = { offset: around.top, size: around.height, position: anchorPosition === 0 /* AnchorPosition.BELOW */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */, mode: LayoutAnchorMode.ALIGN };
210
+ left = layout(activeWindow.innerWidth, viewSizeWidth, horizontalAnchor);
211
+ // if view intersects horizontally with anchor, we must avoid the anchor
212
+ if (Range.intersects({ start: left, end: left + viewSizeWidth }, { start: horizontalAnchor.offset, end: horizontalAnchor.offset + horizontalAnchor.size })) {
213
+ verticalAnchor.mode = LayoutAnchorMode.AVOID;
214
+ }
215
+ top = layout(activeWindow.innerHeight, viewSizeHeight, verticalAnchor) + activeWindow.pageYOffset;
216
+ }
217
+ this.view.classList.remove('top', 'bottom', 'left', 'right');
218
+ this.view.classList.add(anchorPosition === 0 /* AnchorPosition.BELOW */ ? 'bottom' : 'top');
219
+ this.view.classList.add(anchorAlignment === 0 /* AnchorAlignment.LEFT */ ? 'left' : 'right');
220
+ this.view.classList.toggle('fixed', this.useFixedPosition);
221
+ const containerPosition = DOM.getDomNodePagePosition(this.container);
222
+ this.view.style.top = `${top - (this.useFixedPosition ? DOM.getDomNodePagePosition(this.view).top : containerPosition.top)}px`;
223
+ this.view.style.left = `${left - (this.useFixedPosition ? DOM.getDomNodePagePosition(this.view).left : containerPosition.left)}px`;
224
+ this.view.style.width = 'initial';
225
+ }
226
+ hide(data) {
227
+ const delegate = this.delegate;
228
+ this.delegate = null;
229
+ if (delegate?.onHide) {
230
+ delegate.onHide(data);
231
+ }
232
+ this.toDisposeOnClean.dispose();
233
+ DOM.hide(this.view);
234
+ }
235
+ isVisible() {
236
+ return !!this.delegate;
237
+ }
238
+ onDOMEvent(e, onCapture) {
239
+ if (this.delegate) {
240
+ if (this.delegate.onDOMEvent) {
241
+ this.delegate.onDOMEvent(e, DOM.getWindow(e).document.activeElement);
242
+ }
243
+ else if (onCapture && !DOM.isAncestor(e.target, this.container)) {
244
+ this.hide();
245
+ }
246
+ }
247
+ }
248
+ dispose() {
249
+ this.hide();
250
+ super.dispose();
251
+ }
252
+ }
253
+ const SHADOW_ROOT_CSS = /* css */ `
254
+ :host {
255
+ all: initial; /* 1st rule so subsequent properties are reset. */
256
+ }
257
+
258
+ .codicon[class*='codicon-'] {
259
+ font: normal normal normal 16px/1 codicon;
260
+ display: inline-block;
261
+ text-decoration: none;
262
+ text-rendering: auto;
263
+ text-align: center;
264
+ -webkit-font-smoothing: antialiased;
265
+ -moz-osx-font-smoothing: grayscale;
266
+ user-select: none;
267
+ -webkit-user-select: none;
268
+ -ms-user-select: none;
269
+ }
270
+
271
+ :host {
272
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
273
+ }
274
+
275
+ :host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
276
+ :host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
277
+ :host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
278
+ :host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
279
+ :host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Nanum Gothic", "Apple SD Gothic Neo", "AppleGothic", sans-serif; }
280
+
281
+ :host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
282
+ :host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
283
+ :host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
284
+ :host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
285
+ :host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }
286
+
287
+ :host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
288
+ :host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
289
+ :host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
290
+ :host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
291
+ :host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
292
+ `;
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .monaco-count-badge {
7
+ padding: 3px 6px;
8
+ border-radius: 11px;
9
+ font-size: 11px;
10
+ min-width: 18px;
11
+ min-height: 18px;
12
+ line-height: 11px;
13
+ font-weight: normal;
14
+ text-align: center;
15
+ display: inline-block;
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ .monaco-count-badge.long {
20
+ padding: 2px 3px;
21
+ border-radius: 2px;
22
+ min-height: auto;
23
+ line-height: normal;
24
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { $, append } from '../../dom.js';
6
+ import { format } from '../../../common/strings.js';
7
+ import './countBadge.css';
8
+ export class CountBadge {
9
+ constructor(container, options, styles) {
10
+ this.options = options;
11
+ this.styles = styles;
12
+ this.count = 0;
13
+ this.element = append(container, $('.monaco-count-badge'));
14
+ this.countFormat = this.options.countFormat || '{0}';
15
+ this.titleFormat = this.options.titleFormat || '';
16
+ this.setCount(this.options.count || 0);
17
+ }
18
+ setCount(count) {
19
+ this.count = count;
20
+ this.render();
21
+ }
22
+ setTitleFormat(titleFormat) {
23
+ this.titleFormat = titleFormat;
24
+ this.render();
25
+ }
26
+ render() {
27
+ this.element.textContent = format(this.countFormat, this.count);
28
+ this.element.title = format(this.titleFormat, this.count);
29
+ this.element.style.backgroundColor = this.styles.badgeBackground ?? '';
30
+ this.element.style.color = this.styles.badgeForeground ?? '';
31
+ if (this.styles.badgeBorder) {
32
+ this.element.style.border = `1px solid ${this.styles.badgeBorder}`;
33
+ }
34
+ }
35
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.css ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ /** Dialog: Modal Block */
7
+ .monaco-dialog-modal-block {
8
+ position: fixed;
9
+ height: 100%;
10
+ width: 100%;
11
+ left:0;
12
+ top:0;
13
+ z-index: 2600;
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ }
18
+
19
+ .monaco-dialog-modal-block.dimmed {
20
+ background: rgba(0, 0, 0, 0.3);
21
+ }
22
+
23
+ /** Dialog: Container */
24
+ .monaco-dialog-box {
25
+ display: flex;
26
+ flex-direction: column-reverse;
27
+ width: min-content;
28
+ min-width: 500px;
29
+ max-width: 90vw;
30
+ min-height: 75px;
31
+ padding: 10px;
32
+ transform: translate3d(0px, 0px, 0px);
33
+ border-radius: 3px;
34
+ }
35
+
36
+ /** Dialog: Title Actions Row */
37
+ .monaco-dialog-box .dialog-toolbar-row {
38
+ height: 22px;
39
+ padding-bottom: 4px;
40
+ }
41
+
42
+ .monaco-dialog-box .dialog-toolbar-row .actions-container {
43
+ justify-content: flex-end;
44
+ }
45
+
46
+ /** Dialog: Message Row */
47
+ .monaco-dialog-box .dialog-message-row {
48
+ display: flex;
49
+ flex-grow: 1;
50
+ align-items: center;
51
+ padding: 0 10px;
52
+ }
53
+
54
+ .monaco-dialog-box .dialog-message-row > .dialog-icon.codicon {
55
+ flex: 0 0 48px;
56
+ height: 48px;
57
+ align-self: baseline;
58
+ font-size: 48px;
59
+ }
60
+
61
+ /** Dialog: Message Container */
62
+ .monaco-dialog-box .dialog-message-row .dialog-message-container {
63
+ display: flex;
64
+ flex-direction: column;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ padding-left: 24px;
68
+ user-select: text;
69
+ -webkit-user-select: text;
70
+ word-wrap: break-word; /* never overflow long words, but break to next line */
71
+ white-space: normal;
72
+ }
73
+
74
+ /** Dialog: Message */
75
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message {
76
+ line-height: 22px;
77
+ font-size: 18px;
78
+ flex: 1; /* let the message always grow */
79
+ white-space: normal;
80
+ word-wrap: break-word; /* never overflow long words, but break to next line */
81
+ min-height: 48px; /* matches icon height */
82
+ margin-bottom: 8px;
83
+ display: flex;
84
+ align-items: center;
85
+ }
86
+
87
+ /** Dialog: Details */
88
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-detail {
89
+ line-height: 22px;
90
+ flex: 1; /* let the message always grow */
91
+ }
92
+
93
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message a:focus {
94
+ outline-width: 1px;
95
+ outline-style: solid;
96
+ }
97
+
98
+ /** Dialog: Checkbox */
99
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row {
100
+ padding: 15px 0px 0px;
101
+ display: flex;
102
+ }
103
+
104
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row .dialog-checkbox-message {
105
+ cursor: pointer;
106
+ user-select: none;
107
+ -webkit-user-select: none;
108
+ }
109
+
110
+ /** Dialog: Input */
111
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-input {
112
+ padding: 15px 0px 0px;
113
+ display: flex;
114
+ }
115
+
116
+ .monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-input .monaco-inputbox {
117
+ flex: 1;
118
+ }
119
+
120
+ /** Dialog: File Path */
121
+ .monaco-dialog-box code {
122
+ font-family: var(--monaco-monospace-font);
123
+ }
124
+
125
+ /** Dialog: Buttons Row */
126
+ .monaco-dialog-box > .dialog-buttons-row {
127
+ display: flex;
128
+ align-items: center;
129
+ padding-right: 1px;
130
+ overflow: hidden; /* buttons row should never overflow */
131
+ }
132
+
133
+ .monaco-dialog-box > .dialog-buttons-row {
134
+ display: flex;
135
+ white-space: nowrap;
136
+ padding: 20px 10px 10px;
137
+ }
138
+
139
+ /** Dialog: Buttons */
140
+ .monaco-dialog-box > .dialog-buttons-row > .dialog-buttons {
141
+ display: flex;
142
+ width: 100%;
143
+ justify-content: flex-end;
144
+ overflow: hidden;
145
+ margin-left: 67px; /* for long buttons, force align with text */
146
+ }
147
+
148
+ .monaco-dialog-box > .dialog-buttons-row > .dialog-buttons > .monaco-button {
149
+ width: fit-content;
150
+ padding: 5px 10px;
151
+ overflow: hidden;
152
+ text-overflow: ellipsis;
153
+ margin: 4px 5px; /* allows button focus outline to be visible */
154
+ outline-offset: 2px !important;
155
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import './dialog.css';
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .monaco-dropdown {
7
+ height: 100%;
8
+ padding: 0;
9
+ }
10
+
11
+ .monaco-dropdown > .dropdown-label {
12
+ cursor: pointer;
13
+ height: 100%;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ }
18
+
19
+ .monaco-dropdown > .dropdown-label > .action-label.disabled {
20
+ cursor: default;
21
+ }
22
+
23
+ .monaco-dropdown-with-primary {
24
+ display: flex !important;
25
+ flex-direction: row;
26
+ border-radius: 5px;
27
+ }
28
+
29
+ .monaco-dropdown-with-primary > .action-container > .action-label {
30
+ margin-right: 0;
31
+ }
32
+
33
+ .monaco-dropdown-with-primary > .dropdown-action-container > .monaco-dropdown > .dropdown-label .codicon[class*='codicon-'] {
34
+ font-size: 12px;
35
+ padding-left: 0px;
36
+ padding-right: 0px;
37
+ line-height: 16px;
38
+ margin-left: -3px;
39
+ }
40
+
41
+ .monaco-dropdown-with-primary > .dropdown-action-container > .monaco-dropdown > .dropdown-label > .action-label {
42
+ display: block;
43
+ background-size: 16px;
44
+ background-position: center center;
45
+ background-repeat: no-repeat;
46
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { $, addDisposableListener, append, EventHelper, EventType, isMouseEvent } from '../../dom.js';
6
+ import { StandardKeyboardEvent } from '../../keyboardEvent.js';
7
+ import { EventType as GestureEventType, Gesture } from '../../touch.js';
8
+ import { ActionRunner } from '../../../common/actions.js';
9
+ import { Emitter } from '../../../common/event.js';
10
+ import './dropdown.css';
11
+ class BaseDropdown extends ActionRunner {
12
+ constructor(container, options) {
13
+ super();
14
+ this._onDidChangeVisibility = this._register(new Emitter());
15
+ this.onDidChangeVisibility = this._onDidChangeVisibility.event;
16
+ this._element = append(container, $('.monaco-dropdown'));
17
+ this._label = append(this._element, $('.dropdown-label'));
18
+ let labelRenderer = options.labelRenderer;
19
+ if (!labelRenderer) {
20
+ labelRenderer = (container) => {
21
+ container.textContent = options.label || '';
22
+ return null;
23
+ };
24
+ }
25
+ for (const event of [EventType.CLICK, EventType.MOUSE_DOWN, GestureEventType.Tap]) {
26
+ this._register(addDisposableListener(this.element, event, e => EventHelper.stop(e, true))); // prevent default click behaviour to trigger
27
+ }
28
+ for (const event of [EventType.MOUSE_DOWN, GestureEventType.Tap]) {
29
+ this._register(addDisposableListener(this._label, event, e => {
30
+ if (isMouseEvent(e) && (e.detail > 1 || e.button !== 0)) {
31
+ // prevent right click trigger to allow separate context menu (https://github.com/microsoft/vscode/issues/151064)
32
+ // prevent multiple clicks to open multiple context menus (https://github.com/microsoft/vscode/issues/41363)
33
+ return;
34
+ }
35
+ if (this.visible) {
36
+ this.hide();
37
+ }
38
+ else {
39
+ this.show();
40
+ }
41
+ }));
42
+ }
43
+ this._register(addDisposableListener(this._label, EventType.KEY_UP, e => {
44
+ const event = new StandardKeyboardEvent(e);
45
+ if (event.equals(3 /* KeyCode.Enter */) || event.equals(10 /* KeyCode.Space */)) {
46
+ EventHelper.stop(e, true); // https://github.com/microsoft/vscode/issues/57997
47
+ if (this.visible) {
48
+ this.hide();
49
+ }
50
+ else {
51
+ this.show();
52
+ }
53
+ }
54
+ }));
55
+ const cleanupFn = labelRenderer(this._label);
56
+ if (cleanupFn) {
57
+ this._register(cleanupFn);
58
+ }
59
+ this._register(Gesture.addTarget(this._label));
60
+ }
61
+ get element() {
62
+ return this._element;
63
+ }
64
+ show() {
65
+ if (!this.visible) {
66
+ this.visible = true;
67
+ this._onDidChangeVisibility.fire(true);
68
+ }
69
+ }
70
+ hide() {
71
+ if (this.visible) {
72
+ this.visible = false;
73
+ this._onDidChangeVisibility.fire(false);
74
+ }
75
+ }
76
+ dispose() {
77
+ super.dispose();
78
+ this.hide();
79
+ if (this.boxContainer) {
80
+ this.boxContainer.remove();
81
+ this.boxContainer = undefined;
82
+ }
83
+ if (this.contents) {
84
+ this.contents.remove();
85
+ this.contents = undefined;
86
+ }
87
+ if (this._label) {
88
+ this._label.remove();
89
+ this._label = undefined;
90
+ }
91
+ }
92
+ }
93
+ export class DropdownMenu extends BaseDropdown {
94
+ constructor(container, _options) {
95
+ super(container, _options);
96
+ this._options = _options;
97
+ this._actions = [];
98
+ this.actions = _options.actions || [];
99
+ }
100
+ set menuOptions(options) {
101
+ this._menuOptions = options;
102
+ }
103
+ get menuOptions() {
104
+ return this._menuOptions;
105
+ }
106
+ get actions() {
107
+ if (this._options.actionProvider) {
108
+ return this._options.actionProvider.getActions();
109
+ }
110
+ return this._actions;
111
+ }
112
+ set actions(actions) {
113
+ this._actions = actions;
114
+ }
115
+ show() {
116
+ super.show();
117
+ this.element.classList.add('active');
118
+ this._options.contextMenuProvider.showContextMenu({
119
+ getAnchor: () => this.element,
120
+ getActions: () => this.actions,
121
+ getActionsContext: () => this.menuOptions ? this.menuOptions.context : null,
122
+ getActionViewItem: (action, options) => this.menuOptions && this.menuOptions.actionViewItemProvider ? this.menuOptions.actionViewItemProvider(action, options) : undefined,
123
+ getKeyBinding: action => this.menuOptions && this.menuOptions.getKeyBinding ? this.menuOptions.getKeyBinding(action) : undefined,
124
+ getMenuClassName: () => this._options.menuClassName || '',
125
+ onHide: () => this.onHide(),
126
+ actionRunner: this.menuOptions ? this.menuOptions.actionRunner : undefined,
127
+ anchorAlignment: this.menuOptions ? this.menuOptions.anchorAlignment : 0 /* AnchorAlignment.LEFT */,
128
+ domForShadowRoot: this._options.menuAsChild ? this.element : undefined,
129
+ skipTelemetry: this._options.skipTelemetry
130
+ });
131
+ }
132
+ hide() {
133
+ super.hide();
134
+ }
135
+ onHide() {
136
+ this.hide();
137
+ this.element.classList.remove('active');
138
+ }
139
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { $, append } from '../../dom.js';
2
+ import { BaseActionViewItem } from '../actionbar/actionViewItems.js';
3
+ import { DropdownMenu } from './dropdown.js';
4
+ import { Emitter } from '../../../common/event.js';
5
+ import './dropdown.css';
6
+ import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
7
+ import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';
8
+ export class DropdownMenuActionViewItem extends BaseActionViewItem {
9
+ constructor(action, menuActionsOrProvider, contextMenuProvider, options = Object.create(null)) {
10
+ super(null, action, options);
11
+ this.actionItem = null;
12
+ this._onDidChangeVisibility = this._register(new Emitter());
13
+ this.onDidChangeVisibility = this._onDidChangeVisibility.event;
14
+ this.menuActionsOrProvider = menuActionsOrProvider;
15
+ this.contextMenuProvider = contextMenuProvider;
16
+ this.options = options;
17
+ if (this.options.actionRunner) {
18
+ this.actionRunner = this.options.actionRunner;
19
+ }
20
+ }
21
+ render(container) {
22
+ this.actionItem = container;
23
+ const labelRenderer = (el) => {
24
+ this.element = append(el, $('a.action-label'));
25
+ let classNames = [];
26
+ if (typeof this.options.classNames === 'string') {
27
+ classNames = this.options.classNames.split(/\s+/g).filter(s => !!s);
28
+ }
29
+ else if (this.options.classNames) {
30
+ classNames = this.options.classNames;
31
+ }
32
+ // todo@aeschli: remove codicon, should come through `this.options.classNames`
33
+ if (!classNames.find(c => c === 'icon')) {
34
+ classNames.push('codicon');
35
+ }
36
+ this.element.classList.add(...classNames);
37
+ this.element.setAttribute('role', 'button');
38
+ this.element.setAttribute('aria-haspopup', 'true');
39
+ this.element.setAttribute('aria-expanded', 'false');
40
+ if (this._action.label) {
41
+ this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('mouse'), this.element, this._action.label));
42
+ }
43
+ this.element.ariaLabel = this._action.label || '';
44
+ return null;
45
+ };
46
+ const isActionsArray = Array.isArray(this.menuActionsOrProvider);
47
+ const options = {
48
+ contextMenuProvider: this.contextMenuProvider,
49
+ labelRenderer: labelRenderer,
50
+ menuAsChild: this.options.menuAsChild,
51
+ actions: isActionsArray ? this.menuActionsOrProvider : undefined,
52
+ actionProvider: isActionsArray ? undefined : this.menuActionsOrProvider,
53
+ skipTelemetry: this.options.skipTelemetry
54
+ };
55
+ this.dropdownMenu = this._register(new DropdownMenu(container, options));
56
+ this._register(this.dropdownMenu.onDidChangeVisibility(visible => {
57
+ this.element?.setAttribute('aria-expanded', `${visible}`);
58
+ this._onDidChangeVisibility.fire(visible);
59
+ }));
60
+ this.dropdownMenu.menuOptions = {
61
+ actionViewItemProvider: this.options.actionViewItemProvider,
62
+ actionRunner: this.actionRunner,
63
+ getKeyBinding: this.options.keybindingProvider,
64
+ context: this._context
65
+ };
66
+ if (this.options.anchorAlignmentProvider) {
67
+ const that = this;
68
+ this.dropdownMenu.menuOptions = {
69
+ ...this.dropdownMenu.menuOptions,
70
+ get anchorAlignment() {
71
+ return that.options.anchorAlignmentProvider();
72
+ }
73
+ };
74
+ }
75
+ this.updateTooltip();
76
+ this.updateEnabled();
77
+ }
78
+ getTooltip() {
79
+ let title = null;
80
+ if (this.action.tooltip) {
81
+ title = this.action.tooltip;
82
+ }
83
+ else if (this.action.label) {
84
+ title = this.action.label;
85
+ }
86
+ return title ?? undefined;
87
+ }
88
+ setActionContext(newContext) {
89
+ super.setActionContext(newContext);
90
+ if (this.dropdownMenu) {
91
+ if (this.dropdownMenu.menuOptions) {
92
+ this.dropdownMenu.menuOptions.context = newContext;
93
+ }
94
+ else {
95
+ this.dropdownMenu.menuOptions = { context: newContext };
96
+ }
97
+ }
98
+ }
99
+ show() {
100
+ this.dropdownMenu?.show();
101
+ }
102
+ updateEnabled() {
103
+ const disabled = !this.action.enabled;
104
+ this.actionItem?.classList.toggle('disabled', disabled);
105
+ this.element?.classList.toggle('disabled', disabled);
106
+ }
107
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /* ---------- Find input ---------- */
6
+
7
+ .monaco-findInput {
8
+ position: relative;
9
+ }
10
+
11
+ .monaco-findInput .monaco-inputbox {
12
+ font-size: 13px;
13
+ width: 100%;
14
+ }
15
+
16
+ .monaco-findInput > .controls {
17
+ position: absolute;
18
+ top: 3px;
19
+ right: 2px;
20
+ }
21
+
22
+ .vs .monaco-findInput.disabled {
23
+ background-color: #E1E1E1;
24
+ }
25
+
26
+ /* Theming */
27
+ .vs-dark .monaco-findInput.disabled {
28
+ background-color: #333;
29
+ }
30
+
31
+ /* Highlighting */
32
+ .monaco-findInput.highlight-0 .controls,
33
+ .hc-light .monaco-findInput.highlight-0 .controls {
34
+ animation: monaco-findInput-highlight-0 100ms linear 0s;
35
+ }
36
+
37
+ .monaco-findInput.highlight-1 .controls,
38
+ .hc-light .monaco-findInput.highlight-1 .controls {
39
+ animation: monaco-findInput-highlight-1 100ms linear 0s;
40
+ }
41
+
42
+ .hc-black .monaco-findInput.highlight-0 .controls,
43
+ .vs-dark .monaco-findInput.highlight-0 .controls {
44
+ animation: monaco-findInput-highlight-dark-0 100ms linear 0s;
45
+ }
46
+
47
+ .hc-black .monaco-findInput.highlight-1 .controls,
48
+ .vs-dark .monaco-findInput.highlight-1 .controls {
49
+ animation: monaco-findInput-highlight-dark-1 100ms linear 0s;
50
+ }
51
+
52
+ @keyframes monaco-findInput-highlight-0 {
53
+ 0% { background: rgba(253, 255, 0, 0.8); }
54
+ 100% { background: transparent; }
55
+ }
56
+ @keyframes monaco-findInput-highlight-1 {
57
+ 0% { background: rgba(253, 255, 0, 0.8); }
58
+ /* Made intentionally different such that the CSS minifier does not collapse the two animations into a single one*/
59
+ 99% { background: transparent; }
60
+ }
61
+
62
+ @keyframes monaco-findInput-highlight-dark-0 {
63
+ 0% { background: rgba(255, 255, 255, 0.44); }
64
+ 100% { background: transparent; }
65
+ }
66
+ @keyframes monaco-findInput-highlight-dark-1 {
67
+ 0% { background: rgba(255, 255, 255, 0.44); }
68
+ /* Made intentionally different such that the CSS minifier does not collapse the two animations into a single one*/
69
+ 99% { background: transparent; }
70
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as dom from '../../dom.js';
6
+ import { CaseSensitiveToggle, RegexToggle, WholeWordsToggle } from './findInputToggles.js';
7
+ import { HistoryInputBox } from '../inputbox/inputBox.js';
8
+ import { Widget } from '../widget.js';
9
+ import { Emitter } from '../../../common/event.js';
10
+ import './findInput.css';
11
+ import * as nls from '../../../../nls.js';
12
+ import { DisposableStore, MutableDisposable } from '../../../common/lifecycle.js';
13
+ import { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js';
14
+ const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
15
+ export class FindInput extends Widget {
16
+ constructor(parent, contextViewProvider, options) {
17
+ super();
18
+ this.fixFocusOnOptionClickEnabled = true;
19
+ this.imeSessionInProgress = false;
20
+ this.additionalTogglesDisposables = this._register(new MutableDisposable());
21
+ this.additionalToggles = [];
22
+ this._onDidOptionChange = this._register(new Emitter());
23
+ this.onDidOptionChange = this._onDidOptionChange.event;
24
+ this._onKeyDown = this._register(new Emitter());
25
+ this.onKeyDown = this._onKeyDown.event;
26
+ this._onMouseDown = this._register(new Emitter());
27
+ this.onMouseDown = this._onMouseDown.event;
28
+ this._onInput = this._register(new Emitter());
29
+ this._onKeyUp = this._register(new Emitter());
30
+ this._onCaseSensitiveKeyDown = this._register(new Emitter());
31
+ this.onCaseSensitiveKeyDown = this._onCaseSensitiveKeyDown.event;
32
+ this._onRegexKeyDown = this._register(new Emitter());
33
+ this.onRegexKeyDown = this._onRegexKeyDown.event;
34
+ this._lastHighlightFindOptions = 0;
35
+ this.placeholder = options.placeholder || '';
36
+ this.validation = options.validation;
37
+ this.label = options.label || NLS_DEFAULT_LABEL;
38
+ this.showCommonFindToggles = !!options.showCommonFindToggles;
39
+ const appendCaseSensitiveLabel = options.appendCaseSensitiveLabel || '';
40
+ const appendWholeWordsLabel = options.appendWholeWordsLabel || '';
41
+ const appendRegexLabel = options.appendRegexLabel || '';
42
+ const history = options.history || [];
43
+ const flexibleHeight = !!options.flexibleHeight;
44
+ const flexibleWidth = !!options.flexibleWidth;
45
+ const flexibleMaxHeight = options.flexibleMaxHeight;
46
+ this.domNode = document.createElement('div');
47
+ this.domNode.classList.add('monaco-findInput');
48
+ this.inputBox = this._register(new HistoryInputBox(this.domNode, contextViewProvider, {
49
+ placeholder: this.placeholder || '',
50
+ ariaLabel: this.label || '',
51
+ validationOptions: {
52
+ validation: this.validation
53
+ },
54
+ history,
55
+ showHistoryHint: options.showHistoryHint,
56
+ flexibleHeight,
57
+ flexibleWidth,
58
+ flexibleMaxHeight,
59
+ inputBoxStyles: options.inputBoxStyles,
60
+ }));
61
+ const hoverDelegate = this._register(createInstantHoverDelegate());
62
+ if (this.showCommonFindToggles) {
63
+ this.regex = this._register(new RegexToggle({
64
+ appendTitle: appendRegexLabel,
65
+ isChecked: false,
66
+ hoverDelegate,
67
+ ...options.toggleStyles
68
+ }));
69
+ this._register(this.regex.onChange(viaKeyboard => {
70
+ this._onDidOptionChange.fire(viaKeyboard);
71
+ if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
72
+ this.inputBox.focus();
73
+ }
74
+ this.validate();
75
+ }));
76
+ this._register(this.regex.onKeyDown(e => {
77
+ this._onRegexKeyDown.fire(e);
78
+ }));
79
+ this.wholeWords = this._register(new WholeWordsToggle({
80
+ appendTitle: appendWholeWordsLabel,
81
+ isChecked: false,
82
+ hoverDelegate,
83
+ ...options.toggleStyles
84
+ }));
85
+ this._register(this.wholeWords.onChange(viaKeyboard => {
86
+ this._onDidOptionChange.fire(viaKeyboard);
87
+ if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
88
+ this.inputBox.focus();
89
+ }
90
+ this.validate();
91
+ }));
92
+ this.caseSensitive = this._register(new CaseSensitiveToggle({
93
+ appendTitle: appendCaseSensitiveLabel,
94
+ isChecked: false,
95
+ hoverDelegate,
96
+ ...options.toggleStyles
97
+ }));
98
+ this._register(this.caseSensitive.onChange(viaKeyboard => {
99
+ this._onDidOptionChange.fire(viaKeyboard);
100
+ if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
101
+ this.inputBox.focus();
102
+ }
103
+ this.validate();
104
+ }));
105
+ this._register(this.caseSensitive.onKeyDown(e => {
106
+ this._onCaseSensitiveKeyDown.fire(e);
107
+ }));
108
+ // Arrow-Key support to navigate between options
109
+ const indexes = [this.caseSensitive.domNode, this.wholeWords.domNode, this.regex.domNode];
110
+ this.onkeydown(this.domNode, (event) => {
111
+ if (event.equals(15 /* KeyCode.LeftArrow */) || event.equals(17 /* KeyCode.RightArrow */) || event.equals(9 /* KeyCode.Escape */)) {
112
+ const index = indexes.indexOf(this.domNode.ownerDocument.activeElement);
113
+ if (index >= 0) {
114
+ let newIndex = -1;
115
+ if (event.equals(17 /* KeyCode.RightArrow */)) {
116
+ newIndex = (index + 1) % indexes.length;
117
+ }
118
+ else if (event.equals(15 /* KeyCode.LeftArrow */)) {
119
+ if (index === 0) {
120
+ newIndex = indexes.length - 1;
121
+ }
122
+ else {
123
+ newIndex = index - 1;
124
+ }
125
+ }
126
+ if (event.equals(9 /* KeyCode.Escape */)) {
127
+ indexes[index].blur();
128
+ this.inputBox.focus();
129
+ }
130
+ else if (newIndex >= 0) {
131
+ indexes[newIndex].focus();
132
+ }
133
+ dom.EventHelper.stop(event, true);
134
+ }
135
+ }
136
+ });
137
+ }
138
+ this.controls = document.createElement('div');
139
+ this.controls.className = 'controls';
140
+ this.controls.style.display = this.showCommonFindToggles ? '' : 'none';
141
+ if (this.caseSensitive) {
142
+ this.controls.append(this.caseSensitive.domNode);
143
+ }
144
+ if (this.wholeWords) {
145
+ this.controls.appendChild(this.wholeWords.domNode);
146
+ }
147
+ if (this.regex) {
148
+ this.controls.appendChild(this.regex.domNode);
149
+ }
150
+ this.setAdditionalToggles(options?.additionalToggles);
151
+ if (this.controls) {
152
+ this.domNode.appendChild(this.controls);
153
+ }
154
+ parent?.appendChild(this.domNode);
155
+ this._register(dom.addDisposableListener(this.inputBox.inputElement, 'compositionstart', (e) => {
156
+ this.imeSessionInProgress = true;
157
+ }));
158
+ this._register(dom.addDisposableListener(this.inputBox.inputElement, 'compositionend', (e) => {
159
+ this.imeSessionInProgress = false;
160
+ this._onInput.fire();
161
+ }));
162
+ this.onkeydown(this.inputBox.inputElement, (e) => this._onKeyDown.fire(e));
163
+ this.onkeyup(this.inputBox.inputElement, (e) => this._onKeyUp.fire(e));
164
+ this.oninput(this.inputBox.inputElement, (e) => this._onInput.fire());
165
+ this.onmousedown(this.inputBox.inputElement, (e) => this._onMouseDown.fire(e));
166
+ }
167
+ get onDidChange() {
168
+ return this.inputBox.onDidChange;
169
+ }
170
+ layout(style) {
171
+ this.inputBox.layout();
172
+ this.updateInputBoxPadding(style.collapsedFindWidget);
173
+ }
174
+ enable() {
175
+ this.domNode.classList.remove('disabled');
176
+ this.inputBox.enable();
177
+ this.regex?.enable();
178
+ this.wholeWords?.enable();
179
+ this.caseSensitive?.enable();
180
+ for (const toggle of this.additionalToggles) {
181
+ toggle.enable();
182
+ }
183
+ }
184
+ disable() {
185
+ this.domNode.classList.add('disabled');
186
+ this.inputBox.disable();
187
+ this.regex?.disable();
188
+ this.wholeWords?.disable();
189
+ this.caseSensitive?.disable();
190
+ for (const toggle of this.additionalToggles) {
191
+ toggle.disable();
192
+ }
193
+ }
194
+ setFocusInputOnOptionClick(value) {
195
+ this.fixFocusOnOptionClickEnabled = value;
196
+ }
197
+ setEnabled(enabled) {
198
+ if (enabled) {
199
+ this.enable();
200
+ }
201
+ else {
202
+ this.disable();
203
+ }
204
+ }
205
+ setAdditionalToggles(toggles) {
206
+ for (const currentToggle of this.additionalToggles) {
207
+ currentToggle.domNode.remove();
208
+ }
209
+ this.additionalToggles = [];
210
+ this.additionalTogglesDisposables.value = new DisposableStore();
211
+ for (const toggle of toggles ?? []) {
212
+ this.additionalTogglesDisposables.value.add(toggle);
213
+ this.controls.appendChild(toggle.domNode);
214
+ this.additionalTogglesDisposables.value.add(toggle.onChange(viaKeyboard => {
215
+ this._onDidOptionChange.fire(viaKeyboard);
216
+ if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
217
+ this.inputBox.focus();
218
+ }
219
+ }));
220
+ this.additionalToggles.push(toggle);
221
+ }
222
+ if (this.additionalToggles.length > 0) {
223
+ this.controls.style.display = '';
224
+ }
225
+ this.updateInputBoxPadding();
226
+ }
227
+ updateInputBoxPadding(controlsHidden = false) {
228
+ if (controlsHidden) {
229
+ this.inputBox.paddingRight = 0;
230
+ }
231
+ else {
232
+ this.inputBox.paddingRight =
233
+ ((this.caseSensitive?.width() ?? 0) + (this.wholeWords?.width() ?? 0) + (this.regex?.width() ?? 0))
234
+ + this.additionalToggles.reduce((r, t) => r + t.width(), 0);
235
+ }
236
+ }
237
+ getValue() {
238
+ return this.inputBox.value;
239
+ }
240
+ setValue(value) {
241
+ if (this.inputBox.value !== value) {
242
+ this.inputBox.value = value;
243
+ }
244
+ }
245
+ select() {
246
+ this.inputBox.select();
247
+ }
248
+ focus() {
249
+ this.inputBox.focus();
250
+ }
251
+ getCaseSensitive() {
252
+ return this.caseSensitive?.checked ?? false;
253
+ }
254
+ setCaseSensitive(value) {
255
+ if (this.caseSensitive) {
256
+ this.caseSensitive.checked = value;
257
+ }
258
+ }
259
+ getWholeWords() {
260
+ return this.wholeWords?.checked ?? false;
261
+ }
262
+ setWholeWords(value) {
263
+ if (this.wholeWords) {
264
+ this.wholeWords.checked = value;
265
+ }
266
+ }
267
+ getRegex() {
268
+ return this.regex?.checked ?? false;
269
+ }
270
+ setRegex(value) {
271
+ if (this.regex) {
272
+ this.regex.checked = value;
273
+ this.validate();
274
+ }
275
+ }
276
+ focusOnCaseSensitive() {
277
+ this.caseSensitive?.focus();
278
+ }
279
+ highlightFindOptions() {
280
+ this.domNode.classList.remove('highlight-' + (this._lastHighlightFindOptions));
281
+ this._lastHighlightFindOptions = 1 - this._lastHighlightFindOptions;
282
+ this.domNode.classList.add('highlight-' + (this._lastHighlightFindOptions));
283
+ }
284
+ validate() {
285
+ this.inputBox.validate();
286
+ }
287
+ showMessage(message) {
288
+ this.inputBox.showMessage(message);
289
+ }
290
+ clearMessage() {
291
+ this.inputBox.hideMessage();
292
+ }
293
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
6
+ import { Toggle } from '../toggle/toggle.js';
7
+ import { Codicon } from '../../../common/codicons.js';
8
+ import * as nls from '../../../../nls.js';
9
+ const NLS_CASE_SENSITIVE_TOGGLE_LABEL = nls.localize('caseDescription', "Match Case");
10
+ const NLS_WHOLE_WORD_TOGGLE_LABEL = nls.localize('wordsDescription', "Match Whole Word");
11
+ const NLS_REGEX_TOGGLE_LABEL = nls.localize('regexDescription', "Use Regular Expression");
12
+ export class CaseSensitiveToggle extends Toggle {
13
+ constructor(opts) {
14
+ super({
15
+ icon: Codicon.caseSensitive,
16
+ title: NLS_CASE_SENSITIVE_TOGGLE_LABEL + opts.appendTitle,
17
+ isChecked: opts.isChecked,
18
+ hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),
19
+ inputActiveOptionBorder: opts.inputActiveOptionBorder,
20
+ inputActiveOptionForeground: opts.inputActiveOptionForeground,
21
+ inputActiveOptionBackground: opts.inputActiveOptionBackground
22
+ });
23
+ }
24
+ }
25
+ export class WholeWordsToggle extends Toggle {
26
+ constructor(opts) {
27
+ super({
28
+ icon: Codicon.wholeWord,
29
+ title: NLS_WHOLE_WORD_TOGGLE_LABEL + opts.appendTitle,
30
+ isChecked: opts.isChecked,
31
+ hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),
32
+ inputActiveOptionBorder: opts.inputActiveOptionBorder,
33
+ inputActiveOptionForeground: opts.inputActiveOptionForeground,
34
+ inputActiveOptionBackground: opts.inputActiveOptionBackground
35
+ });
36
+ }
37
+ }
38
+ export class RegexToggle extends Toggle {
39
+ constructor(opts) {
40
+ super({
41
+ icon: Codicon.regex,
42
+ title: NLS_REGEX_TOGGLE_LABEL + opts.appendTitle,
43
+ isChecked: opts.isChecked,
44
+ hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),
45
+ inputActiveOptionBorder: opts.inputActiveOptionBorder,
46
+ inputActiveOptionForeground: opts.inputActiveOptionForeground,
47
+ inputActiveOptionBackground: opts.inputActiveOptionBackground
48
+ });
49
+ }
50
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/replaceInput.js ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as dom from '../../dom.js';
6
+ import { Toggle } from '../toggle/toggle.js';
7
+ import { HistoryInputBox } from '../inputbox/inputBox.js';
8
+ import { Widget } from '../widget.js';
9
+ import { Codicon } from '../../../common/codicons.js';
10
+ import { Emitter } from '../../../common/event.js';
11
+ import './findInput.css';
12
+ import * as nls from '../../../../nls.js';
13
+ import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
14
+ const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
15
+ const NLS_PRESERVE_CASE_LABEL = nls.localize('label.preserveCaseToggle', "Preserve Case");
16
+ class PreserveCaseToggle extends Toggle {
17
+ constructor(opts) {
18
+ super({
19
+ // TODO: does this need its own icon?
20
+ icon: Codicon.preserveCase,
21
+ title: NLS_PRESERVE_CASE_LABEL + opts.appendTitle,
22
+ isChecked: opts.isChecked,
23
+ hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),
24
+ inputActiveOptionBorder: opts.inputActiveOptionBorder,
25
+ inputActiveOptionForeground: opts.inputActiveOptionForeground,
26
+ inputActiveOptionBackground: opts.inputActiveOptionBackground,
27
+ });
28
+ }
29
+ }
30
+ export class ReplaceInput extends Widget {
31
+ constructor(parent, contextViewProvider, _showOptionButtons, options) {
32
+ super();
33
+ this._showOptionButtons = _showOptionButtons;
34
+ this.fixFocusOnOptionClickEnabled = true;
35
+ this.cachedOptionsWidth = 0;
36
+ this._onDidOptionChange = this._register(new Emitter());
37
+ this.onDidOptionChange = this._onDidOptionChange.event;
38
+ this._onKeyDown = this._register(new Emitter());
39
+ this.onKeyDown = this._onKeyDown.event;
40
+ this._onMouseDown = this._register(new Emitter());
41
+ this._onInput = this._register(new Emitter());
42
+ this._onKeyUp = this._register(new Emitter());
43
+ this._onPreserveCaseKeyDown = this._register(new Emitter());
44
+ this.onPreserveCaseKeyDown = this._onPreserveCaseKeyDown.event;
45
+ this.contextViewProvider = contextViewProvider;
46
+ this.placeholder = options.placeholder || '';
47
+ this.validation = options.validation;
48
+ this.label = options.label || NLS_DEFAULT_LABEL;
49
+ const appendPreserveCaseLabel = options.appendPreserveCaseLabel || '';
50
+ const history = options.history || [];
51
+ const flexibleHeight = !!options.flexibleHeight;
52
+ const flexibleWidth = !!options.flexibleWidth;
53
+ const flexibleMaxHeight = options.flexibleMaxHeight;
54
+ this.domNode = document.createElement('div');
55
+ this.domNode.classList.add('monaco-findInput');
56
+ this.inputBox = this._register(new HistoryInputBox(this.domNode, this.contextViewProvider, {
57
+ ariaLabel: this.label || '',
58
+ placeholder: this.placeholder || '',
59
+ validationOptions: {
60
+ validation: this.validation
61
+ },
62
+ history,
63
+ showHistoryHint: options.showHistoryHint,
64
+ flexibleHeight,
65
+ flexibleWidth,
66
+ flexibleMaxHeight,
67
+ inputBoxStyles: options.inputBoxStyles
68
+ }));
69
+ this.preserveCase = this._register(new PreserveCaseToggle({
70
+ appendTitle: appendPreserveCaseLabel,
71
+ isChecked: false,
72
+ ...options.toggleStyles
73
+ }));
74
+ this._register(this.preserveCase.onChange(viaKeyboard => {
75
+ this._onDidOptionChange.fire(viaKeyboard);
76
+ if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
77
+ this.inputBox.focus();
78
+ }
79
+ this.validate();
80
+ }));
81
+ this._register(this.preserveCase.onKeyDown(e => {
82
+ this._onPreserveCaseKeyDown.fire(e);
83
+ }));
84
+ if (this._showOptionButtons) {
85
+ this.cachedOptionsWidth = this.preserveCase.width();
86
+ }
87
+ else {
88
+ this.cachedOptionsWidth = 0;
89
+ }
90
+ // Arrow-Key support to navigate between options
91
+ const indexes = [this.preserveCase.domNode];
92
+ this.onkeydown(this.domNode, (event) => {
93
+ if (event.equals(15 /* KeyCode.LeftArrow */) || event.equals(17 /* KeyCode.RightArrow */) || event.equals(9 /* KeyCode.Escape */)) {
94
+ const index = indexes.indexOf(this.domNode.ownerDocument.activeElement);
95
+ if (index >= 0) {
96
+ let newIndex = -1;
97
+ if (event.equals(17 /* KeyCode.RightArrow */)) {
98
+ newIndex = (index + 1) % indexes.length;
99
+ }
100
+ else if (event.equals(15 /* KeyCode.LeftArrow */)) {
101
+ if (index === 0) {
102
+ newIndex = indexes.length - 1;
103
+ }
104
+ else {
105
+ newIndex = index - 1;
106
+ }
107
+ }
108
+ if (event.equals(9 /* KeyCode.Escape */)) {
109
+ indexes[index].blur();
110
+ this.inputBox.focus();
111
+ }
112
+ else if (newIndex >= 0) {
113
+ indexes[newIndex].focus();
114
+ }
115
+ dom.EventHelper.stop(event, true);
116
+ }
117
+ }
118
+ });
119
+ const controls = document.createElement('div');
120
+ controls.className = 'controls';
121
+ controls.style.display = this._showOptionButtons ? 'block' : 'none';
122
+ controls.appendChild(this.preserveCase.domNode);
123
+ this.domNode.appendChild(controls);
124
+ parent?.appendChild(this.domNode);
125
+ this.onkeydown(this.inputBox.inputElement, (e) => this._onKeyDown.fire(e));
126
+ this.onkeyup(this.inputBox.inputElement, (e) => this._onKeyUp.fire(e));
127
+ this.oninput(this.inputBox.inputElement, (e) => this._onInput.fire());
128
+ this.onmousedown(this.inputBox.inputElement, (e) => this._onMouseDown.fire(e));
129
+ }
130
+ enable() {
131
+ this.domNode.classList.remove('disabled');
132
+ this.inputBox.enable();
133
+ this.preserveCase.enable();
134
+ }
135
+ disable() {
136
+ this.domNode.classList.add('disabled');
137
+ this.inputBox.disable();
138
+ this.preserveCase.disable();
139
+ }
140
+ setEnabled(enabled) {
141
+ if (enabled) {
142
+ this.enable();
143
+ }
144
+ else {
145
+ this.disable();
146
+ }
147
+ }
148
+ select() {
149
+ this.inputBox.select();
150
+ }
151
+ focus() {
152
+ this.inputBox.focus();
153
+ }
154
+ getPreserveCase() {
155
+ return this.preserveCase.checked;
156
+ }
157
+ setPreserveCase(value) {
158
+ this.preserveCase.checked = value;
159
+ }
160
+ focusOnPreserve() {
161
+ this.preserveCase.focus();
162
+ }
163
+ validate() {
164
+ this.inputBox?.validate();
165
+ }
166
+ set width(newWidth) {
167
+ this.inputBox.paddingRight = this.cachedOptionsWidth;
168
+ this.domNode.style.width = newWidth + 'px';
169
+ }
170
+ dispose() {
171
+ super.dispose();
172
+ }
173
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as dom from '../../dom.js';
6
+ import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';
7
+ import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
8
+ import { renderLabelWithIcons } from '../iconLabel/iconLabels.js';
9
+ import { Disposable } from '../../../common/lifecycle.js';
10
+ import * as objects from '../../../common/objects.js';
11
+ /**
12
+ * A widget which can render a label with substring highlights, often
13
+ * originating from a filter function like the fuzzy matcher.
14
+ */
15
+ export class HighlightedLabel extends Disposable {
16
+ /**
17
+ * Create a new {@link HighlightedLabel}.
18
+ *
19
+ * @param container The parent container to append to.
20
+ */
21
+ constructor(container, options) {
22
+ super();
23
+ this.options = options;
24
+ this.text = '';
25
+ this.title = '';
26
+ this.highlights = [];
27
+ this.didEverRender = false;
28
+ this.supportIcons = options?.supportIcons ?? false;
29
+ this.domNode = dom.append(container, dom.$('span.monaco-highlighted-label'));
30
+ }
31
+ /**
32
+ * The label's DOM node.
33
+ */
34
+ get element() {
35
+ return this.domNode;
36
+ }
37
+ /**
38
+ * Set the label and highlights.
39
+ *
40
+ * @param text The label to display.
41
+ * @param highlights The ranges to highlight.
42
+ * @param title An optional title for the hover tooltip.
43
+ * @param escapeNewLines Whether to escape new lines.
44
+ * @returns
45
+ */
46
+ set(text, highlights = [], title = '', escapeNewLines) {
47
+ if (!text) {
48
+ text = '';
49
+ }
50
+ if (escapeNewLines) {
51
+ // adjusts highlights inplace
52
+ text = HighlightedLabel.escapeNewLines(text, highlights);
53
+ }
54
+ if (this.didEverRender && this.text === text && this.title === title && objects.equals(this.highlights, highlights)) {
55
+ return;
56
+ }
57
+ this.text = text;
58
+ this.title = title;
59
+ this.highlights = highlights;
60
+ this.render();
61
+ }
62
+ render() {
63
+ const children = [];
64
+ let pos = 0;
65
+ for (const highlight of this.highlights) {
66
+ if (highlight.end === highlight.start) {
67
+ continue;
68
+ }
69
+ if (pos < highlight.start) {
70
+ const substring = this.text.substring(pos, highlight.start);
71
+ if (this.supportIcons) {
72
+ children.push(...renderLabelWithIcons(substring));
73
+ }
74
+ else {
75
+ children.push(substring);
76
+ }
77
+ pos = highlight.start;
78
+ }
79
+ const substring = this.text.substring(pos, highlight.end);
80
+ const element = dom.$('span.highlight', undefined, ...this.supportIcons ? renderLabelWithIcons(substring) : [substring]);
81
+ if (highlight.extraClasses) {
82
+ element.classList.add(...highlight.extraClasses);
83
+ }
84
+ children.push(element);
85
+ pos = highlight.end;
86
+ }
87
+ if (pos < this.text.length) {
88
+ const substring = this.text.substring(pos);
89
+ if (this.supportIcons) {
90
+ children.push(...renderLabelWithIcons(substring));
91
+ }
92
+ else {
93
+ children.push(substring);
94
+ }
95
+ }
96
+ dom.reset(this.domNode, ...children);
97
+ if (this.options?.hoverDelegate?.showNativeHover) {
98
+ /* While custom hover is not inside custom hover */
99
+ this.domNode.title = this.title;
100
+ }
101
+ else {
102
+ if (!this.customHover && this.title !== '') {
103
+ const hoverDelegate = this.options?.hoverDelegate ?? getDefaultHoverDelegate('mouse');
104
+ this.customHover = this._register(getBaseLayerHoverDelegate().setupManagedHover(hoverDelegate, this.domNode, this.title));
105
+ }
106
+ else if (this.customHover) {
107
+ this.customHover.update(this.title);
108
+ }
109
+ }
110
+ this.didEverRender = true;
111
+ }
112
+ static escapeNewLines(text, highlights) {
113
+ let total = 0;
114
+ let extra = 0;
115
+ return text.replace(/\r\n|\r|\n/g, (match, offset) => {
116
+ extra = match === '\r\n' ? -1 : 0;
117
+ offset += total;
118
+ for (const highlight of highlights) {
119
+ if (highlight.end <= offset) {
120
+ continue;
121
+ }
122
+ if (highlight.start >= offset) {
123
+ highlight.start += extra;
124
+ }
125
+ if (highlight.end >= offset) {
126
+ highlight.end += extra;
127
+ }
128
+ }
129
+ total += extra;
130
+ return '\u23CE';
131
+ });
132
+ }
133
+ }
novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hover.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export {};
6
+ // #endregion Managed hover