diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/browser.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/browser.js new file mode 100644 index 0000000000000000000000000000000000000000..ddacbb813eaa7f42369008dfe308a2c6aaf57d42 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/browser.js @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { mainWindow } from './window.js'; +class WindowManager { + constructor() { + // --- Zoom Factor + this.mapWindowIdToZoomFactor = new Map(); + } + static { this.INSTANCE = new WindowManager(); } + getZoomFactor(targetWindow) { + return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1; + } + getWindowId(targetWindow) { + return targetWindow.vscodeWindowId; + } +} +export function addMatchMediaChangeListener(targetWindow, query, callback) { + if (typeof query === 'string') { + query = targetWindow.matchMedia(query); + } + query.addEventListener('change', callback); +} +/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */ +export function getZoomFactor(targetWindow) { + return WindowManager.INSTANCE.getZoomFactor(targetWindow); +} +const userAgent = navigator.userAgent; +export const isFirefox = (userAgent.indexOf('Firefox') >= 0); +export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0); +export const isChrome = (userAgent.indexOf('Chrome') >= 0); +export const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0)); +export const isWebkitWebView = (!isChrome && !isSafari && isWebKit); +export const isElectron = (userAgent.indexOf('Electron/') >= 0); +export const isAndroid = (userAgent.indexOf('Android') >= 0); +let standalone = false; +if (typeof mainWindow.matchMedia === 'function') { + const standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)'); + const fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)'); + standalone = standaloneMatchMedia.matches; + addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => { + // entering fullscreen would change standaloneMatchMedia.matches to false + // if standalone is true (running as PWA) and entering fullscreen, skip this change + if (standalone && fullScreenMatchMedia.matches) { + return; + } + // otherwise update standalone (browser to PWA or PWA to browser) + standalone = matches; + }); +} +export function isStandalone() { + return standalone; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js new file mode 100644 index 0000000000000000000000000000000000000000..3f62d28347c3bc715e39497b785687984f21db54 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as browser from './browser.js'; +import { mainWindow } from './window.js'; +import * as platform from '../common/platform.js'; +/** + * Browser feature we can support in current platform, browser and environment. + */ +export const BrowserFeatures = { + clipboard: { + writeText: (platform.isNative + || (document.queryCommandSupported && document.queryCommandSupported('copy')) + || !!(navigator && navigator.clipboard && navigator.clipboard.writeText)), + readText: (platform.isNative + || !!(navigator && navigator.clipboard && navigator.clipboard.readText)) + }, + keyboard: (() => { + if (platform.isNative || browser.isStandalone()) { + return 0 /* KeyboardSupport.Always */; + } + if (navigator.keyboard || browser.isSafari) { + return 1 /* KeyboardSupport.FullScreen */; + } + return 2 /* KeyboardSupport.None */; + })(), + // 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be + // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast + touch: 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0, + pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0) +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/contextmenu.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/contextmenu.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/contextmenu.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js new file mode 100644 index 0000000000000000000000000000000000000000..ea055c9c1842bb724382fb20db02d14616e4f9ae --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js @@ -0,0 +1,195 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { createTrustedTypesPolicy } from './trustedTypes.js'; +import { onUnexpectedError } from '../common/errors.js'; +import { COI, FileAccess } from '../common/network.js'; +import { logOnceWebWorkerWarning, SimpleWorkerClient } from '../common/worker/simpleWorker.js'; +import { Disposable, toDisposable } from '../common/lifecycle.js'; +import { coalesce } from '../common/arrays.js'; +import { getNLSLanguage, getNLSMessages } from '../../nls.js'; +// ESM-comment-begin +// const isESM = false; +// ESM-comment-end +// ESM-uncomment-begin +const isESM = true; +// ESM-uncomment-end +// Reuse the trusted types policy defined from worker bootstrap +// when available. +// Refs https://github.com/microsoft/vscode/issues/222193 +let ttPolicy; +if (typeof self === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope' && globalThis.workerttPolicy !== undefined) { + ttPolicy = globalThis.workerttPolicy; +} +else { + ttPolicy = createTrustedTypesPolicy('defaultWorkerFactory', { createScriptURL: value => value }); +} +function getWorker(esmWorkerLocation, label) { + const monacoEnvironment = globalThis.MonacoEnvironment; + if (monacoEnvironment) { + if (typeof monacoEnvironment.getWorker === 'function') { + return monacoEnvironment.getWorker('workerMain.js', label); + } + if (typeof monacoEnvironment.getWorkerUrl === 'function') { + const workerUrl = monacoEnvironment.getWorkerUrl('workerMain.js', label); + return new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) : workerUrl, { name: label, type: isESM ? 'module' : undefined }); + } + } + // ESM-comment-begin + // if (typeof require === 'function') { + // const workerMainLocation = require.toUrl('vs/base/worker/workerMain.js'); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321 + // const factoryModuleId = 'vs/base/worker/defaultWorkerFactory.js'; + // const workerBaseUrl = require.toUrl(factoryModuleId).slice(0, -factoryModuleId.length); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321 + // const workerUrl = getWorkerBootstrapUrl(label, workerMainLocation, workerBaseUrl); + // return new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) as unknown as string : workerUrl, { name: label, type: isESM ? 'module' : undefined }); + // } + // ESM-comment-end + if (esmWorkerLocation) { + const workerUrl = getWorkerBootstrapUrl(label, esmWorkerLocation.toString(true)); + const worker = new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) : workerUrl, { name: label, type: isESM ? 'module' : undefined }); + if (isESM) { + return whenESMWorkerReady(worker); + } + else { + return worker; + } + } + throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`); +} +function getWorkerBootstrapUrl(label, workerScriptUrl, workerBaseUrl) { + const workerScriptUrlIsAbsolute = /^((http:)|(https:)|(file:)|(vscode-file:))/.test(workerScriptUrl); + if (workerScriptUrlIsAbsolute && workerScriptUrl.substring(0, globalThis.origin.length) !== globalThis.origin) { + // this is the cross-origin case + // i.e. the webpage is running at a different origin than where the scripts are loaded from + } + else { + const start = workerScriptUrl.lastIndexOf('?'); + const end = workerScriptUrl.lastIndexOf('#', start); + const params = start > 0 + ? new URLSearchParams(workerScriptUrl.substring(start + 1, ~end ? end : undefined)) + : new URLSearchParams(); + COI.addSearchParam(params, true, true); + const search = params.toString(); + if (!search) { + workerScriptUrl = `${workerScriptUrl}#${label}`; + } + else { + workerScriptUrl = `${workerScriptUrl}?${params.toString()}#${label}`; + } + } + if (!isESM && !workerScriptUrlIsAbsolute) { + // we have to convert relative script URLs to the origin because importScripts + // does not work unless the script URL is absolute + workerScriptUrl = new URL(workerScriptUrl, globalThis.origin).toString(); + } + const blob = new Blob([coalesce([ + `/*${label}*/`, + workerBaseUrl ? `globalThis.MonacoEnvironment = { baseUrl: '${workerBaseUrl}' };` : undefined, + `globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(getNLSMessages())};`, + `globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(getNLSLanguage())};`, + `globalThis._VSCODE_FILE_ROOT = '${globalThis._VSCODE_FILE_ROOT}';`, + `const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });`, + `globalThis.workerttPolicy = ttPolicy;`, + isESM ? `await import(ttPolicy?.createScriptURL('${workerScriptUrl}') ?? '${workerScriptUrl}');` : `importScripts(ttPolicy?.createScriptURL('${workerScriptUrl}') ?? '${workerScriptUrl}');`, + isESM ? `globalThis.postMessage({ type: 'vscode-worker-ready' });` : undefined, // in ESM signal we are ready after the async import + `/*${label}*/` + ]).join('')], { type: 'application/javascript' }); + return URL.createObjectURL(blob); +} +function whenESMWorkerReady(worker) { + return new Promise((resolve, reject) => { + worker.onmessage = function (e) { + if (e.data.type === 'vscode-worker-ready') { + worker.onmessage = null; + resolve(worker); + } + }; + worker.onerror = reject; + }); +} +function isPromiseLike(obj) { + if (typeof obj.then === 'function') { + return true; + } + return false; +} +/** + * A worker that uses HTML5 web workers so that is has + * its own global scope and its own thread. + */ +class WebWorker extends Disposable { + constructor(esmWorkerLocation, amdModuleId, id, label, onMessageCallback, onErrorCallback) { + super(); + this.id = id; + this.label = label; + const workerOrPromise = getWorker(esmWorkerLocation, label); + if (isPromiseLike(workerOrPromise)) { + this.worker = workerOrPromise; + } + else { + this.worker = Promise.resolve(workerOrPromise); + } + this.postMessage(amdModuleId, []); + this.worker.then((w) => { + w.onmessage = function (ev) { + onMessageCallback(ev.data); + }; + w.onmessageerror = onErrorCallback; + if (typeof w.addEventListener === 'function') { + w.addEventListener('error', onErrorCallback); + } + }); + this._register(toDisposable(() => { + this.worker?.then(w => { + w.onmessage = null; + w.onmessageerror = null; + w.removeEventListener('error', onErrorCallback); + w.terminate(); + }); + this.worker = null; + })); + } + getId() { + return this.id; + } + postMessage(message, transfer) { + this.worker?.then(w => { + try { + w.postMessage(message, transfer); + } + catch (err) { + onUnexpectedError(err); + onUnexpectedError(new Error(`FAILED to post message to '${this.label}'-worker`, { cause: err })); + } + }); + } +} +export class WorkerDescriptor { + constructor(amdModuleId, label) { + this.amdModuleId = amdModuleId; + this.label = label; + this.esmModuleLocation = (isESM ? FileAccess.asBrowserUri(`${amdModuleId}.esm.js`) : undefined); + } +} +class DefaultWorkerFactory { + static { this.LAST_WORKER_ID = 0; } + constructor() { + this._webWorkerFailedBeforeError = false; + } + create(desc, onMessageCallback, onErrorCallback) { + const workerId = (++DefaultWorkerFactory.LAST_WORKER_ID); + if (this._webWorkerFailedBeforeError) { + throw this._webWorkerFailedBeforeError; + } + return new WebWorker(desc.esmModuleLocation, desc.amdModuleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => { + logOnceWebWorkerWarning(err); + this._webWorkerFailedBeforeError = err; + onErrorCallback(err); + }); + } +} +export function createWebWorker(arg0, arg1) { + const workerDescriptor = (typeof arg0 === 'string' ? new WorkerDescriptor(arg0, arg1) : arg0); + return new SimpleWorkerClient(new DefaultWorkerFactory(), workerDescriptor); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dnd.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dnd.js new file mode 100644 index 0000000000000000000000000000000000000000..019e4f59990d3e09255e49fb2a98e71c61230622 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dnd.js @@ -0,0 +1,26 @@ +import { Mimes } from '../common/mime.js'; +// Common data transfers +export const DataTransfers = { + /** + * Application specific resource transfer type + */ + RESOURCES: 'ResourceURLs', + /** + * Browser specific transfer type to download + */ + DOWNLOAD_URL: 'DownloadURL', + /** + * Browser specific transfer type for files + */ + FILES: 'Files', + /** + * Typically transfer type for copy/paste transfers. + */ + TEXT: Mimes.text, + /** + * Internal type used to pass around text/uri-list data. + * + * This is needed to work around https://bugs.chromium.org/p/chromium/issues/detail?id=239745. + */ + INTERNAL_URI_LIST: 'application/vnd.code.uri-list', +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dom.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dom.js new file mode 100644 index 0000000000000000000000000000000000000000..b2acc4b70e172ec1f834649c5251f06ce612a657 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dom.js @@ -0,0 +1,1525 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as browser from './browser.js'; +import { BrowserFeatures } from './canIUse.js'; +import { StandardKeyboardEvent } from './keyboardEvent.js'; +import { StandardMouseEvent } from './mouseEvent.js'; +import { AbstractIdleValue, IntervalTimer, _runWhenIdle } from '../common/async.js'; +import { onUnexpectedError } from '../common/errors.js'; +import * as event from '../common/event.js'; +import * as dompurify from './dompurify/dompurify.js'; +import { Disposable, DisposableStore, toDisposable } from '../common/lifecycle.js'; +import { FileAccess, RemoteAuthorities } from '../common/network.js'; +import * as platform from '../common/platform.js'; +import { hash } from '../common/hash.js'; +import { ensureCodeWindow, mainWindow } from './window.js'; +//# region Multi-Window Support Utilities +export const { registerWindow, getWindow, getDocument, getWindows, getWindowsCount, getWindowId, getWindowById, hasWindow, onDidRegisterWindow, onWillUnregisterWindow, onDidUnregisterWindow } = (function () { + const windows = new Map(); + ensureCodeWindow(mainWindow, 1); + const mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() }; + windows.set(mainWindow.vscodeWindowId, mainWindowRegistration); + const onDidRegisterWindow = new event.Emitter(); + const onDidUnregisterWindow = new event.Emitter(); + const onWillUnregisterWindow = new event.Emitter(); + function getWindowById(windowId, fallbackToMain) { + const window = typeof windowId === 'number' ? windows.get(windowId) : undefined; + return window ?? (fallbackToMain ? mainWindowRegistration : undefined); + } + return { + onDidRegisterWindow: onDidRegisterWindow.event, + onWillUnregisterWindow: onWillUnregisterWindow.event, + onDidUnregisterWindow: onDidUnregisterWindow.event, + registerWindow(window) { + if (windows.has(window.vscodeWindowId)) { + return Disposable.None; + } + const disposables = new DisposableStore(); + const registeredWindow = { + window, + disposables: disposables.add(new DisposableStore()) + }; + windows.set(window.vscodeWindowId, registeredWindow); + disposables.add(toDisposable(() => { + windows.delete(window.vscodeWindowId); + onDidUnregisterWindow.fire(window); + })); + disposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => { + onWillUnregisterWindow.fire(window); + })); + onDidRegisterWindow.fire(registeredWindow); + return disposables; + }, + getWindows() { + return windows.values(); + }, + getWindowsCount() { + return windows.size; + }, + getWindowId(targetWindow) { + return targetWindow.vscodeWindowId; + }, + hasWindow(windowId) { + return windows.has(windowId); + }, + getWindowById, + getWindow(e) { + const candidateNode = e; + if (candidateNode?.ownerDocument?.defaultView) { + return candidateNode.ownerDocument.defaultView.window; + } + const candidateEvent = e; + if (candidateEvent?.view) { + return candidateEvent.view.window; + } + return mainWindow; + }, + getDocument(e) { + const candidateNode = e; + return getWindow(candidateNode).document; + } + }; +})(); +//#endregion +export function clearNode(node) { + while (node.firstChild) { + node.firstChild.remove(); + } +} +class DomListener { + constructor(node, type, handler, options) { + this._node = node; + this._type = type; + this._handler = handler; + this._options = (options || false); + this._node.addEventListener(this._type, this._handler, this._options); + } + dispose() { + if (!this._handler) { + // Already disposed + return; + } + this._node.removeEventListener(this._type, this._handler, this._options); + // Prevent leakers from holding on to the dom or handler func + this._node = null; + this._handler = null; + } +} +export function addDisposableListener(node, type, handler, useCaptureOrOptions) { + return new DomListener(node, type, handler, useCaptureOrOptions); +} +function _wrapAsStandardMouseEvent(targetWindow, handler) { + return function (e) { + return handler(new StandardMouseEvent(targetWindow, e)); + }; +} +function _wrapAsStandardKeyboardEvent(handler) { + return function (e) { + return handler(new StandardKeyboardEvent(e)); + }; +} +export const addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) { + let wrapHandler = handler; + if (type === 'click' || type === 'mousedown' || type === 'contextmenu') { + wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler); + } + else if (type === 'keydown' || type === 'keypress' || type === 'keyup') { + wrapHandler = _wrapAsStandardKeyboardEvent(handler); + } + return addDisposableListener(node, type, wrapHandler, useCapture); +}; +export const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node, handler, useCapture) { + const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler); + return addDisposableGenericMouseDownListener(node, wrapHandler, useCapture); +}; +export const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node, handler, useCapture) { + const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler); + return addDisposableGenericMouseUpListener(node, wrapHandler, useCapture); +}; +export function addDisposableGenericMouseDownListener(node, handler, useCapture) { + return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture); +} +export function addDisposableGenericMouseUpListener(node, handler, useCapture) { + return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture); +} +/** + * Execute the callback the next time the browser is idle, returning an + * {@link IDisposable} that will cancel the callback when disposed. This wraps + * [requestIdleCallback] so it will fallback to [setTimeout] if the environment + * doesn't support it. + * + * @param targetWindow The window for which to run the idle callback + * @param callback The callback to run when idle, this includes an + * [IdleDeadline] that provides the time alloted for the idle callback by the + * browser. Not respecting this deadline will result in a degraded user + * experience. + * @param timeout A timeout at which point to queue no longer wait for an idle + * callback but queue it on the regular event loop (like setTimeout). Typically + * this should not be used. + * + * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline + * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback + * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout + */ +export function runWhenWindowIdle(targetWindow, callback, timeout) { + return _runWhenIdle(targetWindow, callback, timeout); +} +/** + * An implementation of the "idle-until-urgent"-strategy as introduced + * here: https://philipwalton.com/articles/idle-until-urgent/ + */ +export class WindowIdleValue extends AbstractIdleValue { + constructor(targetWindow, executor) { + super(targetWindow, executor); + } +} +/** + * Schedule a callback to be run at the next animation frame. + * This allows multiple parties to register callbacks that should run at the next animation frame. + * If currently in an animation frame, `runner` will be executed immediately. + * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately). + */ +export let runAtThisOrScheduleAtNextAnimationFrame; +/** + * Schedule a callback to be run at the next animation frame. + * This allows multiple parties to register callbacks that should run at the next animation frame. + * If currently in an animation frame, `runner` will be executed at the next animation frame. + * @return token that can be used to cancel the scheduled runner. + */ +export let scheduleAtNextAnimationFrame; +export class WindowIntervalTimer extends IntervalTimer { + /** + * + * @param node The optional node from which the target window is determined + */ + constructor(node) { + super(); + this.defaultTarget = node && getWindow(node); + } + cancelAndSet(runner, interval, targetWindow) { + return super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget); + } +} +class AnimationFrameQueueItem { + constructor(runner, priority = 0) { + this._runner = runner; + this.priority = priority; + this._canceled = false; + } + dispose() { + this._canceled = true; + } + execute() { + if (this._canceled) { + return; + } + try { + this._runner(); + } + catch (e) { + onUnexpectedError(e); + } + } + // Sort by priority (largest to lowest) + static sort(a, b) { + return b.priority - a.priority; + } +} +(function () { + /** + * The runners scheduled at the next animation frame + */ + const NEXT_QUEUE = new Map(); + /** + * The runners scheduled at the current animation frame + */ + const CURRENT_QUEUE = new Map(); + /** + * A flag to keep track if the native requestAnimationFrame was already called + */ + const animFrameRequested = new Map(); + /** + * A flag to indicate if currently handling a native requestAnimationFrame callback + */ + const inAnimationFrameRunner = new Map(); + const animationFrameRunner = (targetWindowId) => { + animFrameRequested.set(targetWindowId, false); + const currentQueue = NEXT_QUEUE.get(targetWindowId) ?? []; + CURRENT_QUEUE.set(targetWindowId, currentQueue); + NEXT_QUEUE.set(targetWindowId, []); + inAnimationFrameRunner.set(targetWindowId, true); + while (currentQueue.length > 0) { + currentQueue.sort(AnimationFrameQueueItem.sort); + const top = currentQueue.shift(); + top.execute(); + } + inAnimationFrameRunner.set(targetWindowId, false); + }; + scheduleAtNextAnimationFrame = (targetWindow, runner, priority = 0) => { + const targetWindowId = getWindowId(targetWindow); + const item = new AnimationFrameQueueItem(runner, priority); + let nextQueue = NEXT_QUEUE.get(targetWindowId); + if (!nextQueue) { + nextQueue = []; + NEXT_QUEUE.set(targetWindowId, nextQueue); + } + nextQueue.push(item); + if (!animFrameRequested.get(targetWindowId)) { + animFrameRequested.set(targetWindowId, true); + targetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId)); + } + return item; + }; + runAtThisOrScheduleAtNextAnimationFrame = (targetWindow, runner, priority) => { + const targetWindowId = getWindowId(targetWindow); + if (inAnimationFrameRunner.get(targetWindowId)) { + const item = new AnimationFrameQueueItem(runner, priority); + let currentQueue = CURRENT_QUEUE.get(targetWindowId); + if (!currentQueue) { + currentQueue = []; + CURRENT_QUEUE.set(targetWindowId, currentQueue); + } + currentQueue.push(item); + return item; + } + else { + return scheduleAtNextAnimationFrame(targetWindow, runner, priority); + } + }; +})(); +export function getComputedStyle(el) { + return getWindow(el).getComputedStyle(el, null); +} +export function getClientArea(element, fallback) { + const elWindow = getWindow(element); + const elDocument = elWindow.document; + // Try with DOM clientWidth / clientHeight + if (element !== elDocument.body) { + return new Dimension(element.clientWidth, element.clientHeight); + } + // 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 + if (platform.isIOS && elWindow?.visualViewport) { + return new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height); + } + // Try innerWidth / innerHeight + if (elWindow?.innerWidth && elWindow.innerHeight) { + return new Dimension(elWindow.innerWidth, elWindow.innerHeight); + } + // Try with document.body.clientWidth / document.body.clientHeight + if (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) { + return new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight); + } + // Try with document.documentElement.clientWidth / document.documentElement.clientHeight + if (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) { + return new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight); + } + if (fallback) { + return getClientArea(fallback); + } + throw new Error('Unable to figure out browser width and height'); +} +class SizeUtils { + // Adapted from WinJS + // Converts a CSS positioning string for the specified element to pixels. + static convertToPixels(element, value) { + return parseFloat(value) || 0; + } + static getDimension(element, cssPropertyName, jsPropertyName) { + const computedStyle = getComputedStyle(element); + const value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0'; + return SizeUtils.convertToPixels(element, value); + } + static getBorderLeftWidth(element) { + return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth'); + } + static getBorderRightWidth(element) { + return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth'); + } + static getBorderTopWidth(element) { + return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth'); + } + static getBorderBottomWidth(element) { + return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth'); + } + static getPaddingLeft(element) { + return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft'); + } + static getPaddingRight(element) { + return SizeUtils.getDimension(element, 'padding-right', 'paddingRight'); + } + static getPaddingTop(element) { + return SizeUtils.getDimension(element, 'padding-top', 'paddingTop'); + } + static getPaddingBottom(element) { + return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom'); + } + static getMarginLeft(element) { + return SizeUtils.getDimension(element, 'margin-left', 'marginLeft'); + } + static getMarginTop(element) { + return SizeUtils.getDimension(element, 'margin-top', 'marginTop'); + } + static getMarginRight(element) { + return SizeUtils.getDimension(element, 'margin-right', 'marginRight'); + } + static getMarginBottom(element) { + return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom'); + } +} +export class Dimension { + static { this.None = new Dimension(0, 0); } + constructor(width, height) { + this.width = width; + this.height = height; + } + with(width = this.width, height = this.height) { + if (width !== this.width || height !== this.height) { + return new Dimension(width, height); + } + else { + return this; + } + } + static is(obj) { + return typeof obj === 'object' && typeof obj.height === 'number' && typeof obj.width === 'number'; + } + static lift(obj) { + if (obj instanceof Dimension) { + return obj; + } + else { + return new Dimension(obj.width, obj.height); + } + } + static equals(a, b) { + if (a === b) { + return true; + } + if (!a || !b) { + return false; + } + return a.width === b.width && a.height === b.height; + } +} +export function getTopLeftOffset(element) { + // Adapted from WinJS.Utilities.getPosition + // and added borders to the mix + let offsetParent = element.offsetParent; + let top = element.offsetTop; + let left = element.offsetLeft; + while ((element = element.parentNode) !== null + && element !== element.ownerDocument.body + && element !== element.ownerDocument.documentElement) { + top -= element.scrollTop; + const c = isShadowRoot(element) ? null : getComputedStyle(element); + if (c) { + left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft; + } + if (element === offsetParent) { + left += SizeUtils.getBorderLeftWidth(element); + top += SizeUtils.getBorderTopWidth(element); + top += element.offsetTop; + left += element.offsetLeft; + offsetParent = element.offsetParent; + } + } + return { + left: left, + top: top + }; +} +export function size(element, width, height) { + if (typeof width === 'number') { + element.style.width = `${width}px`; + } + if (typeof height === 'number') { + element.style.height = `${height}px`; + } +} +/** + * Returns the position of a dom node relative to the entire page. + */ +export function getDomNodePagePosition(domNode) { + const bb = domNode.getBoundingClientRect(); + const window = getWindow(domNode); + return { + left: bb.left + window.scrollX, + top: bb.top + window.scrollY, + width: bb.width, + height: bb.height + }; +} +/** + * Returns the effective zoom on a given element before window zoom level is applied + */ +export function getDomNodeZoomLevel(domNode) { + let testElement = domNode; + let zoom = 1.0; + do { + const elementZoomLevel = getComputedStyle(testElement).zoom; + if (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') { + zoom *= elementZoomLevel; + } + testElement = testElement.parentElement; + } while (testElement !== null && testElement !== testElement.ownerDocument.documentElement); + return zoom; +} +// Adapted from WinJS +// Gets the width of the element, including margins. +export function getTotalWidth(element) { + const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element); + return element.offsetWidth + margin; +} +export function getContentWidth(element) { + const border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element); + const padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element); + return element.offsetWidth - border - padding; +} +// Adapted from WinJS +// Gets the height of the content of the specified element. The content height does not include borders or padding. +export function getContentHeight(element) { + const border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element); + const padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element); + return element.offsetHeight - border - padding; +} +// Adapted from WinJS +// Gets the height of the element, including its margins. +export function getTotalHeight(element) { + const margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element); + return element.offsetHeight + margin; +} +// ---------------------------------------------------------------------------------------- +export function isAncestor(testChild, testAncestor) { + return Boolean(testAncestor?.contains(testChild)); +} +export function findParentWithClass(node, clazz, stopAtClazzOrNode) { + while (node && node.nodeType === node.ELEMENT_NODE) { + if (node.classList.contains(clazz)) { + return node; + } + if (stopAtClazzOrNode) { + if (typeof stopAtClazzOrNode === 'string') { + if (node.classList.contains(stopAtClazzOrNode)) { + return null; + } + } + else { + if (node === stopAtClazzOrNode) { + return null; + } + } + } + node = node.parentNode; + } + return null; +} +export function hasParentWithClass(node, clazz, stopAtClazzOrNode) { + return !!findParentWithClass(node, clazz, stopAtClazzOrNode); +} +export function isShadowRoot(node) { + return (node && !!node.host && !!node.mode); +} +export function isInShadowDOM(domNode) { + return !!getShadowRoot(domNode); +} +export function getShadowRoot(domNode) { + while (domNode.parentNode) { + if (domNode === domNode.ownerDocument?.body) { + // reached the body + return null; + } + domNode = domNode.parentNode; + } + return isShadowRoot(domNode) ? domNode : null; +} +/** + * Returns the active element across all child windows + * based on document focus. Falls back to the main + * window if no window has focus. + */ +export function getActiveElement() { + let result = getActiveDocument().activeElement; + while (result?.shadowRoot) { + result = result.shadowRoot.activeElement; + } + return result; +} +/** + * Returns true if the focused window active element matches + * the provided element. Falls back to the main window if no + * window has focus. + */ +export function isActiveElement(element) { + return getActiveElement() === element; +} +/** + * Returns true if the focused window active element is contained in + * `ancestor`. Falls back to the main window if no window has focus. + */ +export function isAncestorOfActiveElement(ancestor) { + return isAncestor(getActiveElement(), ancestor); +} +/** + * Returns the active document across main and child windows. + * Prefers the window with focus, otherwise falls back to + * the main windows document. + */ +export function getActiveDocument() { + if (getWindowsCount() <= 1) { + return mainWindow.document; + } + const documents = Array.from(getWindows()).map(({ window }) => window.document); + return documents.find(doc => doc.hasFocus()) ?? mainWindow.document; +} +/** + * Returns the active window across main and child windows. + * Prefers the window with focus, otherwise falls back to + * the main window. + */ +export function getActiveWindow() { + const document = getActiveDocument(); + return (document.defaultView?.window ?? mainWindow); +} +const globalStylesheets = new Map(); +/** + * A version of createStyleSheet which has a unified API to initialize/set the style content. + */ +export function createStyleSheet2() { + return new WrappedStyleElement(); +} +class WrappedStyleElement { + constructor() { + this._currentCssStyle = ''; + this._styleSheet = undefined; + } + setStyle(cssStyle) { + if (cssStyle === this._currentCssStyle) { + return; + } + this._currentCssStyle = cssStyle; + if (!this._styleSheet) { + this._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle); + } + else { + this._styleSheet.innerText = cssStyle; + } + } + dispose() { + if (this._styleSheet) { + this._styleSheet.remove(); + this._styleSheet = undefined; + } + } +} +export function createStyleSheet(container = mainWindow.document.head, beforeAppend, disposableStore) { + const style = document.createElement('style'); + style.type = 'text/css'; + style.media = 'screen'; + beforeAppend?.(style); + container.appendChild(style); + if (disposableStore) { + disposableStore.add(toDisposable(() => style.remove())); + } + // With as container, the stylesheet becomes global and is tracked + // to support auxiliary windows to clone the stylesheet. + if (container === mainWindow.document.head) { + const globalStylesheetClones = new Set(); + globalStylesheets.set(style, globalStylesheetClones); + for (const { window: targetWindow, disposables } of getWindows()) { + if (targetWindow === mainWindow) { + continue; // main window is already tracked + } + const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow)); + disposableStore?.add(cloneDisposable); + } + } + return style; +} +function cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, targetWindow) { + const disposables = new DisposableStore(); + const clone = globalStylesheet.cloneNode(true); + targetWindow.document.head.appendChild(clone); + disposables.add(toDisposable(() => clone.remove())); + for (const rule of getDynamicStyleSheetRules(globalStylesheet)) { + clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length); + } + disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => { + clone.textContent = globalStylesheet.textContent; + })); + globalStylesheetClones.add(clone); + disposables.add(toDisposable(() => globalStylesheetClones.delete(clone))); + return disposables; +} +export const sharedMutationObserver = new class { + constructor() { + this.mutationObservers = new Map(); + } + observe(target, disposables, options) { + let mutationObserversPerTarget = this.mutationObservers.get(target); + if (!mutationObserversPerTarget) { + mutationObserversPerTarget = new Map(); + this.mutationObservers.set(target, mutationObserversPerTarget); + } + const optionsHash = hash(options); + let mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash); + if (!mutationObserverPerOptions) { + const onDidMutate = new event.Emitter(); + const observer = new MutationObserver(mutations => onDidMutate.fire(mutations)); + observer.observe(target, options); + const resolvedMutationObserverPerOptions = mutationObserverPerOptions = { + users: 1, + observer, + onDidMutate: onDidMutate.event + }; + disposables.add(toDisposable(() => { + resolvedMutationObserverPerOptions.users -= 1; + if (resolvedMutationObserverPerOptions.users === 0) { + onDidMutate.dispose(); + observer.disconnect(); + mutationObserversPerTarget?.delete(optionsHash); + if (mutationObserversPerTarget?.size === 0) { + this.mutationObservers.delete(target); + } + } + })); + mutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions); + } + else { + mutationObserverPerOptions.users += 1; + } + return mutationObserverPerOptions.onDidMutate; + } +}; +let _sharedStyleSheet = null; +function getSharedStyleSheet() { + if (!_sharedStyleSheet) { + _sharedStyleSheet = createStyleSheet(); + } + return _sharedStyleSheet; +} +function getDynamicStyleSheetRules(style) { + if (style?.sheet?.rules) { + // Chrome, IE + return style.sheet.rules; + } + if (style?.sheet?.cssRules) { + // FF + return style.sheet.cssRules; + } + return []; +} +export function createCSSRule(selector, cssText, style = getSharedStyleSheet()) { + if (!style || !cssText) { + return; + } + style.sheet?.insertRule(`${selector} {${cssText}}`, 0); + // Apply rule also to all cloned global stylesheets + for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) { + createCSSRule(selector, cssText, clonedGlobalStylesheet); + } +} +export function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) { + if (!style) { + return; + } + const rules = getDynamicStyleSheetRules(style); + const toDelete = []; + for (let i = 0; i < rules.length; i++) { + const rule = rules[i]; + if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) { + toDelete.push(i); + } + } + for (let i = toDelete.length - 1; i >= 0; i--) { + style.sheet?.deleteRule(toDelete[i]); + } + // Remove rules also from all cloned global stylesheets + for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) { + removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet); + } +} +function isCSSStyleRule(rule) { + return typeof rule.selectorText === 'string'; +} +export function isHTMLElement(e) { + // eslint-disable-next-line no-restricted-syntax + return e instanceof HTMLElement || e instanceof getWindow(e).HTMLElement; +} +export function isHTMLAnchorElement(e) { + // eslint-disable-next-line no-restricted-syntax + return e instanceof HTMLAnchorElement || e instanceof getWindow(e).HTMLAnchorElement; +} +export function isSVGElement(e) { + // eslint-disable-next-line no-restricted-syntax + return e instanceof SVGElement || e instanceof getWindow(e).SVGElement; +} +export function isMouseEvent(e) { + // eslint-disable-next-line no-restricted-syntax + return e instanceof MouseEvent || e instanceof getWindow(e).MouseEvent; +} +export function isKeyboardEvent(e) { + // eslint-disable-next-line no-restricted-syntax + return e instanceof KeyboardEvent || e instanceof getWindow(e).KeyboardEvent; +} +export const EventType = { + // Mouse + CLICK: 'click', + AUXCLICK: 'auxclick', + DBLCLICK: 'dblclick', + MOUSE_UP: 'mouseup', + MOUSE_DOWN: 'mousedown', + MOUSE_OVER: 'mouseover', + MOUSE_MOVE: 'mousemove', + MOUSE_OUT: 'mouseout', + MOUSE_ENTER: 'mouseenter', + MOUSE_LEAVE: 'mouseleave', + MOUSE_WHEEL: 'wheel', + POINTER_UP: 'pointerup', + POINTER_DOWN: 'pointerdown', + POINTER_MOVE: 'pointermove', + POINTER_LEAVE: 'pointerleave', + CONTEXT_MENU: 'contextmenu', + WHEEL: 'wheel', + // Keyboard + KEY_DOWN: 'keydown', + KEY_PRESS: 'keypress', + KEY_UP: 'keyup', + // HTML Document + LOAD: 'load', + BEFORE_UNLOAD: 'beforeunload', + UNLOAD: 'unload', + PAGE_SHOW: 'pageshow', + PAGE_HIDE: 'pagehide', + PASTE: 'paste', + ABORT: 'abort', + ERROR: 'error', + RESIZE: 'resize', + SCROLL: 'scroll', + FULLSCREEN_CHANGE: 'fullscreenchange', + WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange', + // Form + SELECT: 'select', + CHANGE: 'change', + SUBMIT: 'submit', + RESET: 'reset', + FOCUS: 'focus', + FOCUS_IN: 'focusin', + FOCUS_OUT: 'focusout', + BLUR: 'blur', + INPUT: 'input', + // Local Storage + STORAGE: 'storage', + // Drag + DRAG_START: 'dragstart', + DRAG: 'drag', + DRAG_ENTER: 'dragenter', + DRAG_LEAVE: 'dragleave', + DRAG_OVER: 'dragover', + DROP: 'drop', + DRAG_END: 'dragend', + // Animation + ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart', + ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend', + ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration' +}; +export function isEventLike(obj) { + const candidate = obj; + return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function'); +} +export const EventHelper = { + stop: (e, cancelBubble) => { + e.preventDefault(); + if (cancelBubble) { + e.stopPropagation(); + } + return e; + } +}; +export function saveParentsScrollTop(node) { + const r = []; + for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) { + r[i] = node.scrollTop; + node = node.parentNode; + } + return r; +} +export function restoreParentsScrollTop(node, state) { + for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) { + if (node.scrollTop !== state[i]) { + node.scrollTop = state[i]; + } + node = node.parentNode; + } +} +class FocusTracker extends Disposable { + static hasFocusWithin(element) { + if (isHTMLElement(element)) { + const shadowRoot = getShadowRoot(element); + const activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement); + return isAncestor(activeElement, element); + } + else { + const window = element; + return isAncestor(window.document.activeElement, window.document); + } + } + constructor(element) { + super(); + this._onDidFocus = this._register(new event.Emitter()); + this.onDidFocus = this._onDidFocus.event; + this._onDidBlur = this._register(new event.Emitter()); + this.onDidBlur = this._onDidBlur.event; + let hasFocus = FocusTracker.hasFocusWithin(element); + let loosingFocus = false; + const onFocus = () => { + loosingFocus = false; + if (!hasFocus) { + hasFocus = true; + this._onDidFocus.fire(); + } + }; + const onBlur = () => { + if (hasFocus) { + loosingFocus = true; + (isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => { + if (loosingFocus) { + loosingFocus = false; + hasFocus = false; + this._onDidBlur.fire(); + } + }, 0); + } + }; + this._refreshStateHandler = () => { + const currentNodeHasFocus = FocusTracker.hasFocusWithin(element); + if (currentNodeHasFocus !== hasFocus) { + if (hasFocus) { + onBlur(); + } + else { + onFocus(); + } + } + }; + this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true)); + this._register(addDisposableListener(element, EventType.BLUR, onBlur, true)); + if (isHTMLElement(element)) { + this._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler())); + this._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler())); + } + } +} +/** + * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants. + * + * @param element The `HTMLElement` or `Window` to track focus changes on. + * @returns An `IFocusTracker` instance. + */ +export function trackFocus(element) { + return new FocusTracker(element); +} +export function after(sibling, child) { + sibling.after(child); + return child; +} +export function append(parent, ...children) { + parent.append(...children); + if (children.length === 1 && typeof children[0] !== 'string') { + return children[0]; + } +} +export function prepend(parent, child) { + parent.insertBefore(child, parent.firstChild); + return child; +} +/** + * Removes all children from `parent` and appends `children` + */ +export function reset(parent, ...children) { + parent.innerText = ''; + append(parent, ...children); +} +const SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/; +export var Namespace; +(function (Namespace) { + Namespace["HTML"] = "http://www.w3.org/1999/xhtml"; + Namespace["SVG"] = "http://www.w3.org/2000/svg"; +})(Namespace || (Namespace = {})); +function _$(namespace, description, attrs, ...children) { + const match = SELECTOR_REGEX.exec(description); + if (!match) { + throw new Error('Bad use of emmet'); + } + const tagName = match[1] || 'div'; + let result; + if (namespace !== Namespace.HTML) { + result = document.createElementNS(namespace, tagName); + } + else { + result = document.createElement(tagName); + } + if (match[3]) { + result.id = match[3]; + } + if (match[4]) { + result.className = match[4].replace(/\./g, ' ').trim(); + } + if (attrs) { + Object.entries(attrs).forEach(([name, value]) => { + if (typeof value === 'undefined') { + return; + } + if (/^on\w+$/.test(name)) { + result[name] = value; + } + else if (name === 'selected') { + if (value) { + result.setAttribute(name, 'true'); + } + } + else { + result.setAttribute(name, value); + } + }); + } + result.append(...children); + return result; +} +export function $(description, attrs, ...children) { + return _$(Namespace.HTML, description, attrs, ...children); +} +$.SVG = function (description, attrs, ...children) { + return _$(Namespace.SVG, description, attrs, ...children); +}; +export function setVisibility(visible, ...elements) { + if (visible) { + show(...elements); + } + else { + hide(...elements); + } +} +export function show(...elements) { + for (const element of elements) { + element.style.display = ''; + element.removeAttribute('aria-hidden'); + } +} +export function hide(...elements) { + for (const element of elements) { + element.style.display = 'none'; + element.setAttribute('aria-hidden', 'true'); + } +} +/** + * Find a value usable for a dom node size such that the likelihood that it would be + * displayed with constant screen pixels size is as high as possible. + * + * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio + * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps" + * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels. + */ +export function computeScreenAwareSize(window, cssPx) { + const screenPx = window.devicePixelRatio * cssPx; + return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio; +} +/** + * Open safely a new window. This is the best way to do so, but you cannot tell + * if the window was opened or if it was blocked by the browser's popup blocker. + * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}. + * + * See https://github.com/microsoft/monaco-editor/issues/601 + * To protect against malicious code in the linked site, particularly phishing attempts, + * the window.opener should be set to null to prevent the linked site from having access + * to change the location of the current page. + * See https://mathiasbynens.github.io/rel-noopener/ + */ +export function windowOpenNoOpener(url) { + // By using 'noopener' in the `windowFeatures` argument, the newly created window will + // not be able to use `window.opener` to reach back to the current page. + // See https://stackoverflow.com/a/46958731 + // See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener + // However, this also doesn't allow us to realize if the browser blocked + // the creation of the window. + mainWindow.open(url, '_blank', 'noopener'); +} +export function animate(targetWindow, fn) { + const step = () => { + fn(); + stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step); + }; + let stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step); + return toDisposable(() => stepDisposable.dispose()); +} +RemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? 'https' : 'http'); +/** + * returns url('...') + */ +export function asCSSUrl(uri) { + if (!uri) { + return `url('')`; + } + return `url('${FileAccess.uriToBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`; +} +export function asCSSPropertyValue(value) { + return `'${value.replace(/'/g, '%27')}'`; +} +export function asCssValueWithDefault(cssPropertyValue, dflt) { + if (cssPropertyValue !== undefined) { + const variableMatch = cssPropertyValue.match(/^\s*var\((.+)\)$/); + if (variableMatch) { + const varArguments = variableMatch[1].split(',', 2); + if (varArguments.length === 2) { + dflt = asCssValueWithDefault(varArguments[1].trim(), dflt); + } + return `var(${varArguments[0]}, ${dflt})`; + } + return cssPropertyValue; + } + return dflt; +} +// -- sanitize and trusted html +/** + * Hooks dompurify using `afterSanitizeAttributes` to check that all `href` and `src` + * attributes are valid. + */ +export function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, allowDataImages = false) { + // https://github.com/cure53/DOMPurify/blob/main/demos/hooks-scheme-allowlist.html + // build an anchor to map URLs to + const anchor = document.createElement('a'); + dompurify.addHook('afterSanitizeAttributes', (node) => { + // check all href/src attributes for validity + for (const attr of ['href', 'src']) { + if (node.hasAttribute(attr)) { + const attrValue = node.getAttribute(attr); + if (attr === 'href' && attrValue.startsWith('#')) { + // Allow fragment links + continue; + } + anchor.href = attrValue; + if (!allowedProtocols.includes(anchor.protocol.replace(/:$/, ''))) { + if (allowDataImages && attr === 'src' && anchor.href.startsWith('data:')) { + continue; + } + node.removeAttribute(attr); + } + } + } + }); + return toDisposable(() => { + dompurify.removeHook('afterSanitizeAttributes'); + }); +} +/** + * List of safe, non-input html tags. + */ +export const basicMarkupHtmlTags = Object.freeze([ + 'a', + 'abbr', + 'b', + 'bdo', + 'blockquote', + 'br', + 'caption', + 'cite', + 'code', + 'col', + 'colgroup', + 'dd', + 'del', + 'details', + 'dfn', + 'div', + 'dl', + 'dt', + 'em', + 'figcaption', + 'figure', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'hr', + 'i', + 'img', + 'input', + 'ins', + 'kbd', + 'label', + 'li', + 'mark', + 'ol', + 'p', + 'pre', + 'q', + 'rp', + 'rt', + 'ruby', + 'samp', + 'small', + 'small', + 'source', + 'span', + 'strike', + 'strong', + 'sub', + 'summary', + 'sup', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'time', + 'tr', + 'tt', + 'u', + 'ul', + 'var', + 'video', + 'wbr', +]); +const defaultDomPurifyConfig = Object.freeze({ + 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'], + 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'], + RETURN_DOM: false, + RETURN_DOM_FRAGMENT: false, + RETURN_TRUSTED_TYPE: true +}); +export class ModifierKeyEmitter extends event.Emitter { + constructor() { + super(); + this._subscriptions = new DisposableStore(); + this._keyStatus = { + altKey: false, + shiftKey: false, + ctrlKey: false, + metaKey: false + }; + this._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions })); + } + registerListeners(window, disposables) { + disposables.add(addDisposableListener(window, 'keydown', e => { + if (e.defaultPrevented) { + return; + } + const event = new StandardKeyboardEvent(e); + // If Alt-key keydown event is repeated, ignore it #112347 + // Only known to be necessary for Alt-Key at the moment #115810 + if (event.keyCode === 6 /* KeyCode.Alt */ && e.repeat) { + return; + } + if (e.altKey && !this._keyStatus.altKey) { + this._keyStatus.lastKeyPressed = 'alt'; + } + else if (e.ctrlKey && !this._keyStatus.ctrlKey) { + this._keyStatus.lastKeyPressed = 'ctrl'; + } + else if (e.metaKey && !this._keyStatus.metaKey) { + this._keyStatus.lastKeyPressed = 'meta'; + } + else if (e.shiftKey && !this._keyStatus.shiftKey) { + this._keyStatus.lastKeyPressed = 'shift'; + } + else if (event.keyCode !== 6 /* KeyCode.Alt */) { + this._keyStatus.lastKeyPressed = undefined; + } + else { + return; + } + this._keyStatus.altKey = e.altKey; + this._keyStatus.ctrlKey = e.ctrlKey; + this._keyStatus.metaKey = e.metaKey; + this._keyStatus.shiftKey = e.shiftKey; + if (this._keyStatus.lastKeyPressed) { + this._keyStatus.event = e; + this.fire(this._keyStatus); + } + }, true)); + disposables.add(addDisposableListener(window, 'keyup', e => { + if (e.defaultPrevented) { + return; + } + if (!e.altKey && this._keyStatus.altKey) { + this._keyStatus.lastKeyReleased = 'alt'; + } + else if (!e.ctrlKey && this._keyStatus.ctrlKey) { + this._keyStatus.lastKeyReleased = 'ctrl'; + } + else if (!e.metaKey && this._keyStatus.metaKey) { + this._keyStatus.lastKeyReleased = 'meta'; + } + else if (!e.shiftKey && this._keyStatus.shiftKey) { + this._keyStatus.lastKeyReleased = 'shift'; + } + else { + this._keyStatus.lastKeyReleased = undefined; + } + if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) { + this._keyStatus.lastKeyPressed = undefined; + } + this._keyStatus.altKey = e.altKey; + this._keyStatus.ctrlKey = e.ctrlKey; + this._keyStatus.metaKey = e.metaKey; + this._keyStatus.shiftKey = e.shiftKey; + if (this._keyStatus.lastKeyReleased) { + this._keyStatus.event = e; + this.fire(this._keyStatus); + } + }, true)); + disposables.add(addDisposableListener(window.document.body, 'mousedown', () => { + this._keyStatus.lastKeyPressed = undefined; + }, true)); + disposables.add(addDisposableListener(window.document.body, 'mouseup', () => { + this._keyStatus.lastKeyPressed = undefined; + }, true)); + disposables.add(addDisposableListener(window.document.body, 'mousemove', e => { + if (e.buttons) { + this._keyStatus.lastKeyPressed = undefined; + } + }, true)); + disposables.add(addDisposableListener(window, 'blur', () => { + this.resetKeyStatus(); + })); + } + get keyStatus() { + return this._keyStatus; + } + /** + * Allows to explicitly reset the key status based on more knowledge (#109062) + */ + resetKeyStatus() { + this.doResetKeyStatus(); + this.fire(this._keyStatus); + } + doResetKeyStatus() { + this._keyStatus = { + altKey: false, + shiftKey: false, + ctrlKey: false, + metaKey: false + }; + } + static getInstance() { + if (!ModifierKeyEmitter.instance) { + ModifierKeyEmitter.instance = new ModifierKeyEmitter(); + } + return ModifierKeyEmitter.instance; + } + dispose() { + super.dispose(); + this._subscriptions.dispose(); + } +} +export class DragAndDropObserver extends Disposable { + constructor(element, callbacks) { + super(); + this.element = element; + this.callbacks = callbacks; + // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE + // calls see https://github.com/microsoft/vscode/issues/14470 + // when the element has child elements where the events are fired + // repeadedly. + this.counter = 0; + // Allows to measure the duration of the drag operation. + this.dragStartTime = 0; + this.registerListeners(); + } + registerListeners() { + if (this.callbacks.onDragStart) { + this._register(addDisposableListener(this.element, EventType.DRAG_START, (e) => { + this.callbacks.onDragStart?.(e); + })); + } + if (this.callbacks.onDrag) { + this._register(addDisposableListener(this.element, EventType.DRAG, (e) => { + this.callbacks.onDrag?.(e); + })); + } + this._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e) => { + this.counter++; + this.dragStartTime = e.timeStamp; + this.callbacks.onDragEnter?.(e); + })); + this._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e) => { + e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + this.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime); + })); + this._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e) => { + this.counter--; + if (this.counter === 0) { + this.dragStartTime = 0; + this.callbacks.onDragLeave?.(e); + } + })); + this._register(addDisposableListener(this.element, EventType.DRAG_END, (e) => { + this.counter = 0; + this.dragStartTime = 0; + this.callbacks.onDragEnd?.(e); + })); + this._register(addDisposableListener(this.element, EventType.DROP, (e) => { + this.counter = 0; + this.dragStartTime = 0; + this.callbacks.onDrop?.(e); + })); + } +} +const H_REGEX = /(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/; +export function h(tag, ...args) { + let attributes; + let children; + if (Array.isArray(args[0])) { + attributes = {}; + children = args[0]; + } + else { + attributes = args[0] || {}; + children = args[1]; + } + const match = H_REGEX.exec(tag); + if (!match || !match.groups) { + throw new Error('Bad use of h'); + } + const tagName = match.groups['tag'] || 'div'; + const el = document.createElement(tagName); + if (match.groups['id']) { + el.id = match.groups['id']; + } + const classNames = []; + if (match.groups['class']) { + for (const className of match.groups['class'].split('.')) { + if (className !== '') { + classNames.push(className); + } + } + } + if (attributes.className !== undefined) { + for (const className of attributes.className.split('.')) { + if (className !== '') { + classNames.push(className); + } + } + } + if (classNames.length > 0) { + el.className = classNames.join(' '); + } + const result = {}; + if (match.groups['name']) { + result[match.groups['name']] = el; + } + if (children) { + for (const c of children) { + if (isHTMLElement(c)) { + el.appendChild(c); + } + else if (typeof c === 'string') { + el.append(c); + } + else if ('root' in c) { + Object.assign(result, c); + el.appendChild(c.root); + } + } + } + for (const [key, value] of Object.entries(attributes)) { + if (key === 'className') { + continue; + } + else if (key === 'style') { + for (const [cssKey, cssValue] of Object.entries(value)) { + el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue); + } + } + else if (key === 'tabIndex') { + el.tabIndex = value; + } + else { + el.setAttribute(camelCaseToHyphenCase(key), value.toString()); + } + } + result['root'] = el; + return result; +} +export function svgElem(tag, ...args) { + let attributes; + let children; + if (Array.isArray(args[0])) { + attributes = {}; + children = args[0]; + } + else { + attributes = args[0] || {}; + children = args[1]; + } + const match = H_REGEX.exec(tag); + if (!match || !match.groups) { + throw new Error('Bad use of h'); + } + const tagName = match.groups['tag'] || 'div'; + const el = document.createElementNS('http://www.w3.org/2000/svg', tagName); + if (match.groups['id']) { + el.id = match.groups['id']; + } + const classNames = []; + if (match.groups['class']) { + for (const className of match.groups['class'].split('.')) { + if (className !== '') { + classNames.push(className); + } + } + } + if (attributes.className !== undefined) { + for (const className of attributes.className.split('.')) { + if (className !== '') { + classNames.push(className); + } + } + } + if (classNames.length > 0) { + el.className = classNames.join(' '); + } + const result = {}; + if (match.groups['name']) { + result[match.groups['name']] = el; + } + if (children) { + for (const c of children) { + if (isHTMLElement(c)) { + el.appendChild(c); + } + else if (typeof c === 'string') { + el.append(c); + } + else if ('root' in c) { + Object.assign(result, c); + el.appendChild(c.root); + } + } + } + for (const [key, value] of Object.entries(attributes)) { + if (key === 'className') { + continue; + } + else if (key === 'style') { + for (const [cssKey, cssValue] of Object.entries(value)) { + el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue); + } + } + else if (key === 'tabIndex') { + el.tabIndex = value; + } + else { + el.setAttribute(camelCaseToHyphenCase(key), value.toString()); + } + } + result['root'] = el; + return result; +} +function camelCaseToHyphenCase(str) { + return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/domObservable.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/domObservable.js new file mode 100644 index 0000000000000000000000000000000000000000..bfabfde41488560637f3ff535ff96ee7565ea51e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/domObservable.js @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { createStyleSheet2 } from './dom.js'; +import { DisposableStore } from '../common/lifecycle.js'; +import { autorun } from '../common/observable.js'; +export function createStyleSheetFromObservable(css) { + const store = new DisposableStore(); + const w = store.add(createStyleSheet2()); + store.add(autorun(reader => { + w.setStyle(css.read(reader)); + })); + return store; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js new file mode 100644 index 0000000000000000000000000000000000000000..38362cbbac7e66c00cb4407a8b87c4c9f48d7498 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js @@ -0,0 +1,1569 @@ +/*! @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 */ + +const { + entries, + setPrototypeOf, + isFrozen, + getPrototypeOf, + getOwnPropertyDescriptor +} = Object; +let { + freeze, + seal, + create +} = Object; // eslint-disable-line import/no-mutable-exports +let { + apply, + construct +} = typeof Reflect !== 'undefined' && Reflect; +if (!freeze) { + freeze = function freeze(x) { + return x; + }; +} +if (!seal) { + seal = function seal(x) { + return x; + }; +} +if (!apply) { + apply = function apply(fun, thisValue, args) { + return fun.apply(thisValue, args); + }; +} +if (!construct) { + construct = function construct(Func, args) { + return new Func(...args); + }; +} +const arrayForEach = unapply(Array.prototype.forEach); +const arrayPop = unapply(Array.prototype.pop); +const arrayPush = unapply(Array.prototype.push); +const stringToLowerCase = unapply(String.prototype.toLowerCase); +const stringToString = unapply(String.prototype.toString); +const stringMatch = unapply(String.prototype.match); +const stringReplace = unapply(String.prototype.replace); +const stringIndexOf = unapply(String.prototype.indexOf); +const stringTrim = unapply(String.prototype.trim); +const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty); +const regExpTest = unapply(RegExp.prototype.test); +const typeErrorCreate = unconstruct(TypeError); + +/** + * Creates a new function that calls the given function with a specified thisArg and arguments. + * + * @param {Function} func - The function to be wrapped and called. + * @returns {Function} A new function that calls the given function with a specified thisArg and arguments. + */ +function unapply(func) { + return function (thisArg) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + return apply(func, thisArg, args); + }; +} + +/** + * Creates a new function that constructs an instance of the given constructor function with the provided arguments. + * + * @param {Function} func - The constructor function to be wrapped and called. + * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments. + */ +function unconstruct(func) { + return function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + return construct(func, args); + }; +} + +/** + * Add properties to a lookup table + * + * @param {Object} set - The set to which elements will be added. + * @param {Array} array - The array containing elements to be added to the set. + * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set. + * @returns {Object} The modified set with added elements. + */ +function addToSet(set, array) { + let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase; + if (setPrototypeOf) { + // Make 'in' and truthy checks like Boolean(set.constructor) + // independent of any properties defined on Object.prototype. + // Prevent prototype setters from intercepting set as a this value. + setPrototypeOf(set, null); + } + let l = array.length; + while (l--) { + let element = array[l]; + if (typeof element === 'string') { + const lcElement = transformCaseFunc(element); + if (lcElement !== element) { + // Config presets (e.g. tags.js, attrs.js) are immutable. + if (!isFrozen(array)) { + array[l] = lcElement; + } + element = lcElement; + } + } + set[element] = true; + } + return set; +} + +/** + * Clean up an array to harden against CSPP + * + * @param {Array} array - The array to be cleaned. + * @returns {Array} The cleaned version of the array + */ +function cleanArray(array) { + for (let index = 0; index < array.length; index++) { + const isPropertyExist = objectHasOwnProperty(array, index); + if (!isPropertyExist) { + array[index] = null; + } + } + return array; +} + +/** + * Shallow clone an object + * + * @param {Object} object - The object to be cloned. + * @returns {Object} A new object that copies the original. + */ +function clone(object) { + const newObject = create(null); + for (const [property, value] of entries(object)) { + const isPropertyExist = objectHasOwnProperty(object, property); + if (isPropertyExist) { + if (Array.isArray(value)) { + newObject[property] = cleanArray(value); + } else if (value && typeof value === 'object' && value.constructor === Object) { + newObject[property] = clone(value); + } else { + newObject[property] = value; + } + } + } + return newObject; +} + +/** + * This method automatically checks if the prop is function or getter and behaves accordingly. + * + * @param {Object} object - The object to look up the getter function in its prototype chain. + * @param {String} prop - The property name for which to find the getter function. + * @returns {Function} The getter function found in the prototype chain or a fallback function. + */ +function lookupGetter(object, prop) { + while (object !== null) { + const desc = getOwnPropertyDescriptor(object, prop); + if (desc) { + if (desc.get) { + return unapply(desc.get); + } + if (typeof desc.value === 'function') { + return unapply(desc.value); + } + } + object = getPrototypeOf(object); + } + function fallbackValue() { + return null; + } + return fallbackValue; +} + +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']); + +// SVG +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']); +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']); + +// List of SVG elements that are disallowed by default. +// We still need to know them so that we can do namespace +// checks properly in case one wants to add them to +// allow-list. +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']); +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']); + +// Similarly to SVG, we want to know all MathML elements, +// even those that we disallow by default. +const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); +const text = freeze(['#text']); + +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']); +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']); +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']); +const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); + +// eslint-disable-next-line unicorn/better-regex +const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode +const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); +const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); +const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape +const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape +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 +); +const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); +const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex +); +const DOCTYPE_NAME = seal(/^html$/i); +const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i); + +var EXPRESSIONS = /*#__PURE__*/Object.freeze({ + __proto__: null, + MUSTACHE_EXPR: MUSTACHE_EXPR, + ERB_EXPR: ERB_EXPR, + TMPLIT_EXPR: TMPLIT_EXPR, + DATA_ATTR: DATA_ATTR, + ARIA_ATTR: ARIA_ATTR, + IS_ALLOWED_URI: IS_ALLOWED_URI, + IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA, + ATTR_WHITESPACE: ATTR_WHITESPACE, + DOCTYPE_NAME: DOCTYPE_NAME, + CUSTOM_ELEMENT: CUSTOM_ELEMENT +}); + +// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType +const NODE_TYPE = { + element: 1, + attribute: 2, + text: 3, + cdataSection: 4, + entityReference: 5, + // Deprecated + entityNode: 6, + // Deprecated + progressingInstruction: 7, + comment: 8, + document: 9, + documentType: 10, + documentFragment: 11, + notation: 12 // Deprecated +}; +const getGlobal = function getGlobal() { + return typeof window === 'undefined' ? null : window; +}; + +/** + * Creates a no-op policy for internal use only. + * Don't export this function outside this module! + * @param {TrustedTypePolicyFactory} trustedTypes The policy factory. + * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix). + * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types + * are not supported or creating the policy failed). + */ +const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) { + if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') { + return null; + } + + // Allow the callers to control the unique policy name + // by adding a data-tt-policy-suffix to the script element with the DOMPurify. + // Policy creation with duplicate names throws in Trusted Types. + let suffix = null; + const ATTR_NAME = 'data-tt-policy-suffix'; + if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) { + suffix = purifyHostElement.getAttribute(ATTR_NAME); + } + const policyName = 'dompurify' + (suffix ? '#' + suffix : ''); + try { + return trustedTypes.createPolicy(policyName, { + createHTML(html) { + return html; + }, + createScriptURL(scriptUrl) { + return scriptUrl; + } + }); + } catch (_) { + // Policy creation failed (most likely another DOMPurify script has + // already run). Skip creating the policy, as this will only cause errors + // if TT are enforced. + console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); + return null; + } +}; +function createDOMPurify() { + let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); + const DOMPurify = root => createDOMPurify(root); + + /** + * Version label, exposed for easier checks + * if DOMPurify is up to date or not + */ + DOMPurify.version = '3.1.7'; + + /** + * Array of elements that DOMPurify removed during sanitation. + * Empty if nothing was removed. + */ + DOMPurify.removed = []; + if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) { + // Not running in a browser, provide a factory function + // so that you can pass your own Window + DOMPurify.isSupported = false; + return DOMPurify; + } + let { + document + } = window; + const originalDocument = document; + const currentScript = originalDocument.currentScript; + const { + DocumentFragment, + HTMLTemplateElement, + Node, + Element, + NodeFilter, + NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap, + HTMLFormElement, + DOMParser, + trustedTypes + } = window; + const ElementPrototype = Element.prototype; + const cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); + const remove = lookupGetter(ElementPrototype, 'remove'); + const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); + const getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); + const getParentNode = lookupGetter(ElementPrototype, 'parentNode'); + + // As per issue #47, the web-components registry is inherited by a + // new document created via createHTMLDocument. As per the spec + // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) + // a new empty registry is used when creating a template contents owner + // document, so we use that as our parent document to ensure nothing + // is inherited. + if (typeof HTMLTemplateElement === 'function') { + const template = document.createElement('template'); + if (template.content && template.content.ownerDocument) { + document = template.content.ownerDocument; + } + } + let trustedTypesPolicy; + let emptyHTML = ''; + const { + implementation, + createNodeIterator, + createDocumentFragment, + getElementsByTagName + } = document; + const { + importNode + } = originalDocument; + let hooks = {}; + + /** + * Expose whether this browser supports running the full DOMPurify. + */ + DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined; + const { + MUSTACHE_EXPR, + ERB_EXPR, + TMPLIT_EXPR, + DATA_ATTR, + ARIA_ATTR, + IS_SCRIPT_OR_DATA, + ATTR_WHITESPACE, + CUSTOM_ELEMENT + } = EXPRESSIONS; + let { + IS_ALLOWED_URI: IS_ALLOWED_URI$1 + } = EXPRESSIONS; + + /** + * We consider the elements and attributes below to be safe. Ideally + * don't add any new ones but feel free to remove unwanted ones. + */ + + /* allowed element names */ + let ALLOWED_TAGS = null; + const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]); + + /* Allowed attribute names */ + let ALLOWED_ATTR = null; + const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]); + + /* + * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. + * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) + * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) + * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. + */ + let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { + tagNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + attributeNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + allowCustomizedBuiltInElements: { + writable: true, + configurable: false, + enumerable: true, + value: false + } + })); + + /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ + let FORBID_TAGS = null; + + /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ + let FORBID_ATTR = null; + + /* Decide if ARIA attributes are okay */ + let ALLOW_ARIA_ATTR = true; + + /* Decide if custom data attributes are okay */ + let ALLOW_DATA_ATTR = true; + + /* Decide if unknown protocols are okay */ + let ALLOW_UNKNOWN_PROTOCOLS = false; + + /* Decide if self-closing tags in attributes are allowed. + * Usually removed due to a mXSS issue in jQuery 3.0 */ + let ALLOW_SELF_CLOSE_IN_ATTR = true; + + /* Output should be safe for common template engines. + * This means, DOMPurify removes data attributes, mustaches and ERB + */ + let SAFE_FOR_TEMPLATES = false; + + /* Output should be safe even for XML used within HTML and alike. + * This means, DOMPurify removes comments when containing risky content. + */ + let SAFE_FOR_XML = true; + + /* Decide if document with ... should be returned */ + let WHOLE_DOCUMENT = false; + + /* Track whether config is already set on this instance of DOMPurify. */ + let SET_CONFIG = false; + + /* Decide if all elements (e.g. style, script) must be children of + * document.body. By default, browsers might move them to document.head */ + let FORCE_BODY = false; + + /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported). + * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead + */ + let RETURN_DOM = false; + + /* Decide if a DOM `DocumentFragment` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported) */ + let RETURN_DOM_FRAGMENT = false; + + /* Try to return a Trusted Type object instead of a string, return a string in + * case Trusted Types are not supported */ + let RETURN_TRUSTED_TYPE = false; + + /* Output should be free from DOM clobbering attacks? + * This sanitizes markups named with colliding, clobberable built-in DOM APIs. + */ + let SANITIZE_DOM = true; + + /* Achieve full DOM Clobbering protection by isolating the namespace of named + * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules. + * + * HTML/DOM spec rules that enable DOM Clobbering: + * - Named Access on Window (§7.3.3) + * - DOM Tree Accessors (§3.1.5) + * - Form Element Parent-Child Relations (§4.10.3) + * - Iframe srcdoc / Nested WindowProxies (§4.8.5) + * - HTMLCollection (§4.2.10.2) + * + * Namespace isolation is implemented by prefixing `id` and `name` attributes + * with a constant string, i.e., `user-content-` + */ + let SANITIZE_NAMED_PROPS = false; + const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-'; + + /* Keep element content when removing element? */ + let KEEP_CONTENT = true; + + /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead + * of importing it into a new Document and returning a sanitized copy */ + let IN_PLACE = false; + + /* Allow usage of profiles like html, svg and mathMl */ + let USE_PROFILES = {}; + + /* Tags to ignore content of when KEEP_CONTENT is true */ + let FORBID_CONTENTS = null; + 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']); + + /* Tags that are safe for data: URIs */ + let DATA_URI_TAGS = null; + const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); + + /* Attributes safe for values like "javascript:" */ + let URI_SAFE_ATTRIBUTES = null; + const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); + const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; + const SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; + const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; + /* Document namespace */ + let NAMESPACE = HTML_NAMESPACE; + let IS_EMPTY_INPUT = false; + + /* Allowed XHTML+XML namespaces */ + let ALLOWED_NAMESPACES = null; + const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); + + /* Parsing of strict XHTML documents */ + let PARSER_MEDIA_TYPE = null; + const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; + const DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; + let transformCaseFunc = null; + + /* Keep a reference to config to pass to hooks */ + let CONFIG = null; + + /* Ideally, do not touch anything below this line */ + /* ______________________________________________ */ + + const formElement = document.createElement('form'); + const isRegexOrFunction = function isRegexOrFunction(testValue) { + return testValue instanceof RegExp || testValue instanceof Function; + }; + + /** + * _parseConfig + * + * @param {Object} cfg optional config literal + */ + // eslint-disable-next-line complexity + const _parseConfig = function _parseConfig() { + let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + if (CONFIG && CONFIG === cfg) { + return; + } + + /* Shield configuration object from tampering */ + if (!cfg || typeof cfg !== 'object') { + cfg = {}; + } + + /* Shield configuration object from prototype pollution */ + cfg = clone(cfg); + PARSER_MEDIA_TYPE = + // eslint-disable-next-line unicorn/prefer-includes + SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE; + + // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. + transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase; + + /* Set configuration parameters */ + ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; + ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; + ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; + URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), + // eslint-disable-line indent + cfg.ADD_URI_SAFE_ATTR, + // eslint-disable-line indent + transformCaseFunc // eslint-disable-line indent + ) // eslint-disable-line indent + : DEFAULT_URI_SAFE_ATTRIBUTES; + DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), + // eslint-disable-line indent + cfg.ADD_DATA_URI_TAGS, + // eslint-disable-line indent + transformCaseFunc // eslint-disable-line indent + ) // eslint-disable-line indent + : DEFAULT_DATA_URI_TAGS; + FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; + FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; + FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; + USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false; + ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true + ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true + ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false + ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true + SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false + SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true + WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false + RETURN_DOM = cfg.RETURN_DOM || false; // Default false + RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false + RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false + FORCE_BODY = cfg.FORCE_BODY || false; // Default false + SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true + SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false + KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true + IN_PLACE = cfg.IN_PLACE || false; // Default false + IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; + NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; + CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { + CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; + } + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { + CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; + } + if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { + CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; + } + if (SAFE_FOR_TEMPLATES) { + ALLOW_DATA_ATTR = false; + } + if (RETURN_DOM_FRAGMENT) { + RETURN_DOM = true; + } + + /* Parse profile info */ + if (USE_PROFILES) { + ALLOWED_TAGS = addToSet({}, text); + ALLOWED_ATTR = []; + if (USE_PROFILES.html === true) { + addToSet(ALLOWED_TAGS, html$1); + addToSet(ALLOWED_ATTR, html); + } + if (USE_PROFILES.svg === true) { + addToSet(ALLOWED_TAGS, svg$1); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.svgFilters === true) { + addToSet(ALLOWED_TAGS, svgFilters); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.mathMl === true) { + addToSet(ALLOWED_TAGS, mathMl$1); + addToSet(ALLOWED_ATTR, mathMl); + addToSet(ALLOWED_ATTR, xml); + } + } + + /* Merge configuration parameters */ + if (cfg.ADD_TAGS) { + if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { + ALLOWED_TAGS = clone(ALLOWED_TAGS); + } + addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); + } + if (cfg.ADD_ATTR) { + if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { + ALLOWED_ATTR = clone(ALLOWED_ATTR); + } + addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); + } + if (cfg.ADD_URI_SAFE_ATTR) { + addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); + } + if (cfg.FORBID_CONTENTS) { + if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { + FORBID_CONTENTS = clone(FORBID_CONTENTS); + } + addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); + } + + /* Add #text in case KEEP_CONTENT is set to true */ + if (KEEP_CONTENT) { + ALLOWED_TAGS['#text'] = true; + } + + /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ + if (WHOLE_DOCUMENT) { + addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); + } + + /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ + if (ALLOWED_TAGS.table) { + addToSet(ALLOWED_TAGS, ['tbody']); + delete FORBID_TAGS.tbody; + } + if (cfg.TRUSTED_TYPES_POLICY) { + if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') { + throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); + } + if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') { + throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); + } + + // Overwrite existing TrustedTypes policy. + trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; + + // Sign local variables required by `sanitize`. + emptyHTML = trustedTypesPolicy.createHTML(''); + } else { + // Uninitialized policy, attempt to initialize the internal dompurify policy. + if (trustedTypesPolicy === undefined) { + trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); + } + + // If creating the internal policy succeeded sign internal variables. + if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') { + emptyHTML = trustedTypesPolicy.createHTML(''); + } + } + + // Prevent further manipulation of configuration. + // Not available in IE8, Safari 5, etc. + if (freeze) { + freeze(cfg); + } + CONFIG = cfg; + }; + const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); + const HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']); + + // Certain elements are allowed in both SVG and HTML + // namespace. We need to specify them explicitly + // so that they don't get erroneously deleted from + // HTML namespace. + const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); + + /* Keep track of all possible SVG and MathML tags + * so that we can perform the namespace checks + * correctly. */ + const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]); + const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]); + + /** + * @param {Element} element a DOM element whose namespace is being checked + * @returns {boolean} Return false if the element has a + * namespace that a spec-compliant parser would never + * return. Return true otherwise. + */ + const _checkValidNamespace = function _checkValidNamespace(element) { + let parent = getParentNode(element); + + // In JSDOM, if we're inside shadow DOM, then parentNode + // can be null. We just simulate parent in this case. + if (!parent || !parent.tagName) { + parent = { + namespaceURI: NAMESPACE, + tagName: 'template' + }; + } + const tagName = stringToLowerCase(element.tagName); + const parentTagName = stringToLowerCase(parent.tagName); + if (!ALLOWED_NAMESPACES[element.namespaceURI]) { + return false; + } + if (element.namespaceURI === SVG_NAMESPACE) { + // The only way to switch from HTML namespace to SVG + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'svg'; + } + + // The only way to switch from MathML to SVG is via` + // svg if parent is either or MathML + // text integration points. + if (parent.namespaceURI === MATHML_NAMESPACE) { + return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); + } + + // We only allow elements that are defined in SVG + // spec. All others are disallowed in SVG namespace. + return Boolean(ALL_SVG_TAGS[tagName]); + } + if (element.namespaceURI === MATHML_NAMESPACE) { + // The only way to switch from HTML namespace to MathML + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'math'; + } + + // The only way to switch from SVG to MathML is via + // and HTML integration points + if (parent.namespaceURI === SVG_NAMESPACE) { + return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; + } + + // We only allow elements that are defined in MathML + // spec. All others are disallowed in MathML namespace. + return Boolean(ALL_MATHML_TAGS[tagName]); + } + if (element.namespaceURI === HTML_NAMESPACE) { + // The only way to switch from SVG to HTML is via + // HTML integration points, and from MathML to HTML + // is via MathML text integration points + if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { + return false; + } + if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { + return false; + } + + // We disallow tags that are specific for MathML + // or SVG and should never appear in HTML namespace + return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); + } + + // For XHTML and XML documents that support custom namespaces + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) { + return true; + } + + // The code should never reach this place (this means + // that the element somehow got namespace that is not + // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES). + // Return false just in case. + return false; + }; + + /** + * _forceRemove + * + * @param {Node} node a DOM node + */ + const _forceRemove = function _forceRemove(node) { + arrayPush(DOMPurify.removed, { + element: node + }); + try { + // eslint-disable-next-line unicorn/prefer-dom-node-remove + getParentNode(node).removeChild(node); + } catch (_) { + remove(node); + } + }; + + /** + * _removeAttribute + * + * @param {String} name an Attribute name + * @param {Node} node a DOM node + */ + const _removeAttribute = function _removeAttribute(name, node) { + try { + arrayPush(DOMPurify.removed, { + attribute: node.getAttributeNode(name), + from: node + }); + } catch (_) { + arrayPush(DOMPurify.removed, { + attribute: null, + from: node + }); + } + node.removeAttribute(name); + + // We void attribute values for unremovable "is"" attributes + if (name === 'is' && !ALLOWED_ATTR[name]) { + if (RETURN_DOM || RETURN_DOM_FRAGMENT) { + try { + _forceRemove(node); + } catch (_) { } + } else { + try { + node.setAttribute(name, ''); + } catch (_) { } + } + } + }; + + /** + * _initDocument + * + * @param {String} dirty a string of dirty markup + * @return {Document} a DOM, filled with the dirty markup + */ + const _initDocument = function _initDocument(dirty) { + /* Create a HTML document */ + let doc = null; + let leadingWhitespace = null; + if (FORCE_BODY) { + dirty = '' + dirty; + } else { + /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ + const matches = stringMatch(dirty, /^[\r\n\t ]+/); + leadingWhitespace = matches && matches[0]; + } + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) { + // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) + dirty = '' + dirty + ''; + } + const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; + /* + * Use the DOMParser API by default, fallback later if needs be + * DOMParser not work for svg when has multiple root element. + */ + if (NAMESPACE === HTML_NAMESPACE) { + try { + doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); + } catch (_) { } + } + + /* Use createHTMLDocument in case DOMParser is not available */ + if (!doc || !doc.documentElement) { + doc = implementation.createDocument(NAMESPACE, 'template', null); + try { + doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; + } catch (_) { + // Syntax error if dirtyPayload is invalid xml + } + } + const body = doc.body || doc.documentElement; + if (dirty && leadingWhitespace) { + body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); + } + + /* Work on whole document or just its body */ + if (NAMESPACE === HTML_NAMESPACE) { + return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; + } + return WHOLE_DOCUMENT ? doc.documentElement : body; + }; + + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * + * @param {Node} root The root element or node to start traversing on. + * @return {NodeIterator} The created NodeIterator + */ + const _createNodeIterator = function _createNodeIterator(root) { + return createNodeIterator.call(root.ownerDocument || root, root, + // eslint-disable-next-line no-bitwise + NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null); + }; + + /** + * _isClobbered + * + * @param {Node} elm element to check for clobbering attacks + * @return {Boolean} true if clobbered, false if safe + */ + const _isClobbered = function _isClobbered(elm) { + 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'); + }; + + /** + * Checks whether the given object is a DOM node. + * + * @param {Node} object object to check whether it's a DOM node + * @return {Boolean} true is object is a DOM node + */ + const _isNode = function _isNode(object) { + return typeof Node === 'function' && object instanceof Node; + }; + + /** + * _executeHook + * Execute user configurable hooks + * + * @param {String} entryPoint Name of the hook's entry point + * @param {Node} currentNode node to work on with the hook + * @param {Object} data additional hook parameters + */ + const _executeHook = function _executeHook(entryPoint, currentNode, data) { + if (!hooks[entryPoint]) { + return; + } + arrayForEach(hooks[entryPoint], hook => { + hook.call(DOMPurify, currentNode, data, CONFIG); + }); + }; + + /** + * _sanitizeElements + * + * @protect nodeName + * @protect textContent + * @protect removeChild + * + * @param {Node} currentNode to check for permission to exist + * @return {Boolean} true if node was killed, false if left alive + */ + const _sanitizeElements = function _sanitizeElements(currentNode) { + let content = null; + + /* Execute a hook if present */ + _executeHook('beforeSanitizeElements', currentNode, null); + + /* Check if element is clobbered or can clobber */ + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + return true; + } + + /* Now let's check the element's type and name */ + const tagName = transformCaseFunc(currentNode.nodeName); + + /* Execute a hook if present */ + _executeHook('uponSanitizeElement', currentNode, { + tagName, + allowedTags: ALLOWED_TAGS + }); + + /* Detect mXSS attempts abusing namespace confusion */ + if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { + _forceRemove(currentNode); + return true; + } + + /* Remove any occurrence of processing instructions */ + if (currentNode.nodeType === NODE_TYPE.progressingInstruction) { + _forceRemove(currentNode); + return true; + } + + /* Remove any kind of possibly harmful comments */ + if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) { + _forceRemove(currentNode); + return true; + } + + /* Remove element if anything forbids its presence */ + if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { + /* Check if we have a custom element to handle */ + if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { + if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) { + return false; + } + if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) { + return false; + } + } + + /* Keep content except for bad-listed elements */ + if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { + const parentNode = getParentNode(currentNode) || currentNode.parentNode; + const childNodes = getChildNodes(currentNode) || currentNode.childNodes; + if (childNodes && parentNode) { + const childCount = childNodes.length; + for (let i = childCount - 1; i >= 0; --i) { + const childClone = cloneNode(childNodes[i], true); + childClone.__removalCount = (currentNode.__removalCount || 0) + 1; + parentNode.insertBefore(childClone, getNextSibling(currentNode)); + } + } + } + _forceRemove(currentNode); + return true; + } + + /* Check whether element has a valid namespace */ + if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) { + _forceRemove(currentNode); + return true; + } + + /* Make sure that older browsers don't get fallback-tag mXSS */ + if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { + _forceRemove(currentNode); + return true; + } + + /* Sanitize element content to be template-safe */ + if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) { + /* Get the element's text content */ + content = currentNode.textContent; + arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => { + content = stringReplace(content, expr, ' '); + }); + if (currentNode.textContent !== content) { + arrayPush(DOMPurify.removed, { + element: currentNode.cloneNode() + }); + currentNode.textContent = content; + } + } + + /* Execute a hook if present */ + _executeHook('afterSanitizeElements', currentNode, null); + return false; + }; + + /** + * _isValidAttribute + * + * @param {string} lcTag Lowercase tag name of containing element. + * @param {string} lcName Lowercase attribute name. + * @param {string} value Attribute value. + * @return {Boolean} Returns true if `value` is valid, otherwise false. + */ + // eslint-disable-next-line complexity + const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) { + /* Make sure attribute cannot clobber */ + if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) { + return false; + } + + /* Allow valid data-* attributes: At least one character after "-" + (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes) + XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804) + We don't need to check the value; it's always URI safe. */ + 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]) { + if ( + // First condition does a very basic check if a) it's basically a valid custom element tagname AND + // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck + // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck + _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)) || + // Alternative, second condition checks if it's an `is`-attribute, AND + // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck + 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 { + return false; + } + /* Check value is safe. First, is attr inert? If so, is safe */ + } 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) { + return false; + } else; + return true; + }; + + /** + * _isBasicCustomElement + * checks if at least one dash is included in tagName, and it's not the first char + * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name + * + * @param {string} tagName name of the tag of the node to sanitize + * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false. + */ + const _isBasicCustomElement = function _isBasicCustomElement(tagName) { + return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT); + }; + + /** + * _sanitizeAttributes + * + * @protect attributes + * @protect nodeName + * @protect removeAttribute + * @protect setAttribute + * + * @param {Node} currentNode to sanitize + */ + const _sanitizeAttributes = function _sanitizeAttributes(currentNode) { + /* Execute a hook if present */ + _executeHook('beforeSanitizeAttributes', currentNode, null); + const { + attributes + } = currentNode; + + /* Check if we have attributes; if not we might have a text node */ + if (!attributes) { + return; + } + const hookEvent = { + attrName: '', + attrValue: '', + keepAttr: true, + allowedAttributes: ALLOWED_ATTR + }; + let l = attributes.length; + + /* Go backwards over all attributes; safely remove bad ones */ + while (l--) { + const attr = attributes[l]; + const { + name, + namespaceURI, + value: attrValue + } = attr; + const lcName = transformCaseFunc(name); + let value = name === 'value' ? attrValue : stringTrim(attrValue); + + /* Execute a hook if present */ + hookEvent.attrName = lcName; + hookEvent.attrValue = value; + hookEvent.keepAttr = true; + hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set + _executeHook('uponSanitizeAttribute', currentNode, hookEvent); + value = hookEvent.attrValue; + + /* Did the hooks approve of the attribute? */ + if (hookEvent.forceKeepAttr) { + continue; + } + + /* Remove attribute */ + _removeAttribute(name, currentNode); + + /* Did the hooks approve of the attribute? */ + if (!hookEvent.keepAttr) { + continue; + } + + /* Work around a security issue in jQuery 3.0 */ + if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { + _removeAttribute(name, currentNode); + continue; + } + + /* Sanitize attribute content to be template-safe */ + if (SAFE_FOR_TEMPLATES) { + arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => { + value = stringReplace(value, expr, ' '); + }); + } + + /* Is `value` valid for this attribute? */ + const lcTag = transformCaseFunc(currentNode.nodeName); + if (!_isValidAttribute(lcTag, lcName, value)) { + continue; + } + + /* Full DOM Clobbering protection via namespace isolation, + * Prefix id and name attributes with `user-content-` + */ + if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) { + // Remove the attribute with this value + _removeAttribute(name, currentNode); + + // Prefix the value and later re-create the attribute with the sanitized value + value = SANITIZE_NAMED_PROPS_PREFIX + value; + } + + /* Work around a security issue with comments inside attributes */ + if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) { + _removeAttribute(name, currentNode); + continue; + } + + /* Handle attributes that require Trusted Types */ + if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') { + if (namespaceURI); else { + switch (trustedTypes.getAttributeType(lcTag, lcName)) { + case 'TrustedHTML': + { + value = trustedTypesPolicy.createHTML(value); + break; + } + case 'TrustedScriptURL': + { + value = trustedTypesPolicy.createScriptURL(value); + break; + } + } + } + } + + /* Handle invalid data-* attribute set by try-catching it */ + try { + if (namespaceURI) { + currentNode.setAttributeNS(namespaceURI, name, value); + } else { + /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */ + currentNode.setAttribute(name, value); + } + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + } else { + arrayPop(DOMPurify.removed); + } + } catch (_) { } + } + + /* Execute a hook if present */ + _executeHook('afterSanitizeAttributes', currentNode, null); + }; + + /** + * _sanitizeShadowDOM + * + * @param {DocumentFragment} fragment to iterate over recursively + */ + const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) { + let shadowNode = null; + const shadowIterator = _createNodeIterator(fragment); + + /* Execute a hook if present */ + _executeHook('beforeSanitizeShadowDOM', fragment, null); + while (shadowNode = shadowIterator.nextNode()) { + /* Execute a hook if present */ + _executeHook('uponSanitizeShadowNode', shadowNode, null); + + /* Sanitize tags and elements */ + if (_sanitizeElements(shadowNode)) { + continue; + } + + /* Deep shadow DOM detected */ + if (shadowNode.content instanceof DocumentFragment) { + _sanitizeShadowDOM(shadowNode.content); + } + + /* Check attributes, sanitize if necessary */ + _sanitizeAttributes(shadowNode); + } + + /* Execute a hook if present */ + _executeHook('afterSanitizeShadowDOM', fragment, null); + }; + + /** + * Sanitize + * Public method providing core sanitation functionality + * + * @param {String|Node} dirty string or DOM node + * @param {Object} cfg object + */ + // eslint-disable-next-line complexity + DOMPurify.sanitize = function (dirty) { + let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let body = null; + let importedNode = null; + let currentNode = null; + let returnNode = null; + /* Make sure we have a string to sanitize. + DO NOT return early, as this will return the wrong type if + the user has requested a DOM object rather than a string */ + IS_EMPTY_INPUT = !dirty; + if (IS_EMPTY_INPUT) { + dirty = ''; + } + + /* Stringify, in case dirty is an object */ + if (typeof dirty !== 'string' && !_isNode(dirty)) { + if (typeof dirty.toString === 'function') { + dirty = dirty.toString(); + if (typeof dirty !== 'string') { + throw typeErrorCreate('dirty is not a string, aborting'); + } + } else { + throw typeErrorCreate('toString is not a function'); + } + } + + /* Return dirty HTML if DOMPurify cannot run */ + if (!DOMPurify.isSupported) { + return dirty; + } + + /* Assign config vars */ + if (!SET_CONFIG) { + _parseConfig(cfg); + } + + /* Clean up removed elements */ + DOMPurify.removed = []; + + /* Check if dirty is correctly typed for IN_PLACE */ + if (typeof dirty === 'string') { + IN_PLACE = false; + } + if (IN_PLACE) { + /* Do some early pre-sanitization to avoid unsafe root nodes */ + if (dirty.nodeName) { + const tagName = transformCaseFunc(dirty.nodeName); + if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { + throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place'); + } + } + } else if (dirty instanceof Node) { + /* If dirty is a DOM element, append to an empty document to avoid + elements being stripped by the parser */ + body = _initDocument(''); + importedNode = body.ownerDocument.importNode(dirty, true); + if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') { + /* Node is already a body, use as is */ + body = importedNode; + } else if (importedNode.nodeName === 'HTML') { + body = importedNode; + } else { + // eslint-disable-next-line unicorn/prefer-dom-node-append + body.appendChild(importedNode); + } + } else { + /* Exit directly if we have nothing to do */ + if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && + // eslint-disable-next-line unicorn/prefer-includes + dirty.indexOf('<') === -1) { + return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; + } + + /* Initialize the document to work on */ + body = _initDocument(dirty); + + /* Check we have a DOM node from the data */ + if (!body) { + return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ''; + } + } + + /* Remove first element node (ours) if FORCE_BODY is set */ + if (body && FORCE_BODY) { + _forceRemove(body.firstChild); + } + + /* Get node iterator */ + const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); + + /* Now start iterating over the created document */ + while (currentNode = nodeIterator.nextNode()) { + /* Sanitize tags and elements */ + if (_sanitizeElements(currentNode)) { + continue; + } + + /* Shadow DOM detected, sanitize it */ + if (currentNode.content instanceof DocumentFragment) { + _sanitizeShadowDOM(currentNode.content); + } + + /* Check attributes, sanitize if necessary */ + _sanitizeAttributes(currentNode); + } + + /* If we sanitized `dirty` in-place, return it. */ + if (IN_PLACE) { + return dirty; + } + + /* Return sanitized string or DOM */ + if (RETURN_DOM) { + if (RETURN_DOM_FRAGMENT) { + returnNode = createDocumentFragment.call(body.ownerDocument); + while (body.firstChild) { + // eslint-disable-next-line unicorn/prefer-dom-node-append + returnNode.appendChild(body.firstChild); + } + } else { + returnNode = body; + } + if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) { + /* + AdoptNode() is not used because internal state is not reset + (e.g. the past names map of a HTMLFormElement), this is safe + in theory but we would rather not risk another attack vector. + The state that is cloned by importNode() is explicitly defined + by the specs. + */ + returnNode = importNode.call(originalDocument, returnNode, true); + } + return returnNode; + } + let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; + + /* Serialize doctype if allowed */ + if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) { + serializedHTML = '\n' + serializedHTML; + } + + /* Sanitize final string template-safe */ + if (SAFE_FOR_TEMPLATES) { + arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => { + serializedHTML = stringReplace(serializedHTML, expr, ' '); + }); + } + return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; + }; + + /** + * Public method to set the configuration once + * setConfig + * + * @param {Object} cfg configuration object + */ + DOMPurify.setConfig = function () { + let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + _parseConfig(cfg); + SET_CONFIG = true; + }; + + /** + * Public method to remove the configuration + * clearConfig + * + */ + DOMPurify.clearConfig = function () { + CONFIG = null; + SET_CONFIG = false; + }; + + /** + * Public method to check if an attribute value is valid. + * Uses last set config, if any. Otherwise, uses config defaults. + * isValidAttribute + * + * @param {String} tag Tag name of containing element. + * @param {String} attr Attribute name. + * @param {String} value Attribute value. + * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false. + */ + DOMPurify.isValidAttribute = function (tag, attr, value) { + /* Initialize shared config vars if necessary. */ + if (!CONFIG) { + _parseConfig({}); + } + const lcTag = transformCaseFunc(tag); + const lcName = transformCaseFunc(attr); + return _isValidAttribute(lcTag, lcName, value); + }; + + /** + * AddHook + * Public method to add DOMPurify hooks + * + * @param {String} entryPoint entry point for the hook to add + * @param {Function} hookFunction function to execute + */ + DOMPurify.addHook = function (entryPoint, hookFunction) { + if (typeof hookFunction !== 'function') { + return; + } + hooks[entryPoint] = hooks[entryPoint] || []; + arrayPush(hooks[entryPoint], hookFunction); + }; + + /** + * RemoveHook + * Public method to remove a DOMPurify hook at a given entryPoint + * (pops it from the stack of hooks if more are present) + * + * @param {String} entryPoint entry point for the hook to remove + * @return {Function} removed(popped) hook + */ + DOMPurify.removeHook = function (entryPoint) { + if (hooks[entryPoint]) { + return arrayPop(hooks[entryPoint]); + } + }; + + /** + * RemoveHooks + * Public method to remove all DOMPurify hooks at a given entryPoint + * + * @param {String} entryPoint entry point for the hooks to remove + */ + DOMPurify.removeHooks = function (entryPoint) { + if (hooks[entryPoint]) { + hooks[entryPoint] = []; + } + }; + + /** + * RemoveAllHooks + * Public method to remove all DOMPurify hooks + */ + DOMPurify.removeAllHooks = function () { + hooks = {}; + }; + return DOMPurify; +} +var purify = createDOMPurify(); + +// ESM-comment-begin +// define(function () { return purify; }); +// ESM-comment-end + +// ESM-uncomment-begin +export default purify; +export const version = purify.version; +export const isSupported = purify.isSupported; +export const sanitize = purify.sanitize; +export const setConfig = purify.setConfig; +export const clearConfig = purify.clearConfig; +export const isValidAttribute = purify.isValidAttribute; +export const addHook = purify.addHook; +export const removeHook = purify.removeHook; +export const removeHooks = purify.removeHooks; +export const removeAllHooks = purify.removeAllHooks; +// ESM-uncomment-end diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/event.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/event.js new file mode 100644 index 0000000000000000000000000000000000000000..2111414c142f54a58b4f9fbf8c632874bca44b23 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/event.js @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Emitter } from '../common/event.js'; +export class DomEmitter { + get event() { + return this.emitter.event; + } + constructor(element, type, useCapture) { + const fn = (e) => this.emitter.fire(e); + this.emitter = new Emitter({ + onWillAddFirstListener: () => element.addEventListener(type, fn, useCapture), + onDidRemoveLastListener: () => element.removeEventListener(type, fn, useCapture) + }); + } + dispose() { + this.emitter.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js new file mode 100644 index 0000000000000000000000000000000000000000..62f205badaae9532c329d010f791dacbb9af0214 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class FastDomNode { + constructor(domNode) { + this.domNode = domNode; + this._maxWidth = ''; + this._width = ''; + this._height = ''; + this._top = ''; + this._left = ''; + this._bottom = ''; + this._right = ''; + this._paddingLeft = ''; + this._fontFamily = ''; + this._fontWeight = ''; + this._fontSize = ''; + this._fontStyle = ''; + this._fontFeatureSettings = ''; + this._fontVariationSettings = ''; + this._textDecoration = ''; + this._lineHeight = ''; + this._letterSpacing = ''; + this._className = ''; + this._display = ''; + this._position = ''; + this._visibility = ''; + this._color = ''; + this._backgroundColor = ''; + this._layerHint = false; + this._contain = 'none'; + this._boxShadow = ''; + } + setMaxWidth(_maxWidth) { + const maxWidth = numberAsPixels(_maxWidth); + if (this._maxWidth === maxWidth) { + return; + } + this._maxWidth = maxWidth; + this.domNode.style.maxWidth = this._maxWidth; + } + setWidth(_width) { + const width = numberAsPixels(_width); + if (this._width === width) { + return; + } + this._width = width; + this.domNode.style.width = this._width; + } + setHeight(_height) { + const height = numberAsPixels(_height); + if (this._height === height) { + return; + } + this._height = height; + this.domNode.style.height = this._height; + } + setTop(_top) { + const top = numberAsPixels(_top); + if (this._top === top) { + return; + } + this._top = top; + this.domNode.style.top = this._top; + } + setLeft(_left) { + const left = numberAsPixels(_left); + if (this._left === left) { + return; + } + this._left = left; + this.domNode.style.left = this._left; + } + setBottom(_bottom) { + const bottom = numberAsPixels(_bottom); + if (this._bottom === bottom) { + return; + } + this._bottom = bottom; + this.domNode.style.bottom = this._bottom; + } + setRight(_right) { + const right = numberAsPixels(_right); + if (this._right === right) { + return; + } + this._right = right; + this.domNode.style.right = this._right; + } + setPaddingLeft(_paddingLeft) { + const paddingLeft = numberAsPixels(_paddingLeft); + if (this._paddingLeft === paddingLeft) { + return; + } + this._paddingLeft = paddingLeft; + this.domNode.style.paddingLeft = this._paddingLeft; + } + setFontFamily(fontFamily) { + if (this._fontFamily === fontFamily) { + return; + } + this._fontFamily = fontFamily; + this.domNode.style.fontFamily = this._fontFamily; + } + setFontWeight(fontWeight) { + if (this._fontWeight === fontWeight) { + return; + } + this._fontWeight = fontWeight; + this.domNode.style.fontWeight = this._fontWeight; + } + setFontSize(_fontSize) { + const fontSize = numberAsPixels(_fontSize); + if (this._fontSize === fontSize) { + return; + } + this._fontSize = fontSize; + this.domNode.style.fontSize = this._fontSize; + } + setFontStyle(fontStyle) { + if (this._fontStyle === fontStyle) { + return; + } + this._fontStyle = fontStyle; + this.domNode.style.fontStyle = this._fontStyle; + } + setFontFeatureSettings(fontFeatureSettings) { + if (this._fontFeatureSettings === fontFeatureSettings) { + return; + } + this._fontFeatureSettings = fontFeatureSettings; + this.domNode.style.fontFeatureSettings = this._fontFeatureSettings; + } + setFontVariationSettings(fontVariationSettings) { + if (this._fontVariationSettings === fontVariationSettings) { + return; + } + this._fontVariationSettings = fontVariationSettings; + this.domNode.style.fontVariationSettings = this._fontVariationSettings; + } + setTextDecoration(textDecoration) { + if (this._textDecoration === textDecoration) { + return; + } + this._textDecoration = textDecoration; + this.domNode.style.textDecoration = this._textDecoration; + } + setLineHeight(_lineHeight) { + const lineHeight = numberAsPixels(_lineHeight); + if (this._lineHeight === lineHeight) { + return; + } + this._lineHeight = lineHeight; + this.domNode.style.lineHeight = this._lineHeight; + } + setLetterSpacing(_letterSpacing) { + const letterSpacing = numberAsPixels(_letterSpacing); + if (this._letterSpacing === letterSpacing) { + return; + } + this._letterSpacing = letterSpacing; + this.domNode.style.letterSpacing = this._letterSpacing; + } + setClassName(className) { + if (this._className === className) { + return; + } + this._className = className; + this.domNode.className = this._className; + } + toggleClassName(className, shouldHaveIt) { + this.domNode.classList.toggle(className, shouldHaveIt); + this._className = this.domNode.className; + } + setDisplay(display) { + if (this._display === display) { + return; + } + this._display = display; + this.domNode.style.display = this._display; + } + setPosition(position) { + if (this._position === position) { + return; + } + this._position = position; + this.domNode.style.position = this._position; + } + setVisibility(visibility) { + if (this._visibility === visibility) { + return; + } + this._visibility = visibility; + this.domNode.style.visibility = this._visibility; + } + setColor(color) { + if (this._color === color) { + return; + } + this._color = color; + this.domNode.style.color = this._color; + } + setBackgroundColor(backgroundColor) { + if (this._backgroundColor === backgroundColor) { + return; + } + this._backgroundColor = backgroundColor; + this.domNode.style.backgroundColor = this._backgroundColor; + } + setLayerHinting(layerHint) { + if (this._layerHint === layerHint) { + return; + } + this._layerHint = layerHint; + this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : ''; + } + setBoxShadow(boxShadow) { + if (this._boxShadow === boxShadow) { + return; + } + this._boxShadow = boxShadow; + this.domNode.style.boxShadow = boxShadow; + } + setContain(contain) { + if (this._contain === contain) { + return; + } + this._contain = contain; + this.domNode.style.contain = this._contain; + } + setAttribute(name, value) { + this.domNode.setAttribute(name, value); + } + removeAttribute(name) { + this.domNode.removeAttribute(name); + } + appendChild(child) { + this.domNode.appendChild(child.domNode); + } + removeChild(child) { + this.domNode.removeChild(child.domNode); + } +} +function numberAsPixels(value) { + return (typeof value === 'number' ? `${value}px` : value); +} +export function createFastDomNode(domNode) { + return new FastDomNode(domNode); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fonts.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fonts.js new file mode 100644 index 0000000000000000000000000000000000000000..dd7dee7b27577d10970c7a76848ea8f8684d7521 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/fonts.js @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { isMacintosh, isWindows } from '../common/platform.js'; +/** + * The best font-family to be used in CSS based on the platform: + * - Windows: Segoe preferred, fallback to sans-serif + * - macOS: standard system font, fallback to sans-serif + * - Linux: standard system font preferred, fallback to Ubuntu fonts + * + * Note: this currently does not adjust for different locales. + */ +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'; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..d5540180d87791a1a4203f056fd5ffbb57cd65cb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js @@ -0,0 +1,167 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as DOM from './dom.js'; +export function renderText(text, options = {}) { + const element = createElement(options); + element.textContent = text; + return element; +} +export function renderFormattedText(formattedText, options = {}) { + const element = createElement(options); + _renderFormattedText(element, parseFormattedText(formattedText, !!options.renderCodeSegments), options.actionHandler, options.renderCodeSegments); + return element; +} +export function createElement(options) { + const tagName = options.inline ? 'span' : 'div'; + const element = document.createElement(tagName); + if (options.className) { + element.className = options.className; + } + return element; +} +class StringStream { + constructor(source) { + this.source = source; + this.index = 0; + } + eos() { + return this.index >= this.source.length; + } + next() { + const next = this.peek(); + this.advance(); + return next; + } + peek() { + return this.source[this.index]; + } + advance() { + this.index++; + } +} +function _renderFormattedText(element, treeNode, actionHandler, renderCodeSegments) { + let child; + if (treeNode.type === 2 /* FormatType.Text */) { + child = document.createTextNode(treeNode.content || ''); + } + else if (treeNode.type === 3 /* FormatType.Bold */) { + child = document.createElement('b'); + } + else if (treeNode.type === 4 /* FormatType.Italics */) { + child = document.createElement('i'); + } + else if (treeNode.type === 7 /* FormatType.Code */ && renderCodeSegments) { + child = document.createElement('code'); + } + else if (treeNode.type === 5 /* FormatType.Action */ && actionHandler) { + const a = document.createElement('a'); + actionHandler.disposables.add(DOM.addStandardDisposableListener(a, 'click', (event) => { + actionHandler.callback(String(treeNode.index), event); + })); + child = a; + } + else if (treeNode.type === 8 /* FormatType.NewLine */) { + child = document.createElement('br'); + } + else if (treeNode.type === 1 /* FormatType.Root */) { + child = element; + } + if (child && element !== child) { + element.appendChild(child); + } + if (child && Array.isArray(treeNode.children)) { + treeNode.children.forEach((nodeChild) => { + _renderFormattedText(child, nodeChild, actionHandler, renderCodeSegments); + }); + } +} +function parseFormattedText(content, parseCodeSegments) { + const root = { + type: 1 /* FormatType.Root */, + children: [] + }; + let actionViewItemIndex = 0; + let current = root; + const stack = []; + const stream = new StringStream(content); + while (!stream.eos()) { + let next = stream.next(); + const isEscapedFormatType = (next === '\\' && formatTagType(stream.peek(), parseCodeSegments) !== 0 /* FormatType.Invalid */); + if (isEscapedFormatType) { + next = stream.next(); // unread the backslash if it escapes a format tag type + } + if (!isEscapedFormatType && isFormatTag(next, parseCodeSegments) && next === stream.peek()) { + stream.advance(); + if (current.type === 2 /* FormatType.Text */) { + current = stack.pop(); + } + const type = formatTagType(next, parseCodeSegments); + if (current.type === type || (current.type === 5 /* FormatType.Action */ && type === 6 /* FormatType.ActionClose */)) { + current = stack.pop(); + } + else { + const newCurrent = { + type: type, + children: [] + }; + if (type === 5 /* FormatType.Action */) { + newCurrent.index = actionViewItemIndex; + actionViewItemIndex++; + } + current.children.push(newCurrent); + stack.push(current); + current = newCurrent; + } + } + else if (next === '\n') { + if (current.type === 2 /* FormatType.Text */) { + current = stack.pop(); + } + current.children.push({ + type: 8 /* FormatType.NewLine */ + }); + } + else { + if (current.type !== 2 /* FormatType.Text */) { + const textCurrent = { + type: 2 /* FormatType.Text */, + content: next + }; + current.children.push(textCurrent); + stack.push(current); + current = textCurrent; + } + else { + current.content += next; + } + } + } + if (current.type === 2 /* FormatType.Text */) { + current = stack.pop(); + } + if (stack.length) { + // incorrectly formatted string literal + } + return root; +} +function isFormatTag(char, supportCodeSegments) { + return formatTagType(char, supportCodeSegments) !== 0 /* FormatType.Invalid */; +} +function formatTagType(char, supportCodeSegments) { + switch (char) { + case '*': + return 3 /* FormatType.Bold */; + case '_': + return 4 /* FormatType.Italics */; + case '[': + return 5 /* FormatType.Action */; + case ']': + return 6 /* FormatType.ActionClose */; + case '`': + return supportCodeSegments ? 7 /* FormatType.Code */ : 0 /* FormatType.Invalid */; + default: + return 0 /* FormatType.Invalid */; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js new file mode 100644 index 0000000000000000000000000000000000000000..09f5d07d614c5e199b9860a45ae2565cc2f75c36 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js @@ -0,0 +1,80 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from './dom.js'; +import { DisposableStore, toDisposable } from '../common/lifecycle.js'; +export class GlobalPointerMoveMonitor { + constructor() { + this._hooks = new DisposableStore(); + this._pointerMoveCallback = null; + this._onStopCallback = null; + } + dispose() { + this.stopMonitoring(false); + this._hooks.dispose(); + } + stopMonitoring(invokeStopCallback, browserEvent) { + if (!this.isMonitoring()) { + // Not monitoring + return; + } + // Unhook + this._hooks.clear(); + this._pointerMoveCallback = null; + const onStopCallback = this._onStopCallback; + this._onStopCallback = null; + if (invokeStopCallback && onStopCallback) { + onStopCallback(browserEvent); + } + } + isMonitoring() { + return !!this._pointerMoveCallback; + } + startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) { + if (this.isMonitoring()) { + this.stopMonitoring(false); + } + this._pointerMoveCallback = pointerMoveCallback; + this._onStopCallback = onStopCallback; + let eventSource = initialElement; + try { + initialElement.setPointerCapture(pointerId); + this._hooks.add(toDisposable(() => { + try { + initialElement.releasePointerCapture(pointerId); + } + catch (err) { + // See https://github.com/microsoft/vscode/issues/161731 + // + // `releasePointerCapture` sometimes fails when being invoked with the exception: + // DOMException: Failed to execute 'releasePointerCapture' on 'Element': + // No active pointer with the given id is found. + // + // There's no need to do anything in case of failure + } + })); + } + catch (err) { + // See https://github.com/microsoft/vscode/issues/144584 + // See https://github.com/microsoft/vscode/issues/146947 + // `setPointerCapture` sometimes fails when being invoked + // from a `mousedown` listener on macOS and Windows + // and it always fails on Linux with the exception: + // DOMException: Failed to execute 'setPointerCapture' on 'Element': + // No active pointer with the given id is found. + // In case of failure, we bind the listeners on the window + eventSource = dom.getWindow(initialElement); + } + this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_MOVE, (e) => { + if (e.buttons !== initialButtons) { + // Buttons state has changed in the meantime + this.stopMonitoring(true); + return; + } + e.preventDefault(); + this._pointerMoveCallback(e); + })); + this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_UP, (e) => this.stopMonitoring(true))); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/history.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/history.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/history.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/iframe.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/iframe.js new file mode 100644 index 0000000000000000000000000000000000000000..38f49322b37fc940c5a4932d2dbae0e0538cefb1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/iframe.js @@ -0,0 +1,85 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const sameOriginWindowChainCache = new WeakMap(); +function getParentWindowIfSameOrigin(w) { + if (!w.parent || w.parent === w) { + return null; + } + // Cannot really tell if we have access to the parent window unless we try to access something in it + try { + const location = w.location; + const parentLocation = w.parent.location; + if (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) { + return null; + } + } + catch (e) { + return null; + } + return w.parent; +} +export class IframeUtils { + /** + * Returns a chain of embedded windows with the same origin (which can be accessed programmatically). + * 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. + */ + static getSameOriginWindowChain(targetWindow) { + let windowChainCache = sameOriginWindowChainCache.get(targetWindow); + if (!windowChainCache) { + windowChainCache = []; + sameOriginWindowChainCache.set(targetWindow, windowChainCache); + let w = targetWindow; + let parent; + do { + parent = getParentWindowIfSameOrigin(w); + if (parent) { + windowChainCache.push({ + window: new WeakRef(w), + iframeElement: w.frameElement || null + }); + } + else { + windowChainCache.push({ + window: new WeakRef(w), + iframeElement: null + }); + } + w = parent; + } while (w); + } + return windowChainCache.slice(0); + } + /** + * Returns the position of `childWindow` relative to `ancestorWindow` + */ + static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) { + if (!ancestorWindow || childWindow === ancestorWindow) { + return { + top: 0, + left: 0 + }; + } + let top = 0, left = 0; + const windowChain = this.getSameOriginWindowChain(childWindow); + for (const windowChainEl of windowChain) { + const windowInChain = windowChainEl.window.deref(); + top += windowInChain?.scrollY ?? 0; + left += windowInChain?.scrollX ?? 0; + if (windowInChain === ancestorWindow) { + break; + } + if (!windowChainEl.iframeElement) { + break; + } + const boundingRect = windowChainEl.iframeElement.getBoundingClientRect(); + top += boundingRect.top; + left += boundingRect.left; + } + return { + top: top, + left: left + }; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js new file mode 100644 index 0000000000000000000000000000000000000000..755d535142ef6476b716f02918a2d28f76fe0432 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as browser from './browser.js'; +import { EVENT_KEY_CODE_MAP, KeyCodeUtils } from '../common/keyCodes.js'; +import { KeyCodeChord } from '../common/keybindings.js'; +import * as platform from '../common/platform.js'; +function extractKeyCode(e) { + if (e.charCode) { + // "keypress" events mostly + const char = String.fromCharCode(e.charCode).toUpperCase(); + return KeyCodeUtils.fromString(char); + } + const keyCode = e.keyCode; + // browser quirks + if (keyCode === 3) { + return 7 /* KeyCode.PauseBreak */; + } + else if (browser.isFirefox) { + switch (keyCode) { + case 59: return 85 /* KeyCode.Semicolon */; + case 60: + if (platform.isLinux) { + return 97 /* KeyCode.IntlBackslash */; + } + break; + case 61: return 86 /* KeyCode.Equal */; + // based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys + case 107: return 109 /* KeyCode.NumpadAdd */; + case 109: return 111 /* KeyCode.NumpadSubtract */; + case 173: return 88 /* KeyCode.Minus */; + case 224: + if (platform.isMacintosh) { + return 57 /* KeyCode.Meta */; + } + break; + } + } + else if (browser.isWebKit) { + if (platform.isMacintosh && keyCode === 93) { + // the two meta keys in the Mac have different key codes (91 and 93) + return 57 /* KeyCode.Meta */; + } + else if (!platform.isMacintosh && keyCode === 92) { + return 57 /* KeyCode.Meta */; + } + } + // cross browser keycodes: + return EVENT_KEY_CODE_MAP[keyCode] || 0 /* KeyCode.Unknown */; +} +const ctrlKeyMod = (platform.isMacintosh ? 256 /* KeyMod.WinCtrl */ : 2048 /* KeyMod.CtrlCmd */); +const altKeyMod = 512 /* KeyMod.Alt */; +const shiftKeyMod = 1024 /* KeyMod.Shift */; +const metaKeyMod = (platform.isMacintosh ? 2048 /* KeyMod.CtrlCmd */ : 256 /* KeyMod.WinCtrl */); +export class StandardKeyboardEvent { + constructor(source) { + this._standardKeyboardEventBrand = true; + const e = source; + this.browserEvent = e; + this.target = e.target; + this.ctrlKey = e.ctrlKey; + this.shiftKey = e.shiftKey; + this.altKey = e.altKey; + this.metaKey = e.metaKey; + this.altGraphKey = e.getModifierState?.('AltGraph'); + this.keyCode = extractKeyCode(e); + this.code = e.code; + // console.info(e.type + ": keyCode: " + e.keyCode + ", which: " + e.which + ", charCode: " + e.charCode + ", detail: " + e.detail + " ====> " + this.keyCode + ' -- ' + KeyCode[this.keyCode]); + this.ctrlKey = this.ctrlKey || this.keyCode === 5 /* KeyCode.Ctrl */; + this.altKey = this.altKey || this.keyCode === 6 /* KeyCode.Alt */; + this.shiftKey = this.shiftKey || this.keyCode === 4 /* KeyCode.Shift */; + this.metaKey = this.metaKey || this.keyCode === 57 /* KeyCode.Meta */; + this._asKeybinding = this._computeKeybinding(); + this._asKeyCodeChord = this._computeKeyCodeChord(); + // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`); + } + preventDefault() { + if (this.browserEvent && this.browserEvent.preventDefault) { + this.browserEvent.preventDefault(); + } + } + stopPropagation() { + if (this.browserEvent && this.browserEvent.stopPropagation) { + this.browserEvent.stopPropagation(); + } + } + toKeyCodeChord() { + return this._asKeyCodeChord; + } + equals(other) { + return this._asKeybinding === other; + } + _computeKeybinding() { + let key = 0 /* KeyCode.Unknown */; + if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) { + key = this.keyCode; + } + let result = 0; + if (this.ctrlKey) { + result |= ctrlKeyMod; + } + if (this.altKey) { + result |= altKeyMod; + } + if (this.shiftKey) { + result |= shiftKeyMod; + } + if (this.metaKey) { + result |= metaKeyMod; + } + result |= key; + return result; + } + _computeKeyCodeChord() { + let key = 0 /* KeyCode.Unknown */; + if (this.keyCode !== 5 /* KeyCode.Ctrl */ && this.keyCode !== 4 /* KeyCode.Shift */ && this.keyCode !== 6 /* KeyCode.Alt */ && this.keyCode !== 57 /* KeyCode.Meta */) { + key = this.keyCode; + } + return new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..ceb5bb6eb94d0312360f1c1fc3db8e14e0dc6037 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js @@ -0,0 +1,814 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as DOM from './dom.js'; +import * as dompurify from './dompurify/dompurify.js'; +import { DomEmitter } from './event.js'; +import { createElement } from './formattedTextRenderer.js'; +import { StandardKeyboardEvent } from './keyboardEvent.js'; +import { StandardMouseEvent } from './mouseEvent.js'; +import { renderLabelWithIcons } from './ui/iconLabel/iconLabels.js'; +import { onUnexpectedError } from '../common/errors.js'; +import { Event } from '../common/event.js'; +import { escapeDoubleQuotes, parseHrefAndDimensions, removeMarkdownEscapes } from '../common/htmlContent.js'; +import { markdownEscapeEscapedIcons } from '../common/iconLabels.js'; +import { defaultGenerator } from '../common/idGenerator.js'; +import { Lazy } from '../common/lazy.js'; +import { DisposableStore, toDisposable } from '../common/lifecycle.js'; +import * as marked from '../common/marked/marked.js'; +import { parse } from '../common/marshalling.js'; +import { FileAccess, Schemas } from '../common/network.js'; +import { cloneAndChange } from '../common/objects.js'; +import { dirname, resolvePath } from '../common/resources.js'; +import { escape } from '../common/strings.js'; +import { URI } from '../common/uri.js'; +const defaultMarkedRenderers = Object.freeze({ + image: ({ href, title, text }) => { + let dimensions = []; + let attributes = []; + if (href) { + ({ href, dimensions } = parseHrefAndDimensions(href)); + attributes.push(`src="${escapeDoubleQuotes(href)}"`); + } + if (text) { + attributes.push(`alt="${escapeDoubleQuotes(text)}"`); + } + if (title) { + attributes.push(`title="${escapeDoubleQuotes(title)}"`); + } + if (dimensions.length) { + attributes = attributes.concat(dimensions); + } + return ''; + }, + paragraph({ tokens }) { + return `

${this.parser.parseInline(tokens)}

`; + }, + link({ href, title, tokens }) { + let text = this.parser.parseInline(tokens); + if (typeof href !== 'string') { + return ''; + } + // Remove markdown escapes. Workaround for https://github.com/chjj/marked/issues/829 + if (href === text) { // raw link case + text = removeMarkdownEscapes(text); + } + title = typeof title === 'string' ? escapeDoubleQuotes(removeMarkdownEscapes(title)) : ''; + href = removeMarkdownEscapes(href); + // HTML Encode href + href = href.replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + return `${text}`; + }, +}); +/** + * Low-level way create a html element from a markdown string. + * + * **Note** that for most cases you should be using [`MarkdownRenderer`](./src/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.ts) + * which comes with support for pretty code block rendering and which uses the default way of handling links. + */ +export function renderMarkdown(markdown, options = {}, markedOptions = {}) { + const disposables = new DisposableStore(); + let isDisposed = false; + const element = createElement(options); + const _uriMassage = function (part) { + let data; + try { + data = parse(decodeURIComponent(part)); + } + catch (e) { + // ignore + } + if (!data) { + return part; + } + data = cloneAndChange(data, value => { + if (markdown.uris && markdown.uris[value]) { + return URI.revive(markdown.uris[value]); + } + else { + return undefined; + } + }); + return encodeURIComponent(JSON.stringify(data)); + }; + const _href = function (href, isDomUri) { + const data = markdown.uris && markdown.uris[href]; + let uri = URI.revive(data); + if (isDomUri) { + if (href.startsWith(Schemas.data + ':')) { + return href; + } + if (!uri) { + uri = URI.parse(href); + } + // this URI will end up as "src"-attribute of a dom node + // and because of that special rewriting needs to be done + // so that the URI uses a protocol that's understood by + // browsers (like http or https) + return FileAccess.uriToBrowserUri(uri).toString(true); + } + if (!uri) { + return href; + } + if (URI.parse(href).toString() === uri.toString()) { + return href; // no transformation performed + } + if (uri.query) { + uri = uri.with({ query: _uriMassage(uri.query) }); + } + return uri.toString(); + }; + const renderer = new marked.Renderer(); + renderer.image = defaultMarkedRenderers.image; + renderer.link = defaultMarkedRenderers.link; + renderer.paragraph = defaultMarkedRenderers.paragraph; + // Will collect [id, renderedElement] tuples + const codeBlocks = []; + const syncCodeBlocks = []; + if (options.codeBlockRendererSync) { + renderer.code = ({ text, lang }) => { + const id = defaultGenerator.nextId(); + const value = options.codeBlockRendererSync(postProcessCodeBlockLanguageId(lang), text); + syncCodeBlocks.push([id, value]); + return `
${escape(text)}
`; + }; + } + else if (options.codeBlockRenderer) { + renderer.code = ({ text, lang }) => { + const id = defaultGenerator.nextId(); + const value = options.codeBlockRenderer(postProcessCodeBlockLanguageId(lang), text); + codeBlocks.push(value.then(element => [id, element])); + return `
${escape(text)}
`; + }; + } + if (options.actionHandler) { + const _activateLink = function (event) { + let target = event.target; + if (target.tagName !== 'A') { + target = target.parentElement; + if (!target || target.tagName !== 'A') { + return; + } + } + try { + let href = target.dataset['href']; + if (href) { + if (markdown.baseUri) { + href = resolveWithBaseUri(URI.from(markdown.baseUri), href); + } + options.actionHandler.callback(href, event); + } + } + catch (err) { + onUnexpectedError(err); + } + finally { + event.preventDefault(); + } + }; + const onClick = options.actionHandler.disposables.add(new DomEmitter(element, 'click')); + const onAuxClick = options.actionHandler.disposables.add(new DomEmitter(element, 'auxclick')); + options.actionHandler.disposables.add(Event.any(onClick.event, onAuxClick.event)(e => { + const mouseEvent = new StandardMouseEvent(DOM.getWindow(element), e); + if (!mouseEvent.leftButton && !mouseEvent.middleButton) { + return; + } + _activateLink(mouseEvent); + })); + options.actionHandler.disposables.add(DOM.addDisposableListener(element, 'keydown', (e) => { + const keyboardEvent = new StandardKeyboardEvent(e); + if (!keyboardEvent.equals(10 /* KeyCode.Space */) && !keyboardEvent.equals(3 /* KeyCode.Enter */)) { + return; + } + _activateLink(keyboardEvent); + })); + } + if (!markdown.supportHtml) { + // Note: we always pass the output through dompurify after this so that we don't rely on + // marked for real sanitization. + renderer.html = ({ text }) => { + if (options.sanitizerOptions?.replaceWithPlaintext) { + return escape(text); + } + const match = markdown.isTrusted ? text.match(/^(]+>)|(<\/\s*span>)$/) : undefined; + return match ? text : ''; + }; + } + markedOptions.renderer = renderer; + // values that are too long will freeze the UI + let value = markdown.value ?? ''; + if (value.length > 100_000) { + value = `${value.substr(0, 100_000)}…`; + } + // escape theme icons + if (markdown.supportThemeIcons) { + value = markdownEscapeEscapedIcons(value); + } + let renderedMarkdown; + if (options.fillInIncompleteTokens) { + // The defaults are applied by parse but not lexer()/parser(), and they need to be present + const opts = { + ...marked.defaults, + ...markedOptions + }; + const tokens = marked.lexer(value, opts); + const newTokens = fillInIncompleteTokens(tokens); + renderedMarkdown = marked.parser(newTokens, opts); + } + else { + renderedMarkdown = marked.parse(value, { ...markedOptions, async: false }); + } + // Rewrite theme icons + if (markdown.supportThemeIcons) { + const elements = renderLabelWithIcons(renderedMarkdown); + renderedMarkdown = elements.map(e => typeof e === 'string' ? e : e.outerHTML).join(''); + } + const htmlParser = new DOMParser(); + const markdownHtmlDoc = htmlParser.parseFromString(sanitizeRenderedMarkdown({ isTrusted: markdown.isTrusted, ...options.sanitizerOptions }, renderedMarkdown), 'text/html'); + markdownHtmlDoc.body.querySelectorAll('img, audio, video, source') + .forEach(img => { + const src = img.getAttribute('src'); // Get the raw 'src' attribute value as text, not the resolved 'src' + if (src) { + let href = src; + try { + if (markdown.baseUri) { // absolute or relative local path, or file: uri + href = resolveWithBaseUri(URI.from(markdown.baseUri), href); + } + } + catch (err) { } + img.setAttribute('src', _href(href, true)); + if (options.remoteImageIsAllowed) { + const uri = URI.parse(href); + if (uri.scheme !== Schemas.file && uri.scheme !== Schemas.data && !options.remoteImageIsAllowed(uri)) { + img.replaceWith(DOM.$('', undefined, img.outerHTML)); + } + } + } + }); + markdownHtmlDoc.body.querySelectorAll('a') + .forEach(a => { + const href = a.getAttribute('href'); // Get the raw 'href' attribute value as text, not the resolved 'href' + a.setAttribute('href', ''); // Clear out href. We use the `data-href` for handling clicks instead + if (!href + || /^data:|javascript:/i.test(href) + || (/^command:/i.test(href) && !markdown.isTrusted) + || /^command:(\/\/\/)?_workbench\.downloadResource/i.test(href)) { + // drop the link + a.replaceWith(...a.childNodes); + } + else { + let resolvedHref = _href(href, false); + if (markdown.baseUri) { + resolvedHref = resolveWithBaseUri(URI.from(markdown.baseUri), href); + } + a.dataset.href = resolvedHref; + } + }); + element.innerHTML = sanitizeRenderedMarkdown({ isTrusted: markdown.isTrusted, ...options.sanitizerOptions }, markdownHtmlDoc.body.innerHTML); + if (codeBlocks.length > 0) { + Promise.all(codeBlocks).then((tuples) => { + if (isDisposed) { + return; + } + const renderedElements = new Map(tuples); + const placeholderElements = element.querySelectorAll(`div[data-code]`); + for (const placeholderElement of placeholderElements) { + const renderedElement = renderedElements.get(placeholderElement.dataset['code'] ?? ''); + if (renderedElement) { + DOM.reset(placeholderElement, renderedElement); + } + } + options.asyncRenderCallback?.(); + }); + } + else if (syncCodeBlocks.length > 0) { + const renderedElements = new Map(syncCodeBlocks); + const placeholderElements = element.querySelectorAll(`div[data-code]`); + for (const placeholderElement of placeholderElements) { + const renderedElement = renderedElements.get(placeholderElement.dataset['code'] ?? ''); + if (renderedElement) { + DOM.reset(placeholderElement, renderedElement); + } + } + } + // signal size changes for image tags + if (options.asyncRenderCallback) { + for (const img of element.getElementsByTagName('img')) { + const listener = disposables.add(DOM.addDisposableListener(img, 'load', () => { + listener.dispose(); + options.asyncRenderCallback(); + })); + } + } + return { + element, + dispose: () => { + isDisposed = true; + disposables.dispose(); + } + }; +} +function postProcessCodeBlockLanguageId(lang) { + if (!lang) { + return ''; + } + const parts = lang.split(/[\s+|:|,|\{|\?]/, 1); + if (parts.length) { + return parts[0]; + } + return lang; +} +function resolveWithBaseUri(baseUri, href) { + const hasScheme = /^\w[\w\d+.-]*:/.test(href); + if (hasScheme) { + return href; + } + if (baseUri.path.endsWith('/')) { + return resolvePath(baseUri, href).toString(); + } + else { + return resolvePath(dirname(baseUri), href).toString(); + } +} +const selfClosingTags = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; +function sanitizeRenderedMarkdown(options, renderedMarkdown) { + const { config, allowedSchemes } = getSanitizerOptions(options); + const store = new DisposableStore(); + store.add(addDompurifyHook('uponSanitizeAttribute', (element, e) => { + if (e.attrName === 'style' || e.attrName === 'class') { + if (element.tagName === 'SPAN') { + if (e.attrName === 'style') { + 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); + return; + } + else if (e.attrName === 'class') { + e.keepAttr = /^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(e.attrValue); + return; + } + } + e.keepAttr = false; + return; + } + else if (element.tagName === 'INPUT' && element.attributes.getNamedItem('type')?.value === 'checkbox') { + if ((e.attrName === 'type' && e.attrValue === 'checkbox') || e.attrName === 'disabled' || e.attrName === 'checked') { + e.keepAttr = true; + return; + } + e.keepAttr = false; + } + })); + store.add(addDompurifyHook('uponSanitizeElement', (element, e) => { + if (e.tagName === 'input') { + if (element.attributes.getNamedItem('type')?.value === 'checkbox') { + element.setAttribute('disabled', ''); + } + else if (!options.replaceWithPlaintext) { + element.remove(); + } + } + if (options.replaceWithPlaintext && !e.allowedTags[e.tagName] && e.tagName !== 'body') { + if (element.parentElement) { + let startTagText; + let endTagText; + if (e.tagName === '#comment') { + startTagText = ``; + } + else { + const isSelfClosing = selfClosingTags.includes(e.tagName); + const attrString = element.attributes.length ? + ' ' + Array.from(element.attributes) + .map(attr => `${attr.name}="${attr.value}"`) + .join(' ') + : ''; + startTagText = `<${e.tagName}${attrString}>`; + if (!isSelfClosing) { + endTagText = ``; + } + } + const fragment = document.createDocumentFragment(); + const textNode = element.parentElement.ownerDocument.createTextNode(startTagText); + fragment.appendChild(textNode); + const endTagTextNode = endTagText ? element.parentElement.ownerDocument.createTextNode(endTagText) : undefined; + while (element.firstChild) { + fragment.appendChild(element.firstChild); + } + if (endTagTextNode) { + fragment.appendChild(endTagTextNode); + } + if (element.nodeType === Node.COMMENT_NODE) { + // Workaround for https://github.com/cure53/DOMPurify/issues/1005 + // The comment will be deleted in the next phase. However if we try to remove it now, it will cause + // an exception. Instead we insert the text node before the comment. + element.parentElement.insertBefore(fragment, element); + } + else { + element.parentElement.replaceChild(fragment, element); + } + } + } + })); + store.add(DOM.hookDomPurifyHrefAndSrcSanitizer(allowedSchemes)); + try { + return dompurify.sanitize(renderedMarkdown, { ...config, RETURN_TRUSTED_TYPE: true }); + } + finally { + store.dispose(); + } +} +export const allowedMarkdownAttr = [ + 'align', + 'autoplay', + 'alt', + 'checked', + 'class', + 'colspan', + 'controls', + 'data-code', + 'data-href', + 'disabled', + 'draggable', + 'height', + 'href', + 'loop', + 'muted', + 'playsinline', + 'poster', + 'rowspan', + 'src', + 'style', + 'target', + 'title', + 'type', + 'width', + 'start', +]; +function getSanitizerOptions(options) { + const allowedSchemes = [ + Schemas.http, + Schemas.https, + Schemas.mailto, + Schemas.data, + Schemas.file, + Schemas.vscodeFileResource, + Schemas.vscodeRemote, + Schemas.vscodeRemoteResource, + ]; + if (options.isTrusted) { + allowedSchemes.push(Schemas.command); + } + return { + config: { + // allowedTags should included everything that markdown renders to. + // Since we have our own sanitize function for marked, it's possible we missed some tag so let dompurify make sure. + // HTML tags that can result from markdown are from reading https://spec.commonmark.org/0.29/ + // HTML table tags that can result from markdown are from https://github.github.com/gfm/#tables-extension- + ALLOWED_TAGS: options.allowedTags ?? [...DOM.basicMarkupHtmlTags], + ALLOWED_ATTR: allowedMarkdownAttr, + ALLOW_UNKNOWN_PROTOCOLS: true, + }, + allowedSchemes + }; +} +/** + * Strips all markdown from `string`, if it's an IMarkdownString. For example + * `# Header` would be output as `Header`. If it's not, the string is returned. + */ +export function renderStringAsPlaintext(string) { + return typeof string === 'string' ? string : renderMarkdownAsPlaintext(string); +} +/** + * Strips all markdown from `markdown`. For example `# Header` would be output as `Header`. + * provide @param withCodeBlocks to retain code blocks + */ +export function renderMarkdownAsPlaintext(markdown, withCodeBlocks) { + // values that are too long will freeze the UI + let value = markdown.value ?? ''; + if (value.length > 100_000) { + value = `${value.substr(0, 100_000)}…`; + } + const html = marked.parse(value, { async: false, renderer: withCodeBlocks ? plainTextWithCodeBlocksRenderer.value : plainTextRenderer.value }).replace(/&(#\d+|[a-zA-Z]+);/g, m => unescapeInfo.get(m) ?? m); + return sanitizeRenderedMarkdown({ isTrusted: false }, html).toString(); +} +const unescapeInfo = new Map([ + ['"', '"'], + [' ', ' '], + ['&', '&'], + [''', '\''], + ['<', '<'], + ['>', '>'], +]); +function createRenderer() { + const renderer = new marked.Renderer(); + renderer.code = ({ text }) => { + return text; + }; + renderer.blockquote = ({ text }) => { + return text + '\n'; + }; + renderer.html = (_) => { + return ''; + }; + renderer.heading = function ({ tokens }) { + return this.parser.parseInline(tokens) + '\n'; + }; + renderer.hr = () => { + return ''; + }; + renderer.list = function ({ items }) { + return items.map(x => this.listitem(x)).join('\n') + '\n'; + }; + renderer.listitem = ({ text }) => { + return text + '\n'; + }; + renderer.paragraph = function ({ tokens }) { + return this.parser.parseInline(tokens) + '\n'; + }; + renderer.table = function ({ header, rows }) { + return header.map(cell => this.tablecell(cell)).join(' ') + '\n' + rows.map(cells => cells.map(cell => this.tablecell(cell)).join(' ')).join('\n') + '\n'; + }; + renderer.tablerow = ({ text }) => { + return text; + }; + renderer.tablecell = function ({ tokens }) { + return this.parser.parseInline(tokens); + }; + renderer.strong = ({ text }) => { + return text; + }; + renderer.em = ({ text }) => { + return text; + }; + renderer.codespan = ({ text }) => { + return text; + }; + renderer.br = (_) => { + return '\n'; + }; + renderer.del = ({ text }) => { + return text; + }; + renderer.image = (_) => { + return ''; + }; + renderer.text = ({ text }) => { + return text; + }; + renderer.link = ({ text }) => { + return text; + }; + return renderer; +} +const plainTextRenderer = new Lazy((withCodeBlocks) => createRenderer()); +const plainTextWithCodeBlocksRenderer = new Lazy(() => { + const renderer = createRenderer(); + renderer.code = ({ text }) => { + return `\n\`\`\`\n${text}\n\`\`\`\n`; + }; + return renderer; +}); +function mergeRawTokenText(tokens) { + let mergedTokenText = ''; + tokens.forEach(token => { + mergedTokenText += token.raw; + }); + return mergedTokenText; +} +function completeSingleLinePattern(token) { + if (!token.tokens) { + return undefined; + } + for (let i = token.tokens.length - 1; i >= 0; i--) { + const subtoken = token.tokens[i]; + if (subtoken.type === 'text') { + const lines = subtoken.raw.split('\n'); + const lastLine = lines[lines.length - 1]; + if (lastLine.includes('`')) { + return completeCodespan(token); + } + else if (lastLine.includes('**')) { + return completeDoublestar(token); + } + else if (lastLine.match(/\*\w/)) { + return completeStar(token); + } + else if (lastLine.match(/(^|\s)__\w/)) { + return completeDoubleUnderscore(token); + } + else if (lastLine.match(/(^|\s)_\w/)) { + return completeUnderscore(token); + } + else if ( + // Text with start of link target + hasLinkTextAndStartOfLinkTarget(lastLine) || + // This token doesn't have the link text, eg if it contains other markdown constructs that are in other subtokens. + // But some preceding token does have an unbalanced [ at least + hasStartOfLinkTargetAndNoLinkText(lastLine) && token.tokens.slice(0, i).some(t => t.type === 'text' && t.raw.match(/\[[^\]]*$/))) { + const nextTwoSubTokens = token.tokens.slice(i + 1); + // A markdown link can look like + // [link text](https://microsoft.com "more text") + // Where "more text" is a title for the link or an argument to a vscode command link + if ( + // If the link was parsed as a link, then look for a link token and a text token with a quote + nextTwoSubTokens[0]?.type === 'link' && nextTwoSubTokens[1]?.type === 'text' && nextTwoSubTokens[1].raw.match(/^ *"[^"]*$/) || + // And if the link was not parsed as a link (eg command link), just look for a single quote in this token + lastLine.match(/^[^"]* +"[^"]*$/)) { + return completeLinkTargetArg(token); + } + return completeLinkTarget(token); + } + // Contains the start of link text, and no following tokens contain the link target + else if (lastLine.match(/(^|\s)\[\w*/)) { + return completeLinkText(token); + } + } + } + return undefined; +} +function hasLinkTextAndStartOfLinkTarget(str) { + return !!str.match(/(^|\s)\[.*\]\(\w*/); +} +function hasStartOfLinkTargetAndNoLinkText(str) { + return !!str.match(/^[^\[]*\]\([^\)]*$/); +} +function completeListItemPattern(list) { + // Patch up this one list item + const lastListItem = list.items[list.items.length - 1]; + const lastListSubToken = lastListItem.tokens ? lastListItem.tokens[lastListItem.tokens.length - 1] : undefined; + /* + Example list token structures: + + list + list_item + text + text + codespan + link + list_item + text + code // Complete indented codeblock + list_item + text + space + text + text // Incomplete indented codeblock + list_item + text + list // Nested list + list_item + text + text + + Contrast with paragraph: + paragraph + text + codespan + */ + let newToken; + if (lastListSubToken?.type === 'text' && !('inRawBlock' in lastListItem)) { // Why does Tag have a type of 'text' + newToken = completeSingleLinePattern(lastListSubToken); + } + if (!newToken || newToken.type !== 'paragraph') { // 'text' item inside the list item turns into paragraph + // Nothing to fix, or not a pattern we were expecting + return; + } + const previousListItemsText = mergeRawTokenText(list.items.slice(0, -1)); + // Grabbing the `- ` or `1. ` or `* ` off the list item because I can't find a better way to do this + const lastListItemLead = lastListItem.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0]; + if (!lastListItemLead) { + // Is badly formatted + return; + } + const newListItemText = lastListItemLead + + mergeRawTokenText(lastListItem.tokens.slice(0, -1)) + + newToken.raw; + const newList = marked.lexer(previousListItemsText + newListItemText)[0]; + if (newList.type !== 'list') { + // Something went wrong + return; + } + return newList; +} +const maxIncompleteTokensFixRounds = 3; +export function fillInIncompleteTokens(tokens) { + for (let i = 0; i < maxIncompleteTokensFixRounds; i++) { + const newTokens = fillInIncompleteTokensOnce(tokens); + if (newTokens) { + tokens = newTokens; + } + else { + break; + } + } + return tokens; +} +function fillInIncompleteTokensOnce(tokens) { + let i; + let newTokens; + for (i = 0; i < tokens.length; i++) { + const token = tokens[i]; + if (token.type === 'paragraph' && token.raw.match(/(\n|^)\|/)) { + newTokens = completeTable(tokens.slice(i)); + break; + } + if (i === tokens.length - 1 && token.type === 'list') { + const newListToken = completeListItemPattern(token); + if (newListToken) { + newTokens = [newListToken]; + break; + } + } + if (i === tokens.length - 1 && token.type === 'paragraph') { + // Only operates on a single token, because any newline that follows this should break these patterns + const newToken = completeSingleLinePattern(token); + if (newToken) { + newTokens = [newToken]; + break; + } + } + } + if (newTokens) { + const newTokensList = [ + ...tokens.slice(0, i), + ...newTokens + ]; + newTokensList.links = tokens.links; + return newTokensList; + } + return null; +} +function completeCodespan(token) { + return completeWithString(token, '`'); +} +function completeStar(tokens) { + return completeWithString(tokens, '*'); +} +function completeUnderscore(tokens) { + return completeWithString(tokens, '_'); +} +function completeLinkTarget(tokens) { + return completeWithString(tokens, ')'); +} +function completeLinkTargetArg(tokens) { + return completeWithString(tokens, '")'); +} +function completeLinkText(tokens) { + return completeWithString(tokens, '](https://microsoft.com)'); +} +function completeDoublestar(tokens) { + return completeWithString(tokens, '**'); +} +function completeDoubleUnderscore(tokens) { + return completeWithString(tokens, '__'); +} +function completeWithString(tokens, closingString) { + const mergedRawText = mergeRawTokenText(Array.isArray(tokens) ? tokens : [tokens]); + // If it was completed correctly, this should be a single token. + // Expecting either a Paragraph or a List + return marked.lexer(mergedRawText + closingString)[0]; +} +function completeTable(tokens) { + const mergedRawText = mergeRawTokenText(tokens); + const lines = mergedRawText.split('\n'); + let numCols; // The number of line1 col headers + let hasSeparatorRow = false; + for (let i = 0; i < lines.length; i++) { + const line = lines[i].trim(); + if (typeof numCols === 'undefined' && line.match(/^\s*\|/)) { + const line1Matches = line.match(/(\|[^\|]+)(?=\||$)/g); + if (line1Matches) { + numCols = line1Matches.length; + } + } + else if (typeof numCols === 'number') { + if (line.match(/^\s*\|/)) { + if (i !== lines.length - 1) { + // We got the line1 header row, and the line2 separator row, but there are more lines, and it wasn't parsed as a table! + // That's strange and means that the table is probably malformed in the source, so I won't try to patch it up. + return undefined; + } + // Got a line2 separator row- partial or complete, doesn't matter, we'll replace it with a correct one + hasSeparatorRow = true; + } + else { + // The line after the header row isn't a valid separator row, so the table is malformed, don't fix it up + return undefined; + } + } + } + if (typeof numCols === 'number' && numCols > 0) { + const prefixText = hasSeparatorRow ? lines.slice(0, -1).join('\n') : mergedRawText; + const line1EndsInPipe = !!prefixText.match(/\|\s*$/); + const newRawText = prefixText + (line1EndsInPipe ? '' : '|') + `\n|${' --- |'.repeat(numCols)}`; + return marked.lexer(newRawText); + } + return undefined; +} +function addDompurifyHook(hook, cb) { + dompurify.addHook(hook, cb); + return toDisposable(() => dompurify.removeHook(hook)); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js new file mode 100644 index 0000000000000000000000000000000000000000..b4c6aa6f030e0e87e4bb48e09ca29719bf019b87 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js @@ -0,0 +1,146 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as browser from './browser.js'; +import { IframeUtils } from './iframe.js'; +import * as platform from '../common/platform.js'; +export class StandardMouseEvent { + constructor(targetWindow, e) { + this.timestamp = Date.now(); + this.browserEvent = e; + this.leftButton = e.button === 0; + this.middleButton = e.button === 1; + this.rightButton = e.button === 2; + this.buttons = e.buttons; + this.target = e.target; + this.detail = e.detail || 1; + if (e.type === 'dblclick') { + this.detail = 2; + } + this.ctrlKey = e.ctrlKey; + this.shiftKey = e.shiftKey; + this.altKey = e.altKey; + this.metaKey = e.metaKey; + if (typeof e.pageX === 'number') { + this.posx = e.pageX; + this.posy = e.pageY; + } + else { + // Probably hit by MSGestureEvent + this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft; + this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop; + } + // Find the position of the iframe this code is executing in relative to the iframe where the event was captured. + const iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view); + this.posx -= iframeOffsets.left; + this.posy -= iframeOffsets.top; + } + preventDefault() { + this.browserEvent.preventDefault(); + } + stopPropagation() { + this.browserEvent.stopPropagation(); + } +} +export class StandardWheelEvent { + constructor(e, deltaX = 0, deltaY = 0) { + this.browserEvent = e || null; + this.target = e ? (e.target || e.targetNode || e.srcElement) : null; + this.deltaY = deltaY; + this.deltaX = deltaX; + let shouldFactorDPR = false; + if (browser.isChrome) { + // Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event. + // See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61 + const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/); + const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123; + shouldFactorDPR = chromeMajorVersion <= 122; + } + if (e) { + // Old (deprecated) wheel events + const e1 = e; + const e2 = e; + const devicePixelRatio = e.view?.devicePixelRatio || 1; + // vertical delta scroll + if (typeof e1.wheelDeltaY !== 'undefined') { + if (shouldFactorDPR) { + // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928 + this.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio); + } + else { + this.deltaY = e1.wheelDeltaY / 120; + } + } + else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) { + this.deltaY = -e2.detail / 3; + } + else if (e.type === 'wheel') { + // Modern wheel event + // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent + const ev = e; + if (ev.deltaMode === ev.DOM_DELTA_LINE) { + // the deltas are expressed in lines + if (browser.isFirefox && !platform.isMacintosh) { + this.deltaY = -e.deltaY / 3; + } + else { + this.deltaY = -e.deltaY; + } + } + else { + this.deltaY = -e.deltaY / 40; + } + } + // horizontal delta scroll + if (typeof e1.wheelDeltaX !== 'undefined') { + if (browser.isSafari && platform.isWindows) { + this.deltaX = -(e1.wheelDeltaX / 120); + } + else if (shouldFactorDPR) { + // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928 + this.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio); + } + else { + this.deltaX = e1.wheelDeltaX / 120; + } + } + else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) { + this.deltaX = -e.detail / 3; + } + else if (e.type === 'wheel') { + // Modern wheel event + // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent + const ev = e; + if (ev.deltaMode === ev.DOM_DELTA_LINE) { + // the deltas are expressed in lines + if (browser.isFirefox && !platform.isMacintosh) { + this.deltaX = -e.deltaX / 3; + } + else { + this.deltaX = -e.deltaX; + } + } + else { + this.deltaX = -e.deltaX / 40; + } + } + // Assume a vertical scroll if nothing else worked + if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) { + if (shouldFactorDPR) { + // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928 + this.deltaY = e.wheelDelta / (120 * devicePixelRatio); + } + else { + this.deltaY = e.wheelDelta / 120; + } + } + } + } + preventDefault() { + this.browserEvent?.preventDefault(); + } + stopPropagation() { + this.browserEvent?.stopPropagation(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/performance.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/performance.js new file mode 100644 index 0000000000000000000000000000000000000000..7a1ceeee9cf625b604cc28ebde04eb4287a638a8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/performance.js @@ -0,0 +1,220 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export var inputLatency; +(function (inputLatency) { + const totalKeydownTime = { total: 0, min: Number.MAX_VALUE, max: 0 }; + const totalInputTime = { ...totalKeydownTime }; + const totalRenderTime = { ...totalKeydownTime }; + const totalInputLatencyTime = { ...totalKeydownTime }; + let measurementsCount = 0; + const state = { + keydown: 0 /* EventPhase.Before */, + input: 0 /* EventPhase.Before */, + render: 0 /* EventPhase.Before */, + }; + /** + * Record the start of the keydown event. + */ + function onKeyDown() { + /** Direct Check C. See explanation in {@link recordIfFinished} */ + recordIfFinished(); + performance.mark('inputlatency/start'); + performance.mark('keydown/start'); + state.keydown = 1 /* EventPhase.InProgress */; + queueMicrotask(markKeyDownEnd); + } + inputLatency.onKeyDown = onKeyDown; + /** + * Mark the end of the keydown event. + */ + function markKeyDownEnd() { + if (state.keydown === 1 /* EventPhase.InProgress */) { + performance.mark('keydown/end'); + state.keydown = 2 /* EventPhase.Finished */; + } + } + /** + * Record the start of the beforeinput event. + */ + function onBeforeInput() { + performance.mark('input/start'); + state.input = 1 /* EventPhase.InProgress */; + /** Schedule Task A. See explanation in {@link recordIfFinished} */ + scheduleRecordIfFinishedTask(); + } + inputLatency.onBeforeInput = onBeforeInput; + /** + * Record the start of the input event. + */ + function onInput() { + if (state.input === 0 /* EventPhase.Before */) { + // it looks like we didn't receive a `beforeinput` + onBeforeInput(); + } + queueMicrotask(markInputEnd); + } + inputLatency.onInput = onInput; + function markInputEnd() { + if (state.input === 1 /* EventPhase.InProgress */) { + performance.mark('input/end'); + state.input = 2 /* EventPhase.Finished */; + } + } + /** + * Record the start of the keyup event. + */ + function onKeyUp() { + /** Direct Check D. See explanation in {@link recordIfFinished} */ + recordIfFinished(); + } + inputLatency.onKeyUp = onKeyUp; + /** + * Record the start of the selectionchange event. + */ + function onSelectionChange() { + /** Direct Check E. See explanation in {@link recordIfFinished} */ + recordIfFinished(); + } + inputLatency.onSelectionChange = onSelectionChange; + /** + * Record the start of the animation frame performing the rendering. + */ + function onRenderStart() { + // Render may be triggered during input, but we only measure the following animation frame + if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 0 /* EventPhase.Before */) { + // Only measure the first render after keyboard input + performance.mark('render/start'); + state.render = 1 /* EventPhase.InProgress */; + queueMicrotask(markRenderEnd); + /** Schedule Task B. See explanation in {@link recordIfFinished} */ + scheduleRecordIfFinishedTask(); + } + } + inputLatency.onRenderStart = onRenderStart; + /** + * Mark the end of the animation frame performing the rendering. + */ + function markRenderEnd() { + if (state.render === 1 /* EventPhase.InProgress */) { + performance.mark('render/end'); + state.render = 2 /* EventPhase.Finished */; + } + } + function scheduleRecordIfFinishedTask() { + // Here we can safely assume that the `setTimeout` will not be + // artificially delayed by 4ms because we schedule it from + // event handlers + setTimeout(recordIfFinished); + } + /** + * Record the input latency sample if input handling and rendering are finished. + * + * The challenge here is that we want to record the latency in such a way that it includes + * also the layout and painting work the browser does during the animation frame task. + * + * Simply scheduling a new task (via `setTimeout`) from the animation frame task would + * schedule the new task at the end of the task queue (after other code that uses `setTimeout`), + * so we need to use multiple strategies to make sure our task runs before others: + * + * We schedule tasks (A and B): + * - we schedule a task A (via a `setTimeout` call) when the input starts in `markInputStart`. + * If the animation frame task is scheduled quickly by the browser, then task A has a very good + * chance of being the very first task after the animation frame and thus will record the input latency. + * - however, if the animation frame task is scheduled a bit later, then task A might execute + * before the animation frame task. We therefore schedule another task B from `markRenderStart`. + * + * We do direct checks in browser event handlers (C, D, E): + * - if the browser has multiple keydown events queued up, they will be scheduled before the `setTimeout` tasks, + * so we do a direct check in the keydown event handler (C). + * - depending on timing, sometimes the animation frame is scheduled even before the `keyup` event, so we + * do a direct check there too (E). + * - the browser oftentimes emits a `selectionchange` event after an `input`, so we do a direct check there (D). + */ + function recordIfFinished() { + if (state.keydown === 2 /* EventPhase.Finished */ && state.input === 2 /* EventPhase.Finished */ && state.render === 2 /* EventPhase.Finished */) { + performance.mark('inputlatency/end'); + performance.measure('keydown', 'keydown/start', 'keydown/end'); + performance.measure('input', 'input/start', 'input/end'); + performance.measure('render', 'render/start', 'render/end'); + performance.measure('inputlatency', 'inputlatency/start', 'inputlatency/end'); + addMeasure('keydown', totalKeydownTime); + addMeasure('input', totalInputTime); + addMeasure('render', totalRenderTime); + addMeasure('inputlatency', totalInputLatencyTime); + // console.info( + // `input latency=${performance.getEntriesByName('inputlatency')[0].duration.toFixed(1)} [` + + // `keydown=${performance.getEntriesByName('keydown')[0].duration.toFixed(1)}, ` + + // `input=${performance.getEntriesByName('input')[0].duration.toFixed(1)}, ` + + // `render=${performance.getEntriesByName('render')[0].duration.toFixed(1)}` + + // `]` + // ); + measurementsCount++; + reset(); + } + } + function addMeasure(entryName, cumulativeMeasurement) { + const duration = performance.getEntriesByName(entryName)[0].duration; + cumulativeMeasurement.total += duration; + cumulativeMeasurement.min = Math.min(cumulativeMeasurement.min, duration); + cumulativeMeasurement.max = Math.max(cumulativeMeasurement.max, duration); + } + /** + * Clear the current sample. + */ + function reset() { + performance.clearMarks('keydown/start'); + performance.clearMarks('keydown/end'); + performance.clearMarks('input/start'); + performance.clearMarks('input/end'); + performance.clearMarks('render/start'); + performance.clearMarks('render/end'); + performance.clearMarks('inputlatency/start'); + performance.clearMarks('inputlatency/end'); + performance.clearMeasures('keydown'); + performance.clearMeasures('input'); + performance.clearMeasures('render'); + performance.clearMeasures('inputlatency'); + state.keydown = 0 /* EventPhase.Before */; + state.input = 0 /* EventPhase.Before */; + state.render = 0 /* EventPhase.Before */; + } + /** + * Gets all input latency samples and clears the internal buffers to start recording a new set + * of samples. + */ + function getAndClearMeasurements() { + if (measurementsCount === 0) { + return undefined; + } + // Assemble the result + const result = { + keydown: cumulativeToFinalMeasurement(totalKeydownTime), + input: cumulativeToFinalMeasurement(totalInputTime), + render: cumulativeToFinalMeasurement(totalRenderTime), + total: cumulativeToFinalMeasurement(totalInputLatencyTime), + sampleCount: measurementsCount + }; + // Clear the cumulative measurements + clearCumulativeMeasurement(totalKeydownTime); + clearCumulativeMeasurement(totalInputTime); + clearCumulativeMeasurement(totalRenderTime); + clearCumulativeMeasurement(totalInputLatencyTime); + measurementsCount = 0; + return result; + } + inputLatency.getAndClearMeasurements = getAndClearMeasurements; + function cumulativeToFinalMeasurement(cumulative) { + return { + average: cumulative.total / measurementsCount, + max: cumulative.max, + min: cumulative.min, + }; + } + function clearCumulativeMeasurement(cumulative) { + cumulative.total = 0; + cumulative.min = Number.MAX_VALUE; + cumulative.max = 0; + } +})(inputLatency || (inputLatency = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js new file mode 100644 index 0000000000000000000000000000000000000000..9c299db4ac2b96fdd8d97cd4364708abe27c0c93 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js @@ -0,0 +1,85 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { getWindowId, onDidUnregisterWindow } from './dom.js'; +import { Emitter, Event } from '../common/event.js'; +import { Disposable, markAsSingleton } from '../common/lifecycle.js'; +/** + * See https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes + */ +class DevicePixelRatioMonitor extends Disposable { + constructor(targetWindow) { + super(); + this._onDidChange = this._register(new Emitter()); + this.onDidChange = this._onDidChange.event; + this._listener = () => this._handleChange(targetWindow, true); + this._mediaQueryList = null; + this._handleChange(targetWindow, false); + } + _handleChange(targetWindow, fireEvent) { + this._mediaQueryList?.removeEventListener('change', this._listener); + this._mediaQueryList = targetWindow.matchMedia(`(resolution: ${targetWindow.devicePixelRatio}dppx)`); + this._mediaQueryList.addEventListener('change', this._listener); + if (fireEvent) { + this._onDidChange.fire(); + } + } +} +class PixelRatioMonitorImpl extends Disposable { + get value() { + return this._value; + } + constructor(targetWindow) { + super(); + this._onDidChange = this._register(new Emitter()); + this.onDidChange = this._onDidChange.event; + this._value = this._getPixelRatio(targetWindow); + const dprMonitor = this._register(new DevicePixelRatioMonitor(targetWindow)); + this._register(dprMonitor.onDidChange(() => { + this._value = this._getPixelRatio(targetWindow); + this._onDidChange.fire(this._value); + })); + } + _getPixelRatio(targetWindow) { + const ctx = document.createElement('canvas').getContext('2d'); + const dpr = targetWindow.devicePixelRatio || 1; + const bsr = ctx.webkitBackingStorePixelRatio || + ctx.mozBackingStorePixelRatio || + ctx.msBackingStorePixelRatio || + ctx.oBackingStorePixelRatio || + ctx.backingStorePixelRatio || 1; + return dpr / bsr; + } +} +class PixelRatioMonitorFacade { + constructor() { + this.mapWindowIdToPixelRatioMonitor = new Map(); + } + _getOrCreatePixelRatioMonitor(targetWindow) { + const targetWindowId = getWindowId(targetWindow); + let pixelRatioMonitor = this.mapWindowIdToPixelRatioMonitor.get(targetWindowId); + if (!pixelRatioMonitor) { + pixelRatioMonitor = markAsSingleton(new PixelRatioMonitorImpl(targetWindow)); + this.mapWindowIdToPixelRatioMonitor.set(targetWindowId, pixelRatioMonitor); + markAsSingleton(Event.once(onDidUnregisterWindow)(({ vscodeWindowId }) => { + if (vscodeWindowId === targetWindowId) { + pixelRatioMonitor?.dispose(); + this.mapWindowIdToPixelRatioMonitor.delete(targetWindowId); + } + })); + } + return pixelRatioMonitor; + } + getInstance(targetWindow) { + return this._getOrCreatePixelRatioMonitor(targetWindow); + } +} +/** + * Returns the pixel ratio. + * + * This is useful for rendering elements at native screen resolution or for being used as + * a cache key when storing font measurements. Fonts might render differently depending on resolution + * and any measurements need to be discarded for example when a window is moved from a monitor to another. + */ +export const PixelRatio = new PixelRatioMonitorFacade(); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/touch.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/touch.js new file mode 100644 index 0000000000000000000000000000000000000000..88de3f1d5896666a8f878d0d616c7a2c8d4c38b3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/touch.js @@ -0,0 +1,268 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import * as DomUtils from './dom.js'; +import { mainWindow } from './window.js'; +import * as arrays from '../common/arrays.js'; +import { memoize } from '../common/decorators.js'; +import { Event as EventUtils } from '../common/event.js'; +import { Disposable, markAsSingleton, toDisposable } from '../common/lifecycle.js'; +import { LinkedList } from '../common/linkedList.js'; +export var EventType; +(function (EventType) { + EventType.Tap = '-monaco-gesturetap'; + EventType.Change = '-monaco-gesturechange'; + EventType.Start = '-monaco-gesturestart'; + EventType.End = '-monaco-gesturesend'; + EventType.Contextmenu = '-monaco-gesturecontextmenu'; +})(EventType || (EventType = {})); +export class Gesture extends Disposable { + static { this.SCROLL_FRICTION = -0.005; } + static { this.HOLD_DELAY = 700; } + static { this.CLEAR_TAP_COUNT_TIME = 400; } // ms + constructor() { + super(); + this.dispatched = false; + this.targets = new LinkedList(); + this.ignoreTargets = new LinkedList(); + this.activeTouches = {}; + this.handle = null; + this._lastSetTapCountTime = 0; + this._register(EventUtils.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => { + disposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e) => this.onTouchStart(e), { passive: false })); + disposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e) => this.onTouchEnd(window, e))); + disposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e) => this.onTouchMove(e), { passive: false })); + }, { window: mainWindow, disposables: this._store })); + } + static addTarget(element) { + if (!Gesture.isTouchDevice()) { + return Disposable.None; + } + if (!Gesture.INSTANCE) { + Gesture.INSTANCE = markAsSingleton(new Gesture()); + } + const remove = Gesture.INSTANCE.targets.push(element); + return toDisposable(remove); + } + static ignoreTarget(element) { + if (!Gesture.isTouchDevice()) { + return Disposable.None; + } + if (!Gesture.INSTANCE) { + Gesture.INSTANCE = markAsSingleton(new Gesture()); + } + const remove = Gesture.INSTANCE.ignoreTargets.push(element); + return toDisposable(remove); + } + static isTouchDevice() { + // `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be + // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast + return 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0; + } + dispose() { + if (this.handle) { + this.handle.dispose(); + this.handle = null; + } + super.dispose(); + } + onTouchStart(e) { + const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based. + if (this.handle) { + this.handle.dispose(); + this.handle = null; + } + for (let i = 0, len = e.targetTouches.length; i < len; i++) { + const touch = e.targetTouches.item(i); + this.activeTouches[touch.identifier] = { + id: touch.identifier, + initialTarget: touch.target, + initialTimeStamp: timestamp, + initialPageX: touch.pageX, + initialPageY: touch.pageY, + rollingTimestamps: [timestamp], + rollingPageX: [touch.pageX], + rollingPageY: [touch.pageY] + }; + const evt = this.newGestureEvent(EventType.Start, touch.target); + evt.pageX = touch.pageX; + evt.pageY = touch.pageY; + this.dispatchEvent(evt); + } + if (this.dispatched) { + e.preventDefault(); + e.stopPropagation(); + this.dispatched = false; + } + } + onTouchEnd(targetWindow, e) { + const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based. + const activeTouchCount = Object.keys(this.activeTouches).length; + for (let i = 0, len = e.changedTouches.length; i < len; i++) { + const touch = e.changedTouches.item(i); + if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) { + console.warn('move of an UNKNOWN touch', touch); + continue; + } + const data = this.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp; + if (holdTime < Gesture.HOLD_DELAY + && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30 + && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) { + const evt = this.newGestureEvent(EventType.Tap, data.initialTarget); + evt.pageX = arrays.tail(data.rollingPageX); + evt.pageY = arrays.tail(data.rollingPageY); + this.dispatchEvent(evt); + } + else if (holdTime >= Gesture.HOLD_DELAY + && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30 + && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) { + const evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget); + evt.pageX = arrays.tail(data.rollingPageX); + evt.pageY = arrays.tail(data.rollingPageY); + this.dispatchEvent(evt); + } + else if (activeTouchCount === 1) { + const finalX = arrays.tail(data.rollingPageX); + const finalY = arrays.tail(data.rollingPageY); + const deltaT = arrays.tail(data.rollingTimestamps) - data.rollingTimestamps[0]; + const deltaX = finalX - data.rollingPageX[0]; + const deltaY = finalY - data.rollingPageY[0]; + // We need to get all the dispatch targets on the start of the inertia event + const dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget)); + this.inertia(targetWindow, dispatchTo, timestamp, // time now + Math.abs(deltaX) / deltaT, // speed + deltaX > 0 ? 1 : -1, // x direction + finalX, // x now + Math.abs(deltaY) / deltaT, // y speed + deltaY > 0 ? 1 : -1, // y direction + finalY // y now + ); + } + this.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget)); + // forget about this touch + delete this.activeTouches[touch.identifier]; + } + if (this.dispatched) { + e.preventDefault(); + e.stopPropagation(); + this.dispatched = false; + } + } + newGestureEvent(type, initialTarget) { + const event = document.createEvent('CustomEvent'); + event.initEvent(type, false, true); + event.initialTarget = initialTarget; + event.tapCount = 0; + return event; + } + dispatchEvent(event) { + if (event.type === EventType.Tap) { + const currentTime = (new Date()).getTime(); + let setTapCount = 0; + if (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) { + setTapCount = 1; + } + else { + setTapCount = 2; + } + this._lastSetTapCountTime = currentTime; + event.tapCount = setTapCount; + } + else if (event.type === EventType.Change || event.type === EventType.Contextmenu) { + // tap is canceled by scrolling or context menu + this._lastSetTapCountTime = 0; + } + if (event.initialTarget instanceof Node) { + for (const ignoreTarget of this.ignoreTargets) { + if (ignoreTarget.contains(event.initialTarget)) { + return; + } + } + const targets = []; + for (const target of this.targets) { + if (target.contains(event.initialTarget)) { + let depth = 0; + let now = event.initialTarget; + while (now && now !== target) { + depth++; + now = now.parentElement; + } + targets.push([depth, target]); + } + } + targets.sort((a, b) => a[0] - b[0]); + for (const [_, target] of targets) { + target.dispatchEvent(event); + this.dispatched = true; + } + } + } + inertia(targetWindow, dispatchTo, t1, vX, dirX, x, vY, dirY, y) { + this.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => { + const now = Date.now(); + // velocity: old speed + accel_over_time + const deltaT = now - t1; + let delta_pos_x = 0, delta_pos_y = 0; + let stopped = true; + vX += Gesture.SCROLL_FRICTION * deltaT; + vY += Gesture.SCROLL_FRICTION * deltaT; + if (vX > 0) { + stopped = false; + delta_pos_x = dirX * vX * deltaT; + } + if (vY > 0) { + stopped = false; + delta_pos_y = dirY * vY * deltaT; + } + // dispatch translation event + const evt = this.newGestureEvent(EventType.Change); + evt.translationX = delta_pos_x; + evt.translationY = delta_pos_y; + dispatchTo.forEach(d => d.dispatchEvent(evt)); + if (!stopped) { + this.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y); + } + }); + } + onTouchMove(e) { + const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based. + for (let i = 0, len = e.changedTouches.length; i < len; i++) { + const touch = e.changedTouches.item(i); + if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) { + console.warn('end of an UNKNOWN touch', touch); + continue; + } + const data = this.activeTouches[touch.identifier]; + const evt = this.newGestureEvent(EventType.Change, data.initialTarget); + evt.translationX = touch.pageX - arrays.tail(data.rollingPageX); + evt.translationY = touch.pageY - arrays.tail(data.rollingPageY); + evt.pageX = touch.pageX; + evt.pageY = touch.pageY; + this.dispatchEvent(evt); + // only keep a few data points, to average the final speed + if (data.rollingPageX.length > 3) { + data.rollingPageX.shift(); + data.rollingPageY.shift(); + data.rollingTimestamps.shift(); + } + data.rollingPageX.push(touch.pageX); + data.rollingPageY.push(touch.pageY); + data.rollingTimestamps.push(timestamp); + } + if (this.dispatched) { + e.preventDefault(); + e.stopPropagation(); + this.dispatched = false; + } + } +} +__decorate([ + memoize +], Gesture, "isTouchDevice", null); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js new file mode 100644 index 0000000000000000000000000000000000000000..8ac809dd3553f96227cf0480acb69018bdf5b333 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { onUnexpectedError } from '../common/errors.js'; +export function createTrustedTypesPolicy(policyName, policyOptions) { + const monacoEnvironment = globalThis.MonacoEnvironment; + if (monacoEnvironment?.createTrustedTypesPolicy) { + try { + return monacoEnvironment.createTrustedTypesPolicy(policyName, policyOptions); + } + catch (err) { + onUnexpectedError(err); + return undefined; + } + } + try { + return globalThis.trustedTypes?.createPolicy(policyName, policyOptions); + } + catch (err) { + onUnexpectedError(err); + return undefined; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js new file mode 100644 index 0000000000000000000000000000000000000000..4df6d28300c1c815de6e2ff718f41aaaeebdf025 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js @@ -0,0 +1,373 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { isFirefox } from '../../browser.js'; +import { DataTransfers } from '../../dnd.js'; +import { addDisposableListener, EventHelper, EventType } from '../../dom.js'; +import { EventType as TouchEventType, Gesture } from '../../touch.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { SelectBox } from '../selectBox/selectBox.js'; +import { Action, ActionRunner, Separator } from '../../../common/actions.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import * as platform from '../../../common/platform.js'; +import * as types from '../../../common/types.js'; +import './actionbar.css'; +import * as nls from '../../../../nls.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +export class BaseActionViewItem extends Disposable { + get action() { + return this._action; + } + constructor(context, action, options = {}) { + super(); + this.options = options; + this._context = context || this; + this._action = action; + if (action instanceof Action) { + this._register(action.onDidChange(event => { + if (!this.element) { + // we have not been rendered yet, so there + // is no point in updating the UI + return; + } + this.handleActionChangeEvent(event); + })); + } + } + handleActionChangeEvent(event) { + if (event.enabled !== undefined) { + this.updateEnabled(); + } + if (event.checked !== undefined) { + this.updateChecked(); + } + if (event.class !== undefined) { + this.updateClass(); + } + if (event.label !== undefined) { + this.updateLabel(); + this.updateTooltip(); + } + if (event.tooltip !== undefined) { + this.updateTooltip(); + } + } + get actionRunner() { + if (!this._actionRunner) { + this._actionRunner = this._register(new ActionRunner()); + } + return this._actionRunner; + } + set actionRunner(actionRunner) { + this._actionRunner = actionRunner; + } + isEnabled() { + return this._action.enabled; + } + setActionContext(newContext) { + this._context = newContext; + } + render(container) { + const element = this.element = container; + this._register(Gesture.addTarget(container)); + const enableDragging = this.options && this.options.draggable; + if (enableDragging) { + container.draggable = true; + if (isFirefox) { + // Firefox: requires to set a text data transfer to get going + this._register(addDisposableListener(container, EventType.DRAG_START, e => e.dataTransfer?.setData(DataTransfers.TEXT, this._action.label))); + } + } + this._register(addDisposableListener(element, TouchEventType.Tap, e => this.onClick(e, true))); // Preserve focus on tap #125470 + this._register(addDisposableListener(element, EventType.MOUSE_DOWN, e => { + if (!enableDragging) { + EventHelper.stop(e, true); // do not run when dragging is on because that would disable it + } + if (this._action.enabled && e.button === 0) { + element.classList.add('active'); + } + })); + if (platform.isMacintosh) { + // macOS: allow to trigger the button when holding Ctrl+key and pressing the + // main mouse button. This is for scenarios where e.g. some interaction forces + // the Ctrl+key to be pressed and hold but the user still wants to interact + // with the actions (for example quick access in quick navigation mode). + this._register(addDisposableListener(element, EventType.CONTEXT_MENU, e => { + if (e.button === 0 && e.ctrlKey === true) { + this.onClick(e); + } + })); + } + this._register(addDisposableListener(element, EventType.CLICK, e => { + EventHelper.stop(e, true); + // menus do not use the click event + if (!(this.options && this.options.isMenu)) { + this.onClick(e); + } + })); + this._register(addDisposableListener(element, EventType.DBLCLICK, e => { + EventHelper.stop(e, true); + })); + [EventType.MOUSE_UP, EventType.MOUSE_OUT].forEach(event => { + this._register(addDisposableListener(element, event, e => { + EventHelper.stop(e); + element.classList.remove('active'); + })); + }); + } + onClick(event, preserveFocus = false) { + EventHelper.stop(event, true); + const context = types.isUndefinedOrNull(this._context) ? this.options?.useEventAsContext ? event : { preserveFocus } : this._context; + this.actionRunner.run(this._action, context); + } + // Only set the tabIndex on the element once it is about to get focused + // That way this element wont be a tab stop when it is not needed #106441 + focus() { + if (this.element) { + this.element.tabIndex = 0; + this.element.focus(); + this.element.classList.add('focused'); + } + } + blur() { + if (this.element) { + this.element.blur(); + this.element.tabIndex = -1; + this.element.classList.remove('focused'); + } + } + setFocusable(focusable) { + if (this.element) { + this.element.tabIndex = focusable ? 0 : -1; + } + } + get trapsArrowNavigation() { + return false; + } + updateEnabled() { + // implement in subclass + } + updateLabel() { + // implement in subclass + } + getClass() { + return this.action.class; + } + getTooltip() { + return this.action.tooltip; + } + updateTooltip() { + if (!this.element) { + return; + } + const title = this.getTooltip() ?? ''; + this.updateAriaLabel(); + if (this.options.hoverDelegate?.showNativeHover) { + /* While custom hover is not inside custom hover */ + this.element.title = title; + } + else { + if (!this.customHover && title !== '') { + const hoverDelegate = this.options.hoverDelegate ?? getDefaultHoverDelegate('element'); + this.customHover = this._store.add(getBaseLayerHoverDelegate().setupManagedHover(hoverDelegate, this.element, title)); + } + else if (this.customHover) { + this.customHover.update(title); + } + } + } + updateAriaLabel() { + if (this.element) { + const title = this.getTooltip() ?? ''; + this.element.setAttribute('aria-label', title); + } + } + updateClass() { + // implement in subclass + } + updateChecked() { + // implement in subclass + } + dispose() { + if (this.element) { + this.element.remove(); + this.element = undefined; + } + this._context = undefined; + super.dispose(); + } +} +export class ActionViewItem extends BaseActionViewItem { + constructor(context, action, options) { + super(context, action, options); + this.options = options; + this.options.icon = options.icon !== undefined ? options.icon : false; + this.options.label = options.label !== undefined ? options.label : true; + this.cssClass = ''; + } + render(container) { + super.render(container); + types.assertType(this.element); + const label = document.createElement('a'); + label.classList.add('action-label'); + label.setAttribute('role', this.getDefaultAriaRole()); + this.label = label; + this.element.appendChild(label); + if (this.options.label && this.options.keybinding) { + const kbLabel = document.createElement('span'); + kbLabel.classList.add('keybinding'); + kbLabel.textContent = this.options.keybinding; + this.element.appendChild(kbLabel); + } + this.updateClass(); + this.updateLabel(); + this.updateTooltip(); + this.updateEnabled(); + this.updateChecked(); + } + getDefaultAriaRole() { + if (this._action.id === Separator.ID) { + return 'presentation'; // A separator is a presentation item + } + else { + if (this.options.isMenu) { + return 'menuitem'; + } + else if (this.options.isTabList) { + return 'tab'; + } + else { + return 'button'; + } + } + } + // Only set the tabIndex on the element once it is about to get focused + // That way this element wont be a tab stop when it is not needed #106441 + focus() { + if (this.label) { + this.label.tabIndex = 0; + this.label.focus(); + } + } + blur() { + if (this.label) { + this.label.tabIndex = -1; + } + } + setFocusable(focusable) { + if (this.label) { + this.label.tabIndex = focusable ? 0 : -1; + } + } + updateLabel() { + if (this.options.label && this.label) { + this.label.textContent = this.action.label; + } + } + getTooltip() { + let title = null; + if (this.action.tooltip) { + title = this.action.tooltip; + } + else if (!this.options.label && this.action.label && this.options.icon) { + title = this.action.label; + if (this.options.keybinding) { + title = nls.localize({ key: 'titleLabel', comment: ['action title', 'action keybinding'] }, "{0} ({1})", title, this.options.keybinding); + } + } + return title ?? undefined; + } + updateClass() { + if (this.cssClass && this.label) { + this.label.classList.remove(...this.cssClass.split(' ')); + } + if (this.options.icon) { + this.cssClass = this.getClass(); + if (this.label) { + this.label.classList.add('codicon'); + if (this.cssClass) { + this.label.classList.add(...this.cssClass.split(' ')); + } + } + this.updateEnabled(); + } + else { + this.label?.classList.remove('codicon'); + } + } + updateEnabled() { + if (this.action.enabled) { + if (this.label) { + this.label.removeAttribute('aria-disabled'); + this.label.classList.remove('disabled'); + } + this.element?.classList.remove('disabled'); + } + else { + if (this.label) { + this.label.setAttribute('aria-disabled', 'true'); + this.label.classList.add('disabled'); + } + this.element?.classList.add('disabled'); + } + } + updateAriaLabel() { + if (this.label) { + const title = this.getTooltip() ?? ''; + this.label.setAttribute('aria-label', title); + } + } + updateChecked() { + if (this.label) { + if (this.action.checked !== undefined) { + this.label.classList.toggle('checked', this.action.checked); + if (this.options.isTabList) { + this.label.setAttribute('aria-selected', this.action.checked ? 'true' : 'false'); + } + else { + this.label.setAttribute('aria-checked', this.action.checked ? 'true' : 'false'); + this.label.setAttribute('role', 'checkbox'); + } + } + else { + this.label.classList.remove('checked'); + this.label.removeAttribute(this.options.isTabList ? 'aria-selected' : 'aria-checked'); + this.label.setAttribute('role', this.getDefaultAriaRole()); + } + } + } +} +export class SelectActionViewItem extends BaseActionViewItem { + constructor(ctx, action, options, selected, contextViewProvider, styles, selectBoxOptions) { + super(ctx, action); + this.selectBox = new SelectBox(options, selected, contextViewProvider, styles, selectBoxOptions); + this.selectBox.setFocusable(false); + this._register(this.selectBox); + this.registerListeners(); + } + select(index) { + this.selectBox.select(index); + } + registerListeners() { + this._register(this.selectBox.onDidSelect(e => this.runAction(e.selected, e.index))); + } + runAction(option, index) { + this.actionRunner.run(this._action, this.getActionContext(option, index)); + } + getActionContext(option, index) { + return option; + } + setFocusable(focusable) { + this.selectBox.setFocusable(focusable); + } + focus() { + this.selectBox?.focus(); + } + blur() { + this.selectBox?.blur(); + } + render(container) { + this.selectBox.render(container); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css new file mode 100644 index 0000000000000000000000000000000000000000..cf699047f022151d46140d272277b1d0a8aee559 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-action-bar { + white-space: nowrap; + height: 100%; +} + +.monaco-action-bar .actions-container { + display: flex; + margin: 0 auto; + padding: 0; + height: 100%; + width: 100%; + align-items: center; +} + +.monaco-action-bar.vertical .actions-container { + display: inline-block; +} + +.monaco-action-bar .action-item { + display: block; + align-items: center; + justify-content: center; + cursor: pointer; + position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */ +} + +.monaco-action-bar .action-item.disabled { + cursor: default; +} + +.monaco-action-bar .action-item .icon, +.monaco-action-bar .action-item .codicon { + display: block; +} + +.monaco-action-bar .action-item .codicon { + display: flex; + align-items: center; + width: 16px; + height: 16px; +} + +.monaco-action-bar .action-label { + display: flex; + font-size: 11px; + padding: 3px; + border-radius: 5px; +} + +.monaco-action-bar .action-item.disabled .action-label, +.monaco-action-bar .action-item.disabled .action-label::before, +.monaco-action-bar .action-item.disabled .action-label:hover { + color: var(--vscode-disabledForeground); +} + +/* Vertical actions */ + +.monaco-action-bar.vertical { + text-align: left; +} + +.monaco-action-bar.vertical .action-item { + display: block; +} + +.monaco-action-bar.vertical .action-label.separator { + display: block; + border-bottom: 1px solid #bbb; + padding-top: 1px; + margin-left: .8em; + margin-right: .8em; +} + +.monaco-action-bar .action-item .action-label.separator { + width: 1px; + height: 16px; + margin: 5px 4px !important; + cursor: default; + min-width: 1px; + padding: 0; + background-color: #bbb; +} + +.secondary-actions .monaco-action-bar .action-label { + margin-left: 6px; +} + +/* Action Items */ +.monaco-action-bar .action-item.select-container { + overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */ + flex: 1; + max-width: 170px; + min-width: 60px; + display: flex; + align-items: center; + justify-content: center; + margin-right: 10px; +} + +.monaco-action-bar .action-item.action-dropdown-item { + display: flex; +} + +.monaco-action-bar .action-item.action-dropdown-item > .action-dropdown-item-separator { + display: flex; + align-items: center; + cursor: default; +} + +.monaco-action-bar .action-item.action-dropdown-item > .action-dropdown-item-separator > div { + width: 1px; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js new file mode 100644 index 0000000000000000000000000000000000000000..445c3e5c478ab18e811f94cf815f8d73475e530e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js @@ -0,0 +1,417 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as DOM from '../../dom.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { ActionViewItem, BaseActionViewItem } from './actionViewItems.js'; +import { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { ActionRunner, Separator } from '../../../common/actions.js'; +import { Emitter } from '../../../common/event.js'; +import { Disposable, DisposableMap, DisposableStore, dispose } from '../../../common/lifecycle.js'; +import * as types from '../../../common/types.js'; +import './actionbar.css'; +export class ActionBar extends Disposable { + constructor(container, options = {}) { + super(); + this._actionRunnerDisposables = this._register(new DisposableStore()); + this.viewItemDisposables = this._register(new DisposableMap()); + // Trigger Key Tracking + this.triggerKeyDown = false; + this.focusable = true; + this._onDidBlur = this._register(new Emitter()); + this.onDidBlur = this._onDidBlur.event; + this._onDidCancel = this._register(new Emitter({ onWillAddFirstListener: () => this.cancelHasListener = true })); + this.onDidCancel = this._onDidCancel.event; + this.cancelHasListener = false; + this._onDidRun = this._register(new Emitter()); + this.onDidRun = this._onDidRun.event; + this._onWillRun = this._register(new Emitter()); + this.onWillRun = this._onWillRun.event; + this.options = options; + this._context = options.context ?? null; + this._orientation = this.options.orientation ?? 0 /* ActionsOrientation.HORIZONTAL */; + this._triggerKeys = { + keyDown: this.options.triggerKeys?.keyDown ?? false, + keys: this.options.triggerKeys?.keys ?? [3 /* KeyCode.Enter */, 10 /* KeyCode.Space */] + }; + this._hoverDelegate = options.hoverDelegate ?? this._register(createInstantHoverDelegate()); + if (this.options.actionRunner) { + this._actionRunner = this.options.actionRunner; + } + else { + this._actionRunner = new ActionRunner(); + this._actionRunnerDisposables.add(this._actionRunner); + } + this._actionRunnerDisposables.add(this._actionRunner.onDidRun(e => this._onDidRun.fire(e))); + this._actionRunnerDisposables.add(this._actionRunner.onWillRun(e => this._onWillRun.fire(e))); + this.viewItems = []; + this.focusedItem = undefined; + this.domNode = document.createElement('div'); + this.domNode.className = 'monaco-action-bar'; + let previousKeys; + let nextKeys; + switch (this._orientation) { + case 0 /* ActionsOrientation.HORIZONTAL */: + previousKeys = [15 /* KeyCode.LeftArrow */]; + nextKeys = [17 /* KeyCode.RightArrow */]; + break; + case 1 /* ActionsOrientation.VERTICAL */: + previousKeys = [16 /* KeyCode.UpArrow */]; + nextKeys = [18 /* KeyCode.DownArrow */]; + this.domNode.className += ' vertical'; + break; + } + this._register(DOM.addDisposableListener(this.domNode, DOM.EventType.KEY_DOWN, e => { + const event = new StandardKeyboardEvent(e); + let eventHandled = true; + const focusedItem = typeof this.focusedItem === 'number' ? this.viewItems[this.focusedItem] : undefined; + if (previousKeys && (event.equals(previousKeys[0]) || event.equals(previousKeys[1]))) { + eventHandled = this.focusPrevious(); + } + else if (nextKeys && (event.equals(nextKeys[0]) || event.equals(nextKeys[1]))) { + eventHandled = this.focusNext(); + } + else if (event.equals(9 /* KeyCode.Escape */) && this.cancelHasListener) { + this._onDidCancel.fire(); + } + else if (event.equals(14 /* KeyCode.Home */)) { + eventHandled = this.focusFirst(); + } + else if (event.equals(13 /* KeyCode.End */)) { + eventHandled = this.focusLast(); + } + else if (event.equals(2 /* KeyCode.Tab */) && focusedItem instanceof BaseActionViewItem && focusedItem.trapsArrowNavigation) { + // Tab, so forcibly focus next #219199 + eventHandled = this.focusNext(undefined, true); + } + else if (this.isTriggerKeyEvent(event)) { + // Staying out of the else branch even if not triggered + if (this._triggerKeys.keyDown) { + this.doTrigger(event); + } + else { + this.triggerKeyDown = true; + } + } + else { + eventHandled = false; + } + if (eventHandled) { + event.preventDefault(); + event.stopPropagation(); + } + })); + this._register(DOM.addDisposableListener(this.domNode, DOM.EventType.KEY_UP, e => { + const event = new StandardKeyboardEvent(e); + // Run action on Enter/Space + if (this.isTriggerKeyEvent(event)) { + if (!this._triggerKeys.keyDown && this.triggerKeyDown) { + this.triggerKeyDown = false; + this.doTrigger(event); + } + event.preventDefault(); + event.stopPropagation(); + } + // Recompute focused item + 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 */)) { + this.updateFocusedItem(); + } + })); + this.focusTracker = this._register(DOM.trackFocus(this.domNode)); + this._register(this.focusTracker.onDidBlur(() => { + if (DOM.getActiveElement() === this.domNode || !DOM.isAncestor(DOM.getActiveElement(), this.domNode)) { + this._onDidBlur.fire(); + this.previouslyFocusedItem = this.focusedItem; + this.focusedItem = undefined; + this.triggerKeyDown = false; + } + })); + this._register(this.focusTracker.onDidFocus(() => this.updateFocusedItem())); + this.actionsList = document.createElement('ul'); + this.actionsList.className = 'actions-container'; + if (this.options.highlightToggledItems) { + this.actionsList.classList.add('highlight-toggled'); + } + this.actionsList.setAttribute('role', this.options.ariaRole || 'toolbar'); + if (this.options.ariaLabel) { + this.actionsList.setAttribute('aria-label', this.options.ariaLabel); + } + this.domNode.appendChild(this.actionsList); + container.appendChild(this.domNode); + } + refreshRole() { + if (this.length() >= 1) { + this.actionsList.setAttribute('role', this.options.ariaRole || 'toolbar'); + } + else { + this.actionsList.setAttribute('role', 'presentation'); + } + } + // Some action bars should not be focusable at times + // When an action bar is not focusable make sure to make all the elements inside it not focusable + // When an action bar is focusable again, make sure the first item can be focused + setFocusable(focusable) { + this.focusable = focusable; + if (this.focusable) { + const firstEnabled = this.viewItems.find(vi => vi instanceof BaseActionViewItem && vi.isEnabled()); + if (firstEnabled instanceof BaseActionViewItem) { + firstEnabled.setFocusable(true); + } + } + else { + this.viewItems.forEach(vi => { + if (vi instanceof BaseActionViewItem) { + vi.setFocusable(false); + } + }); + } + } + isTriggerKeyEvent(event) { + let ret = false; + this._triggerKeys.keys.forEach(keyCode => { + ret = ret || event.equals(keyCode); + }); + return ret; + } + updateFocusedItem() { + for (let i = 0; i < this.actionsList.children.length; i++) { + const elem = this.actionsList.children[i]; + if (DOM.isAncestor(DOM.getActiveElement(), elem)) { + this.focusedItem = i; + this.viewItems[this.focusedItem]?.showHover?.(); + break; + } + } + } + get context() { + return this._context; + } + set context(context) { + this._context = context; + this.viewItems.forEach(i => i.setActionContext(context)); + } + get actionRunner() { + return this._actionRunner; + } + set actionRunner(actionRunner) { + this._actionRunner = actionRunner; + // when setting a new `IActionRunner` make sure to dispose old listeners and + // start to forward events from the new listener + this._actionRunnerDisposables.clear(); + this._actionRunnerDisposables.add(this._actionRunner.onDidRun(e => this._onDidRun.fire(e))); + this._actionRunnerDisposables.add(this._actionRunner.onWillRun(e => this._onWillRun.fire(e))); + this.viewItems.forEach(item => item.actionRunner = actionRunner); + } + getContainer() { + return this.domNode; + } + getAction(indexOrElement) { + // by index + if (typeof indexOrElement === 'number') { + return this.viewItems[indexOrElement]?.action; + } + // by element + if (DOM.isHTMLElement(indexOrElement)) { + while (indexOrElement.parentElement !== this.actionsList) { + if (!indexOrElement.parentElement) { + return undefined; + } + indexOrElement = indexOrElement.parentElement; + } + for (let i = 0; i < this.actionsList.childNodes.length; i++) { + if (this.actionsList.childNodes[i] === indexOrElement) { + return this.viewItems[i].action; + } + } + } + return undefined; + } + push(arg, options = {}) { + const actions = Array.isArray(arg) ? arg : [arg]; + let index = types.isNumber(options.index) ? options.index : null; + actions.forEach((action) => { + const actionViewItemElement = document.createElement('li'); + actionViewItemElement.className = 'action-item'; + actionViewItemElement.setAttribute('role', 'presentation'); + let item; + const viewItemOptions = { hoverDelegate: this._hoverDelegate, ...options, isTabList: this.options.ariaRole === 'tablist' }; + if (this.options.actionViewItemProvider) { + item = this.options.actionViewItemProvider(action, viewItemOptions); + } + if (!item) { + item = new ActionViewItem(this.context, action, viewItemOptions); + } + // Prevent native context menu on actions + if (!this.options.allowContextMenu) { + this.viewItemDisposables.set(item, DOM.addDisposableListener(actionViewItemElement, DOM.EventType.CONTEXT_MENU, (e) => { + DOM.EventHelper.stop(e, true); + })); + } + item.actionRunner = this._actionRunner; + item.setActionContext(this.context); + item.render(actionViewItemElement); + if (this.focusable && item instanceof BaseActionViewItem && this.viewItems.length === 0) { + // We need to allow for the first enabled item to be focused on using tab navigation #106441 + item.setFocusable(true); + } + if (index === null || index < 0 || index >= this.actionsList.children.length) { + this.actionsList.appendChild(actionViewItemElement); + this.viewItems.push(item); + } + else { + this.actionsList.insertBefore(actionViewItemElement, this.actionsList.children[index]); + this.viewItems.splice(index, 0, item); + index++; + } + }); + if (typeof this.focusedItem === 'number') { + // After a clear actions might be re-added to simply toggle some actions. We should preserve focus #97128 + this.focus(this.focusedItem); + } + this.refreshRole(); + } + clear() { + if (this.isEmpty()) { + return; + } + this.viewItems = dispose(this.viewItems); + this.viewItemDisposables.clearAndDisposeAll(); + DOM.clearNode(this.actionsList); + this.refreshRole(); + } + length() { + return this.viewItems.length; + } + isEmpty() { + return this.viewItems.length === 0; + } + focus(arg) { + let selectFirst = false; + let index = undefined; + if (arg === undefined) { + selectFirst = true; + } + else if (typeof arg === 'number') { + index = arg; + } + else if (typeof arg === 'boolean') { + selectFirst = arg; + } + if (selectFirst && typeof this.focusedItem === 'undefined') { + const firstEnabled = this.viewItems.findIndex(item => item.isEnabled()); + // Focus the first enabled item + this.focusedItem = firstEnabled === -1 ? undefined : firstEnabled; + this.updateFocus(undefined, undefined, true); + } + else { + if (index !== undefined) { + this.focusedItem = index; + } + this.updateFocus(undefined, undefined, true); + } + } + focusFirst() { + this.focusedItem = this.length() - 1; + return this.focusNext(true); + } + focusLast() { + this.focusedItem = 0; + return this.focusPrevious(true); + } + focusNext(forceLoop, forceFocus) { + if (typeof this.focusedItem === 'undefined') { + this.focusedItem = this.viewItems.length - 1; + } + else if (this.viewItems.length <= 1) { + return false; + } + const startIndex = this.focusedItem; + let item; + do { + if (!forceLoop && this.options.preventLoopNavigation && this.focusedItem + 1 >= this.viewItems.length) { + this.focusedItem = startIndex; + return false; + } + this.focusedItem = (this.focusedItem + 1) % this.viewItems.length; + item = this.viewItems[this.focusedItem]; + } while (this.focusedItem !== startIndex && ((this.options.focusOnlyEnabledItems && !item.isEnabled()) || item.action.id === Separator.ID)); + this.updateFocus(undefined, undefined, forceFocus); + return true; + } + focusPrevious(forceLoop) { + if (typeof this.focusedItem === 'undefined') { + this.focusedItem = 0; + } + else if (this.viewItems.length <= 1) { + return false; + } + const startIndex = this.focusedItem; + let item; + do { + this.focusedItem = this.focusedItem - 1; + if (this.focusedItem < 0) { + if (!forceLoop && this.options.preventLoopNavigation) { + this.focusedItem = startIndex; + return false; + } + this.focusedItem = this.viewItems.length - 1; + } + item = this.viewItems[this.focusedItem]; + } while (this.focusedItem !== startIndex && ((this.options.focusOnlyEnabledItems && !item.isEnabled()) || item.action.id === Separator.ID)); + this.updateFocus(true); + return true; + } + updateFocus(fromRight, preventScroll, forceFocus = false) { + if (typeof this.focusedItem === 'undefined') { + this.actionsList.focus({ preventScroll }); + } + if (this.previouslyFocusedItem !== undefined && this.previouslyFocusedItem !== this.focusedItem) { + this.viewItems[this.previouslyFocusedItem]?.blur(); + } + const actionViewItem = this.focusedItem !== undefined ? this.viewItems[this.focusedItem] : undefined; + if (actionViewItem) { + let focusItem = true; + if (!types.isFunction(actionViewItem.focus)) { + focusItem = false; + } + if (this.options.focusOnlyEnabledItems && types.isFunction(actionViewItem.isEnabled) && !actionViewItem.isEnabled()) { + focusItem = false; + } + if (actionViewItem.action.id === Separator.ID) { + focusItem = false; + } + if (!focusItem) { + this.actionsList.focus({ preventScroll }); + this.previouslyFocusedItem = undefined; + } + else if (forceFocus || this.previouslyFocusedItem !== this.focusedItem) { + actionViewItem.focus(fromRight); + this.previouslyFocusedItem = this.focusedItem; + } + if (focusItem) { + actionViewItem.showHover?.(); + } + } + } + doTrigger(event) { + if (typeof this.focusedItem === 'undefined') { + return; //nothing to focus + } + // trigger action + const actionViewItem = this.viewItems[this.focusedItem]; + if (actionViewItem instanceof BaseActionViewItem) { + const context = (actionViewItem._context === null || actionViewItem._context === undefined) ? event : actionViewItem._context; + this.run(actionViewItem._action, context); + } + } + async run(action, context) { + await this._actionRunner.run(action, context); + } + dispose() { + this._context = undefined; + this.viewItems = dispose(this.viewItems); + this.getContainer().remove(); + super.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css new file mode 100644 index 0000000000000000000000000000000000000000..fdcbb34c7d79112c98a6d14a752aa2a291e1b86b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css @@ -0,0 +1,9 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-aria-container { + position: absolute; /* try to hide from window but not from screen readers */ + left:-999em; +} \ No newline at end of file diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js new file mode 100644 index 0000000000000000000000000000000000000000..5d5a76c0968e4597ff9b3b8d2bb8f6478c4da2a4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js @@ -0,0 +1,81 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import './aria.css'; +// 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 +const MAX_MESSAGE_LENGTH = 20000; +let ariaContainer; +let alertContainer; +let alertContainer2; +let statusContainer; +let statusContainer2; +export function setARIAContainer(parent) { + ariaContainer = document.createElement('div'); + ariaContainer.className = 'monaco-aria-container'; + const createAlertContainer = () => { + const element = document.createElement('div'); + element.className = 'monaco-alert'; + element.setAttribute('role', 'alert'); + element.setAttribute('aria-atomic', 'true'); + ariaContainer.appendChild(element); + return element; + }; + alertContainer = createAlertContainer(); + alertContainer2 = createAlertContainer(); + const createStatusContainer = () => { + const element = document.createElement('div'); + element.className = 'monaco-status'; + element.setAttribute('aria-live', 'polite'); + element.setAttribute('aria-atomic', 'true'); + ariaContainer.appendChild(element); + return element; + }; + statusContainer = createStatusContainer(); + statusContainer2 = createStatusContainer(); + parent.appendChild(ariaContainer); +} +/** + * Given the provided message, will make sure that it is read as alert to screen readers. + */ +export function alert(msg) { + if (!ariaContainer) { + return; + } + // Use alternate containers such that duplicated messages get read out by screen readers #99466 + if (alertContainer.textContent !== msg) { + dom.clearNode(alertContainer2); + insertMessage(alertContainer, msg); + } + else { + dom.clearNode(alertContainer); + insertMessage(alertContainer2, msg); + } +} +/** + * Given the provided message, will make sure that it is read as status to screen readers. + */ +export function status(msg) { + if (!ariaContainer) { + return; + } + if (statusContainer.textContent !== msg) { + dom.clearNode(statusContainer2); + insertMessage(statusContainer, msg); + } + else { + dom.clearNode(statusContainer); + insertMessage(statusContainer2, msg); + } +} +function insertMessage(target, msg) { + dom.clearNode(target); + if (msg.length > MAX_MESSAGE_LENGTH) { + msg = msg.substr(0, MAX_MESSAGE_LENGTH); + } + target.textContent = msg; + // See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/ + target.style.visibility = 'hidden'; + target.style.visibility = 'visible'; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css new file mode 100644 index 0000000000000000000000000000000000000000..4a3cf074790b3b68d097e129256fde47cea531f0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-breadcrumbs { + user-select: none; + -webkit-user-select: none; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + outline-style: none; +} + +.monaco-breadcrumbs .monaco-breadcrumb-item { + display: flex; + align-items: center; + flex: 0 1 auto; + white-space: nowrap; + cursor: pointer; + align-self: center; + height: 100%; + outline: none; +} +.monaco-breadcrumbs.disabled .monaco-breadcrumb-item { + cursor: default; +} + +.monaco-breadcrumbs .monaco-breadcrumb-item .codicon-breadcrumb-separator { + color: inherit; +} + +.monaco-breadcrumbs .monaco-breadcrumb-item:first-of-type::before { + content: ' '; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js new file mode 100644 index 0000000000000000000000000000000000000000..af8913557bb4ab5c95e81125f3df50f28e5f4737 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js @@ -0,0 +1 @@ +import './breadcrumbsWidget.css'; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css new file mode 100644 index 0000000000000000000000000000000000000000..2517cd3571ca9da9d4bb5329e0873be624f71f17 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css @@ -0,0 +1,174 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-text-button { + box-sizing: border-box; + display: flex; + width: 100%; + padding: 4px; + border-radius: 2px; + text-align: center; + cursor: pointer; + justify-content: center; + align-items: center; + border: 1px solid var(--vscode-button-border, transparent); + line-height: 18px; +} + +.monaco-text-button:focus { + outline-offset: 2px !important; +} + +.monaco-text-button:hover { + text-decoration: none !important; +} + +.monaco-button.disabled:focus, +.monaco-button.disabled { + opacity: 0.4 !important; + cursor: default; +} + +.monaco-text-button .codicon { + margin: 0 0.2em; + color: inherit !important; +} + +.monaco-text-button.monaco-text-button-with-short-label { + flex-direction: row; + flex-wrap: wrap; + padding: 0 4px; + overflow: hidden; + height: 28px; +} + +.monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label { + flex-basis: 100%; +} + +.monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label-short { + flex-grow: 1; + width: 0; + overflow: hidden; +} + +.monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label, +.monaco-text-button.monaco-text-button-with-short-label > .monaco-button-label-short { + display: flex; + justify-content: center; + align-items: center; + font-weight: normal; + font-style: inherit; + padding: 4px 0; +} + +.monaco-button-dropdown { + display: flex; + cursor: pointer; +} + +.monaco-button-dropdown.disabled { + cursor: default; +} + +.monaco-button-dropdown > .monaco-button:focus { + outline-offset: -1px !important; +} + +.monaco-button-dropdown.disabled > .monaco-button.disabled, +.monaco-button-dropdown.disabled > .monaco-button.disabled:focus, +.monaco-button-dropdown.disabled > .monaco-button-dropdown-separator { + opacity: 0.4 !important; +} + +.monaco-button-dropdown > .monaco-button.monaco-text-button { + border-right-width: 0 !important; +} + +.monaco-button-dropdown .monaco-button-dropdown-separator { + padding: 4px 0; + cursor: default; +} + +.monaco-button-dropdown .monaco-button-dropdown-separator > div { + height: 100%; + width: 1px; +} + +.monaco-button-dropdown > .monaco-button.monaco-dropdown-button { + border: 1px solid var(--vscode-button-border, transparent); + border-left-width: 0 !important; + border-radius: 0 2px 2px 0; + display: flex; + align-items: center; +} + +.monaco-button-dropdown > .monaco-button.monaco-text-button { + border-radius: 2px 0 0 2px; +} + +.monaco-description-button { + display: flex; + flex-direction: column; + align-items: center; + margin: 4px 5px; /* allows button focus outline to be visible */ +} + +.monaco-description-button .monaco-button-description { + font-style: italic; + font-size: 11px; + padding: 4px 20px; +} + +.monaco-description-button .monaco-button-label, +.monaco-description-button .monaco-button-description { + display: flex; + justify-content: center; + align-items: center; +} + +.monaco-description-button .monaco-button-label > .codicon, +.monaco-description-button .monaco-button-description > .codicon { + margin: 0 0.2em; + color: inherit !important; +} + +/* default color styles - based on CSS variables */ + +.monaco-button.default-colors, +.monaco-button-dropdown.default-colors > .monaco-button{ + color: var(--vscode-button-foreground); + background-color: var(--vscode-button-background); +} + +.monaco-button.default-colors:hover, +.monaco-button-dropdown.default-colors > .monaco-button:hover { + background-color: var(--vscode-button-hoverBackground); +} + +.monaco-button.default-colors.secondary, +.monaco-button-dropdown.default-colors > .monaco-button.secondary { + color: var(--vscode-button-secondaryForeground); + background-color: var(--vscode-button-secondaryBackground); +} + +.monaco-button.default-colors.secondary:hover, +.monaco-button-dropdown.default-colors > .monaco-button.secondary:hover { + background-color: var(--vscode-button-secondaryHoverBackground); +} + +.monaco-button-dropdown.default-colors .monaco-button-dropdown-separator { + background-color: var(--vscode-button-background); + border-top: 1px solid var(--vscode-button-border); + border-bottom: 1px solid var(--vscode-button-border); +} + +.monaco-button-dropdown.default-colors .monaco-button.secondary + .monaco-button-dropdown-separator { + background-color: var(--vscode-button-secondaryBackground); +} + +.monaco-button-dropdown.default-colors .monaco-button-dropdown-separator > div { + background-color: var(--vscode-button-separator); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js new file mode 100644 index 0000000000000000000000000000000000000000..954a61f9cf658fa0872c7002837b33500be4316d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js @@ -0,0 +1,215 @@ +import { addDisposableListener, EventHelper, EventType, reset, trackFocus } from '../../dom.js'; +import { sanitize } from '../../dompurify/dompurify.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { renderMarkdown, renderStringAsPlaintext } from '../../markdownRenderer.js'; +import { Gesture, EventType as TouchEventType } from '../../touch.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { renderLabelWithIcons } from '../iconLabel/iconLabels.js'; +import { Color } from '../../../common/color.js'; +import { Emitter } from '../../../common/event.js'; +import { isMarkdownString, markdownStringEqual } from '../../../common/htmlContent.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import './button.css'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +export const unthemedButtonStyles = { + buttonBackground: '#0E639C', + buttonHoverBackground: '#006BB3', + buttonSeparator: Color.white.toString(), + buttonForeground: Color.white.toString(), + buttonBorder: undefined, + buttonSecondaryBackground: undefined, + buttonSecondaryForeground: undefined, + buttonSecondaryHoverBackground: undefined +}; +export class Button extends Disposable { + get onDidClick() { return this._onDidClick.event; } + constructor(container, options) { + super(); + this._label = ''; + this._onDidClick = this._register(new Emitter()); + this._onDidEscape = this._register(new Emitter()); + this.options = options; + this._element = document.createElement('a'); + this._element.classList.add('monaco-button'); + this._element.tabIndex = 0; + this._element.setAttribute('role', 'button'); + this._element.classList.toggle('secondary', !!options.secondary); + const background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground; + const foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground; + this._element.style.color = foreground || ''; + this._element.style.backgroundColor = background || ''; + if (options.supportShortLabel) { + this._labelShortElement = document.createElement('div'); + this._labelShortElement.classList.add('monaco-button-label-short'); + this._element.appendChild(this._labelShortElement); + this._labelElement = document.createElement('div'); + this._labelElement.classList.add('monaco-button-label'); + this._element.appendChild(this._labelElement); + this._element.classList.add('monaco-text-button-with-short-label'); + } + if (typeof options.title === 'string') { + this.setTitle(options.title); + } + if (typeof options.ariaLabel === 'string') { + this._element.setAttribute('aria-label', options.ariaLabel); + } + container.appendChild(this._element); + this._register(Gesture.addTarget(this._element)); + [EventType.CLICK, TouchEventType.Tap].forEach(eventType => { + this._register(addDisposableListener(this._element, eventType, e => { + if (!this.enabled) { + EventHelper.stop(e); + return; + } + this._onDidClick.fire(e); + })); + }); + this._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => { + const event = new StandardKeyboardEvent(e); + let eventHandled = false; + if (this.enabled && (event.equals(3 /* KeyCode.Enter */) || event.equals(10 /* KeyCode.Space */))) { + this._onDidClick.fire(e); + eventHandled = true; + } + else if (event.equals(9 /* KeyCode.Escape */)) { + this._onDidEscape.fire(e); + this._element.blur(); + eventHandled = true; + } + if (eventHandled) { + EventHelper.stop(event, true); + } + })); + this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => { + if (!this._element.classList.contains('disabled')) { + this.updateBackground(true); + } + })); + this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => { + this.updateBackground(false); // restore standard styles + })); + // Also set hover background when button is focused for feedback + this.focusTracker = this._register(trackFocus(this._element)); + this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { + this.updateBackground(true); + } })); + this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { + this.updateBackground(false); + } })); + } + dispose() { + super.dispose(); + this._element.remove(); + } + getContentElements(content) { + const elements = []; + for (let segment of renderLabelWithIcons(content)) { + if (typeof (segment) === 'string') { + segment = segment.trim(); + // Ignore empty segment + if (segment === '') { + continue; + } + // Convert string segments to nodes + const node = document.createElement('span'); + node.textContent = segment; + elements.push(node); + } + else { + elements.push(segment); + } + } + return elements; + } + updateBackground(hover) { + let background; + if (this.options.secondary) { + background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground; + } + else { + background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground; + } + if (background) { + this._element.style.backgroundColor = background; + } + } + get element() { + return this._element; + } + set label(value) { + if (this._label === value) { + return; + } + if (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) { + return; + } + this._element.classList.add('monaco-text-button'); + const labelElement = this.options.supportShortLabel ? this._labelElement : this._element; + if (isMarkdownString(value)) { + const rendered = renderMarkdown(value, { inline: true }); + rendered.dispose(); + // Don't include outer `

` + const root = rendered.element.querySelector('p')?.innerHTML; + if (root) { + // Only allow a very limited set of inline html tags + const sanitized = sanitize(root, { ADD_TAGS: ['b', 'i', 'u', 'code', 'span'], ALLOWED_ATTR: ['class'], RETURN_TRUSTED_TYPE: true }); + labelElement.innerHTML = sanitized; + } + else { + reset(labelElement); + } + } + else { + if (this.options.supportIcons) { + reset(labelElement, ...this.getContentElements(value)); + } + else { + labelElement.textContent = value; + } + } + let title = ''; + if (typeof this.options.title === 'string') { + title = this.options.title; + } + else if (this.options.title) { + title = renderStringAsPlaintext(value); + } + this.setTitle(title); + if (typeof this.options.ariaLabel === 'string') { + this._element.setAttribute('aria-label', this.options.ariaLabel); + } + else if (this.options.ariaLabel) { + this._element.setAttribute('aria-label', title); + } + this._label = value; + } + get label() { + return this._label; + } + set icon(icon) { + this._element.classList.add(...ThemeIcon.asClassNameArray(icon)); + } + set enabled(value) { + if (value) { + this._element.classList.remove('disabled'); + this._element.setAttribute('aria-disabled', String(false)); + this._element.tabIndex = 0; + } + else { + this._element.classList.add('disabled'); + this._element.setAttribute('aria-disabled', String(true)); + } + } + get enabled() { + return !this._element.classList.contains('disabled'); + } + setTitle(title) { + if (!this._hover && title !== '') { + this._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('mouse'), this._element, title)); + } + else if (this._hover) { + this._hover.update(title); + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css new file mode 100644 index 0000000000000000000000000000000000000000..9666216f6ae00e73fd6ce82d8039f6d97ab179cb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.codicon-wrench-subaction { + opacity: 0.5; +} + +@keyframes codicon-spin { + 100% { + transform:rotate(360deg); + } +} + +.codicon-sync.codicon-modifier-spin, +.codicon-loading.codicon-modifier-spin, +.codicon-gear.codicon-modifier-spin, +.codicon-notebook-state-executing.codicon-modifier-spin { + /* Use steps to throttle FPS to reduce CPU usage */ + animation: codicon-spin 1.5s steps(30) infinite; +} + +.codicon-modifier-disabled { + opacity: 0.4; +} + +/* custom speed & easing for loading icon */ +.codicon-loading, +.codicon-tree-item-loading::before { + animation-duration: 1s !important; + animation-timing-function: cubic-bezier(0.53, 0.21, 0.29, 0.67) !important; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css new file mode 100644 index 0000000000000000000000000000000000000000..c4a0e7599d4759a6a7a7a0d7b78345a7f53de869 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +@font-face { + font-family: "codicon"; + font-display: block; + src: url(./codicon.ttf) format("truetype"); +} + +.codicon[class*='codicon-'] { + font: normal normal normal 16px/1 codicon; + display: inline-block; + text-decoration: none; + text-rendering: auto; + text-align: center; + text-transform: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + user-select: none; + -webkit-user-select: none; +} + +/* icon rules are dynamically created by the platform theme service (see iconsStyleSheet.ts) */ diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf new file mode 100644 index 0000000000000000000000000000000000000000..27ee4c68caef1cd22342f481420d6dbda1648012 Binary files /dev/null and b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf differ diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codiconStyles.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codiconStyles.js new file mode 100644 index 0000000000000000000000000000000000000000..cc0b2b3c19346a55fc4f345b8d5582aa29d8922f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codiconStyles.js @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import './codicon/codicon.css'; +import './codicon/codicon-modifiers.css'; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css new file mode 100644 index 0000000000000000000000000000000000000000..cca41507ae9ef84550946ed082f0d5f86d31fe23 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.context-view { + position: absolute; +} + +.context-view.fixed { + all: initial; + font-family: inherit; + font-size: 13px; + position: fixed; + color: inherit; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js new file mode 100644 index 0000000000000000000000000000000000000000..ff9a2926092a932d2dcdd01e75abf9c26df50f2c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js @@ -0,0 +1,292 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { BrowserFeatures } from '../../canIUse.js'; +import * as DOM from '../../dom.js'; +import { Disposable, DisposableStore, toDisposable } from '../../../common/lifecycle.js'; +import * as platform from '../../../common/platform.js'; +import { Range } from '../../../common/range.js'; +import './contextview.css'; +export function isAnchor(obj) { + const anchor = obj; + return !!anchor && typeof anchor.x === 'number' && typeof anchor.y === 'number'; +} +export var LayoutAnchorMode; +(function (LayoutAnchorMode) { + LayoutAnchorMode[LayoutAnchorMode["AVOID"] = 0] = "AVOID"; + LayoutAnchorMode[LayoutAnchorMode["ALIGN"] = 1] = "ALIGN"; +})(LayoutAnchorMode || (LayoutAnchorMode = {})); +/** + * Lays out a one dimensional view next to an anchor in a viewport. + * + * @returns The view offset within the viewport. + */ +export function layout(viewportSize, viewSize, anchor) { + const layoutAfterAnchorBoundary = anchor.mode === LayoutAnchorMode.ALIGN ? anchor.offset : anchor.offset + anchor.size; + const layoutBeforeAnchorBoundary = anchor.mode === LayoutAnchorMode.ALIGN ? anchor.offset + anchor.size : anchor.offset; + if (anchor.position === 0 /* LayoutAnchorPosition.Before */) { + if (viewSize <= viewportSize - layoutAfterAnchorBoundary) { + return layoutAfterAnchorBoundary; // happy case, lay it out after the anchor + } + if (viewSize <= layoutBeforeAnchorBoundary) { + return layoutBeforeAnchorBoundary - viewSize; // ok case, lay it out before the anchor + } + return Math.max(viewportSize - viewSize, 0); // sad case, lay it over the anchor + } + else { + if (viewSize <= layoutBeforeAnchorBoundary) { + return layoutBeforeAnchorBoundary - viewSize; // happy case, lay it out before the anchor + } + if (viewSize <= viewportSize - layoutAfterAnchorBoundary) { + return layoutAfterAnchorBoundary; // ok case, lay it out after the anchor + } + return 0; // sad case, lay it over the anchor + } +} +export class ContextView extends Disposable { + static { this.BUBBLE_UP_EVENTS = ['click', 'keydown', 'focus', 'blur']; } + static { this.BUBBLE_DOWN_EVENTS = ['click']; } + constructor(container, domPosition) { + super(); + this.container = null; + this.useFixedPosition = false; + this.useShadowDOM = false; + this.delegate = null; + this.toDisposeOnClean = Disposable.None; + this.toDisposeOnSetContainer = Disposable.None; + this.shadowRoot = null; + this.shadowRootHostElement = null; + this.view = DOM.$('.context-view'); + DOM.hide(this.view); + this.setContainer(container, domPosition); + this._register(toDisposable(() => this.setContainer(null, 1 /* ContextViewDOMPosition.ABSOLUTE */))); + } + setContainer(container, domPosition) { + this.useFixedPosition = domPosition !== 1 /* ContextViewDOMPosition.ABSOLUTE */; + const usedShadowDOM = this.useShadowDOM; + this.useShadowDOM = domPosition === 3 /* ContextViewDOMPosition.FIXED_SHADOW */; + if (container === this.container && usedShadowDOM === this.useShadowDOM) { + return; // container is the same and no shadow DOM usage has changed + } + if (this.container) { + this.toDisposeOnSetContainer.dispose(); + this.view.remove(); + if (this.shadowRoot) { + this.shadowRoot = null; + this.shadowRootHostElement?.remove(); + this.shadowRootHostElement = null; + } + this.container = null; + } + if (container) { + this.container = container; + if (this.useShadowDOM) { + this.shadowRootHostElement = DOM.$('.shadow-root-host'); + this.container.appendChild(this.shadowRootHostElement); + this.shadowRoot = this.shadowRootHostElement.attachShadow({ mode: 'open' }); + const style = document.createElement('style'); + style.textContent = SHADOW_ROOT_CSS; + this.shadowRoot.appendChild(style); + this.shadowRoot.appendChild(this.view); + this.shadowRoot.appendChild(DOM.$('slot')); + } + else { + this.container.appendChild(this.view); + } + const toDisposeOnSetContainer = new DisposableStore(); + ContextView.BUBBLE_UP_EVENTS.forEach(event => { + toDisposeOnSetContainer.add(DOM.addStandardDisposableListener(this.container, event, e => { + this.onDOMEvent(e, false); + })); + }); + ContextView.BUBBLE_DOWN_EVENTS.forEach(event => { + toDisposeOnSetContainer.add(DOM.addStandardDisposableListener(this.container, event, e => { + this.onDOMEvent(e, true); + }, true)); + }); + this.toDisposeOnSetContainer = toDisposeOnSetContainer; + } + } + show(delegate) { + if (this.isVisible()) { + this.hide(); + } + // Show static box + DOM.clearNode(this.view); + this.view.className = 'context-view monaco-component'; + this.view.style.top = '0px'; + this.view.style.left = '0px'; + this.view.style.zIndex = `${2575 + (delegate.layer ?? 0)}`; + this.view.style.position = this.useFixedPosition ? 'fixed' : 'absolute'; + DOM.show(this.view); + // Render content + this.toDisposeOnClean = delegate.render(this.view) || Disposable.None; + // Set active delegate + this.delegate = delegate; + // Layout + this.doLayout(); + // Focus + this.delegate.focus?.(); + } + getViewElement() { + return this.view; + } + layout() { + if (!this.isVisible()) { + return; + } + if (this.delegate.canRelayout === false && !(platform.isIOS && BrowserFeatures.pointerEvents)) { + this.hide(); + return; + } + this.delegate?.layout?.(); + this.doLayout(); + } + doLayout() { + // Check that we still have a delegate - this.delegate.layout may have hidden + if (!this.isVisible()) { + return; + } + // Get anchor + const anchor = this.delegate.getAnchor(); + // Compute around + let around; + // Get the element's position and size (to anchor the view) + if (DOM.isHTMLElement(anchor)) { + const elementPosition = DOM.getDomNodePagePosition(anchor); + // In areas where zoom is applied to the element or its ancestors, we need to adjust the size of the element + // e.g. The title bar has counter zoom behavior meaning it applies the inverse of zoom level. + // Window Zoom Level: 1.5, Title Bar Zoom: 1/1.5, Size Multiplier: 1.5 + const zoom = DOM.getDomNodeZoomLevel(anchor); + around = { + top: elementPosition.top * zoom, + left: elementPosition.left * zoom, + width: elementPosition.width * zoom, + height: elementPosition.height * zoom + }; + } + else if (isAnchor(anchor)) { + around = { + top: anchor.y, + left: anchor.x, + width: anchor.width || 1, + height: anchor.height || 2 + }; + } + else { + around = { + top: anchor.posy, + left: anchor.posx, + // We are about to position the context view where the mouse + // cursor is. To prevent the view being exactly under the mouse + // when showing and thus potentially triggering an action within, + // we treat the mouse location like a small sized block element. + width: 2, + height: 2 + }; + } + const viewSizeWidth = DOM.getTotalWidth(this.view); + const viewSizeHeight = DOM.getTotalHeight(this.view); + const anchorPosition = this.delegate.anchorPosition || 0 /* AnchorPosition.BELOW */; + const anchorAlignment = this.delegate.anchorAlignment || 0 /* AnchorAlignment.LEFT */; + const anchorAxisAlignment = this.delegate.anchorAxisAlignment || 0 /* AnchorAxisAlignment.VERTICAL */; + let top; + let left; + const activeWindow = DOM.getActiveWindow(); + if (anchorAxisAlignment === 0 /* AnchorAxisAlignment.VERTICAL */) { + const verticalAnchor = { offset: around.top - activeWindow.pageYOffset, size: around.height, position: anchorPosition === 0 /* AnchorPosition.BELOW */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */ }; + const horizontalAnchor = { offset: around.left, size: around.width, position: anchorAlignment === 0 /* AnchorAlignment.LEFT */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */, mode: LayoutAnchorMode.ALIGN }; + top = layout(activeWindow.innerHeight, viewSizeHeight, verticalAnchor) + activeWindow.pageYOffset; + // if view intersects vertically with anchor, we must avoid the anchor + if (Range.intersects({ start: top, end: top + viewSizeHeight }, { start: verticalAnchor.offset, end: verticalAnchor.offset + verticalAnchor.size })) { + horizontalAnchor.mode = LayoutAnchorMode.AVOID; + } + left = layout(activeWindow.innerWidth, viewSizeWidth, horizontalAnchor); + } + else { + const horizontalAnchor = { offset: around.left, size: around.width, position: anchorAlignment === 0 /* AnchorAlignment.LEFT */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */ }; + const verticalAnchor = { offset: around.top, size: around.height, position: anchorPosition === 0 /* AnchorPosition.BELOW */ ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */, mode: LayoutAnchorMode.ALIGN }; + left = layout(activeWindow.innerWidth, viewSizeWidth, horizontalAnchor); + // if view intersects horizontally with anchor, we must avoid the anchor + if (Range.intersects({ start: left, end: left + viewSizeWidth }, { start: horizontalAnchor.offset, end: horizontalAnchor.offset + horizontalAnchor.size })) { + verticalAnchor.mode = LayoutAnchorMode.AVOID; + } + top = layout(activeWindow.innerHeight, viewSizeHeight, verticalAnchor) + activeWindow.pageYOffset; + } + this.view.classList.remove('top', 'bottom', 'left', 'right'); + this.view.classList.add(anchorPosition === 0 /* AnchorPosition.BELOW */ ? 'bottom' : 'top'); + this.view.classList.add(anchorAlignment === 0 /* AnchorAlignment.LEFT */ ? 'left' : 'right'); + this.view.classList.toggle('fixed', this.useFixedPosition); + const containerPosition = DOM.getDomNodePagePosition(this.container); + this.view.style.top = `${top - (this.useFixedPosition ? DOM.getDomNodePagePosition(this.view).top : containerPosition.top)}px`; + this.view.style.left = `${left - (this.useFixedPosition ? DOM.getDomNodePagePosition(this.view).left : containerPosition.left)}px`; + this.view.style.width = 'initial'; + } + hide(data) { + const delegate = this.delegate; + this.delegate = null; + if (delegate?.onHide) { + delegate.onHide(data); + } + this.toDisposeOnClean.dispose(); + DOM.hide(this.view); + } + isVisible() { + return !!this.delegate; + } + onDOMEvent(e, onCapture) { + if (this.delegate) { + if (this.delegate.onDOMEvent) { + this.delegate.onDOMEvent(e, DOM.getWindow(e).document.activeElement); + } + else if (onCapture && !DOM.isAncestor(e.target, this.container)) { + this.hide(); + } + } + } + dispose() { + this.hide(); + super.dispose(); + } +} +const SHADOW_ROOT_CSS = /* css */ ` + :host { + all: initial; /* 1st rule so subsequent properties are reset. */ + } + + .codicon[class*='codicon-'] { + font: normal normal normal 16px/1 codicon; + display: inline-block; + text-decoration: none; + text-rendering: auto; + text-align: center; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + } + + :host { + font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif; + } + + :host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; } + :host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; } + :host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; } + :host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; } + :host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Nanum Gothic", "Apple SD Gothic Neo", "AppleGothic", sans-serif; } + + :host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; } + :host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; } + :host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; } + :host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; } + :host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; } + + :host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; } + :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; } + :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; } + :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; } + :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; } +`; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css new file mode 100644 index 0000000000000000000000000000000000000000..eb0c0837ee9f9442838631ef42a4bf78209dac14 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-count-badge { + padding: 3px 6px; + border-radius: 11px; + font-size: 11px; + min-width: 18px; + min-height: 18px; + line-height: 11px; + font-weight: normal; + text-align: center; + display: inline-block; + box-sizing: border-box; +} + +.monaco-count-badge.long { + padding: 2px 3px; + border-radius: 2px; + min-height: auto; + line-height: normal; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js new file mode 100644 index 0000000000000000000000000000000000000000..a1498d5a4e1f8eeb55182bb2f911d8792d2018be --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { $, append } from '../../dom.js'; +import { format } from '../../../common/strings.js'; +import './countBadge.css'; +export class CountBadge { + constructor(container, options, styles) { + this.options = options; + this.styles = styles; + this.count = 0; + this.element = append(container, $('.monaco-count-badge')); + this.countFormat = this.options.countFormat || '{0}'; + this.titleFormat = this.options.titleFormat || ''; + this.setCount(this.options.count || 0); + } + setCount(count) { + this.count = count; + this.render(); + } + setTitleFormat(titleFormat) { + this.titleFormat = titleFormat; + this.render(); + } + render() { + this.element.textContent = format(this.countFormat, this.count); + this.element.title = format(this.titleFormat, this.count); + this.element.style.backgroundColor = this.styles.badgeBackground ?? ''; + this.element.style.color = this.styles.badgeForeground ?? ''; + if (this.styles.badgeBorder) { + this.element.style.border = `1px solid ${this.styles.badgeBorder}`; + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.css new file mode 100644 index 0000000000000000000000000000000000000000..60dba786a8aba798424d7a64cd830525bde9f674 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.css @@ -0,0 +1,155 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/** Dialog: Modal Block */ +.monaco-dialog-modal-block { + position: fixed; + height: 100%; + width: 100%; + left:0; + top:0; + z-index: 2600; + display: flex; + justify-content: center; + align-items: center; +} + +.monaco-dialog-modal-block.dimmed { + background: rgba(0, 0, 0, 0.3); +} + +/** Dialog: Container */ +.monaco-dialog-box { + display: flex; + flex-direction: column-reverse; + width: min-content; + min-width: 500px; + max-width: 90vw; + min-height: 75px; + padding: 10px; + transform: translate3d(0px, 0px, 0px); + border-radius: 3px; +} + +/** Dialog: Title Actions Row */ +.monaco-dialog-box .dialog-toolbar-row { + height: 22px; + padding-bottom: 4px; +} + +.monaco-dialog-box .dialog-toolbar-row .actions-container { + justify-content: flex-end; +} + +/** Dialog: Message Row */ +.monaco-dialog-box .dialog-message-row { + display: flex; + flex-grow: 1; + align-items: center; + padding: 0 10px; +} + +.monaco-dialog-box .dialog-message-row > .dialog-icon.codicon { + flex: 0 0 48px; + height: 48px; + align-self: baseline; + font-size: 48px; +} + +/** Dialog: Message Container */ +.monaco-dialog-box .dialog-message-row .dialog-message-container { + display: flex; + flex-direction: column; + overflow: hidden; + text-overflow: ellipsis; + padding-left: 24px; + user-select: text; + -webkit-user-select: text; + word-wrap: break-word; /* never overflow long words, but break to next line */ + white-space: normal; +} + +/** Dialog: Message */ +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message { + line-height: 22px; + font-size: 18px; + flex: 1; /* let the message always grow */ + white-space: normal; + word-wrap: break-word; /* never overflow long words, but break to next line */ + min-height: 48px; /* matches icon height */ + margin-bottom: 8px; + display: flex; + align-items: center; +} + +/** Dialog: Details */ +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-detail { + line-height: 22px; + flex: 1; /* let the message always grow */ +} + +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message a:focus { + outline-width: 1px; + outline-style: solid; +} + +/** Dialog: Checkbox */ +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row { + padding: 15px 0px 0px; + display: flex; +} + +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-checkbox-row .dialog-checkbox-message { + cursor: pointer; + user-select: none; + -webkit-user-select: none; +} + +/** Dialog: Input */ +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-input { + padding: 15px 0px 0px; + display: flex; +} + +.monaco-dialog-box .dialog-message-row .dialog-message-container .dialog-message-input .monaco-inputbox { + flex: 1; +} + +/** Dialog: File Path */ +.monaco-dialog-box code { + font-family: var(--monaco-monospace-font); +} + +/** Dialog: Buttons Row */ +.monaco-dialog-box > .dialog-buttons-row { + display: flex; + align-items: center; + padding-right: 1px; + overflow: hidden; /* buttons row should never overflow */ +} + +.monaco-dialog-box > .dialog-buttons-row { + display: flex; + white-space: nowrap; + padding: 20px 10px 10px; +} + +/** Dialog: Buttons */ +.monaco-dialog-box > .dialog-buttons-row > .dialog-buttons { + display: flex; + width: 100%; + justify-content: flex-end; + overflow: hidden; + margin-left: 67px; /* for long buttons, force align with text */ +} + +.monaco-dialog-box > .dialog-buttons-row > .dialog-buttons > .monaco-button { + width: fit-content; + padding: 5px 10px; + overflow: hidden; + text-overflow: ellipsis; + margin: 4px 5px; /* allows button focus outline to be visible */ + outline-offset: 2px !important; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..d372d9c57d37cf2ae261874bc3ad87014ae1264c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dialog/dialog.js @@ -0,0 +1 @@ +import './dialog.css'; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css new file mode 100644 index 0000000000000000000000000000000000000000..bfcaee41f98ade3a33bb5e05e3ebaa17582fa12a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-dropdown { + height: 100%; + padding: 0; +} + +.monaco-dropdown > .dropdown-label { + cursor: pointer; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.monaco-dropdown > .dropdown-label > .action-label.disabled { + cursor: default; +} + +.monaco-dropdown-with-primary { + display: flex !important; + flex-direction: row; + border-radius: 5px; +} + +.monaco-dropdown-with-primary > .action-container > .action-label { + margin-right: 0; +} + +.monaco-dropdown-with-primary > .dropdown-action-container > .monaco-dropdown > .dropdown-label .codicon[class*='codicon-'] { + font-size: 12px; + padding-left: 0px; + padding-right: 0px; + line-height: 16px; + margin-left: -3px; +} + +.monaco-dropdown-with-primary > .dropdown-action-container > .monaco-dropdown > .dropdown-label > .action-label { + display: block; + background-size: 16px; + background-position: center center; + background-repeat: no-repeat; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js new file mode 100644 index 0000000000000000000000000000000000000000..7d69a90030be0d4dfb621063479923c5de8770a4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js @@ -0,0 +1,139 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { $, addDisposableListener, append, EventHelper, EventType, isMouseEvent } from '../../dom.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { EventType as GestureEventType, Gesture } from '../../touch.js'; +import { ActionRunner } from '../../../common/actions.js'; +import { Emitter } from '../../../common/event.js'; +import './dropdown.css'; +class BaseDropdown extends ActionRunner { + constructor(container, options) { + super(); + this._onDidChangeVisibility = this._register(new Emitter()); + this.onDidChangeVisibility = this._onDidChangeVisibility.event; + this._element = append(container, $('.monaco-dropdown')); + this._label = append(this._element, $('.dropdown-label')); + let labelRenderer = options.labelRenderer; + if (!labelRenderer) { + labelRenderer = (container) => { + container.textContent = options.label || ''; + return null; + }; + } + for (const event of [EventType.CLICK, EventType.MOUSE_DOWN, GestureEventType.Tap]) { + this._register(addDisposableListener(this.element, event, e => EventHelper.stop(e, true))); // prevent default click behaviour to trigger + } + for (const event of [EventType.MOUSE_DOWN, GestureEventType.Tap]) { + this._register(addDisposableListener(this._label, event, e => { + if (isMouseEvent(e) && (e.detail > 1 || e.button !== 0)) { + // prevent right click trigger to allow separate context menu (https://github.com/microsoft/vscode/issues/151064) + // prevent multiple clicks to open multiple context menus (https://github.com/microsoft/vscode/issues/41363) + return; + } + if (this.visible) { + this.hide(); + } + else { + this.show(); + } + })); + } + this._register(addDisposableListener(this._label, EventType.KEY_UP, e => { + const event = new StandardKeyboardEvent(e); + if (event.equals(3 /* KeyCode.Enter */) || event.equals(10 /* KeyCode.Space */)) { + EventHelper.stop(e, true); // https://github.com/microsoft/vscode/issues/57997 + if (this.visible) { + this.hide(); + } + else { + this.show(); + } + } + })); + const cleanupFn = labelRenderer(this._label); + if (cleanupFn) { + this._register(cleanupFn); + } + this._register(Gesture.addTarget(this._label)); + } + get element() { + return this._element; + } + show() { + if (!this.visible) { + this.visible = true; + this._onDidChangeVisibility.fire(true); + } + } + hide() { + if (this.visible) { + this.visible = false; + this._onDidChangeVisibility.fire(false); + } + } + dispose() { + super.dispose(); + this.hide(); + if (this.boxContainer) { + this.boxContainer.remove(); + this.boxContainer = undefined; + } + if (this.contents) { + this.contents.remove(); + this.contents = undefined; + } + if (this._label) { + this._label.remove(); + this._label = undefined; + } + } +} +export class DropdownMenu extends BaseDropdown { + constructor(container, _options) { + super(container, _options); + this._options = _options; + this._actions = []; + this.actions = _options.actions || []; + } + set menuOptions(options) { + this._menuOptions = options; + } + get menuOptions() { + return this._menuOptions; + } + get actions() { + if (this._options.actionProvider) { + return this._options.actionProvider.getActions(); + } + return this._actions; + } + set actions(actions) { + this._actions = actions; + } + show() { + super.show(); + this.element.classList.add('active'); + this._options.contextMenuProvider.showContextMenu({ + getAnchor: () => this.element, + getActions: () => this.actions, + getActionsContext: () => this.menuOptions ? this.menuOptions.context : null, + getActionViewItem: (action, options) => this.menuOptions && this.menuOptions.actionViewItemProvider ? this.menuOptions.actionViewItemProvider(action, options) : undefined, + getKeyBinding: action => this.menuOptions && this.menuOptions.getKeyBinding ? this.menuOptions.getKeyBinding(action) : undefined, + getMenuClassName: () => this._options.menuClassName || '', + onHide: () => this.onHide(), + actionRunner: this.menuOptions ? this.menuOptions.actionRunner : undefined, + anchorAlignment: this.menuOptions ? this.menuOptions.anchorAlignment : 0 /* AnchorAlignment.LEFT */, + domForShadowRoot: this._options.menuAsChild ? this.element : undefined, + skipTelemetry: this._options.skipTelemetry + }); + } + hide() { + super.hide(); + } + onHide() { + this.hide(); + this.element.classList.remove('active'); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js new file mode 100644 index 0000000000000000000000000000000000000000..5d7cf79bdbd8583cec639d79b3f64f0e49da62c4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js @@ -0,0 +1,107 @@ +import { $, append } from '../../dom.js'; +import { BaseActionViewItem } from '../actionbar/actionViewItems.js'; +import { DropdownMenu } from './dropdown.js'; +import { Emitter } from '../../../common/event.js'; +import './dropdown.css'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +export class DropdownMenuActionViewItem extends BaseActionViewItem { + constructor(action, menuActionsOrProvider, contextMenuProvider, options = Object.create(null)) { + super(null, action, options); + this.actionItem = null; + this._onDidChangeVisibility = this._register(new Emitter()); + this.onDidChangeVisibility = this._onDidChangeVisibility.event; + this.menuActionsOrProvider = menuActionsOrProvider; + this.contextMenuProvider = contextMenuProvider; + this.options = options; + if (this.options.actionRunner) { + this.actionRunner = this.options.actionRunner; + } + } + render(container) { + this.actionItem = container; + const labelRenderer = (el) => { + this.element = append(el, $('a.action-label')); + let classNames = []; + if (typeof this.options.classNames === 'string') { + classNames = this.options.classNames.split(/\s+/g).filter(s => !!s); + } + else if (this.options.classNames) { + classNames = this.options.classNames; + } + // todo@aeschli: remove codicon, should come through `this.options.classNames` + if (!classNames.find(c => c === 'icon')) { + classNames.push('codicon'); + } + this.element.classList.add(...classNames); + this.element.setAttribute('role', 'button'); + this.element.setAttribute('aria-haspopup', 'true'); + this.element.setAttribute('aria-expanded', 'false'); + if (this._action.label) { + this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('mouse'), this.element, this._action.label)); + } + this.element.ariaLabel = this._action.label || ''; + return null; + }; + const isActionsArray = Array.isArray(this.menuActionsOrProvider); + const options = { + contextMenuProvider: this.contextMenuProvider, + labelRenderer: labelRenderer, + menuAsChild: this.options.menuAsChild, + actions: isActionsArray ? this.menuActionsOrProvider : undefined, + actionProvider: isActionsArray ? undefined : this.menuActionsOrProvider, + skipTelemetry: this.options.skipTelemetry + }; + this.dropdownMenu = this._register(new DropdownMenu(container, options)); + this._register(this.dropdownMenu.onDidChangeVisibility(visible => { + this.element?.setAttribute('aria-expanded', `${visible}`); + this._onDidChangeVisibility.fire(visible); + })); + this.dropdownMenu.menuOptions = { + actionViewItemProvider: this.options.actionViewItemProvider, + actionRunner: this.actionRunner, + getKeyBinding: this.options.keybindingProvider, + context: this._context + }; + if (this.options.anchorAlignmentProvider) { + const that = this; + this.dropdownMenu.menuOptions = { + ...this.dropdownMenu.menuOptions, + get anchorAlignment() { + return that.options.anchorAlignmentProvider(); + } + }; + } + this.updateTooltip(); + this.updateEnabled(); + } + getTooltip() { + let title = null; + if (this.action.tooltip) { + title = this.action.tooltip; + } + else if (this.action.label) { + title = this.action.label; + } + return title ?? undefined; + } + setActionContext(newContext) { + super.setActionContext(newContext); + if (this.dropdownMenu) { + if (this.dropdownMenu.menuOptions) { + this.dropdownMenu.menuOptions.context = newContext; + } + else { + this.dropdownMenu.menuOptions = { context: newContext }; + } + } + } + show() { + this.dropdownMenu?.show(); + } + updateEnabled() { + const disabled = !this.action.enabled; + this.actionItem?.classList.toggle('disabled', disabled); + this.element?.classList.toggle('disabled', disabled); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css new file mode 100644 index 0000000000000000000000000000000000000000..3de2fd329aca8658d65e4335f171057dd1cc9736 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css @@ -0,0 +1,70 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/* ---------- Find input ---------- */ + +.monaco-findInput { + position: relative; +} + +.monaco-findInput .monaco-inputbox { + font-size: 13px; + width: 100%; +} + +.monaco-findInput > .controls { + position: absolute; + top: 3px; + right: 2px; +} + +.vs .monaco-findInput.disabled { + background-color: #E1E1E1; +} + +/* Theming */ +.vs-dark .monaco-findInput.disabled { + background-color: #333; +} + +/* Highlighting */ +.monaco-findInput.highlight-0 .controls, +.hc-light .monaco-findInput.highlight-0 .controls { + animation: monaco-findInput-highlight-0 100ms linear 0s; +} + +.monaco-findInput.highlight-1 .controls, +.hc-light .monaco-findInput.highlight-1 .controls { + animation: monaco-findInput-highlight-1 100ms linear 0s; +} + +.hc-black .monaco-findInput.highlight-0 .controls, +.vs-dark .monaco-findInput.highlight-0 .controls { + animation: monaco-findInput-highlight-dark-0 100ms linear 0s; +} + +.hc-black .monaco-findInput.highlight-1 .controls, +.vs-dark .monaco-findInput.highlight-1 .controls { + animation: monaco-findInput-highlight-dark-1 100ms linear 0s; +} + +@keyframes monaco-findInput-highlight-0 { + 0% { background: rgba(253, 255, 0, 0.8); } + 100% { background: transparent; } +} +@keyframes monaco-findInput-highlight-1 { + 0% { background: rgba(253, 255, 0, 0.8); } + /* Made intentionally different such that the CSS minifier does not collapse the two animations into a single one*/ + 99% { background: transparent; } +} + +@keyframes monaco-findInput-highlight-dark-0 { + 0% { background: rgba(255, 255, 255, 0.44); } + 100% { background: transparent; } +} +@keyframes monaco-findInput-highlight-dark-1 { + 0% { background: rgba(255, 255, 255, 0.44); } + /* Made intentionally different such that the CSS minifier does not collapse the two animations into a single one*/ + 99% { background: transparent; } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js new file mode 100644 index 0000000000000000000000000000000000000000..0eaa81ae114b8fe95f3aa2c8caa972026af7f35a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js @@ -0,0 +1,293 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { CaseSensitiveToggle, RegexToggle, WholeWordsToggle } from './findInputToggles.js'; +import { HistoryInputBox } from '../inputbox/inputBox.js'; +import { Widget } from '../widget.js'; +import { Emitter } from '../../../common/event.js'; +import './findInput.css'; +import * as nls from '../../../../nls.js'; +import { DisposableStore, MutableDisposable } from '../../../common/lifecycle.js'; +import { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js'; +const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input"); +export class FindInput extends Widget { + constructor(parent, contextViewProvider, options) { + super(); + this.fixFocusOnOptionClickEnabled = true; + this.imeSessionInProgress = false; + this.additionalTogglesDisposables = this._register(new MutableDisposable()); + this.additionalToggles = []; + this._onDidOptionChange = this._register(new Emitter()); + this.onDidOptionChange = this._onDidOptionChange.event; + this._onKeyDown = this._register(new Emitter()); + this.onKeyDown = this._onKeyDown.event; + this._onMouseDown = this._register(new Emitter()); + this.onMouseDown = this._onMouseDown.event; + this._onInput = this._register(new Emitter()); + this._onKeyUp = this._register(new Emitter()); + this._onCaseSensitiveKeyDown = this._register(new Emitter()); + this.onCaseSensitiveKeyDown = this._onCaseSensitiveKeyDown.event; + this._onRegexKeyDown = this._register(new Emitter()); + this.onRegexKeyDown = this._onRegexKeyDown.event; + this._lastHighlightFindOptions = 0; + this.placeholder = options.placeholder || ''; + this.validation = options.validation; + this.label = options.label || NLS_DEFAULT_LABEL; + this.showCommonFindToggles = !!options.showCommonFindToggles; + const appendCaseSensitiveLabel = options.appendCaseSensitiveLabel || ''; + const appendWholeWordsLabel = options.appendWholeWordsLabel || ''; + const appendRegexLabel = options.appendRegexLabel || ''; + const history = options.history || []; + const flexibleHeight = !!options.flexibleHeight; + const flexibleWidth = !!options.flexibleWidth; + const flexibleMaxHeight = options.flexibleMaxHeight; + this.domNode = document.createElement('div'); + this.domNode.classList.add('monaco-findInput'); + this.inputBox = this._register(new HistoryInputBox(this.domNode, contextViewProvider, { + placeholder: this.placeholder || '', + ariaLabel: this.label || '', + validationOptions: { + validation: this.validation + }, + history, + showHistoryHint: options.showHistoryHint, + flexibleHeight, + flexibleWidth, + flexibleMaxHeight, + inputBoxStyles: options.inputBoxStyles, + })); + const hoverDelegate = this._register(createInstantHoverDelegate()); + if (this.showCommonFindToggles) { + this.regex = this._register(new RegexToggle({ + appendTitle: appendRegexLabel, + isChecked: false, + hoverDelegate, + ...options.toggleStyles + })); + this._register(this.regex.onChange(viaKeyboard => { + this._onDidOptionChange.fire(viaKeyboard); + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { + this.inputBox.focus(); + } + this.validate(); + })); + this._register(this.regex.onKeyDown(e => { + this._onRegexKeyDown.fire(e); + })); + this.wholeWords = this._register(new WholeWordsToggle({ + appendTitle: appendWholeWordsLabel, + isChecked: false, + hoverDelegate, + ...options.toggleStyles + })); + this._register(this.wholeWords.onChange(viaKeyboard => { + this._onDidOptionChange.fire(viaKeyboard); + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { + this.inputBox.focus(); + } + this.validate(); + })); + this.caseSensitive = this._register(new CaseSensitiveToggle({ + appendTitle: appendCaseSensitiveLabel, + isChecked: false, + hoverDelegate, + ...options.toggleStyles + })); + this._register(this.caseSensitive.onChange(viaKeyboard => { + this._onDidOptionChange.fire(viaKeyboard); + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { + this.inputBox.focus(); + } + this.validate(); + })); + this._register(this.caseSensitive.onKeyDown(e => { + this._onCaseSensitiveKeyDown.fire(e); + })); + // Arrow-Key support to navigate between options + const indexes = [this.caseSensitive.domNode, this.wholeWords.domNode, this.regex.domNode]; + this.onkeydown(this.domNode, (event) => { + if (event.equals(15 /* KeyCode.LeftArrow */) || event.equals(17 /* KeyCode.RightArrow */) || event.equals(9 /* KeyCode.Escape */)) { + const index = indexes.indexOf(this.domNode.ownerDocument.activeElement); + if (index >= 0) { + let newIndex = -1; + if (event.equals(17 /* KeyCode.RightArrow */)) { + newIndex = (index + 1) % indexes.length; + } + else if (event.equals(15 /* KeyCode.LeftArrow */)) { + if (index === 0) { + newIndex = indexes.length - 1; + } + else { + newIndex = index - 1; + } + } + if (event.equals(9 /* KeyCode.Escape */)) { + indexes[index].blur(); + this.inputBox.focus(); + } + else if (newIndex >= 0) { + indexes[newIndex].focus(); + } + dom.EventHelper.stop(event, true); + } + } + }); + } + this.controls = document.createElement('div'); + this.controls.className = 'controls'; + this.controls.style.display = this.showCommonFindToggles ? '' : 'none'; + if (this.caseSensitive) { + this.controls.append(this.caseSensitive.domNode); + } + if (this.wholeWords) { + this.controls.appendChild(this.wholeWords.domNode); + } + if (this.regex) { + this.controls.appendChild(this.regex.domNode); + } + this.setAdditionalToggles(options?.additionalToggles); + if (this.controls) { + this.domNode.appendChild(this.controls); + } + parent?.appendChild(this.domNode); + this._register(dom.addDisposableListener(this.inputBox.inputElement, 'compositionstart', (e) => { + this.imeSessionInProgress = true; + })); + this._register(dom.addDisposableListener(this.inputBox.inputElement, 'compositionend', (e) => { + this.imeSessionInProgress = false; + this._onInput.fire(); + })); + this.onkeydown(this.inputBox.inputElement, (e) => this._onKeyDown.fire(e)); + this.onkeyup(this.inputBox.inputElement, (e) => this._onKeyUp.fire(e)); + this.oninput(this.inputBox.inputElement, (e) => this._onInput.fire()); + this.onmousedown(this.inputBox.inputElement, (e) => this._onMouseDown.fire(e)); + } + get onDidChange() { + return this.inputBox.onDidChange; + } + layout(style) { + this.inputBox.layout(); + this.updateInputBoxPadding(style.collapsedFindWidget); + } + enable() { + this.domNode.classList.remove('disabled'); + this.inputBox.enable(); + this.regex?.enable(); + this.wholeWords?.enable(); + this.caseSensitive?.enable(); + for (const toggle of this.additionalToggles) { + toggle.enable(); + } + } + disable() { + this.domNode.classList.add('disabled'); + this.inputBox.disable(); + this.regex?.disable(); + this.wholeWords?.disable(); + this.caseSensitive?.disable(); + for (const toggle of this.additionalToggles) { + toggle.disable(); + } + } + setFocusInputOnOptionClick(value) { + this.fixFocusOnOptionClickEnabled = value; + } + setEnabled(enabled) { + if (enabled) { + this.enable(); + } + else { + this.disable(); + } + } + setAdditionalToggles(toggles) { + for (const currentToggle of this.additionalToggles) { + currentToggle.domNode.remove(); + } + this.additionalToggles = []; + this.additionalTogglesDisposables.value = new DisposableStore(); + for (const toggle of toggles ?? []) { + this.additionalTogglesDisposables.value.add(toggle); + this.controls.appendChild(toggle.domNode); + this.additionalTogglesDisposables.value.add(toggle.onChange(viaKeyboard => { + this._onDidOptionChange.fire(viaKeyboard); + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { + this.inputBox.focus(); + } + })); + this.additionalToggles.push(toggle); + } + if (this.additionalToggles.length > 0) { + this.controls.style.display = ''; + } + this.updateInputBoxPadding(); + } + updateInputBoxPadding(controlsHidden = false) { + if (controlsHidden) { + this.inputBox.paddingRight = 0; + } + else { + this.inputBox.paddingRight = + ((this.caseSensitive?.width() ?? 0) + (this.wholeWords?.width() ?? 0) + (this.regex?.width() ?? 0)) + + this.additionalToggles.reduce((r, t) => r + t.width(), 0); + } + } + getValue() { + return this.inputBox.value; + } + setValue(value) { + if (this.inputBox.value !== value) { + this.inputBox.value = value; + } + } + select() { + this.inputBox.select(); + } + focus() { + this.inputBox.focus(); + } + getCaseSensitive() { + return this.caseSensitive?.checked ?? false; + } + setCaseSensitive(value) { + if (this.caseSensitive) { + this.caseSensitive.checked = value; + } + } + getWholeWords() { + return this.wholeWords?.checked ?? false; + } + setWholeWords(value) { + if (this.wholeWords) { + this.wholeWords.checked = value; + } + } + getRegex() { + return this.regex?.checked ?? false; + } + setRegex(value) { + if (this.regex) { + this.regex.checked = value; + this.validate(); + } + } + focusOnCaseSensitive() { + this.caseSensitive?.focus(); + } + highlightFindOptions() { + this.domNode.classList.remove('highlight-' + (this._lastHighlightFindOptions)); + this._lastHighlightFindOptions = 1 - this._lastHighlightFindOptions; + this.domNode.classList.add('highlight-' + (this._lastHighlightFindOptions)); + } + validate() { + this.inputBox.validate(); + } + showMessage(message) { + this.inputBox.showMessage(message); + } + clearMessage() { + this.inputBox.hideMessage(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js new file mode 100644 index 0000000000000000000000000000000000000000..7ac45cb7b9e814308bce620f75c84104f642a316 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js @@ -0,0 +1,50 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { Toggle } from '../toggle/toggle.js'; +import { Codicon } from '../../../common/codicons.js'; +import * as nls from '../../../../nls.js'; +const NLS_CASE_SENSITIVE_TOGGLE_LABEL = nls.localize('caseDescription', "Match Case"); +const NLS_WHOLE_WORD_TOGGLE_LABEL = nls.localize('wordsDescription', "Match Whole Word"); +const NLS_REGEX_TOGGLE_LABEL = nls.localize('regexDescription', "Use Regular Expression"); +export class CaseSensitiveToggle extends Toggle { + constructor(opts) { + super({ + icon: Codicon.caseSensitive, + title: NLS_CASE_SENSITIVE_TOGGLE_LABEL + opts.appendTitle, + isChecked: opts.isChecked, + hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'), + inputActiveOptionBorder: opts.inputActiveOptionBorder, + inputActiveOptionForeground: opts.inputActiveOptionForeground, + inputActiveOptionBackground: opts.inputActiveOptionBackground + }); + } +} +export class WholeWordsToggle extends Toggle { + constructor(opts) { + super({ + icon: Codicon.wholeWord, + title: NLS_WHOLE_WORD_TOGGLE_LABEL + opts.appendTitle, + isChecked: opts.isChecked, + hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'), + inputActiveOptionBorder: opts.inputActiveOptionBorder, + inputActiveOptionForeground: opts.inputActiveOptionForeground, + inputActiveOptionBackground: opts.inputActiveOptionBackground + }); + } +} +export class RegexToggle extends Toggle { + constructor(opts) { + super({ + icon: Codicon.regex, + title: NLS_REGEX_TOGGLE_LABEL + opts.appendTitle, + isChecked: opts.isChecked, + hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'), + inputActiveOptionBorder: opts.inputActiveOptionBorder, + inputActiveOptionForeground: opts.inputActiveOptionForeground, + inputActiveOptionBackground: opts.inputActiveOptionBackground + }); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/replaceInput.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/replaceInput.js new file mode 100644 index 0000000000000000000000000000000000000000..0953fbd88e3a7eb8c0d7591f7ff72ce5e8f334b7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/replaceInput.js @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { Toggle } from '../toggle/toggle.js'; +import { HistoryInputBox } from '../inputbox/inputBox.js'; +import { Widget } from '../widget.js'; +import { Codicon } from '../../../common/codicons.js'; +import { Emitter } from '../../../common/event.js'; +import './findInput.css'; +import * as nls from '../../../../nls.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input"); +const NLS_PRESERVE_CASE_LABEL = nls.localize('label.preserveCaseToggle', "Preserve Case"); +class PreserveCaseToggle extends Toggle { + constructor(opts) { + super({ + // TODO: does this need its own icon? + icon: Codicon.preserveCase, + title: NLS_PRESERVE_CASE_LABEL + opts.appendTitle, + isChecked: opts.isChecked, + hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'), + inputActiveOptionBorder: opts.inputActiveOptionBorder, + inputActiveOptionForeground: opts.inputActiveOptionForeground, + inputActiveOptionBackground: opts.inputActiveOptionBackground, + }); + } +} +export class ReplaceInput extends Widget { + constructor(parent, contextViewProvider, _showOptionButtons, options) { + super(); + this._showOptionButtons = _showOptionButtons; + this.fixFocusOnOptionClickEnabled = true; + this.cachedOptionsWidth = 0; + this._onDidOptionChange = this._register(new Emitter()); + this.onDidOptionChange = this._onDidOptionChange.event; + this._onKeyDown = this._register(new Emitter()); + this.onKeyDown = this._onKeyDown.event; + this._onMouseDown = this._register(new Emitter()); + this._onInput = this._register(new Emitter()); + this._onKeyUp = this._register(new Emitter()); + this._onPreserveCaseKeyDown = this._register(new Emitter()); + this.onPreserveCaseKeyDown = this._onPreserveCaseKeyDown.event; + this.contextViewProvider = contextViewProvider; + this.placeholder = options.placeholder || ''; + this.validation = options.validation; + this.label = options.label || NLS_DEFAULT_LABEL; + const appendPreserveCaseLabel = options.appendPreserveCaseLabel || ''; + const history = options.history || []; + const flexibleHeight = !!options.flexibleHeight; + const flexibleWidth = !!options.flexibleWidth; + const flexibleMaxHeight = options.flexibleMaxHeight; + this.domNode = document.createElement('div'); + this.domNode.classList.add('monaco-findInput'); + this.inputBox = this._register(new HistoryInputBox(this.domNode, this.contextViewProvider, { + ariaLabel: this.label || '', + placeholder: this.placeholder || '', + validationOptions: { + validation: this.validation + }, + history, + showHistoryHint: options.showHistoryHint, + flexibleHeight, + flexibleWidth, + flexibleMaxHeight, + inputBoxStyles: options.inputBoxStyles + })); + this.preserveCase = this._register(new PreserveCaseToggle({ + appendTitle: appendPreserveCaseLabel, + isChecked: false, + ...options.toggleStyles + })); + this._register(this.preserveCase.onChange(viaKeyboard => { + this._onDidOptionChange.fire(viaKeyboard); + if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) { + this.inputBox.focus(); + } + this.validate(); + })); + this._register(this.preserveCase.onKeyDown(e => { + this._onPreserveCaseKeyDown.fire(e); + })); + if (this._showOptionButtons) { + this.cachedOptionsWidth = this.preserveCase.width(); + } + else { + this.cachedOptionsWidth = 0; + } + // Arrow-Key support to navigate between options + const indexes = [this.preserveCase.domNode]; + this.onkeydown(this.domNode, (event) => { + if (event.equals(15 /* KeyCode.LeftArrow */) || event.equals(17 /* KeyCode.RightArrow */) || event.equals(9 /* KeyCode.Escape */)) { + const index = indexes.indexOf(this.domNode.ownerDocument.activeElement); + if (index >= 0) { + let newIndex = -1; + if (event.equals(17 /* KeyCode.RightArrow */)) { + newIndex = (index + 1) % indexes.length; + } + else if (event.equals(15 /* KeyCode.LeftArrow */)) { + if (index === 0) { + newIndex = indexes.length - 1; + } + else { + newIndex = index - 1; + } + } + if (event.equals(9 /* KeyCode.Escape */)) { + indexes[index].blur(); + this.inputBox.focus(); + } + else if (newIndex >= 0) { + indexes[newIndex].focus(); + } + dom.EventHelper.stop(event, true); + } + } + }); + const controls = document.createElement('div'); + controls.className = 'controls'; + controls.style.display = this._showOptionButtons ? 'block' : 'none'; + controls.appendChild(this.preserveCase.domNode); + this.domNode.appendChild(controls); + parent?.appendChild(this.domNode); + this.onkeydown(this.inputBox.inputElement, (e) => this._onKeyDown.fire(e)); + this.onkeyup(this.inputBox.inputElement, (e) => this._onKeyUp.fire(e)); + this.oninput(this.inputBox.inputElement, (e) => this._onInput.fire()); + this.onmousedown(this.inputBox.inputElement, (e) => this._onMouseDown.fire(e)); + } + enable() { + this.domNode.classList.remove('disabled'); + this.inputBox.enable(); + this.preserveCase.enable(); + } + disable() { + this.domNode.classList.add('disabled'); + this.inputBox.disable(); + this.preserveCase.disable(); + } + setEnabled(enabled) { + if (enabled) { + this.enable(); + } + else { + this.disable(); + } + } + select() { + this.inputBox.select(); + } + focus() { + this.inputBox.focus(); + } + getPreserveCase() { + return this.preserveCase.checked; + } + setPreserveCase(value) { + this.preserveCase.checked = value; + } + focusOnPreserve() { + this.preserveCase.focus(); + } + validate() { + this.inputBox?.validate(); + } + set width(newWidth) { + this.inputBox.paddingRight = this.cachedOptionsWidth; + this.domNode.style.width = newWidth + 'px'; + } + dispose() { + super.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js new file mode 100644 index 0000000000000000000000000000000000000000..261398b2e5e103ad35ae13f6ee5aa38ebcd92612 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js @@ -0,0 +1,133 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { renderLabelWithIcons } from '../iconLabel/iconLabels.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import * as objects from '../../../common/objects.js'; +/** + * A widget which can render a label with substring highlights, often + * originating from a filter function like the fuzzy matcher. + */ +export class HighlightedLabel extends Disposable { + /** + * Create a new {@link HighlightedLabel}. + * + * @param container The parent container to append to. + */ + constructor(container, options) { + super(); + this.options = options; + this.text = ''; + this.title = ''; + this.highlights = []; + this.didEverRender = false; + this.supportIcons = options?.supportIcons ?? false; + this.domNode = dom.append(container, dom.$('span.monaco-highlighted-label')); + } + /** + * The label's DOM node. + */ + get element() { + return this.domNode; + } + /** + * Set the label and highlights. + * + * @param text The label to display. + * @param highlights The ranges to highlight. + * @param title An optional title for the hover tooltip. + * @param escapeNewLines Whether to escape new lines. + * @returns + */ + set(text, highlights = [], title = '', escapeNewLines) { + if (!text) { + text = ''; + } + if (escapeNewLines) { + // adjusts highlights inplace + text = HighlightedLabel.escapeNewLines(text, highlights); + } + if (this.didEverRender && this.text === text && this.title === title && objects.equals(this.highlights, highlights)) { + return; + } + this.text = text; + this.title = title; + this.highlights = highlights; + this.render(); + } + render() { + const children = []; + let pos = 0; + for (const highlight of this.highlights) { + if (highlight.end === highlight.start) { + continue; + } + if (pos < highlight.start) { + const substring = this.text.substring(pos, highlight.start); + if (this.supportIcons) { + children.push(...renderLabelWithIcons(substring)); + } + else { + children.push(substring); + } + pos = highlight.start; + } + const substring = this.text.substring(pos, highlight.end); + const element = dom.$('span.highlight', undefined, ...this.supportIcons ? renderLabelWithIcons(substring) : [substring]); + if (highlight.extraClasses) { + element.classList.add(...highlight.extraClasses); + } + children.push(element); + pos = highlight.end; + } + if (pos < this.text.length) { + const substring = this.text.substring(pos); + if (this.supportIcons) { + children.push(...renderLabelWithIcons(substring)); + } + else { + children.push(substring); + } + } + dom.reset(this.domNode, ...children); + if (this.options?.hoverDelegate?.showNativeHover) { + /* While custom hover is not inside custom hover */ + this.domNode.title = this.title; + } + else { + if (!this.customHover && this.title !== '') { + const hoverDelegate = this.options?.hoverDelegate ?? getDefaultHoverDelegate('mouse'); + this.customHover = this._register(getBaseLayerHoverDelegate().setupManagedHover(hoverDelegate, this.domNode, this.title)); + } + else if (this.customHover) { + this.customHover.update(this.title); + } + } + this.didEverRender = true; + } + static escapeNewLines(text, highlights) { + let total = 0; + let extra = 0; + return text.replace(/\r\n|\r|\n/g, (match, offset) => { + extra = match === '\r\n' ? -1 : 0; + offset += total; + for (const highlight of highlights) { + if (highlight.end <= offset) { + continue; + } + if (highlight.start >= offset) { + highlight.start += extra; + } + if (highlight.end >= offset) { + highlight.end += extra; + } + } + total += extra; + return '\u23CE'; + }); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hover.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hover.js new file mode 100644 index 0000000000000000000000000000000000000000..ab7609bb6763a8568b74f05f914122321e3d8aad --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hover.js @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; +// #endregion Managed hover diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate2.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate2.js new file mode 100644 index 0000000000000000000000000000000000000000..e4e7b2b654a3dceefeb8d37be9eb238d46a0736b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate2.js @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +let baseHoverDelegate = { + showHover: () => undefined, + hideHover: () => undefined, + showAndFocusLastHover: () => undefined, + setupManagedHover: () => null, + showManagedHover: () => undefined +}; +/** + * Sets the hover delegate for use **only in the `base/` layer**. + */ +export function setBaseLayerHoverDelegate(hoverDelegate) { + baseHoverDelegate = hoverDelegate; +} +/** + * Gets the hover delegate for use **only in the `base/` layer**. + * + * Since the hover service depends on various platform services, this delegate essentially bypasses + * the standard dependency injection mechanism by injecting a global hover service at start up. The + * only reason this should be used is if `IHoverService` is not available. + */ +export function getBaseLayerHoverDelegate() { + return baseHoverDelegate; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js new file mode 100644 index 0000000000000000000000000000000000000000..f6fc092d56c141c4dab7bd6d4d4d2e067e3007e6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Lazy } from '../../../common/lazy.js'; +const nullHoverDelegateFactory = () => ({ + get delay() { return -1; }, + dispose: () => { }, + showHover: () => { return undefined; }, +}); +let hoverDelegateFactory = nullHoverDelegateFactory; +const defaultHoverDelegateMouse = new Lazy(() => hoverDelegateFactory('mouse', false)); +const defaultHoverDelegateElement = new Lazy(() => hoverDelegateFactory('element', false)); +// TODO: Remove when getDefaultHoverDelegate is no longer used +export function setHoverDelegateFactory(hoverDelegateProvider) { + hoverDelegateFactory = hoverDelegateProvider; +} +// TODO: Refine type for use in new IHoverService interface +export function getDefaultHoverDelegate(placement) { + if (placement === 'element') { + return defaultHoverDelegateElement.value; + } + return defaultHoverDelegateMouse.value; +} +// TODO: Create equivalent in IHoverService +export function createInstantHoverDelegate() { + // Creates a hover delegate with instant hover enabled. + // This hover belongs to the consumer and requires the them to dispose it. + // Instant hover only makes sense for 'element' placement. + return hoverDelegateFactory('element', true); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.css new file mode 100644 index 0000000000000000000000000000000000000000..d69122654e579098a88016d7c049424a0d2ec8e9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.css @@ -0,0 +1,192 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-hover { + cursor: default; + position: absolute; + overflow: hidden; + user-select: text; + -webkit-user-select: text; + box-sizing: border-box; + animation: fadein 100ms linear; + line-height: 1.5em; + white-space: var(--vscode-hover-whiteSpace, normal); +} + +.monaco-hover.hidden { + display: none; +} + +.monaco-hover a:hover:not(.disabled) { + cursor: pointer; +} + +.monaco-hover .hover-contents:not(.html-hover-contents) { + padding: 4px 8px; +} + +.monaco-hover .markdown-hover > .hover-contents:not(.code-hover-contents) { + max-width: var(--vscode-hover-maxWidth, 500px); + word-wrap: break-word; +} + +.monaco-hover .markdown-hover > .hover-contents:not(.code-hover-contents) hr { + min-width: 100%; +} + +.monaco-hover p, +.monaco-hover .code, +.monaco-hover ul, +.monaco-hover h1, +.monaco-hover h2, +.monaco-hover h3, +.monaco-hover h4, +.monaco-hover h5, +.monaco-hover h6 { + margin: 8px 0; +} + +.monaco-hover h1, +.monaco-hover h2, +.monaco-hover h3, +.monaco-hover h4, +.monaco-hover h5, +.monaco-hover h6 { + line-height: 1.1; +} + +.monaco-hover code { + font-family: var(--monaco-monospace-font); +} + +.monaco-hover hr { + box-sizing: border-box; + border-left: 0px; + border-right: 0px; + margin-top: 4px; + margin-bottom: -4px; + margin-left: -8px; + margin-right: -8px; + height: 1px; +} + +.monaco-hover p:first-child, +.monaco-hover .code:first-child, +.monaco-hover ul:first-child { + margin-top: 0; +} + +.monaco-hover p:last-child, +.monaco-hover .code:last-child, +.monaco-hover ul:last-child { + margin-bottom: 0; +} + +/* MarkupContent Layout */ +.monaco-hover ul { + padding-left: 20px; +} +.monaco-hover ol { + padding-left: 20px; +} + +.monaco-hover li > p { + margin-bottom: 0; +} + +.monaco-hover li > ul { + margin-top: 0; +} + +.monaco-hover code { + border-radius: 3px; + padding: 0 0.4em; +} + +.monaco-hover .monaco-tokenized-source { + white-space: var(--vscode-hover-sourceWhiteSpace, pre-wrap); +} + +.monaco-hover .hover-row.status-bar { + font-size: 12px; + line-height: 22px; +} + +.monaco-hover .hover-row.status-bar .info { + font-style: italic; + padding: 0px 8px; +} + +.monaco-hover .hover-row.status-bar .actions { + display: flex; + padding: 0px 8px; + width: 100%; +} + +.monaco-hover .hover-row.status-bar .actions .action-container { + margin-right: 16px; + cursor: pointer; +} + +.monaco-hover .hover-row.status-bar .actions .action-container .action .icon { + padding-right: 4px; +} + +.monaco-hover .hover-row.status-bar .actions .action-container a { + color: var(--vscode-textLink-foreground); + text-decoration: var(--text-link-decoration); +} + +.monaco-hover .markdown-hover .hover-contents .codicon { + color: inherit; + font-size: inherit; + vertical-align: middle; +} + +.monaco-hover .hover-contents a.code-link:hover, +.monaco-hover .hover-contents a.code-link { + color: inherit; +} + +.monaco-hover .hover-contents a.code-link:before { + content: '('; +} + +.monaco-hover .hover-contents a.code-link:after { + content: ')'; +} + +.monaco-hover .hover-contents a.code-link > span { + text-decoration: underline; + /** Hack to force underline to show **/ + border-bottom: 1px solid transparent; + text-underline-position: under; + color: var(--vscode-textLink-foreground); +} + +.monaco-hover .hover-contents a.code-link > span:hover { + color: var(--vscode-textLink-activeForeground); +} + +/** Spans in markdown hovers need a margin-bottom to avoid looking cramped: https://github.com/microsoft/vscode/issues/101496 **/ +.monaco-hover .markdown-hover .hover-contents:not(.code-hover-contents):not(.html-hover-contents) span { + margin-bottom: 4px; + display: inline-block; +} + +.monaco-hover .markdown-hover .hover-contents:not(.code-hover-contents):not(.html-hover-contents) span.codicon { + margin-bottom: 2px; +} + +.monaco-hover-content .action-container a { + -webkit-user-select: none; + user-select: none; +} + +.monaco-hover-content .action-container.disabled { + pointer-events: none; + opacity: 0.4; + cursor: default; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.js new file mode 100644 index 0000000000000000000000000000000000000000..35e7230b0d4c3b8dc24dbac8bf5ec9836a180b19 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.js @@ -0,0 +1,87 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { DomScrollableElement } from '../scrollbar/scrollableElement.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import './hoverWidget.css'; +import { localize } from '../../../../nls.js'; +const $ = dom.$; +export class HoverWidget extends Disposable { + constructor() { + super(); + this.containerDomNode = document.createElement('div'); + this.containerDomNode.className = 'monaco-hover'; + this.containerDomNode.tabIndex = 0; + this.containerDomNode.setAttribute('role', 'tooltip'); + this.contentsDomNode = document.createElement('div'); + this.contentsDomNode.className = 'monaco-hover-content'; + this.scrollbar = this._register(new DomScrollableElement(this.contentsDomNode, { + consumeMouseWheelIfScrollbarIsNeeded: true + })); + this.containerDomNode.appendChild(this.scrollbar.getDomNode()); + } + onContentsChanged() { + this.scrollbar.scanDomNode(); + } +} +export class HoverAction extends Disposable { + static render(parent, actionOptions, keybindingLabel) { + return new HoverAction(parent, actionOptions, keybindingLabel); + } + constructor(parent, actionOptions, keybindingLabel) { + super(); + this.actionLabel = actionOptions.label; + this.actionKeybindingLabel = keybindingLabel; + this.actionContainer = dom.append(parent, $('div.action-container')); + this.actionContainer.setAttribute('tabindex', '0'); + this.action = dom.append(this.actionContainer, $('a.action')); + this.action.setAttribute('role', 'button'); + if (actionOptions.iconClass) { + dom.append(this.action, $(`span.icon.${actionOptions.iconClass}`)); + } + const label = dom.append(this.action, $('span')); + label.textContent = keybindingLabel ? `${actionOptions.label} (${keybindingLabel})` : actionOptions.label; + this._store.add(new ClickAction(this.actionContainer, actionOptions.run)); + this._store.add(new KeyDownAction(this.actionContainer, actionOptions.run, [3 /* KeyCode.Enter */, 10 /* KeyCode.Space */])); + this.setEnabled(true); + } + setEnabled(enabled) { + if (enabled) { + this.actionContainer.classList.remove('disabled'); + this.actionContainer.removeAttribute('aria-disabled'); + } + else { + this.actionContainer.classList.add('disabled'); + this.actionContainer.setAttribute('aria-disabled', 'true'); + } + } +} +export function getHoverAccessibleViewHint(shouldHaveHint, keybinding) { + return shouldHaveHint && keybinding ? localize('acessibleViewHint', "Inspect this in the accessible view with {0}.", keybinding) : shouldHaveHint ? localize('acessibleViewHintNoKbOpen', "Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding.") : ''; +} +export class ClickAction extends Disposable { + constructor(container, run) { + super(); + this._register(dom.addDisposableListener(container, dom.EventType.CLICK, e => { + e.stopPropagation(); + e.preventDefault(); + run(container); + })); + } +} +export class KeyDownAction extends Disposable { + constructor(container, run, keyCodes) { + super(); + this._register(dom.addDisposableListener(container, dom.EventType.KEY_DOWN, e => { + const event = new StandardKeyboardEvent(e); + if (keyCodes.some(keyCode => event.equals(keyCode))) { + e.stopPropagation(); + e.preventDefault(); + run(container); + } + })); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js new file mode 100644 index 0000000000000000000000000000000000000000..4459c50a7536093d8804f3948474faef0125f9dd --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js @@ -0,0 +1,281 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import './iconlabel.css'; +import * as dom from '../../dom.js'; +import { HighlightedLabel } from '../highlightedlabel/highlightedLabel.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import { equals } from '../../../common/objects.js'; +import { Range } from '../../../common/range.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +import { isString } from '../../../common/types.js'; +import { stripIcons } from '../../../common/iconLabels.js'; +class FastLabelNode { + constructor(_element) { + this._element = _element; + } + get element() { + return this._element; + } + set textContent(content) { + if (this.disposed || content === this._textContent) { + return; + } + this._textContent = content; + this._element.textContent = content; + } + set classNames(classNames) { + if (this.disposed || equals(classNames, this._classNames)) { + return; + } + this._classNames = classNames; + this._element.classList.value = ''; + this._element.classList.add(...classNames); + } + set empty(empty) { + if (this.disposed || empty === this._empty) { + return; + } + this._empty = empty; + this._element.style.marginLeft = empty ? '0' : ''; + } + dispose() { + this.disposed = true; + } +} +export class IconLabel extends Disposable { + constructor(container, options) { + super(); + this.customHovers = new Map(); + this.creationOptions = options; + this.domNode = this._register(new FastLabelNode(dom.append(container, dom.$('.monaco-icon-label')))); + this.labelContainer = dom.append(this.domNode.element, dom.$('.monaco-icon-label-container')); + this.nameContainer = dom.append(this.labelContainer, dom.$('span.monaco-icon-name-container')); + if (options?.supportHighlights || options?.supportIcons) { + this.nameNode = this._register(new LabelWithHighlights(this.nameContainer, !!options.supportIcons)); + } + else { + this.nameNode = new Label(this.nameContainer); + } + this.hoverDelegate = options?.hoverDelegate ?? getDefaultHoverDelegate('mouse'); + } + get element() { + return this.domNode.element; + } + setLabel(label, description, options) { + const labelClasses = ['monaco-icon-label']; + const containerClasses = ['monaco-icon-label-container']; + let ariaLabel = ''; + if (options) { + if (options.extraClasses) { + labelClasses.push(...options.extraClasses); + } + if (options.italic) { + labelClasses.push('italic'); + } + if (options.strikethrough) { + labelClasses.push('strikethrough'); + } + if (options.disabledCommand) { + containerClasses.push('disabled'); + } + if (options.title) { + if (typeof options.title === 'string') { + ariaLabel += options.title; + } + else { + ariaLabel += label; + } + } + } + const existingIconNode = this.domNode.element.querySelector('.monaco-icon-label-iconpath'); + if (options?.iconPath) { + let iconNode; + if (!existingIconNode || !(dom.isHTMLElement(existingIconNode))) { + iconNode = dom.$('.monaco-icon-label-iconpath'); + this.domNode.element.prepend(iconNode); + } + else { + iconNode = existingIconNode; + } + iconNode.style.backgroundImage = dom.asCSSUrl(options?.iconPath); + } + else if (existingIconNode) { + existingIconNode.remove(); + } + this.domNode.classNames = labelClasses; + this.domNode.element.setAttribute('aria-label', ariaLabel); + this.labelContainer.classList.value = ''; + this.labelContainer.classList.add(...containerClasses); + this.setupHover(options?.descriptionTitle ? this.labelContainer : this.element, options?.title); + this.nameNode.setLabel(label, options); + if (description || this.descriptionNode) { + const descriptionNode = this.getOrCreateDescriptionNode(); + if (descriptionNode instanceof HighlightedLabel) { + descriptionNode.set(description || '', options ? options.descriptionMatches : undefined, undefined, options?.labelEscapeNewLines); + this.setupHover(descriptionNode.element, options?.descriptionTitle); + } + else { + descriptionNode.textContent = description && options?.labelEscapeNewLines ? HighlightedLabel.escapeNewLines(description, []) : (description || ''); + this.setupHover(descriptionNode.element, options?.descriptionTitle || ''); + descriptionNode.empty = !description; + } + } + if (options?.suffix || this.suffixNode) { + const suffixNode = this.getOrCreateSuffixNode(); + suffixNode.textContent = options?.suffix ?? ''; + } + } + setupHover(htmlElement, tooltip) { + const previousCustomHover = this.customHovers.get(htmlElement); + if (previousCustomHover) { + previousCustomHover.dispose(); + this.customHovers.delete(htmlElement); + } + if (!tooltip) { + htmlElement.removeAttribute('title'); + return; + } + if (this.hoverDelegate.showNativeHover) { + function setupNativeHover(htmlElement, tooltip) { + if (isString(tooltip)) { + // Icons don't render in the native hover so we strip them out + htmlElement.title = stripIcons(tooltip); + } + else if (tooltip?.markdownNotSupportedFallback) { + htmlElement.title = tooltip.markdownNotSupportedFallback; + } + else { + htmlElement.removeAttribute('title'); + } + } + setupNativeHover(htmlElement, tooltip); + } + else { + const hoverDisposable = getBaseLayerHoverDelegate().setupManagedHover(this.hoverDelegate, htmlElement, tooltip); + if (hoverDisposable) { + this.customHovers.set(htmlElement, hoverDisposable); + } + } + } + dispose() { + super.dispose(); + for (const disposable of this.customHovers.values()) { + disposable.dispose(); + } + this.customHovers.clear(); + } + getOrCreateSuffixNode() { + if (!this.suffixNode) { + const suffixContainer = this._register(new FastLabelNode(dom.after(this.nameContainer, dom.$('span.monaco-icon-suffix-container')))); + this.suffixNode = this._register(new FastLabelNode(dom.append(suffixContainer.element, dom.$('span.label-suffix')))); + } + return this.suffixNode; + } + getOrCreateDescriptionNode() { + if (!this.descriptionNode) { + const descriptionContainer = this._register(new FastLabelNode(dom.append(this.labelContainer, dom.$('span.monaco-icon-description-container')))); + if (this.creationOptions?.supportDescriptionHighlights) { + this.descriptionNode = this._register(new HighlightedLabel(dom.append(descriptionContainer.element, dom.$('span.label-description')), { supportIcons: !!this.creationOptions.supportIcons })); + } + else { + this.descriptionNode = this._register(new FastLabelNode(dom.append(descriptionContainer.element, dom.$('span.label-description')))); + } + } + return this.descriptionNode; + } +} +class Label { + constructor(container) { + this.container = container; + this.label = undefined; + this.singleLabel = undefined; + } + setLabel(label, options) { + if (this.label === label && equals(this.options, options)) { + return; + } + this.label = label; + this.options = options; + if (typeof label === 'string') { + if (!this.singleLabel) { + this.container.innerText = ''; + this.container.classList.remove('multiple'); + this.singleLabel = dom.append(this.container, dom.$('a.label-name', { id: options?.domId })); + } + this.singleLabel.textContent = label; + } + else { + this.container.innerText = ''; + this.container.classList.add('multiple'); + this.singleLabel = undefined; + for (let i = 0; i < label.length; i++) { + const l = label[i]; + const id = options?.domId && `${options?.domId}_${i}`; + dom.append(this.container, dom.$('a.label-name', { id, 'data-icon-label-count': label.length, 'data-icon-label-index': i, 'role': 'treeitem' }, l)); + if (i < label.length - 1) { + dom.append(this.container, dom.$('span.label-separator', undefined, options?.separator || '/')); + } + } + } + } +} +function splitMatches(labels, separator, matches) { + if (!matches) { + return undefined; + } + let labelStart = 0; + return labels.map(label => { + const labelRange = { start: labelStart, end: labelStart + label.length }; + const result = matches + .map(match => Range.intersect(labelRange, match)) + .filter(range => !Range.isEmpty(range)) + .map(({ start, end }) => ({ start: start - labelStart, end: end - labelStart })); + labelStart = labelRange.end + separator.length; + return result; + }); +} +class LabelWithHighlights extends Disposable { + constructor(container, supportIcons) { + super(); + this.container = container; + this.supportIcons = supportIcons; + this.label = undefined; + this.singleLabel = undefined; + } + setLabel(label, options) { + if (this.label === label && equals(this.options, options)) { + return; + } + this.label = label; + this.options = options; + if (typeof label === 'string') { + if (!this.singleLabel) { + this.container.innerText = ''; + this.container.classList.remove('multiple'); + this.singleLabel = this._register(new HighlightedLabel(dom.append(this.container, dom.$('a.label-name', { id: options?.domId })), { supportIcons: this.supportIcons })); + } + this.singleLabel.set(label, options?.matches, undefined, options?.labelEscapeNewLines); + } + else { + this.container.innerText = ''; + this.container.classList.add('multiple'); + this.singleLabel = undefined; + const separator = options?.separator || '/'; + const matches = splitMatches(label, separator, options?.matches); + for (let i = 0; i < label.length; i++) { + const l = label[i]; + const m = matches ? matches[i] : undefined; + const id = options?.domId && `${options?.domId}_${i}`; + const name = dom.$('a.label-name', { id, 'data-icon-label-count': label.length, 'data-icon-label-index': i, 'role': 'treeitem' }); + const highlightedLabel = this._register(new HighlightedLabel(dom.append(this.container, name), { supportIcons: this.supportIcons })); + highlightedLabel.set(l, m, undefined, options?.labelEscapeNewLines); + if (i < label.length - 1) { + dom.append(name, dom.$('span.label-separator', undefined, separator)); + } + } + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js new file mode 100644 index 0000000000000000000000000000000000000000..b8ffc43448ee54220e6ce3d91779afdf263616d0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { ThemeIcon } from '../../../common/themables.js'; +const labelWithIconsRegex = new RegExp(`(\\\\)?\\$\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\)`, 'g'); +export function renderLabelWithIcons(text) { + const elements = new Array(); + let match; + let textStart = 0, textStop = 0; + while ((match = labelWithIconsRegex.exec(text)) !== null) { + textStop = match.index || 0; + if (textStart < textStop) { + elements.push(text.substring(textStart, textStop)); + } + textStart = (match.index || 0) + match[0].length; + const [, escaped, codicon] = match; + elements.push(escaped ? `$(${codicon})` : renderIcon({ id: codicon })); + } + if (textStart < text.length) { + elements.push(text.substring(textStart)); + } + return elements; +} +export function renderIcon(icon) { + const node = dom.$(`span`); + node.classList.add(...ThemeIcon.asClassNameArray(icon)); + return node; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconlabel.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconlabel.css new file mode 100644 index 0000000000000000000000000000000000000000..ad3a358bc5a29f54bd5c72f6b014e4066469d17c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconlabel.css @@ -0,0 +1,120 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/* ---------- Icon label ---------- */ + +.monaco-icon-label { + display: flex; /* required for icons support :before rule */ + overflow: hidden; + text-overflow: ellipsis; +} + +.monaco-icon-label::before { + + /* svg icons rendered as background image */ + background-size: 16px; + background-position: left center; + background-repeat: no-repeat; + padding-right: 6px; + width: 16px; + height: 22px; + line-height: inherit !important; + display: inline-block; + + /* fonts icons */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + vertical-align: top; + + flex-shrink: 0; /* fix for https://github.com/microsoft/vscode/issues/13787 */ +} + +.monaco-icon-label-iconpath { + width: 16px; + height: 16px; + padding-left: 2px; + margin-top: 2px; + display: flex; +} + +.monaco-icon-label-container.disabled { + color: var(--vscode-disabledForeground); +} +.monaco-icon-label > .monaco-icon-label-container { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + flex: 1; +} + +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-name-container > .label-name { + color: inherit; + white-space: pre; /* enable to show labels that include multiple whitespaces */ +} + +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-name-container > .label-name > .label-separator { + margin: 0 2px; + opacity: 0.5; +} + +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-suffix-container > .label-suffix { + opacity: .7; + white-space: pre; +} + +.monaco-icon-label > .monaco-icon-label-container > .monaco-icon-description-container > .label-description { + opacity: .7; + margin-left: 0.5em; + font-size: 0.9em; + white-space: pre; /* enable to show labels that include multiple whitespaces */ +} + +.monaco-icon-label.nowrap > .monaco-icon-label-container > .monaco-icon-description-container > .label-description{ + white-space: nowrap +} + +.vs .monaco-icon-label > .monaco-icon-label-container > .monaco-icon-description-container > .label-description { + opacity: .95; +} + +.monaco-icon-label.italic > .monaco-icon-label-container > .monaco-icon-name-container > .label-name, +.monaco-icon-label.italic > .monaco-icon-label-container > .monaco-icon-description-container > .label-description { + font-style: italic; +} + +.monaco-icon-label.deprecated { + text-decoration: line-through; + opacity: 0.66; +} + +/* make sure apply italic font style to decorations as well */ +.monaco-icon-label.italic::after { + font-style: italic; +} + +.monaco-icon-label.strikethrough > .monaco-icon-label-container > .monaco-icon-name-container > .label-name, +.monaco-icon-label.strikethrough > .monaco-icon-label-container > .monaco-icon-description-container > .label-description { + text-decoration: line-through; +} + +.monaco-icon-label::after { + opacity: 0.75; + font-size: 90%; + font-weight: 600; + margin: auto 16px 0 5px; /* https://github.com/microsoft/vscode/issues/113223 */ + text-align: center; +} + +/* make sure selection color wins when a label is being selected */ +.monaco-list:focus .selected .monaco-icon-label, /* list */ +.monaco-list:focus .selected .monaco-icon-label::after +{ + color: inherit !important; +} + +.monaco-list-row.focused.selected .label-description, +.monaco-list-row.selected .label-description { + opacity: .8; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.css new file mode 100644 index 0000000000000000000000000000000000000000..9d52e6e66da4a98355319f94c034864d8fd8064a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.css @@ -0,0 +1,107 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-inputbox { + position: relative; + display: block; + padding: 0; + box-sizing: border-box; + border-radius: 2px; + + /* Customizable */ + font-size: inherit; +} + +.monaco-inputbox > .ibwrapper > .input, +.monaco-inputbox > .ibwrapper > .mirror { + + /* Customizable */ + padding: 4px 6px; +} + +.monaco-inputbox > .ibwrapper { + position: relative; + width: 100%; + height: 100%; +} + +.monaco-inputbox > .ibwrapper > .input { + display: inline-block; + box-sizing: border-box; + width: 100%; + height: 100%; + line-height: inherit; + border: none; + font-family: inherit; + font-size: inherit; + resize: none; + color: inherit; +} + +.monaco-inputbox > .ibwrapper > input { + text-overflow: ellipsis; +} + +.monaco-inputbox > .ibwrapper > textarea.input { + display: block; + scrollbar-width: none; /* Firefox: hide scrollbars */ + outline: none; +} + +.monaco-inputbox > .ibwrapper > textarea.input::-webkit-scrollbar { + display: none; /* Chrome + Safari: hide scrollbar */ +} + +.monaco-inputbox > .ibwrapper > textarea.input.empty { + white-space: nowrap; +} + +.monaco-inputbox > .ibwrapper > .mirror { + position: absolute; + display: inline-block; + width: 100%; + top: 0; + left: 0; + box-sizing: border-box; + white-space: pre-wrap; + visibility: hidden; + word-wrap: break-word; +} + +/* Context view */ + +.monaco-inputbox-container { + text-align: right; +} + +.monaco-inputbox-container .monaco-inputbox-message { + display: inline-block; + overflow: hidden; + text-align: left; + width: 100%; + box-sizing: border-box; + padding: 0.4em; + font-size: 12px; + line-height: 17px; + margin-top: -1px; + word-wrap: break-word; +} + +/* Action bar support */ +.monaco-inputbox .monaco-action-bar { + position: absolute; + right: 2px; + top: 4px; +} + +.monaco-inputbox .monaco-action-bar .action-item { + margin-left: 2px; +} + +.monaco-inputbox .monaco-action-bar .action-item .codicon { + background-repeat: no-repeat; + width: 16px; + height: 16px; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js new file mode 100644 index 0000000000000000000000000000000000000000..55a96a20f17cfef548409fa616a301709055304b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js @@ -0,0 +1,517 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { renderFormattedText, renderText } from '../../formattedTextRenderer.js'; +import { ActionBar } from '../actionbar/actionbar.js'; +import * as aria from '../aria/aria.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { ScrollableElement } from '../scrollbar/scrollableElement.js'; +import { Widget } from '../widget.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { HistoryNavigator } from '../../../common/history.js'; +import { equals } from '../../../common/objects.js'; +import './inputBox.css'; +import * as nls from '../../../../nls.js'; +const $ = dom.$; +export const unthemedInboxStyles = { + inputBackground: '#3C3C3C', + inputForeground: '#CCCCCC', + inputValidationInfoBorder: '#55AAFF', + inputValidationInfoBackground: '#063B49', + inputValidationWarningBorder: '#B89500', + inputValidationWarningBackground: '#352A05', + inputValidationErrorBorder: '#BE1100', + inputValidationErrorBackground: '#5A1D1D', + inputBorder: undefined, + inputValidationErrorForeground: undefined, + inputValidationInfoForeground: undefined, + inputValidationWarningForeground: undefined +}; +export class InputBox extends Widget { + constructor(container, contextViewProvider, options) { + super(); + this.state = 'idle'; + this.maxHeight = Number.POSITIVE_INFINITY; + this._onDidChange = this._register(new Emitter()); + this.onDidChange = this._onDidChange.event; + this._onDidHeightChange = this._register(new Emitter()); + this.onDidHeightChange = this._onDidHeightChange.event; + this.contextViewProvider = contextViewProvider; + this.options = options; + this.message = null; + this.placeholder = this.options.placeholder || ''; + this.tooltip = this.options.tooltip ?? (this.placeholder || ''); + this.ariaLabel = this.options.ariaLabel || ''; + if (this.options.validationOptions) { + this.validation = this.options.validationOptions.validation; + } + this.element = dom.append(container, $('.monaco-inputbox.idle')); + const tagName = this.options.flexibleHeight ? 'textarea' : 'input'; + const wrapper = dom.append(this.element, $('.ibwrapper')); + this.input = dom.append(wrapper, $(tagName + '.input.empty')); + this.input.setAttribute('autocorrect', 'off'); + this.input.setAttribute('autocapitalize', 'off'); + this.input.setAttribute('spellcheck', 'false'); + this.onfocus(this.input, () => this.element.classList.add('synthetic-focus')); + this.onblur(this.input, () => this.element.classList.remove('synthetic-focus')); + if (this.options.flexibleHeight) { + this.maxHeight = typeof this.options.flexibleMaxHeight === 'number' ? this.options.flexibleMaxHeight : Number.POSITIVE_INFINITY; + this.mirror = dom.append(wrapper, $('div.mirror')); + this.mirror.innerText = '\u00a0'; + this.scrollableElement = new ScrollableElement(this.element, { vertical: 1 /* ScrollbarVisibility.Auto */ }); + if (this.options.flexibleWidth) { + this.input.setAttribute('wrap', 'off'); + this.mirror.style.whiteSpace = 'pre'; + this.mirror.style.wordWrap = 'initial'; + } + dom.append(container, this.scrollableElement.getDomNode()); + this._register(this.scrollableElement); + // from ScrollableElement to DOM + this._register(this.scrollableElement.onScroll(e => this.input.scrollTop = e.scrollTop)); + const onSelectionChange = this._register(new DomEmitter(container.ownerDocument, 'selectionchange')); + const onAnchoredSelectionChange = Event.filter(onSelectionChange.event, () => { + const selection = container.ownerDocument.getSelection(); + return selection?.anchorNode === wrapper; + }); + // from DOM to ScrollableElement + this._register(onAnchoredSelectionChange(this.updateScrollDimensions, this)); + this._register(this.onDidHeightChange(this.updateScrollDimensions, this)); + } + else { + this.input.type = this.options.type || 'text'; + this.input.setAttribute('wrap', 'off'); + } + if (this.ariaLabel) { + this.input.setAttribute('aria-label', this.ariaLabel); + } + if (this.placeholder && !this.options.showPlaceholderOnFocus) { + this.setPlaceHolder(this.placeholder); + } + if (this.tooltip) { + this.setTooltip(this.tooltip); + } + this.oninput(this.input, () => this.onValueChange()); + this.onblur(this.input, () => this.onBlur()); + this.onfocus(this.input, () => this.onFocus()); + this._register(this.ignoreGesture(this.input)); + setTimeout(() => this.updateMirror(), 0); + // Support actions + if (this.options.actions) { + this.actionbar = this._register(new ActionBar(this.element)); + this.actionbar.push(this.options.actions, { icon: true, label: false }); + } + this.applyStyles(); + } + onBlur() { + this._hideMessage(); + if (this.options.showPlaceholderOnFocus) { + this.input.setAttribute('placeholder', ''); + } + } + onFocus() { + this._showMessage(); + if (this.options.showPlaceholderOnFocus) { + this.input.setAttribute('placeholder', this.placeholder || ''); + } + } + setPlaceHolder(placeHolder) { + this.placeholder = placeHolder; + this.input.setAttribute('placeholder', placeHolder); + } + setTooltip(tooltip) { + this.tooltip = tooltip; + if (!this.hover) { + this.hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate('mouse'), this.input, tooltip)); + } + else { + this.hover.update(tooltip); + } + } + get inputElement() { + return this.input; + } + get value() { + return this.input.value; + } + set value(newValue) { + if (this.input.value !== newValue) { + this.input.value = newValue; + this.onValueChange(); + } + } + get height() { + return typeof this.cachedHeight === 'number' ? this.cachedHeight : dom.getTotalHeight(this.element); + } + focus() { + this.input.focus(); + } + blur() { + this.input.blur(); + } + hasFocus() { + return dom.isActiveElement(this.input); + } + select(range = null) { + this.input.select(); + if (range) { + this.input.setSelectionRange(range.start, range.end); + if (range.end === this.input.value.length) { + this.input.scrollLeft = this.input.scrollWidth; + } + } + } + isSelectionAtEnd() { + return this.input.selectionEnd === this.input.value.length && this.input.selectionStart === this.input.selectionEnd; + } + getSelection() { + const selectionStart = this.input.selectionStart; + if (selectionStart === null) { + return null; + } + const selectionEnd = this.input.selectionEnd ?? selectionStart; + return { + start: selectionStart, + end: selectionEnd, + }; + } + enable() { + this.input.removeAttribute('disabled'); + } + disable() { + this.blur(); + this.input.disabled = true; + this._hideMessage(); + } + set paddingRight(paddingRight) { + // Set width to avoid hint text overlapping buttons + this.input.style.width = `calc(100% - ${paddingRight}px)`; + if (this.mirror) { + this.mirror.style.paddingRight = paddingRight + 'px'; + } + } + updateScrollDimensions() { + if (typeof this.cachedContentHeight !== 'number' || typeof this.cachedHeight !== 'number' || !this.scrollableElement) { + return; + } + const scrollHeight = this.cachedContentHeight; + const height = this.cachedHeight; + const scrollTop = this.input.scrollTop; + this.scrollableElement.setScrollDimensions({ scrollHeight, height }); + this.scrollableElement.setScrollPosition({ scrollTop }); + } + showMessage(message, force) { + if (this.state === 'open' && equals(this.message, message)) { + // Already showing + return; + } + this.message = message; + this.element.classList.remove('idle'); + this.element.classList.remove('info'); + this.element.classList.remove('warning'); + this.element.classList.remove('error'); + this.element.classList.add(this.classForType(message.type)); + const styles = this.stylesForType(this.message.type); + this.element.style.border = `1px solid ${dom.asCssValueWithDefault(styles.border, 'transparent')}`; + if (this.message.content && (this.hasFocus() || force)) { + this._showMessage(); + } + } + hideMessage() { + this.message = null; + this.element.classList.remove('info'); + this.element.classList.remove('warning'); + this.element.classList.remove('error'); + this.element.classList.add('idle'); + this._hideMessage(); + this.applyStyles(); + } + validate() { + let errorMsg = null; + if (this.validation) { + errorMsg = this.validation(this.value); + if (errorMsg) { + this.inputElement.setAttribute('aria-invalid', 'true'); + this.showMessage(errorMsg); + } + else if (this.inputElement.hasAttribute('aria-invalid')) { + this.inputElement.removeAttribute('aria-invalid'); + this.hideMessage(); + } + } + return errorMsg?.type; + } + stylesForType(type) { + const styles = this.options.inputBoxStyles; + switch (type) { + case 1 /* MessageType.INFO */: return { border: styles.inputValidationInfoBorder, background: styles.inputValidationInfoBackground, foreground: styles.inputValidationInfoForeground }; + case 2 /* MessageType.WARNING */: return { border: styles.inputValidationWarningBorder, background: styles.inputValidationWarningBackground, foreground: styles.inputValidationWarningForeground }; + default: return { border: styles.inputValidationErrorBorder, background: styles.inputValidationErrorBackground, foreground: styles.inputValidationErrorForeground }; + } + } + classForType(type) { + switch (type) { + case 1 /* MessageType.INFO */: return 'info'; + case 2 /* MessageType.WARNING */: return 'warning'; + default: return 'error'; + } + } + _showMessage() { + if (!this.contextViewProvider || !this.message) { + return; + } + let div; + const layout = () => div.style.width = dom.getTotalWidth(this.element) + 'px'; + this.contextViewProvider.showContextView({ + getAnchor: () => this.element, + anchorAlignment: 1 /* AnchorAlignment.RIGHT */, + render: (container) => { + if (!this.message) { + return null; + } + div = dom.append(container, $('.monaco-inputbox-container')); + layout(); + const renderOptions = { + inline: true, + className: 'monaco-inputbox-message' + }; + const spanElement = (this.message.formatContent + ? renderFormattedText(this.message.content, renderOptions) + : renderText(this.message.content, renderOptions)); + spanElement.classList.add(this.classForType(this.message.type)); + const styles = this.stylesForType(this.message.type); + spanElement.style.backgroundColor = styles.background ?? ''; + spanElement.style.color = styles.foreground ?? ''; + spanElement.style.border = styles.border ? `1px solid ${styles.border}` : ''; + dom.append(div, spanElement); + return null; + }, + onHide: () => { + this.state = 'closed'; + }, + layout: layout + }); + // ARIA Support + let alertText; + if (this.message.type === 3 /* MessageType.ERROR */) { + alertText = nls.localize('alertErrorMessage', "Error: {0}", this.message.content); + } + else if (this.message.type === 2 /* MessageType.WARNING */) { + alertText = nls.localize('alertWarningMessage', "Warning: {0}", this.message.content); + } + else { + alertText = nls.localize('alertInfoMessage', "Info: {0}", this.message.content); + } + aria.alert(alertText); + this.state = 'open'; + } + _hideMessage() { + if (!this.contextViewProvider) { + return; + } + if (this.state === 'open') { + this.contextViewProvider.hideContextView(); + } + this.state = 'idle'; + } + onValueChange() { + this._onDidChange.fire(this.value); + this.validate(); + this.updateMirror(); + this.input.classList.toggle('empty', !this.value); + if (this.state === 'open' && this.contextViewProvider) { + this.contextViewProvider.layout(); + } + } + updateMirror() { + if (!this.mirror) { + return; + } + const value = this.value; + const lastCharCode = value.charCodeAt(value.length - 1); + const suffix = lastCharCode === 10 ? ' ' : ''; + const mirrorTextContent = (value + suffix) + .replace(/\u000c/g, ''); // Don't measure with the form feed character, which messes up sizing + if (mirrorTextContent) { + this.mirror.textContent = value + suffix; + } + else { + this.mirror.innerText = '\u00a0'; + } + this.layout(); + } + applyStyles() { + const styles = this.options.inputBoxStyles; + const background = styles.inputBackground ?? ''; + const foreground = styles.inputForeground ?? ''; + const border = styles.inputBorder ?? ''; + this.element.style.backgroundColor = background; + this.element.style.color = foreground; + this.input.style.backgroundColor = 'inherit'; + this.input.style.color = foreground; + // there's always a border, even if the color is not set. + this.element.style.border = `1px solid ${dom.asCssValueWithDefault(border, 'transparent')}`; + } + layout() { + if (!this.mirror) { + return; + } + const previousHeight = this.cachedContentHeight; + this.cachedContentHeight = dom.getTotalHeight(this.mirror); + if (previousHeight !== this.cachedContentHeight) { + this.cachedHeight = Math.min(this.cachedContentHeight, this.maxHeight); + this.input.style.height = this.cachedHeight + 'px'; + this._onDidHeightChange.fire(this.cachedContentHeight); + } + } + insertAtCursor(text) { + const inputElement = this.inputElement; + const start = inputElement.selectionStart; + const end = inputElement.selectionEnd; + const content = inputElement.value; + if (start !== null && end !== null) { + this.value = content.substr(0, start) + text + content.substr(end); + inputElement.setSelectionRange(start + 1, start + 1); + this.layout(); + } + } + dispose() { + this._hideMessage(); + this.message = null; + this.actionbar?.dispose(); + super.dispose(); + } +} +export class HistoryInputBox extends InputBox { + constructor(container, contextViewProvider, options) { + const NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS = nls.localize({ + key: 'history.inputbox.hint.suffix.noparens', + comment: ['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field ends in a closing parenthesis ")", for example "Filter (e.g. text, !exclude)". The character inserted into the final string is \u21C5 to represent the up and down arrow keys.'] + }, ' or {0} for history', `\u21C5`); + const NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS = nls.localize({ + key: 'history.inputbox.hint.suffix.inparens', + comment: ['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field does NOT end in a closing parenthesis (eg. "Find"). The character inserted into the final string is \u21C5 to represent the up and down arrow keys.'] + }, ' ({0} for history)', `\u21C5`); + super(container, contextViewProvider, options); + this._onDidFocus = this._register(new Emitter()); + this.onDidFocus = this._onDidFocus.event; + this._onDidBlur = this._register(new Emitter()); + this.onDidBlur = this._onDidBlur.event; + this.history = new HistoryNavigator(options.history, 100); + // Function to append the history suffix to the placeholder if necessary + const addSuffix = () => { + if (options.showHistoryHint && options.showHistoryHint() && !this.placeholder.endsWith(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS) && !this.placeholder.endsWith(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS) && this.history.getHistory().length) { + const suffix = this.placeholder.endsWith(')') ? NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS : NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS; + const suffixedPlaceholder = this.placeholder + suffix; + if (options.showPlaceholderOnFocus && !dom.isActiveElement(this.input)) { + this.placeholder = suffixedPlaceholder; + } + else { + this.setPlaceHolder(suffixedPlaceholder); + } + } + }; + // Spot the change to the textarea class attribute which occurs when it changes between non-empty and empty, + // and add the history suffix to the placeholder if not yet present + this.observer = new MutationObserver((mutationList, observer) => { + mutationList.forEach((mutation) => { + if (!mutation.target.textContent) { + addSuffix(); + } + }); + }); + this.observer.observe(this.input, { attributeFilter: ['class'] }); + this.onfocus(this.input, () => addSuffix()); + this.onblur(this.input, () => { + const resetPlaceholder = (historyHint) => { + if (!this.placeholder.endsWith(historyHint)) { + return false; + } + else { + const revertedPlaceholder = this.placeholder.slice(0, this.placeholder.length - historyHint.length); + if (options.showPlaceholderOnFocus) { + this.placeholder = revertedPlaceholder; + } + else { + this.setPlaceHolder(revertedPlaceholder); + } + return true; + } + }; + if (!resetPlaceholder(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS)) { + resetPlaceholder(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS); + } + }); + } + dispose() { + super.dispose(); + if (this.observer) { + this.observer.disconnect(); + this.observer = undefined; + } + } + addToHistory(always) { + if (this.value && (always || this.value !== this.getCurrentValue())) { + this.history.add(this.value); + } + } + isAtLastInHistory() { + return this.history.isLast(); + } + isNowhereInHistory() { + return this.history.isNowhere(); + } + showNextValue() { + if (!this.history.has(this.value)) { + this.addToHistory(); + } + let next = this.getNextValue(); + if (next) { + next = next === this.value ? this.getNextValue() : next; + } + this.value = next ?? ''; + aria.status(this.value ? this.value : nls.localize('clearedInput', "Cleared Input")); + } + showPreviousValue() { + if (!this.history.has(this.value)) { + this.addToHistory(); + } + let previous = this.getPreviousValue(); + if (previous) { + previous = previous === this.value ? this.getPreviousValue() : previous; + } + if (previous) { + this.value = previous; + aria.status(this.value); + } + } + setPlaceHolder(placeHolder) { + super.setPlaceHolder(placeHolder); + this.setTooltip(placeHolder); + } + onBlur() { + super.onBlur(); + this._onDidBlur.fire(); + } + onFocus() { + super.onFocus(); + this._onDidFocus.fire(); + } + getCurrentValue() { + let currentValue = this.history.current(); + if (!currentValue) { + currentValue = this.history.last(); + this.history.next(); + } + return currentValue; + } + getPreviousValue() { + return this.history.previous() || this.history.first(); + } + getNextValue() { + return this.history.next(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css new file mode 100644 index 0000000000000000000000000000000000000000..7f203773f5e2facd8359e341112201b11383a38e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-keybinding { + display: flex; + align-items: center; + line-height: 10px; +} + +.monaco-keybinding > .monaco-keybinding-key { + display: inline-block; + border-style: solid; + border-width: 1px; + border-radius: 3px; + vertical-align: middle; + font-size: 11px; + padding: 3px 5px; + margin: 0 2px; +} + +.monaco-keybinding > .monaco-keybinding-key:first-child { + margin-left: 0; +} + +.monaco-keybinding > .monaco-keybinding-key:last-child { + margin-right: 0; +} + +.monaco-keybinding > .monaco-keybinding-key-separator { + display: inline-block; +} + +.monaco-keybinding > .monaco-keybinding-key-chord-separator { + width: 6px; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js new file mode 100644 index 0000000000000000000000000000000000000000..0fd91447aaa1cb6117788cb74e0cc6f63c6306ed --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { UILabelProvider } from '../../../common/keybindingLabels.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import { equals } from '../../../common/objects.js'; +import './keybindingLabel.css'; +import { localize } from '../../../../nls.js'; +const $ = dom.$; +export const unthemedKeybindingLabelOptions = { + keybindingLabelBackground: undefined, + keybindingLabelForeground: undefined, + keybindingLabelBorder: undefined, + keybindingLabelBottomBorder: undefined, + keybindingLabelShadow: undefined +}; +export class KeybindingLabel extends Disposable { + constructor(container, os, options) { + super(); + this.os = os; + this.keyElements = new Set(); + this.options = options || Object.create(null); + const labelForeground = this.options.keybindingLabelForeground; + this.domNode = dom.append(container, $('.monaco-keybinding')); + if (labelForeground) { + this.domNode.style.color = labelForeground; + } + this.hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate('mouse'), this.domNode, '')); + this.didEverRender = false; + container.appendChild(this.domNode); + } + get element() { + return this.domNode; + } + set(keybinding, matches) { + if (this.didEverRender && this.keybinding === keybinding && KeybindingLabel.areSame(this.matches, matches)) { + return; + } + this.keybinding = keybinding; + this.matches = matches; + this.render(); + } + render() { + this.clear(); + if (this.keybinding) { + const chords = this.keybinding.getChords(); + if (chords[0]) { + this.renderChord(this.domNode, chords[0], this.matches ? this.matches.firstPart : null); + } + for (let i = 1; i < chords.length; i++) { + dom.append(this.domNode, $('span.monaco-keybinding-key-chord-separator', undefined, ' ')); + this.renderChord(this.domNode, chords[i], this.matches ? this.matches.chordPart : null); + } + const title = (this.options.disableTitle ?? false) ? undefined : this.keybinding.getAriaLabel() || undefined; + this.hover.update(title); + this.domNode.setAttribute('aria-label', title || ''); + } + else if (this.options && this.options.renderUnboundKeybindings) { + this.renderUnbound(this.domNode); + } + this.didEverRender = true; + } + clear() { + dom.clearNode(this.domNode); + this.keyElements.clear(); + } + renderChord(parent, chord, match) { + const modifierLabels = UILabelProvider.modifierLabels[this.os]; + if (chord.ctrlKey) { + this.renderKey(parent, modifierLabels.ctrlKey, Boolean(match?.ctrlKey), modifierLabels.separator); + } + if (chord.shiftKey) { + this.renderKey(parent, modifierLabels.shiftKey, Boolean(match?.shiftKey), modifierLabels.separator); + } + if (chord.altKey) { + this.renderKey(parent, modifierLabels.altKey, Boolean(match?.altKey), modifierLabels.separator); + } + if (chord.metaKey) { + this.renderKey(parent, modifierLabels.metaKey, Boolean(match?.metaKey), modifierLabels.separator); + } + const keyLabel = chord.keyLabel; + if (keyLabel) { + this.renderKey(parent, keyLabel, Boolean(match?.keyCode), ''); + } + } + renderKey(parent, label, highlight, separator) { + dom.append(parent, this.createKeyElement(label, highlight ? '.highlight' : '')); + if (separator) { + dom.append(parent, $('span.monaco-keybinding-key-separator', undefined, separator)); + } + } + renderUnbound(parent) { + dom.append(parent, this.createKeyElement(localize('unbound', "Unbound"))); + } + createKeyElement(label, extraClass = '') { + const keyElement = $('span.monaco-keybinding-key' + extraClass, undefined, label); + this.keyElements.add(keyElement); + if (this.options.keybindingLabelBackground) { + keyElement.style.backgroundColor = this.options.keybindingLabelBackground; + } + if (this.options.keybindingLabelBorder) { + keyElement.style.borderColor = this.options.keybindingLabelBorder; + } + if (this.options.keybindingLabelBottomBorder) { + keyElement.style.borderBottomColor = this.options.keybindingLabelBottomBorder; + } + if (this.options.keybindingLabelShadow) { + keyElement.style.boxShadow = `inset 0 -1px 0 ${this.options.keybindingLabelShadow}`; + } + return keyElement; + } + static areSame(a, b) { + if (a === b || (!a && !b)) { + return true; + } + return !!a && !!b && equals(a.firstPart, b.firstPart) && equals(a.chordPart, b.chordPart); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.css new file mode 100644 index 0000000000000000000000000000000000000000..be273a61823d989fc0b00e21558485768d366d71 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.css @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-list { + position: relative; + height: 100%; + width: 100%; + white-space: nowrap; +} + +.monaco-list.mouse-support { + user-select: none; + -webkit-user-select: none; +} + +.monaco-list > .monaco-scrollable-element { + height: 100%; +} + +.monaco-list-rows { + position: relative; + width: 100%; + height: 100%; +} + +.monaco-list.horizontal-scrolling .monaco-list-rows { + width: auto; + min-width: 100%; +} + +.monaco-list-row { + position: absolute; + box-sizing: border-box; + overflow: hidden; + width: 100%; +} + +.monaco-list.mouse-support .monaco-list-row { + cursor: pointer; + touch-action: none; +} + +/* Make sure the scrollbar renders above overlays (sticky scroll) */ +.monaco-list .monaco-scrollable-element > .scrollbar.vertical, +.monaco-pane-view > .monaco-split-view2.vertical > .monaco-scrollable-element > .scrollbar.vertical { + z-index: 14; +} + +/* for OS X ballistic scrolling */ +.monaco-list-row.scrolling { + display: none !important; +} + +/* Focus */ +.monaco-list.element-focused, +.monaco-list.selection-single, +.monaco-list.selection-multiple { + outline: 0 !important; +} + +/* Dnd */ +.monaco-drag-image { + display: inline-block; + padding: 1px 7px; + border-radius: 10px; + font-size: 12px; + position: absolute; + z-index: 1000; +} + +/* Filter */ + +.monaco-list-type-filter-message { + position: absolute; + box-sizing: border-box; + width: 100%; + height: 100%; + top: 0; + left: 0; + padding: 40px 1em 1em 1em; + text-align: center; + white-space: normal; + opacity: 0.7; + pointer-events: none; +} + +.monaco-list-type-filter-message:empty { + display: none; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js new file mode 100644 index 0000000000000000000000000000000000000000..5d4c77eeb4ac6de6604ecb4406e6ec7e81727266 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js @@ -0,0 +1,9 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class ListError extends Error { + constructor(user, message) { + super(`ListError [${user}] ${message}`); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js new file mode 100644 index 0000000000000000000000000000000000000000..322eb4803ff3b8ef50cc4feeba87c9aba9827567 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { range } from '../../../common/arrays.js'; +import { CancellationTokenSource } from '../../../common/cancellation.js'; +import { Event } from '../../../common/event.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import './list.css'; +import { List } from './listWidget.js'; +class PagedRenderer { + get templateId() { return this.renderer.templateId; } + constructor(renderer, modelProvider) { + this.renderer = renderer; + this.modelProvider = modelProvider; + } + renderTemplate(container) { + const data = this.renderer.renderTemplate(container); + return { data, disposable: Disposable.None }; + } + renderElement(index, _, data, height) { + data.disposable?.dispose(); + if (!data.data) { + return; + } + const model = this.modelProvider(); + if (model.isResolved(index)) { + return this.renderer.renderElement(model.get(index), index, data.data, height); + } + const cts = new CancellationTokenSource(); + const promise = model.resolve(index, cts.token); + data.disposable = { dispose: () => cts.cancel() }; + this.renderer.renderPlaceholder(index, data.data); + promise.then(entry => this.renderer.renderElement(entry, index, data.data, height)); + } + disposeTemplate(data) { + if (data.disposable) { + data.disposable.dispose(); + data.disposable = undefined; + } + if (data.data) { + this.renderer.disposeTemplate(data.data); + data.data = undefined; + } + } +} +class PagedAccessibilityProvider { + constructor(modelProvider, accessibilityProvider) { + this.modelProvider = modelProvider; + this.accessibilityProvider = accessibilityProvider; + } + getWidgetAriaLabel() { + return this.accessibilityProvider.getWidgetAriaLabel(); + } + getAriaLabel(index) { + const model = this.modelProvider(); + if (!model.isResolved(index)) { + return null; + } + return this.accessibilityProvider.getAriaLabel(model.get(index)); + } +} +function fromPagedListOptions(modelProvider, options) { + return { + ...options, + accessibilityProvider: options.accessibilityProvider && new PagedAccessibilityProvider(modelProvider, options.accessibilityProvider) + }; +} +export class PagedList { + constructor(user, container, virtualDelegate, renderers, options = {}) { + const modelProvider = () => this.model; + const pagedRenderers = renderers.map(r => new PagedRenderer(r, modelProvider)); + this.list = new List(user, container, virtualDelegate, pagedRenderers, fromPagedListOptions(modelProvider, options)); + } + updateOptions(options) { + this.list.updateOptions(options); + } + getHTMLElement() { + return this.list.getHTMLElement(); + } + get onDidFocus() { + return this.list.onDidFocus; + } + get widget() { + return this.list; + } + get onDidDispose() { + return this.list.onDidDispose; + } + get onMouseDblClick() { + return Event.map(this.list.onMouseDblClick, ({ element, index, browserEvent }) => ({ element: element === undefined ? undefined : this._model.get(element), index, browserEvent })); + } + get onPointer() { + return Event.map(this.list.onPointer, ({ element, index, browserEvent }) => ({ element: element === undefined ? undefined : this._model.get(element), index, browserEvent })); + } + get onDidChangeSelection() { + return Event.map(this.list.onDidChangeSelection, ({ elements, indexes, browserEvent }) => ({ elements: elements.map(e => this._model.get(e)), indexes, browserEvent })); + } + get model() { + return this._model; + } + set model(model) { + this._model = model; + this.list.splice(0, this.list.length, range(model.length)); + } + getFocus() { + return this.list.getFocus(); + } + getSelection() { + return this.list.getSelection(); + } + getSelectedElements() { + return this.getSelection().map(i => this.model.get(i)); + } + style(styles) { + this.list.style(styles); + } + dispose() { + this.list.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js new file mode 100644 index 0000000000000000000000000000000000000000..b7bf416de319ef525de269d69c69db04176ae2ea --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js @@ -0,0 +1,1073 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { DataTransfers } from '../../dnd.js'; +import { $, addDisposableListener, animate, getContentHeight, getContentWidth, getTopLeftOffset, getWindow, isAncestor, isHTMLElement, isSVGElement, scheduleAtNextAnimationFrame } from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { EventType as TouchEventType, Gesture } from '../../touch.js'; +import { SmoothScrollableElement } from '../scrollbar/scrollableElement.js'; +import { distinct, equals } from '../../../common/arrays.js'; +import { Delayer, disposableTimeout } from '../../../common/async.js'; +import { memoize } from '../../../common/decorators.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { Disposable, DisposableStore, toDisposable } from '../../../common/lifecycle.js'; +import { Range } from '../../../common/range.js'; +import { Scrollable } from '../../../common/scrollable.js'; +import { RangeMap, shift } from './rangeMap.js'; +import { RowCache } from './rowCache.js'; +import { BugIndicatingError } from '../../../common/errors.js'; +import { clamp } from '../../../common/numbers.js'; +const StaticDND = { + CurrentDragAndDropData: undefined +}; +const DefaultOptions = { + useShadows: true, + verticalScrollMode: 1 /* ScrollbarVisibility.Auto */, + setRowLineHeight: true, + setRowHeight: true, + supportDynamicHeights: false, + dnd: { + getDragElements(e) { return [e]; }, + getDragURI() { return null; }, + onDragStart() { }, + onDragOver() { return false; }, + drop() { }, + dispose() { } + }, + horizontalScrolling: false, + transformOptimization: true, + alwaysConsumeMouseWheel: true, +}; +export class ElementsDragAndDropData { + constructor(elements) { + this.elements = elements; + } + update() { } + getData() { + return this.elements; + } +} +export class ExternalElementsDragAndDropData { + constructor(elements) { + this.elements = elements; + } + update() { } + getData() { + return this.elements; + } +} +export class NativeDragAndDropData { + constructor() { + this.types = []; + this.files = []; + } + update(dataTransfer) { + if (dataTransfer.types) { + this.types.splice(0, this.types.length, ...dataTransfer.types); + } + if (dataTransfer.files) { + this.files.splice(0, this.files.length); + for (let i = 0; i < dataTransfer.files.length; i++) { + const file = dataTransfer.files.item(i); + if (file && (file.size || file.type)) { + this.files.push(file); + } + } + } + } + getData() { + return { + types: this.types, + files: this.files + }; + } +} +function equalsDragFeedback(f1, f2) { + if (Array.isArray(f1) && Array.isArray(f2)) { + return equals(f1, f2); + } + return f1 === f2; +} +class ListViewAccessibilityProvider { + constructor(accessibilityProvider) { + if (accessibilityProvider?.getSetSize) { + this.getSetSize = accessibilityProvider.getSetSize.bind(accessibilityProvider); + } + else { + this.getSetSize = (e, i, l) => l; + } + if (accessibilityProvider?.getPosInSet) { + this.getPosInSet = accessibilityProvider.getPosInSet.bind(accessibilityProvider); + } + else { + this.getPosInSet = (e, i) => i + 1; + } + if (accessibilityProvider?.getRole) { + this.getRole = accessibilityProvider.getRole.bind(accessibilityProvider); + } + else { + this.getRole = _ => 'listitem'; + } + if (accessibilityProvider?.isChecked) { + this.isChecked = accessibilityProvider.isChecked.bind(accessibilityProvider); + } + else { + this.isChecked = _ => undefined; + } + } +} +/** + * The {@link ListView} is a virtual scrolling engine. + * + * Given that it only renders elements within its viewport, it can hold large + * collections of elements and stay very performant. The performance bottleneck + * usually lies within the user's rendering code for each element. + * + * @remarks It is a low-level widget, not meant to be used directly. Refer to the + * List widget instead. + */ +export class ListView { + static { this.InstanceCount = 0; } + get contentHeight() { return this.rangeMap.size; } + get onDidScroll() { return this.scrollableElement.onScroll; } + get scrollableElementDomNode() { return this.scrollableElement.getDomNode(); } + get horizontalScrolling() { return this._horizontalScrolling; } + set horizontalScrolling(value) { + if (value === this._horizontalScrolling) { + return; + } + if (value && this.supportDynamicHeights) { + throw new Error('Horizontal scrolling and dynamic heights not supported simultaneously'); + } + this._horizontalScrolling = value; + this.domNode.classList.toggle('horizontal-scrolling', this._horizontalScrolling); + if (this._horizontalScrolling) { + for (const item of this.items) { + this.measureItemWidth(item); + } + this.updateScrollWidth(); + this.scrollableElement.setScrollDimensions({ width: getContentWidth(this.domNode) }); + this.rowsContainer.style.width = `${Math.max(this.scrollWidth || 0, this.renderWidth)}px`; + } + else { + this.scrollableElementWidthDelayer.cancel(); + this.scrollableElement.setScrollDimensions({ width: this.renderWidth, scrollWidth: this.renderWidth }); + this.rowsContainer.style.width = ''; + } + } + constructor(container, virtualDelegate, renderers, options = DefaultOptions) { + this.virtualDelegate = virtualDelegate; + this.domId = `list_id_${++ListView.InstanceCount}`; + this.renderers = new Map(); + this.renderWidth = 0; + this._scrollHeight = 0; + this.scrollableElementUpdateDisposable = null; + this.scrollableElementWidthDelayer = new Delayer(50); + this.splicing = false; + this.dragOverAnimationStopDisposable = Disposable.None; + this.dragOverMouseY = 0; + this.canDrop = false; + this.currentDragFeedbackDisposable = Disposable.None; + this.onDragLeaveTimeout = Disposable.None; + this.disposables = new DisposableStore(); + this._onDidChangeContentHeight = new Emitter(); + this._onDidChangeContentWidth = new Emitter(); + this.onDidChangeContentHeight = Event.latch(this._onDidChangeContentHeight.event, undefined, this.disposables); + this._horizontalScrolling = false; + if (options.horizontalScrolling && options.supportDynamicHeights) { + throw new Error('Horizontal scrolling and dynamic heights not supported simultaneously'); + } + this.items = []; + this.itemId = 0; + this.rangeMap = this.createRangeMap(options.paddingTop ?? 0); + for (const renderer of renderers) { + this.renderers.set(renderer.templateId, renderer); + } + this.cache = this.disposables.add(new RowCache(this.renderers)); + this.lastRenderTop = 0; + this.lastRenderHeight = 0; + this.domNode = document.createElement('div'); + this.domNode.className = 'monaco-list'; + this.domNode.classList.add(this.domId); + this.domNode.tabIndex = 0; + this.domNode.classList.toggle('mouse-support', typeof options.mouseSupport === 'boolean' ? options.mouseSupport : true); + this._horizontalScrolling = options.horizontalScrolling ?? DefaultOptions.horizontalScrolling; + this.domNode.classList.toggle('horizontal-scrolling', this._horizontalScrolling); + this.paddingBottom = typeof options.paddingBottom === 'undefined' ? 0 : options.paddingBottom; + this.accessibilityProvider = new ListViewAccessibilityProvider(options.accessibilityProvider); + this.rowsContainer = document.createElement('div'); + this.rowsContainer.className = 'monaco-list-rows'; + const transformOptimization = options.transformOptimization ?? DefaultOptions.transformOptimization; + if (transformOptimization) { + this.rowsContainer.style.transform = 'translate3d(0px, 0px, 0px)'; + this.rowsContainer.style.overflow = 'hidden'; + this.rowsContainer.style.contain = 'strict'; + } + this.disposables.add(Gesture.addTarget(this.rowsContainer)); + this.scrollable = this.disposables.add(new Scrollable({ + forceIntegerValues: true, + smoothScrollDuration: (options.smoothScrolling ?? false) ? 125 : 0, + scheduleAtNextAnimationFrame: cb => scheduleAtNextAnimationFrame(getWindow(this.domNode), cb) + })); + this.scrollableElement = this.disposables.add(new SmoothScrollableElement(this.rowsContainer, { + alwaysConsumeMouseWheel: options.alwaysConsumeMouseWheel ?? DefaultOptions.alwaysConsumeMouseWheel, + horizontal: 1 /* ScrollbarVisibility.Auto */, + vertical: options.verticalScrollMode ?? DefaultOptions.verticalScrollMode, + useShadows: options.useShadows ?? DefaultOptions.useShadows, + mouseWheelScrollSensitivity: options.mouseWheelScrollSensitivity, + fastScrollSensitivity: options.fastScrollSensitivity, + scrollByPage: options.scrollByPage + }, this.scrollable)); + this.domNode.appendChild(this.scrollableElement.getDomNode()); + container.appendChild(this.domNode); + this.scrollableElement.onScroll(this.onScroll, this, this.disposables); + this.disposables.add(addDisposableListener(this.rowsContainer, TouchEventType.Change, e => this.onTouchChange(e))); + // Prevent the monaco-scrollable-element from scrolling + // https://github.com/microsoft/vscode/issues/44181 + this.disposables.add(addDisposableListener(this.scrollableElement.getDomNode(), 'scroll', e => e.target.scrollTop = 0)); + this.disposables.add(addDisposableListener(this.domNode, 'dragover', e => this.onDragOver(this.toDragEvent(e)))); + this.disposables.add(addDisposableListener(this.domNode, 'drop', e => this.onDrop(this.toDragEvent(e)))); + this.disposables.add(addDisposableListener(this.domNode, 'dragleave', e => this.onDragLeave(this.toDragEvent(e)))); + this.disposables.add(addDisposableListener(this.domNode, 'dragend', e => this.onDragEnd(e))); + this.setRowLineHeight = options.setRowLineHeight ?? DefaultOptions.setRowLineHeight; + this.setRowHeight = options.setRowHeight ?? DefaultOptions.setRowHeight; + this.supportDynamicHeights = options.supportDynamicHeights ?? DefaultOptions.supportDynamicHeights; + this.dnd = options.dnd ?? this.disposables.add(DefaultOptions.dnd); + this.layout(options.initialSize?.height, options.initialSize?.width); + } + updateOptions(options) { + if (options.paddingBottom !== undefined) { + this.paddingBottom = options.paddingBottom; + this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight }); + } + if (options.smoothScrolling !== undefined) { + this.scrollable.setSmoothScrollDuration(options.smoothScrolling ? 125 : 0); + } + if (options.horizontalScrolling !== undefined) { + this.horizontalScrolling = options.horizontalScrolling; + } + let scrollableOptions; + if (options.scrollByPage !== undefined) { + scrollableOptions = { ...(scrollableOptions ?? {}), scrollByPage: options.scrollByPage }; + } + if (options.mouseWheelScrollSensitivity !== undefined) { + scrollableOptions = { ...(scrollableOptions ?? {}), mouseWheelScrollSensitivity: options.mouseWheelScrollSensitivity }; + } + if (options.fastScrollSensitivity !== undefined) { + scrollableOptions = { ...(scrollableOptions ?? {}), fastScrollSensitivity: options.fastScrollSensitivity }; + } + if (scrollableOptions) { + this.scrollableElement.updateOptions(scrollableOptions); + } + if (options.paddingTop !== undefined && options.paddingTop !== this.rangeMap.paddingTop) { + // trigger a rerender + const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight); + const offset = options.paddingTop - this.rangeMap.paddingTop; + this.rangeMap.paddingTop = options.paddingTop; + this.render(lastRenderRange, Math.max(0, this.lastRenderTop + offset), this.lastRenderHeight, undefined, undefined, true); + this.setScrollTop(this.lastRenderTop); + this.eventuallyUpdateScrollDimensions(); + if (this.supportDynamicHeights) { + this._rerender(this.lastRenderTop, this.lastRenderHeight); + } + } + } + createRangeMap(paddingTop) { + return new RangeMap(paddingTop); + } + splice(start, deleteCount, elements = []) { + if (this.splicing) { + throw new Error('Can\'t run recursive splices.'); + } + this.splicing = true; + try { + return this._splice(start, deleteCount, elements); + } + finally { + this.splicing = false; + this._onDidChangeContentHeight.fire(this.contentHeight); + } + } + _splice(start, deleteCount, elements = []) { + const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight); + const deleteRange = { start, end: start + deleteCount }; + const removeRange = Range.intersect(previousRenderRange, deleteRange); + // try to reuse rows, avoid removing them from DOM + const rowsToDispose = new Map(); + for (let i = removeRange.end - 1; i >= removeRange.start; i--) { + const item = this.items[i]; + item.dragStartDisposable.dispose(); + item.checkedDisposable.dispose(); + if (item.row) { + let rows = rowsToDispose.get(item.templateId); + if (!rows) { + rows = []; + rowsToDispose.set(item.templateId, rows); + } + const renderer = this.renderers.get(item.templateId); + if (renderer && renderer.disposeElement) { + renderer.disposeElement(item.element, i, item.row.templateData, item.size); + } + rows.unshift(item.row); + } + item.row = null; + item.stale = true; + } + const previousRestRange = { start: start + deleteCount, end: this.items.length }; + const previousRenderedRestRange = Range.intersect(previousRestRange, previousRenderRange); + const previousUnrenderedRestRanges = Range.relativeComplement(previousRestRange, previousRenderRange); + const inserted = elements.map(element => ({ + id: String(this.itemId++), + element, + templateId: this.virtualDelegate.getTemplateId(element), + size: this.virtualDelegate.getHeight(element), + width: undefined, + hasDynamicHeight: !!this.virtualDelegate.hasDynamicHeight && this.virtualDelegate.hasDynamicHeight(element), + lastDynamicHeightWidth: undefined, + row: null, + uri: undefined, + dropTarget: false, + dragStartDisposable: Disposable.None, + checkedDisposable: Disposable.None, + stale: false + })); + let deleted; + // TODO@joao: improve this optimization to catch even more cases + if (start === 0 && deleteCount >= this.items.length) { + this.rangeMap = this.createRangeMap(this.rangeMap.paddingTop); + this.rangeMap.splice(0, 0, inserted); + deleted = this.items; + this.items = inserted; + } + else { + this.rangeMap.splice(start, deleteCount, inserted); + deleted = this.items.splice(start, deleteCount, ...inserted); + } + const delta = elements.length - deleteCount; + const renderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight); + const renderedRestRange = shift(previousRenderedRestRange, delta); + const updateRange = Range.intersect(renderRange, renderedRestRange); + for (let i = updateRange.start; i < updateRange.end; i++) { + this.updateItemInDOM(this.items[i], i); + } + const removeRanges = Range.relativeComplement(renderedRestRange, renderRange); + for (const range of removeRanges) { + for (let i = range.start; i < range.end; i++) { + this.removeItemFromDOM(i); + } + } + const unrenderedRestRanges = previousUnrenderedRestRanges.map(r => shift(r, delta)); + const elementsRange = { start, end: start + elements.length }; + const insertRanges = [elementsRange, ...unrenderedRestRanges].map(r => Range.intersect(renderRange, r)).reverse(); + for (const range of insertRanges) { + for (let i = range.end - 1; i >= range.start; i--) { + const item = this.items[i]; + const rows = rowsToDispose.get(item.templateId); + const row = rows?.pop(); + this.insertItemInDOM(i, row); + } + } + for (const rows of rowsToDispose.values()) { + for (const row of rows) { + this.cache.release(row); + } + } + this.eventuallyUpdateScrollDimensions(); + if (this.supportDynamicHeights) { + this._rerender(this.scrollTop, this.renderHeight); + } + return deleted.map(i => i.element); + } + eventuallyUpdateScrollDimensions() { + this._scrollHeight = this.contentHeight; + this.rowsContainer.style.height = `${this._scrollHeight}px`; + if (!this.scrollableElementUpdateDisposable) { + this.scrollableElementUpdateDisposable = scheduleAtNextAnimationFrame(getWindow(this.domNode), () => { + this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight }); + this.updateScrollWidth(); + this.scrollableElementUpdateDisposable = null; + }); + } + } + eventuallyUpdateScrollWidth() { + if (!this.horizontalScrolling) { + this.scrollableElementWidthDelayer.cancel(); + return; + } + this.scrollableElementWidthDelayer.trigger(() => this.updateScrollWidth()); + } + updateScrollWidth() { + if (!this.horizontalScrolling) { + return; + } + let scrollWidth = 0; + for (const item of this.items) { + if (typeof item.width !== 'undefined') { + scrollWidth = Math.max(scrollWidth, item.width); + } + } + this.scrollWidth = scrollWidth; + this.scrollableElement.setScrollDimensions({ scrollWidth: scrollWidth === 0 ? 0 : (scrollWidth + 10) }); + this._onDidChangeContentWidth.fire(this.scrollWidth); + } + rerender() { + if (!this.supportDynamicHeights) { + return; + } + for (const item of this.items) { + item.lastDynamicHeightWidth = undefined; + } + this._rerender(this.lastRenderTop, this.lastRenderHeight); + } + get length() { + return this.items.length; + } + get renderHeight() { + const scrollDimensions = this.scrollableElement.getScrollDimensions(); + return scrollDimensions.height; + } + get firstVisibleIndex() { + const range = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight); + return range.start; + } + element(index) { + return this.items[index].element; + } + indexOf(element) { + return this.items.findIndex(item => item.element === element); + } + domElement(index) { + const row = this.items[index].row; + return row && row.domNode; + } + elementHeight(index) { + return this.items[index].size; + } + elementTop(index) { + return this.rangeMap.positionAt(index); + } + indexAt(position) { + return this.rangeMap.indexAt(position); + } + indexAfter(position) { + return this.rangeMap.indexAfter(position); + } + layout(height, width) { + const scrollDimensions = { + height: typeof height === 'number' ? height : getContentHeight(this.domNode) + }; + if (this.scrollableElementUpdateDisposable) { + this.scrollableElementUpdateDisposable.dispose(); + this.scrollableElementUpdateDisposable = null; + scrollDimensions.scrollHeight = this.scrollHeight; + } + this.scrollableElement.setScrollDimensions(scrollDimensions); + if (typeof width !== 'undefined') { + this.renderWidth = width; + if (this.supportDynamicHeights) { + this._rerender(this.scrollTop, this.renderHeight); + } + } + if (this.horizontalScrolling) { + this.scrollableElement.setScrollDimensions({ + width: typeof width === 'number' ? width : getContentWidth(this.domNode) + }); + } + } + // Render + render(previousRenderRange, renderTop, renderHeight, renderLeft, scrollWidth, updateItemsInDOM = false) { + const renderRange = this.getRenderRange(renderTop, renderHeight); + const rangesToInsert = Range.relativeComplement(renderRange, previousRenderRange).reverse(); + const rangesToRemove = Range.relativeComplement(previousRenderRange, renderRange); + if (updateItemsInDOM) { + const rangesToUpdate = Range.intersect(previousRenderRange, renderRange); + for (let i = rangesToUpdate.start; i < rangesToUpdate.end; i++) { + this.updateItemInDOM(this.items[i], i); + } + } + this.cache.transact(() => { + for (const range of rangesToRemove) { + for (let i = range.start; i < range.end; i++) { + this.removeItemFromDOM(i); + } + } + for (const range of rangesToInsert) { + for (let i = range.end - 1; i >= range.start; i--) { + this.insertItemInDOM(i); + } + } + }); + if (renderLeft !== undefined) { + this.rowsContainer.style.left = `-${renderLeft}px`; + } + this.rowsContainer.style.top = `-${renderTop}px`; + if (this.horizontalScrolling && scrollWidth !== undefined) { + this.rowsContainer.style.width = `${Math.max(scrollWidth, this.renderWidth)}px`; + } + this.lastRenderTop = renderTop; + this.lastRenderHeight = renderHeight; + } + // DOM operations + insertItemInDOM(index, row) { + const item = this.items[index]; + if (!item.row) { + if (row) { + item.row = row; + item.stale = true; + } + else { + const result = this.cache.alloc(item.templateId); + item.row = result.row; + item.stale ||= result.isReusingConnectedDomNode; + } + } + const role = this.accessibilityProvider.getRole(item.element) || 'listitem'; + item.row.domNode.setAttribute('role', role); + const checked = this.accessibilityProvider.isChecked(item.element); + if (typeof checked === 'boolean') { + item.row.domNode.setAttribute('aria-checked', String(!!checked)); + } + else if (checked) { + const update = (checked) => item.row.domNode.setAttribute('aria-checked', String(!!checked)); + update(checked.value); + item.checkedDisposable = checked.onDidChange(() => update(checked.value)); + } + if (item.stale || !item.row.domNode.parentElement) { + const referenceNode = this.items.at(index + 1)?.row?.domNode ?? null; + if (item.row.domNode.parentElement !== this.rowsContainer || item.row.domNode.nextElementSibling !== referenceNode) { + this.rowsContainer.insertBefore(item.row.domNode, referenceNode); + } + item.stale = false; + } + this.updateItemInDOM(item, index); + const renderer = this.renderers.get(item.templateId); + if (!renderer) { + throw new Error(`No renderer found for template id ${item.templateId}`); + } + renderer?.renderElement(item.element, index, item.row.templateData, item.size); + const uri = this.dnd.getDragURI(item.element); + item.dragStartDisposable.dispose(); + item.row.domNode.draggable = !!uri; + if (uri) { + item.dragStartDisposable = addDisposableListener(item.row.domNode, 'dragstart', event => this.onDragStart(item.element, uri, event)); + } + if (this.horizontalScrolling) { + this.measureItemWidth(item); + this.eventuallyUpdateScrollWidth(); + } + } + measureItemWidth(item) { + if (!item.row || !item.row.domNode) { + return; + } + item.row.domNode.style.width = 'fit-content'; + item.width = getContentWidth(item.row.domNode); + const style = getWindow(item.row.domNode).getComputedStyle(item.row.domNode); + if (style.paddingLeft) { + item.width += parseFloat(style.paddingLeft); + } + if (style.paddingRight) { + item.width += parseFloat(style.paddingRight); + } + item.row.domNode.style.width = ''; + } + updateItemInDOM(item, index) { + item.row.domNode.style.top = `${this.elementTop(index)}px`; + if (this.setRowHeight) { + item.row.domNode.style.height = `${item.size}px`; + } + if (this.setRowLineHeight) { + item.row.domNode.style.lineHeight = `${item.size}px`; + } + item.row.domNode.setAttribute('data-index', `${index}`); + item.row.domNode.setAttribute('data-last-element', index === this.length - 1 ? 'true' : 'false'); + item.row.domNode.setAttribute('data-parity', index % 2 === 0 ? 'even' : 'odd'); + item.row.domNode.setAttribute('aria-setsize', String(this.accessibilityProvider.getSetSize(item.element, index, this.length))); + item.row.domNode.setAttribute('aria-posinset', String(this.accessibilityProvider.getPosInSet(item.element, index))); + item.row.domNode.setAttribute('id', this.getElementDomId(index)); + item.row.domNode.classList.toggle('drop-target', item.dropTarget); + } + removeItemFromDOM(index) { + const item = this.items[index]; + item.dragStartDisposable.dispose(); + item.checkedDisposable.dispose(); + if (item.row) { + const renderer = this.renderers.get(item.templateId); + if (renderer && renderer.disposeElement) { + renderer.disposeElement(item.element, index, item.row.templateData, item.size); + } + this.cache.release(item.row); + item.row = null; + } + if (this.horizontalScrolling) { + this.eventuallyUpdateScrollWidth(); + } + } + getScrollTop() { + const scrollPosition = this.scrollableElement.getScrollPosition(); + return scrollPosition.scrollTop; + } + setScrollTop(scrollTop, reuseAnimation) { + if (this.scrollableElementUpdateDisposable) { + this.scrollableElementUpdateDisposable.dispose(); + this.scrollableElementUpdateDisposable = null; + this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight }); + } + this.scrollableElement.setScrollPosition({ scrollTop, reuseAnimation }); + } + get scrollTop() { + return this.getScrollTop(); + } + set scrollTop(scrollTop) { + this.setScrollTop(scrollTop); + } + get scrollHeight() { + return this._scrollHeight + (this.horizontalScrolling ? 10 : 0) + this.paddingBottom; + } + // Events + get onMouseClick() { return Event.map(this.disposables.add(new DomEmitter(this.domNode, 'click')).event, e => this.toMouseEvent(e), this.disposables); } + get onMouseDblClick() { return Event.map(this.disposables.add(new DomEmitter(this.domNode, 'dblclick')).event, e => this.toMouseEvent(e), this.disposables); } + get onMouseMiddleClick() { return Event.filter(Event.map(this.disposables.add(new DomEmitter(this.domNode, 'auxclick')).event, e => this.toMouseEvent(e), this.disposables), e => e.browserEvent.button === 1, this.disposables); } + get onMouseDown() { return Event.map(this.disposables.add(new DomEmitter(this.domNode, 'mousedown')).event, e => this.toMouseEvent(e), this.disposables); } + get onMouseOver() { return Event.map(this.disposables.add(new DomEmitter(this.domNode, 'mouseover')).event, e => this.toMouseEvent(e), this.disposables); } + get onMouseOut() { return Event.map(this.disposables.add(new DomEmitter(this.domNode, 'mouseout')).event, e => this.toMouseEvent(e), this.disposables); } + get onContextMenu() { return Event.any(Event.map(this.disposables.add(new DomEmitter(this.domNode, 'contextmenu')).event, e => this.toMouseEvent(e), this.disposables), Event.map(this.disposables.add(new DomEmitter(this.domNode, TouchEventType.Contextmenu)).event, e => this.toGestureEvent(e), this.disposables)); } + get onTouchStart() { return Event.map(this.disposables.add(new DomEmitter(this.domNode, 'touchstart')).event, e => this.toTouchEvent(e), this.disposables); } + get onTap() { return Event.map(this.disposables.add(new DomEmitter(this.rowsContainer, TouchEventType.Tap)).event, e => this.toGestureEvent(e), this.disposables); } + toMouseEvent(browserEvent) { + const index = this.getItemIndexFromEventTarget(browserEvent.target || null); + const item = typeof index === 'undefined' ? undefined : this.items[index]; + const element = item && item.element; + return { browserEvent, index, element }; + } + toTouchEvent(browserEvent) { + const index = this.getItemIndexFromEventTarget(browserEvent.target || null); + const item = typeof index === 'undefined' ? undefined : this.items[index]; + const element = item && item.element; + return { browserEvent, index, element }; + } + toGestureEvent(browserEvent) { + const index = this.getItemIndexFromEventTarget(browserEvent.initialTarget || null); + const item = typeof index === 'undefined' ? undefined : this.items[index]; + const element = item && item.element; + return { browserEvent, index, element }; + } + toDragEvent(browserEvent) { + const index = this.getItemIndexFromEventTarget(browserEvent.target || null); + const item = typeof index === 'undefined' ? undefined : this.items[index]; + const element = item && item.element; + const sector = this.getTargetSector(browserEvent, index); + return { browserEvent, index, element, sector }; + } + onScroll(e) { + try { + const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight); + this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth); + if (this.supportDynamicHeights) { + this._rerender(e.scrollTop, e.height, e.inSmoothScrolling); + } + } + catch (err) { + console.error('Got bad scroll event:', e); + throw err; + } + } + onTouchChange(event) { + event.preventDefault(); + event.stopPropagation(); + this.scrollTop -= event.translationY; + } + // DND + onDragStart(element, uri, event) { + if (!event.dataTransfer) { + return; + } + const elements = this.dnd.getDragElements(element); + event.dataTransfer.effectAllowed = 'copyMove'; + event.dataTransfer.setData(DataTransfers.TEXT, uri); + if (event.dataTransfer.setDragImage) { + let label; + if (this.dnd.getDragLabel) { + label = this.dnd.getDragLabel(elements, event); + } + if (typeof label === 'undefined') { + label = String(elements.length); + } + const dragImage = $('.monaco-drag-image'); + dragImage.textContent = label; + const getDragImageContainer = (e) => { + while (e && !e.classList.contains('monaco-workbench')) { + e = e.parentElement; + } + return e || this.domNode.ownerDocument; + }; + const container = getDragImageContainer(this.domNode); + container.appendChild(dragImage); + event.dataTransfer.setDragImage(dragImage, -10, -10); + setTimeout(() => dragImage.remove(), 0); + } + this.domNode.classList.add('dragging'); + this.currentDragData = new ElementsDragAndDropData(elements); + StaticDND.CurrentDragAndDropData = new ExternalElementsDragAndDropData(elements); + this.dnd.onDragStart?.(this.currentDragData, event); + } + onDragOver(event) { + event.browserEvent.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome) + this.onDragLeaveTimeout.dispose(); + if (StaticDND.CurrentDragAndDropData && StaticDND.CurrentDragAndDropData.getData() === 'vscode-ui') { + return false; + } + this.setupDragAndDropScrollTopAnimation(event.browserEvent); + if (!event.browserEvent.dataTransfer) { + return false; + } + // Drag over from outside + if (!this.currentDragData) { + if (StaticDND.CurrentDragAndDropData) { + // Drag over from another list + this.currentDragData = StaticDND.CurrentDragAndDropData; + } + else { + // Drag over from the desktop + if (!event.browserEvent.dataTransfer.types) { + return false; + } + this.currentDragData = new NativeDragAndDropData(); + } + } + const result = this.dnd.onDragOver(this.currentDragData, event.element, event.index, event.sector, event.browserEvent); + this.canDrop = typeof result === 'boolean' ? result : result.accept; + if (!this.canDrop) { + this.currentDragFeedback = undefined; + this.currentDragFeedbackDisposable.dispose(); + return false; + } + event.browserEvent.dataTransfer.dropEffect = (typeof result !== 'boolean' && result.effect?.type === 0 /* ListDragOverEffectType.Copy */) ? 'copy' : 'move'; + let feedback; + if (typeof result !== 'boolean' && result.feedback) { + feedback = result.feedback; + } + else { + if (typeof event.index === 'undefined') { + feedback = [-1]; + } + else { + feedback = [event.index]; + } + } + // sanitize feedback list + feedback = distinct(feedback).filter(i => i >= -1 && i < this.length).sort((a, b) => a - b); + feedback = feedback[0] === -1 ? [-1] : feedback; + let dragOverEffectPosition = typeof result !== 'boolean' && result.effect && result.effect.position ? result.effect.position : "drop-target" /* ListDragOverEffectPosition.Over */; + if (equalsDragFeedback(this.currentDragFeedback, feedback) && this.currentDragFeedbackPosition === dragOverEffectPosition) { + return true; + } + this.currentDragFeedback = feedback; + this.currentDragFeedbackPosition = dragOverEffectPosition; + this.currentDragFeedbackDisposable.dispose(); + if (feedback[0] === -1) { // entire list feedback + this.domNode.classList.add(dragOverEffectPosition); + this.rowsContainer.classList.add(dragOverEffectPosition); + this.currentDragFeedbackDisposable = toDisposable(() => { + this.domNode.classList.remove(dragOverEffectPosition); + this.rowsContainer.classList.remove(dragOverEffectPosition); + }); + } + else { + if (feedback.length > 1 && dragOverEffectPosition !== "drop-target" /* ListDragOverEffectPosition.Over */) { + throw new Error('Can\'t use multiple feedbacks with position different than \'over\''); + } + // Make sure there is no flicker when moving between two items + // Always use the before feedback if possible + if (dragOverEffectPosition === "drop-target-after" /* ListDragOverEffectPosition.After */) { + if (feedback[0] < this.length - 1) { + feedback[0] += 1; + dragOverEffectPosition = "drop-target-before" /* ListDragOverEffectPosition.Before */; + } + } + for (const index of feedback) { + const item = this.items[index]; + item.dropTarget = true; + item.row?.domNode.classList.add(dragOverEffectPosition); + } + this.currentDragFeedbackDisposable = toDisposable(() => { + for (const index of feedback) { + const item = this.items[index]; + item.dropTarget = false; + item.row?.domNode.classList.remove(dragOverEffectPosition); + } + }); + } + return true; + } + onDragLeave(event) { + this.onDragLeaveTimeout.dispose(); + this.onDragLeaveTimeout = disposableTimeout(() => this.clearDragOverFeedback(), 100, this.disposables); + if (this.currentDragData) { + this.dnd.onDragLeave?.(this.currentDragData, event.element, event.index, event.browserEvent); + } + } + onDrop(event) { + if (!this.canDrop) { + return; + } + const dragData = this.currentDragData; + this.teardownDragAndDropScrollTopAnimation(); + this.clearDragOverFeedback(); + this.domNode.classList.remove('dragging'); + this.currentDragData = undefined; + StaticDND.CurrentDragAndDropData = undefined; + if (!dragData || !event.browserEvent.dataTransfer) { + return; + } + event.browserEvent.preventDefault(); + dragData.update(event.browserEvent.dataTransfer); + this.dnd.drop(dragData, event.element, event.index, event.sector, event.browserEvent); + } + onDragEnd(event) { + this.canDrop = false; + this.teardownDragAndDropScrollTopAnimation(); + this.clearDragOverFeedback(); + this.domNode.classList.remove('dragging'); + this.currentDragData = undefined; + StaticDND.CurrentDragAndDropData = undefined; + this.dnd.onDragEnd?.(event); + } + clearDragOverFeedback() { + this.currentDragFeedback = undefined; + this.currentDragFeedbackPosition = undefined; + this.currentDragFeedbackDisposable.dispose(); + this.currentDragFeedbackDisposable = Disposable.None; + } + // DND scroll top animation + setupDragAndDropScrollTopAnimation(event) { + if (!this.dragOverAnimationDisposable) { + const viewTop = getTopLeftOffset(this.domNode).top; + this.dragOverAnimationDisposable = animate(getWindow(this.domNode), this.animateDragAndDropScrollTop.bind(this, viewTop)); + } + this.dragOverAnimationStopDisposable.dispose(); + this.dragOverAnimationStopDisposable = disposableTimeout(() => { + if (this.dragOverAnimationDisposable) { + this.dragOverAnimationDisposable.dispose(); + this.dragOverAnimationDisposable = undefined; + } + }, 1000, this.disposables); + this.dragOverMouseY = event.pageY; + } + animateDragAndDropScrollTop(viewTop) { + if (this.dragOverMouseY === undefined) { + return; + } + const diff = this.dragOverMouseY - viewTop; + const upperLimit = this.renderHeight - 35; + if (diff < 35) { + this.scrollTop += Math.max(-14, Math.floor(0.3 * (diff - 35))); + } + else if (diff > upperLimit) { + this.scrollTop += Math.min(14, Math.floor(0.3 * (diff - upperLimit))); + } + } + teardownDragAndDropScrollTopAnimation() { + this.dragOverAnimationStopDisposable.dispose(); + if (this.dragOverAnimationDisposable) { + this.dragOverAnimationDisposable.dispose(); + this.dragOverAnimationDisposable = undefined; + } + } + // Util + getTargetSector(browserEvent, targetIndex) { + if (targetIndex === undefined) { + return undefined; + } + const relativePosition = browserEvent.offsetY / this.items[targetIndex].size; + const sector = Math.floor(relativePosition / 0.25); + return clamp(sector, 0, 3); + } + getItemIndexFromEventTarget(target) { + const scrollableElement = this.scrollableElement.getDomNode(); + let element = target; + while ((isHTMLElement(element) || isSVGElement(element)) && element !== this.rowsContainer && scrollableElement.contains(element)) { + const rawIndex = element.getAttribute('data-index'); + if (rawIndex) { + const index = Number(rawIndex); + if (!isNaN(index)) { + return index; + } + } + element = element.parentElement; + } + return undefined; + } + getRenderRange(renderTop, renderHeight) { + return { + start: this.rangeMap.indexAt(renderTop), + end: this.rangeMap.indexAfter(renderTop + renderHeight - 1) + }; + } + /** + * Given a stable rendered state, checks every rendered element whether it needs + * to be probed for dynamic height. Adjusts scroll height and top if necessary. + */ + _rerender(renderTop, renderHeight, inSmoothScrolling) { + const previousRenderRange = this.getRenderRange(renderTop, renderHeight); + // Let's remember the second element's position, this helps in scrolling up + // and preserving a linear upwards scroll movement + let anchorElementIndex; + let anchorElementTopDelta; + if (renderTop === this.elementTop(previousRenderRange.start)) { + anchorElementIndex = previousRenderRange.start; + anchorElementTopDelta = 0; + } + else if (previousRenderRange.end - previousRenderRange.start > 1) { + anchorElementIndex = previousRenderRange.start + 1; + anchorElementTopDelta = this.elementTop(anchorElementIndex) - renderTop; + } + let heightDiff = 0; + while (true) { + const renderRange = this.getRenderRange(renderTop, renderHeight); + let didChange = false; + for (let i = renderRange.start; i < renderRange.end; i++) { + const diff = this.probeDynamicHeight(i); + if (diff !== 0) { + this.rangeMap.splice(i, 1, [this.items[i]]); + } + heightDiff += diff; + didChange = didChange || diff !== 0; + } + if (!didChange) { + if (heightDiff !== 0) { + this.eventuallyUpdateScrollDimensions(); + } + const unrenderRanges = Range.relativeComplement(previousRenderRange, renderRange); + for (const range of unrenderRanges) { + for (let i = range.start; i < range.end; i++) { + if (this.items[i].row) { + this.removeItemFromDOM(i); + } + } + } + const renderRanges = Range.relativeComplement(renderRange, previousRenderRange).reverse(); + for (const range of renderRanges) { + for (let i = range.end - 1; i >= range.start; i--) { + this.insertItemInDOM(i); + } + } + for (let i = renderRange.start; i < renderRange.end; i++) { + if (this.items[i].row) { + this.updateItemInDOM(this.items[i], i); + } + } + if (typeof anchorElementIndex === 'number') { + // To compute a destination scroll top, we need to take into account the current smooth scrolling + // animation, and then reuse it with a new target (to avoid prolonging the scroll) + // See https://github.com/microsoft/vscode/issues/104144 + // See https://github.com/microsoft/vscode/pull/104284 + // See https://github.com/microsoft/vscode/issues/107704 + const deltaScrollTop = this.scrollable.getFutureScrollPosition().scrollTop - renderTop; + const newScrollTop = this.elementTop(anchorElementIndex) - anchorElementTopDelta + deltaScrollTop; + this.setScrollTop(newScrollTop, inSmoothScrolling); + } + this._onDidChangeContentHeight.fire(this.contentHeight); + return; + } + } + } + probeDynamicHeight(index) { + const item = this.items[index]; + if (!!this.virtualDelegate.getDynamicHeight) { + const newSize = this.virtualDelegate.getDynamicHeight(item.element); + if (newSize !== null) { + const size = item.size; + item.size = newSize; + item.lastDynamicHeightWidth = this.renderWidth; + return newSize - size; + } + } + if (!item.hasDynamicHeight || item.lastDynamicHeightWidth === this.renderWidth) { + return 0; + } + if (!!this.virtualDelegate.hasDynamicHeight && !this.virtualDelegate.hasDynamicHeight(item.element)) { + return 0; + } + const size = item.size; + if (item.row) { + item.row.domNode.style.height = ''; + item.size = item.row.domNode.offsetHeight; + if (item.size === 0 && !isAncestor(item.row.domNode, getWindow(item.row.domNode).document.body)) { + console.warn('Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!', new Error().stack); + } + item.lastDynamicHeightWidth = this.renderWidth; + return item.size - size; + } + const { row } = this.cache.alloc(item.templateId); + row.domNode.style.height = ''; + this.rowsContainer.appendChild(row.domNode); + const renderer = this.renderers.get(item.templateId); + if (!renderer) { + throw new BugIndicatingError('Missing renderer for templateId: ' + item.templateId); + } + renderer.renderElement(item.element, index, row.templateData, undefined); + item.size = row.domNode.offsetHeight; + renderer.disposeElement?.(item.element, index, row.templateData, undefined); + this.virtualDelegate.setDynamicHeight?.(item.element, item.size); + item.lastDynamicHeightWidth = this.renderWidth; + row.domNode.remove(); + this.cache.release(row); + return item.size - size; + } + getElementDomId(index) { + return `${this.domId}_${index}`; + } + // Dispose + dispose() { + for (const item of this.items) { + item.dragStartDisposable.dispose(); + item.checkedDisposable.dispose(); + if (item.row) { + const renderer = this.renderers.get(item.row.templateId); + if (renderer) { + renderer.disposeElement?.(item.element, -1, item.row.templateData, undefined); + renderer.disposeTemplate(item.row.templateData); + } + } + } + this.items = []; + this.domNode?.remove(); + this.dragOverAnimationDisposable?.dispose(); + this.disposables.dispose(); + } +} +__decorate([ + memoize +], ListView.prototype, "onMouseClick", null); +__decorate([ + memoize +], ListView.prototype, "onMouseDblClick", null); +__decorate([ + memoize +], ListView.prototype, "onMouseMiddleClick", null); +__decorate([ + memoize +], ListView.prototype, "onMouseDown", null); +__decorate([ + memoize +], ListView.prototype, "onMouseOver", null); +__decorate([ + memoize +], ListView.prototype, "onMouseOut", null); +__decorate([ + memoize +], ListView.prototype, "onContextMenu", null); +__decorate([ + memoize +], ListView.prototype, "onTouchStart", null); +__decorate([ + memoize +], ListView.prototype, "onTap", null); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js new file mode 100644 index 0000000000000000000000000000000000000000..416fdc73173feb12b20b21c568d7e8d8f5fcedd8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js @@ -0,0 +1,1528 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { asCssValueWithDefault, createStyleSheet, EventHelper, getActiveElement, getWindow, isHTMLElement, isMouseEvent } from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { Gesture } from '../../touch.js'; +import { alert } from '../aria/aria.js'; +import { CombinedSpliceable } from './splice.js'; +import { binarySearch, firstOrDefault, range } from '../../../common/arrays.js'; +import { timeout } from '../../../common/async.js'; +import { Color } from '../../../common/color.js'; +import { memoize } from '../../../common/decorators.js'; +import { Emitter, Event, EventBufferer } from '../../../common/event.js'; +import { matchesFuzzy2, matchesPrefix } from '../../../common/filters.js'; +import { DisposableStore, dispose } from '../../../common/lifecycle.js'; +import { clamp } from '../../../common/numbers.js'; +import * as platform from '../../../common/platform.js'; +import { isNumber } from '../../../common/types.js'; +import './list.css'; +import { ListError } from './list.js'; +import { ListView } from './listView.js'; +import { StandardMouseEvent } from '../../mouseEvent.js'; +import { autorun, constObservable } from '../../../common/observable.js'; +class TraitRenderer { + constructor(trait) { + this.trait = trait; + this.renderedElements = []; + } + get templateId() { + return `template:${this.trait.name}`; + } + renderTemplate(container) { + return container; + } + renderElement(element, index, templateData) { + const renderedElementIndex = this.renderedElements.findIndex(el => el.templateData === templateData); + if (renderedElementIndex >= 0) { + const rendered = this.renderedElements[renderedElementIndex]; + this.trait.unrender(templateData); + rendered.index = index; + } + else { + const rendered = { index, templateData }; + this.renderedElements.push(rendered); + } + this.trait.renderIndex(index, templateData); + } + splice(start, deleteCount, insertCount) { + const rendered = []; + for (const renderedElement of this.renderedElements) { + if (renderedElement.index < start) { + rendered.push(renderedElement); + } + else if (renderedElement.index >= start + deleteCount) { + rendered.push({ + index: renderedElement.index + insertCount - deleteCount, + templateData: renderedElement.templateData + }); + } + } + this.renderedElements = rendered; + } + renderIndexes(indexes) { + for (const { index, templateData } of this.renderedElements) { + if (indexes.indexOf(index) > -1) { + this.trait.renderIndex(index, templateData); + } + } + } + disposeTemplate(templateData) { + const index = this.renderedElements.findIndex(el => el.templateData === templateData); + if (index < 0) { + return; + } + this.renderedElements.splice(index, 1); + } +} +class Trait { + get name() { return this._trait; } + get renderer() { + return new TraitRenderer(this); + } + constructor(_trait) { + this._trait = _trait; + this.indexes = []; + this.sortedIndexes = []; + this._onChange = new Emitter(); + this.onChange = this._onChange.event; + } + splice(start, deleteCount, elements) { + const diff = elements.length - deleteCount; + const end = start + deleteCount; + const sortedIndexes = []; + let i = 0; + while (i < this.sortedIndexes.length && this.sortedIndexes[i] < start) { + sortedIndexes.push(this.sortedIndexes[i++]); + } + for (let j = 0; j < elements.length; j++) { + if (elements[j]) { + sortedIndexes.push(j + start); + } + } + while (i < this.sortedIndexes.length && this.sortedIndexes[i] >= end) { + sortedIndexes.push(this.sortedIndexes[i++] + diff); + } + this.renderer.splice(start, deleteCount, elements.length); + this._set(sortedIndexes, sortedIndexes); + } + renderIndex(index, container) { + container.classList.toggle(this._trait, this.contains(index)); + } + unrender(container) { + container.classList.remove(this._trait); + } + /** + * Sets the indexes which should have this trait. + * + * @param indexes Indexes which should have this trait. + * @return The old indexes which had this trait. + */ + set(indexes, browserEvent) { + return this._set(indexes, [...indexes].sort(numericSort), browserEvent); + } + _set(indexes, sortedIndexes, browserEvent) { + const result = this.indexes; + const sortedResult = this.sortedIndexes; + this.indexes = indexes; + this.sortedIndexes = sortedIndexes; + const toRender = disjunction(sortedResult, indexes); + this.renderer.renderIndexes(toRender); + this._onChange.fire({ indexes, browserEvent }); + return result; + } + get() { + return this.indexes; + } + contains(index) { + return binarySearch(this.sortedIndexes, index, numericSort) >= 0; + } + dispose() { + dispose(this._onChange); + } +} +__decorate([ + memoize +], Trait.prototype, "renderer", null); +class SelectionTrait extends Trait { + constructor(setAriaSelected) { + super('selected'); + this.setAriaSelected = setAriaSelected; + } + renderIndex(index, container) { + super.renderIndex(index, container); + if (this.setAriaSelected) { + if (this.contains(index)) { + container.setAttribute('aria-selected', 'true'); + } + else { + container.setAttribute('aria-selected', 'false'); + } + } + } +} +/** + * The TraitSpliceable is used as a util class to be able + * to preserve traits across splice calls, given an identity + * provider. + */ +class TraitSpliceable { + constructor(trait, view, identityProvider) { + this.trait = trait; + this.view = view; + this.identityProvider = identityProvider; + } + splice(start, deleteCount, elements) { + if (!this.identityProvider) { + return this.trait.splice(start, deleteCount, new Array(elements.length).fill(false)); + } + const pastElementsWithTrait = this.trait.get().map(i => this.identityProvider.getId(this.view.element(i)).toString()); + if (pastElementsWithTrait.length === 0) { + return this.trait.splice(start, deleteCount, new Array(elements.length).fill(false)); + } + const pastElementsWithTraitSet = new Set(pastElementsWithTrait); + const elementsWithTrait = elements.map(e => pastElementsWithTraitSet.has(this.identityProvider.getId(e).toString())); + this.trait.splice(start, deleteCount, elementsWithTrait); + } +} +export function isInputElement(e) { + return e.tagName === 'INPUT' || e.tagName === 'TEXTAREA'; +} +function isListElementDescendantOfClass(e, className) { + if (e.classList.contains(className)) { + return true; + } + if (e.classList.contains('monaco-list')) { + return false; + } + if (!e.parentElement) { + return false; + } + return isListElementDescendantOfClass(e.parentElement, className); +} +export function isMonacoEditor(e) { + return isListElementDescendantOfClass(e, 'monaco-editor'); +} +export function isMonacoCustomToggle(e) { + return isListElementDescendantOfClass(e, 'monaco-custom-toggle'); +} +export function isActionItem(e) { + return isListElementDescendantOfClass(e, 'action-item'); +} +export function isStickyScrollElement(e) { + return isListElementDescendantOfClass(e, 'monaco-tree-sticky-row'); +} +export function isStickyScrollContainer(e) { + return e.classList.contains('monaco-tree-sticky-container'); +} +export function isButton(e) { + if ((e.tagName === 'A' && e.classList.contains('monaco-button')) || + (e.tagName === 'DIV' && e.classList.contains('monaco-button-dropdown'))) { + return true; + } + if (e.classList.contains('monaco-list')) { + return false; + } + if (!e.parentElement) { + return false; + } + return isButton(e.parentElement); +} +class KeyboardController { + get onKeyDown() { + return Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, 'keydown')).event, $ => $.filter(e => !isInputElement(e.target)) + .map(e => new StandardKeyboardEvent(e))); + } + constructor(list, view, options) { + this.list = list; + this.view = view; + this.disposables = new DisposableStore(); + this.multipleSelectionDisposables = new DisposableStore(); + this.multipleSelectionSupport = options.multipleSelectionSupport; + this.disposables.add(this.onKeyDown(e => { + switch (e.keyCode) { + case 3 /* KeyCode.Enter */: + return this.onEnter(e); + case 16 /* KeyCode.UpArrow */: + return this.onUpArrow(e); + case 18 /* KeyCode.DownArrow */: + return this.onDownArrow(e); + case 11 /* KeyCode.PageUp */: + return this.onPageUpArrow(e); + case 12 /* KeyCode.PageDown */: + return this.onPageDownArrow(e); + case 9 /* KeyCode.Escape */: + return this.onEscape(e); + case 31 /* KeyCode.KeyA */: + if (this.multipleSelectionSupport && (platform.isMacintosh ? e.metaKey : e.ctrlKey)) { + this.onCtrlA(e); + } + } + })); + } + updateOptions(optionsUpdate) { + if (optionsUpdate.multipleSelectionSupport !== undefined) { + this.multipleSelectionSupport = optionsUpdate.multipleSelectionSupport; + } + } + onEnter(e) { + e.preventDefault(); + e.stopPropagation(); + this.list.setSelection(this.list.getFocus(), e.browserEvent); + } + onUpArrow(e) { + e.preventDefault(); + e.stopPropagation(); + this.list.focusPrevious(1, false, e.browserEvent); + const el = this.list.getFocus()[0]; + this.list.setAnchor(el); + this.list.reveal(el); + this.view.domNode.focus(); + } + onDownArrow(e) { + e.preventDefault(); + e.stopPropagation(); + this.list.focusNext(1, false, e.browserEvent); + const el = this.list.getFocus()[0]; + this.list.setAnchor(el); + this.list.reveal(el); + this.view.domNode.focus(); + } + onPageUpArrow(e) { + e.preventDefault(); + e.stopPropagation(); + this.list.focusPreviousPage(e.browserEvent); + const el = this.list.getFocus()[0]; + this.list.setAnchor(el); + this.list.reveal(el); + this.view.domNode.focus(); + } + onPageDownArrow(e) { + e.preventDefault(); + e.stopPropagation(); + this.list.focusNextPage(e.browserEvent); + const el = this.list.getFocus()[0]; + this.list.setAnchor(el); + this.list.reveal(el); + this.view.domNode.focus(); + } + onCtrlA(e) { + e.preventDefault(); + e.stopPropagation(); + this.list.setSelection(range(this.list.length), e.browserEvent); + this.list.setAnchor(undefined); + this.view.domNode.focus(); + } + onEscape(e) { + if (this.list.getSelection().length) { + e.preventDefault(); + e.stopPropagation(); + this.list.setSelection([], e.browserEvent); + this.list.setAnchor(undefined); + this.view.domNode.focus(); + } + } + dispose() { + this.disposables.dispose(); + this.multipleSelectionDisposables.dispose(); + } +} +__decorate([ + memoize +], KeyboardController.prototype, "onKeyDown", null); +export var TypeNavigationMode; +(function (TypeNavigationMode) { + TypeNavigationMode[TypeNavigationMode["Automatic"] = 0] = "Automatic"; + TypeNavigationMode[TypeNavigationMode["Trigger"] = 1] = "Trigger"; +})(TypeNavigationMode || (TypeNavigationMode = {})); +var TypeNavigationControllerState; +(function (TypeNavigationControllerState) { + TypeNavigationControllerState[TypeNavigationControllerState["Idle"] = 0] = "Idle"; + TypeNavigationControllerState[TypeNavigationControllerState["Typing"] = 1] = "Typing"; +})(TypeNavigationControllerState || (TypeNavigationControllerState = {})); +export const DefaultKeyboardNavigationDelegate = new class { + mightProducePrintableCharacter(event) { + if (event.ctrlKey || event.metaKey || event.altKey) { + return false; + } + return (event.keyCode >= 31 /* KeyCode.KeyA */ && event.keyCode <= 56 /* KeyCode.KeyZ */) + || (event.keyCode >= 21 /* KeyCode.Digit0 */ && event.keyCode <= 30 /* KeyCode.Digit9 */) + || (event.keyCode >= 98 /* KeyCode.Numpad0 */ && event.keyCode <= 107 /* KeyCode.Numpad9 */) + || (event.keyCode >= 85 /* KeyCode.Semicolon */ && event.keyCode <= 95 /* KeyCode.Quote */); + } +}; +class TypeNavigationController { + constructor(list, view, keyboardNavigationLabelProvider, keyboardNavigationEventFilter, delegate) { + this.list = list; + this.view = view; + this.keyboardNavigationLabelProvider = keyboardNavigationLabelProvider; + this.keyboardNavigationEventFilter = keyboardNavigationEventFilter; + this.delegate = delegate; + this.enabled = false; + this.state = TypeNavigationControllerState.Idle; + this.mode = TypeNavigationMode.Automatic; + this.triggered = false; + this.previouslyFocused = -1; + this.enabledDisposables = new DisposableStore(); + this.disposables = new DisposableStore(); + this.updateOptions(list.options); + } + updateOptions(options) { + if (options.typeNavigationEnabled ?? true) { + this.enable(); + } + else { + this.disable(); + } + this.mode = options.typeNavigationMode ?? TypeNavigationMode.Automatic; + } + enable() { + if (this.enabled) { + return; + } + let typing = false; + const onChar = Event.chain(this.enabledDisposables.add(new DomEmitter(this.view.domNode, 'keydown')).event, $ => $.filter(e => !isInputElement(e.target)) + .filter(() => this.mode === TypeNavigationMode.Automatic || this.triggered) + .map(event => new StandardKeyboardEvent(event)) + .filter(e => typing || this.keyboardNavigationEventFilter(e)) + .filter(e => this.delegate.mightProducePrintableCharacter(e)) + .forEach(e => EventHelper.stop(e, true)) + .map(event => event.browserEvent.key)); + const onClear = Event.debounce(onChar, () => null, 800, undefined, undefined, undefined, this.enabledDisposables); + const onInput = Event.reduce(Event.any(onChar, onClear), (r, i) => i === null ? null : ((r || '') + i), undefined, this.enabledDisposables); + onInput(this.onInput, this, this.enabledDisposables); + onClear(this.onClear, this, this.enabledDisposables); + onChar(() => typing = true, undefined, this.enabledDisposables); + onClear(() => typing = false, undefined, this.enabledDisposables); + this.enabled = true; + this.triggered = false; + } + disable() { + if (!this.enabled) { + return; + } + this.enabledDisposables.clear(); + this.enabled = false; + this.triggered = false; + } + onClear() { + const focus = this.list.getFocus(); + if (focus.length > 0 && focus[0] === this.previouslyFocused) { + // List: re-announce element on typing end since typed keys will interrupt aria label of focused element + // Do not announce if there was a focus change at the end to prevent duplication https://github.com/microsoft/vscode/issues/95961 + const ariaLabel = this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(focus[0])); + if (typeof ariaLabel === 'string') { + alert(ariaLabel); + } + else if (ariaLabel) { + alert(ariaLabel.get()); + } + } + this.previouslyFocused = -1; + } + onInput(word) { + if (!word) { + this.state = TypeNavigationControllerState.Idle; + this.triggered = false; + return; + } + const focus = this.list.getFocus(); + const start = focus.length > 0 ? focus[0] : 0; + const delta = this.state === TypeNavigationControllerState.Idle ? 1 : 0; + this.state = TypeNavigationControllerState.Typing; + for (let i = 0; i < this.list.length; i++) { + const index = (start + i + delta) % this.list.length; + const label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(index)); + const labelStr = label && label.toString(); + if (this.list.options.typeNavigationEnabled) { + if (typeof labelStr !== 'undefined') { + // If prefix is found, focus and return early + if (matchesPrefix(word, labelStr)) { + this.previouslyFocused = start; + this.list.setFocus([index]); + this.list.reveal(index); + return; + } + const fuzzy = matchesFuzzy2(word, labelStr); + if (fuzzy) { + const fuzzyScore = fuzzy[0].end - fuzzy[0].start; + // ensures that when fuzzy matching, doesn't clash with prefix matching (1 input vs 1+ should be prefix and fuzzy respecitvely). Also makes sure that exact matches are prioritized. + if (fuzzyScore > 1 && fuzzy.length === 1) { + this.previouslyFocused = start; + this.list.setFocus([index]); + this.list.reveal(index); + return; + } + } + } + } + else if (typeof labelStr === 'undefined' || matchesPrefix(word, labelStr)) { + this.previouslyFocused = start; + this.list.setFocus([index]); + this.list.reveal(index); + return; + } + } + } + dispose() { + this.disable(); + this.enabledDisposables.dispose(); + this.disposables.dispose(); + } +} +class DOMFocusController { + constructor(list, view) { + this.list = list; + this.view = view; + this.disposables = new DisposableStore(); + const onKeyDown = Event.chain(this.disposables.add(new DomEmitter(view.domNode, 'keydown')).event, $ => $ + .filter(e => !isInputElement(e.target)) + .map(e => new StandardKeyboardEvent(e))); + const onTab = Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 2 /* KeyCode.Tab */ && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey)); + onTab(this.onTab, this, this.disposables); + } + onTab(e) { + if (e.target !== this.view.domNode) { + return; + } + const focus = this.list.getFocus(); + if (focus.length === 0) { + return; + } + const focusedDomElement = this.view.domElement(focus[0]); + if (!focusedDomElement) { + return; + } + const tabIndexElement = focusedDomElement.querySelector('[tabIndex]'); + if (!tabIndexElement || !(isHTMLElement(tabIndexElement)) || tabIndexElement.tabIndex === -1) { + return; + } + const style = getWindow(tabIndexElement).getComputedStyle(tabIndexElement); + if (style.visibility === 'hidden' || style.display === 'none') { + return; + } + e.preventDefault(); + e.stopPropagation(); + tabIndexElement.focus(); + } + dispose() { + this.disposables.dispose(); + } +} +export function isSelectionSingleChangeEvent(event) { + return platform.isMacintosh ? event.browserEvent.metaKey : event.browserEvent.ctrlKey; +} +export function isSelectionRangeChangeEvent(event) { + return event.browserEvent.shiftKey; +} +function isMouseRightClick(event) { + return isMouseEvent(event) && event.button === 2; +} +const DefaultMultipleSelectionController = { + isSelectionSingleChangeEvent, + isSelectionRangeChangeEvent +}; +export class MouseController { + constructor(list) { + this.list = list; + this.disposables = new DisposableStore(); + this._onPointer = new Emitter(); + this.onPointer = this._onPointer.event; + if (list.options.multipleSelectionSupport !== false) { + this.multipleSelectionController = this.list.options.multipleSelectionController || DefaultMultipleSelectionController; + } + this.mouseSupport = typeof list.options.mouseSupport === 'undefined' || !!list.options.mouseSupport; + if (this.mouseSupport) { + list.onMouseDown(this.onMouseDown, this, this.disposables); + list.onContextMenu(this.onContextMenu, this, this.disposables); + list.onMouseDblClick(this.onDoubleClick, this, this.disposables); + list.onTouchStart(this.onMouseDown, this, this.disposables); + this.disposables.add(Gesture.addTarget(list.getHTMLElement())); + } + Event.any(list.onMouseClick, list.onMouseMiddleClick, list.onTap)(this.onViewPointer, this, this.disposables); + } + updateOptions(optionsUpdate) { + if (optionsUpdate.multipleSelectionSupport !== undefined) { + this.multipleSelectionController = undefined; + if (optionsUpdate.multipleSelectionSupport) { + this.multipleSelectionController = this.list.options.multipleSelectionController || DefaultMultipleSelectionController; + } + } + } + isSelectionSingleChangeEvent(event) { + if (!this.multipleSelectionController) { + return false; + } + return this.multipleSelectionController.isSelectionSingleChangeEvent(event); + } + isSelectionRangeChangeEvent(event) { + if (!this.multipleSelectionController) { + return false; + } + return this.multipleSelectionController.isSelectionRangeChangeEvent(event); + } + isSelectionChangeEvent(event) { + return this.isSelectionSingleChangeEvent(event) || this.isSelectionRangeChangeEvent(event); + } + onMouseDown(e) { + if (isMonacoEditor(e.browserEvent.target)) { + return; + } + if (getActiveElement() !== e.browserEvent.target) { + this.list.domFocus(); + } + } + onContextMenu(e) { + if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) { + return; + } + const focus = typeof e.index === 'undefined' ? [] : [e.index]; + this.list.setFocus(focus, e.browserEvent); + } + onViewPointer(e) { + if (!this.mouseSupport) { + return; + } + if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) { + return; + } + if (e.browserEvent.isHandledByList) { + return; + } + e.browserEvent.isHandledByList = true; + const focus = e.index; + if (typeof focus === 'undefined') { + this.list.setFocus([], e.browserEvent); + this.list.setSelection([], e.browserEvent); + this.list.setAnchor(undefined); + return; + } + if (this.isSelectionChangeEvent(e)) { + return this.changeSelection(e); + } + this.list.setFocus([focus], e.browserEvent); + this.list.setAnchor(focus); + if (!isMouseRightClick(e.browserEvent)) { + this.list.setSelection([focus], e.browserEvent); + } + this._onPointer.fire(e); + } + onDoubleClick(e) { + if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) { + return; + } + if (this.isSelectionChangeEvent(e)) { + return; + } + if (e.browserEvent.isHandledByList) { + return; + } + e.browserEvent.isHandledByList = true; + const focus = this.list.getFocus(); + this.list.setSelection(focus, e.browserEvent); + } + changeSelection(e) { + const focus = e.index; + let anchor = this.list.getAnchor(); + if (this.isSelectionRangeChangeEvent(e)) { + if (typeof anchor === 'undefined') { + const currentFocus = this.list.getFocus()[0]; + anchor = currentFocus ?? focus; + this.list.setAnchor(anchor); + } + const min = Math.min(anchor, focus); + const max = Math.max(anchor, focus); + const rangeSelection = range(min, max + 1); + const selection = this.list.getSelection(); + const contiguousRange = getContiguousRangeContaining(disjunction(selection, [anchor]), anchor); + if (contiguousRange.length === 0) { + return; + } + const newSelection = disjunction(rangeSelection, relativeComplement(selection, contiguousRange)); + this.list.setSelection(newSelection, e.browserEvent); + this.list.setFocus([focus], e.browserEvent); + } + else if (this.isSelectionSingleChangeEvent(e)) { + const selection = this.list.getSelection(); + const newSelection = selection.filter(i => i !== focus); + this.list.setFocus([focus]); + this.list.setAnchor(focus); + if (selection.length === newSelection.length) { + this.list.setSelection([...newSelection, focus], e.browserEvent); + } + else { + this.list.setSelection(newSelection, e.browserEvent); + } + } + } + dispose() { + this.disposables.dispose(); + } +} +export class DefaultStyleController { + constructor(styleElement, selectorSuffix) { + this.styleElement = styleElement; + this.selectorSuffix = selectorSuffix; + } + style(styles) { + const suffix = this.selectorSuffix && `.${this.selectorSuffix}`; + const content = []; + if (styles.listBackground) { + content.push(`.monaco-list${suffix} .monaco-list-rows { background: ${styles.listBackground}; }`); + } + if (styles.listFocusBackground) { + content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`); + content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused:hover { background-color: ${styles.listFocusBackground}; }`); // overwrite :hover style in this case! + } + if (styles.listFocusForeground) { + content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`); + } + if (styles.listActiveSelectionBackground) { + content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected { background-color: ${styles.listActiveSelectionBackground}; }`); + content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected:hover { background-color: ${styles.listActiveSelectionBackground}; }`); // overwrite :hover style in this case! + } + if (styles.listActiveSelectionForeground) { + content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected { color: ${styles.listActiveSelectionForeground}; }`); + } + if (styles.listActiveSelectionIconForeground) { + content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected .codicon { color: ${styles.listActiveSelectionIconForeground}; }`); + } + if (styles.listFocusAndSelectionBackground) { + content.push(` + .monaco-drag-image, + .monaco-list${suffix}:focus .monaco-list-row.selected.focused { background-color: ${styles.listFocusAndSelectionBackground}; } + `); + } + if (styles.listFocusAndSelectionForeground) { + content.push(` + .monaco-drag-image, + .monaco-list${suffix}:focus .monaco-list-row.selected.focused { color: ${styles.listFocusAndSelectionForeground}; } + `); + } + if (styles.listInactiveFocusForeground) { + content.push(`.monaco-list${suffix} .monaco-list-row.focused { color: ${styles.listInactiveFocusForeground}; }`); + content.push(`.monaco-list${suffix} .monaco-list-row.focused:hover { color: ${styles.listInactiveFocusForeground}; }`); // overwrite :hover style in this case! + } + if (styles.listInactiveSelectionIconForeground) { + content.push(`.monaco-list${suffix} .monaco-list-row.focused .codicon { color: ${styles.listInactiveSelectionIconForeground}; }`); + } + if (styles.listInactiveFocusBackground) { + content.push(`.monaco-list${suffix} .monaco-list-row.focused { background-color: ${styles.listInactiveFocusBackground}; }`); + content.push(`.monaco-list${suffix} .monaco-list-row.focused:hover { background-color: ${styles.listInactiveFocusBackground}; }`); // overwrite :hover style in this case! + } + if (styles.listInactiveSelectionBackground) { + content.push(`.monaco-list${suffix} .monaco-list-row.selected { background-color: ${styles.listInactiveSelectionBackground}; }`); + content.push(`.monaco-list${suffix} .monaco-list-row.selected:hover { background-color: ${styles.listInactiveSelectionBackground}; }`); // overwrite :hover style in this case! + } + if (styles.listInactiveSelectionForeground) { + content.push(`.monaco-list${suffix} .monaco-list-row.selected { color: ${styles.listInactiveSelectionForeground}; }`); + } + if (styles.listHoverBackground) { + content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`); + } + if (styles.listHoverForeground) { + content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`); + } + /** + * Outlines + */ + const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, styles.listFocusOutline ?? '')); + if (focusAndSelectionOutline) { // default: listFocusOutline + content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`); + } + if (styles.listFocusOutline) { // default: set + content.push(` + .monaco-drag-image, + .monaco-list${suffix}:focus .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; } + .monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; } + `); + } + const inactiveFocusAndSelectionOutline = asCssValueWithDefault(styles.listSelectionOutline, styles.listInactiveFocusOutline ?? ''); + if (inactiveFocusAndSelectionOutline) { + content.push(`.monaco-list${suffix} .monaco-list-row.focused.selected { outline: 1px dotted ${inactiveFocusAndSelectionOutline}; outline-offset: -1px; }`); + } + if (styles.listSelectionOutline) { // default: activeContrastBorder + content.push(`.monaco-list${suffix} .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`); + } + if (styles.listInactiveFocusOutline) { // default: null + content.push(`.monaco-list${suffix} .monaco-list-row.focused { outline: 1px dotted ${styles.listInactiveFocusOutline}; outline-offset: -1px; }`); + } + if (styles.listHoverOutline) { // default: activeContrastBorder + content.push(`.monaco-list${suffix} .monaco-list-row:hover { outline: 1px dashed ${styles.listHoverOutline}; outline-offset: -1px; }`); + } + if (styles.listDropOverBackground) { + content.push(` + .monaco-list${suffix}.drop-target, + .monaco-list${suffix} .monaco-list-rows.drop-target, + .monaco-list${suffix} .monaco-list-row.drop-target { background-color: ${styles.listDropOverBackground} !important; color: inherit !important; } + `); + } + if (styles.listDropBetweenBackground) { + content.push(` + .monaco-list${suffix} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before, + .monaco-list${suffix} .monaco-list-row.drop-target-before::before { + content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px; + background-color: ${styles.listDropBetweenBackground}; + }`); + content.push(` + .monaco-list${suffix} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after, + .monaco-list${suffix} .monaco-list-row.drop-target-after::after { + content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px; + background-color: ${styles.listDropBetweenBackground}; + }`); + } + if (styles.tableColumnsBorder) { + content.push(` + .monaco-table > .monaco-split-view2, + .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before, + .monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2, + .monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before { + border-color: ${styles.tableColumnsBorder}; + } + + .monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2, + .monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before { + border-color: transparent; + } + `); + } + if (styles.tableOddRowsBackgroundColor) { + content.push(` + .monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr, + .monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr, + .monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr { + background-color: ${styles.tableOddRowsBackgroundColor}; + } + `); + } + this.styleElement.textContent = content.join('\n'); + } +} +export const unthemedListStyles = { + listFocusBackground: '#7FB0D0', + listActiveSelectionBackground: '#0E639C', + listActiveSelectionForeground: '#FFFFFF', + listActiveSelectionIconForeground: '#FFFFFF', + listFocusAndSelectionOutline: '#90C2F9', + listFocusAndSelectionBackground: '#094771', + listFocusAndSelectionForeground: '#FFFFFF', + listInactiveSelectionBackground: '#3F3F46', + listInactiveSelectionIconForeground: '#FFFFFF', + listHoverBackground: '#2A2D2E', + listDropOverBackground: '#383B3D', + listDropBetweenBackground: '#EEEEEE', + treeIndentGuidesStroke: '#a9a9a9', + treeInactiveIndentGuidesStroke: Color.fromHex('#a9a9a9').transparent(0.4).toString(), + tableColumnsBorder: Color.fromHex('#cccccc').transparent(0.2).toString(), + tableOddRowsBackgroundColor: Color.fromHex('#cccccc').transparent(0.04).toString(), + listBackground: undefined, + listFocusForeground: undefined, + listInactiveSelectionForeground: undefined, + listInactiveFocusForeground: undefined, + listInactiveFocusBackground: undefined, + listHoverForeground: undefined, + listFocusOutline: undefined, + listInactiveFocusOutline: undefined, + listSelectionOutline: undefined, + listHoverOutline: undefined, + treeStickyScrollBackground: undefined, + treeStickyScrollBorder: undefined, + treeStickyScrollShadow: undefined +}; +const DefaultOptions = { + keyboardSupport: true, + mouseSupport: true, + multipleSelectionSupport: true, + dnd: { + getDragURI() { return null; }, + onDragStart() { }, + onDragOver() { return false; }, + drop() { }, + dispose() { } + } +}; +// TODO@Joao: move these utils into a SortedArray class +function getContiguousRangeContaining(range, value) { + const index = range.indexOf(value); + if (index === -1) { + return []; + } + const result = []; + let i = index - 1; + while (i >= 0 && range[i] === value - (index - i)) { + result.push(range[i--]); + } + result.reverse(); + i = index; + while (i < range.length && range[i] === value + (i - index)) { + result.push(range[i++]); + } + return result; +} +/** + * Given two sorted collections of numbers, returns the intersection + * between them (OR). + */ +function disjunction(one, other) { + const result = []; + let i = 0, j = 0; + while (i < one.length || j < other.length) { + if (i >= one.length) { + result.push(other[j++]); + } + else if (j >= other.length) { + result.push(one[i++]); + } + else if (one[i] === other[j]) { + result.push(one[i]); + i++; + j++; + continue; + } + else if (one[i] < other[j]) { + result.push(one[i++]); + } + else { + result.push(other[j++]); + } + } + return result; +} +/** + * Given two sorted collections of numbers, returns the relative + * complement between them (XOR). + */ +function relativeComplement(one, other) { + const result = []; + let i = 0, j = 0; + while (i < one.length || j < other.length) { + if (i >= one.length) { + result.push(other[j++]); + } + else if (j >= other.length) { + result.push(one[i++]); + } + else if (one[i] === other[j]) { + i++; + j++; + continue; + } + else if (one[i] < other[j]) { + result.push(one[i++]); + } + else { + j++; + } + } + return result; +} +const numericSort = (a, b) => a - b; +class PipelineRenderer { + constructor(_templateId, renderers) { + this._templateId = _templateId; + this.renderers = renderers; + } + get templateId() { + return this._templateId; + } + renderTemplate(container) { + return this.renderers.map(r => r.renderTemplate(container)); + } + renderElement(element, index, templateData, height) { + let i = 0; + for (const renderer of this.renderers) { + renderer.renderElement(element, index, templateData[i++], height); + } + } + disposeElement(element, index, templateData, height) { + let i = 0; + for (const renderer of this.renderers) { + renderer.disposeElement?.(element, index, templateData[i], height); + i += 1; + } + } + disposeTemplate(templateData) { + let i = 0; + for (const renderer of this.renderers) { + renderer.disposeTemplate(templateData[i++]); + } + } +} +class AccessibiltyRenderer { + constructor(accessibilityProvider) { + this.accessibilityProvider = accessibilityProvider; + this.templateId = 'a18n'; + } + renderTemplate(container) { + return { container, disposables: new DisposableStore() }; + } + renderElement(element, index, data) { + const ariaLabel = this.accessibilityProvider.getAriaLabel(element); + const observable = (ariaLabel && typeof ariaLabel !== 'string') ? ariaLabel : constObservable(ariaLabel); + data.disposables.add(autorun(reader => { + this.setAriaLabel(reader.readObservable(observable), data.container); + })); + const ariaLevel = this.accessibilityProvider.getAriaLevel && this.accessibilityProvider.getAriaLevel(element); + if (typeof ariaLevel === 'number') { + data.container.setAttribute('aria-level', `${ariaLevel}`); + } + else { + data.container.removeAttribute('aria-level'); + } + } + setAriaLabel(ariaLabel, element) { + if (ariaLabel) { + element.setAttribute('aria-label', ariaLabel); + } + else { + element.removeAttribute('aria-label'); + } + } + disposeElement(element, index, templateData, height) { + templateData.disposables.clear(); + } + disposeTemplate(templateData) { + templateData.disposables.dispose(); + } +} +class ListViewDragAndDrop { + constructor(list, dnd) { + this.list = list; + this.dnd = dnd; + } + getDragElements(element) { + const selection = this.list.getSelectedElements(); + const elements = selection.indexOf(element) > -1 ? selection : [element]; + return elements; + } + getDragURI(element) { + return this.dnd.getDragURI(element); + } + getDragLabel(elements, originalEvent) { + if (this.dnd.getDragLabel) { + return this.dnd.getDragLabel(elements, originalEvent); + } + return undefined; + } + onDragStart(data, originalEvent) { + this.dnd.onDragStart?.(data, originalEvent); + } + onDragOver(data, targetElement, targetIndex, targetSector, originalEvent) { + return this.dnd.onDragOver(data, targetElement, targetIndex, targetSector, originalEvent); + } + onDragLeave(data, targetElement, targetIndex, originalEvent) { + this.dnd.onDragLeave?.(data, targetElement, targetIndex, originalEvent); + } + onDragEnd(originalEvent) { + this.dnd.onDragEnd?.(originalEvent); + } + drop(data, targetElement, targetIndex, targetSector, originalEvent) { + this.dnd.drop(data, targetElement, targetIndex, targetSector, originalEvent); + } + dispose() { + this.dnd.dispose(); + } +} +/** + * The {@link List} is a virtual scrolling widget, built on top of the {@link ListView} + * widget. + * + * Features: + * - Customizable keyboard and mouse support + * - Element traits: focus, selection, achor + * - Accessibility support + * - Touch support + * - Performant template-based rendering + * - Horizontal scrolling + * - Variable element height support + * - Dynamic element height support + * - Drag-and-drop support + */ +export class List { + get onDidChangeFocus() { + return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), e => this.toListEvent(e), this.disposables); + } + get onDidChangeSelection() { + return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e), this.disposables); + } + get domId() { return this.view.domId; } + get onDidScroll() { return this.view.onDidScroll; } + get onMouseClick() { return this.view.onMouseClick; } + get onMouseDblClick() { return this.view.onMouseDblClick; } + get onMouseMiddleClick() { return this.view.onMouseMiddleClick; } + get onPointer() { return this.mouseController.onPointer; } + get onMouseDown() { return this.view.onMouseDown; } + get onMouseOver() { return this.view.onMouseOver; } + get onMouseOut() { return this.view.onMouseOut; } + get onTouchStart() { return this.view.onTouchStart; } + get onTap() { return this.view.onTap; } + /** + * Possible context menu trigger events: + * - ContextMenu key + * - Shift F10 + * - Ctrl Option Shift M (macOS with VoiceOver) + * - Mouse right click + */ + get onContextMenu() { + let didJustPressContextMenuKey = false; + const fromKeyDown = Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, 'keydown')).event, $ => $.map(e => new StandardKeyboardEvent(e)) + .filter(e => didJustPressContextMenuKey = e.keyCode === 58 /* KeyCode.ContextMenu */ || (e.shiftKey && e.keyCode === 68 /* KeyCode.F10 */)) + .map(e => EventHelper.stop(e, true)) + .filter(() => false)); + const fromKeyUp = Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, 'keyup')).event, $ => $.forEach(() => didJustPressContextMenuKey = false) + .map(e => new StandardKeyboardEvent(e)) + .filter(e => e.keyCode === 58 /* KeyCode.ContextMenu */ || (e.shiftKey && e.keyCode === 68 /* KeyCode.F10 */)) + .map(e => EventHelper.stop(e, true)) + .map(({ browserEvent }) => { + const focus = this.getFocus(); + const index = focus.length ? focus[0] : undefined; + const element = typeof index !== 'undefined' ? this.view.element(index) : undefined; + const anchor = typeof index !== 'undefined' ? this.view.domElement(index) : this.view.domNode; + return { index, element, anchor, browserEvent }; + })); + const fromMouse = Event.chain(this.view.onContextMenu, $ => $.filter(_ => !didJustPressContextMenuKey) + .map(({ element, index, browserEvent }) => ({ element, index, anchor: new StandardMouseEvent(getWindow(this.view.domNode), browserEvent), browserEvent }))); + return Event.any(fromKeyDown, fromKeyUp, fromMouse); + } + get onKeyDown() { return this.disposables.add(new DomEmitter(this.view.domNode, 'keydown')).event; } + get onDidFocus() { return Event.signal(this.disposables.add(new DomEmitter(this.view.domNode, 'focus', true)).event); } + get onDidBlur() { return Event.signal(this.disposables.add(new DomEmitter(this.view.domNode, 'blur', true)).event); } + constructor(user, container, virtualDelegate, renderers, _options = DefaultOptions) { + this.user = user; + this._options = _options; + this.focus = new Trait('focused'); + this.anchor = new Trait('anchor'); + this.eventBufferer = new EventBufferer(); + this._ariaLabel = ''; + this.disposables = new DisposableStore(); + this._onDidDispose = new Emitter(); + this.onDidDispose = this._onDidDispose.event; + const role = this._options.accessibilityProvider && this._options.accessibilityProvider.getWidgetRole ? this._options.accessibilityProvider?.getWidgetRole() : 'list'; + this.selection = new SelectionTrait(role !== 'listbox'); + const baseRenderers = [this.focus.renderer, this.selection.renderer]; + this.accessibilityProvider = _options.accessibilityProvider; + if (this.accessibilityProvider) { + baseRenderers.push(new AccessibiltyRenderer(this.accessibilityProvider)); + this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant, this, this.disposables); + } + renderers = renderers.map(r => new PipelineRenderer(r.templateId, [...baseRenderers, r])); + const viewOptions = { + ..._options, + dnd: _options.dnd && new ListViewDragAndDrop(this, _options.dnd) + }; + this.view = this.createListView(container, virtualDelegate, renderers, viewOptions); + this.view.domNode.setAttribute('role', role); + if (_options.styleController) { + this.styleController = _options.styleController(this.view.domId); + } + else { + const styleElement = createStyleSheet(this.view.domNode); + this.styleController = new DefaultStyleController(styleElement, this.view.domId); + } + this.spliceable = new CombinedSpliceable([ + new TraitSpliceable(this.focus, this.view, _options.identityProvider), + new TraitSpliceable(this.selection, this.view, _options.identityProvider), + new TraitSpliceable(this.anchor, this.view, _options.identityProvider), + this.view + ]); + this.disposables.add(this.focus); + this.disposables.add(this.selection); + this.disposables.add(this.anchor); + this.disposables.add(this.view); + this.disposables.add(this._onDidDispose); + this.disposables.add(new DOMFocusController(this, this.view)); + if (typeof _options.keyboardSupport !== 'boolean' || _options.keyboardSupport) { + this.keyboardController = new KeyboardController(this, this.view, _options); + this.disposables.add(this.keyboardController); + } + if (_options.keyboardNavigationLabelProvider) { + const delegate = _options.keyboardNavigationDelegate || DefaultKeyboardNavigationDelegate; + this.typeNavigationController = new TypeNavigationController(this, this.view, _options.keyboardNavigationLabelProvider, _options.keyboardNavigationEventFilter ?? (() => true), delegate); + this.disposables.add(this.typeNavigationController); + } + this.mouseController = this.createMouseController(_options); + this.disposables.add(this.mouseController); + this.onDidChangeFocus(this._onFocusChange, this, this.disposables); + this.onDidChangeSelection(this._onSelectionChange, this, this.disposables); + if (this.accessibilityProvider) { + this.ariaLabel = this.accessibilityProvider.getWidgetAriaLabel(); + } + if (this._options.multipleSelectionSupport !== false) { + this.view.domNode.setAttribute('aria-multiselectable', 'true'); + } + } + createListView(container, virtualDelegate, renderers, viewOptions) { + return new ListView(container, virtualDelegate, renderers, viewOptions); + } + createMouseController(options) { + return new MouseController(this); + } + updateOptions(optionsUpdate = {}) { + this._options = { ...this._options, ...optionsUpdate }; + this.typeNavigationController?.updateOptions(this._options); + if (this._options.multipleSelectionController !== undefined) { + if (this._options.multipleSelectionSupport) { + this.view.domNode.setAttribute('aria-multiselectable', 'true'); + } + else { + this.view.domNode.removeAttribute('aria-multiselectable'); + } + } + this.mouseController.updateOptions(optionsUpdate); + this.keyboardController?.updateOptions(optionsUpdate); + this.view.updateOptions(optionsUpdate); + } + get options() { + return this._options; + } + splice(start, deleteCount, elements = []) { + if (start < 0 || start > this.view.length) { + throw new ListError(this.user, `Invalid start index: ${start}`); + } + if (deleteCount < 0) { + throw new ListError(this.user, `Invalid delete count: ${deleteCount}`); + } + if (deleteCount === 0 && elements.length === 0) { + return; + } + this.eventBufferer.bufferEvents(() => this.spliceable.splice(start, deleteCount, elements)); + } + rerender() { + this.view.rerender(); + } + element(index) { + return this.view.element(index); + } + indexOf(element) { + return this.view.indexOf(element); + } + indexAt(position) { + return this.view.indexAt(position); + } + get length() { + return this.view.length; + } + get contentHeight() { + return this.view.contentHeight; + } + get onDidChangeContentHeight() { + return this.view.onDidChangeContentHeight; + } + get scrollTop() { + return this.view.getScrollTop(); + } + set scrollTop(scrollTop) { + this.view.setScrollTop(scrollTop); + } + get scrollHeight() { + return this.view.scrollHeight; + } + get renderHeight() { + return this.view.renderHeight; + } + get firstVisibleIndex() { + return this.view.firstVisibleIndex; + } + get ariaLabel() { + return this._ariaLabel; + } + set ariaLabel(value) { + this._ariaLabel = value; + this.view.domNode.setAttribute('aria-label', value); + } + domFocus() { + this.view.domNode.focus({ preventScroll: true }); + } + layout(height, width) { + this.view.layout(height, width); + } + setSelection(indexes, browserEvent) { + for (const index of indexes) { + if (index < 0 || index >= this.length) { + throw new ListError(this.user, `Invalid index ${index}`); + } + } + this.selection.set(indexes, browserEvent); + } + getSelection() { + return this.selection.get(); + } + getSelectedElements() { + return this.getSelection().map(i => this.view.element(i)); + } + setAnchor(index) { + if (typeof index === 'undefined') { + this.anchor.set([]); + return; + } + if (index < 0 || index >= this.length) { + throw new ListError(this.user, `Invalid index ${index}`); + } + this.anchor.set([index]); + } + getAnchor() { + return firstOrDefault(this.anchor.get(), undefined); + } + getAnchorElement() { + const anchor = this.getAnchor(); + return typeof anchor === 'undefined' ? undefined : this.element(anchor); + } + setFocus(indexes, browserEvent) { + for (const index of indexes) { + if (index < 0 || index >= this.length) { + throw new ListError(this.user, `Invalid index ${index}`); + } + } + this.focus.set(indexes, browserEvent); + } + focusNext(n = 1, loop = false, browserEvent, filter) { + if (this.length === 0) { + return; + } + const focus = this.focus.get(); + const index = this.findNextIndex(focus.length > 0 ? focus[0] + n : 0, loop, filter); + if (index > -1) { + this.setFocus([index], browserEvent); + } + } + focusPrevious(n = 1, loop = false, browserEvent, filter) { + if (this.length === 0) { + return; + } + const focus = this.focus.get(); + const index = this.findPreviousIndex(focus.length > 0 ? focus[0] - n : 0, loop, filter); + if (index > -1) { + this.setFocus([index], browserEvent); + } + } + async focusNextPage(browserEvent, filter) { + let lastPageIndex = this.view.indexAt(this.view.getScrollTop() + this.view.renderHeight); + lastPageIndex = lastPageIndex === 0 ? 0 : lastPageIndex - 1; + const currentlyFocusedElementIndex = this.getFocus()[0]; + if (currentlyFocusedElementIndex !== lastPageIndex && (currentlyFocusedElementIndex === undefined || lastPageIndex > currentlyFocusedElementIndex)) { + const lastGoodPageIndex = this.findPreviousIndex(lastPageIndex, false, filter); + if (lastGoodPageIndex > -1 && currentlyFocusedElementIndex !== lastGoodPageIndex) { + this.setFocus([lastGoodPageIndex], browserEvent); + } + else { + this.setFocus([lastPageIndex], browserEvent); + } + } + else { + const previousScrollTop = this.view.getScrollTop(); + let nextpageScrollTop = previousScrollTop + this.view.renderHeight; + if (lastPageIndex > currentlyFocusedElementIndex) { + // scroll last page element to the top only if the last page element is below the focused element + nextpageScrollTop -= this.view.elementHeight(lastPageIndex); + } + this.view.setScrollTop(nextpageScrollTop); + if (this.view.getScrollTop() !== previousScrollTop) { + this.setFocus([]); + // Let the scroll event listener run + await timeout(0); + await this.focusNextPage(browserEvent, filter); + } + } + } + async focusPreviousPage(browserEvent, filter, getPaddingTop = () => 0) { + let firstPageIndex; + const paddingTop = getPaddingTop(); + const scrollTop = this.view.getScrollTop() + paddingTop; + if (scrollTop === 0) { + firstPageIndex = this.view.indexAt(scrollTop); + } + else { + firstPageIndex = this.view.indexAfter(scrollTop - 1); + } + const currentlyFocusedElementIndex = this.getFocus()[0]; + if (currentlyFocusedElementIndex !== firstPageIndex && (currentlyFocusedElementIndex === undefined || currentlyFocusedElementIndex >= firstPageIndex)) { + const firstGoodPageIndex = this.findNextIndex(firstPageIndex, false, filter); + if (firstGoodPageIndex > -1 && currentlyFocusedElementIndex !== firstGoodPageIndex) { + this.setFocus([firstGoodPageIndex], browserEvent); + } + else { + this.setFocus([firstPageIndex], browserEvent); + } + } + else { + const previousScrollTop = scrollTop; + this.view.setScrollTop(scrollTop - this.view.renderHeight - paddingTop); + if (this.view.getScrollTop() + getPaddingTop() !== previousScrollTop) { + this.setFocus([]); + // Let the scroll event listener run + await timeout(0); + await this.focusPreviousPage(browserEvent, filter, getPaddingTop); + } + } + } + focusLast(browserEvent, filter) { + if (this.length === 0) { + return; + } + const index = this.findPreviousIndex(this.length - 1, false, filter); + if (index > -1) { + this.setFocus([index], browserEvent); + } + } + focusFirst(browserEvent, filter) { + this.focusNth(0, browserEvent, filter); + } + focusNth(n, browserEvent, filter) { + if (this.length === 0) { + return; + } + const index = this.findNextIndex(n, false, filter); + if (index > -1) { + this.setFocus([index], browserEvent); + } + } + findNextIndex(index, loop = false, filter) { + for (let i = 0; i < this.length; i++) { + if (index >= this.length && !loop) { + return -1; + } + index = index % this.length; + if (!filter || filter(this.element(index))) { + return index; + } + index++; + } + return -1; + } + findPreviousIndex(index, loop = false, filter) { + for (let i = 0; i < this.length; i++) { + if (index < 0 && !loop) { + return -1; + } + index = (this.length + (index % this.length)) % this.length; + if (!filter || filter(this.element(index))) { + return index; + } + index--; + } + return -1; + } + getFocus() { + return this.focus.get(); + } + getFocusedElements() { + return this.getFocus().map(i => this.view.element(i)); + } + reveal(index, relativeTop, paddingTop = 0) { + if (index < 0 || index >= this.length) { + throw new ListError(this.user, `Invalid index ${index}`); + } + const scrollTop = this.view.getScrollTop(); + const elementTop = this.view.elementTop(index); + const elementHeight = this.view.elementHeight(index); + if (isNumber(relativeTop)) { + // y = mx + b + const m = elementHeight - this.view.renderHeight + paddingTop; + this.view.setScrollTop(m * clamp(relativeTop, 0, 1) + elementTop - paddingTop); + } + else { + const viewItemBottom = elementTop + elementHeight; + const scrollBottom = scrollTop + this.view.renderHeight; + if (elementTop < scrollTop + paddingTop && viewItemBottom >= scrollBottom) { + // The element is already overflowing the viewport, no-op + } + else if (elementTop < scrollTop + paddingTop || (viewItemBottom >= scrollBottom && elementHeight >= this.view.renderHeight)) { + this.view.setScrollTop(elementTop - paddingTop); + } + else if (viewItemBottom >= scrollBottom) { + this.view.setScrollTop(viewItemBottom - this.view.renderHeight); + } + } + } + /** + * Returns the relative position of an element rendered in the list. + * Returns `null` if the element isn't *entirely* in the visible viewport. + */ + getRelativeTop(index, paddingTop = 0) { + if (index < 0 || index >= this.length) { + throw new ListError(this.user, `Invalid index ${index}`); + } + const scrollTop = this.view.getScrollTop(); + const elementTop = this.view.elementTop(index); + const elementHeight = this.view.elementHeight(index); + if (elementTop < scrollTop + paddingTop || elementTop + elementHeight > scrollTop + this.view.renderHeight) { + return null; + } + // y = mx + b + const m = elementHeight - this.view.renderHeight + paddingTop; + return Math.abs((scrollTop + paddingTop - elementTop) / m); + } + getHTMLElement() { + return this.view.domNode; + } + getScrollableElement() { + return this.view.scrollableElementDomNode; + } + getElementID(index) { + return this.view.getElementDomId(index); + } + getElementTop(index) { + return this.view.elementTop(index); + } + style(styles) { + this.styleController.style(styles); + } + toListEvent({ indexes, browserEvent }) { + return { indexes, elements: indexes.map(i => this.view.element(i)), browserEvent }; + } + _onFocusChange() { + const focus = this.focus.get(); + this.view.domNode.classList.toggle('element-focused', focus.length > 0); + this.onDidChangeActiveDescendant(); + } + onDidChangeActiveDescendant() { + const focus = this.focus.get(); + if (focus.length > 0) { + let id; + if (this.accessibilityProvider?.getActiveDescendantId) { + id = this.accessibilityProvider.getActiveDescendantId(this.view.element(focus[0])); + } + this.view.domNode.setAttribute('aria-activedescendant', id || this.view.getElementDomId(focus[0])); + } + else { + this.view.domNode.removeAttribute('aria-activedescendant'); + } + } + _onSelectionChange() { + const selection = this.selection.get(); + this.view.domNode.classList.toggle('selection-none', selection.length === 0); + this.view.domNode.classList.toggle('selection-single', selection.length === 1); + this.view.domNode.classList.toggle('selection-multiple', selection.length > 1); + } + dispose() { + this._onDidDispose.fire(); + this.disposables.dispose(); + this._onDidDispose.dispose(); + } +} +__decorate([ + memoize +], List.prototype, "onDidChangeFocus", null); +__decorate([ + memoize +], List.prototype, "onDidChangeSelection", null); +__decorate([ + memoize +], List.prototype, "onContextMenu", null); +__decorate([ + memoize +], List.prototype, "onKeyDown", null); +__decorate([ + memoize +], List.prototype, "onDidFocus", null); +__decorate([ + memoize +], List.prototype, "onDidBlur", null); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js new file mode 100644 index 0000000000000000000000000000000000000000..18fc09ad8f69b2cb83e732832b84ef070ca37535 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js @@ -0,0 +1,158 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Range } from '../../../common/range.js'; +/** + * Returns the intersection between a ranged group and a range. + * Returns `[]` if the intersection is empty. + */ +export function groupIntersect(range, groups) { + const result = []; + for (const r of groups) { + if (range.start >= r.range.end) { + continue; + } + if (range.end < r.range.start) { + break; + } + const intersection = Range.intersect(range, r.range); + if (Range.isEmpty(intersection)) { + continue; + } + result.push({ + range: intersection, + size: r.size + }); + } + return result; +} +/** + * Shifts a range by that `much`. + */ +export function shift({ start, end }, much) { + return { start: start + much, end: end + much }; +} +/** + * Consolidates a collection of ranged groups. + * + * Consolidation is the process of merging consecutive ranged groups + * that share the same `size`. + */ +export function consolidate(groups) { + const result = []; + let previousGroup = null; + for (const group of groups) { + const start = group.range.start; + const end = group.range.end; + const size = group.size; + if (previousGroup && size === previousGroup.size) { + previousGroup.range.end = end; + continue; + } + previousGroup = { range: { start, end }, size }; + result.push(previousGroup); + } + return result; +} +/** + * Concatenates several collections of ranged groups into a single + * collection. + */ +function concat(...groups) { + return consolidate(groups.reduce((r, g) => r.concat(g), [])); +} +export class RangeMap { + get paddingTop() { + return this._paddingTop; + } + set paddingTop(paddingTop) { + this._size = this._size + paddingTop - this._paddingTop; + this._paddingTop = paddingTop; + } + constructor(topPadding) { + this.groups = []; + this._size = 0; + this._paddingTop = 0; + this._paddingTop = topPadding ?? 0; + this._size = this._paddingTop; + } + splice(index, deleteCount, items = []) { + const diff = items.length - deleteCount; + const before = groupIntersect({ start: 0, end: index }, this.groups); + const after = groupIntersect({ start: index + deleteCount, end: Number.POSITIVE_INFINITY }, this.groups) + .map(g => ({ range: shift(g.range, diff), size: g.size })); + const middle = items.map((item, i) => ({ + range: { start: index + i, end: index + i + 1 }, + size: item.size + })); + this.groups = concat(before, middle, after); + this._size = this._paddingTop + this.groups.reduce((t, g) => t + (g.size * (g.range.end - g.range.start)), 0); + } + /** + * Returns the number of items in the range map. + */ + get count() { + const len = this.groups.length; + if (!len) { + return 0; + } + return this.groups[len - 1].range.end; + } + /** + * Returns the sum of the sizes of all items in the range map. + */ + get size() { + return this._size; + } + /** + * Returns the index of the item at the given position. + */ + indexAt(position) { + if (position < 0) { + return -1; + } + if (position < this._paddingTop) { + return 0; + } + let index = 0; + let size = this._paddingTop; + for (const group of this.groups) { + const count = group.range.end - group.range.start; + const newSize = size + (count * group.size); + if (position < newSize) { + return index + Math.floor((position - size) / group.size); + } + index += count; + size = newSize; + } + return index; + } + /** + * Returns the index of the item right after the item at the + * index of the given position. + */ + indexAfter(position) { + return Math.min(this.indexAt(position) + 1, this.count); + } + /** + * Returns the start position of the item at the given index. + */ + positionAt(index) { + if (index < 0) { + return -1; + } + let position = 0; + let count = 0; + for (const group of this.groups) { + const groupCount = group.range.end - group.range.start; + const newCount = count + groupCount; + if (index < newCount) { + return this._paddingTop + position + ((index - count) * group.size); + } + position += groupCount * group.size; + count = newCount; + } + return -1; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js new file mode 100644 index 0000000000000000000000000000000000000000..5a549388bfcb04aad63936fcf858a90452fc1f0e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js @@ -0,0 +1,107 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { $ } from '../../dom.js'; +export class RowCache { + constructor(renderers) { + this.renderers = renderers; + this.cache = new Map(); + this.transactionNodesPendingRemoval = new Set(); + this.inTransaction = false; + } + /** + * Returns a row either by creating a new one or reusing + * a previously released row which shares the same templateId. + * + * @returns A row and `isReusingConnectedDomNode` if the row's node is already in the dom in a stale position. + */ + alloc(templateId) { + let result = this.getTemplateCache(templateId).pop(); + let isStale = false; + if (result) { + isStale = this.transactionNodesPendingRemoval.has(result.domNode); + if (isStale) { + this.transactionNodesPendingRemoval.delete(result.domNode); + } + } + else { + const domNode = $('.monaco-list-row'); + const renderer = this.getRenderer(templateId); + const templateData = renderer.renderTemplate(domNode); + result = { domNode, templateId, templateData }; + } + return { row: result, isReusingConnectedDomNode: isStale }; + } + /** + * Releases the row for eventual reuse. + */ + release(row) { + if (!row) { + return; + } + this.releaseRow(row); + } + /** + * Begin a set of changes that use the cache. This lets us skip work when a row is removed and then inserted again. + */ + transact(makeChanges) { + if (this.inTransaction) { + throw new Error('Already in transaction'); + } + this.inTransaction = true; + try { + makeChanges(); + } + finally { + for (const domNode of this.transactionNodesPendingRemoval) { + this.doRemoveNode(domNode); + } + this.transactionNodesPendingRemoval.clear(); + this.inTransaction = false; + } + } + releaseRow(row) { + const { domNode, templateId } = row; + if (domNode) { + if (this.inTransaction) { + this.transactionNodesPendingRemoval.add(domNode); + } + else { + this.doRemoveNode(domNode); + } + } + const cache = this.getTemplateCache(templateId); + cache.push(row); + } + doRemoveNode(domNode) { + domNode.classList.remove('scrolling'); + domNode.remove(); + } + getTemplateCache(templateId) { + let result = this.cache.get(templateId); + if (!result) { + result = []; + this.cache.set(templateId, result); + } + return result; + } + dispose() { + this.cache.forEach((cachedRows, templateId) => { + for (const cachedRow of cachedRows) { + const renderer = this.getRenderer(templateId); + renderer.disposeTemplate(cachedRow.templateData); + cachedRow.templateData = null; + } + }); + this.cache.clear(); + this.transactionNodesPendingRemoval.clear(); + } + getRenderer(templateId) { + const renderer = this.renderers.get(templateId); + if (!renderer) { + throw new Error(`No renderer found for ${templateId}`); + } + return renderer; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js new file mode 100644 index 0000000000000000000000000000000000000000..5aa7cc8ab562c98a6cc76c5463cf3b2ef45bb6ef --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js @@ -0,0 +1,12 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class CombinedSpliceable { + constructor(spliceables) { + this.spliceables = spliceables; + } + splice(start, deleteCount, elements) { + this.spliceables.forEach(s => s.splice(start, deleteCount, elements)); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js new file mode 100644 index 0000000000000000000000000000000000000000..0a638b92add280f96d4a1cf7fe8c07a64b37d50e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js @@ -0,0 +1,1139 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { isFirefox } from '../../browser.js'; +import { EventType as TouchEventType, Gesture } from '../../touch.js'; +import { $, addDisposableListener, append, clearNode, createStyleSheet, Dimension, EventHelper, EventType, getActiveElement, getWindow, isAncestor, isInShadowDOM } from '../../dom.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { StandardMouseEvent } from '../../mouseEvent.js'; +import { ActionBar } from '../actionbar/actionbar.js'; +import { ActionViewItem, BaseActionViewItem } from '../actionbar/actionViewItems.js'; +import { layout } from '../contextview/contextview.js'; +import { DomScrollableElement } from '../scrollbar/scrollableElement.js'; +import { EmptySubmenuAction, Separator, SubmenuAction } from '../../../common/actions.js'; +import { RunOnceScheduler } from '../../../common/async.js'; +import { Codicon } from '../../../common/codicons.js'; +import { getCodiconFontCharacters } from '../../../common/codiconsUtil.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import { stripIcons } from '../../../common/iconLabels.js'; +import { DisposableStore } from '../../../common/lifecycle.js'; +import { isLinux, isMacintosh } from '../../../common/platform.js'; +import * as strings from '../../../common/strings.js'; +export const MENU_MNEMONIC_REGEX = /\(&([^\s&])\)|(^|[^&])&([^\s&])/; +export const MENU_ESCAPED_MNEMONIC_REGEX = /(&)?(&)([^\s&])/g; +export var HorizontalDirection; +(function (HorizontalDirection) { + HorizontalDirection[HorizontalDirection["Right"] = 0] = "Right"; + HorizontalDirection[HorizontalDirection["Left"] = 1] = "Left"; +})(HorizontalDirection || (HorizontalDirection = {})); +export var VerticalDirection; +(function (VerticalDirection) { + VerticalDirection[VerticalDirection["Above"] = 0] = "Above"; + VerticalDirection[VerticalDirection["Below"] = 1] = "Below"; +})(VerticalDirection || (VerticalDirection = {})); +export class Menu extends ActionBar { + constructor(container, actions, options, menuStyles) { + container.classList.add('monaco-menu-container'); + container.setAttribute('role', 'presentation'); + const menuElement = document.createElement('div'); + menuElement.classList.add('monaco-menu'); + menuElement.setAttribute('role', 'presentation'); + super(menuElement, { + orientation: 1 /* ActionsOrientation.VERTICAL */, + actionViewItemProvider: action => this.doGetActionViewItem(action, options, parentData), + context: options.context, + actionRunner: options.actionRunner, + ariaLabel: options.ariaLabel, + ariaRole: 'menu', + focusOnlyEnabledItems: true, + triggerKeys: { keys: [3 /* KeyCode.Enter */, ...(isMacintosh || isLinux ? [10 /* KeyCode.Space */] : [])], keyDown: true } + }); + this.menuStyles = menuStyles; + this.menuElement = menuElement; + this.actionsList.tabIndex = 0; + this.initializeOrUpdateStyleSheet(container, menuStyles); + this._register(Gesture.addTarget(menuElement)); + this._register(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => { + const event = new StandardKeyboardEvent(e); + // Stop tab navigation of menus + if (event.equals(2 /* KeyCode.Tab */)) { + e.preventDefault(); + } + })); + if (options.enableMnemonics) { + this._register(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => { + const key = e.key.toLocaleLowerCase(); + if (this.mnemonics.has(key)) { + EventHelper.stop(e, true); + const actions = this.mnemonics.get(key); + if (actions.length === 1) { + if (actions[0] instanceof SubmenuMenuActionViewItem && actions[0].container) { + this.focusItemByElement(actions[0].container); + } + actions[0].onClick(e); + } + if (actions.length > 1) { + const action = actions.shift(); + if (action && action.container) { + this.focusItemByElement(action.container); + actions.push(action); + } + this.mnemonics.set(key, actions); + } + } + })); + } + if (isLinux) { + this._register(addDisposableListener(menuElement, EventType.KEY_DOWN, e => { + const event = new StandardKeyboardEvent(e); + if (event.equals(14 /* KeyCode.Home */) || event.equals(11 /* KeyCode.PageUp */)) { + this.focusedItem = this.viewItems.length - 1; + this.focusNext(); + EventHelper.stop(e, true); + } + else if (event.equals(13 /* KeyCode.End */) || event.equals(12 /* KeyCode.PageDown */)) { + this.focusedItem = 0; + this.focusPrevious(); + EventHelper.stop(e, true); + } + })); + } + this._register(addDisposableListener(this.domNode, EventType.MOUSE_OUT, e => { + const relatedTarget = e.relatedTarget; + if (!isAncestor(relatedTarget, this.domNode)) { + this.focusedItem = undefined; + this.updateFocus(); + e.stopPropagation(); + } + })); + this._register(addDisposableListener(this.actionsList, EventType.MOUSE_OVER, e => { + let target = e.target; + if (!target || !isAncestor(target, this.actionsList) || target === this.actionsList) { + return; + } + while (target.parentElement !== this.actionsList && target.parentElement !== null) { + target = target.parentElement; + } + if (target.classList.contains('action-item')) { + const lastFocusedItem = this.focusedItem; + this.setFocusedItem(target); + if (lastFocusedItem !== this.focusedItem) { + this.updateFocus(); + } + } + })); + // Support touch on actions list to focus items (needed for submenus) + this._register(Gesture.addTarget(this.actionsList)); + this._register(addDisposableListener(this.actionsList, TouchEventType.Tap, e => { + let target = e.initialTarget; + if (!target || !isAncestor(target, this.actionsList) || target === this.actionsList) { + return; + } + while (target.parentElement !== this.actionsList && target.parentElement !== null) { + target = target.parentElement; + } + if (target.classList.contains('action-item')) { + const lastFocusedItem = this.focusedItem; + this.setFocusedItem(target); + if (lastFocusedItem !== this.focusedItem) { + this.updateFocus(); + } + } + })); + const parentData = { + parent: this + }; + this.mnemonics = new Map(); + // Scroll Logic + this.scrollableElement = this._register(new DomScrollableElement(menuElement, { + alwaysConsumeMouseWheel: true, + horizontal: 2 /* ScrollbarVisibility.Hidden */, + vertical: 3 /* ScrollbarVisibility.Visible */, + verticalScrollbarSize: 7, + handleMouseWheel: true, + useShadows: true + })); + const scrollElement = this.scrollableElement.getDomNode(); + scrollElement.style.position = ''; + this.styleScrollElement(scrollElement, menuStyles); + // Support scroll on menu drag + this._register(addDisposableListener(menuElement, TouchEventType.Change, e => { + EventHelper.stop(e, true); + const scrollTop = this.scrollableElement.getScrollPosition().scrollTop; + this.scrollableElement.setScrollPosition({ scrollTop: scrollTop - e.translationY }); + })); + this._register(addDisposableListener(scrollElement, EventType.MOUSE_UP, e => { + // Absorb clicks in menu dead space https://github.com/microsoft/vscode/issues/63575 + // We do this on the scroll element so the scroll bar doesn't dismiss the menu either + e.preventDefault(); + })); + const window = getWindow(container); + menuElement.style.maxHeight = `${Math.max(10, window.innerHeight - container.getBoundingClientRect().top - 35)}px`; + actions = actions.filter((a, idx) => { + if (options.submenuIds?.has(a.id)) { + console.warn(`Found submenu cycle: ${a.id}`); + return false; + } + // Filter out consecutive or useless separators + if (a instanceof Separator) { + if (idx === actions.length - 1 || idx === 0) { + return false; + } + const prevAction = actions[idx - 1]; + if (prevAction instanceof Separator) { + return false; + } + } + return true; + }); + this.push(actions, { icon: true, label: true, isMenu: true }); + container.appendChild(this.scrollableElement.getDomNode()); + this.scrollableElement.scanDomNode(); + this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item, index, array) => { + item.updatePositionInSet(index + 1, array.length); + }); + } + initializeOrUpdateStyleSheet(container, style) { + if (!this.styleSheet) { + if (isInShadowDOM(container)) { + this.styleSheet = createStyleSheet(container); + } + else { + if (!Menu.globalStyleSheet) { + Menu.globalStyleSheet = createStyleSheet(); + } + this.styleSheet = Menu.globalStyleSheet; + } + } + this.styleSheet.textContent = getMenuWidgetCSS(style, isInShadowDOM(container)); + } + styleScrollElement(scrollElement, style) { + const fgColor = style.foregroundColor ?? ''; + const bgColor = style.backgroundColor ?? ''; + const border = style.borderColor ? `1px solid ${style.borderColor}` : ''; + const borderRadius = '5px'; + const shadow = style.shadowColor ? `0 2px 8px ${style.shadowColor}` : ''; + scrollElement.style.outline = border; + scrollElement.style.borderRadius = borderRadius; + scrollElement.style.color = fgColor; + scrollElement.style.backgroundColor = bgColor; + scrollElement.style.boxShadow = shadow; + } + getContainer() { + return this.scrollableElement.getDomNode(); + } + get onScroll() { + return this.scrollableElement.onScroll; + } + focusItemByElement(element) { + const lastFocusedItem = this.focusedItem; + this.setFocusedItem(element); + if (lastFocusedItem !== this.focusedItem) { + this.updateFocus(); + } + } + setFocusedItem(element) { + for (let i = 0; i < this.actionsList.children.length; i++) { + const elem = this.actionsList.children[i]; + if (element === elem) { + this.focusedItem = i; + break; + } + } + } + updateFocus(fromRight) { + super.updateFocus(fromRight, true, true); + if (typeof this.focusedItem !== 'undefined') { + // Workaround for #80047 caused by an issue in chromium + // https://bugs.chromium.org/p/chromium/issues/detail?id=414283 + // When that's fixed, just call this.scrollableElement.scanDomNode() + this.scrollableElement.setScrollPosition({ + scrollTop: Math.round(this.menuElement.scrollTop) + }); + } + } + doGetActionViewItem(action, options, parentData) { + if (action instanceof Separator) { + return new MenuSeparatorActionViewItem(options.context, action, { icon: true }, this.menuStyles); + } + else if (action instanceof SubmenuAction) { + const menuActionViewItem = new SubmenuMenuActionViewItem(action, action.actions, parentData, { ...options, submenuIds: new Set([...(options.submenuIds || []), action.id]) }, this.menuStyles); + if (options.enableMnemonics) { + const mnemonic = menuActionViewItem.getMnemonic(); + if (mnemonic && menuActionViewItem.isEnabled()) { + let actionViewItems = []; + if (this.mnemonics.has(mnemonic)) { + actionViewItems = this.mnemonics.get(mnemonic); + } + actionViewItems.push(menuActionViewItem); + this.mnemonics.set(mnemonic, actionViewItems); + } + } + return menuActionViewItem; + } + else { + const menuItemOptions = { enableMnemonics: options.enableMnemonics, useEventAsContext: options.useEventAsContext }; + if (options.getKeyBinding) { + const keybinding = options.getKeyBinding(action); + if (keybinding) { + const keybindingLabel = keybinding.getLabel(); + if (keybindingLabel) { + menuItemOptions.keybinding = keybindingLabel; + } + } + } + const menuActionViewItem = new BaseMenuActionViewItem(options.context, action, menuItemOptions, this.menuStyles); + if (options.enableMnemonics) { + const mnemonic = menuActionViewItem.getMnemonic(); + if (mnemonic && menuActionViewItem.isEnabled()) { + let actionViewItems = []; + if (this.mnemonics.has(mnemonic)) { + actionViewItems = this.mnemonics.get(mnemonic); + } + actionViewItems.push(menuActionViewItem); + this.mnemonics.set(mnemonic, actionViewItems); + } + } + return menuActionViewItem; + } + } +} +class BaseMenuActionViewItem extends BaseActionViewItem { + constructor(ctx, action, options, menuStyle) { + options.isMenu = true; + super(action, action, options); + this.menuStyle = menuStyle; + this.options = options; + this.options.icon = options.icon !== undefined ? options.icon : false; + this.options.label = options.label !== undefined ? options.label : true; + this.cssClass = ''; + // Set mnemonic + if (this.options.label && options.enableMnemonics) { + const label = this.action.label; + if (label) { + const matches = MENU_MNEMONIC_REGEX.exec(label); + if (matches) { + this.mnemonic = (!!matches[1] ? matches[1] : matches[3]).toLocaleLowerCase(); + } + } + } + // Add mouse up listener later to avoid accidental clicks + this.runOnceToEnableMouseUp = new RunOnceScheduler(() => { + if (!this.element) { + return; + } + this._register(addDisposableListener(this.element, EventType.MOUSE_UP, e => { + // removed default prevention as it conflicts + // with BaseActionViewItem #101537 + // add back if issues arise and link new issue + EventHelper.stop(e, true); + // See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Interact_with_the_clipboard + // > Writing to the clipboard + // > You can use the "cut" and "copy" commands without any special + // permission if you are using them in a short-lived event handler + // for a user action (for example, a click handler). + // => to get the Copy and Paste context menu actions working on Firefox, + // there should be no timeout here + if (isFirefox) { + const mouseEvent = new StandardMouseEvent(getWindow(this.element), e); + // Allowing right click to trigger the event causes the issue described below, + // but since the solution below does not work in FF, we must disable right click + if (mouseEvent.rightButton) { + return; + } + this.onClick(e); + } + // In all other cases, set timeout to allow context menu cancellation to trigger + // otherwise the action will destroy the menu and a second context menu + // will still trigger for right click. + else { + setTimeout(() => { + this.onClick(e); + }, 0); + } + })); + this._register(addDisposableListener(this.element, EventType.CONTEXT_MENU, e => { + EventHelper.stop(e, true); + })); + }, 100); + this._register(this.runOnceToEnableMouseUp); + } + render(container) { + super.render(container); + if (!this.element) { + return; + } + this.container = container; + this.item = append(this.element, $('a.action-menu-item')); + if (this._action.id === Separator.ID) { + // A separator is a presentation item + this.item.setAttribute('role', 'presentation'); + } + else { + this.item.setAttribute('role', 'menuitem'); + if (this.mnemonic) { + this.item.setAttribute('aria-keyshortcuts', `${this.mnemonic}`); + } + } + this.check = append(this.item, $('span.menu-item-check' + ThemeIcon.asCSSSelector(Codicon.menuSelection))); + this.check.setAttribute('role', 'none'); + this.label = append(this.item, $('span.action-label')); + if (this.options.label && this.options.keybinding) { + append(this.item, $('span.keybinding')).textContent = this.options.keybinding; + } + // Adds mouse up listener to actually run the action + this.runOnceToEnableMouseUp.schedule(); + this.updateClass(); + this.updateLabel(); + this.updateTooltip(); + this.updateEnabled(); + this.updateChecked(); + this.applyStyle(); + } + blur() { + super.blur(); + this.applyStyle(); + } + focus() { + super.focus(); + this.item?.focus(); + this.applyStyle(); + } + updatePositionInSet(pos, setSize) { + if (this.item) { + this.item.setAttribute('aria-posinset', `${pos}`); + this.item.setAttribute('aria-setsize', `${setSize}`); + } + } + updateLabel() { + if (!this.label) { + return; + } + if (this.options.label) { + clearNode(this.label); + let label = stripIcons(this.action.label); + if (label) { + const cleanLabel = cleanMnemonic(label); + if (!this.options.enableMnemonics) { + label = cleanLabel; + } + this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&')); + const matches = MENU_MNEMONIC_REGEX.exec(label); + if (matches) { + label = strings.escape(label); + // This is global, reset it + MENU_ESCAPED_MNEMONIC_REGEX.lastIndex = 0; + let escMatch = MENU_ESCAPED_MNEMONIC_REGEX.exec(label); + // We can't use negative lookbehind so if we match our negative and skip + while (escMatch && escMatch[1]) { + escMatch = MENU_ESCAPED_MNEMONIC_REGEX.exec(label); + } + const replaceDoubleEscapes = (str) => str.replace(/&&/g, '&'); + if (escMatch) { + this.label.append(strings.ltrim(replaceDoubleEscapes(label.substr(0, escMatch.index)), ' '), $('u', { 'aria-hidden': 'true' }, escMatch[3]), strings.rtrim(replaceDoubleEscapes(label.substr(escMatch.index + escMatch[0].length)), ' ')); + } + else { + this.label.innerText = replaceDoubleEscapes(label).trim(); + } + this.item?.setAttribute('aria-keyshortcuts', (!!matches[1] ? matches[1] : matches[3]).toLocaleLowerCase()); + } + else { + this.label.innerText = label.replace(/&&/g, '&').trim(); + } + } + } + } + updateTooltip() { + // menus should function like native menus and they do not have tooltips + } + updateClass() { + if (this.cssClass && this.item) { + this.item.classList.remove(...this.cssClass.split(' ')); + } + if (this.options.icon && this.label) { + this.cssClass = this.action.class || ''; + this.label.classList.add('icon'); + if (this.cssClass) { + this.label.classList.add(...this.cssClass.split(' ')); + } + this.updateEnabled(); + } + else if (this.label) { + this.label.classList.remove('icon'); + } + } + updateEnabled() { + if (this.action.enabled) { + if (this.element) { + this.element.classList.remove('disabled'); + this.element.removeAttribute('aria-disabled'); + } + if (this.item) { + this.item.classList.remove('disabled'); + this.item.removeAttribute('aria-disabled'); + this.item.tabIndex = 0; + } + } + else { + if (this.element) { + this.element.classList.add('disabled'); + this.element.setAttribute('aria-disabled', 'true'); + } + if (this.item) { + this.item.classList.add('disabled'); + this.item.setAttribute('aria-disabled', 'true'); + } + } + } + updateChecked() { + if (!this.item) { + return; + } + const checked = this.action.checked; + this.item.classList.toggle('checked', !!checked); + if (checked !== undefined) { + this.item.setAttribute('role', 'menuitemcheckbox'); + this.item.setAttribute('aria-checked', checked ? 'true' : 'false'); + } + else { + this.item.setAttribute('role', 'menuitem'); + this.item.setAttribute('aria-checked', ''); + } + } + getMnemonic() { + return this.mnemonic; + } + applyStyle() { + const isSelected = this.element && this.element.classList.contains('focused'); + const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor; + const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : undefined; + const outline = isSelected && this.menuStyle.selectionBorderColor ? `1px solid ${this.menuStyle.selectionBorderColor}` : ''; + const outlineOffset = isSelected && this.menuStyle.selectionBorderColor ? `-1px` : ''; + if (this.item) { + this.item.style.color = fgColor ?? ''; + this.item.style.backgroundColor = bgColor ?? ''; + this.item.style.outline = outline; + this.item.style.outlineOffset = outlineOffset; + } + if (this.check) { + this.check.style.color = fgColor ?? ''; + } + } +} +class SubmenuMenuActionViewItem extends BaseMenuActionViewItem { + constructor(action, submenuActions, parentData, submenuOptions, menuStyles) { + super(action, action, submenuOptions, menuStyles); + this.submenuActions = submenuActions; + this.parentData = parentData; + this.submenuOptions = submenuOptions; + this.mysubmenu = null; + this.submenuDisposables = this._register(new DisposableStore()); + this.mouseOver = false; + this.expandDirection = submenuOptions && submenuOptions.expandDirection !== undefined ? submenuOptions.expandDirection : { horizontal: HorizontalDirection.Right, vertical: VerticalDirection.Below }; + this.showScheduler = new RunOnceScheduler(() => { + if (this.mouseOver) { + this.cleanupExistingSubmenu(false); + this.createSubmenu(false); + } + }, 250); + this.hideScheduler = new RunOnceScheduler(() => { + if (this.element && (!isAncestor(getActiveElement(), this.element) && this.parentData.submenu === this.mysubmenu)) { + this.parentData.parent.focus(false); + this.cleanupExistingSubmenu(true); + } + }, 750); + } + render(container) { + super.render(container); + if (!this.element) { + return; + } + if (this.item) { + this.item.classList.add('monaco-submenu-item'); + this.item.tabIndex = 0; + this.item.setAttribute('aria-haspopup', 'true'); + this.updateAriaExpanded('false'); + this.submenuIndicator = append(this.item, $('span.submenu-indicator' + ThemeIcon.asCSSSelector(Codicon.menuSubmenu))); + this.submenuIndicator.setAttribute('aria-hidden', 'true'); + } + this._register(addDisposableListener(this.element, EventType.KEY_UP, e => { + const event = new StandardKeyboardEvent(e); + if (event.equals(17 /* KeyCode.RightArrow */) || event.equals(3 /* KeyCode.Enter */)) { + EventHelper.stop(e, true); + this.createSubmenu(true); + } + })); + this._register(addDisposableListener(this.element, EventType.KEY_DOWN, e => { + const event = new StandardKeyboardEvent(e); + if (getActiveElement() === this.item) { + if (event.equals(17 /* KeyCode.RightArrow */) || event.equals(3 /* KeyCode.Enter */)) { + EventHelper.stop(e, true); + } + } + })); + this._register(addDisposableListener(this.element, EventType.MOUSE_OVER, e => { + if (!this.mouseOver) { + this.mouseOver = true; + this.showScheduler.schedule(); + } + })); + this._register(addDisposableListener(this.element, EventType.MOUSE_LEAVE, e => { + this.mouseOver = false; + })); + this._register(addDisposableListener(this.element, EventType.FOCUS_OUT, e => { + if (this.element && !isAncestor(getActiveElement(), this.element)) { + this.hideScheduler.schedule(); + } + })); + this._register(this.parentData.parent.onScroll(() => { + if (this.parentData.submenu === this.mysubmenu) { + this.parentData.parent.focus(false); + this.cleanupExistingSubmenu(true); + } + })); + } + updateEnabled() { + // override on submenu entry + // native menus do not observe enablement on sumbenus + // we mimic that behavior + } + onClick(e) { + // stop clicking from trying to run an action + EventHelper.stop(e, true); + this.cleanupExistingSubmenu(false); + this.createSubmenu(true); + } + cleanupExistingSubmenu(force) { + if (this.parentData.submenu && (force || (this.parentData.submenu !== this.mysubmenu))) { + // disposal may throw if the submenu has already been removed + try { + this.parentData.submenu.dispose(); + } + catch { } + this.parentData.submenu = undefined; + this.updateAriaExpanded('false'); + if (this.submenuContainer) { + this.submenuDisposables.clear(); + this.submenuContainer = undefined; + } + } + } + calculateSubmenuMenuLayout(windowDimensions, submenu, entry, expandDirection) { + const ret = { top: 0, left: 0 }; + // Start with horizontal + ret.left = layout(windowDimensions.width, submenu.width, { position: expandDirection.horizontal === HorizontalDirection.Right ? 0 /* LayoutAnchorPosition.Before */ : 1 /* LayoutAnchorPosition.After */, offset: entry.left, size: entry.width }); + // We don't have enough room to layout the menu fully, so we are overlapping the menu + if (ret.left >= entry.left && ret.left < entry.left + entry.width) { + if (entry.left + 10 + submenu.width <= windowDimensions.width) { + ret.left = entry.left + 10; + } + entry.top += 10; + entry.height = 0; + } + // Now that we have a horizontal position, try layout vertically + ret.top = layout(windowDimensions.height, submenu.height, { position: 0 /* LayoutAnchorPosition.Before */, offset: entry.top, size: 0 }); + // We didn't have enough room below, but we did above, so we shift down to align the menu + if (ret.top + submenu.height === entry.top && ret.top + entry.height + submenu.height <= windowDimensions.height) { + ret.top += entry.height; + } + return ret; + } + createSubmenu(selectFirstItem = true) { + if (!this.element) { + return; + } + if (!this.parentData.submenu) { + this.updateAriaExpanded('true'); + this.submenuContainer = append(this.element, $('div.monaco-submenu')); + this.submenuContainer.classList.add('menubar-menu-items-holder', 'context-view'); + // Set the top value of the menu container before construction + // This allows the menu constructor to calculate the proper max height + const computedStyles = getWindow(this.parentData.parent.domNode).getComputedStyle(this.parentData.parent.domNode); + const paddingTop = parseFloat(computedStyles.paddingTop || '0') || 0; + // this.submenuContainer.style.top = `${this.element.offsetTop - this.parentData.parent.scrollOffset - paddingTop}px`; + this.submenuContainer.style.zIndex = '1'; + this.submenuContainer.style.position = 'fixed'; + this.submenuContainer.style.top = '0'; + this.submenuContainer.style.left = '0'; + this.parentData.submenu = new Menu(this.submenuContainer, this.submenuActions.length ? this.submenuActions : [new EmptySubmenuAction()], this.submenuOptions, this.menuStyle); + // layout submenu + const entryBox = this.element.getBoundingClientRect(); + const entryBoxUpdated = { + top: entryBox.top - paddingTop, + left: entryBox.left, + height: entryBox.height + 2 * paddingTop, + width: entryBox.width + }; + const viewBox = this.submenuContainer.getBoundingClientRect(); + const window = getWindow(this.element); + const { top, left } = this.calculateSubmenuMenuLayout(new Dimension(window.innerWidth, window.innerHeight), Dimension.lift(viewBox), entryBoxUpdated, this.expandDirection); + // subtract offsets caused by transform parent + this.submenuContainer.style.left = `${left - viewBox.left}px`; + this.submenuContainer.style.top = `${top - viewBox.top}px`; + this.submenuDisposables.add(addDisposableListener(this.submenuContainer, EventType.KEY_UP, e => { + const event = new StandardKeyboardEvent(e); + if (event.equals(15 /* KeyCode.LeftArrow */)) { + EventHelper.stop(e, true); + this.parentData.parent.focus(); + this.cleanupExistingSubmenu(true); + } + })); + this.submenuDisposables.add(addDisposableListener(this.submenuContainer, EventType.KEY_DOWN, e => { + const event = new StandardKeyboardEvent(e); + if (event.equals(15 /* KeyCode.LeftArrow */)) { + EventHelper.stop(e, true); + } + })); + this.submenuDisposables.add(this.parentData.submenu.onDidCancel(() => { + this.parentData.parent.focus(); + this.cleanupExistingSubmenu(true); + })); + this.parentData.submenu.focus(selectFirstItem); + this.mysubmenu = this.parentData.submenu; + } + else { + this.parentData.submenu.focus(false); + } + } + updateAriaExpanded(value) { + if (this.item) { + this.item?.setAttribute('aria-expanded', value); + } + } + applyStyle() { + super.applyStyle(); + const isSelected = this.element && this.element.classList.contains('focused'); + const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor; + if (this.submenuIndicator) { + this.submenuIndicator.style.color = fgColor ?? ''; + } + } + dispose() { + super.dispose(); + this.hideScheduler.dispose(); + if (this.mysubmenu) { + this.mysubmenu.dispose(); + this.mysubmenu = null; + } + if (this.submenuContainer) { + this.submenuContainer = undefined; + } + } +} +class MenuSeparatorActionViewItem extends ActionViewItem { + constructor(context, action, options, menuStyles) { + super(context, action, options); + this.menuStyles = menuStyles; + } + render(container) { + super.render(container); + if (this.label) { + this.label.style.borderBottomColor = this.menuStyles.separatorColor ? `${this.menuStyles.separatorColor}` : ''; + } + } +} +export function cleanMnemonic(label) { + const regex = MENU_MNEMONIC_REGEX; + const matches = regex.exec(label); + if (!matches) { + return label; + } + const mnemonicInText = !matches[1]; + return label.replace(regex, mnemonicInText ? '$2$3' : '').trim(); +} +export function formatRule(c) { + const fontCharacter = getCodiconFontCharacters()[c.id]; + return `.codicon-${c.id}:before { content: '\\${fontCharacter.toString(16)}'; }`; +} +function getMenuWidgetCSS(style, isForShadowDom) { + let result = /* css */ ` +.monaco-menu { + font-size: 13px; + border-radius: 5px; + min-width: 160px; +} + +${formatRule(Codicon.menuSelection)} +${formatRule(Codicon.menuSubmenu)} + +.monaco-menu .monaco-action-bar { + text-align: right; + overflow: hidden; + white-space: nowrap; +} + +.monaco-menu .monaco-action-bar .actions-container { + display: flex; + margin: 0 auto; + padding: 0; + width: 100%; + justify-content: flex-end; +} + +.monaco-menu .monaco-action-bar.vertical .actions-container { + display: inline-block; +} + +.monaco-menu .monaco-action-bar.reverse .actions-container { + flex-direction: row-reverse; +} + +.monaco-menu .monaco-action-bar .action-item { + cursor: pointer; + display: inline-block; + transition: transform 50ms ease; + position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */ +} + +.monaco-menu .monaco-action-bar .action-item.disabled { + cursor: default; +} + +.monaco-menu .monaco-action-bar .action-item .icon, +.monaco-menu .monaco-action-bar .action-item .codicon { + display: inline-block; +} + +.monaco-menu .monaco-action-bar .action-item .codicon { + display: flex; + align-items: center; +} + +.monaco-menu .monaco-action-bar .action-label { + font-size: 11px; + margin-right: 4px; +} + +.monaco-menu .monaco-action-bar .action-item.disabled .action-label, +.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover { + color: var(--vscode-disabledForeground); +} + +/* Vertical actions */ + +.monaco-menu .monaco-action-bar.vertical { + text-align: left; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + display: block; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator { + display: block; + border-bottom: 1px solid var(--vscode-menu-separatorBackground); + padding-top: 1px; + padding: 30px; +} + +.monaco-menu .secondary-actions .monaco-action-bar .action-label { + margin-left: 6px; +} + +/* Action Items */ +.monaco-menu .monaco-action-bar .action-item.select-container { + overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */ + flex: 1; + max-width: 170px; + min-width: 60px; + display: flex; + align-items: center; + justify-content: center; + margin-right: 10px; +} + +.monaco-menu .monaco-action-bar.vertical { + margin-left: 0; + overflow: visible; +} + +.monaco-menu .monaco-action-bar.vertical .actions-container { + display: block; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + padding: 0; + transform: none; + display: flex; +} + +.monaco-menu .monaco-action-bar.vertical .action-item.active { + transform: none; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item { + flex: 1 1 auto; + display: flex; + height: 2em; + align-items: center; + position: relative; + margin: 0 4px; + border-radius: 4px; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding, +.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding { + opacity: unset; +} + +.monaco-menu .monaco-action-bar.vertical .action-label { + flex: 1 1 auto; + text-decoration: none; + padding: 0 1em; + background: none; + font-size: 12px; + line-height: 1; +} + +.monaco-menu .monaco-action-bar.vertical .keybinding, +.monaco-menu .monaco-action-bar.vertical .submenu-indicator { + display: inline-block; + flex: 2 1 auto; + padding: 0 1em; + text-align: right; + font-size: 12px; + line-height: 1; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator { + height: 100%; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon { + font-size: 16px !important; + display: flex; + align-items: center; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before { + margin-left: auto; + margin-right: -20px; +} + +.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding, +.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator { + opacity: 0.4; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) { + display: inline-block; + box-sizing: border-box; + margin: 0; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + position: static; + overflow: visible; +} + +.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu { + position: absolute; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator { + width: 100%; + height: 0px !important; + opacity: 1; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator.text { + padding: 0.7em 1em 0.1em 1em; + font-weight: bold; + opacity: 1; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:hover { + color: inherit; +} + +.monaco-menu .monaco-action-bar.vertical .menu-item-check { + position: absolute; + visibility: hidden; + width: 1em; + height: 100%; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check { + visibility: visible; + display: flex; + align-items: center; + justify-content: center; +} + +/* Context Menu */ + +.context-view.monaco-menu-container { + outline: 0; + border: none; + animation: fadeIn 0.083s linear; + -webkit-app-region: no-drag; +} + +.context-view.monaco-menu-container :focus, +.context-view.monaco-menu-container .monaco-action-bar.vertical:focus, +.context-view.monaco-menu-container .monaco-action-bar.vertical :focus { + outline: 0; +} + +.hc-black .context-view.monaco-menu-container, +.hc-light .context-view.monaco-menu-container, +:host-context(.hc-black) .context-view.monaco-menu-container, +:host-context(.hc-light) .context-view.monaco-menu-container { + box-shadow: none; +} + +.hc-black .monaco-menu .monaco-action-bar.vertical .action-item.focused, +.hc-light .monaco-menu .monaco-action-bar.vertical .action-item.focused, +:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused, +:host-context(.hc-light) .monaco-menu .monaco-action-bar.vertical .action-item.focused { + background: none; +} + +/* Vertical Action Bar Styles */ + +.monaco-menu .monaco-action-bar.vertical { + padding: 4px 0; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item { + height: 2em; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator), +.monaco-menu .monaco-action-bar.vertical .keybinding { + font-size: inherit; + padding: 0 2em; + max-height: 100%; +} + +.monaco-menu .monaco-action-bar.vertical .menu-item-check { + font-size: inherit; + width: 2em; +} + +.monaco-menu .monaco-action-bar.vertical .action-label.separator { + font-size: inherit; + margin: 5px 0 !important; + padding: 0; + border-radius: 0; +} + +.linux .monaco-menu .monaco-action-bar.vertical .action-label.separator, +:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator { + margin-left: 0; + margin-right: 0; +} + +.monaco-menu .monaco-action-bar.vertical .submenu-indicator { + font-size: 60%; + padding: 0 1.8em; +} + +.linux .monaco-menu .monaco-action-bar.vertical .submenu-indicator, +:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator { + height: 100%; + mask-size: 10px 10px; + -webkit-mask-size: 10px 10px; +} + +.monaco-menu .action-item { + cursor: default; +}`; + if (isForShadowDom) { + // Only define scrollbar styles when used inside shadow dom, + // otherwise leave their styling to the global workbench styling. + result += ` + /* Arrows */ + .monaco-scrollable-element > .scrollbar > .scra { + cursor: pointer; + font-size: 11px !important; + } + + .monaco-scrollable-element > .visible { + opacity: 1; + + /* Background rule added for IE9 - to allow clicks on dom node */ + background:rgba(0,0,0,0); + + transition: opacity 100ms linear; + } + .monaco-scrollable-element > .invisible { + opacity: 0; + pointer-events: none; + } + .monaco-scrollable-element > .invisible.fade { + transition: opacity 800ms linear; + } + + /* Scrollable Content Inset Shadow */ + .monaco-scrollable-element > .shadow { + position: absolute; + display: none; + } + .monaco-scrollable-element > .shadow.top { + display: block; + top: 0; + left: 3px; + height: 3px; + width: 100%; + } + .monaco-scrollable-element > .shadow.left { + display: block; + top: 3px; + left: 0; + height: 100%; + width: 3px; + } + .monaco-scrollable-element > .shadow.top-left-corner { + display: block; + top: 0; + left: 0; + height: 3px; + width: 3px; + } + `; + // Scrollbars + const scrollbarShadowColor = style.scrollbarShadow; + if (scrollbarShadowColor) { + result += ` + .monaco-scrollable-element > .shadow.top { + box-shadow: ${scrollbarShadowColor} 0 6px 6px -6px inset; + } + + .monaco-scrollable-element > .shadow.left { + box-shadow: ${scrollbarShadowColor} 6px 0 6px -6px inset; + } + + .monaco-scrollable-element > .shadow.top.left { + box-shadow: ${scrollbarShadowColor} 6px 6px 6px -6px inset; + } + `; + } + const scrollbarSliderBackgroundColor = style.scrollbarSliderBackground; + if (scrollbarSliderBackgroundColor) { + result += ` + .monaco-scrollable-element > .scrollbar > .slider { + background: ${scrollbarSliderBackgroundColor}; + } + `; + } + const scrollbarSliderHoverBackgroundColor = style.scrollbarSliderHoverBackground; + if (scrollbarSliderHoverBackgroundColor) { + result += ` + .monaco-scrollable-element > .scrollbar > .slider:hover { + background: ${scrollbarSliderHoverBackgroundColor}; + } + `; + } + const scrollbarSliderActiveBackgroundColor = style.scrollbarSliderActiveBackground; + if (scrollbarSliderActiveBackgroundColor) { + result += ` + .monaco-scrollable-element > .scrollbar > .slider.active { + background: ${scrollbarSliderActiveBackgroundColor}; + } + `; + } + } + return result; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.css new file mode 100644 index 0000000000000000000000000000000000000000..1d7ede841756208575245f3fd6aed4138a9bd293 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.css @@ -0,0 +1,8 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-mouse-cursor-text { + cursor: text; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js new file mode 100644 index 0000000000000000000000000000000000000000..6ea890a1a5691890da1a5cf08d6d1fb10714020b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js @@ -0,0 +1,6 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import './mouseCursor.css'; +export const MOUSE_CURSOR_TEXT_CSS_CLASS_NAME = `monaco-mouse-cursor-text`; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.css new file mode 100644 index 0000000000000000000000000000000000000000..dc23cd255ecfcf1a6243f8b636d52ce83769f212 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.css @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-progress-container { + width: 100%; + height: 2px; + overflow: hidden; /* keep progress bit in bounds */ +} + +.monaco-progress-container .progress-bit { + width: 2%; + height: 2px; + position: absolute; + left: 0; + display: none; +} + +.monaco-progress-container.active .progress-bit { + display: inherit; +} + +.monaco-progress-container.discrete .progress-bit { + left: 0; + transition: width 100ms linear; +} + +.monaco-progress-container.discrete.done .progress-bit { + width: 100%; +} + +.monaco-progress-container.infinite .progress-bit { + animation-name: progress; + animation-duration: 4s; + animation-iteration-count: infinite; + transform: translate3d(0px, 0px, 0px); + animation-timing-function: linear; +} + +.monaco-progress-container.infinite.infinite-long-running .progress-bit { + /* + The more smooth `linear` timing function can cause + higher GPU consumption as indicated in + https://github.com/microsoft/vscode/issues/97900 & + https://github.com/microsoft/vscode/issues/138396 + */ + animation-timing-function: steps(100); +} + +/** + * The progress bit has a width: 2% (1/50) of the parent container. The animation moves it from 0% to 100% of + * that container. Since translateX is relative to the progress bit size, we have to multiple it with + * its relative size to the parent container: + * parent width: 5000% + * bit width: 100% + * translateX should be as follow: + * 50%: 5000% * 50% - 50% (set to center) = 2450% + * 100%: 5000% * 100% - 100% (do not overflow) = 4900% + */ +@keyframes progress { from { transform: translateX(0%) scaleX(1) } 50% { transform: translateX(2500%) scaleX(3) } to { transform: translateX(4900%) scaleX(1) } } diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js new file mode 100644 index 0000000000000000000000000000000000000000..b2f82c23b4d4602a328a5d2fcf03bfa64e19b54b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js @@ -0,0 +1,102 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { show } from '../../dom.js'; +import { RunOnceScheduler } from '../../../common/async.js'; +import { Disposable, MutableDisposable } from '../../../common/lifecycle.js'; +import './progressbar.css'; +const CSS_DONE = 'done'; +const CSS_ACTIVE = 'active'; +const CSS_INFINITE = 'infinite'; +const CSS_INFINITE_LONG_RUNNING = 'infinite-long-running'; +const CSS_DISCRETE = 'discrete'; +/** + * A progress bar with support for infinite or discrete progress. + */ +export class ProgressBar extends Disposable { + /** + * After a certain time of showing the progress bar, switch + * to long-running mode and throttle animations to reduce + * the pressure on the GPU process. + * + * https://github.com/microsoft/vscode/issues/97900 + * https://github.com/microsoft/vscode/issues/138396 + */ + static { this.LONG_RUNNING_INFINITE_THRESHOLD = 10000; } + constructor(container, options) { + super(); + this.progressSignal = this._register(new MutableDisposable()); + this.workedVal = 0; + this.showDelayedScheduler = this._register(new RunOnceScheduler(() => show(this.element), 0)); + this.longRunningScheduler = this._register(new RunOnceScheduler(() => this.infiniteLongRunning(), ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD)); + this.create(container, options); + } + create(container, options) { + this.element = document.createElement('div'); + this.element.classList.add('monaco-progress-container'); + this.element.setAttribute('role', 'progressbar'); + this.element.setAttribute('aria-valuemin', '0'); + container.appendChild(this.element); + this.bit = document.createElement('div'); + this.bit.classList.add('progress-bit'); + this.bit.style.backgroundColor = options?.progressBarBackground || '#0E70C0'; + this.element.appendChild(this.bit); + } + off() { + this.bit.style.width = 'inherit'; + this.bit.style.opacity = '1'; + this.element.classList.remove(CSS_ACTIVE, CSS_INFINITE, CSS_INFINITE_LONG_RUNNING, CSS_DISCRETE); + this.workedVal = 0; + this.totalWork = undefined; + this.longRunningScheduler.cancel(); + this.progressSignal.clear(); + } + /** + * Stops the progressbar from showing any progress instantly without fading out. + */ + stop() { + return this.doDone(false); + } + doDone(delayed) { + this.element.classList.add(CSS_DONE); + // discrete: let it grow to 100% width and hide afterwards + if (!this.element.classList.contains(CSS_INFINITE)) { + this.bit.style.width = 'inherit'; + if (delayed) { + setTimeout(() => this.off(), 200); + } + else { + this.off(); + } + } + // infinite: let it fade out and hide afterwards + else { + this.bit.style.opacity = '0'; + if (delayed) { + setTimeout(() => this.off(), 200); + } + else { + this.off(); + } + } + return this; + } + /** + * Use this mode to indicate progress that has no total number of work units. + */ + infinite() { + this.bit.style.width = '2%'; + this.bit.style.opacity = '1'; + this.element.classList.remove(CSS_DISCRETE, CSS_DONE, CSS_INFINITE_LONG_RUNNING); + this.element.classList.add(CSS_ACTIVE, CSS_INFINITE); + this.longRunningScheduler.schedule(); + return this; + } + infiniteLongRunning() { + this.element.classList.add(CSS_INFINITE_LONG_RUNNING); + } + getContainer() { + return this.element; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/radio/radio.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/radio/radio.css new file mode 100644 index 0000000000000000000000000000000000000000..259c157011f36099264148490adb27dcbd591e46 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/radio/radio.css @@ -0,0 +1,69 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-custom-radio { + display: flex; +} + +.monaco-custom-radio > .monaco-button { + border-radius: 0; + font-size: 0.9em; + line-height: 1em; + padding-left: 0.5em; + padding-right: 0.5em; +} + +.monaco-custom-radio > .monaco-button:first-child { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} + +.monaco-custom-radio > .monaco-button:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} + +.monaco-custom-radio > .monaco-button:not(.active):not(:last-child) { + border-right: none; +} + +.monaco-custom-radio > .monaco-button.previous-active { + border-left: none; +} + +/* default color styles - based on CSS variables */ + +.monaco-custom-radio > .monaco-button { + color: var(--vscode-radio-inactiveForeground); + background-color: var(--vscode-radio-inactiveBackground); + border-color: var(--vscode-radio-inactiveBorder, transparent); +} + +.monaco-custom-radio > .monaco-button.active:hover, +.monaco-custom-radio > .monaco-button.active { + color: var(--vscode-radio-activeForeground); + background-color: var(--vscode-radio-activeBackground); + border-color: var(--vscode-radio-activeBorder, transparent); +} + +.hc-black .monaco-custom-radio > .monaco-button.active, +.hc-light .monaco-custom-radio > .monaco-button.active { + border-color: var(--vscode-radio-activeBorder, transparent); +} + +.hc-black .monaco-custom-radio > .monaco-button:not(.active), +.hc-light .monaco-custom-radio > .monaco-button:not(.active) { + border-color: var(--vscode-radio-inactiveBorder, transparent); +} + +.hc-black .monaco-custom-radio > .monaco-button:not(.active):hover, +.hc-light .monaco-custom-radio > .monaco-button:not(.active):hover { + outline: 1px dashed var(--vscode-toolbar-hoverOutline); + outline-offset: -1px +} + +.monaco-custom-radio > .monaco-button:hover:not(.active) { + background-color: var(--vscode-radio-inactiveHoverBackground); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/radio/radio.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/radio/radio.js new file mode 100644 index 0000000000000000000000000000000000000000..546ce196592ab473dcb1666d40d6b9902423a142 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/radio/radio.js @@ -0,0 +1 @@ +import './radio.css'; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/resizable/resizable.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/resizable/resizable.js new file mode 100644 index 0000000000000000000000000000000000000000..9d5d37923cdb20e5a0d24ab4b863a0044800419a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/resizable/resizable.js @@ -0,0 +1,147 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Dimension } from '../../dom.js'; +import { OrthogonalEdge, Sash } from '../sash/sash.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { DisposableStore } from '../../../common/lifecycle.js'; +export class ResizableHTMLElement { + constructor() { + this._onDidWillResize = new Emitter(); + this.onDidWillResize = this._onDidWillResize.event; + this._onDidResize = new Emitter(); + this.onDidResize = this._onDidResize.event; + this._sashListener = new DisposableStore(); + this._size = new Dimension(0, 0); + this._minSize = new Dimension(0, 0); + this._maxSize = new Dimension(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER); + this.domNode = document.createElement('div'); + this._eastSash = new Sash(this.domNode, { getVerticalSashLeft: () => this._size.width }, { orientation: 0 /* Orientation.VERTICAL */ }); + this._westSash = new Sash(this.domNode, { getVerticalSashLeft: () => 0 }, { orientation: 0 /* Orientation.VERTICAL */ }); + this._northSash = new Sash(this.domNode, { getHorizontalSashTop: () => 0 }, { orientation: 1 /* Orientation.HORIZONTAL */, orthogonalEdge: OrthogonalEdge.North }); + this._southSash = new Sash(this.domNode, { getHorizontalSashTop: () => this._size.height }, { orientation: 1 /* Orientation.HORIZONTAL */, orthogonalEdge: OrthogonalEdge.South }); + this._northSash.orthogonalStartSash = this._westSash; + this._northSash.orthogonalEndSash = this._eastSash; + this._southSash.orthogonalStartSash = this._westSash; + this._southSash.orthogonalEndSash = this._eastSash; + let currentSize; + let deltaY = 0; + let deltaX = 0; + this._sashListener.add(Event.any(this._northSash.onDidStart, this._eastSash.onDidStart, this._southSash.onDidStart, this._westSash.onDidStart)(() => { + if (currentSize === undefined) { + this._onDidWillResize.fire(); + currentSize = this._size; + deltaY = 0; + deltaX = 0; + } + })); + this._sashListener.add(Event.any(this._northSash.onDidEnd, this._eastSash.onDidEnd, this._southSash.onDidEnd, this._westSash.onDidEnd)(() => { + if (currentSize !== undefined) { + currentSize = undefined; + deltaY = 0; + deltaX = 0; + this._onDidResize.fire({ dimension: this._size, done: true }); + } + })); + this._sashListener.add(this._eastSash.onDidChange(e => { + if (currentSize) { + deltaX = e.currentX - e.startX; + this.layout(currentSize.height + deltaY, currentSize.width + deltaX); + this._onDidResize.fire({ dimension: this._size, done: false, east: true }); + } + })); + this._sashListener.add(this._westSash.onDidChange(e => { + if (currentSize) { + deltaX = -(e.currentX - e.startX); + this.layout(currentSize.height + deltaY, currentSize.width + deltaX); + this._onDidResize.fire({ dimension: this._size, done: false, west: true }); + } + })); + this._sashListener.add(this._northSash.onDidChange(e => { + if (currentSize) { + deltaY = -(e.currentY - e.startY); + this.layout(currentSize.height + deltaY, currentSize.width + deltaX); + this._onDidResize.fire({ dimension: this._size, done: false, north: true }); + } + })); + this._sashListener.add(this._southSash.onDidChange(e => { + if (currentSize) { + deltaY = e.currentY - e.startY; + this.layout(currentSize.height + deltaY, currentSize.width + deltaX); + this._onDidResize.fire({ dimension: this._size, done: false, south: true }); + } + })); + this._sashListener.add(Event.any(this._eastSash.onDidReset, this._westSash.onDidReset)(e => { + if (this._preferredSize) { + this.layout(this._size.height, this._preferredSize.width); + this._onDidResize.fire({ dimension: this._size, done: true }); + } + })); + this._sashListener.add(Event.any(this._northSash.onDidReset, this._southSash.onDidReset)(e => { + if (this._preferredSize) { + this.layout(this._preferredSize.height, this._size.width); + this._onDidResize.fire({ dimension: this._size, done: true }); + } + })); + } + dispose() { + this._northSash.dispose(); + this._southSash.dispose(); + this._eastSash.dispose(); + this._westSash.dispose(); + this._sashListener.dispose(); + this._onDidResize.dispose(); + this._onDidWillResize.dispose(); + this.domNode.remove(); + } + enableSashes(north, east, south, west) { + this._northSash.state = north ? 3 /* SashState.Enabled */ : 0 /* SashState.Disabled */; + this._eastSash.state = east ? 3 /* SashState.Enabled */ : 0 /* SashState.Disabled */; + this._southSash.state = south ? 3 /* SashState.Enabled */ : 0 /* SashState.Disabled */; + this._westSash.state = west ? 3 /* SashState.Enabled */ : 0 /* SashState.Disabled */; + } + layout(height = this.size.height, width = this.size.width) { + const { height: minHeight, width: minWidth } = this._minSize; + const { height: maxHeight, width: maxWidth } = this._maxSize; + height = Math.max(minHeight, Math.min(maxHeight, height)); + width = Math.max(minWidth, Math.min(maxWidth, width)); + const newSize = new Dimension(width, height); + if (!Dimension.equals(newSize, this._size)) { + this.domNode.style.height = height + 'px'; + this.domNode.style.width = width + 'px'; + this._size = newSize; + this._northSash.layout(); + this._eastSash.layout(); + this._southSash.layout(); + this._westSash.layout(); + } + } + clearSashHoverState() { + this._eastSash.clearSashHoverState(); + this._westSash.clearSashHoverState(); + this._northSash.clearSashHoverState(); + this._southSash.clearSashHoverState(); + } + get size() { + return this._size; + } + set maxSize(value) { + this._maxSize = value; + } + get maxSize() { + return this._maxSize; + } + set minSize(value) { + this._minSize = value; + } + get minSize() { + return this._minSize; + } + set preferredSize(value) { + this._preferredSize = value; + } + get preferredSize() { + return this._preferredSize; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.css new file mode 100644 index 0000000000000000000000000000000000000000..42b0f4257877fa7acc3ddc2c9ddef6fd8468542e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.css @@ -0,0 +1,149 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +:root { + --vscode-sash-size: 4px; + --vscode-sash-hover-size: 4px; +} + +.monaco-sash { + position: absolute; + z-index: 35; + touch-action: none; +} + +.monaco-sash.disabled { + pointer-events: none; +} + +.monaco-sash.mac.vertical { + cursor: col-resize; +} + +.monaco-sash.vertical.minimum { + cursor: e-resize; +} + +.monaco-sash.vertical.maximum { + cursor: w-resize; +} + +.monaco-sash.mac.horizontal { + cursor: row-resize; +} + +.monaco-sash.horizontal.minimum { + cursor: s-resize; +} + +.monaco-sash.horizontal.maximum { + cursor: n-resize; +} + +.monaco-sash.disabled { + cursor: default !important; + pointer-events: none !important; +} + +.monaco-sash.vertical { + cursor: ew-resize; + top: 0; + width: var(--vscode-sash-size); + height: 100%; +} + +.monaco-sash.horizontal { + cursor: ns-resize; + left: 0; + width: 100%; + height: var(--vscode-sash-size); +} + +.monaco-sash:not(.disabled) > .orthogonal-drag-handle { + content: " "; + height: calc(var(--vscode-sash-size) * 2); + width: calc(var(--vscode-sash-size) * 2); + z-index: 100; + display: block; + cursor: all-scroll; + position: absolute; +} + +.monaco-sash.horizontal.orthogonal-edge-north:not(.disabled) + > .orthogonal-drag-handle.start, +.monaco-sash.horizontal.orthogonal-edge-south:not(.disabled) + > .orthogonal-drag-handle.end { + cursor: nwse-resize; +} + +.monaco-sash.horizontal.orthogonal-edge-north:not(.disabled) + > .orthogonal-drag-handle.end, +.monaco-sash.horizontal.orthogonal-edge-south:not(.disabled) + > .orthogonal-drag-handle.start { + cursor: nesw-resize; +} + +.monaco-sash.vertical > .orthogonal-drag-handle.start { + left: calc(var(--vscode-sash-size) * -0.5); + top: calc(var(--vscode-sash-size) * -1); +} +.monaco-sash.vertical > .orthogonal-drag-handle.end { + left: calc(var(--vscode-sash-size) * -0.5); + bottom: calc(var(--vscode-sash-size) * -1); +} +.monaco-sash.horizontal > .orthogonal-drag-handle.start { + top: calc(var(--vscode-sash-size) * -0.5); + left: calc(var(--vscode-sash-size) * -1); +} +.monaco-sash.horizontal > .orthogonal-drag-handle.end { + top: calc(var(--vscode-sash-size) * -0.5); + right: calc(var(--vscode-sash-size) * -1); +} + +.monaco-sash:before { + content: ''; + pointer-events: none; + position: absolute; + width: 100%; + height: 100%; + background: transparent; +} + +.monaco-workbench:not(.reduce-motion) .monaco-sash:before { + transition: background-color 0.1s ease-out; +} + +.monaco-sash.hover:before, +.monaco-sash.active:before { + background: var(--vscode-sash-hoverBorder); +} + +.monaco-sash.vertical:before { + width: var(--vscode-sash-hover-size); + left: calc(50% - (var(--vscode-sash-hover-size) / 2)); +} + +.monaco-sash.horizontal:before { + height: var(--vscode-sash-hover-size); + top: calc(50% - (var(--vscode-sash-hover-size) / 2)); +} + +.pointer-events-disabled { + pointer-events: none !important; +} + +/** Debug **/ + +.monaco-sash.debug { + background: cyan; +} + +.monaco-sash.debug.disabled { + background: rgba(0, 255, 255, 0.2); +} + +.monaco-sash.debug:not(.disabled) > .orthogonal-drag-handle { + background: red; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js new file mode 100644 index 0000000000000000000000000000000000000000..2fbf83936ef53b0f8f26c300105bcd9b4e34b521 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js @@ -0,0 +1,448 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { $, append, createStyleSheet, EventHelper, getWindow, isHTMLElement } from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { EventType, Gesture } from '../../touch.js'; +import { Delayer } from '../../../common/async.js'; +import { memoize } from '../../../common/decorators.js'; +import { Emitter } from '../../../common/event.js'; +import { Disposable, DisposableStore, toDisposable } from '../../../common/lifecycle.js'; +import { isMacintosh } from '../../../common/platform.js'; +import './sash.css'; +/** + * Allow the sashes to be visible at runtime. + * @remark Use for development purposes only. + */ +const DEBUG = false; +export var OrthogonalEdge; +(function (OrthogonalEdge) { + OrthogonalEdge["North"] = "north"; + OrthogonalEdge["South"] = "south"; + OrthogonalEdge["East"] = "east"; + OrthogonalEdge["West"] = "west"; +})(OrthogonalEdge || (OrthogonalEdge = {})); +let globalSize = 4; +const onDidChangeGlobalSize = new Emitter(); +let globalHoverDelay = 300; +const onDidChangeHoverDelay = new Emitter(); +class MouseEventFactory { + constructor(el) { + this.el = el; + this.disposables = new DisposableStore(); + } + get onPointerMove() { + return this.disposables.add(new DomEmitter(getWindow(this.el), 'mousemove')).event; + } + get onPointerUp() { + return this.disposables.add(new DomEmitter(getWindow(this.el), 'mouseup')).event; + } + dispose() { + this.disposables.dispose(); + } +} +__decorate([ + memoize +], MouseEventFactory.prototype, "onPointerMove", null); +__decorate([ + memoize +], MouseEventFactory.prototype, "onPointerUp", null); +class GestureEventFactory { + get onPointerMove() { + return this.disposables.add(new DomEmitter(this.el, EventType.Change)).event; + } + get onPointerUp() { + return this.disposables.add(new DomEmitter(this.el, EventType.End)).event; + } + constructor(el) { + this.el = el; + this.disposables = new DisposableStore(); + } + dispose() { + this.disposables.dispose(); + } +} +__decorate([ + memoize +], GestureEventFactory.prototype, "onPointerMove", null); +__decorate([ + memoize +], GestureEventFactory.prototype, "onPointerUp", null); +class OrthogonalPointerEventFactory { + get onPointerMove() { + return this.factory.onPointerMove; + } + get onPointerUp() { + return this.factory.onPointerUp; + } + constructor(factory) { + this.factory = factory; + } + dispose() { + // noop + } +} +__decorate([ + memoize +], OrthogonalPointerEventFactory.prototype, "onPointerMove", null); +__decorate([ + memoize +], OrthogonalPointerEventFactory.prototype, "onPointerUp", null); +const PointerEventsDisabledCssClass = 'pointer-events-disabled'; +/** + * The {@link Sash} is the UI component which allows the user to resize other + * components. It's usually an invisible horizontal or vertical line which, when + * hovered, becomes highlighted and can be dragged along the perpendicular dimension + * to its direction. + * + * Features: + * - Touch event handling + * - Corner sash support + * - Hover with different mouse cursor support + * - Configurable hover size + * - Linked sash support, for 2x2 corner sashes + */ +export class Sash extends Disposable { + get state() { return this._state; } + get orthogonalStartSash() { return this._orthogonalStartSash; } + get orthogonalEndSash() { return this._orthogonalEndSash; } + /** + * The state of a sash defines whether it can be interacted with by the user + * as well as what mouse cursor to use, when hovered. + */ + set state(state) { + if (this._state === state) { + return; + } + this.el.classList.toggle('disabled', state === 0 /* SashState.Disabled */); + this.el.classList.toggle('minimum', state === 1 /* SashState.AtMinimum */); + this.el.classList.toggle('maximum', state === 2 /* SashState.AtMaximum */); + this._state = state; + this.onDidEnablementChange.fire(state); + } + /** + * A reference to another sash, perpendicular to this one, which + * aligns at the start of this one. A corner sash will be created + * automatically at that location. + * + * The start of a horizontal sash is its left-most position. + * The start of a vertical sash is its top-most position. + */ + set orthogonalStartSash(sash) { + if (this._orthogonalStartSash === sash) { + return; + } + this.orthogonalStartDragHandleDisposables.clear(); + this.orthogonalStartSashDisposables.clear(); + if (sash) { + const onChange = (state) => { + this.orthogonalStartDragHandleDisposables.clear(); + if (state !== 0 /* SashState.Disabled */) { + this._orthogonalStartDragHandle = append(this.el, $('.orthogonal-drag-handle.start')); + this.orthogonalStartDragHandleDisposables.add(toDisposable(() => this._orthogonalStartDragHandle.remove())); + this.orthogonalStartDragHandleDisposables.add(new DomEmitter(this._orthogonalStartDragHandle, 'mouseenter')).event(() => Sash.onMouseEnter(sash), undefined, this.orthogonalStartDragHandleDisposables); + this.orthogonalStartDragHandleDisposables.add(new DomEmitter(this._orthogonalStartDragHandle, 'mouseleave')).event(() => Sash.onMouseLeave(sash), undefined, this.orthogonalStartDragHandleDisposables); + } + }; + this.orthogonalStartSashDisposables.add(sash.onDidEnablementChange.event(onChange, this)); + onChange(sash.state); + } + this._orthogonalStartSash = sash; + } + /** + * A reference to another sash, perpendicular to this one, which + * aligns at the end of this one. A corner sash will be created + * automatically at that location. + * + * The end of a horizontal sash is its right-most position. + * The end of a vertical sash is its bottom-most position. + */ + set orthogonalEndSash(sash) { + if (this._orthogonalEndSash === sash) { + return; + } + this.orthogonalEndDragHandleDisposables.clear(); + this.orthogonalEndSashDisposables.clear(); + if (sash) { + const onChange = (state) => { + this.orthogonalEndDragHandleDisposables.clear(); + if (state !== 0 /* SashState.Disabled */) { + this._orthogonalEndDragHandle = append(this.el, $('.orthogonal-drag-handle.end')); + this.orthogonalEndDragHandleDisposables.add(toDisposable(() => this._orthogonalEndDragHandle.remove())); + this.orthogonalEndDragHandleDisposables.add(new DomEmitter(this._orthogonalEndDragHandle, 'mouseenter')).event(() => Sash.onMouseEnter(sash), undefined, this.orthogonalEndDragHandleDisposables); + this.orthogonalEndDragHandleDisposables.add(new DomEmitter(this._orthogonalEndDragHandle, 'mouseleave')).event(() => Sash.onMouseLeave(sash), undefined, this.orthogonalEndDragHandleDisposables); + } + }; + this.orthogonalEndSashDisposables.add(sash.onDidEnablementChange.event(onChange, this)); + onChange(sash.state); + } + this._orthogonalEndSash = sash; + } + constructor(container, layoutProvider, options) { + super(); + this.hoverDelay = globalHoverDelay; + this.hoverDelayer = this._register(new Delayer(this.hoverDelay)); + this._state = 3 /* SashState.Enabled */; + this.onDidEnablementChange = this._register(new Emitter()); + this._onDidStart = this._register(new Emitter()); + this._onDidChange = this._register(new Emitter()); + this._onDidReset = this._register(new Emitter()); + this._onDidEnd = this._register(new Emitter()); + this.orthogonalStartSashDisposables = this._register(new DisposableStore()); + this.orthogonalStartDragHandleDisposables = this._register(new DisposableStore()); + this.orthogonalEndSashDisposables = this._register(new DisposableStore()); + this.orthogonalEndDragHandleDisposables = this._register(new DisposableStore()); + /** + * An event which fires whenever the user starts dragging this sash. + */ + this.onDidStart = this._onDidStart.event; + /** + * An event which fires whenever the user moves the mouse while + * dragging this sash. + */ + this.onDidChange = this._onDidChange.event; + /** + * An event which fires whenever the user double clicks this sash. + */ + this.onDidReset = this._onDidReset.event; + /** + * An event which fires whenever the user stops dragging this sash. + */ + this.onDidEnd = this._onDidEnd.event; + /** + * A linked sash will be forwarded the same user interactions and events + * so it moves exactly the same way as this sash. + * + * Useful in 2x2 grids. Not meant for widespread usage. + */ + this.linkedSash = undefined; + this.el = append(container, $('.monaco-sash')); + if (options.orthogonalEdge) { + this.el.classList.add(`orthogonal-edge-${options.orthogonalEdge}`); + } + if (isMacintosh) { + this.el.classList.add('mac'); + } + const onMouseDown = this._register(new DomEmitter(this.el, 'mousedown')).event; + this._register(onMouseDown(e => this.onPointerStart(e, new MouseEventFactory(container)), this)); + const onMouseDoubleClick = this._register(new DomEmitter(this.el, 'dblclick')).event; + this._register(onMouseDoubleClick(this.onPointerDoublePress, this)); + const onMouseEnter = this._register(new DomEmitter(this.el, 'mouseenter')).event; + this._register(onMouseEnter(() => Sash.onMouseEnter(this))); + const onMouseLeave = this._register(new DomEmitter(this.el, 'mouseleave')).event; + this._register(onMouseLeave(() => Sash.onMouseLeave(this))); + this._register(Gesture.addTarget(this.el)); + const onTouchStart = this._register(new DomEmitter(this.el, EventType.Start)).event; + this._register(onTouchStart(e => this.onPointerStart(e, new GestureEventFactory(this.el)), this)); + const onTap = this._register(new DomEmitter(this.el, EventType.Tap)).event; + let doubleTapTimeout = undefined; + this._register(onTap(event => { + if (doubleTapTimeout) { + clearTimeout(doubleTapTimeout); + doubleTapTimeout = undefined; + this.onPointerDoublePress(event); + return; + } + clearTimeout(doubleTapTimeout); + doubleTapTimeout = setTimeout(() => doubleTapTimeout = undefined, 250); + }, this)); + if (typeof options.size === 'number') { + this.size = options.size; + if (options.orientation === 0 /* Orientation.VERTICAL */) { + this.el.style.width = `${this.size}px`; + } + else { + this.el.style.height = `${this.size}px`; + } + } + else { + this.size = globalSize; + this._register(onDidChangeGlobalSize.event(size => { + this.size = size; + this.layout(); + })); + } + this._register(onDidChangeHoverDelay.event(delay => this.hoverDelay = delay)); + this.layoutProvider = layoutProvider; + this.orthogonalStartSash = options.orthogonalStartSash; + this.orthogonalEndSash = options.orthogonalEndSash; + this.orientation = options.orientation || 0 /* Orientation.VERTICAL */; + if (this.orientation === 1 /* Orientation.HORIZONTAL */) { + this.el.classList.add('horizontal'); + this.el.classList.remove('vertical'); + } + else { + this.el.classList.remove('horizontal'); + this.el.classList.add('vertical'); + } + this.el.classList.toggle('debug', DEBUG); + this.layout(); + } + onPointerStart(event, pointerEventFactory) { + EventHelper.stop(event); + let isMultisashResize = false; + if (!event.__orthogonalSashEvent) { + const orthogonalSash = this.getOrthogonalSash(event); + if (orthogonalSash) { + isMultisashResize = true; + event.__orthogonalSashEvent = true; + orthogonalSash.onPointerStart(event, new OrthogonalPointerEventFactory(pointerEventFactory)); + } + } + if (this.linkedSash && !event.__linkedSashEvent) { + event.__linkedSashEvent = true; + this.linkedSash.onPointerStart(event, new OrthogonalPointerEventFactory(pointerEventFactory)); + } + if (!this.state) { + return; + } + const iframes = this.el.ownerDocument.getElementsByTagName('iframe'); + for (const iframe of iframes) { + iframe.classList.add(PointerEventsDisabledCssClass); // disable mouse events on iframes as long as we drag the sash + } + const startX = event.pageX; + const startY = event.pageY; + const altKey = event.altKey; + const startEvent = { startX, currentX: startX, startY, currentY: startY, altKey }; + this.el.classList.add('active'); + this._onDidStart.fire(startEvent); + // fix https://github.com/microsoft/vscode/issues/21675 + const style = createStyleSheet(this.el); + const updateStyle = () => { + let cursor = ''; + if (isMultisashResize) { + cursor = 'all-scroll'; + } + else if (this.orientation === 1 /* Orientation.HORIZONTAL */) { + if (this.state === 1 /* SashState.AtMinimum */) { + cursor = 's-resize'; + } + else if (this.state === 2 /* SashState.AtMaximum */) { + cursor = 'n-resize'; + } + else { + cursor = isMacintosh ? 'row-resize' : 'ns-resize'; + } + } + else { + if (this.state === 1 /* SashState.AtMinimum */) { + cursor = 'e-resize'; + } + else if (this.state === 2 /* SashState.AtMaximum */) { + cursor = 'w-resize'; + } + else { + cursor = isMacintosh ? 'col-resize' : 'ew-resize'; + } + } + style.textContent = `* { cursor: ${cursor} !important; }`; + }; + const disposables = new DisposableStore(); + updateStyle(); + if (!isMultisashResize) { + this.onDidEnablementChange.event(updateStyle, null, disposables); + } + const onPointerMove = (e) => { + EventHelper.stop(e, false); + const event = { startX, currentX: e.pageX, startY, currentY: e.pageY, altKey }; + this._onDidChange.fire(event); + }; + const onPointerUp = (e) => { + EventHelper.stop(e, false); + style.remove(); + this.el.classList.remove('active'); + this._onDidEnd.fire(); + disposables.dispose(); + for (const iframe of iframes) { + iframe.classList.remove(PointerEventsDisabledCssClass); + } + }; + pointerEventFactory.onPointerMove(onPointerMove, null, disposables); + pointerEventFactory.onPointerUp(onPointerUp, null, disposables); + disposables.add(pointerEventFactory); + } + onPointerDoublePress(e) { + const orthogonalSash = this.getOrthogonalSash(e); + if (orthogonalSash) { + orthogonalSash._onDidReset.fire(); + } + if (this.linkedSash) { + this.linkedSash._onDidReset.fire(); + } + this._onDidReset.fire(); + } + static onMouseEnter(sash, fromLinkedSash = false) { + if (sash.el.classList.contains('active')) { + sash.hoverDelayer.cancel(); + sash.el.classList.add('hover'); + } + else { + sash.hoverDelayer.trigger(() => sash.el.classList.add('hover'), sash.hoverDelay).then(undefined, () => { }); + } + if (!fromLinkedSash && sash.linkedSash) { + Sash.onMouseEnter(sash.linkedSash, true); + } + } + static onMouseLeave(sash, fromLinkedSash = false) { + sash.hoverDelayer.cancel(); + sash.el.classList.remove('hover'); + if (!fromLinkedSash && sash.linkedSash) { + Sash.onMouseLeave(sash.linkedSash, true); + } + } + /** + * Forcefully stop any user interactions with this sash. + * Useful when hiding a parent component, while the user is still + * interacting with the sash. + */ + clearSashHoverState() { + Sash.onMouseLeave(this); + } + /** + * Layout the sash. The sash will size and position itself + * based on its provided {@link ISashLayoutProvider layout provider}. + */ + layout() { + if (this.orientation === 0 /* Orientation.VERTICAL */) { + const verticalProvider = this.layoutProvider; + this.el.style.left = verticalProvider.getVerticalSashLeft(this) - (this.size / 2) + 'px'; + if (verticalProvider.getVerticalSashTop) { + this.el.style.top = verticalProvider.getVerticalSashTop(this) + 'px'; + } + if (verticalProvider.getVerticalSashHeight) { + this.el.style.height = verticalProvider.getVerticalSashHeight(this) + 'px'; + } + } + else { + const horizontalProvider = this.layoutProvider; + this.el.style.top = horizontalProvider.getHorizontalSashTop(this) - (this.size / 2) + 'px'; + if (horizontalProvider.getHorizontalSashLeft) { + this.el.style.left = horizontalProvider.getHorizontalSashLeft(this) + 'px'; + } + if (horizontalProvider.getHorizontalSashWidth) { + this.el.style.width = horizontalProvider.getHorizontalSashWidth(this) + 'px'; + } + } + } + getOrthogonalSash(e) { + const target = e.initialTarget ?? e.target; + if (!target || !(isHTMLElement(target))) { + return undefined; + } + if (target.classList.contains('orthogonal-drag-handle')) { + return target.classList.contains('start') ? this.orthogonalStartSash : this.orthogonalEndSash; + } + return undefined; + } + dispose() { + super.dispose(); + this.el.remove(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js new file mode 100644 index 0000000000000000000000000000000000000000..c9dabce7446ec6005ff4fb037da7dfabc348721a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js @@ -0,0 +1,207 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { createFastDomNode } from '../../fastDomNode.js'; +import { GlobalPointerMoveMonitor } from '../../globalPointerMoveMonitor.js'; +import { ScrollbarArrow } from './scrollbarArrow.js'; +import { ScrollbarVisibilityController } from './scrollbarVisibilityController.js'; +import { Widget } from '../widget.js'; +import * as platform from '../../../common/platform.js'; +/** + * The orthogonal distance to the slider at which dragging "resets". This implements "snapping" + */ +const POINTER_DRAG_RESET_DISTANCE = 140; +export class AbstractScrollbar extends Widget { + constructor(opts) { + super(); + this._lazyRender = opts.lazyRender; + this._host = opts.host; + this._scrollable = opts.scrollable; + this._scrollByPage = opts.scrollByPage; + this._scrollbarState = opts.scrollbarState; + this._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName)); + this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()); + this._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor()); + this._shouldRender = true; + this.domNode = createFastDomNode(document.createElement('div')); + this.domNode.setAttribute('role', 'presentation'); + this.domNode.setAttribute('aria-hidden', 'true'); + this._visibilityController.setDomNode(this.domNode); + this.domNode.setPosition('absolute'); + this._register(dom.addDisposableListener(this.domNode.domNode, dom.EventType.POINTER_DOWN, (e) => this._domNodePointerDown(e))); + } + // ----------------- creation + /** + * Creates the dom node for an arrow & adds it to the container + */ + _createArrow(opts) { + const arrow = this._register(new ScrollbarArrow(opts)); + this.domNode.domNode.appendChild(arrow.bgDomNode); + this.domNode.domNode.appendChild(arrow.domNode); + } + /** + * Creates the slider dom node, adds it to the container & hooks up the events + */ + _createSlider(top, left, width, height) { + this.slider = createFastDomNode(document.createElement('div')); + this.slider.setClassName('slider'); + this.slider.setPosition('absolute'); + this.slider.setTop(top); + this.slider.setLeft(left); + if (typeof width === 'number') { + this.slider.setWidth(width); + } + if (typeof height === 'number') { + this.slider.setHeight(height); + } + this.slider.setLayerHinting(true); + this.slider.setContain('strict'); + this.domNode.domNode.appendChild(this.slider.domNode); + this._register(dom.addDisposableListener(this.slider.domNode, dom.EventType.POINTER_DOWN, (e) => { + if (e.button === 0) { + e.preventDefault(); + this._sliderPointerDown(e); + } + })); + this.onclick(this.slider.domNode, e => { + if (e.leftButton) { + e.stopPropagation(); + } + }); + } + // ----------------- Update state + _onElementSize(visibleSize) { + if (this._scrollbarState.setVisibleSize(visibleSize)) { + this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()); + this._shouldRender = true; + if (!this._lazyRender) { + this.render(); + } + } + return this._shouldRender; + } + _onElementScrollSize(elementScrollSize) { + if (this._scrollbarState.setScrollSize(elementScrollSize)) { + this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()); + this._shouldRender = true; + if (!this._lazyRender) { + this.render(); + } + } + return this._shouldRender; + } + _onElementScrollPosition(elementScrollPosition) { + if (this._scrollbarState.setScrollPosition(elementScrollPosition)) { + this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()); + this._shouldRender = true; + if (!this._lazyRender) { + this.render(); + } + } + return this._shouldRender; + } + // ----------------- rendering + beginReveal() { + this._visibilityController.setShouldBeVisible(true); + } + beginHide() { + this._visibilityController.setShouldBeVisible(false); + } + render() { + if (!this._shouldRender) { + return; + } + this._shouldRender = false; + this._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize()); + this._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition()); + } + // ----------------- DOM events + _domNodePointerDown(e) { + if (e.target !== this.domNode.domNode) { + return; + } + this._onPointerDown(e); + } + delegatePointerDown(e) { + const domTop = this.domNode.domNode.getClientRects()[0].top; + const sliderStart = domTop + this._scrollbarState.getSliderPosition(); + const sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize(); + const pointerPos = this._sliderPointerPosition(e); + if (sliderStart <= pointerPos && pointerPos <= sliderStop) { + // Act as if it was a pointer down on the slider + if (e.button === 0) { + e.preventDefault(); + this._sliderPointerDown(e); + } + } + else { + // Act as if it was a pointer down on the scrollbar + this._onPointerDown(e); + } + } + _onPointerDown(e) { + let offsetX; + let offsetY; + if (e.target === this.domNode.domNode && typeof e.offsetX === 'number' && typeof e.offsetY === 'number') { + offsetX = e.offsetX; + offsetY = e.offsetY; + } + else { + const domNodePosition = dom.getDomNodePagePosition(this.domNode.domNode); + offsetX = e.pageX - domNodePosition.left; + offsetY = e.pageY - domNodePosition.top; + } + const offset = this._pointerDownRelativePosition(offsetX, offsetY); + this._setDesiredScrollPositionNow(this._scrollByPage + ? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset) + : this._scrollbarState.getDesiredScrollPositionFromOffset(offset)); + if (e.button === 0) { + // left button + e.preventDefault(); + this._sliderPointerDown(e); + } + } + _sliderPointerDown(e) { + if (!e.target || !(e.target instanceof Element)) { + return; + } + const initialPointerPosition = this._sliderPointerPosition(e); + const initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e); + const initialScrollbarState = this._scrollbarState.clone(); + this.slider.toggleClassName('active', true); + this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => { + const pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData); + const pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition); + if (platform.isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) { + // The pointer has wondered away from the scrollbar => reset dragging + this._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition()); + return; + } + const pointerPosition = this._sliderPointerPosition(pointerMoveData); + const pointerDelta = pointerPosition - initialPointerPosition; + this._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta)); + }, () => { + this.slider.toggleClassName('active', false); + this._host.onDragEnd(); + }); + this._host.onDragStart(); + } + _setDesiredScrollPositionNow(_desiredScrollPosition) { + const desiredScrollPosition = {}; + this.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition); + this._scrollable.setScrollPositionNow(desiredScrollPosition); + } + updateScrollbarSize(scrollbarSize) { + this._updateScrollbarSize(scrollbarSize); + this._scrollbarState.setScrollbarSize(scrollbarSize); + this._shouldRender = true; + if (!this._lazyRender) { + this.render(); + } + } + isNeeded() { + return this._scrollbarState.isNeeded(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js new file mode 100644 index 0000000000000000000000000000000000000000..644d62779da45b38e5ead4787504e5ae1b461a69 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { StandardWheelEvent } from '../../mouseEvent.js'; +import { AbstractScrollbar } from './abstractScrollbar.js'; +import { ARROW_IMG_SIZE } from './scrollbarArrow.js'; +import { ScrollbarState } from './scrollbarState.js'; +import { Codicon } from '../../../common/codicons.js'; +export class HorizontalScrollbar extends AbstractScrollbar { + constructor(scrollable, options, host) { + const scrollDimensions = scrollable.getScrollDimensions(); + const scrollPosition = scrollable.getCurrentScrollPosition(); + super({ + lazyRender: options.lazyRender, + host: host, + scrollbarState: new ScrollbarState((options.horizontalHasArrows ? options.arrowSize : 0), (options.horizontal === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.horizontalScrollbarSize), (options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize), scrollDimensions.width, scrollDimensions.scrollWidth, scrollPosition.scrollLeft), + visibility: options.horizontal, + extraScrollbarClassName: 'horizontal', + scrollable: scrollable, + scrollByPage: options.scrollByPage + }); + if (options.horizontalHasArrows) { + const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2; + const scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2; + this._createArrow({ + className: 'scra', + icon: Codicon.scrollbarButtonLeft, + top: scrollbarDelta, + left: arrowDelta, + bottom: undefined, + right: undefined, + bgWidth: options.arrowSize, + bgHeight: options.horizontalScrollbarSize, + onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0)), + }); + this._createArrow({ + className: 'scra', + icon: Codicon.scrollbarButtonRight, + top: scrollbarDelta, + left: undefined, + bottom: undefined, + right: arrowDelta, + bgWidth: options.arrowSize, + bgHeight: options.horizontalScrollbarSize, + onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0)), + }); + } + this._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize); + } + _updateSlider(sliderSize, sliderPosition) { + this.slider.setWidth(sliderSize); + this.slider.setLeft(sliderPosition); + } + _renderDomNode(largeSize, smallSize) { + this.domNode.setWidth(largeSize); + this.domNode.setHeight(smallSize); + this.domNode.setLeft(0); + this.domNode.setBottom(0); + } + onDidScroll(e) { + this._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender; + this._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender; + this._shouldRender = this._onElementSize(e.width) || this._shouldRender; + return this._shouldRender; + } + _pointerDownRelativePosition(offsetX, offsetY) { + return offsetX; + } + _sliderPointerPosition(e) { + return e.pageX; + } + _sliderOrthogonalPointerPosition(e) { + return e.pageY; + } + _updateScrollbarSize(size) { + this.slider.setHeight(size); + } + writeScrollPosition(target, scrollPosition) { + target.scrollLeft = scrollPosition; + } + updateOptions(options) { + this.updateScrollbarSize(options.horizontal === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.horizontalScrollbarSize); + this._scrollbarState.setOppositeScrollbarSize(options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize); + this._visibilityController.setVisibility(options.horizontal); + this._scrollByPage = options.scrollByPage; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css new file mode 100644 index 0000000000000000000000000000000000000000..84c173708948a4dcbf871a5ddc728cbca4cf950f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css @@ -0,0 +1,72 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/* Arrows */ +.monaco-scrollable-element > .scrollbar > .scra { + cursor: pointer; + font-size: 11px !important; +} + +.monaco-scrollable-element > .visible { + opacity: 1; + + /* Background rule added for IE9 - to allow clicks on dom node */ + background:rgba(0,0,0,0); + + transition: opacity 100ms linear; + /* In front of peek view */ + z-index: 11; +} +.monaco-scrollable-element > .invisible { + opacity: 0; + pointer-events: none; +} +.monaco-scrollable-element > .invisible.fade { + transition: opacity 800ms linear; +} + +/* Scrollable Content Inset Shadow */ +.monaco-scrollable-element > .shadow { + position: absolute; + display: none; +} +.monaco-scrollable-element > .shadow.top { + display: block; + top: 0; + left: 3px; + height: 3px; + width: 100%; + box-shadow: var(--vscode-scrollbar-shadow) 0 6px 6px -6px inset; +} +.monaco-scrollable-element > .shadow.left { + display: block; + top: 3px; + left: 0; + height: 100%; + width: 3px; + box-shadow: var(--vscode-scrollbar-shadow) 6px 0 6px -6px inset; +} +.monaco-scrollable-element > .shadow.top-left-corner { + display: block; + top: 0; + left: 0; + height: 3px; + width: 3px; +} +.monaco-scrollable-element > .shadow.top.left { + box-shadow: var(--vscode-scrollbar-shadow) 6px 0 6px -6px inset; +} + +.monaco-scrollable-element > .scrollbar > .slider { + background: var(--vscode-scrollbarSlider-background); +} + +.monaco-scrollable-element > .scrollbar > .slider:hover { + background: var(--vscode-scrollbarSlider-hoverBackground); +} + +.monaco-scrollable-element > .scrollbar > .slider.active { + background: var(--vscode-scrollbarSlider-activeBackground); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js new file mode 100644 index 0000000000000000000000000000000000000000..633002e63f2999335d8a800cc57957b179d281a2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js @@ -0,0 +1,554 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { getZoomFactor, isChrome } from '../../browser.js'; +import * as dom from '../../dom.js'; +import { createFastDomNode } from '../../fastDomNode.js'; +import { StandardWheelEvent } from '../../mouseEvent.js'; +import { HorizontalScrollbar } from './horizontalScrollbar.js'; +import { VerticalScrollbar } from './verticalScrollbar.js'; +import { Widget } from '../widget.js'; +import { TimeoutTimer } from '../../../common/async.js'; +import { Emitter } from '../../../common/event.js'; +import { dispose } from '../../../common/lifecycle.js'; +import * as platform from '../../../common/platform.js'; +import { Scrollable } from '../../../common/scrollable.js'; +import './media/scrollbars.css'; +const HIDE_TIMEOUT = 500; +const SCROLL_WHEEL_SENSITIVITY = 50; +const SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true; +class MouseWheelClassifierItem { + constructor(timestamp, deltaX, deltaY) { + this.timestamp = timestamp; + this.deltaX = deltaX; + this.deltaY = deltaY; + this.score = 0; + } +} +export class MouseWheelClassifier { + static { this.INSTANCE = new MouseWheelClassifier(); } + constructor() { + this._capacity = 5; + this._memory = []; + this._front = -1; + this._rear = -1; + } + isPhysicalMouseWheel() { + if (this._front === -1 && this._rear === -1) { + // no elements + return false; + } + // 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ... + let remainingInfluence = 1; + let score = 0; + let iteration = 1; + let index = this._rear; + do { + const influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration)); + remainingInfluence -= influence; + score += this._memory[index].score * influence; + if (index === this._front) { + break; + } + index = (this._capacity + index - 1) % this._capacity; + iteration++; + } while (true); + return (score <= 0.5); + } + acceptStandardWheelEvent(e) { + if (isChrome) { + const targetWindow = dom.getWindow(e.browserEvent); + const pageZoomFactor = getZoomFactor(targetWindow); + // On Chrome, the incoming delta events are multiplied with the OS zoom factor. + // The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account. + this.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor); + } + else { + this.accept(Date.now(), e.deltaX, e.deltaY); + } + } + accept(timestamp, deltaX, deltaY) { + let previousItem = null; + const item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY); + if (this._front === -1 && this._rear === -1) { + this._memory[0] = item; + this._front = 0; + this._rear = 0; + } + else { + previousItem = this._memory[this._rear]; + this._rear = (this._rear + 1) % this._capacity; + if (this._rear === this._front) { + // Drop oldest + this._front = (this._front + 1) % this._capacity; + } + this._memory[this._rear] = item; + } + item.score = this._computeScore(item, previousItem); + } + /** + * A score between 0 and 1 for `item`. + * - a score towards 0 indicates that the source appears to be a physical mouse wheel + * - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc. + */ + _computeScore(item, previousItem) { + if (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) { + // both axes exercised => definitely not a physical mouse wheel + return 1; + } + let score = 0.5; + if (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) { + // non-integer deltas => indicator that this is not a physical mouse wheel + score += 0.25; + } + // Non-accelerating scroll => indicator that this is a physical mouse wheel + // These can be identified by seeing whether they are the module of one another. + if (previousItem) { + const absDeltaX = Math.abs(item.deltaX); + const absDeltaY = Math.abs(item.deltaY); + const absPreviousDeltaX = Math.abs(previousItem.deltaX); + const absPreviousDeltaY = Math.abs(previousItem.deltaY); + // Min 1 to avoid division by zero, module 1 will still be 0. + const minDeltaX = Math.max(Math.min(absDeltaX, absPreviousDeltaX), 1); + const minDeltaY = Math.max(Math.min(absDeltaY, absPreviousDeltaY), 1); + const maxDeltaX = Math.max(absDeltaX, absPreviousDeltaX); + const maxDeltaY = Math.max(absDeltaY, absPreviousDeltaY); + const isSameModulo = (maxDeltaX % minDeltaX === 0 && maxDeltaY % minDeltaY === 0); + if (isSameModulo) { + score -= 0.5; + } + } + return Math.min(Math.max(score, 0), 1); + } + _isAlmostInt(value) { + const delta = Math.abs(Math.round(value) - value); + return (delta < 0.01); + } +} +export class AbstractScrollableElement extends Widget { + get options() { + return this._options; + } + constructor(element, options, scrollable) { + super(); + this._onScroll = this._register(new Emitter()); + this.onScroll = this._onScroll.event; + this._onWillScroll = this._register(new Emitter()); + element.style.overflow = 'hidden'; + this._options = resolveOptions(options); + this._scrollable = scrollable; + this._register(this._scrollable.onScroll((e) => { + this._onWillScroll.fire(e); + this._onDidScroll(e); + this._onScroll.fire(e); + })); + const scrollbarHost = { + onMouseWheel: (mouseWheelEvent) => this._onMouseWheel(mouseWheelEvent), + onDragStart: () => this._onDragStart(), + onDragEnd: () => this._onDragEnd(), + }; + this._verticalScrollbar = this._register(new VerticalScrollbar(this._scrollable, this._options, scrollbarHost)); + this._horizontalScrollbar = this._register(new HorizontalScrollbar(this._scrollable, this._options, scrollbarHost)); + this._domNode = document.createElement('div'); + this._domNode.className = 'monaco-scrollable-element ' + this._options.className; + this._domNode.setAttribute('role', 'presentation'); + this._domNode.style.position = 'relative'; + this._domNode.style.overflow = 'hidden'; + this._domNode.appendChild(element); + this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode); + this._domNode.appendChild(this._verticalScrollbar.domNode.domNode); + if (this._options.useShadows) { + this._leftShadowDomNode = createFastDomNode(document.createElement('div')); + this._leftShadowDomNode.setClassName('shadow'); + this._domNode.appendChild(this._leftShadowDomNode.domNode); + this._topShadowDomNode = createFastDomNode(document.createElement('div')); + this._topShadowDomNode.setClassName('shadow'); + this._domNode.appendChild(this._topShadowDomNode.domNode); + this._topLeftShadowDomNode = createFastDomNode(document.createElement('div')); + this._topLeftShadowDomNode.setClassName('shadow'); + this._domNode.appendChild(this._topLeftShadowDomNode.domNode); + } + else { + this._leftShadowDomNode = null; + this._topShadowDomNode = null; + this._topLeftShadowDomNode = null; + } + this._listenOnDomNode = this._options.listenOnDomNode || this._domNode; + this._mouseWheelToDispose = []; + this._setListeningToMouseWheel(this._options.handleMouseWheel); + this.onmouseover(this._listenOnDomNode, (e) => this._onMouseOver(e)); + this.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e)); + this._hideTimeout = this._register(new TimeoutTimer()); + this._isDragging = false; + this._mouseIsOver = false; + this._shouldRender = true; + this._revealOnScroll = true; + } + dispose() { + this._mouseWheelToDispose = dispose(this._mouseWheelToDispose); + super.dispose(); + } + /** + * Get the generated 'scrollable' dom node + */ + getDomNode() { + return this._domNode; + } + getOverviewRulerLayoutInfo() { + return { + parent: this._domNode, + insertBefore: this._verticalScrollbar.domNode.domNode, + }; + } + /** + * Delegate a pointer down event to the vertical scrollbar. + * This is to help with clicking somewhere else and having the scrollbar react. + */ + delegateVerticalScrollbarPointerDown(browserEvent) { + this._verticalScrollbar.delegatePointerDown(browserEvent); + } + getScrollDimensions() { + return this._scrollable.getScrollDimensions(); + } + setScrollDimensions(dimensions) { + this._scrollable.setScrollDimensions(dimensions, false); + } + /** + * Update the class name of the scrollable element. + */ + updateClassName(newClassName) { + this._options.className = newClassName; + // Defaults are different on Macs + if (platform.isMacintosh) { + this._options.className += ' mac'; + } + this._domNode.className = 'monaco-scrollable-element ' + this._options.className; + } + /** + * Update configuration options for the scrollbar. + */ + updateOptions(newOptions) { + if (typeof newOptions.handleMouseWheel !== 'undefined') { + this._options.handleMouseWheel = newOptions.handleMouseWheel; + this._setListeningToMouseWheel(this._options.handleMouseWheel); + } + if (typeof newOptions.mouseWheelScrollSensitivity !== 'undefined') { + this._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity; + } + if (typeof newOptions.fastScrollSensitivity !== 'undefined') { + this._options.fastScrollSensitivity = newOptions.fastScrollSensitivity; + } + if (typeof newOptions.scrollPredominantAxis !== 'undefined') { + this._options.scrollPredominantAxis = newOptions.scrollPredominantAxis; + } + if (typeof newOptions.horizontal !== 'undefined') { + this._options.horizontal = newOptions.horizontal; + } + if (typeof newOptions.vertical !== 'undefined') { + this._options.vertical = newOptions.vertical; + } + if (typeof newOptions.horizontalScrollbarSize !== 'undefined') { + this._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize; + } + if (typeof newOptions.verticalScrollbarSize !== 'undefined') { + this._options.verticalScrollbarSize = newOptions.verticalScrollbarSize; + } + if (typeof newOptions.scrollByPage !== 'undefined') { + this._options.scrollByPage = newOptions.scrollByPage; + } + this._horizontalScrollbar.updateOptions(this._options); + this._verticalScrollbar.updateOptions(this._options); + if (!this._options.lazyRender) { + this._render(); + } + } + delegateScrollFromMouseWheelEvent(browserEvent) { + this._onMouseWheel(new StandardWheelEvent(browserEvent)); + } + // -------------------- mouse wheel scrolling -------------------- + _setListeningToMouseWheel(shouldListen) { + const isListening = (this._mouseWheelToDispose.length > 0); + if (isListening === shouldListen) { + // No change + return; + } + // Stop listening (if necessary) + this._mouseWheelToDispose = dispose(this._mouseWheelToDispose); + // Start listening (if necessary) + if (shouldListen) { + const onMouseWheel = (browserEvent) => { + this._onMouseWheel(new StandardWheelEvent(browserEvent)); + }; + this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { passive: false })); + } + } + _onMouseWheel(e) { + if (e.browserEvent?.defaultPrevented) { + return; + } + const classifier = MouseWheelClassifier.INSTANCE; + if (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) { + classifier.acceptStandardWheelEvent(e); + } + // useful for creating unit tests: + // console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`); + let didScroll = false; + if (e.deltaY || e.deltaX) { + let deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity; + let deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity; + if (this._options.scrollPredominantAxis) { + if (this._options.scrollYToX && deltaX + deltaY === 0) { + // when configured to map Y to X and we both see + // no dominant axis and X and Y are competing with + // identical values into opposite directions, we + // ignore the delta as we cannot make a decision then + deltaX = deltaY = 0; + } + else if (Math.abs(deltaY) >= Math.abs(deltaX)) { + deltaX = 0; + } + else { + deltaY = 0; + } + } + if (this._options.flipAxes) { + [deltaY, deltaX] = [deltaX, deltaY]; + } + // Convert vertical scrolling to horizontal if shift is held, this + // is handled at a higher level on Mac + const shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey; + if ((this._options.scrollYToX || shiftConvert) && !deltaX) { + deltaX = deltaY; + deltaY = 0; + } + if (e.browserEvent && e.browserEvent.altKey) { + // fastScrolling + deltaX = deltaX * this._options.fastScrollSensitivity; + deltaY = deltaY * this._options.fastScrollSensitivity; + } + const futureScrollPosition = this._scrollable.getFutureScrollPosition(); + let desiredScrollPosition = {}; + if (deltaY) { + const deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY; + // Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll + const desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop)); + this._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop); + } + if (deltaX) { + const deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX; + // Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll + const desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft)); + this._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft); + } + // Check that we are scrolling towards a location which is valid + desiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition); + if (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) { + const canPerformSmoothScroll = (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED + && this._options.mouseWheelSmoothScroll + && classifier.isPhysicalMouseWheel()); + if (canPerformSmoothScroll) { + this._scrollable.setScrollPositionSmooth(desiredScrollPosition); + } + else { + this._scrollable.setScrollPositionNow(desiredScrollPosition); + } + didScroll = true; + } + } + let consumeMouseWheel = didScroll; + if (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) { + consumeMouseWheel = true; + } + if (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) { + consumeMouseWheel = true; + } + if (consumeMouseWheel) { + e.preventDefault(); + e.stopPropagation(); + } + } + _onDidScroll(e) { + this._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender; + this._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender; + if (this._options.useShadows) { + this._shouldRender = true; + } + if (this._revealOnScroll) { + this._reveal(); + } + if (!this._options.lazyRender) { + this._render(); + } + } + /** + * Render / mutate the DOM now. + * Should be used together with the ctor option `lazyRender`. + */ + renderNow() { + if (!this._options.lazyRender) { + throw new Error('Please use `lazyRender` together with `renderNow`!'); + } + this._render(); + } + _render() { + if (!this._shouldRender) { + return; + } + this._shouldRender = false; + this._horizontalScrollbar.render(); + this._verticalScrollbar.render(); + if (this._options.useShadows) { + const scrollState = this._scrollable.getCurrentScrollPosition(); + const enableTop = scrollState.scrollTop > 0; + const enableLeft = scrollState.scrollLeft > 0; + const leftClassName = (enableLeft ? ' left' : ''); + const topClassName = (enableTop ? ' top' : ''); + const topLeftClassName = (enableLeft || enableTop ? ' top-left-corner' : ''); + this._leftShadowDomNode.setClassName(`shadow${leftClassName}`); + this._topShadowDomNode.setClassName(`shadow${topClassName}`); + this._topLeftShadowDomNode.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`); + } + } + // -------------------- fade in / fade out -------------------- + _onDragStart() { + this._isDragging = true; + this._reveal(); + } + _onDragEnd() { + this._isDragging = false; + this._hide(); + } + _onMouseLeave(e) { + this._mouseIsOver = false; + this._hide(); + } + _onMouseOver(e) { + this._mouseIsOver = true; + this._reveal(); + } + _reveal() { + this._verticalScrollbar.beginReveal(); + this._horizontalScrollbar.beginReveal(); + this._scheduleHide(); + } + _hide() { + if (!this._mouseIsOver && !this._isDragging) { + this._verticalScrollbar.beginHide(); + this._horizontalScrollbar.beginHide(); + } + } + _scheduleHide() { + if (!this._mouseIsOver && !this._isDragging) { + this._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT); + } + } +} +export class ScrollableElement extends AbstractScrollableElement { + constructor(element, options) { + options = options || {}; + options.mouseWheelSmoothScroll = false; + const scrollable = new Scrollable({ + forceIntegerValues: true, + smoothScrollDuration: 0, + scheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback) + }); + super(element, options, scrollable); + this._register(scrollable); + } + setScrollPosition(update) { + this._scrollable.setScrollPositionNow(update); + } +} +export class SmoothScrollableElement extends AbstractScrollableElement { + constructor(element, options, scrollable) { + super(element, options, scrollable); + } + setScrollPosition(update) { + if (update.reuseAnimation) { + this._scrollable.setScrollPositionSmooth(update, update.reuseAnimation); + } + else { + this._scrollable.setScrollPositionNow(update); + } + } + getScrollPosition() { + return this._scrollable.getCurrentScrollPosition(); + } +} +export class DomScrollableElement extends AbstractScrollableElement { + constructor(element, options) { + options = options || {}; + options.mouseWheelSmoothScroll = false; + const scrollable = new Scrollable({ + forceIntegerValues: false, // See https://github.com/microsoft/vscode/issues/139877 + smoothScrollDuration: 0, + scheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback) + }); + super(element, options, scrollable); + this._register(scrollable); + this._element = element; + this._register(this.onScroll((e) => { + if (e.scrollTopChanged) { + this._element.scrollTop = e.scrollTop; + } + if (e.scrollLeftChanged) { + this._element.scrollLeft = e.scrollLeft; + } + })); + this.scanDomNode(); + } + setScrollPosition(update) { + this._scrollable.setScrollPositionNow(update); + } + getScrollPosition() { + return this._scrollable.getCurrentScrollPosition(); + } + scanDomNode() { + // width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight + this.setScrollDimensions({ + width: this._element.clientWidth, + scrollWidth: this._element.scrollWidth, + height: this._element.clientHeight, + scrollHeight: this._element.scrollHeight + }); + this.setScrollPosition({ + scrollLeft: this._element.scrollLeft, + scrollTop: this._element.scrollTop, + }); + } +} +function resolveOptions(opts) { + const result = { + lazyRender: (typeof opts.lazyRender !== 'undefined' ? opts.lazyRender : false), + className: (typeof opts.className !== 'undefined' ? opts.className : ''), + useShadows: (typeof opts.useShadows !== 'undefined' ? opts.useShadows : true), + handleMouseWheel: (typeof opts.handleMouseWheel !== 'undefined' ? opts.handleMouseWheel : true), + flipAxes: (typeof opts.flipAxes !== 'undefined' ? opts.flipAxes : false), + consumeMouseWheelIfScrollbarIsNeeded: (typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== 'undefined' ? opts.consumeMouseWheelIfScrollbarIsNeeded : false), + alwaysConsumeMouseWheel: (typeof opts.alwaysConsumeMouseWheel !== 'undefined' ? opts.alwaysConsumeMouseWheel : false), + scrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false), + mouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1), + fastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5), + scrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true), + mouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true), + arrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11), + listenOnDomNode: (typeof opts.listenOnDomNode !== 'undefined' ? opts.listenOnDomNode : null), + horizontal: (typeof opts.horizontal !== 'undefined' ? opts.horizontal : 1 /* ScrollbarVisibility.Auto */), + horizontalScrollbarSize: (typeof opts.horizontalScrollbarSize !== 'undefined' ? opts.horizontalScrollbarSize : 10), + horizontalSliderSize: (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : 0), + horizontalHasArrows: (typeof opts.horizontalHasArrows !== 'undefined' ? opts.horizontalHasArrows : false), + vertical: (typeof opts.vertical !== 'undefined' ? opts.vertical : 1 /* ScrollbarVisibility.Auto */), + verticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10), + verticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false), + verticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0), + scrollByPage: (typeof opts.scrollByPage !== 'undefined' ? opts.scrollByPage : false) + }; + result.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize); + result.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize); + // Defaults are different on Macs + if (platform.isMacintosh) { + result.className += ' mac'; + } + return result; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElementOptions.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElementOptions.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElementOptions.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js new file mode 100644 index 0000000000000000000000000000000000000000..e32901ab2af79978813bb84a0dd2d3804bc3668e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { GlobalPointerMoveMonitor } from '../../globalPointerMoveMonitor.js'; +import { Widget } from '../widget.js'; +import { TimeoutTimer } from '../../../common/async.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import * as dom from '../../dom.js'; +/** + * The arrow image size. + */ +export const ARROW_IMG_SIZE = 11; +export class ScrollbarArrow extends Widget { + constructor(opts) { + super(); + this._onActivate = opts.onActivate; + this.bgDomNode = document.createElement('div'); + this.bgDomNode.className = 'arrow-background'; + this.bgDomNode.style.position = 'absolute'; + this.bgDomNode.style.width = opts.bgWidth + 'px'; + this.bgDomNode.style.height = opts.bgHeight + 'px'; + if (typeof opts.top !== 'undefined') { + this.bgDomNode.style.top = '0px'; + } + if (typeof opts.left !== 'undefined') { + this.bgDomNode.style.left = '0px'; + } + if (typeof opts.bottom !== 'undefined') { + this.bgDomNode.style.bottom = '0px'; + } + if (typeof opts.right !== 'undefined') { + this.bgDomNode.style.right = '0px'; + } + this.domNode = document.createElement('div'); + this.domNode.className = opts.className; + this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon)); + this.domNode.style.position = 'absolute'; + this.domNode.style.width = ARROW_IMG_SIZE + 'px'; + this.domNode.style.height = ARROW_IMG_SIZE + 'px'; + if (typeof opts.top !== 'undefined') { + this.domNode.style.top = opts.top + 'px'; + } + if (typeof opts.left !== 'undefined') { + this.domNode.style.left = opts.left + 'px'; + } + if (typeof opts.bottom !== 'undefined') { + this.domNode.style.bottom = opts.bottom + 'px'; + } + if (typeof opts.right !== 'undefined') { + this.domNode.style.right = opts.right + 'px'; + } + this._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor()); + this._register(dom.addStandardDisposableListener(this.bgDomNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e))); + this._register(dom.addStandardDisposableListener(this.domNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e))); + this._pointerdownRepeatTimer = this._register(new dom.WindowIntervalTimer()); + this._pointerdownScheduleRepeatTimer = this._register(new TimeoutTimer()); + } + _arrowPointerDown(e) { + if (!e.target || !(e.target instanceof Element)) { + return; + } + const scheduleRepeater = () => { + this._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24, dom.getWindow(e)); + }; + this._onActivate(); + this._pointerdownRepeatTimer.cancel(); + this._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200); + this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => { }, () => { + this._pointerdownRepeatTimer.cancel(); + this._pointerdownScheduleRepeatTimer.cancel(); + }); + e.preventDefault(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js new file mode 100644 index 0000000000000000000000000000000000000000..85d185b15ed6e8ef54f09c9dcce1db319f5740ba --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js @@ -0,0 +1,161 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/** + * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged. + */ +const MINIMUM_SLIDER_SIZE = 20; +export class ScrollbarState { + constructor(arrowSize, scrollbarSize, oppositeScrollbarSize, visibleSize, scrollSize, scrollPosition) { + this._scrollbarSize = Math.round(scrollbarSize); + this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize); + this._arrowSize = Math.round(arrowSize); + this._visibleSize = visibleSize; + this._scrollSize = scrollSize; + this._scrollPosition = scrollPosition; + this._computedAvailableSize = 0; + this._computedIsNeeded = false; + this._computedSliderSize = 0; + this._computedSliderRatio = 0; + this._computedSliderPosition = 0; + this._refreshComputedValues(); + } + clone() { + return new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition); + } + setVisibleSize(visibleSize) { + const iVisibleSize = Math.round(visibleSize); + if (this._visibleSize !== iVisibleSize) { + this._visibleSize = iVisibleSize; + this._refreshComputedValues(); + return true; + } + return false; + } + setScrollSize(scrollSize) { + const iScrollSize = Math.round(scrollSize); + if (this._scrollSize !== iScrollSize) { + this._scrollSize = iScrollSize; + this._refreshComputedValues(); + return true; + } + return false; + } + setScrollPosition(scrollPosition) { + const iScrollPosition = Math.round(scrollPosition); + if (this._scrollPosition !== iScrollPosition) { + this._scrollPosition = iScrollPosition; + this._refreshComputedValues(); + return true; + } + return false; + } + setScrollbarSize(scrollbarSize) { + this._scrollbarSize = Math.round(scrollbarSize); + } + setOppositeScrollbarSize(oppositeScrollbarSize) { + this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize); + } + static _computeValues(oppositeScrollbarSize, arrowSize, visibleSize, scrollSize, scrollPosition) { + const computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize); + const computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize); + const computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize); + if (!computedIsNeeded) { + // There is no need for a slider + return { + computedAvailableSize: Math.round(computedAvailableSize), + computedIsNeeded: computedIsNeeded, + computedSliderSize: Math.round(computedRepresentableSize), + computedSliderRatio: 0, + computedSliderPosition: 0, + }; + } + // We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise + const computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize))); + // The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize` + // in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`. + const computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize); + const computedSliderPosition = (scrollPosition * computedSliderRatio); + return { + computedAvailableSize: Math.round(computedAvailableSize), + computedIsNeeded: computedIsNeeded, + computedSliderSize: Math.round(computedSliderSize), + computedSliderRatio: computedSliderRatio, + computedSliderPosition: Math.round(computedSliderPosition), + }; + } + _refreshComputedValues() { + const r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition); + this._computedAvailableSize = r.computedAvailableSize; + this._computedIsNeeded = r.computedIsNeeded; + this._computedSliderSize = r.computedSliderSize; + this._computedSliderRatio = r.computedSliderRatio; + this._computedSliderPosition = r.computedSliderPosition; + } + getArrowSize() { + return this._arrowSize; + } + getScrollPosition() { + return this._scrollPosition; + } + getRectangleLargeSize() { + return this._computedAvailableSize; + } + getRectangleSmallSize() { + return this._scrollbarSize; + } + isNeeded() { + return this._computedIsNeeded; + } + getSliderSize() { + return this._computedSliderSize; + } + getSliderPosition() { + return this._computedSliderPosition; + } + /** + * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider. + * `offset` is based on the same coordinate system as the `sliderPosition`. + */ + getDesiredScrollPositionFromOffset(offset) { + if (!this._computedIsNeeded) { + // no need for a slider + return 0; + } + const desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2; + return Math.round(desiredSliderPosition / this._computedSliderRatio); + } + /** + * Compute a desired `scrollPosition` from if offset is before or after the slider position. + * If offset is before slider, treat as a page up (or left). If after, page down (or right). + * `offset` and `_computedSliderPosition` are based on the same coordinate system. + * `_visibleSize` corresponds to a "page" of lines in the returned coordinate system. + */ + getDesiredScrollPositionFromOffsetPaged(offset) { + if (!this._computedIsNeeded) { + // no need for a slider + return 0; + } + const correctedOffset = offset - this._arrowSize; // compensate if has arrows + let desiredScrollPosition = this._scrollPosition; + if (correctedOffset < this._computedSliderPosition) { + desiredScrollPosition -= this._visibleSize; // page up/left + } + else { + desiredScrollPosition += this._visibleSize; // page down/right + } + return desiredScrollPosition; + } + /** + * Compute a desired `scrollPosition` such that the slider moves by `delta`. + */ + getDesiredScrollPositionFromDelta(delta) { + if (!this._computedIsNeeded) { + // no need for a slider + return 0; + } + const desiredSliderPosition = this._computedSliderPosition + delta; + return Math.round(desiredSliderPosition / this._computedSliderRatio); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js new file mode 100644 index 0000000000000000000000000000000000000000..751adf33dd04be4b16a9c0e5078264994aa13aff --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js @@ -0,0 +1,90 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { TimeoutTimer } from '../../../common/async.js'; +import { Disposable } from '../../../common/lifecycle.js'; +export class ScrollbarVisibilityController extends Disposable { + constructor(visibility, visibleClassName, invisibleClassName) { + super(); + this._visibility = visibility; + this._visibleClassName = visibleClassName; + this._invisibleClassName = invisibleClassName; + this._domNode = null; + this._isVisible = false; + this._isNeeded = false; + this._rawShouldBeVisible = false; + this._shouldBeVisible = false; + this._revealTimer = this._register(new TimeoutTimer()); + } + setVisibility(visibility) { + if (this._visibility !== visibility) { + this._visibility = visibility; + this._updateShouldBeVisible(); + } + } + // ----------------- Hide / Reveal + setShouldBeVisible(rawShouldBeVisible) { + this._rawShouldBeVisible = rawShouldBeVisible; + this._updateShouldBeVisible(); + } + _applyVisibilitySetting() { + if (this._visibility === 2 /* ScrollbarVisibility.Hidden */) { + return false; + } + if (this._visibility === 3 /* ScrollbarVisibility.Visible */) { + return true; + } + return this._rawShouldBeVisible; + } + _updateShouldBeVisible() { + const shouldBeVisible = this._applyVisibilitySetting(); + if (this._shouldBeVisible !== shouldBeVisible) { + this._shouldBeVisible = shouldBeVisible; + this.ensureVisibility(); + } + } + setIsNeeded(isNeeded) { + if (this._isNeeded !== isNeeded) { + this._isNeeded = isNeeded; + this.ensureVisibility(); + } + } + setDomNode(domNode) { + this._domNode = domNode; + this._domNode.setClassName(this._invisibleClassName); + // Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration + this.setShouldBeVisible(false); + } + ensureVisibility() { + if (!this._isNeeded) { + // Nothing to be rendered + this._hide(false); + return; + } + if (this._shouldBeVisible) { + this._reveal(); + } + else { + this._hide(true); + } + } + _reveal() { + if (this._isVisible) { + return; + } + this._isVisible = true; + // The CSS animation doesn't play otherwise + this._revealTimer.setIfNotSet(() => { + this._domNode?.setClassName(this._visibleClassName); + }, 0); + } + _hide(withFadeAway) { + this._revealTimer.cancel(); + if (!this._isVisible) { + return; + } + this._isVisible = false; + this._domNode?.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : '')); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js new file mode 100644 index 0000000000000000000000000000000000000000..29470d53d0bead0bbfe8f9fa8baf4bc6411a6f6c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { StandardWheelEvent } from '../../mouseEvent.js'; +import { AbstractScrollbar } from './abstractScrollbar.js'; +import { ARROW_IMG_SIZE } from './scrollbarArrow.js'; +import { ScrollbarState } from './scrollbarState.js'; +import { Codicon } from '../../../common/codicons.js'; +export class VerticalScrollbar extends AbstractScrollbar { + constructor(scrollable, options, host) { + const scrollDimensions = scrollable.getScrollDimensions(); + const scrollPosition = scrollable.getCurrentScrollPosition(); + super({ + lazyRender: options.lazyRender, + host: host, + scrollbarState: new ScrollbarState((options.verticalHasArrows ? options.arrowSize : 0), (options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize), + // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom + 0, scrollDimensions.height, scrollDimensions.scrollHeight, scrollPosition.scrollTop), + visibility: options.vertical, + extraScrollbarClassName: 'vertical', + scrollable: scrollable, + scrollByPage: options.scrollByPage + }); + if (options.verticalHasArrows) { + const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2; + const scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2; + this._createArrow({ + className: 'scra', + icon: Codicon.scrollbarButtonUp, + top: arrowDelta, + left: scrollbarDelta, + bottom: undefined, + right: undefined, + bgWidth: options.verticalScrollbarSize, + bgHeight: options.arrowSize, + onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1)), + }); + this._createArrow({ + className: 'scra', + icon: Codicon.scrollbarButtonDown, + top: undefined, + left: scrollbarDelta, + bottom: arrowDelta, + right: undefined, + bgWidth: options.verticalScrollbarSize, + bgHeight: options.arrowSize, + onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1)), + }); + } + this._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined); + } + _updateSlider(sliderSize, sliderPosition) { + this.slider.setHeight(sliderSize); + this.slider.setTop(sliderPosition); + } + _renderDomNode(largeSize, smallSize) { + this.domNode.setWidth(smallSize); + this.domNode.setHeight(largeSize); + this.domNode.setRight(0); + this.domNode.setTop(0); + } + onDidScroll(e) { + this._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender; + this._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender; + this._shouldRender = this._onElementSize(e.height) || this._shouldRender; + return this._shouldRender; + } + _pointerDownRelativePosition(offsetX, offsetY) { + return offsetY; + } + _sliderPointerPosition(e) { + return e.pageY; + } + _sliderOrthogonalPointerPosition(e) { + return e.pageX; + } + _updateScrollbarSize(size) { + this.slider.setWidth(size); + } + writeScrollPosition(target, scrollPosition) { + target.scrollTop = scrollPosition; + } + updateOptions(options) { + this.updateScrollbarSize(options.vertical === 2 /* ScrollbarVisibility.Hidden */ ? 0 : options.verticalScrollbarSize); + // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom + this._scrollbarState.setOppositeScrollbarSize(0); + this._visibilityController.setVisibility(options.vertical); + this._scrollByPage = options.scrollByPage; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.css new file mode 100644 index 0000000000000000000000000000000000000000..55910937a00c8fcd37d1fb4ecc617fd74553779a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.css @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-select-box { + width: 100%; + cursor: pointer; + border-radius: 2px; +} + +.monaco-select-box-dropdown-container { + font-size: 13px; + font-weight: normal; + text-transform: none; +} + +/** Actions */ + +.monaco-action-bar .action-item.select-container { + cursor: default; +} + +.monaco-action-bar .action-item .monaco-select-box { + cursor: pointer; + min-width: 100px; + min-height: 18px; + padding: 2px 23px 2px 8px; +} + +.mac .monaco-action-bar .action-item .monaco-select-box { + font-size: 11px; + border-radius: 5px; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.js new file mode 100644 index 0000000000000000000000000000000000000000..320378880370c26a3c8fec83579ed5a7a6b5d1a0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.js @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { SelectBoxList } from './selectBoxCustom.js'; +import { SelectBoxNative } from './selectBoxNative.js'; +import { Widget } from '../widget.js'; +import { isMacintosh } from '../../../common/platform.js'; +import './selectBox.css'; +export class SelectBox extends Widget { + constructor(options, selected, contextViewProvider, styles, selectBoxOptions) { + super(); + // Default to native SelectBox for OSX unless overridden + if (isMacintosh && !selectBoxOptions?.useCustomDrawn) { + this.selectBoxDelegate = new SelectBoxNative(options, selected, styles, selectBoxOptions); + } + else { + this.selectBoxDelegate = new SelectBoxList(options, selected, contextViewProvider, styles, selectBoxOptions); + } + this._register(this.selectBoxDelegate); + } + // Public SelectBox Methods - routed through delegate interface + get onDidSelect() { + return this.selectBoxDelegate.onDidSelect; + } + setOptions(options, selected) { + this.selectBoxDelegate.setOptions(options, selected); + } + select(index) { + this.selectBoxDelegate.select(index); + } + focus() { + this.selectBoxDelegate.focus(); + } + blur() { + this.selectBoxDelegate.blur(); + } + setFocusable(focusable) { + this.selectBoxDelegate.setFocusable(focusable); + } + render(container) { + this.selectBoxDelegate.render(container); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css new file mode 100644 index 0000000000000000000000000000000000000000..292cd2dd1e19e2a127ed8c8ab00eb8e5a6a1c10b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css @@ -0,0 +1,126 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/* Use custom CSS vars to expose padding into parent select for padding calculation */ +.monaco-select-box-dropdown-padding { + --dropdown-padding-top: 1px; + --dropdown-padding-bottom: 1px; +} + +.hc-black .monaco-select-box-dropdown-padding, +.hc-light .monaco-select-box-dropdown-padding { + --dropdown-padding-top: 3px; + --dropdown-padding-bottom: 4px; +} + +.monaco-select-box-dropdown-container { + display: none; + box-sizing: border-box; +} + +.monaco-select-box-dropdown-container > .select-box-details-pane > .select-box-description-markdown * { + margin: 0; +} + +.monaco-select-box-dropdown-container > .select-box-details-pane > .select-box-description-markdown a:focus { + outline: 1px solid -webkit-focus-ring-color; + outline-offset: -1px; +} + +.monaco-select-box-dropdown-container > .select-box-details-pane > .select-box-description-markdown code { + line-height: 15px; /** For some reason, this is needed, otherwise will take up 20px height */ + font-family: var(--monaco-monospace-font); +} + + +.monaco-select-box-dropdown-container.visible { + display: flex; + flex-direction: column; + text-align: left; + width: 1px; + overflow: hidden; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-list-container { + flex: 0 0 auto; + align-self: flex-start; + padding-top: var(--dropdown-padding-top); + padding-bottom: var(--dropdown-padding-bottom); + padding-left: 1px; + padding-right: 1px; + width: 100%; + overflow: hidden; + box-sizing: border-box; +} + +.monaco-select-box-dropdown-container > .select-box-details-pane { + padding: 5px; +} + +.hc-black .monaco-select-box-dropdown-container > .select-box-dropdown-list-container { + padding-top: var(--dropdown-padding-top); + padding-bottom: var(--dropdown-padding-bottom); +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row { + cursor: pointer; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row > .option-text { + text-overflow: ellipsis; + overflow: hidden; + padding-left: 3.5px; + white-space: nowrap; + float: left; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row > .option-detail { + text-overflow: ellipsis; + overflow: hidden; + padding-left: 3.5px; + white-space: nowrap; + float: left; + opacity: 0.7; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row > .option-decorator-right { + text-overflow: ellipsis; + overflow: hidden; + padding-right: 10px; + white-space: nowrap; + float: right; +} + + +/* Accepted CSS hiding technique for accessibility reader text */ +/* https://webaim.org/techniques/css/invisiblecontent/ */ + +.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row > .visually-hidden { + position: absolute; + left: -10000px; + top: auto; + width: 1px; + height: 1px; + overflow: hidden; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-container-width-control { + flex: 1 1 auto; + align-self: flex-start; + opacity: 0; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-container-width-control > .width-control-div { + overflow: hidden; + max-height: 0px; +} + +.monaco-select-box-dropdown-container > .select-box-dropdown-container-width-control > .width-control-div > .option-text-width-control { + padding-left: 4px; + padding-right: 8px; + white-space: nowrap; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js new file mode 100644 index 0000000000000000000000000000000000000000..de9c51a722be663f688b409c9dd59f77d99064e2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js @@ -0,0 +1,849 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { renderMarkdown } from '../../markdownRenderer.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { List } from '../list/listWidget.js'; +import * as arrays from '../../../common/arrays.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { KeyCodeUtils } from '../../../common/keyCodes.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import { isMacintosh } from '../../../common/platform.js'; +import './selectBoxCustom.css'; +import { localize } from '../../../../nls.js'; +const $ = dom.$; +const SELECT_OPTION_ENTRY_TEMPLATE_ID = 'selectOption.entry.template'; +class SelectListRenderer { + get templateId() { return SELECT_OPTION_ENTRY_TEMPLATE_ID; } + renderTemplate(container) { + const data = Object.create(null); + data.root = container; + data.text = dom.append(container, $('.option-text')); + data.detail = dom.append(container, $('.option-detail')); + data.decoratorRight = dom.append(container, $('.option-decorator-right')); + return data; + } + renderElement(element, index, templateData) { + const data = templateData; + const text = element.text; + const detail = element.detail; + const decoratorRight = element.decoratorRight; + const isDisabled = element.isDisabled; + data.text.textContent = text; + data.detail.textContent = !!detail ? detail : ''; + data.decoratorRight.innerText = !!decoratorRight ? decoratorRight : ''; + // pseudo-select disabled option + if (isDisabled) { + data.root.classList.add('option-disabled'); + } + else { + // Make sure we do class removal from prior template rendering + data.root.classList.remove('option-disabled'); + } + } + disposeTemplate(_templateData) { + // noop + } +} +export class SelectBoxList extends Disposable { + static { this.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN = 32; } + static { this.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN = 2; } + static { this.DEFAULT_MINIMUM_VISIBLE_OPTIONS = 3; } + constructor(options, selected, contextViewProvider, styles, selectBoxOptions) { + super(); + this.options = []; + this._currentSelection = 0; + this._hasDetails = false; + this._skipLayout = false; + this._sticky = false; // for dev purposes only + this._isVisible = false; + this.styles = styles; + this.selectBoxOptions = selectBoxOptions || Object.create(null); + if (typeof this.selectBoxOptions.minBottomMargin !== 'number') { + this.selectBoxOptions.minBottomMargin = SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN; + } + else if (this.selectBoxOptions.minBottomMargin < 0) { + this.selectBoxOptions.minBottomMargin = 0; + } + this.selectElement = document.createElement('select'); + // Use custom CSS vars for padding calculation + this.selectElement.className = 'monaco-select-box monaco-select-box-dropdown-padding'; + if (typeof this.selectBoxOptions.ariaLabel === 'string') { + this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel); + } + if (typeof this.selectBoxOptions.ariaDescription === 'string') { + this.selectElement.setAttribute('aria-description', this.selectBoxOptions.ariaDescription); + } + this._onDidSelect = new Emitter(); + this._register(this._onDidSelect); + this.registerListeners(); + this.constructSelectDropDown(contextViewProvider); + this.selected = selected || 0; + if (options) { + this.setOptions(options, selected); + } + this.initStyleSheet(); + } + setTitle(title) { + if (!this._hover && title) { + this._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate('mouse'), this.selectElement, title)); + } + else if (this._hover) { + this._hover.update(title); + } + } + // IDelegate - List renderer + getHeight() { + return 22; + } + getTemplateId() { + return SELECT_OPTION_ENTRY_TEMPLATE_ID; + } + constructSelectDropDown(contextViewProvider) { + // SetUp ContextView container to hold select Dropdown + this.contextViewProvider = contextViewProvider; + this.selectDropDownContainer = dom.$('.monaco-select-box-dropdown-container'); + // Use custom CSS vars for padding calculation (shared with parent select) + this.selectDropDownContainer.classList.add('monaco-select-box-dropdown-padding'); + // Setup container for select option details + this.selectionDetailsPane = dom.append(this.selectDropDownContainer, $('.select-box-details-pane')); + // Create span flex box item/div we can measure and control + const widthControlOuterDiv = dom.append(this.selectDropDownContainer, $('.select-box-dropdown-container-width-control')); + const widthControlInnerDiv = dom.append(widthControlOuterDiv, $('.width-control-div')); + this.widthControlElement = document.createElement('span'); + this.widthControlElement.className = 'option-text-width-control'; + dom.append(widthControlInnerDiv, this.widthControlElement); + // Always default to below position + this._dropDownPosition = 0 /* AnchorPosition.BELOW */; + // Inline stylesheet for themes + this.styleElement = dom.createStyleSheet(this.selectDropDownContainer); + // Prevent dragging of dropdown #114329 + this.selectDropDownContainer.setAttribute('draggable', 'true'); + this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.DRAG_START, (e) => { + dom.EventHelper.stop(e, true); + })); + } + registerListeners() { + // Parent native select keyboard listeners + this._register(dom.addStandardDisposableListener(this.selectElement, 'change', (e) => { + this.selected = e.target.selectedIndex; + this._onDidSelect.fire({ + index: e.target.selectedIndex, + selected: e.target.value + }); + if (!!this.options[this.selected] && !!this.options[this.selected].text) { + this.setTitle(this.options[this.selected].text); + } + })); + // Have to implement both keyboard and mouse controllers to handle disabled options + // Intercept mouse events to override normal select actions on parents + this._register(dom.addDisposableListener(this.selectElement, dom.EventType.CLICK, (e) => { + dom.EventHelper.stop(e); + if (this._isVisible) { + this.hideSelectDropDown(true); + } + else { + this.showSelectDropDown(); + } + })); + this._register(dom.addDisposableListener(this.selectElement, dom.EventType.MOUSE_DOWN, (e) => { + dom.EventHelper.stop(e); + })); + // Intercept touch events + // The following implementation is slightly different from the mouse event handlers above. + // Use the following helper variable, otherwise the list flickers. + let listIsVisibleOnTouchStart; + this._register(dom.addDisposableListener(this.selectElement, 'touchstart', (e) => { + listIsVisibleOnTouchStart = this._isVisible; + })); + this._register(dom.addDisposableListener(this.selectElement, 'touchend', (e) => { + dom.EventHelper.stop(e); + if (listIsVisibleOnTouchStart) { + this.hideSelectDropDown(true); + } + else { + this.showSelectDropDown(); + } + })); + // Intercept keyboard handling + this._register(dom.addDisposableListener(this.selectElement, dom.EventType.KEY_DOWN, (e) => { + const event = new StandardKeyboardEvent(e); + let showDropDown = false; + // Create and drop down select list on keyboard select + if (isMacintosh) { + if (event.keyCode === 18 /* KeyCode.DownArrow */ || event.keyCode === 16 /* KeyCode.UpArrow */ || event.keyCode === 10 /* KeyCode.Space */ || event.keyCode === 3 /* KeyCode.Enter */) { + showDropDown = true; + } + } + else { + if (event.keyCode === 18 /* KeyCode.DownArrow */ && event.altKey || event.keyCode === 16 /* KeyCode.UpArrow */ && event.altKey || event.keyCode === 10 /* KeyCode.Space */ || event.keyCode === 3 /* KeyCode.Enter */) { + showDropDown = true; + } + } + if (showDropDown) { + this.showSelectDropDown(); + dom.EventHelper.stop(e, true); + } + })); + } + get onDidSelect() { + return this._onDidSelect.event; + } + setOptions(options, selected) { + if (!arrays.equals(this.options, options)) { + this.options = options; + this.selectElement.options.length = 0; + this._hasDetails = false; + this._cachedMaxDetailsHeight = undefined; + this.options.forEach((option, index) => { + this.selectElement.add(this.createOption(option.text, index, option.isDisabled)); + if (typeof option.description === 'string') { + this._hasDetails = true; + } + }); + } + if (selected !== undefined) { + this.select(selected); + // Set current = selected since this is not necessarily a user exit + this._currentSelection = this.selected; + } + } + setOptionsList() { + // Mirror options in drop-down + // Populate select list for non-native select mode + this.selectList?.splice(0, this.selectList.length, this.options); + } + select(index) { + if (index >= 0 && index < this.options.length) { + this.selected = index; + } + else if (index > this.options.length - 1) { + // Adjust index to end of list + // This could make client out of sync with the select + this.select(this.options.length - 1); + } + else if (this.selected < 0) { + this.selected = 0; + } + this.selectElement.selectedIndex = this.selected; + if (!!this.options[this.selected] && !!this.options[this.selected].text) { + this.setTitle(this.options[this.selected].text); + } + } + focus() { + if (this.selectElement) { + this.selectElement.tabIndex = 0; + this.selectElement.focus(); + } + } + blur() { + if (this.selectElement) { + this.selectElement.tabIndex = -1; + this.selectElement.blur(); + } + } + setFocusable(focusable) { + this.selectElement.tabIndex = focusable ? 0 : -1; + } + render(container) { + this.container = container; + container.classList.add('select-container'); + container.appendChild(this.selectElement); + this.styleSelectElement(); + } + initStyleSheet() { + const content = []; + // Style non-native select mode + if (this.styles.listFocusBackground) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`); + } + if (this.styles.listFocusForeground) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`); + } + if (this.styles.decoratorRightForeground) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`); + } + if (this.styles.selectBackground && this.styles.selectBorder && this.styles.selectBorder !== this.styles.selectBackground) { + content.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `); + content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `); + content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `); + } + else if (this.styles.selectListBorder) { + content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `); + content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `); + } + // Hover foreground - ignore for disabled options + if (this.styles.listHoverForeground) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`); + } + // Hover background - ignore for disabled options + if (this.styles.listHoverBackground) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`); + } + // Match quick input outline styles - ignore for disabled options + if (this.styles.listFocusOutline) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`); + } + if (this.styles.listHoverOutline) { + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`); + } + // Clear list styles on focus and on hover for disabled options + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }`); + content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }`); + this.styleElement.textContent = content.join('\n'); + } + styleSelectElement() { + const background = this.styles.selectBackground ?? ''; + const foreground = this.styles.selectForeground ?? ''; + const border = this.styles.selectBorder ?? ''; + this.selectElement.style.backgroundColor = background; + this.selectElement.style.color = foreground; + this.selectElement.style.borderColor = border; + } + styleList() { + const background = this.styles.selectBackground ?? ''; + const listBackground = dom.asCssValueWithDefault(this.styles.selectListBackground, background); + this.selectDropDownListContainer.style.backgroundColor = listBackground; + this.selectionDetailsPane.style.backgroundColor = listBackground; + const optionsBorder = this.styles.focusBorder ?? ''; + this.selectDropDownContainer.style.outlineColor = optionsBorder; + this.selectDropDownContainer.style.outlineOffset = '-1px'; + this.selectList.style(this.styles); + } + createOption(value, index, disabled) { + const option = document.createElement('option'); + option.value = value; + option.text = value; + option.disabled = !!disabled; + return option; + } + // ContextView dropdown methods + showSelectDropDown() { + this.selectionDetailsPane.innerText = ''; + if (!this.contextViewProvider || this._isVisible) { + return; + } + // Lazily create and populate list only at open, moved from constructor + this.createSelectList(this.selectDropDownContainer); + this.setOptionsList(); + // This allows us to flip the position based on measurement + // Set drop-down position above/below from required height and margins + // If pre-layout cannot fit at least one option do not show drop-down + this.contextViewProvider.showContextView({ + getAnchor: () => this.selectElement, + render: (container) => this.renderSelectDropDown(container, true), + layout: () => { + this.layoutSelectDropDown(); + }, + onHide: () => { + this.selectDropDownContainer.classList.remove('visible'); + this.selectElement.classList.remove('synthetic-focus'); + }, + anchorPosition: this._dropDownPosition + }, this.selectBoxOptions.optionsAsChildren ? this.container : undefined); + // Hide so we can relay out + this._isVisible = true; + this.hideSelectDropDown(false); + this.contextViewProvider.showContextView({ + getAnchor: () => this.selectElement, + render: (container) => this.renderSelectDropDown(container), + layout: () => this.layoutSelectDropDown(), + onHide: () => { + this.selectDropDownContainer.classList.remove('visible'); + this.selectElement.classList.remove('synthetic-focus'); + }, + anchorPosition: this._dropDownPosition + }, this.selectBoxOptions.optionsAsChildren ? this.container : undefined); + // Track initial selection the case user escape, blur + this._currentSelection = this.selected; + this._isVisible = true; + this.selectElement.setAttribute('aria-expanded', 'true'); + } + hideSelectDropDown(focusSelect) { + if (!this.contextViewProvider || !this._isVisible) { + return; + } + this._isVisible = false; + this.selectElement.setAttribute('aria-expanded', 'false'); + if (focusSelect) { + this.selectElement.focus(); + } + this.contextViewProvider.hideContextView(); + } + renderSelectDropDown(container, preLayoutPosition) { + container.appendChild(this.selectDropDownContainer); + // Pre-Layout allows us to change position + this.layoutSelectDropDown(preLayoutPosition); + return { + dispose: () => { + // contextView will dispose itself if moving from one View to another + this.selectDropDownContainer.remove(); // remove to take out the CSS rules we add + } + }; + } + // Iterate over detailed descriptions, find max height + measureMaxDetailsHeight() { + let maxDetailsPaneHeight = 0; + this.options.forEach((_option, index) => { + this.updateDetail(index); + if (this.selectionDetailsPane.offsetHeight > maxDetailsPaneHeight) { + maxDetailsPaneHeight = this.selectionDetailsPane.offsetHeight; + } + }); + return maxDetailsPaneHeight; + } + layoutSelectDropDown(preLayoutPosition) { + // Avoid recursion from layout called in onListFocus + if (this._skipLayout) { + return false; + } + // Layout ContextView drop down select list and container + // Have to manage our vertical overflow, sizing, position below or above + // Position has to be determined and set prior to contextView instantiation + if (this.selectList) { + // Make visible to enable measurements + this.selectDropDownContainer.classList.add('visible'); + const window = dom.getWindow(this.selectElement); + const selectPosition = dom.getDomNodePagePosition(this.selectElement); + const styles = dom.getWindow(this.selectElement).getComputedStyle(this.selectElement); + const verticalPadding = parseFloat(styles.getPropertyValue('--dropdown-padding-top')) + parseFloat(styles.getPropertyValue('--dropdown-padding-bottom')); + const maxSelectDropDownHeightBelow = (window.innerHeight - selectPosition.top - selectPosition.height - (this.selectBoxOptions.minBottomMargin || 0)); + const maxSelectDropDownHeightAbove = (selectPosition.top - SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN); + // Determine optimal width - min(longest option), opt(parent select, excluding margins), max(ContextView controlled) + const selectWidth = this.selectElement.offsetWidth; + const selectMinWidth = this.setWidthControlElement(this.widthControlElement); + const selectOptimalWidth = Math.max(selectMinWidth, Math.round(selectWidth)).toString() + 'px'; + this.selectDropDownContainer.style.width = selectOptimalWidth; + // Get initial list height and determine space above and below + this.selectList.getHTMLElement().style.height = ''; + this.selectList.layout(); + let listHeight = this.selectList.contentHeight; + if (this._hasDetails && this._cachedMaxDetailsHeight === undefined) { + this._cachedMaxDetailsHeight = this.measureMaxDetailsHeight(); + } + const maxDetailsPaneHeight = this._hasDetails ? this._cachedMaxDetailsHeight : 0; + const minRequiredDropDownHeight = listHeight + verticalPadding + maxDetailsPaneHeight; + const maxVisibleOptionsBelow = ((Math.floor((maxSelectDropDownHeightBelow - verticalPadding - maxDetailsPaneHeight) / this.getHeight()))); + const maxVisibleOptionsAbove = ((Math.floor((maxSelectDropDownHeightAbove - verticalPadding - maxDetailsPaneHeight) / this.getHeight()))); + // If we are only doing pre-layout check/adjust position only + // Calculate vertical space available, flip up if insufficient + // Use reflected padding on parent select, ContextView style + // properties not available before DOM attachment + if (preLayoutPosition) { + // Check if select moved out of viewport , do not open + // If at least one option cannot be shown, don't open the drop-down or hide/remove if open + if ((selectPosition.top + selectPosition.height) > (window.innerHeight - 22) + || selectPosition.top < SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN + || ((maxVisibleOptionsBelow < 1) && (maxVisibleOptionsAbove < 1))) { + // Indicate we cannot open + return false; + } + // Determine if we have to flip up + // Always show complete list items - never more than Max available vertical height + if (maxVisibleOptionsBelow < SelectBoxList.DEFAULT_MINIMUM_VISIBLE_OPTIONS + && maxVisibleOptionsAbove > maxVisibleOptionsBelow + && this.options.length > maxVisibleOptionsBelow) { + this._dropDownPosition = 1 /* AnchorPosition.ABOVE */; + this.selectDropDownListContainer.remove(); + this.selectionDetailsPane.remove(); + this.selectDropDownContainer.appendChild(this.selectionDetailsPane); + this.selectDropDownContainer.appendChild(this.selectDropDownListContainer); + this.selectionDetailsPane.classList.remove('border-top'); + this.selectionDetailsPane.classList.add('border-bottom'); + } + else { + this._dropDownPosition = 0 /* AnchorPosition.BELOW */; + this.selectDropDownListContainer.remove(); + this.selectionDetailsPane.remove(); + this.selectDropDownContainer.appendChild(this.selectDropDownListContainer); + this.selectDropDownContainer.appendChild(this.selectionDetailsPane); + this.selectionDetailsPane.classList.remove('border-bottom'); + this.selectionDetailsPane.classList.add('border-top'); + } + // Do full layout on showSelectDropDown only + return true; + } + // Check if select out of viewport or cutting into status bar + if ((selectPosition.top + selectPosition.height) > (window.innerHeight - 22) + || selectPosition.top < SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN + || (this._dropDownPosition === 0 /* AnchorPosition.BELOW */ && maxVisibleOptionsBelow < 1) + || (this._dropDownPosition === 1 /* AnchorPosition.ABOVE */ && maxVisibleOptionsAbove < 1)) { + // Cannot properly layout, close and hide + this.hideSelectDropDown(true); + return false; + } + // SetUp list dimensions and layout - account for container padding + // Use position to check above or below available space + if (this._dropDownPosition === 0 /* AnchorPosition.BELOW */) { + if (this._isVisible && maxVisibleOptionsBelow + maxVisibleOptionsAbove < 1) { + // If drop-down is visible, must be doing a DOM re-layout, hide since we don't fit + // Hide drop-down, hide contextview, focus on parent select + this.hideSelectDropDown(true); + return false; + } + // Adjust list height to max from select bottom to margin (default/minBottomMargin) + if (minRequiredDropDownHeight > maxSelectDropDownHeightBelow) { + listHeight = (maxVisibleOptionsBelow * this.getHeight()); + } + } + else { + if (minRequiredDropDownHeight > maxSelectDropDownHeightAbove) { + listHeight = (maxVisibleOptionsAbove * this.getHeight()); + } + } + // Set adjusted list height and relayout + this.selectList.layout(listHeight); + this.selectList.domFocus(); + // Finally set focus on selected item + if (this.selectList.length > 0) { + this.selectList.setFocus([this.selected || 0]); + this.selectList.reveal(this.selectList.getFocus()[0] || 0); + } + if (this._hasDetails) { + // Leave the selectDropDownContainer to size itself according to children (list + details) - #57447 + this.selectList.getHTMLElement().style.height = (listHeight + verticalPadding) + 'px'; + this.selectDropDownContainer.style.height = ''; + } + else { + this.selectDropDownContainer.style.height = (listHeight + verticalPadding) + 'px'; + } + this.updateDetail(this.selected); + this.selectDropDownContainer.style.width = selectOptimalWidth; + // Maintain focus outline on parent select as well as list container - tabindex for focus + this.selectDropDownListContainer.setAttribute('tabindex', '0'); + this.selectElement.classList.add('synthetic-focus'); + this.selectDropDownContainer.classList.add('synthetic-focus'); + return true; + } + else { + return false; + } + } + setWidthControlElement(container) { + let elementWidth = 0; + if (container) { + let longest = 0; + let longestLength = 0; + this.options.forEach((option, index) => { + const detailLength = !!option.detail ? option.detail.length : 0; + const rightDecoratorLength = !!option.decoratorRight ? option.decoratorRight.length : 0; + const len = option.text.length + detailLength + rightDecoratorLength; + if (len > longestLength) { + longest = index; + longestLength = len; + } + }); + container.textContent = this.options[longest].text + (!!this.options[longest].decoratorRight ? (this.options[longest].decoratorRight + ' ') : ''); + elementWidth = dom.getTotalWidth(container); + } + return elementWidth; + } + createSelectList(parent) { + // If we have already constructive list on open, skip + if (this.selectList) { + return; + } + // SetUp container for list + this.selectDropDownListContainer = dom.append(parent, $('.select-box-dropdown-list-container')); + this.listRenderer = new SelectListRenderer(); + this.selectList = this._register(new List('SelectBoxCustom', this.selectDropDownListContainer, this, [this.listRenderer], { + useShadows: false, + verticalScrollMode: 3 /* ScrollbarVisibility.Visible */, + keyboardSupport: false, + mouseSupport: false, + accessibilityProvider: { + getAriaLabel: element => { + let label = element.text; + if (element.detail) { + label += `. ${element.detail}`; + } + if (element.decoratorRight) { + label += `. ${element.decoratorRight}`; + } + if (element.description) { + label += `. ${element.description}`; + } + return label; + }, + getWidgetAriaLabel: () => localize({ key: 'selectBox', comment: ['Behave like native select dropdown element.'] }, "Select Box"), + getRole: () => isMacintosh ? '' : 'option', + getWidgetRole: () => 'listbox' + } + })); + if (this.selectBoxOptions.ariaLabel) { + this.selectList.ariaLabel = this.selectBoxOptions.ariaLabel; + } + // SetUp list keyboard controller - control navigation, disabled items, focus + const onKeyDown = this._register(new DomEmitter(this.selectDropDownListContainer, 'keydown')); + const onSelectDropDownKeyDown = Event.chain(onKeyDown.event, $ => $.filter(() => this.selectList.length > 0) + .map(e => new StandardKeyboardEvent(e))); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 3 /* KeyCode.Enter */))(this.onEnter, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 2 /* KeyCode.Tab */))(this.onEnter, this)); // Tab should behave the same as enter, #79339 + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 9 /* KeyCode.Escape */))(this.onEscape, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 16 /* KeyCode.UpArrow */))(this.onUpArrow, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 18 /* KeyCode.DownArrow */))(this.onDownArrow, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 12 /* KeyCode.PageDown */))(this.onPageDown, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 11 /* KeyCode.PageUp */))(this.onPageUp, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 14 /* KeyCode.Home */))(this.onHome, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => e.keyCode === 13 /* KeyCode.End */))(this.onEnd, this)); + this._register(Event.chain(onSelectDropDownKeyDown, $ => $.filter(e => (e.keyCode >= 21 /* KeyCode.Digit0 */ && e.keyCode <= 56 /* KeyCode.KeyZ */) || (e.keyCode >= 85 /* KeyCode.Semicolon */ && e.keyCode <= 113 /* KeyCode.NumpadDivide */)))(this.onCharacter, this)); + // SetUp list mouse controller - control navigation, disabled items, focus + this._register(dom.addDisposableListener(this.selectList.getHTMLElement(), dom.EventType.POINTER_UP, e => this.onPointerUp(e))); + this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index]))); + this._register(this.selectList.onDidChangeFocus(e => this.onListFocus(e))); + this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.FOCUS_OUT, e => { + if (!this._isVisible || dom.isAncestor(e.relatedTarget, this.selectDropDownContainer)) { + return; + } + this.onListBlur(); + })); + this.selectList.getHTMLElement().setAttribute('aria-label', this.selectBoxOptions.ariaLabel || ''); + this.selectList.getHTMLElement().setAttribute('aria-expanded', 'true'); + this.styleList(); + } + // List methods + // List mouse controller - active exit, select option, fire onDidSelect if change, return focus to parent select + // Also takes in touchend events + onPointerUp(e) { + if (!this.selectList.length) { + return; + } + dom.EventHelper.stop(e); + const target = e.target; + if (!target) { + return; + } + // Check our mouse event is on an option (not scrollbar) + if (target.classList.contains('slider')) { + return; + } + const listRowElement = target.closest('.monaco-list-row'); + if (!listRowElement) { + return; + } + const index = Number(listRowElement.getAttribute('data-index')); + const disabled = listRowElement.classList.contains('option-disabled'); + // Ignore mouse selection of disabled options + if (index >= 0 && index < this.options.length && !disabled) { + this.selected = index; + this.select(this.selected); + this.selectList.setFocus([this.selected]); + this.selectList.reveal(this.selectList.getFocus()[0]); + // Only fire if selection change + if (this.selected !== this._currentSelection) { + // Set current = selected + this._currentSelection = this.selected; + this._onDidSelect.fire({ + index: this.selectElement.selectedIndex, + selected: this.options[this.selected].text + }); + if (!!this.options[this.selected] && !!this.options[this.selected].text) { + this.setTitle(this.options[this.selected].text); + } + } + this.hideSelectDropDown(true); + } + } + // List Exit - passive - implicit no selection change, hide drop-down + onListBlur() { + if (this._sticky) { + return; + } + if (this.selected !== this._currentSelection) { + // Reset selected to current if no change + this.select(this._currentSelection); + } + this.hideSelectDropDown(false); + } + renderDescriptionMarkdown(text, actionHandler) { + const cleanRenderedMarkdown = (element) => { + for (let i = 0; i < element.childNodes.length; i++) { + const child = element.childNodes.item(i); + const tagName = child.tagName && child.tagName.toLowerCase(); + if (tagName === 'img') { + child.remove(); + } + else { + cleanRenderedMarkdown(child); + } + } + }; + const rendered = renderMarkdown({ value: text, supportThemeIcons: true }, { actionHandler }); + rendered.element.classList.add('select-box-description-markdown'); + cleanRenderedMarkdown(rendered.element); + return rendered.element; + } + // List Focus Change - passive - update details pane with newly focused element's data + onListFocus(e) { + // Skip during initial layout + if (!this._isVisible || !this._hasDetails) { + return; + } + this.updateDetail(e.indexes[0]); + } + updateDetail(selectedIndex) { + this.selectionDetailsPane.innerText = ''; + const option = this.options[selectedIndex]; + const description = option?.description ?? ''; + const descriptionIsMarkdown = option?.descriptionIsMarkdown ?? false; + if (description) { + if (descriptionIsMarkdown) { + const actionHandler = option.descriptionMarkdownActionHandler; + this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description, actionHandler)); + } + else { + this.selectionDetailsPane.innerText = description; + } + this.selectionDetailsPane.style.display = 'block'; + } + else { + this.selectionDetailsPane.style.display = 'none'; + } + // Avoid recursion + this._skipLayout = true; + this.contextViewProvider.layout(); + this._skipLayout = false; + } + // List keyboard controller + // List exit - active - hide ContextView dropdown, reset selection, return focus to parent select + onEscape(e) { + dom.EventHelper.stop(e); + // Reset selection to value when opened + this.select(this._currentSelection); + this.hideSelectDropDown(true); + } + // List exit - active - hide ContextView dropdown, return focus to parent select, fire onDidSelect if change + onEnter(e) { + dom.EventHelper.stop(e); + // Only fire if selection change + if (this.selected !== this._currentSelection) { + this._currentSelection = this.selected; + this._onDidSelect.fire({ + index: this.selectElement.selectedIndex, + selected: this.options[this.selected].text + }); + if (!!this.options[this.selected] && !!this.options[this.selected].text) { + this.setTitle(this.options[this.selected].text); + } + } + this.hideSelectDropDown(true); + } + // List navigation - have to handle a disabled option (jump over) + onDownArrow(e) { + if (this.selected < this.options.length - 1) { + dom.EventHelper.stop(e, true); + // Skip disabled options + const nextOptionDisabled = this.options[this.selected + 1].isDisabled; + if (nextOptionDisabled && this.options.length > this.selected + 2) { + this.selected += 2; + } + else if (nextOptionDisabled) { + return; + } + else { + this.selected++; + } + // Set focus/selection - only fire event when closing drop-down or on blur + this.select(this.selected); + this.selectList.setFocus([this.selected]); + this.selectList.reveal(this.selectList.getFocus()[0]); + } + } + onUpArrow(e) { + if (this.selected > 0) { + dom.EventHelper.stop(e, true); + // Skip disabled options + const previousOptionDisabled = this.options[this.selected - 1].isDisabled; + if (previousOptionDisabled && this.selected > 1) { + this.selected -= 2; + } + else { + this.selected--; + } + // Set focus/selection - only fire event when closing drop-down or on blur + this.select(this.selected); + this.selectList.setFocus([this.selected]); + this.selectList.reveal(this.selectList.getFocus()[0]); + } + } + onPageUp(e) { + dom.EventHelper.stop(e); + this.selectList.focusPreviousPage(); + // Allow scrolling to settle + setTimeout(() => { + this.selected = this.selectList.getFocus()[0]; + // Shift selection down if we land on a disabled option + if (this.options[this.selected].isDisabled && this.selected < this.options.length - 1) { + this.selected++; + this.selectList.setFocus([this.selected]); + } + this.selectList.reveal(this.selected); + this.select(this.selected); + }, 1); + } + onPageDown(e) { + dom.EventHelper.stop(e); + this.selectList.focusNextPage(); + // Allow scrolling to settle + setTimeout(() => { + this.selected = this.selectList.getFocus()[0]; + // Shift selection up if we land on a disabled option + if (this.options[this.selected].isDisabled && this.selected > 0) { + this.selected--; + this.selectList.setFocus([this.selected]); + } + this.selectList.reveal(this.selected); + this.select(this.selected); + }, 1); + } + onHome(e) { + dom.EventHelper.stop(e); + if (this.options.length < 2) { + return; + } + this.selected = 0; + if (this.options[this.selected].isDisabled && this.selected > 1) { + this.selected++; + } + this.selectList.setFocus([this.selected]); + this.selectList.reveal(this.selected); + this.select(this.selected); + } + onEnd(e) { + dom.EventHelper.stop(e); + if (this.options.length < 2) { + return; + } + this.selected = this.options.length - 1; + if (this.options[this.selected].isDisabled && this.selected > 1) { + this.selected--; + } + this.selectList.setFocus([this.selected]); + this.selectList.reveal(this.selected); + this.select(this.selected); + } + // Mimic option first character navigation of native select + onCharacter(e) { + const ch = KeyCodeUtils.toString(e.keyCode); + let optionIndex = -1; + for (let i = 0; i < this.options.length - 1; i++) { + optionIndex = (i + this.selected + 1) % this.options.length; + if (this.options[optionIndex].text.charAt(0).toUpperCase() === ch && !this.options[optionIndex].isDisabled) { + this.select(optionIndex); + this.selectList.setFocus([optionIndex]); + this.selectList.reveal(this.selectList.getFocus()[0]); + dom.EventHelper.stop(e); + break; + } + } + } + dispose() { + this.hideSelectDropDown(false); + super.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxNative.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxNative.js new file mode 100644 index 0000000000000000000000000000000000000000..60036a70699f02500677ec1518498bc02a50ab65 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxNative.js @@ -0,0 +1,139 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../../dom.js'; +import { EventType, Gesture } from '../../touch.js'; +import * as arrays from '../../../common/arrays.js'; +import { Emitter } from '../../../common/event.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import { isMacintosh } from '../../../common/platform.js'; +export class SelectBoxNative extends Disposable { + constructor(options, selected, styles, selectBoxOptions) { + super(); + this.selected = 0; + this.selectBoxOptions = selectBoxOptions || Object.create(null); + this.options = []; + this.selectElement = document.createElement('select'); + this.selectElement.className = 'monaco-select-box'; + if (typeof this.selectBoxOptions.ariaLabel === 'string') { + this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel); + } + if (typeof this.selectBoxOptions.ariaDescription === 'string') { + this.selectElement.setAttribute('aria-description', this.selectBoxOptions.ariaDescription); + } + this._onDidSelect = this._register(new Emitter()); + this.styles = styles; + this.registerListeners(); + this.setOptions(options, selected); + } + registerListeners() { + this._register(Gesture.addTarget(this.selectElement)); + [EventType.Tap].forEach(eventType => { + this._register(dom.addDisposableListener(this.selectElement, eventType, (e) => { + this.selectElement.focus(); + })); + }); + this._register(dom.addStandardDisposableListener(this.selectElement, 'click', (e) => { + dom.EventHelper.stop(e, true); + })); + this._register(dom.addStandardDisposableListener(this.selectElement, 'change', (e) => { + this.selectElement.title = e.target.value; + this._onDidSelect.fire({ + index: e.target.selectedIndex, + selected: e.target.value + }); + })); + this._register(dom.addStandardDisposableListener(this.selectElement, 'keydown', (e) => { + let showSelect = false; + if (isMacintosh) { + if (e.keyCode === 18 /* KeyCode.DownArrow */ || e.keyCode === 16 /* KeyCode.UpArrow */ || e.keyCode === 10 /* KeyCode.Space */) { + showSelect = true; + } + } + else { + if (e.keyCode === 18 /* KeyCode.DownArrow */ && e.altKey || e.keyCode === 10 /* KeyCode.Space */ || e.keyCode === 3 /* KeyCode.Enter */) { + showSelect = true; + } + } + if (showSelect) { + // Space, Enter, is used to expand select box, do not propagate it (prevent action bar action run) + e.stopPropagation(); + } + })); + } + get onDidSelect() { + return this._onDidSelect.event; + } + setOptions(options, selected) { + if (!this.options || !arrays.equals(this.options, options)) { + this.options = options; + this.selectElement.options.length = 0; + this.options.forEach((option, index) => { + this.selectElement.add(this.createOption(option.text, index, option.isDisabled)); + }); + } + if (selected !== undefined) { + this.select(selected); + } + } + select(index) { + if (this.options.length === 0) { + this.selected = 0; + } + else if (index >= 0 && index < this.options.length) { + this.selected = index; + } + else if (index > this.options.length - 1) { + // Adjust index to end of list + // This could make client out of sync with the select + this.select(this.options.length - 1); + } + else if (this.selected < 0) { + this.selected = 0; + } + this.selectElement.selectedIndex = this.selected; + if ((this.selected < this.options.length) && typeof this.options[this.selected].text === 'string') { + this.selectElement.title = this.options[this.selected].text; + } + else { + this.selectElement.title = ''; + } + } + focus() { + if (this.selectElement) { + this.selectElement.tabIndex = 0; + this.selectElement.focus(); + } + } + blur() { + if (this.selectElement) { + this.selectElement.tabIndex = -1; + this.selectElement.blur(); + } + } + setFocusable(focusable) { + this.selectElement.tabIndex = focusable ? 0 : -1; + } + render(container) { + container.classList.add('select-container'); + container.appendChild(this.selectElement); + this.setOptions(this.options, this.selected); + this.applyStyles(); + } + applyStyles() { + // Style native select + if (this.selectElement) { + this.selectElement.style.backgroundColor = this.styles.selectBackground ?? ''; + this.selectElement.style.color = this.styles.selectForeground ?? ''; + this.selectElement.style.borderColor = this.styles.selectBorder ?? ''; + } + } + createOption(value, index, disabled) { + const option = document.createElement('option'); + option.value = value; + option.text = value; + option.disabled = !!disabled; + return option; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.css new file mode 100644 index 0000000000000000000000000000000000000000..3af3e9062d2c9c13dd058da7d02d122164412681 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.css @@ -0,0 +1,70 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-split-view2 { + position: relative; + width: 100%; + height: 100%; +} + +.monaco-split-view2 > .sash-container { + position: absolute; + width: 100%; + height: 100%; + pointer-events: none; +} + +.monaco-split-view2 > .sash-container > .monaco-sash { + pointer-events: initial; +} + +.monaco-split-view2 > .monaco-scrollable-element { + width: 100%; + height: 100%; +} + +.monaco-split-view2 > .monaco-scrollable-element > .split-view-container { + width: 100%; + height: 100%; + white-space: nowrap; + position: relative; +} + +.monaco-split-view2 > .monaco-scrollable-element > .split-view-container > .split-view-view { + white-space: initial; + position: absolute; +} + +.monaco-split-view2 > .monaco-scrollable-element > .split-view-container > .split-view-view:not(.visible) { + display: none; +} + +.monaco-split-view2.vertical > .monaco-scrollable-element > .split-view-container > .split-view-view { + width: 100%; +} + +.monaco-split-view2.horizontal > .monaco-scrollable-element > .split-view-container > .split-view-view { + height: 100%; +} + +.monaco-split-view2.separator-border > .monaco-scrollable-element > .split-view-container > .split-view-view:not(:first-child)::before { + content: ' '; + position: absolute; + top: 0; + left: 0; + z-index: 5; + pointer-events: none; + background-color: var(--separator-border); +} + +.monaco-split-view2.separator-border.horizontal > .monaco-scrollable-element > .split-view-container > .split-view-view:not(:first-child)::before { + height: 100%; + width: 1px; +} + +.monaco-split-view2.separator-border.vertical > .monaco-scrollable-element > .split-view-container > .split-view-view:not(:first-child)::before { + height: 1px; + width: 100%; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js new file mode 100644 index 0000000000000000000000000000000000000000..6627e855f823588a0800a8da04682938eb39f917 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js @@ -0,0 +1,826 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { $, addDisposableListener, append, getWindow, scheduleAtNextAnimationFrame } from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { Sash } from '../sash/sash.js'; +import { SmoothScrollableElement } from '../scrollbar/scrollableElement.js'; +import { pushToEnd, pushToStart, range } from '../../../common/arrays.js'; +import { Color } from '../../../common/color.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { combinedDisposable, Disposable, dispose, toDisposable } from '../../../common/lifecycle.js'; +import { clamp } from '../../../common/numbers.js'; +import { Scrollable } from '../../../common/scrollable.js'; +import * as types from '../../../common/types.js'; +import './splitview.css'; +const defaultStyles = { + separatorBorder: Color.transparent +}; +class ViewItem { + set size(size) { + this._size = size; + } + get size() { + return this._size; + } + get visible() { + return typeof this._cachedVisibleSize === 'undefined'; + } + setVisible(visible, size) { + if (visible === this.visible) { + return; + } + if (visible) { + this.size = clamp(this._cachedVisibleSize, this.viewMinimumSize, this.viewMaximumSize); + this._cachedVisibleSize = undefined; + } + else { + this._cachedVisibleSize = typeof size === 'number' ? size : this.size; + this.size = 0; + } + this.container.classList.toggle('visible', visible); + try { + this.view.setVisible?.(visible); + } + catch (e) { + console.error('Splitview: Failed to set visible view'); + console.error(e); + } + } + get minimumSize() { return this.visible ? this.view.minimumSize : 0; } + get viewMinimumSize() { return this.view.minimumSize; } + get maximumSize() { return this.visible ? this.view.maximumSize : 0; } + get viewMaximumSize() { return this.view.maximumSize; } + get priority() { return this.view.priority; } + get proportionalLayout() { return this.view.proportionalLayout ?? true; } + get snap() { return !!this.view.snap; } + set enabled(enabled) { + this.container.style.pointerEvents = enabled ? '' : 'none'; + } + constructor(container, view, size, disposable) { + this.container = container; + this.view = view; + this.disposable = disposable; + this._cachedVisibleSize = undefined; + if (typeof size === 'number') { + this._size = size; + this._cachedVisibleSize = undefined; + container.classList.add('visible'); + } + else { + this._size = 0; + this._cachedVisibleSize = size.cachedVisibleSize; + } + } + layout(offset, layoutContext) { + this.layoutContainer(offset); + try { + this.view.layout(this.size, offset, layoutContext); + } + catch (e) { + console.error('Splitview: Failed to layout view'); + console.error(e); + } + } + dispose() { + this.disposable.dispose(); + } +} +class VerticalViewItem extends ViewItem { + layoutContainer(offset) { + this.container.style.top = `${offset}px`; + this.container.style.height = `${this.size}px`; + } +} +class HorizontalViewItem extends ViewItem { + layoutContainer(offset) { + this.container.style.left = `${offset}px`; + this.container.style.width = `${this.size}px`; + } +} +var State; +(function (State) { + State[State["Idle"] = 0] = "Idle"; + State[State["Busy"] = 1] = "Busy"; +})(State || (State = {})); +export var Sizing; +(function (Sizing) { + /** + * When adding or removing views, distribute the delta space among + * all other views. + */ + Sizing.Distribute = { type: 'distribute' }; + /** + * When adding or removing views, split the delta space with another + * specific view, indexed by the provided `index`. + */ + function Split(index) { return { type: 'split', index }; } + Sizing.Split = Split; + /** + * When adding a view, use DistributeSizing when all pre-existing views are + * distributed evenly, otherwise use SplitSizing. + */ + function Auto(index) { return { type: 'auto', index }; } + Sizing.Auto = Auto; + /** + * When adding or removing views, assume the view is invisible. + */ + function Invisible(cachedVisibleSize) { return { type: 'invisible', cachedVisibleSize }; } + Sizing.Invisible = Invisible; +})(Sizing || (Sizing = {})); +/** + * The {@link SplitView} is the UI component which implements a one dimensional + * flex-like layout algorithm for a collection of {@link IView} instances, which + * are essentially HTMLElement instances with the following size constraints: + * + * - {@link IView.minimumSize} + * - {@link IView.maximumSize} + * - {@link IView.priority} + * - {@link IView.snap} + * + * In case the SplitView doesn't have enough size to fit all views, it will overflow + * its content with a scrollbar. + * + * In between each pair of views there will be a {@link Sash} allowing the user + * to resize the views, making sure the constraints are respected. + * + * An optional {@link TLayoutContext layout context type} may be used in order to + * pass along layout contextual data from the {@link SplitView.layout} method down + * to each view's {@link IView.layout} calls. + * + * Features: + * - Flex-like layout algorithm + * - Snap support + * - Orthogonal sash support, for corner sashes + * - View hide/show support + * - View swap/move support + * - Alt key modifier behavior, macOS style + */ +export class SplitView extends Disposable { + get orthogonalStartSash() { return this._orthogonalStartSash; } + get orthogonalEndSash() { return this._orthogonalEndSash; } + get startSnappingEnabled() { return this._startSnappingEnabled; } + get endSnappingEnabled() { return this._endSnappingEnabled; } + /** + * A reference to a sash, perpendicular to all sashes in this {@link SplitView}, + * located at the left- or top-most side of the SplitView. + * Corner sashes will be created automatically at the intersections. + */ + set orthogonalStartSash(sash) { + for (const sashItem of this.sashItems) { + sashItem.sash.orthogonalStartSash = sash; + } + this._orthogonalStartSash = sash; + } + /** + * A reference to a sash, perpendicular to all sashes in this {@link SplitView}, + * located at the right- or bottom-most side of the SplitView. + * Corner sashes will be created automatically at the intersections. + */ + set orthogonalEndSash(sash) { + for (const sashItem of this.sashItems) { + sashItem.sash.orthogonalEndSash = sash; + } + this._orthogonalEndSash = sash; + } + /** + * Enable/disable snapping at the beginning of this {@link SplitView}. + */ + set startSnappingEnabled(startSnappingEnabled) { + if (this._startSnappingEnabled === startSnappingEnabled) { + return; + } + this._startSnappingEnabled = startSnappingEnabled; + this.updateSashEnablement(); + } + /** + * Enable/disable snapping at the end of this {@link SplitView}. + */ + set endSnappingEnabled(endSnappingEnabled) { + if (this._endSnappingEnabled === endSnappingEnabled) { + return; + } + this._endSnappingEnabled = endSnappingEnabled; + this.updateSashEnablement(); + } + /** + * Create a new {@link SplitView} instance. + */ + constructor(container, options = {}) { + super(); + this.size = 0; + this._contentSize = 0; + this.proportions = undefined; + this.viewItems = []; + this.sashItems = []; // used in tests + this.state = State.Idle; + this._onDidSashChange = this._register(new Emitter()); + this._onDidSashReset = this._register(new Emitter()); + this._startSnappingEnabled = true; + this._endSnappingEnabled = true; + /** + * Fires whenever the user resizes a {@link Sash sash}. + */ + this.onDidSashChange = this._onDidSashChange.event; + /** + * Fires whenever the user double clicks a {@link Sash sash}. + */ + this.onDidSashReset = this._onDidSashReset.event; + this.orientation = options.orientation ?? 0 /* Orientation.VERTICAL */; + this.inverseAltBehavior = options.inverseAltBehavior ?? false; + this.proportionalLayout = options.proportionalLayout ?? true; + this.getSashOrthogonalSize = options.getSashOrthogonalSize; + this.el = document.createElement('div'); + this.el.classList.add('monaco-split-view2'); + this.el.classList.add(this.orientation === 0 /* Orientation.VERTICAL */ ? 'vertical' : 'horizontal'); + container.appendChild(this.el); + this.sashContainer = append(this.el, $('.sash-container')); + this.viewContainer = $('.split-view-container'); + this.scrollable = this._register(new Scrollable({ + forceIntegerValues: true, + smoothScrollDuration: 125, + scheduleAtNextAnimationFrame: callback => scheduleAtNextAnimationFrame(getWindow(this.el), callback), + })); + this.scrollableElement = this._register(new SmoothScrollableElement(this.viewContainer, { + vertical: this.orientation === 0 /* Orientation.VERTICAL */ ? (options.scrollbarVisibility ?? 1 /* ScrollbarVisibility.Auto */) : 2 /* ScrollbarVisibility.Hidden */, + horizontal: this.orientation === 1 /* Orientation.HORIZONTAL */ ? (options.scrollbarVisibility ?? 1 /* ScrollbarVisibility.Auto */) : 2 /* ScrollbarVisibility.Hidden */ + }, this.scrollable)); + // https://github.com/microsoft/vscode/issues/157737 + const onDidScrollViewContainer = this._register(new DomEmitter(this.viewContainer, 'scroll')).event; + this._register(onDidScrollViewContainer(_ => { + const position = this.scrollableElement.getScrollPosition(); + const scrollLeft = Math.abs(this.viewContainer.scrollLeft - position.scrollLeft) <= 1 ? undefined : this.viewContainer.scrollLeft; + const scrollTop = Math.abs(this.viewContainer.scrollTop - position.scrollTop) <= 1 ? undefined : this.viewContainer.scrollTop; + if (scrollLeft !== undefined || scrollTop !== undefined) { + this.scrollableElement.setScrollPosition({ scrollLeft, scrollTop }); + } + })); + this.onDidScroll = this.scrollableElement.onScroll; + this._register(this.onDidScroll(e => { + if (e.scrollTopChanged) { + this.viewContainer.scrollTop = e.scrollTop; + } + if (e.scrollLeftChanged) { + this.viewContainer.scrollLeft = e.scrollLeft; + } + })); + append(this.el, this.scrollableElement.getDomNode()); + this.style(options.styles || defaultStyles); + // We have an existing set of view, add them now + if (options.descriptor) { + this.size = options.descriptor.size; + options.descriptor.views.forEach((viewDescriptor, index) => { + const sizing = types.isUndefined(viewDescriptor.visible) || viewDescriptor.visible ? viewDescriptor.size : { type: 'invisible', cachedVisibleSize: viewDescriptor.size }; + const view = viewDescriptor.view; + this.doAddView(view, sizing, index, true); + }); + // Initialize content size and proportions for first layout + this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); + this.saveProportions(); + } + } + style(styles) { + if (styles.separatorBorder.isTransparent()) { + this.el.classList.remove('separator-border'); + this.el.style.removeProperty('--separator-border'); + } + else { + this.el.classList.add('separator-border'); + this.el.style.setProperty('--separator-border', styles.separatorBorder.toString()); + } + } + /** + * Add a {@link IView view} to this {@link SplitView}. + * + * @param view The view to add. + * @param size Either a fixed size, or a dynamic {@link Sizing} strategy. + * @param index The index to insert the view on. + * @param skipLayout Whether layout should be skipped. + */ + addView(view, size, index = this.viewItems.length, skipLayout) { + this.doAddView(view, size, index, skipLayout); + } + /** + * Layout the {@link SplitView}. + * + * @param size The entire size of the {@link SplitView}. + * @param layoutContext An optional layout context to pass along to {@link IView views}. + */ + layout(size, layoutContext) { + const previousSize = Math.max(this.size, this._contentSize); + this.size = size; + this.layoutContext = layoutContext; + if (!this.proportions) { + const indexes = range(this.viewItems.length); + const lowPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 1 /* LayoutPriority.Low */); + const highPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 2 /* LayoutPriority.High */); + this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes); + } + else { + let total = 0; + for (let i = 0; i < this.viewItems.length; i++) { + const item = this.viewItems[i]; + const proportion = this.proportions[i]; + if (typeof proportion === 'number') { + total += proportion; + } + else { + size -= item.size; + } + } + for (let i = 0; i < this.viewItems.length; i++) { + const item = this.viewItems[i]; + const proportion = this.proportions[i]; + if (typeof proportion === 'number' && total > 0) { + item.size = clamp(Math.round(proportion * size / total), item.minimumSize, item.maximumSize); + } + } + } + this.distributeEmptySpace(); + this.layoutViews(); + } + saveProportions() { + if (this.proportionalLayout && this._contentSize > 0) { + this.proportions = this.viewItems.map(v => v.proportionalLayout && v.visible ? v.size / this._contentSize : undefined); + } + } + onSashStart({ sash, start, alt }) { + for (const item of this.viewItems) { + item.enabled = false; + } + const index = this.sashItems.findIndex(item => item.sash === sash); + // This way, we can press Alt while we resize a sash, macOS style! + const disposable = combinedDisposable(addDisposableListener(this.el.ownerDocument.body, 'keydown', e => resetSashDragState(this.sashDragState.current, e.altKey)), addDisposableListener(this.el.ownerDocument.body, 'keyup', () => resetSashDragState(this.sashDragState.current, false))); + const resetSashDragState = (start, alt) => { + const sizes = this.viewItems.map(i => i.size); + let minDelta = Number.NEGATIVE_INFINITY; + let maxDelta = Number.POSITIVE_INFINITY; + if (this.inverseAltBehavior) { + alt = !alt; + } + if (alt) { + // When we're using the last sash with Alt, we're resizing + // the view to the left/up, instead of right/down as usual + // Thus, we must do the inverse of the usual + const isLastSash = index === this.sashItems.length - 1; + if (isLastSash) { + const viewItem = this.viewItems[index]; + minDelta = (viewItem.minimumSize - viewItem.size) / 2; + maxDelta = (viewItem.maximumSize - viewItem.size) / 2; + } + else { + const viewItem = this.viewItems[index + 1]; + minDelta = (viewItem.size - viewItem.maximumSize) / 2; + maxDelta = (viewItem.size - viewItem.minimumSize) / 2; + } + } + let snapBefore; + let snapAfter; + if (!alt) { + const upIndexes = range(index, -1); + const downIndexes = range(index + 1, this.viewItems.length); + const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0); + const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0); + const maxDeltaDown = downIndexes.length === 0 ? Number.POSITIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].minimumSize), 0); + const minDeltaDown = downIndexes.length === 0 ? Number.NEGATIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].viewMaximumSize), 0); + const minDelta = Math.max(minDeltaUp, minDeltaDown); + const maxDelta = Math.min(maxDeltaDown, maxDeltaUp); + const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); + const snapAfterIndex = this.findFirstSnapIndex(downIndexes); + if (typeof snapBeforeIndex === 'number') { + const viewItem = this.viewItems[snapBeforeIndex]; + const halfSize = Math.floor(viewItem.viewMinimumSize / 2); + snapBefore = { + index: snapBeforeIndex, + limitDelta: viewItem.visible ? minDelta - halfSize : minDelta + halfSize, + size: viewItem.size + }; + } + if (typeof snapAfterIndex === 'number') { + const viewItem = this.viewItems[snapAfterIndex]; + const halfSize = Math.floor(viewItem.viewMinimumSize / 2); + snapAfter = { + index: snapAfterIndex, + limitDelta: viewItem.visible ? maxDelta + halfSize : maxDelta - halfSize, + size: viewItem.size + }; + } + } + this.sashDragState = { start, current: start, index, sizes, minDelta, maxDelta, alt, snapBefore, snapAfter, disposable }; + }; + resetSashDragState(start, alt); + } + onSashChange({ current }) { + const { index, start, sizes, alt, minDelta, maxDelta, snapBefore, snapAfter } = this.sashDragState; + this.sashDragState.current = current; + const delta = current - start; + const newDelta = this.resize(index, delta, sizes, undefined, undefined, minDelta, maxDelta, snapBefore, snapAfter); + if (alt) { + const isLastSash = index === this.sashItems.length - 1; + const newSizes = this.viewItems.map(i => i.size); + const viewItemIndex = isLastSash ? index : index + 1; + const viewItem = this.viewItems[viewItemIndex]; + const newMinDelta = viewItem.size - viewItem.maximumSize; + const newMaxDelta = viewItem.size - viewItem.minimumSize; + const resizeIndex = isLastSash ? index - 1 : index + 1; + this.resize(resizeIndex, -newDelta, newSizes, undefined, undefined, newMinDelta, newMaxDelta); + } + this.distributeEmptySpace(); + this.layoutViews(); + } + onSashEnd(index) { + this._onDidSashChange.fire(index); + this.sashDragState.disposable.dispose(); + this.saveProportions(); + for (const item of this.viewItems) { + item.enabled = true; + } + } + onViewChange(item, size) { + const index = this.viewItems.indexOf(item); + if (index < 0 || index >= this.viewItems.length) { + return; + } + size = typeof size === 'number' ? size : item.size; + size = clamp(size, item.minimumSize, item.maximumSize); + if (this.inverseAltBehavior && index > 0) { + // In this case, we want the view to grow or shrink both sides equally + // so we just resize the "left" side by half and let `resize` do the clamping magic + this.resize(index - 1, Math.floor((item.size - size) / 2)); + this.distributeEmptySpace(); + this.layoutViews(); + } + else { + item.size = size; + this.relayout([index], undefined); + } + } + /** + * Resize a {@link IView view} within the {@link SplitView}. + * + * @param index The {@link IView view} index. + * @param size The {@link IView view} size. + */ + resizeView(index, size) { + if (index < 0 || index >= this.viewItems.length) { + return; + } + if (this.state !== State.Idle) { + throw new Error('Cant modify splitview'); + } + this.state = State.Busy; + try { + const indexes = range(this.viewItems.length).filter(i => i !== index); + const lowPriorityIndexes = [...indexes.filter(i => this.viewItems[i].priority === 1 /* LayoutPriority.Low */), index]; + const highPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 2 /* LayoutPriority.High */); + const item = this.viewItems[index]; + size = Math.round(size); + size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this.size)); + item.size = size; + this.relayout(lowPriorityIndexes, highPriorityIndexes); + } + finally { + this.state = State.Idle; + } + } + /** + * Distribute the entire {@link SplitView} size among all {@link IView views}. + */ + distributeViewSizes() { + const flexibleViewItems = []; + let flexibleSize = 0; + for (const item of this.viewItems) { + if (item.maximumSize - item.minimumSize > 0) { + flexibleViewItems.push(item); + flexibleSize += item.size; + } + } + const size = Math.floor(flexibleSize / flexibleViewItems.length); + for (const item of flexibleViewItems) { + item.size = clamp(size, item.minimumSize, item.maximumSize); + } + const indexes = range(this.viewItems.length); + const lowPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 1 /* LayoutPriority.Low */); + const highPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 2 /* LayoutPriority.High */); + this.relayout(lowPriorityIndexes, highPriorityIndexes); + } + /** + * Returns the size of a {@link IView view}. + */ + getViewSize(index) { + if (index < 0 || index >= this.viewItems.length) { + return -1; + } + return this.viewItems[index].size; + } + doAddView(view, size, index = this.viewItems.length, skipLayout) { + if (this.state !== State.Idle) { + throw new Error('Cant modify splitview'); + } + this.state = State.Busy; + try { + // Add view + const container = $('.split-view-view'); + if (index === this.viewItems.length) { + this.viewContainer.appendChild(container); + } + else { + this.viewContainer.insertBefore(container, this.viewContainer.children.item(index)); + } + const onChangeDisposable = view.onDidChange(size => this.onViewChange(item, size)); + const containerDisposable = toDisposable(() => container.remove()); + const disposable = combinedDisposable(onChangeDisposable, containerDisposable); + let viewSize; + if (typeof size === 'number') { + viewSize = size; + } + else { + if (size.type === 'auto') { + if (this.areViewsDistributed()) { + size = { type: 'distribute' }; + } + else { + size = { type: 'split', index: size.index }; + } + } + if (size.type === 'split') { + viewSize = this.getViewSize(size.index) / 2; + } + else if (size.type === 'invisible') { + viewSize = { cachedVisibleSize: size.cachedVisibleSize }; + } + else { + viewSize = view.minimumSize; + } + } + const item = this.orientation === 0 /* Orientation.VERTICAL */ + ? new VerticalViewItem(container, view, viewSize, disposable) + : new HorizontalViewItem(container, view, viewSize, disposable); + this.viewItems.splice(index, 0, item); + // Add sash + if (this.viewItems.length > 1) { + const opts = { orthogonalStartSash: this.orthogonalStartSash, orthogonalEndSash: this.orthogonalEndSash }; + const sash = this.orientation === 0 /* Orientation.VERTICAL */ + ? new Sash(this.sashContainer, { getHorizontalSashTop: s => this.getSashPosition(s), getHorizontalSashWidth: this.getSashOrthogonalSize }, { ...opts, orientation: 1 /* Orientation.HORIZONTAL */ }) + : new Sash(this.sashContainer, { getVerticalSashLeft: s => this.getSashPosition(s), getVerticalSashHeight: this.getSashOrthogonalSize }, { ...opts, orientation: 0 /* Orientation.VERTICAL */ }); + const sashEventMapper = this.orientation === 0 /* Orientation.VERTICAL */ + ? (e) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey }) + : (e) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey }); + const onStart = Event.map(sash.onDidStart, sashEventMapper); + const onStartDisposable = onStart(this.onSashStart, this); + const onChange = Event.map(sash.onDidChange, sashEventMapper); + const onChangeDisposable = onChange(this.onSashChange, this); + const onEnd = Event.map(sash.onDidEnd, () => this.sashItems.findIndex(item => item.sash === sash)); + const onEndDisposable = onEnd(this.onSashEnd, this); + const onDidResetDisposable = sash.onDidReset(() => { + const index = this.sashItems.findIndex(item => item.sash === sash); + const upIndexes = range(index, -1); + const downIndexes = range(index + 1, this.viewItems.length); + const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); + const snapAfterIndex = this.findFirstSnapIndex(downIndexes); + if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { + return; + } + if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { + return; + } + this._onDidSashReset.fire(index); + }); + const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash); + const sashItem = { sash, disposable }; + this.sashItems.splice(index - 1, 0, sashItem); + } + container.appendChild(view.element); + let highPriorityIndexes; + if (typeof size !== 'number' && size.type === 'split') { + highPriorityIndexes = [size.index]; + } + if (!skipLayout) { + this.relayout([index], highPriorityIndexes); + } + if (!skipLayout && typeof size !== 'number' && size.type === 'distribute') { + this.distributeViewSizes(); + } + } + finally { + this.state = State.Idle; + } + } + relayout(lowPriorityIndexes, highPriorityIndexes) { + const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); + this.resize(this.viewItems.length - 1, this.size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes); + this.distributeEmptySpace(); + this.layoutViews(); + this.saveProportions(); + } + resize(index, delta, sizes = this.viewItems.map(i => i.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) { + if (index < 0 || index >= this.viewItems.length) { + return 0; + } + const upIndexes = range(index, -1); + const downIndexes = range(index + 1, this.viewItems.length); + if (highPriorityIndexes) { + for (const index of highPriorityIndexes) { + pushToStart(upIndexes, index); + pushToStart(downIndexes, index); + } + } + if (lowPriorityIndexes) { + for (const index of lowPriorityIndexes) { + pushToEnd(upIndexes, index); + pushToEnd(downIndexes, index); + } + } + const upItems = upIndexes.map(i => this.viewItems[i]); + const upSizes = upIndexes.map(i => sizes[i]); + const downItems = downIndexes.map(i => this.viewItems[i]); + const downSizes = downIndexes.map(i => sizes[i]); + const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0); + const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].maximumSize - sizes[i]), 0); + const maxDeltaDown = downIndexes.length === 0 ? Number.POSITIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].minimumSize), 0); + const minDeltaDown = downIndexes.length === 0 ? Number.NEGATIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].maximumSize), 0); + const minDelta = Math.max(minDeltaUp, minDeltaDown, overloadMinDelta); + const maxDelta = Math.min(maxDeltaDown, maxDeltaUp, overloadMaxDelta); + let snapped = false; + if (snapBefore) { + const snapView = this.viewItems[snapBefore.index]; + const visible = delta >= snapBefore.limitDelta; + snapped = visible !== snapView.visible; + snapView.setVisible(visible, snapBefore.size); + } + if (!snapped && snapAfter) { + const snapView = this.viewItems[snapAfter.index]; + const visible = delta < snapAfter.limitDelta; + snapped = visible !== snapView.visible; + snapView.setVisible(visible, snapAfter.size); + } + if (snapped) { + return this.resize(index, delta, sizes, lowPriorityIndexes, highPriorityIndexes, overloadMinDelta, overloadMaxDelta); + } + delta = clamp(delta, minDelta, maxDelta); + for (let i = 0, deltaUp = delta; i < upItems.length; i++) { + const item = upItems[i]; + const size = clamp(upSizes[i] + deltaUp, item.minimumSize, item.maximumSize); + const viewDelta = size - upSizes[i]; + deltaUp -= viewDelta; + item.size = size; + } + for (let i = 0, deltaDown = delta; i < downItems.length; i++) { + const item = downItems[i]; + const size = clamp(downSizes[i] - deltaDown, item.minimumSize, item.maximumSize); + const viewDelta = size - downSizes[i]; + deltaDown += viewDelta; + item.size = size; + } + return delta; + } + distributeEmptySpace(lowPriorityIndex) { + const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); + let emptyDelta = this.size - contentSize; + const indexes = range(this.viewItems.length - 1, -1); + const lowPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 1 /* LayoutPriority.Low */); + const highPriorityIndexes = indexes.filter(i => this.viewItems[i].priority === 2 /* LayoutPriority.High */); + for (const index of highPriorityIndexes) { + pushToStart(indexes, index); + } + for (const index of lowPriorityIndexes) { + pushToEnd(indexes, index); + } + if (typeof lowPriorityIndex === 'number') { + pushToEnd(indexes, lowPriorityIndex); + } + for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) { + const item = this.viewItems[indexes[i]]; + const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize); + const viewDelta = size - item.size; + emptyDelta -= viewDelta; + item.size = size; + } + } + layoutViews() { + // Save new content size + this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); + // Layout views + let offset = 0; + for (const viewItem of this.viewItems) { + viewItem.layout(offset, this.layoutContext); + offset += viewItem.size; + } + // Layout sashes + this.sashItems.forEach(item => item.sash.layout()); + this.updateSashEnablement(); + this.updateScrollableElement(); + } + updateScrollableElement() { + if (this.orientation === 0 /* Orientation.VERTICAL */) { + this.scrollableElement.setScrollDimensions({ + height: this.size, + scrollHeight: this._contentSize + }); + } + else { + this.scrollableElement.setScrollDimensions({ + width: this.size, + scrollWidth: this._contentSize + }); + } + } + updateSashEnablement() { + let previous = false; + const collapsesDown = this.viewItems.map(i => previous = (i.size - i.minimumSize > 0) || previous); + previous = false; + const expandsDown = this.viewItems.map(i => previous = (i.maximumSize - i.size > 0) || previous); + const reverseViews = [...this.viewItems].reverse(); + previous = false; + const collapsesUp = reverseViews.map(i => previous = (i.size - i.minimumSize > 0) || previous).reverse(); + previous = false; + const expandsUp = reverseViews.map(i => previous = (i.maximumSize - i.size > 0) || previous).reverse(); + let position = 0; + for (let index = 0; index < this.sashItems.length; index++) { + const { sash } = this.sashItems[index]; + const viewItem = this.viewItems[index]; + position += viewItem.size; + const min = !(collapsesDown[index] && expandsUp[index + 1]); + const max = !(expandsDown[index] && collapsesUp[index + 1]); + if (min && max) { + const upIndexes = range(index, -1); + const downIndexes = range(index + 1, this.viewItems.length); + const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); + const snapAfterIndex = this.findFirstSnapIndex(downIndexes); + const snappedBefore = typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible; + const snappedAfter = typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible; + if (snappedBefore && collapsesUp[index] && (position > 0 || this.startSnappingEnabled)) { + sash.state = 1 /* SashState.AtMinimum */; + } + else if (snappedAfter && collapsesDown[index] && (position < this._contentSize || this.endSnappingEnabled)) { + sash.state = 2 /* SashState.AtMaximum */; + } + else { + sash.state = 0 /* SashState.Disabled */; + } + } + else if (min && !max) { + sash.state = 1 /* SashState.AtMinimum */; + } + else if (!min && max) { + sash.state = 2 /* SashState.AtMaximum */; + } + else { + sash.state = 3 /* SashState.Enabled */; + } + } + } + getSashPosition(sash) { + let position = 0; + for (let i = 0; i < this.sashItems.length; i++) { + position += this.viewItems[i].size; + if (this.sashItems[i].sash === sash) { + return position; + } + } + return 0; + } + findFirstSnapIndex(indexes) { + // visible views first + for (const index of indexes) { + const viewItem = this.viewItems[index]; + if (!viewItem.visible) { + continue; + } + if (viewItem.snap) { + return index; + } + } + // then, hidden views + for (const index of indexes) { + const viewItem = this.viewItems[index]; + if (viewItem.visible && viewItem.maximumSize - viewItem.minimumSize > 0) { + return undefined; + } + if (!viewItem.visible && viewItem.snap) { + return index; + } + } + return undefined; + } + areViewsDistributed() { + let min = undefined, max = undefined; + for (const view of this.viewItems) { + min = min === undefined ? view.size : Math.min(min, view.size); + max = max === undefined ? view.size : Math.max(max, view.size); + if (max - min > 2) { + return false; + } + } + return true; + } + dispose() { + this.sashDragState?.disposable.dispose(); + dispose(this.viewItems); + this.viewItems = []; + this.sashItems.forEach(i => i.disposable.dispose()); + this.sashItems = []; + super.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.css new file mode 100644 index 0000000000000000000000000000000000000000..2266437d7bc966c5f6edaa28db754b8a25ee6b03 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.css @@ -0,0 +1,57 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-table { + display: flex; + flex-direction: column; + position: relative; + height: 100%; + width: 100%; + white-space: nowrap; + overflow: hidden; +} + +.monaco-table > .monaco-split-view2 { + border-bottom: 1px solid transparent; +} + +.monaco-table > .monaco-list { + flex: 1; +} + +.monaco-table-tr { + display: flex; + height: 100%; +} + +.monaco-table-th { + width: 100%; + height: 100%; + font-weight: bold; + overflow: hidden; + text-overflow: ellipsis; +} + +.monaco-table-th, +.monaco-table-td { + box-sizing: border-box; + flex-shrink: 0; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before { + content: ""; + position: absolute; + left: calc(var(--vscode-sash-size) / 2); + width: 0; + border-left: 1px solid transparent; +} + +.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2, +.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before { + transition: border-color 0.2s ease-out; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js new file mode 100644 index 0000000000000000000000000000000000000000..950427227f1806fe7c39d0f481a557453e32923a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { $, append, clearNode, createStyleSheet } from '../../dom.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { List, unthemedListStyles } from '../list/listWidget.js'; +import { SplitView } from '../splitview/splitview.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { Disposable, DisposableStore } from '../../../common/lifecycle.js'; +import './table.css'; +class TableListRenderer { + static { this.TemplateId = 'row'; } + constructor(columns, renderers, getColumnSize) { + this.columns = columns; + this.getColumnSize = getColumnSize; + this.templateId = TableListRenderer.TemplateId; + this.renderedTemplates = new Set(); + const rendererMap = new Map(renderers.map(r => [r.templateId, r])); + this.renderers = []; + for (const column of columns) { + const renderer = rendererMap.get(column.templateId); + if (!renderer) { + throw new Error(`Table cell renderer for template id ${column.templateId} not found.`); + } + this.renderers.push(renderer); + } + } + renderTemplate(container) { + const rowContainer = append(container, $('.monaco-table-tr')); + const cellContainers = []; + const cellTemplateData = []; + for (let i = 0; i < this.columns.length; i++) { + const renderer = this.renderers[i]; + const cellContainer = append(rowContainer, $('.monaco-table-td', { 'data-col-index': i })); + cellContainer.style.width = `${this.getColumnSize(i)}px`; + cellContainers.push(cellContainer); + cellTemplateData.push(renderer.renderTemplate(cellContainer)); + } + const result = { container, cellContainers, cellTemplateData }; + this.renderedTemplates.add(result); + return result; + } + renderElement(element, index, templateData, height) { + for (let i = 0; i < this.columns.length; i++) { + const column = this.columns[i]; + const cell = column.project(element); + const renderer = this.renderers[i]; + renderer.renderElement(cell, index, templateData.cellTemplateData[i], height); + } + } + disposeElement(element, index, templateData, height) { + for (let i = 0; i < this.columns.length; i++) { + const renderer = this.renderers[i]; + if (renderer.disposeElement) { + const column = this.columns[i]; + const cell = column.project(element); + renderer.disposeElement(cell, index, templateData.cellTemplateData[i], height); + } + } + } + disposeTemplate(templateData) { + for (let i = 0; i < this.columns.length; i++) { + const renderer = this.renderers[i]; + renderer.disposeTemplate(templateData.cellTemplateData[i]); + } + clearNode(templateData.container); + this.renderedTemplates.delete(templateData); + } + layoutColumn(index, size) { + for (const { cellContainers } of this.renderedTemplates) { + cellContainers[index].style.width = `${size}px`; + } + } +} +function asListVirtualDelegate(delegate) { + return { + getHeight(row) { return delegate.getHeight(row); }, + getTemplateId() { return TableListRenderer.TemplateId; }, + }; +} +class ColumnHeader extends Disposable { + get minimumSize() { return this.column.minimumWidth ?? 120; } + get maximumSize() { return this.column.maximumWidth ?? Number.POSITIVE_INFINITY; } + get onDidChange() { return this.column.onDidChangeWidthConstraints ?? Event.None; } + constructor(column, index) { + super(); + this.column = column; + this.index = index; + this._onDidLayout = new Emitter(); + this.onDidLayout = this._onDidLayout.event; + this.element = $('.monaco-table-th', { 'data-col-index': index }, column.label); + if (column.tooltip) { + this._register(getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate('mouse'), this.element, column.tooltip)); + } + } + layout(size) { + this._onDidLayout.fire([this.index, size]); + } +} +export class Table { + static { this.InstanceCount = 0; } + get onDidChangeFocus() { return this.list.onDidChangeFocus; } + get onDidChangeSelection() { return this.list.onDidChangeSelection; } + get onDidScroll() { return this.list.onDidScroll; } + get onMouseDblClick() { return this.list.onMouseDblClick; } + get onPointer() { return this.list.onPointer; } + get onDidFocus() { return this.list.onDidFocus; } + get scrollTop() { return this.list.scrollTop; } + set scrollTop(scrollTop) { this.list.scrollTop = scrollTop; } + get scrollHeight() { return this.list.scrollHeight; } + get renderHeight() { return this.list.renderHeight; } + get onDidDispose() { return this.list.onDidDispose; } + constructor(user, container, virtualDelegate, columns, renderers, _options) { + this.virtualDelegate = virtualDelegate; + this.columns = columns; + this.domId = `table_id_${++Table.InstanceCount}`; + this.disposables = new DisposableStore(); + this.cachedWidth = 0; + this.cachedHeight = 0; + this.domNode = append(container, $(`.monaco-table.${this.domId}`)); + const headers = columns.map((c, i) => this.disposables.add(new ColumnHeader(c, i))); + const descriptor = { + size: headers.reduce((a, b) => a + b.column.weight, 0), + views: headers.map(view => ({ size: view.column.weight, view })) + }; + this.splitview = this.disposables.add(new SplitView(this.domNode, { + orientation: 1 /* Orientation.HORIZONTAL */, + scrollbarVisibility: 2 /* ScrollbarVisibility.Hidden */, + getSashOrthogonalSize: () => this.cachedHeight, + descriptor + })); + this.splitview.el.style.height = `${virtualDelegate.headerRowHeight}px`; + this.splitview.el.style.lineHeight = `${virtualDelegate.headerRowHeight}px`; + const renderer = new TableListRenderer(columns, renderers, i => this.splitview.getViewSize(i)); + this.list = this.disposables.add(new List(user, this.domNode, asListVirtualDelegate(virtualDelegate), [renderer], _options)); + Event.any(...headers.map(h => h.onDidLayout))(([index, size]) => renderer.layoutColumn(index, size), null, this.disposables); + this.splitview.onDidSashReset(index => { + const totalWeight = columns.reduce((r, c) => r + c.weight, 0); + const size = columns[index].weight / totalWeight * this.cachedWidth; + this.splitview.resizeView(index, size); + }, null, this.disposables); + this.styleElement = createStyleSheet(this.domNode); + this.style(unthemedListStyles); + } + updateOptions(options) { + this.list.updateOptions(options); + } + splice(start, deleteCount, elements = []) { + this.list.splice(start, deleteCount, elements); + } + getHTMLElement() { + return this.domNode; + } + style(styles) { + const content = []; + content.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before { + top: ${this.virtualDelegate.headerRowHeight + 1}px; + height: calc(100% - ${this.virtualDelegate.headerRowHeight}px); + }`); + this.styleElement.textContent = content.join('\n'); + this.list.style(styles); + } + getSelectedElements() { + return this.list.getSelectedElements(); + } + getSelection() { + return this.list.getSelection(); + } + getFocus() { + return this.list.getFocus(); + } + dispose() { + this.disposables.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.css new file mode 100644 index 0000000000000000000000000000000000000000..6244ed4a4347ca5b706ed68a3547d0a68d5dd3b4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.css @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-custom-toggle { + margin-left: 2px; + float: left; + cursor: pointer; + overflow: hidden; + width: 20px; + height: 20px; + border-radius: 3px; + border: 1px solid transparent; + padding: 1px; + box-sizing: border-box; + user-select: none; + -webkit-user-select: none; +} + +.monaco-custom-toggle:hover { + background-color: var(--vscode-inputOption-hoverBackground); +} + +.hc-black .monaco-custom-toggle:hover, +.hc-light .monaco-custom-toggle:hover { + border: 1px dashed var(--vscode-focusBorder); +} + +.hc-black .monaco-custom-toggle, +.hc-light .monaco-custom-toggle { + background: none; +} + +.hc-black .monaco-custom-toggle:hover, +.hc-light .monaco-custom-toggle:hover { + background: none; +} + +.monaco-custom-toggle.monaco-checkbox { + height: 18px; + width: 18px; + border: 1px solid transparent; + border-radius: 3px; + margin-right: 9px; + margin-left: 0px; + padding: 0px; + opacity: 1; + background-size: 16px !important; +} + +.monaco-action-bar .checkbox-action-item { + display: flex; + align-items: center; + border-radius: 2px; + padding-right: 2px; +} + +.monaco-action-bar .checkbox-action-item:hover { + background-color: var(--vscode-toolbar-hoverBackground); +} + +.monaco-action-bar .checkbox-action-item > .monaco-custom-toggle.monaco-checkbox { + margin-right: 4px; +} + +.monaco-action-bar .checkbox-action-item > .checkbox-label { + font-size: 12px; +} + +/* hide check when unchecked */ +.monaco-custom-toggle.monaco-checkbox:not(.checked)::before { + visibility: hidden; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.js new file mode 100644 index 0000000000000000000000000000000000000000..9e38e8a2f140b569743effc04629030dedbcc6d0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.js @@ -0,0 +1,96 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Widget } from '../widget.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import { Emitter } from '../../../common/event.js'; +import './toggle.css'; +import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js'; +export const unthemedToggleStyles = { + inputActiveOptionBorder: '#007ACC00', + inputActiveOptionForeground: '#FFFFFF', + inputActiveOptionBackground: '#0E639C50' +}; +export class Toggle extends Widget { + constructor(opts) { + super(); + this._onChange = this._register(new Emitter()); + this.onChange = this._onChange.event; + this._onKeyDown = this._register(new Emitter()); + this.onKeyDown = this._onKeyDown.event; + this._opts = opts; + this._checked = this._opts.isChecked; + const classes = ['monaco-custom-toggle']; + if (this._opts.icon) { + this._icon = this._opts.icon; + classes.push(...ThemeIcon.asClassNameArray(this._icon)); + } + if (this._opts.actionClassName) { + classes.push(...this._opts.actionClassName.split(' ')); + } + if (this._checked) { + classes.push('checked'); + } + this.domNode = document.createElement('div'); + this._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(opts.hoverDelegate ?? getDefaultHoverDelegate('mouse'), this.domNode, this._opts.title)); + this.domNode.classList.add(...classes); + if (!this._opts.notFocusable) { + this.domNode.tabIndex = 0; + } + this.domNode.setAttribute('role', 'checkbox'); + this.domNode.setAttribute('aria-checked', String(this._checked)); + this.domNode.setAttribute('aria-label', this._opts.title); + this.applyStyles(); + this.onclick(this.domNode, (ev) => { + if (this.enabled) { + this.checked = !this._checked; + this._onChange.fire(false); + ev.preventDefault(); + } + }); + this._register(this.ignoreGesture(this.domNode)); + this.onkeydown(this.domNode, (keyboardEvent) => { + if (keyboardEvent.keyCode === 10 /* KeyCode.Space */ || keyboardEvent.keyCode === 3 /* KeyCode.Enter */) { + this.checked = !this._checked; + this._onChange.fire(true); + keyboardEvent.preventDefault(); + keyboardEvent.stopPropagation(); + return; + } + this._onKeyDown.fire(keyboardEvent); + }); + } + get enabled() { + return this.domNode.getAttribute('aria-disabled') !== 'true'; + } + focus() { + this.domNode.focus(); + } + get checked() { + return this._checked; + } + set checked(newIsChecked) { + this._checked = newIsChecked; + this.domNode.setAttribute('aria-checked', String(this._checked)); + this.domNode.classList.toggle('checked', this._checked); + this.applyStyles(); + } + width() { + return 2 /*margin left*/ + 2 /*border*/ + 2 /*padding*/ + 16 /* icon width */; + } + applyStyles() { + if (this.domNode) { + this.domNode.style.borderColor = (this._checked && this._opts.inputActiveOptionBorder) || ''; + this.domNode.style.color = (this._checked && this._opts.inputActiveOptionForeground) || 'inherit'; + this.domNode.style.backgroundColor = (this._checked && this._opts.inputActiveOptionBackground) || ''; + } + } + enable() { + this.domNode.setAttribute('aria-disabled', String(false)); + } + disable() { + this.domNode.setAttribute('aria-disabled', String(true)); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.css new file mode 100644 index 0000000000000000000000000000000000000000..8182fbd9c29d7be25d152c90c161afed2e2a4fec --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.css @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-toolbar { + height: 100%; +} + +.monaco-toolbar .toolbar-toggle-more { + display: inline-block; + padding: 0; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..0bdfae1f72a07045bd94e0ecd9310c1f11f4cb2e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js @@ -0,0 +1,139 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { ActionBar } from '../actionbar/actionbar.js'; +import { DropdownMenuActionViewItem } from '../dropdown/dropdownActionViewItem.js'; +import { Action, SubmenuAction } from '../../../common/actions.js'; +import { Codicon } from '../../../common/codicons.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import { EventMultiplexer } from '../../../common/event.js'; +import { Disposable, DisposableStore } from '../../../common/lifecycle.js'; +import './toolbar.css'; +import * as nls from '../../../../nls.js'; +import { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js'; +/** + * A widget that combines an action bar for primary actions and a dropdown for secondary actions. + */ +export class ToolBar extends Disposable { + constructor(container, contextMenuProvider, options = { orientation: 0 /* ActionsOrientation.HORIZONTAL */ }) { + super(); + this.submenuActionViewItems = []; + this.hasSecondaryActions = false; + this._onDidChangeDropdownVisibility = this._register(new EventMultiplexer()); + this.onDidChangeDropdownVisibility = this._onDidChangeDropdownVisibility.event; + this.disposables = this._register(new DisposableStore()); + options.hoverDelegate = options.hoverDelegate ?? this._register(createInstantHoverDelegate()); + this.options = options; + this.toggleMenuAction = this._register(new ToggleMenuAction(() => this.toggleMenuActionViewItem?.show(), options.toggleMenuTitle)); + this.element = document.createElement('div'); + this.element.className = 'monaco-toolbar'; + container.appendChild(this.element); + this.actionBar = this._register(new ActionBar(this.element, { + orientation: options.orientation, + ariaLabel: options.ariaLabel, + actionRunner: options.actionRunner, + allowContextMenu: options.allowContextMenu, + highlightToggledItems: options.highlightToggledItems, + hoverDelegate: options.hoverDelegate, + actionViewItemProvider: (action, viewItemOptions) => { + if (action.id === ToggleMenuAction.ID) { + this.toggleMenuActionViewItem = new DropdownMenuActionViewItem(action, action.menuActions, contextMenuProvider, { + actionViewItemProvider: this.options.actionViewItemProvider, + actionRunner: this.actionRunner, + keybindingProvider: this.options.getKeyBinding, + classNames: ThemeIcon.asClassNameArray(options.moreIcon ?? Codicon.toolBarMore), + anchorAlignmentProvider: this.options.anchorAlignmentProvider, + menuAsChild: !!this.options.renderDropdownAsChildElement, + skipTelemetry: this.options.skipTelemetry, + isMenu: true, + hoverDelegate: this.options.hoverDelegate + }); + this.toggleMenuActionViewItem.setActionContext(this.actionBar.context); + this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)); + return this.toggleMenuActionViewItem; + } + if (options.actionViewItemProvider) { + const result = options.actionViewItemProvider(action, viewItemOptions); + if (result) { + return result; + } + } + if (action instanceof SubmenuAction) { + const result = new DropdownMenuActionViewItem(action, action.actions, contextMenuProvider, { + actionViewItemProvider: this.options.actionViewItemProvider, + actionRunner: this.actionRunner, + keybindingProvider: this.options.getKeyBinding, + classNames: action.class, + anchorAlignmentProvider: this.options.anchorAlignmentProvider, + menuAsChild: !!this.options.renderDropdownAsChildElement, + skipTelemetry: this.options.skipTelemetry, + hoverDelegate: this.options.hoverDelegate + }); + result.setActionContext(this.actionBar.context); + this.submenuActionViewItems.push(result); + this.disposables.add(this._onDidChangeDropdownVisibility.add(result.onDidChangeVisibility)); + return result; + } + return undefined; + } + })); + } + set actionRunner(actionRunner) { + this.actionBar.actionRunner = actionRunner; + } + get actionRunner() { + return this.actionBar.actionRunner; + } + getElement() { + return this.element; + } + getItemAction(indexOrElement) { + return this.actionBar.getAction(indexOrElement); + } + setActions(primaryActions, secondaryActions) { + this.clear(); + const primaryActionsToSet = primaryActions ? primaryActions.slice(0) : []; + // Inject additional action to open secondary actions if present + this.hasSecondaryActions = !!(secondaryActions && secondaryActions.length > 0); + if (this.hasSecondaryActions && secondaryActions) { + this.toggleMenuAction.menuActions = secondaryActions.slice(0); + primaryActionsToSet.push(this.toggleMenuAction); + } + primaryActionsToSet.forEach(action => { + this.actionBar.push(action, { icon: this.options.icon ?? true, label: this.options.label ?? false, keybinding: this.getKeybindingLabel(action) }); + }); + } + getKeybindingLabel(action) { + const key = this.options.getKeyBinding?.(action); + return key?.getLabel() ?? undefined; + } + clear() { + this.submenuActionViewItems = []; + this.disposables.clear(); + this.actionBar.clear(); + } + dispose() { + this.clear(); + this.disposables.dispose(); + super.dispose(); + } +} +export class ToggleMenuAction extends Action { + static { this.ID = 'toolbar.toggle.more'; } + constructor(toggleDropdownMenu, title) { + title = title || nls.localize('moreActions', "More Actions..."); + super(ToggleMenuAction.ID, title, undefined, true); + this._menuActions = []; + this.toggleDropdownMenu = toggleDropdownMenu; + } + async run() { + this.toggleDropdownMenu(); + } + get menuActions() { + return this._menuActions; + } + set menuActions(actions) { + this._menuActions = actions; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js new file mode 100644 index 0000000000000000000000000000000000000000..e0ce7c28e1dcec30f03cd623b19bfe38d161205e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js @@ -0,0 +1,2094 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { $, append, clearNode, createStyleSheet, getWindow, h, hasParentWithClass, asCssValueWithDefault, isKeyboardEvent, addDisposableListener } from '../../dom.js'; +import { DomEmitter } from '../../event.js'; +import { StandardKeyboardEvent } from '../../keyboardEvent.js'; +import { ActionBar } from '../actionbar/actionbar.js'; +import { FindInput } from '../findinput/findInput.js'; +import { unthemedInboxStyles } from '../inputbox/inputBox.js'; +import { ElementsDragAndDropData } from '../list/listView.js'; +import { isActionItem, isButton, isInputElement, isMonacoCustomToggle, isMonacoEditor, isStickyScrollContainer, isStickyScrollElement, List, MouseController } from '../list/listWidget.js'; +import { Toggle, unthemedToggleStyles } from '../toggle/toggle.js'; +import { getVisibleState, isFilterResult } from './indexTreeModel.js'; +import { TreeMouseEventTarget } from './tree.js'; +import { Action } from '../../../common/actions.js'; +import { distinct, equals, range } from '../../../common/arrays.js'; +import { Delayer, disposableTimeout, timeout } from '../../../common/async.js'; +import { Codicon } from '../../../common/codicons.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import { SetMap } from '../../../common/map.js'; +import { Emitter, Event, EventBufferer, Relay } from '../../../common/event.js'; +import { fuzzyScore, FuzzyScore } from '../../../common/filters.js'; +import { Disposable, DisposableStore, dispose, toDisposable } from '../../../common/lifecycle.js'; +import { clamp } from '../../../common/numbers.js'; +import { isNumber } from '../../../common/types.js'; +import './media/tree.css'; +import { localize } from '../../../../nls.js'; +import { createInstantHoverDelegate, getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js'; +import { autorun, constObservable } from '../../../common/observable.js'; +import { alert } from '../aria/aria.js'; +class TreeElementsDragAndDropData extends ElementsDragAndDropData { + constructor(data) { + super(data.elements.map(node => node.element)); + this.data = data; + } +} +function asTreeDragAndDropData(data) { + if (data instanceof ElementsDragAndDropData) { + return new TreeElementsDragAndDropData(data); + } + return data; +} +class TreeNodeListDragAndDrop { + constructor(modelProvider, dnd) { + this.modelProvider = modelProvider; + this.dnd = dnd; + this.autoExpandDisposable = Disposable.None; + this.disposables = new DisposableStore(); + } + getDragURI(node) { + return this.dnd.getDragURI(node.element); + } + getDragLabel(nodes, originalEvent) { + if (this.dnd.getDragLabel) { + return this.dnd.getDragLabel(nodes.map(node => node.element), originalEvent); + } + return undefined; + } + onDragStart(data, originalEvent) { + this.dnd.onDragStart?.(asTreeDragAndDropData(data), originalEvent); + } + onDragOver(data, targetNode, targetIndex, targetSector, originalEvent, raw = true) { + const result = this.dnd.onDragOver(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent); + const didChangeAutoExpandNode = this.autoExpandNode !== targetNode; + if (didChangeAutoExpandNode) { + this.autoExpandDisposable.dispose(); + this.autoExpandNode = targetNode; + } + if (typeof targetNode === 'undefined') { + return result; + } + if (didChangeAutoExpandNode && typeof result !== 'boolean' && result.autoExpand) { + this.autoExpandDisposable = disposableTimeout(() => { + const model = this.modelProvider(); + const ref = model.getNodeLocation(targetNode); + if (model.isCollapsed(ref)) { + model.setCollapsed(ref, false); + } + this.autoExpandNode = undefined; + }, 500, this.disposables); + } + if (typeof result === 'boolean' || !result.accept || typeof result.bubble === 'undefined' || result.feedback) { + if (!raw) { + const accept = typeof result === 'boolean' ? result : result.accept; + const effect = typeof result === 'boolean' ? undefined : result.effect; + return { accept, effect, feedback: [targetIndex] }; + } + return result; + } + if (result.bubble === 1 /* TreeDragOverBubble.Up */) { + const model = this.modelProvider(); + const ref = model.getNodeLocation(targetNode); + const parentRef = model.getParentNodeLocation(ref); + const parentNode = model.getNode(parentRef); + const parentIndex = parentRef && model.getListIndex(parentRef); + return this.onDragOver(data, parentNode, parentIndex, targetSector, originalEvent, false); + } + const model = this.modelProvider(); + const ref = model.getNodeLocation(targetNode); + const start = model.getListIndex(ref); + const length = model.getListRenderCount(ref); + return { ...result, feedback: range(start, start + length) }; + } + drop(data, targetNode, targetIndex, targetSector, originalEvent) { + this.autoExpandDisposable.dispose(); + this.autoExpandNode = undefined; + this.dnd.drop(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent); + } + onDragEnd(originalEvent) { + this.dnd.onDragEnd?.(originalEvent); + } + dispose() { + this.disposables.dispose(); + this.dnd.dispose(); + } +} +function asListOptions(modelProvider, options) { + return options && { + ...options, + identityProvider: options.identityProvider && { + getId(el) { + return options.identityProvider.getId(el.element); + } + }, + dnd: options.dnd && new TreeNodeListDragAndDrop(modelProvider, options.dnd), + multipleSelectionController: options.multipleSelectionController && { + isSelectionSingleChangeEvent(e) { + return options.multipleSelectionController.isSelectionSingleChangeEvent({ ...e, element: e.element }); + }, + isSelectionRangeChangeEvent(e) { + return options.multipleSelectionController.isSelectionRangeChangeEvent({ ...e, element: e.element }); + } + }, + accessibilityProvider: options.accessibilityProvider && { + ...options.accessibilityProvider, + getSetSize(node) { + const model = modelProvider(); + const ref = model.getNodeLocation(node); + const parentRef = model.getParentNodeLocation(ref); + const parentNode = model.getNode(parentRef); + return parentNode.visibleChildrenCount; + }, + getPosInSet(node) { + return node.visibleChildIndex + 1; + }, + isChecked: options.accessibilityProvider && options.accessibilityProvider.isChecked ? (node) => { + return options.accessibilityProvider.isChecked(node.element); + } : undefined, + getRole: options.accessibilityProvider && options.accessibilityProvider.getRole ? (node) => { + return options.accessibilityProvider.getRole(node.element); + } : () => 'treeitem', + getAriaLabel(e) { + return options.accessibilityProvider.getAriaLabel(e.element); + }, + getWidgetAriaLabel() { + return options.accessibilityProvider.getWidgetAriaLabel(); + }, + getWidgetRole: options.accessibilityProvider && options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider.getWidgetRole() : () => 'tree', + getAriaLevel: options.accessibilityProvider && options.accessibilityProvider.getAriaLevel ? (node) => options.accessibilityProvider.getAriaLevel(node.element) : (node) => { + return node.depth; + }, + getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => { + return options.accessibilityProvider.getActiveDescendantId(node.element); + }) + }, + keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && { + ...options.keyboardNavigationLabelProvider, + getKeyboardNavigationLabel(node) { + return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(node.element); + } + } + }; +} +export class ComposedTreeDelegate { + constructor(delegate) { + this.delegate = delegate; + } + getHeight(element) { + return this.delegate.getHeight(element.element); + } + getTemplateId(element) { + return this.delegate.getTemplateId(element.element); + } + hasDynamicHeight(element) { + return !!this.delegate.hasDynamicHeight && this.delegate.hasDynamicHeight(element.element); + } + setDynamicHeight(element, height) { + this.delegate.setDynamicHeight?.(element.element, height); + } +} +export var RenderIndentGuides; +(function (RenderIndentGuides) { + RenderIndentGuides["None"] = "none"; + RenderIndentGuides["OnHover"] = "onHover"; + RenderIndentGuides["Always"] = "always"; +})(RenderIndentGuides || (RenderIndentGuides = {})); +class EventCollection { + get elements() { + return this._elements; + } + constructor(onDidChange, _elements = []) { + this._elements = _elements; + this.disposables = new DisposableStore(); + this.onDidChange = Event.forEach(onDidChange, elements => this._elements = elements, this.disposables); + } + dispose() { + this.disposables.dispose(); + } +} +export class TreeRenderer { + static { this.DefaultIndent = 8; } + constructor(renderer, modelProvider, onDidChangeCollapseState, activeNodes, renderedIndentGuides, options = {}) { + this.renderer = renderer; + this.modelProvider = modelProvider; + this.activeNodes = activeNodes; + this.renderedIndentGuides = renderedIndentGuides; + this.renderedElements = new Map(); + this.renderedNodes = new Map(); + this.indent = TreeRenderer.DefaultIndent; + this.hideTwistiesOfChildlessElements = false; + this.shouldRenderIndentGuides = false; + this.activeIndentNodes = new Set(); + this.indentGuidesDisposable = Disposable.None; + this.disposables = new DisposableStore(); + this.templateId = renderer.templateId; + this.updateOptions(options); + Event.map(onDidChangeCollapseState, e => e.node)(this.onDidChangeNodeTwistieState, this, this.disposables); + renderer.onDidChangeTwistieState?.(this.onDidChangeTwistieState, this, this.disposables); + } + updateOptions(options = {}) { + if (typeof options.indent !== 'undefined') { + const indent = clamp(options.indent, 0, 40); + if (indent !== this.indent) { + this.indent = indent; + for (const [node, templateData] of this.renderedNodes) { + this.renderTreeElement(node, templateData); + } + } + } + if (typeof options.renderIndentGuides !== 'undefined') { + const shouldRenderIndentGuides = options.renderIndentGuides !== RenderIndentGuides.None; + if (shouldRenderIndentGuides !== this.shouldRenderIndentGuides) { + this.shouldRenderIndentGuides = shouldRenderIndentGuides; + for (const [node, templateData] of this.renderedNodes) { + this._renderIndentGuides(node, templateData); + } + this.indentGuidesDisposable.dispose(); + if (shouldRenderIndentGuides) { + const disposables = new DisposableStore(); + this.activeNodes.onDidChange(this._onDidChangeActiveNodes, this, disposables); + this.indentGuidesDisposable = disposables; + this._onDidChangeActiveNodes(this.activeNodes.elements); + } + } + } + if (typeof options.hideTwistiesOfChildlessElements !== 'undefined') { + this.hideTwistiesOfChildlessElements = options.hideTwistiesOfChildlessElements; + } + } + renderTemplate(container) { + const el = append(container, $('.monaco-tl-row')); + const indent = append(el, $('.monaco-tl-indent')); + const twistie = append(el, $('.monaco-tl-twistie')); + const contents = append(el, $('.monaco-tl-contents')); + const templateData = this.renderer.renderTemplate(contents); + return { container, indent, twistie, indentGuidesDisposable: Disposable.None, templateData }; + } + renderElement(node, index, templateData, height) { + this.renderedNodes.set(node, templateData); + this.renderedElements.set(node.element, node); + this.renderTreeElement(node, templateData); + this.renderer.renderElement(node, index, templateData.templateData, height); + } + disposeElement(node, index, templateData, height) { + templateData.indentGuidesDisposable.dispose(); + this.renderer.disposeElement?.(node, index, templateData.templateData, height); + if (typeof height === 'number') { + this.renderedNodes.delete(node); + this.renderedElements.delete(node.element); + } + } + disposeTemplate(templateData) { + this.renderer.disposeTemplate(templateData.templateData); + } + onDidChangeTwistieState(element) { + const node = this.renderedElements.get(element); + if (!node) { + return; + } + this.onDidChangeNodeTwistieState(node); + } + onDidChangeNodeTwistieState(node) { + const templateData = this.renderedNodes.get(node); + if (!templateData) { + return; + } + this._onDidChangeActiveNodes(this.activeNodes.elements); + this.renderTreeElement(node, templateData); + } + renderTreeElement(node, templateData) { + const indent = TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent; + templateData.twistie.style.paddingLeft = `${indent}px`; + templateData.indent.style.width = `${indent + this.indent - 16}px`; + if (node.collapsible) { + templateData.container.setAttribute('aria-expanded', String(!node.collapsed)); + } + else { + templateData.container.removeAttribute('aria-expanded'); + } + templateData.twistie.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemExpanded)); + let twistieRendered = false; + if (this.renderer.renderTwistie) { + twistieRendered = this.renderer.renderTwistie(node.element, templateData.twistie); + } + if (node.collapsible && (!this.hideTwistiesOfChildlessElements || node.visibleChildrenCount > 0)) { + if (!twistieRendered) { + templateData.twistie.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemExpanded)); + } + templateData.twistie.classList.add('collapsible'); + templateData.twistie.classList.toggle('collapsed', node.collapsed); + } + else { + templateData.twistie.classList.remove('collapsible', 'collapsed'); + } + this._renderIndentGuides(node, templateData); + } + _renderIndentGuides(node, templateData) { + clearNode(templateData.indent); + templateData.indentGuidesDisposable.dispose(); + if (!this.shouldRenderIndentGuides) { + return; + } + const disposableStore = new DisposableStore(); + const model = this.modelProvider(); + while (true) { + const ref = model.getNodeLocation(node); + const parentRef = model.getParentNodeLocation(ref); + if (!parentRef) { + break; + } + const parent = model.getNode(parentRef); + const guide = $('.indent-guide', { style: `width: ${this.indent}px` }); + if (this.activeIndentNodes.has(parent)) { + guide.classList.add('active'); + } + if (templateData.indent.childElementCount === 0) { + templateData.indent.appendChild(guide); + } + else { + templateData.indent.insertBefore(guide, templateData.indent.firstElementChild); + } + this.renderedIndentGuides.add(parent, guide); + disposableStore.add(toDisposable(() => this.renderedIndentGuides.delete(parent, guide))); + node = parent; + } + templateData.indentGuidesDisposable = disposableStore; + } + _onDidChangeActiveNodes(nodes) { + if (!this.shouldRenderIndentGuides) { + return; + } + const set = new Set(); + const model = this.modelProvider(); + nodes.forEach(node => { + const ref = model.getNodeLocation(node); + try { + const parentRef = model.getParentNodeLocation(ref); + if (node.collapsible && node.children.length > 0 && !node.collapsed) { + set.add(node); + } + else if (parentRef) { + set.add(model.getNode(parentRef)); + } + } + catch { + // noop + } + }); + this.activeIndentNodes.forEach(node => { + if (!set.has(node)) { + this.renderedIndentGuides.forEach(node, line => line.classList.remove('active')); + } + }); + set.forEach(node => { + if (!this.activeIndentNodes.has(node)) { + this.renderedIndentGuides.forEach(node, line => line.classList.add('active')); + } + }); + this.activeIndentNodes = set; + } + dispose() { + this.renderedNodes.clear(); + this.renderedElements.clear(); + this.indentGuidesDisposable.dispose(); + dispose(this.disposables); + } +} +class FindFilter { + get totalCount() { return this._totalCount; } + get matchCount() { return this._matchCount; } + constructor(tree, keyboardNavigationLabelProvider, _filter) { + this.tree = tree; + this.keyboardNavigationLabelProvider = keyboardNavigationLabelProvider; + this._filter = _filter; + this._totalCount = 0; + this._matchCount = 0; + this._pattern = ''; + this._lowercasePattern = ''; + this.disposables = new DisposableStore(); + tree.onWillRefilter(this.reset, this, this.disposables); + } + filter(element, parentVisibility) { + let visibility = 1 /* TreeVisibility.Visible */; + if (this._filter) { + const result = this._filter.filter(element, parentVisibility); + if (typeof result === 'boolean') { + visibility = result ? 1 /* TreeVisibility.Visible */ : 0 /* TreeVisibility.Hidden */; + } + else if (isFilterResult(result)) { + visibility = getVisibleState(result.visibility); + } + else { + visibility = result; + } + if (visibility === 0 /* TreeVisibility.Hidden */) { + return false; + } + } + this._totalCount++; + if (!this._pattern) { + this._matchCount++; + return { data: FuzzyScore.Default, visibility }; + } + const label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(element); + const labels = Array.isArray(label) ? label : [label]; + for (const l of labels) { + const labelStr = l && l.toString(); + if (typeof labelStr === 'undefined') { + return { data: FuzzyScore.Default, visibility }; + } + let score; + if (this.tree.findMatchType === TreeFindMatchType.Contiguous) { + const index = labelStr.toLowerCase().indexOf(this._lowercasePattern); + if (index > -1) { + score = [Number.MAX_SAFE_INTEGER, 0]; + for (let i = this._lowercasePattern.length; i > 0; i--) { + score.push(index + i - 1); + } + } + } + else { + score = fuzzyScore(this._pattern, this._lowercasePattern, 0, labelStr, labelStr.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true }); + } + if (score) { + this._matchCount++; + return labels.length === 1 ? + { data: score, visibility } : + { data: { label: labelStr, score: score }, visibility }; + } + } + if (this.tree.findMode === TreeFindMode.Filter) { + if (typeof this.tree.options.defaultFindVisibility === 'number') { + return this.tree.options.defaultFindVisibility; + } + else if (this.tree.options.defaultFindVisibility) { + return this.tree.options.defaultFindVisibility(element); + } + else { + return 2 /* TreeVisibility.Recurse */; + } + } + else { + return { data: FuzzyScore.Default, visibility }; + } + } + reset() { + this._totalCount = 0; + this._matchCount = 0; + } + dispose() { + dispose(this.disposables); + } +} +export class ModeToggle extends Toggle { + constructor(opts) { + super({ + icon: Codicon.listFilter, + title: localize('filter', "Filter"), + isChecked: opts.isChecked ?? false, + hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'), + inputActiveOptionBorder: opts.inputActiveOptionBorder, + inputActiveOptionForeground: opts.inputActiveOptionForeground, + inputActiveOptionBackground: opts.inputActiveOptionBackground + }); + } +} +export class FuzzyToggle extends Toggle { + constructor(opts) { + super({ + icon: Codicon.searchFuzzy, + title: localize('fuzzySearch', "Fuzzy Match"), + isChecked: opts.isChecked ?? false, + hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'), + inputActiveOptionBorder: opts.inputActiveOptionBorder, + inputActiveOptionForeground: opts.inputActiveOptionForeground, + inputActiveOptionBackground: opts.inputActiveOptionBackground + }); + } +} +const unthemedFindWidgetStyles = { + inputBoxStyles: unthemedInboxStyles, + toggleStyles: unthemedToggleStyles, + listFilterWidgetBackground: undefined, + listFilterWidgetNoMatchesOutline: undefined, + listFilterWidgetOutline: undefined, + listFilterWidgetShadow: undefined +}; +export var TreeFindMode; +(function (TreeFindMode) { + TreeFindMode[TreeFindMode["Highlight"] = 0] = "Highlight"; + TreeFindMode[TreeFindMode["Filter"] = 1] = "Filter"; +})(TreeFindMode || (TreeFindMode = {})); +export var TreeFindMatchType; +(function (TreeFindMatchType) { + TreeFindMatchType[TreeFindMatchType["Fuzzy"] = 0] = "Fuzzy"; + TreeFindMatchType[TreeFindMatchType["Contiguous"] = 1] = "Contiguous"; +})(TreeFindMatchType || (TreeFindMatchType = {})); +class FindWidget extends Disposable { + set mode(mode) { + this.modeToggle.checked = mode === TreeFindMode.Filter; + this.findInput.inputBox.setPlaceHolder(mode === TreeFindMode.Filter ? localize('type to filter', "Type to filter") : localize('type to search', "Type to search")); + } + set matchType(matchType) { + this.matchTypeToggle.checked = matchType === TreeFindMatchType.Fuzzy; + } + constructor(container, tree, contextViewProvider, mode, matchType, options) { + super(); + this.tree = tree; + this.elements = h('.monaco-tree-type-filter', [ + h('.monaco-tree-type-filter-grab.codicon.codicon-debug-gripper@grab', { tabIndex: 0 }), + h('.monaco-tree-type-filter-input@findInput'), + h('.monaco-tree-type-filter-actionbar@actionbar'), + ]); + this.width = 0; + this.right = 0; + this.top = 0; + this._onDidDisable = new Emitter(); + container.appendChild(this.elements.root); + this._register(toDisposable(() => this.elements.root.remove())); + const styles = options?.styles ?? unthemedFindWidgetStyles; + if (styles.listFilterWidgetBackground) { + this.elements.root.style.backgroundColor = styles.listFilterWidgetBackground; + } + if (styles.listFilterWidgetShadow) { + this.elements.root.style.boxShadow = `0 0 8px 2px ${styles.listFilterWidgetShadow}`; + } + const toggleHoverDelegate = this._register(createInstantHoverDelegate()); + this.modeToggle = this._register(new ModeToggle({ ...styles.toggleStyles, isChecked: mode === TreeFindMode.Filter, hoverDelegate: toggleHoverDelegate })); + this.matchTypeToggle = this._register(new FuzzyToggle({ ...styles.toggleStyles, isChecked: matchType === TreeFindMatchType.Fuzzy, hoverDelegate: toggleHoverDelegate })); + this.onDidChangeMode = Event.map(this.modeToggle.onChange, () => this.modeToggle.checked ? TreeFindMode.Filter : TreeFindMode.Highlight, this._store); + this.onDidChangeMatchType = Event.map(this.matchTypeToggle.onChange, () => this.matchTypeToggle.checked ? TreeFindMatchType.Fuzzy : TreeFindMatchType.Contiguous, this._store); + this.findInput = this._register(new FindInput(this.elements.findInput, contextViewProvider, { + label: localize('type to search', "Type to search"), + additionalToggles: [this.modeToggle, this.matchTypeToggle], + showCommonFindToggles: false, + inputBoxStyles: styles.inputBoxStyles, + toggleStyles: styles.toggleStyles, + history: options?.history + })); + this.actionbar = this._register(new ActionBar(this.elements.actionbar)); + this.mode = mode; + const emitter = this._register(new DomEmitter(this.findInput.inputBox.inputElement, 'keydown')); + const onKeyDown = Event.chain(emitter.event, $ => $.map(e => new StandardKeyboardEvent(e))); + this._register(onKeyDown((e) => { + // Using equals() so we reserve modified keys for future use + if (e.equals(3 /* KeyCode.Enter */)) { + // This is the only keyboard way to return to the tree from a history item that isn't the last one + e.preventDefault(); + e.stopPropagation(); + this.findInput.inputBox.addToHistory(); + this.tree.domFocus(); + return; + } + if (e.equals(18 /* KeyCode.DownArrow */)) { + e.preventDefault(); + e.stopPropagation(); + if (this.findInput.inputBox.isAtLastInHistory() || this.findInput.inputBox.isNowhereInHistory()) { + // Retain original pre-history DownArrow behavior + this.findInput.inputBox.addToHistory(); + this.tree.domFocus(); + } + else { + // Downward through history + this.findInput.inputBox.showNextValue(); + } + return; + } + if (e.equals(16 /* KeyCode.UpArrow */)) { + e.preventDefault(); + e.stopPropagation(); + // Upward through history + this.findInput.inputBox.showPreviousValue(); + return; + } + })); + const closeAction = this._register(new Action('close', localize('close', "Close"), 'codicon codicon-close', true, () => this.dispose())); + this.actionbar.push(closeAction, { icon: true, label: false }); + const onGrabMouseDown = this._register(new DomEmitter(this.elements.grab, 'mousedown')); + this._register(onGrabMouseDown.event(e => { + const disposables = new DisposableStore(); + const onWindowMouseMove = disposables.add(new DomEmitter(getWindow(e), 'mousemove')); + const onWindowMouseUp = disposables.add(new DomEmitter(getWindow(e), 'mouseup')); + const startRight = this.right; + const startX = e.pageX; + const startTop = this.top; + const startY = e.pageY; + this.elements.grab.classList.add('grabbing'); + const transition = this.elements.root.style.transition; + this.elements.root.style.transition = 'unset'; + const update = (e) => { + const deltaX = e.pageX - startX; + this.right = startRight - deltaX; + const deltaY = e.pageY - startY; + this.top = startTop + deltaY; + this.layout(); + }; + disposables.add(onWindowMouseMove.event(update)); + disposables.add(onWindowMouseUp.event(e => { + update(e); + this.elements.grab.classList.remove('grabbing'); + this.elements.root.style.transition = transition; + disposables.dispose(); + })); + })); + const onGrabKeyDown = Event.chain(this._register(new DomEmitter(this.elements.grab, 'keydown')).event, $ => $.map(e => new StandardKeyboardEvent(e))); + this._register(onGrabKeyDown((e) => { + let right; + let top; + if (e.keyCode === 15 /* KeyCode.LeftArrow */) { + right = Number.POSITIVE_INFINITY; + } + else if (e.keyCode === 17 /* KeyCode.RightArrow */) { + right = 0; + } + else if (e.keyCode === 10 /* KeyCode.Space */) { + right = this.right === 0 ? Number.POSITIVE_INFINITY : 0; + } + if (e.keyCode === 16 /* KeyCode.UpArrow */) { + top = 0; + } + else if (e.keyCode === 18 /* KeyCode.DownArrow */) { + top = Number.POSITIVE_INFINITY; + } + if (right !== undefined) { + e.preventDefault(); + e.stopPropagation(); + this.right = right; + this.layout(); + } + if (top !== undefined) { + e.preventDefault(); + e.stopPropagation(); + this.top = top; + const transition = this.elements.root.style.transition; + this.elements.root.style.transition = 'unset'; + this.layout(); + setTimeout(() => { + this.elements.root.style.transition = transition; + }, 0); + } + })); + this.onDidChangeValue = this.findInput.onDidChange; + } + layout(width = this.width) { + this.width = width; + this.right = clamp(this.right, 0, Math.max(0, width - 212)); + this.elements.root.style.right = `${this.right}px`; + this.top = clamp(this.top, 0, 24); + this.elements.root.style.top = `${this.top}px`; + } + showMessage(message) { + this.findInput.showMessage(message); + } + clearMessage() { + this.findInput.clearMessage(); + } + async dispose() { + this._onDidDisable.fire(); + this.elements.root.classList.add('disabled'); + await timeout(300); + super.dispose(); + } +} +class FindController { + get pattern() { return this._pattern; } + get mode() { return this._mode; } + set mode(mode) { + if (mode === this._mode) { + return; + } + this._mode = mode; + if (this.widget) { + this.widget.mode = this._mode; + } + this.tree.refilter(); + this.render(); + this._onDidChangeMode.fire(mode); + } + get matchType() { return this._matchType; } + set matchType(matchType) { + if (matchType === this._matchType) { + return; + } + this._matchType = matchType; + if (this.widget) { + this.widget.matchType = this._matchType; + } + this.tree.refilter(); + this.render(); + this._onDidChangeMatchType.fire(matchType); + } + constructor(tree, model, view, filter, contextViewProvider, options = {}) { + this.tree = tree; + this.view = view; + this.filter = filter; + this.contextViewProvider = contextViewProvider; + this.options = options; + this._pattern = ''; + this.width = 0; + this._onDidChangeMode = new Emitter(); + this.onDidChangeMode = this._onDidChangeMode.event; + this._onDidChangeMatchType = new Emitter(); + this.onDidChangeMatchType = this._onDidChangeMatchType.event; + this._onDidChangePattern = new Emitter(); + this._onDidChangeOpenState = new Emitter(); + this.onDidChangeOpenState = this._onDidChangeOpenState.event; + this.enabledDisposables = new DisposableStore(); + this.disposables = new DisposableStore(); + this._mode = tree.options.defaultFindMode ?? TreeFindMode.Highlight; + this._matchType = tree.options.defaultFindMatchType ?? TreeFindMatchType.Fuzzy; + model.onDidSplice(this.onDidSpliceModel, this, this.disposables); + } + updateOptions(optionsUpdate = {}) { + if (optionsUpdate.defaultFindMode !== undefined) { + this.mode = optionsUpdate.defaultFindMode; + } + if (optionsUpdate.defaultFindMatchType !== undefined) { + this.matchType = optionsUpdate.defaultFindMatchType; + } + } + onDidSpliceModel() { + if (!this.widget || this.pattern.length === 0) { + return; + } + this.tree.refilter(); + this.render(); + } + render() { + const noMatches = this.filter.totalCount > 0 && this.filter.matchCount === 0; + if (this.pattern && noMatches) { + alert(localize('replFindNoResults', "No results")); + if (this.tree.options.showNotFoundMessage ?? true) { + this.widget?.showMessage({ type: 2 /* MessageType.WARNING */, content: localize('not found', "No elements found.") }); + } + else { + this.widget?.showMessage({ type: 2 /* MessageType.WARNING */ }); + } + } + else { + this.widget?.clearMessage(); + if (this.pattern) { + alert(localize('replFindResults', "{0} results", this.filter.matchCount)); + } + } + } + shouldAllowFocus(node) { + if (!this.widget || !this.pattern) { + return true; + } + if (this.filter.totalCount > 0 && this.filter.matchCount <= 1) { + return true; + } + return !FuzzyScore.isDefault(node.filterData); + } + layout(width) { + this.width = width; + this.widget?.layout(width); + } + dispose() { + this._history = undefined; + this._onDidChangePattern.dispose(); + this.enabledDisposables.dispose(); + this.disposables.dispose(); + } +} +function stickyScrollNodeStateEquals(node1, node2) { + return node1.position === node2.position && stickyScrollNodeEquals(node1, node2); +} +function stickyScrollNodeEquals(node1, node2) { + return node1.node.element === node2.node.element && + node1.startIndex === node2.startIndex && + node1.height === node2.height && + node1.endIndex === node2.endIndex; +} +class StickyScrollState { + constructor(stickyNodes = []) { + this.stickyNodes = stickyNodes; + } + get count() { return this.stickyNodes.length; } + equal(state) { + return equals(this.stickyNodes, state.stickyNodes, stickyScrollNodeStateEquals); + } + lastNodePartiallyVisible() { + if (this.count === 0) { + return false; + } + const lastStickyNode = this.stickyNodes[this.count - 1]; + if (this.count === 1) { + return lastStickyNode.position !== 0; + } + const secondLastStickyNode = this.stickyNodes[this.count - 2]; + return secondLastStickyNode.position + secondLastStickyNode.height !== lastStickyNode.position; + } + animationStateChanged(previousState) { + if (!equals(this.stickyNodes, previousState.stickyNodes, stickyScrollNodeEquals)) { + return false; + } + if (this.count === 0) { + return false; + } + const lastStickyNode = this.stickyNodes[this.count - 1]; + const previousLastStickyNode = previousState.stickyNodes[previousState.count - 1]; + return lastStickyNode.position !== previousLastStickyNode.position; + } +} +class DefaultStickyScrollDelegate { + constrainStickyScrollNodes(stickyNodes, stickyScrollMaxItemCount, maxWidgetHeight) { + for (let i = 0; i < stickyNodes.length; i++) { + const stickyNode = stickyNodes[i]; + const stickyNodeBottom = stickyNode.position + stickyNode.height; + if (stickyNodeBottom > maxWidgetHeight || i >= stickyScrollMaxItemCount) { + return stickyNodes.slice(0, i); + } + } + return stickyNodes; + } +} +class StickyScrollController extends Disposable { + constructor(tree, model, view, renderers, treeDelegate, options = {}) { + super(); + this.tree = tree; + this.model = model; + this.view = view; + this.treeDelegate = treeDelegate; + this.maxWidgetViewRatio = 0.4; + const stickyScrollOptions = this.validateStickySettings(options); + this.stickyScrollMaxItemCount = stickyScrollOptions.stickyScrollMaxItemCount; + this.stickyScrollDelegate = options.stickyScrollDelegate ?? new DefaultStickyScrollDelegate(); + this._widget = this._register(new StickyScrollWidget(view.getScrollableElement(), view, tree, renderers, treeDelegate, options.accessibilityProvider)); + this.onDidChangeHasFocus = this._widget.onDidChangeHasFocus; + this.onContextMenu = this._widget.onContextMenu; + this._register(view.onDidScroll(() => this.update())); + this._register(view.onDidChangeContentHeight(() => this.update())); + this._register(tree.onDidChangeCollapseState(() => this.update())); + this.update(); + } + get height() { + return this._widget.height; + } + getNodeAtHeight(height) { + let index; + if (height === 0) { + index = this.view.firstVisibleIndex; + } + else { + index = this.view.indexAt(height + this.view.scrollTop); + } + if (index < 0 || index >= this.view.length) { + return undefined; + } + return this.view.element(index); + } + update() { + const firstVisibleNode = this.getNodeAtHeight(0); + // Don't render anything if there are no elements + if (!firstVisibleNode || this.tree.scrollTop === 0) { + this._widget.setState(undefined); + return; + } + const stickyState = this.findStickyState(firstVisibleNode); + this._widget.setState(stickyState); + } + findStickyState(firstVisibleNode) { + const stickyNodes = []; + let firstVisibleNodeUnderWidget = firstVisibleNode; + let stickyNodesHeight = 0; + let nextStickyNode = this.getNextStickyNode(firstVisibleNodeUnderWidget, undefined, stickyNodesHeight); + while (nextStickyNode) { + stickyNodes.push(nextStickyNode); + stickyNodesHeight += nextStickyNode.height; + if (stickyNodes.length <= this.stickyScrollMaxItemCount) { + firstVisibleNodeUnderWidget = this.getNextVisibleNode(nextStickyNode); + if (!firstVisibleNodeUnderWidget) { + break; + } + } + nextStickyNode = this.getNextStickyNode(firstVisibleNodeUnderWidget, nextStickyNode.node, stickyNodesHeight); + } + const contrainedStickyNodes = this.constrainStickyNodes(stickyNodes); + return contrainedStickyNodes.length ? new StickyScrollState(contrainedStickyNodes) : undefined; + } + getNextVisibleNode(previousStickyNode) { + return this.getNodeAtHeight(previousStickyNode.position + previousStickyNode.height); + } + getNextStickyNode(firstVisibleNodeUnderWidget, previousStickyNode, stickyNodesHeight) { + const nextStickyNode = this.getAncestorUnderPrevious(firstVisibleNodeUnderWidget, previousStickyNode); + if (!nextStickyNode) { + return undefined; + } + if (nextStickyNode === firstVisibleNodeUnderWidget) { + if (!this.nodeIsUncollapsedParent(firstVisibleNodeUnderWidget)) { + return undefined; + } + if (this.nodeTopAlignsWithStickyNodesBottom(firstVisibleNodeUnderWidget, stickyNodesHeight)) { + return undefined; + } + } + return this.createStickyScrollNode(nextStickyNode, stickyNodesHeight); + } + nodeTopAlignsWithStickyNodesBottom(node, stickyNodesHeight) { + const nodeIndex = this.getNodeIndex(node); + const elementTop = this.view.getElementTop(nodeIndex); + const stickyPosition = stickyNodesHeight; + return this.view.scrollTop === elementTop - stickyPosition; + } + createStickyScrollNode(node, currentStickyNodesHeight) { + const height = this.treeDelegate.getHeight(node); + const { startIndex, endIndex } = this.getNodeRange(node); + const position = this.calculateStickyNodePosition(endIndex, currentStickyNodesHeight, height); + return { node, position, height, startIndex, endIndex }; + } + getAncestorUnderPrevious(node, previousAncestor = undefined) { + let currentAncestor = node; + let parentOfcurrentAncestor = this.getParentNode(currentAncestor); + while (parentOfcurrentAncestor) { + if (parentOfcurrentAncestor === previousAncestor) { + return currentAncestor; + } + currentAncestor = parentOfcurrentAncestor; + parentOfcurrentAncestor = this.getParentNode(currentAncestor); + } + if (previousAncestor === undefined) { + return currentAncestor; + } + return undefined; + } + calculateStickyNodePosition(lastDescendantIndex, stickyRowPositionTop, stickyNodeHeight) { + let lastChildRelativeTop = this.view.getRelativeTop(lastDescendantIndex); + // If the last descendant is only partially visible at the top of the view, getRelativeTop() returns null + // In that case, utilize the next node's relative top to calculate the sticky node's position + if (lastChildRelativeTop === null && this.view.firstVisibleIndex === lastDescendantIndex && lastDescendantIndex + 1 < this.view.length) { + const nodeHeight = this.treeDelegate.getHeight(this.view.element(lastDescendantIndex)); + const nextNodeRelativeTop = this.view.getRelativeTop(lastDescendantIndex + 1); + lastChildRelativeTop = nextNodeRelativeTop ? nextNodeRelativeTop - nodeHeight / this.view.renderHeight : null; + } + if (lastChildRelativeTop === null) { + return stickyRowPositionTop; + } + const lastChildNode = this.view.element(lastDescendantIndex); + const lastChildHeight = this.treeDelegate.getHeight(lastChildNode); + const topOfLastChild = lastChildRelativeTop * this.view.renderHeight; + const bottomOfLastChild = topOfLastChild + lastChildHeight; + if (stickyRowPositionTop + stickyNodeHeight > bottomOfLastChild && stickyRowPositionTop <= bottomOfLastChild) { + return bottomOfLastChild - stickyNodeHeight; + } + return stickyRowPositionTop; + } + constrainStickyNodes(stickyNodes) { + if (stickyNodes.length === 0) { + return []; + } + // Check if sticky nodes need to be constrained + const maximumStickyWidgetHeight = this.view.renderHeight * this.maxWidgetViewRatio; + const lastStickyNode = stickyNodes[stickyNodes.length - 1]; + if (stickyNodes.length <= this.stickyScrollMaxItemCount && lastStickyNode.position + lastStickyNode.height <= maximumStickyWidgetHeight) { + return stickyNodes; + } + // constrain sticky nodes + const constrainedStickyNodes = this.stickyScrollDelegate.constrainStickyScrollNodes(stickyNodes, this.stickyScrollMaxItemCount, maximumStickyWidgetHeight); + if (!constrainedStickyNodes.length) { + return []; + } + // Validate constraints + const lastConstrainedStickyNode = constrainedStickyNodes[constrainedStickyNodes.length - 1]; + if (constrainedStickyNodes.length > this.stickyScrollMaxItemCount || lastConstrainedStickyNode.position + lastConstrainedStickyNode.height > maximumStickyWidgetHeight) { + throw new Error('stickyScrollDelegate violates constraints'); + } + return constrainedStickyNodes; + } + getParentNode(node) { + const nodeLocation = this.model.getNodeLocation(node); + const parentLocation = this.model.getParentNodeLocation(nodeLocation); + return parentLocation ? this.model.getNode(parentLocation) : undefined; + } + nodeIsUncollapsedParent(node) { + const nodeLocation = this.model.getNodeLocation(node); + return this.model.getListRenderCount(nodeLocation) > 1; + } + getNodeIndex(node) { + const nodeLocation = this.model.getNodeLocation(node); + const nodeIndex = this.model.getListIndex(nodeLocation); + return nodeIndex; + } + getNodeRange(node) { + const nodeLocation = this.model.getNodeLocation(node); + const startIndex = this.model.getListIndex(nodeLocation); + if (startIndex < 0) { + throw new Error('Node not found in tree'); + } + const renderCount = this.model.getListRenderCount(nodeLocation); + const endIndex = startIndex + renderCount - 1; + return { startIndex, endIndex }; + } + nodePositionTopBelowWidget(node) { + const ancestors = []; + let currentAncestor = this.getParentNode(node); + while (currentAncestor) { + ancestors.push(currentAncestor); + currentAncestor = this.getParentNode(currentAncestor); + } + let widgetHeight = 0; + for (let i = 0; i < ancestors.length && i < this.stickyScrollMaxItemCount; i++) { + widgetHeight += this.treeDelegate.getHeight(ancestors[i]); + } + return widgetHeight; + } + domFocus() { + this._widget.domFocus(); + } + // Whether sticky scroll was the last focused part in the tree or not + focusedLast() { + return this._widget.focusedLast(); + } + updateOptions(optionsUpdate = {}) { + if (!optionsUpdate.stickyScrollMaxItemCount) { + return; + } + const validatedOptions = this.validateStickySettings(optionsUpdate); + if (this.stickyScrollMaxItemCount !== validatedOptions.stickyScrollMaxItemCount) { + this.stickyScrollMaxItemCount = validatedOptions.stickyScrollMaxItemCount; + this.update(); + } + } + validateStickySettings(options) { + let stickyScrollMaxItemCount = 7; + if (typeof options.stickyScrollMaxItemCount === 'number') { + stickyScrollMaxItemCount = Math.max(options.stickyScrollMaxItemCount, 1); + } + return { stickyScrollMaxItemCount }; + } +} +class StickyScrollWidget { + constructor(container, view, tree, treeRenderers, treeDelegate, accessibilityProvider) { + this.view = view; + this.tree = tree; + this.treeRenderers = treeRenderers; + this.treeDelegate = treeDelegate; + this.accessibilityProvider = accessibilityProvider; + this._previousElements = []; + this._previousStateDisposables = new DisposableStore(); + this._rootDomNode = $('.monaco-tree-sticky-container.empty'); + container.appendChild(this._rootDomNode); + const shadow = $('.monaco-tree-sticky-container-shadow'); + this._rootDomNode.appendChild(shadow); + this.stickyScrollFocus = new StickyScrollFocus(this._rootDomNode, view); + this.onDidChangeHasFocus = this.stickyScrollFocus.onDidChangeHasFocus; + this.onContextMenu = this.stickyScrollFocus.onContextMenu; + } + get height() { + if (!this._previousState) { + return 0; + } + const lastElement = this._previousState.stickyNodes[this._previousState.count - 1]; + return lastElement.position + lastElement.height; + } + setState(state) { + const wasVisible = !!this._previousState && this._previousState.count > 0; + const isVisible = !!state && state.count > 0; + // If state has not changed, do nothing + if ((!wasVisible && !isVisible) || (wasVisible && isVisible && this._previousState.equal(state))) { + return; + } + // Update visibility of the widget if changed + if (wasVisible !== isVisible) { + this.setVisible(isVisible); + } + if (!isVisible) { + this._previousState = undefined; + this._previousElements = []; + this._previousStateDisposables.clear(); + return; + } + const lastStickyNode = state.stickyNodes[state.count - 1]; + // If the new state is only a change in the last node's position, update the position of the last element + if (this._previousState && state.animationStateChanged(this._previousState)) { + this._previousElements[this._previousState.count - 1].style.top = `${lastStickyNode.position}px`; + } + // create new dom elements + else { + this._previousStateDisposables.clear(); + const elements = Array(state.count); + for (let stickyIndex = state.count - 1; stickyIndex >= 0; stickyIndex--) { + const stickyNode = state.stickyNodes[stickyIndex]; + const { element, disposable } = this.createElement(stickyNode, stickyIndex, state.count); + elements[stickyIndex] = element; + this._rootDomNode.appendChild(element); + this._previousStateDisposables.add(disposable); + } + this.stickyScrollFocus.updateElements(elements, state); + this._previousElements = elements; + } + this._previousState = state; + // Set the height of the widget to the bottom of the last sticky node + this._rootDomNode.style.height = `${lastStickyNode.position + lastStickyNode.height}px`; + } + createElement(stickyNode, stickyIndex, stickyNodesTotal) { + const nodeIndex = stickyNode.startIndex; + // Sticky element container + const stickyElement = document.createElement('div'); + stickyElement.style.top = `${stickyNode.position}px`; + if (this.tree.options.setRowHeight !== false) { + stickyElement.style.height = `${stickyNode.height}px`; + } + if (this.tree.options.setRowLineHeight !== false) { + stickyElement.style.lineHeight = `${stickyNode.height}px`; + } + stickyElement.classList.add('monaco-tree-sticky-row'); + stickyElement.classList.add('monaco-list-row'); + stickyElement.setAttribute('data-index', `${nodeIndex}`); + stickyElement.setAttribute('data-parity', nodeIndex % 2 === 0 ? 'even' : 'odd'); + stickyElement.setAttribute('id', this.view.getElementID(nodeIndex)); + const accessibilityDisposable = this.setAccessibilityAttributes(stickyElement, stickyNode.node.element, stickyIndex, stickyNodesTotal); + // Get the renderer for the node + const nodeTemplateId = this.treeDelegate.getTemplateId(stickyNode.node); + const renderer = this.treeRenderers.find((renderer) => renderer.templateId === nodeTemplateId); + if (!renderer) { + throw new Error(`No renderer found for template id ${nodeTemplateId}`); + } + // To make sure we do not influence the original node, we create a copy of the node + // We need to check if it is already a unique instance of the node by the delegate + let nodeCopy = stickyNode.node; + if (nodeCopy === this.tree.getNode(this.tree.getNodeLocation(stickyNode.node))) { + nodeCopy = new Proxy(stickyNode.node, {}); + } + // Render the element + const templateData = renderer.renderTemplate(stickyElement); + renderer.renderElement(nodeCopy, stickyNode.startIndex, templateData, stickyNode.height); + // Remove the element from the DOM when state is disposed + const disposable = toDisposable(() => { + accessibilityDisposable.dispose(); + renderer.disposeElement(nodeCopy, stickyNode.startIndex, templateData, stickyNode.height); + renderer.disposeTemplate(templateData); + stickyElement.remove(); + }); + return { element: stickyElement, disposable }; + } + setAccessibilityAttributes(container, element, stickyIndex, stickyNodesTotal) { + if (!this.accessibilityProvider) { + return Disposable.None; + } + if (this.accessibilityProvider.getSetSize) { + container.setAttribute('aria-setsize', String(this.accessibilityProvider.getSetSize(element, stickyIndex, stickyNodesTotal))); + } + if (this.accessibilityProvider.getPosInSet) { + container.setAttribute('aria-posinset', String(this.accessibilityProvider.getPosInSet(element, stickyIndex))); + } + if (this.accessibilityProvider.getRole) { + container.setAttribute('role', this.accessibilityProvider.getRole(element) ?? 'treeitem'); + } + const ariaLabel = this.accessibilityProvider.getAriaLabel(element); + const observable = (ariaLabel && typeof ariaLabel !== 'string') ? ariaLabel : constObservable(ariaLabel); + const result = autorun(reader => { + const value = reader.readObservable(observable); + if (value) { + container.setAttribute('aria-label', value); + } + else { + container.removeAttribute('aria-label'); + } + }); + if (typeof ariaLabel === 'string') { + } + else if (ariaLabel) { + container.setAttribute('aria-label', ariaLabel.get()); + } + const ariaLevel = this.accessibilityProvider.getAriaLevel && this.accessibilityProvider.getAriaLevel(element); + if (typeof ariaLevel === 'number') { + container.setAttribute('aria-level', `${ariaLevel}`); + } + // Sticky Scroll elements can not be selected + container.setAttribute('aria-selected', String(false)); + return result; + } + setVisible(visible) { + this._rootDomNode.classList.toggle('empty', !visible); + if (!visible) { + this.stickyScrollFocus.updateElements([], undefined); + } + } + domFocus() { + this.stickyScrollFocus.domFocus(); + } + focusedLast() { + return this.stickyScrollFocus.focusedLast(); + } + dispose() { + this.stickyScrollFocus.dispose(); + this._previousStateDisposables.dispose(); + this._rootDomNode.remove(); + } +} +class StickyScrollFocus extends Disposable { + get domHasFocus() { return this._domHasFocus; } + set domHasFocus(hasFocus) { + if (hasFocus !== this._domHasFocus) { + this._onDidChangeHasFocus.fire(hasFocus); + this._domHasFocus = hasFocus; + } + } + constructor(container, view) { + super(); + this.container = container; + this.view = view; + this.focusedIndex = -1; + this.elements = []; + this._onDidChangeHasFocus = new Emitter(); + this.onDidChangeHasFocus = this._onDidChangeHasFocus.event; + this._onContextMenu = new Emitter(); + this.onContextMenu = this._onContextMenu.event; + this._domHasFocus = false; + this._register(addDisposableListener(this.container, 'focus', () => this.onFocus())); + this._register(addDisposableListener(this.container, 'blur', () => this.onBlur())); + this._register(this.view.onDidFocus(() => this.toggleStickyScrollFocused(false))); + this._register(this.view.onKeyDown((e) => this.onKeyDown(e))); + this._register(this.view.onMouseDown((e) => this.onMouseDown(e))); + this._register(this.view.onContextMenu((e) => this.handleContextMenu(e))); + } + handleContextMenu(e) { + const target = e.browserEvent.target; + if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) { + if (this.focusedLast()) { + this.view.domFocus(); + } + return; + } + // The list handles the context menu triggered by a mouse event + // In that case only set the focus of the element clicked and leave the rest to the list to handle + if (!isKeyboardEvent(e.browserEvent)) { + if (!this.state) { + throw new Error('Context menu should not be triggered when state is undefined'); + } + const stickyIndex = this.state.stickyNodes.findIndex(stickyNode => stickyNode.node.element === e.element?.element); + if (stickyIndex === -1) { + throw new Error('Context menu should not be triggered when element is not in sticky scroll widget'); + } + this.container.focus(); + this.setFocus(stickyIndex); + return; + } + if (!this.state || this.focusedIndex < 0) { + throw new Error('Context menu key should not be triggered when focus is not in sticky scroll widget'); + } + const stickyNode = this.state.stickyNodes[this.focusedIndex]; + const element = stickyNode.node.element; + const anchor = this.elements[this.focusedIndex]; + this._onContextMenu.fire({ element, anchor, browserEvent: e.browserEvent, isStickyScroll: true }); + } + onKeyDown(e) { + // Sticky Scroll Navigation + if (this.domHasFocus && this.state) { + // Move up + if (e.key === 'ArrowUp') { + this.setFocusedElement(Math.max(0, this.focusedIndex - 1)); + e.preventDefault(); + e.stopPropagation(); + } + // Move down, if last sticky node is focused, move focus into first child of last sticky node + else if (e.key === 'ArrowDown' || e.key === 'ArrowRight') { + if (this.focusedIndex >= this.state.count - 1) { + const nodeIndexToFocus = this.state.stickyNodes[this.state.count - 1].startIndex + 1; + this.view.domFocus(); + this.view.setFocus([nodeIndexToFocus]); + this.scrollNodeUnderWidget(nodeIndexToFocus, this.state); + } + else { + this.setFocusedElement(this.focusedIndex + 1); + } + e.preventDefault(); + e.stopPropagation(); + } + } + } + onMouseDown(e) { + const target = e.browserEvent.target; + if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) { + return; + } + e.browserEvent.preventDefault(); + e.browserEvent.stopPropagation(); + } + updateElements(elements, state) { + if (state && state.count === 0) { + throw new Error('Sticky scroll state must be undefined when there are no sticky nodes'); + } + if (state && state.count !== elements.length) { + throw new Error('Sticky scroll focus received illigel state'); + } + const previousIndex = this.focusedIndex; + this.removeFocus(); + this.elements = elements; + this.state = state; + if (state) { + const newFocusedIndex = clamp(previousIndex, 0, state.count - 1); + this.setFocus(newFocusedIndex); + } + else { + if (this.domHasFocus) { + this.view.domFocus(); + } + } + // must come last as it calls blur() + this.container.tabIndex = state ? 0 : -1; + } + setFocusedElement(stickyIndex) { + // doesn't imply that the widget has (or will have) focus + const state = this.state; + if (!state) { + throw new Error('Cannot set focus when state is undefined'); + } + this.setFocus(stickyIndex); + if (stickyIndex < state.count - 1) { + return; + } + // If the last sticky node is not fully visible, scroll it into view + if (state.lastNodePartiallyVisible()) { + const lastStickyNode = state.stickyNodes[stickyIndex]; + this.scrollNodeUnderWidget(lastStickyNode.endIndex + 1, state); + } + } + scrollNodeUnderWidget(nodeIndex, state) { + const lastStickyNode = state.stickyNodes[state.count - 1]; + const secondLastStickyNode = state.count > 1 ? state.stickyNodes[state.count - 2] : undefined; + const elementScrollTop = this.view.getElementTop(nodeIndex); + const elementTargetViewTop = secondLastStickyNode ? secondLastStickyNode.position + secondLastStickyNode.height + lastStickyNode.height : lastStickyNode.height; + this.view.scrollTop = elementScrollTop - elementTargetViewTop; + } + domFocus() { + if (!this.state) { + throw new Error('Cannot focus when state is undefined'); + } + this.container.focus(); + } + focusedLast() { + if (!this.state) { + return false; + } + return this.view.getHTMLElement().classList.contains('sticky-scroll-focused'); + } + removeFocus() { + if (this.focusedIndex === -1) { + return; + } + this.toggleElementFocus(this.elements[this.focusedIndex], false); + this.focusedIndex = -1; + } + setFocus(newFocusIndex) { + if (0 > newFocusIndex) { + throw new Error('addFocus() can not remove focus'); + } + if (!this.state && newFocusIndex >= 0) { + throw new Error('Cannot set focus index when state is undefined'); + } + if (this.state && newFocusIndex >= this.state.count) { + throw new Error('Cannot set focus index to an index that does not exist'); + } + const oldIndex = this.focusedIndex; + if (oldIndex >= 0) { + this.toggleElementFocus(this.elements[oldIndex], false); + } + if (newFocusIndex >= 0) { + this.toggleElementFocus(this.elements[newFocusIndex], true); + } + this.focusedIndex = newFocusIndex; + } + toggleElementFocus(element, focused) { + this.toggleElementActiveFocus(element, focused && this.domHasFocus); + this.toggleElementPassiveFocus(element, focused); + } + toggleCurrentElementActiveFocus(focused) { + if (this.focusedIndex === -1) { + return; + } + this.toggleElementActiveFocus(this.elements[this.focusedIndex], focused); + } + toggleElementActiveFocus(element, focused) { + // active focus is set when sticky scroll has focus + element.classList.toggle('focused', focused); + } + toggleElementPassiveFocus(element, focused) { + // passive focus allows to show focus when sticky scroll does not have focus + // for example when the context menu has focus + element.classList.toggle('passive-focused', focused); + } + toggleStickyScrollFocused(focused) { + // Weather the last focus in the view was sticky scroll and not the list + // Is only removed when the focus is back in the tree an no longer in sticky scroll + this.view.getHTMLElement().classList.toggle('sticky-scroll-focused', focused); + } + onFocus() { + if (!this.state || this.elements.length === 0) { + throw new Error('Cannot focus when state is undefined or elements are empty'); + } + this.domHasFocus = true; + this.toggleStickyScrollFocused(true); + this.toggleCurrentElementActiveFocus(true); + if (this.focusedIndex === -1) { + this.setFocus(0); + } + } + onBlur() { + this.domHasFocus = false; + this.toggleCurrentElementActiveFocus(false); + } + dispose() { + this.toggleStickyScrollFocused(false); + this._onDidChangeHasFocus.fire(false); + super.dispose(); + } +} +function asTreeMouseEvent(event) { + let target = TreeMouseEventTarget.Unknown; + if (hasParentWithClass(event.browserEvent.target, 'monaco-tl-twistie', 'monaco-tl-row')) { + target = TreeMouseEventTarget.Twistie; + } + else if (hasParentWithClass(event.browserEvent.target, 'monaco-tl-contents', 'monaco-tl-row')) { + target = TreeMouseEventTarget.Element; + } + else if (hasParentWithClass(event.browserEvent.target, 'monaco-tree-type-filter', 'monaco-list')) { + target = TreeMouseEventTarget.Filter; + } + return { + browserEvent: event.browserEvent, + element: event.element ? event.element.element : null, + target + }; +} +function asTreeContextMenuEvent(event) { + const isStickyScroll = isStickyScrollContainer(event.browserEvent.target); + return { + element: event.element ? event.element.element : null, + browserEvent: event.browserEvent, + anchor: event.anchor, + isStickyScroll + }; +} +function dfs(node, fn) { + fn(node); + node.children.forEach(child => dfs(child, fn)); +} +/** + * The trait concept needs to exist at the tree level, because collapsed + * tree nodes will not be known by the list. + */ +class Trait { + get nodeSet() { + if (!this._nodeSet) { + this._nodeSet = this.createNodeSet(); + } + return this._nodeSet; + } + constructor(getFirstViewElementWithTrait, identityProvider) { + this.getFirstViewElementWithTrait = getFirstViewElementWithTrait; + this.identityProvider = identityProvider; + this.nodes = []; + this._onDidChange = new Emitter(); + this.onDidChange = this._onDidChange.event; + } + set(nodes, browserEvent) { + if (!browserEvent?.__forceEvent && equals(this.nodes, nodes)) { + return; + } + this._set(nodes, false, browserEvent); + } + _set(nodes, silent, browserEvent) { + this.nodes = [...nodes]; + this.elements = undefined; + this._nodeSet = undefined; + if (!silent) { + const that = this; + this._onDidChange.fire({ get elements() { return that.get(); }, browserEvent }); + } + } + get() { + if (!this.elements) { + this.elements = this.nodes.map(node => node.element); + } + return [...this.elements]; + } + getNodes() { + return this.nodes; + } + has(node) { + return this.nodeSet.has(node); + } + onDidModelSplice({ insertedNodes, deletedNodes }) { + if (!this.identityProvider) { + const set = this.createNodeSet(); + const visit = (node) => set.delete(node); + deletedNodes.forEach(node => dfs(node, visit)); + this.set([...set.values()]); + return; + } + const deletedNodesIdSet = new Set(); + const deletedNodesVisitor = (node) => deletedNodesIdSet.add(this.identityProvider.getId(node.element).toString()); + deletedNodes.forEach(node => dfs(node, deletedNodesVisitor)); + const insertedNodesMap = new Map(); + const insertedNodesVisitor = (node) => insertedNodesMap.set(this.identityProvider.getId(node.element).toString(), node); + insertedNodes.forEach(node => dfs(node, insertedNodesVisitor)); + const nodes = []; + for (const node of this.nodes) { + const id = this.identityProvider.getId(node.element).toString(); + const wasDeleted = deletedNodesIdSet.has(id); + if (!wasDeleted) { + nodes.push(node); + } + else { + const insertedNode = insertedNodesMap.get(id); + if (insertedNode && insertedNode.visible) { + nodes.push(insertedNode); + } + } + } + if (this.nodes.length > 0 && nodes.length === 0) { + const node = this.getFirstViewElementWithTrait(); + if (node) { + nodes.push(node); + } + } + this._set(nodes, true); + } + createNodeSet() { + const set = new Set(); + for (const node of this.nodes) { + set.add(node); + } + return set; + } +} +class TreeNodeListMouseController extends MouseController { + constructor(list, tree, stickyScrollProvider) { + super(list); + this.tree = tree; + this.stickyScrollProvider = stickyScrollProvider; + } + onViewPointer(e) { + if (isButton(e.browserEvent.target) || + isInputElement(e.browserEvent.target) || + isMonacoEditor(e.browserEvent.target)) { + return; + } + if (e.browserEvent.isHandledByList) { + return; + } + const node = e.element; + if (!node) { + return super.onViewPointer(e); + } + if (this.isSelectionRangeChangeEvent(e) || this.isSelectionSingleChangeEvent(e)) { + return super.onViewPointer(e); + } + const target = e.browserEvent.target; + const onTwistie = target.classList.contains('monaco-tl-twistie') + || (target.classList.contains('monaco-icon-label') && target.classList.contains('folder-icon') && e.browserEvent.offsetX < 16); + const isStickyElement = isStickyScrollElement(e.browserEvent.target); + let expandOnlyOnTwistieClick = false; + if (isStickyElement) { + expandOnlyOnTwistieClick = true; + } + else if (typeof this.tree.expandOnlyOnTwistieClick === 'function') { + expandOnlyOnTwistieClick = this.tree.expandOnlyOnTwistieClick(node.element); + } + else { + expandOnlyOnTwistieClick = !!this.tree.expandOnlyOnTwistieClick; + } + if (!isStickyElement) { + if (expandOnlyOnTwistieClick && !onTwistie && e.browserEvent.detail !== 2) { + return super.onViewPointer(e); + } + if (!this.tree.expandOnDoubleClick && e.browserEvent.detail === 2) { + return super.onViewPointer(e); + } + } + else { + this.handleStickyScrollMouseEvent(e, node); + } + if (node.collapsible && (!isStickyElement || onTwistie)) { + const location = this.tree.getNodeLocation(node); + const recursive = e.browserEvent.altKey; + this.tree.setFocus([location]); + this.tree.toggleCollapsed(location, recursive); + if (onTwistie) { + // Do not set this before calling a handler on the super class, because it will reject it as handled + e.browserEvent.isHandledByList = true; + return; + } + } + if (!isStickyElement) { + super.onViewPointer(e); + } + } + handleStickyScrollMouseEvent(e, node) { + if (isMonacoCustomToggle(e.browserEvent.target) || isActionItem(e.browserEvent.target)) { + return; + } + const stickyScrollController = this.stickyScrollProvider(); + if (!stickyScrollController) { + throw new Error('Sticky scroll controller not found'); + } + const nodeIndex = this.list.indexOf(node); + const elementScrollTop = this.list.getElementTop(nodeIndex); + const elementTargetViewTop = stickyScrollController.nodePositionTopBelowWidget(node); + this.tree.scrollTop = elementScrollTop - elementTargetViewTop; + this.list.domFocus(); + this.list.setFocus([nodeIndex]); + this.list.setSelection([nodeIndex]); + } + onDoubleClick(e) { + const onTwistie = e.browserEvent.target.classList.contains('monaco-tl-twistie'); + if (onTwistie || !this.tree.expandOnDoubleClick) { + return; + } + if (e.browserEvent.isHandledByList) { + return; + } + super.onDoubleClick(e); + } + // to make sure dom focus is not stolen (for example with context menu) + onMouseDown(e) { + const target = e.browserEvent.target; + if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) { + super.onMouseDown(e); + return; + } + } + onContextMenu(e) { + const target = e.browserEvent.target; + if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) { + super.onContextMenu(e); + return; + } + } +} +/** + * We use this List subclass to restore selection and focus as nodes + * get rendered in the list, possibly due to a node expand() call. + */ +class TreeNodeList extends List { + constructor(user, container, virtualDelegate, renderers, focusTrait, selectionTrait, anchorTrait, options) { + super(user, container, virtualDelegate, renderers, options); + this.focusTrait = focusTrait; + this.selectionTrait = selectionTrait; + this.anchorTrait = anchorTrait; + } + createMouseController(options) { + return new TreeNodeListMouseController(this, options.tree, options.stickyScrollProvider); + } + splice(start, deleteCount, elements = []) { + super.splice(start, deleteCount, elements); + if (elements.length === 0) { + return; + } + const additionalFocus = []; + const additionalSelection = []; + let anchor; + elements.forEach((node, index) => { + if (this.focusTrait.has(node)) { + additionalFocus.push(start + index); + } + if (this.selectionTrait.has(node)) { + additionalSelection.push(start + index); + } + if (this.anchorTrait.has(node)) { + anchor = start + index; + } + }); + if (additionalFocus.length > 0) { + super.setFocus(distinct([...super.getFocus(), ...additionalFocus])); + } + if (additionalSelection.length > 0) { + super.setSelection(distinct([...super.getSelection(), ...additionalSelection])); + } + if (typeof anchor === 'number') { + super.setAnchor(anchor); + } + } + setFocus(indexes, browserEvent, fromAPI = false) { + super.setFocus(indexes, browserEvent); + if (!fromAPI) { + this.focusTrait.set(indexes.map(i => this.element(i)), browserEvent); + } + } + setSelection(indexes, browserEvent, fromAPI = false) { + super.setSelection(indexes, browserEvent); + if (!fromAPI) { + this.selectionTrait.set(indexes.map(i => this.element(i)), browserEvent); + } + } + setAnchor(index, fromAPI = false) { + super.setAnchor(index); + if (!fromAPI) { + if (typeof index === 'undefined') { + this.anchorTrait.set([]); + } + else { + this.anchorTrait.set([this.element(index)]); + } + } + } +} +export class AbstractTree { + get onDidScroll() { return this.view.onDidScroll; } + get onDidChangeFocus() { return this.eventBufferer.wrapEvent(this.focus.onDidChange); } + get onDidChangeSelection() { return this.eventBufferer.wrapEvent(this.selection.onDidChange); } + get onMouseDblClick() { return Event.filter(Event.map(this.view.onMouseDblClick, asTreeMouseEvent), e => e.target !== TreeMouseEventTarget.Filter); } + get onMouseOver() { return Event.map(this.view.onMouseOver, asTreeMouseEvent); } + get onMouseOut() { return Event.map(this.view.onMouseOut, asTreeMouseEvent); } + get onContextMenu() { return Event.any(Event.filter(Event.map(this.view.onContextMenu, asTreeContextMenuEvent), e => !e.isStickyScroll), this.stickyScrollController?.onContextMenu ?? Event.None); } + get onPointer() { return Event.map(this.view.onPointer, asTreeMouseEvent); } + get onKeyDown() { return this.view.onKeyDown; } + get onDidFocus() { return this.view.onDidFocus; } + get onDidChangeModel() { return Event.signal(this.model.onDidSplice); } + get onDidChangeCollapseState() { return this.model.onDidChangeCollapseState; } + get findMode() { return this.findController?.mode ?? TreeFindMode.Highlight; } + set findMode(findMode) { if (this.findController) { + this.findController.mode = findMode; + } } + get findMatchType() { return this.findController?.matchType ?? TreeFindMatchType.Fuzzy; } + set findMatchType(findFuzzy) { if (this.findController) { + this.findController.matchType = findFuzzy; + } } + get expandOnDoubleClick() { return typeof this._options.expandOnDoubleClick === 'undefined' ? true : this._options.expandOnDoubleClick; } + get expandOnlyOnTwistieClick() { return typeof this._options.expandOnlyOnTwistieClick === 'undefined' ? true : this._options.expandOnlyOnTwistieClick; } + get onDidDispose() { return this.view.onDidDispose; } + constructor(_user, container, delegate, renderers, _options = {}) { + this._user = _user; + this._options = _options; + this.eventBufferer = new EventBufferer(); + this.onDidChangeFindOpenState = Event.None; + this.onDidChangeStickyScrollFocused = Event.None; + this.disposables = new DisposableStore(); + this._onWillRefilter = new Emitter(); + this.onWillRefilter = this._onWillRefilter.event; + this._onDidUpdateOptions = new Emitter(); + this.treeDelegate = new ComposedTreeDelegate(delegate); + const onDidChangeCollapseStateRelay = new Relay(); + const onDidChangeActiveNodes = new Relay(); + const activeNodes = this.disposables.add(new EventCollection(onDidChangeActiveNodes.event)); + const renderedIndentGuides = new SetMap(); + this.renderers = renderers.map(r => new TreeRenderer(r, () => this.model, onDidChangeCollapseStateRelay.event, activeNodes, renderedIndentGuides, _options)); + for (const r of this.renderers) { + this.disposables.add(r); + } + let filter; + if (_options.keyboardNavigationLabelProvider) { + filter = new FindFilter(this, _options.keyboardNavigationLabelProvider, _options.filter); + _options = { ..._options, filter: filter }; // TODO need typescript help here + this.disposables.add(filter); + } + this.focus = new Trait(() => this.view.getFocusedElements()[0], _options.identityProvider); + this.selection = new Trait(() => this.view.getSelectedElements()[0], _options.identityProvider); + this.anchor = new Trait(() => this.view.getAnchorElement(), _options.identityProvider); + this.view = new TreeNodeList(_user, container, this.treeDelegate, this.renderers, this.focus, this.selection, this.anchor, { ...asListOptions(() => this.model, _options), tree: this, stickyScrollProvider: () => this.stickyScrollController }); + this.model = this.createModel(_user, this.view, _options); + onDidChangeCollapseStateRelay.input = this.model.onDidChangeCollapseState; + const onDidModelSplice = Event.forEach(this.model.onDidSplice, e => { + this.eventBufferer.bufferEvents(() => { + this.focus.onDidModelSplice(e); + this.selection.onDidModelSplice(e); + }); + }, this.disposables); + // Make sure the `forEach` always runs + onDidModelSplice(() => null, null, this.disposables); + // Active nodes can change when the model changes or when focus or selection change. + // We debounce it with 0 delay since these events may fire in the same stack and we only + // want to run this once. It also doesn't matter if it runs on the next tick since it's only + // a nice to have UI feature. + const activeNodesEmitter = this.disposables.add(new Emitter()); + const activeNodesDebounce = this.disposables.add(new Delayer(0)); + this.disposables.add(Event.any(onDidModelSplice, this.focus.onDidChange, this.selection.onDidChange)(() => { + activeNodesDebounce.trigger(() => { + const set = new Set(); + for (const node of this.focus.getNodes()) { + set.add(node); + } + for (const node of this.selection.getNodes()) { + set.add(node); + } + activeNodesEmitter.fire([...set.values()]); + }); + })); + onDidChangeActiveNodes.input = activeNodesEmitter.event; + if (_options.keyboardSupport !== false) { + const onKeyDown = Event.chain(this.view.onKeyDown, $ => $.filter(e => !isInputElement(e.target)) + .map(e => new StandardKeyboardEvent(e))); + Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 15 /* KeyCode.LeftArrow */))(this.onLeftArrow, this, this.disposables); + Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 17 /* KeyCode.RightArrow */))(this.onRightArrow, this, this.disposables); + Event.chain(onKeyDown, $ => $.filter(e => e.keyCode === 10 /* KeyCode.Space */))(this.onSpace, this, this.disposables); + } + if ((_options.findWidgetEnabled ?? true) && _options.keyboardNavigationLabelProvider && _options.contextViewProvider) { + const opts = this.options.findWidgetStyles ? { styles: this.options.findWidgetStyles } : undefined; + this.findController = new FindController(this, this.model, this.view, filter, _options.contextViewProvider, opts); + this.focusNavigationFilter = node => this.findController.shouldAllowFocus(node); + this.onDidChangeFindOpenState = this.findController.onDidChangeOpenState; + this.disposables.add(this.findController); + this.onDidChangeFindMode = this.findController.onDidChangeMode; + this.onDidChangeFindMatchType = this.findController.onDidChangeMatchType; + } + else { + this.onDidChangeFindMode = Event.None; + this.onDidChangeFindMatchType = Event.None; + } + if (_options.enableStickyScroll) { + this.stickyScrollController = new StickyScrollController(this, this.model, this.view, this.renderers, this.treeDelegate, _options); + this.onDidChangeStickyScrollFocused = this.stickyScrollController.onDidChangeHasFocus; + } + this.styleElement = createStyleSheet(this.view.getHTMLElement()); + this.getHTMLElement().classList.toggle('always', this._options.renderIndentGuides === RenderIndentGuides.Always); + } + updateOptions(optionsUpdate = {}) { + this._options = { ...this._options, ...optionsUpdate }; + for (const renderer of this.renderers) { + renderer.updateOptions(optionsUpdate); + } + this.view.updateOptions(this._options); + this.findController?.updateOptions(optionsUpdate); + this.updateStickyScroll(optionsUpdate); + this._onDidUpdateOptions.fire(this._options); + this.getHTMLElement().classList.toggle('always', this._options.renderIndentGuides === RenderIndentGuides.Always); + } + get options() { + return this._options; + } + updateStickyScroll(optionsUpdate) { + if (!this.stickyScrollController && this._options.enableStickyScroll) { + this.stickyScrollController = new StickyScrollController(this, this.model, this.view, this.renderers, this.treeDelegate, this._options); + this.onDidChangeStickyScrollFocused = this.stickyScrollController.onDidChangeHasFocus; + } + else if (this.stickyScrollController && !this._options.enableStickyScroll) { + this.onDidChangeStickyScrollFocused = Event.None; + this.stickyScrollController.dispose(); + this.stickyScrollController = undefined; + } + this.stickyScrollController?.updateOptions(optionsUpdate); + } + // Widget + getHTMLElement() { + return this.view.getHTMLElement(); + } + get scrollTop() { + return this.view.scrollTop; + } + set scrollTop(scrollTop) { + this.view.scrollTop = scrollTop; + } + get scrollHeight() { + return this.view.scrollHeight; + } + get renderHeight() { + return this.view.renderHeight; + } + get ariaLabel() { + return this.view.ariaLabel; + } + set ariaLabel(value) { + this.view.ariaLabel = value; + } + domFocus() { + if (this.stickyScrollController?.focusedLast()) { + this.stickyScrollController.domFocus(); + } + else { + this.view.domFocus(); + } + } + layout(height, width) { + this.view.layout(height, width); + if (isNumber(width)) { + this.findController?.layout(width); + } + } + style(styles) { + const suffix = `.${this.view.domId}`; + const content = []; + if (styles.treeIndentGuidesStroke) { + content.push(`.monaco-list${suffix}:hover .monaco-tl-indent > .indent-guide, .monaco-list${suffix}.always .monaco-tl-indent > .indent-guide { border-color: ${styles.treeInactiveIndentGuidesStroke}; }`); + content.push(`.monaco-list${suffix} .monaco-tl-indent > .indent-guide.active { border-color: ${styles.treeIndentGuidesStroke}; }`); + } + // Sticky Scroll Background + const stickyScrollBackground = styles.treeStickyScrollBackground ?? styles.listBackground; + if (stickyScrollBackground) { + content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${stickyScrollBackground}; }`); + content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${stickyScrollBackground}; }`); + } + // Sticky Scroll Border + if (styles.treeStickyScrollBorder) { + content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${styles.treeStickyScrollBorder}; }`); + } + // Sticky Scroll Shadow + if (styles.treeStickyScrollShadow) { + content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${styles.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`); + } + // Sticky Scroll Focus + if (styles.listFocusForeground) { + content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`); + content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`); + } + // Sticky Scroll Focus Outlines + const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, styles.listFocusOutline ?? '')); + if (focusAndSelectionOutline) { // default: listFocusOutline + content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`); + content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`); + } + if (styles.listFocusOutline) { // default: set + content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }`); + content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`); + content.push(`.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }`); + content.push(`.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`); + content.push(`.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`); + } + this.styleElement.textContent = content.join('\n'); + this.view.style(styles); + } + // Tree navigation + getParentElement(location) { + const parentRef = this.model.getParentNodeLocation(location); + const parentNode = this.model.getNode(parentRef); + return parentNode.element; + } + getFirstElementChild(location) { + return this.model.getFirstElementChild(location); + } + // Tree + getNode(location) { + return this.model.getNode(location); + } + getNodeLocation(node) { + return this.model.getNodeLocation(node); + } + collapse(location, recursive = false) { + return this.model.setCollapsed(location, true, recursive); + } + expand(location, recursive = false) { + return this.model.setCollapsed(location, false, recursive); + } + toggleCollapsed(location, recursive = false) { + return this.model.setCollapsed(location, undefined, recursive); + } + isCollapsible(location) { + return this.model.isCollapsible(location); + } + setCollapsible(location, collapsible) { + return this.model.setCollapsible(location, collapsible); + } + isCollapsed(location) { + return this.model.isCollapsed(location); + } + refilter() { + this._onWillRefilter.fire(undefined); + this.model.refilter(); + } + setSelection(elements, browserEvent) { + this.eventBufferer.bufferEvents(() => { + const nodes = elements.map(e => this.model.getNode(e)); + this.selection.set(nodes, browserEvent); + const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1); + this.view.setSelection(indexes, browserEvent, true); + }); + } + getSelection() { + return this.selection.get(); + } + setFocus(elements, browserEvent) { + this.eventBufferer.bufferEvents(() => { + const nodes = elements.map(e => this.model.getNode(e)); + this.focus.set(nodes, browserEvent); + const indexes = elements.map(e => this.model.getListIndex(e)).filter(i => i > -1); + this.view.setFocus(indexes, browserEvent, true); + }); + } + focusNext(n = 1, loop = false, browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) { + this.view.focusNext(n, loop, browserEvent, filter); + } + focusPrevious(n = 1, loop = false, browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) { + this.view.focusPrevious(n, loop, browserEvent, filter); + } + focusNextPage(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) { + return this.view.focusNextPage(browserEvent, filter); + } + focusPreviousPage(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) { + return this.view.focusPreviousPage(browserEvent, filter, () => this.stickyScrollController?.height ?? 0); + } + focusLast(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) { + this.view.focusLast(browserEvent, filter); + } + focusFirst(browserEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter) { + this.view.focusFirst(browserEvent, filter); + } + getFocus() { + return this.focus.get(); + } + reveal(location, relativeTop) { + this.model.expandTo(location); + const index = this.model.getListIndex(location); + if (index === -1) { + return; + } + if (!this.stickyScrollController) { + this.view.reveal(index, relativeTop); + } + else { + const paddingTop = this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(location)); + this.view.reveal(index, relativeTop, paddingTop); + } + } + // List + onLeftArrow(e) { + e.preventDefault(); + e.stopPropagation(); + const nodes = this.view.getFocusedElements(); + if (nodes.length === 0) { + return; + } + const node = nodes[0]; + const location = this.model.getNodeLocation(node); + const didChange = this.model.setCollapsed(location, true); + if (!didChange) { + const parentLocation = this.model.getParentNodeLocation(location); + if (!parentLocation) { + return; + } + const parentListIndex = this.model.getListIndex(parentLocation); + this.view.reveal(parentListIndex); + this.view.setFocus([parentListIndex]); + } + } + onRightArrow(e) { + e.preventDefault(); + e.stopPropagation(); + const nodes = this.view.getFocusedElements(); + if (nodes.length === 0) { + return; + } + const node = nodes[0]; + const location = this.model.getNodeLocation(node); + const didChange = this.model.setCollapsed(location, false); + if (!didChange) { + if (!node.children.some(child => child.visible)) { + return; + } + const [focusedIndex] = this.view.getFocus(); + const firstChildIndex = focusedIndex + 1; + this.view.reveal(firstChildIndex); + this.view.setFocus([firstChildIndex]); + } + } + onSpace(e) { + e.preventDefault(); + e.stopPropagation(); + const nodes = this.view.getFocusedElements(); + if (nodes.length === 0) { + return; + } + const node = nodes[0]; + const location = this.model.getNodeLocation(node); + const recursive = e.browserEvent.altKey; + this.model.setCollapsed(location, undefined, recursive); + } + dispose() { + dispose(this.disposables); + this.stickyScrollController?.dispose(); + this.view.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js new file mode 100644 index 0000000000000000000000000000000000000000..e83a168c707d98941c69f46948f2f8e53b760cc6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js @@ -0,0 +1,845 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { ElementsDragAndDropData } from '../list/listView.js'; +import { ComposedTreeDelegate } from './abstractTree.js'; +import { getVisibleState, isFilterResult } from './indexTreeModel.js'; +import { CompressibleObjectTree, ObjectTree } from './objectTree.js'; +import { ObjectTreeElementCollapseState, TreeError, WeakMapper } from './tree.js'; +import { createCancelablePromise, Promises, timeout } from '../../../common/async.js'; +import { Codicon } from '../../../common/codicons.js'; +import { ThemeIcon } from '../../../common/themables.js'; +import { isCancellationError, onUnexpectedError } from '../../../common/errors.js'; +import { Emitter, Event } from '../../../common/event.js'; +import { Iterable } from '../../../common/iterator.js'; +import { DisposableStore, dispose } from '../../../common/lifecycle.js'; +import { isIterable } from '../../../common/types.js'; +function createAsyncDataTreeNode(props) { + return { + ...props, + children: [], + refreshPromise: undefined, + stale: true, + slow: false, + forceExpanded: false + }; +} +function isAncestor(ancestor, descendant) { + if (!descendant.parent) { + return false; + } + else if (descendant.parent === ancestor) { + return true; + } + else { + return isAncestor(ancestor, descendant.parent); + } +} +function intersects(node, other) { + return node === other || isAncestor(node, other) || isAncestor(other, node); +} +class AsyncDataTreeNodeWrapper { + get element() { return this.node.element.element; } + get children() { return this.node.children.map(node => new AsyncDataTreeNodeWrapper(node)); } + get depth() { return this.node.depth; } + get visibleChildrenCount() { return this.node.visibleChildrenCount; } + get visibleChildIndex() { return this.node.visibleChildIndex; } + get collapsible() { return this.node.collapsible; } + get collapsed() { return this.node.collapsed; } + get visible() { return this.node.visible; } + get filterData() { return this.node.filterData; } + constructor(node) { + this.node = node; + } +} +class AsyncDataTreeRenderer { + constructor(renderer, nodeMapper, onDidChangeTwistieState) { + this.renderer = renderer; + this.nodeMapper = nodeMapper; + this.onDidChangeTwistieState = onDidChangeTwistieState; + this.renderedNodes = new Map(); + this.templateId = renderer.templateId; + } + renderTemplate(container) { + const templateData = this.renderer.renderTemplate(container); + return { templateData }; + } + renderElement(node, index, templateData, height) { + this.renderer.renderElement(this.nodeMapper.map(node), index, templateData.templateData, height); + } + renderTwistie(element, twistieElement) { + if (element.slow) { + twistieElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading)); + return true; + } + else { + twistieElement.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading)); + return false; + } + } + disposeElement(node, index, templateData, height) { + this.renderer.disposeElement?.(this.nodeMapper.map(node), index, templateData.templateData, height); + } + disposeTemplate(templateData) { + this.renderer.disposeTemplate(templateData.templateData); + } + dispose() { + this.renderedNodes.clear(); + } +} +function asTreeEvent(e) { + return { + browserEvent: e.browserEvent, + elements: e.elements.map(e => e.element) + }; +} +function asTreeMouseEvent(e) { + return { + browserEvent: e.browserEvent, + element: e.element && e.element.element, + target: e.target + }; +} +class AsyncDataTreeElementsDragAndDropData extends ElementsDragAndDropData { + constructor(data) { + super(data.elements.map(node => node.element)); + this.data = data; + } +} +function asAsyncDataTreeDragAndDropData(data) { + if (data instanceof ElementsDragAndDropData) { + return new AsyncDataTreeElementsDragAndDropData(data); + } + return data; +} +class AsyncDataTreeNodeListDragAndDrop { + constructor(dnd) { + this.dnd = dnd; + } + getDragURI(node) { + return this.dnd.getDragURI(node.element); + } + getDragLabel(nodes, originalEvent) { + if (this.dnd.getDragLabel) { + return this.dnd.getDragLabel(nodes.map(node => node.element), originalEvent); + } + return undefined; + } + onDragStart(data, originalEvent) { + this.dnd.onDragStart?.(asAsyncDataTreeDragAndDropData(data), originalEvent); + } + onDragOver(data, targetNode, targetIndex, targetSector, originalEvent, raw = true) { + return this.dnd.onDragOver(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent); + } + drop(data, targetNode, targetIndex, targetSector, originalEvent) { + this.dnd.drop(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent); + } + onDragEnd(originalEvent) { + this.dnd.onDragEnd?.(originalEvent); + } + dispose() { + this.dnd.dispose(); + } +} +function asObjectTreeOptions(options) { + return options && { + ...options, + collapseByDefault: true, + identityProvider: options.identityProvider && { + getId(el) { + return options.identityProvider.getId(el.element); + } + }, + dnd: options.dnd && new AsyncDataTreeNodeListDragAndDrop(options.dnd), + multipleSelectionController: options.multipleSelectionController && { + isSelectionSingleChangeEvent(e) { + return options.multipleSelectionController.isSelectionSingleChangeEvent({ ...e, element: e.element }); + }, + isSelectionRangeChangeEvent(e) { + return options.multipleSelectionController.isSelectionRangeChangeEvent({ ...e, element: e.element }); + } + }, + accessibilityProvider: options.accessibilityProvider && { + ...options.accessibilityProvider, + getPosInSet: undefined, + getSetSize: undefined, + getRole: options.accessibilityProvider.getRole ? (el) => { + return options.accessibilityProvider.getRole(el.element); + } : () => 'treeitem', + isChecked: options.accessibilityProvider.isChecked ? (e) => { + return !!(options.accessibilityProvider?.isChecked(e.element)); + } : undefined, + getAriaLabel(e) { + return options.accessibilityProvider.getAriaLabel(e.element); + }, + getWidgetAriaLabel() { + return options.accessibilityProvider.getWidgetAriaLabel(); + }, + getWidgetRole: options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider.getWidgetRole() : () => 'tree', + getAriaLevel: options.accessibilityProvider.getAriaLevel && (node => { + return options.accessibilityProvider.getAriaLevel(node.element); + }), + getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => { + return options.accessibilityProvider.getActiveDescendantId(node.element); + }) + }, + filter: options.filter && { + filter(e, parentVisibility) { + return options.filter.filter(e.element, parentVisibility); + } + }, + keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && { + ...options.keyboardNavigationLabelProvider, + getKeyboardNavigationLabel(e) { + return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element); + } + }, + sorter: undefined, + expandOnlyOnTwistieClick: typeof options.expandOnlyOnTwistieClick === 'undefined' ? undefined : (typeof options.expandOnlyOnTwistieClick !== 'function' ? options.expandOnlyOnTwistieClick : (e => options.expandOnlyOnTwistieClick(e.element))), + defaultFindVisibility: e => { + if (e.hasChildren && e.stale) { + return 1 /* TreeVisibility.Visible */; + } + else if (typeof options.defaultFindVisibility === 'number') { + return options.defaultFindVisibility; + } + else if (typeof options.defaultFindVisibility === 'undefined') { + return 2 /* TreeVisibility.Recurse */; + } + else { + return options.defaultFindVisibility(e.element); + } + } + }; +} +function dfs(node, fn) { + fn(node); + node.children.forEach(child => dfs(child, fn)); +} +export class AsyncDataTree { + get onDidScroll() { return this.tree.onDidScroll; } + get onDidChangeFocus() { return Event.map(this.tree.onDidChangeFocus, asTreeEvent); } + get onDidChangeSelection() { return Event.map(this.tree.onDidChangeSelection, asTreeEvent); } + get onMouseDblClick() { return Event.map(this.tree.onMouseDblClick, asTreeMouseEvent); } + get onPointer() { return Event.map(this.tree.onPointer, asTreeMouseEvent); } + get onDidFocus() { return this.tree.onDidFocus; } + /** + * To be used internally only! + * @deprecated + */ + get onDidChangeModel() { return this.tree.onDidChangeModel; } + get onDidChangeCollapseState() { return this.tree.onDidChangeCollapseState; } + get onDidChangeFindOpenState() { return this.tree.onDidChangeFindOpenState; } + get onDidChangeStickyScrollFocused() { return this.tree.onDidChangeStickyScrollFocused; } + get onDidDispose() { return this.tree.onDidDispose; } + constructor(user, container, delegate, renderers, dataSource, options = {}) { + this.user = user; + this.dataSource = dataSource; + this.nodes = new Map(); + this.subTreeRefreshPromises = new Map(); + this.refreshPromises = new Map(); + this._onDidRender = new Emitter(); + this._onDidChangeNodeSlowState = new Emitter(); + this.nodeMapper = new WeakMapper(node => new AsyncDataTreeNodeWrapper(node)); + this.disposables = new DisposableStore(); + this.identityProvider = options.identityProvider; + this.autoExpandSingleChildren = typeof options.autoExpandSingleChildren === 'undefined' ? false : options.autoExpandSingleChildren; + this.sorter = options.sorter; + this.getDefaultCollapseState = e => options.collapseByDefault ? (options.collapseByDefault(e) ? ObjectTreeElementCollapseState.PreserveOrCollapsed : ObjectTreeElementCollapseState.PreserveOrExpanded) : undefined; + this.tree = this.createTree(user, container, delegate, renderers, options); + this.onDidChangeFindMode = this.tree.onDidChangeFindMode; + this.onDidChangeFindMatchType = this.tree.onDidChangeFindMatchType; + this.root = createAsyncDataTreeNode({ + element: undefined, + parent: null, + hasChildren: true, + defaultCollapseState: undefined + }); + if (this.identityProvider) { + this.root = { + ...this.root, + id: null + }; + } + this.nodes.set(null, this.root); + this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState, this, this.disposables); + } + createTree(user, container, delegate, renderers, options) { + const objectTreeDelegate = new ComposedTreeDelegate(delegate); + const objectTreeRenderers = renderers.map(r => new AsyncDataTreeRenderer(r, this.nodeMapper, this._onDidChangeNodeSlowState.event)); + const objectTreeOptions = asObjectTreeOptions(options) || {}; + return new ObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions); + } + updateOptions(options = {}) { + this.tree.updateOptions(options); + } + // Widget + getHTMLElement() { + return this.tree.getHTMLElement(); + } + get scrollTop() { + return this.tree.scrollTop; + } + set scrollTop(scrollTop) { + this.tree.scrollTop = scrollTop; + } + get scrollHeight() { + return this.tree.scrollHeight; + } + get renderHeight() { + return this.tree.renderHeight; + } + domFocus() { + this.tree.domFocus(); + } + layout(height, width) { + this.tree.layout(height, width); + } + style(styles) { + this.tree.style(styles); + } + // Model + getInput() { + return this.root.element; + } + async setInput(input, viewState) { + this.refreshPromises.forEach(promise => promise.cancel()); + this.refreshPromises.clear(); + this.root.element = input; + const viewStateContext = viewState && { viewState, focus: [], selection: [] }; + await this._updateChildren(input, true, false, viewStateContext); + if (viewStateContext) { + this.tree.setFocus(viewStateContext.focus); + this.tree.setSelection(viewStateContext.selection); + } + if (viewState && typeof viewState.scrollTop === 'number') { + this.scrollTop = viewState.scrollTop; + } + } + async _updateChildren(element = this.root.element, recursive = true, rerender = false, viewStateContext, options) { + if (typeof this.root.element === 'undefined') { + throw new TreeError(this.user, 'Tree input not set'); + } + if (this.root.refreshPromise) { + await this.root.refreshPromise; + await Event.toPromise(this._onDidRender.event); + } + const node = this.getDataNode(element); + await this.refreshAndRenderNode(node, recursive, viewStateContext, options); + if (rerender) { + try { + this.tree.rerender(node); + } + catch { + // missing nodes are fine, this could've resulted from + // parallel refresh calls, removing `node` altogether + } + } + } + // View + rerender(element) { + if (element === undefined || element === this.root.element) { + this.tree.rerender(); + return; + } + const node = this.getDataNode(element); + this.tree.rerender(node); + } + // Tree + getNode(element = this.root.element) { + const dataNode = this.getDataNode(element); + const node = this.tree.getNode(dataNode === this.root ? null : dataNode); + return this.nodeMapper.map(node); + } + collapse(element, recursive = false) { + const node = this.getDataNode(element); + return this.tree.collapse(node === this.root ? null : node, recursive); + } + async expand(element, recursive = false) { + if (typeof this.root.element === 'undefined') { + throw new TreeError(this.user, 'Tree input not set'); + } + if (this.root.refreshPromise) { + await this.root.refreshPromise; + await Event.toPromise(this._onDidRender.event); + } + const node = this.getDataNode(element); + if (this.tree.hasElement(node) && !this.tree.isCollapsible(node)) { + return false; + } + if (node.refreshPromise) { + await this.root.refreshPromise; + await Event.toPromise(this._onDidRender.event); + } + if (node !== this.root && !node.refreshPromise && !this.tree.isCollapsed(node)) { + return false; + } + const result = this.tree.expand(node === this.root ? null : node, recursive); + if (node.refreshPromise) { + await this.root.refreshPromise; + await Event.toPromise(this._onDidRender.event); + } + return result; + } + setSelection(elements, browserEvent) { + const nodes = elements.map(e => this.getDataNode(e)); + this.tree.setSelection(nodes, browserEvent); + } + getSelection() { + const nodes = this.tree.getSelection(); + return nodes.map(n => n.element); + } + setFocus(elements, browserEvent) { + const nodes = elements.map(e => this.getDataNode(e)); + this.tree.setFocus(nodes, browserEvent); + } + getFocus() { + const nodes = this.tree.getFocus(); + return nodes.map(n => n.element); + } + reveal(element, relativeTop) { + this.tree.reveal(this.getDataNode(element), relativeTop); + } + // Tree navigation + getParentElement(element) { + const node = this.tree.getParentElement(this.getDataNode(element)); + return (node && node.element); + } + getFirstElementChild(element = this.root.element) { + const dataNode = this.getDataNode(element); + const node = this.tree.getFirstElementChild(dataNode === this.root ? null : dataNode); + return (node && node.element); + } + // Implementation + getDataNode(element) { + const node = this.nodes.get((element === this.root.element ? null : element)); + if (!node) { + throw new TreeError(this.user, `Data tree node not found: ${element}`); + } + return node; + } + async refreshAndRenderNode(node, recursive, viewStateContext, options) { + await this.refreshNode(node, recursive, viewStateContext); + if (this.disposables.isDisposed) { + return; // tree disposed during refresh (#199264) + } + this.render(node, viewStateContext, options); + } + async refreshNode(node, recursive, viewStateContext) { + let result; + this.subTreeRefreshPromises.forEach((refreshPromise, refreshNode) => { + if (!result && intersects(refreshNode, node)) { + result = refreshPromise.then(() => this.refreshNode(node, recursive, viewStateContext)); + } + }); + if (result) { + return result; + } + if (node !== this.root) { + const treeNode = this.tree.getNode(node); + if (treeNode.collapsed) { + node.hasChildren = !!this.dataSource.hasChildren(node.element); + node.stale = true; + this.setChildren(node, [], recursive, viewStateContext); + return; + } + } + return this.doRefreshSubTree(node, recursive, viewStateContext); + } + async doRefreshSubTree(node, recursive, viewStateContext) { + let done; + node.refreshPromise = new Promise(c => done = c); + this.subTreeRefreshPromises.set(node, node.refreshPromise); + node.refreshPromise.finally(() => { + node.refreshPromise = undefined; + this.subTreeRefreshPromises.delete(node); + }); + try { + const childrenToRefresh = await this.doRefreshNode(node, recursive, viewStateContext); + node.stale = false; + await Promises.settled(childrenToRefresh.map(child => this.doRefreshSubTree(child, recursive, viewStateContext))); + } + finally { + done(); + } + } + async doRefreshNode(node, recursive, viewStateContext) { + node.hasChildren = !!this.dataSource.hasChildren(node.element); + let childrenPromise; + if (!node.hasChildren) { + childrenPromise = Promise.resolve(Iterable.empty()); + } + else { + const children = this.doGetChildren(node); + if (isIterable(children)) { + childrenPromise = Promise.resolve(children); + } + else { + const slowTimeout = timeout(800); + slowTimeout.then(() => { + node.slow = true; + this._onDidChangeNodeSlowState.fire(node); + }, _ => null); + childrenPromise = children.finally(() => slowTimeout.cancel()); + } + } + try { + const children = await childrenPromise; + return this.setChildren(node, children, recursive, viewStateContext); + } + catch (err) { + if (node !== this.root && this.tree.hasElement(node)) { + this.tree.collapse(node); + } + if (isCancellationError(err)) { + return []; + } + throw err; + } + finally { + if (node.slow) { + node.slow = false; + this._onDidChangeNodeSlowState.fire(node); + } + } + } + doGetChildren(node) { + let result = this.refreshPromises.get(node); + if (result) { + return result; + } + const children = this.dataSource.getChildren(node.element); + if (isIterable(children)) { + return this.processChildren(children); + } + else { + result = createCancelablePromise(async () => this.processChildren(await children)); + this.refreshPromises.set(node, result); + return result.finally(() => { this.refreshPromises.delete(node); }); + } + } + _onDidChangeCollapseState({ node, deep }) { + if (node.element === null) { + return; + } + if (!node.collapsed && node.element.stale) { + if (deep) { + this.collapse(node.element.element); + } + else { + this.refreshAndRenderNode(node.element, false) + .catch(onUnexpectedError); + } + } + } + setChildren(node, childrenElementsIterable, recursive, viewStateContext) { + const childrenElements = [...childrenElementsIterable]; + // perf: if the node was and still is a leaf, avoid all this hassle + if (node.children.length === 0 && childrenElements.length === 0) { + return []; + } + const nodesToForget = new Map(); + const childrenTreeNodesById = new Map(); + for (const child of node.children) { + nodesToForget.set(child.element, child); + if (this.identityProvider) { + childrenTreeNodesById.set(child.id, { node: child, collapsed: this.tree.hasElement(child) && this.tree.isCollapsed(child) }); + } + } + const childrenToRefresh = []; + const children = childrenElements.map(element => { + const hasChildren = !!this.dataSource.hasChildren(element); + if (!this.identityProvider) { + const asyncDataTreeNode = createAsyncDataTreeNode({ element, parent: node, hasChildren, defaultCollapseState: this.getDefaultCollapseState(element) }); + if (hasChildren && asyncDataTreeNode.defaultCollapseState === ObjectTreeElementCollapseState.PreserveOrExpanded) { + childrenToRefresh.push(asyncDataTreeNode); + } + return asyncDataTreeNode; + } + const id = this.identityProvider.getId(element).toString(); + const result = childrenTreeNodesById.get(id); + if (result) { + const asyncDataTreeNode = result.node; + nodesToForget.delete(asyncDataTreeNode.element); + this.nodes.delete(asyncDataTreeNode.element); + this.nodes.set(element, asyncDataTreeNode); + asyncDataTreeNode.element = element; + asyncDataTreeNode.hasChildren = hasChildren; + if (recursive) { + if (result.collapsed) { + asyncDataTreeNode.children.forEach(node => dfs(node, node => this.nodes.delete(node.element))); + asyncDataTreeNode.children.splice(0, asyncDataTreeNode.children.length); + asyncDataTreeNode.stale = true; + } + else { + childrenToRefresh.push(asyncDataTreeNode); + } + } + else if (hasChildren && !result.collapsed) { + childrenToRefresh.push(asyncDataTreeNode); + } + return asyncDataTreeNode; + } + const childAsyncDataTreeNode = createAsyncDataTreeNode({ element, parent: node, id, hasChildren, defaultCollapseState: this.getDefaultCollapseState(element) }); + if (viewStateContext && viewStateContext.viewState.focus && viewStateContext.viewState.focus.indexOf(id) > -1) { + viewStateContext.focus.push(childAsyncDataTreeNode); + } + if (viewStateContext && viewStateContext.viewState.selection && viewStateContext.viewState.selection.indexOf(id) > -1) { + viewStateContext.selection.push(childAsyncDataTreeNode); + } + if (viewStateContext && viewStateContext.viewState.expanded && viewStateContext.viewState.expanded.indexOf(id) > -1) { + childrenToRefresh.push(childAsyncDataTreeNode); + } + else if (hasChildren && childAsyncDataTreeNode.defaultCollapseState === ObjectTreeElementCollapseState.PreserveOrExpanded) { + childrenToRefresh.push(childAsyncDataTreeNode); + } + return childAsyncDataTreeNode; + }); + for (const node of nodesToForget.values()) { + dfs(node, node => this.nodes.delete(node.element)); + } + for (const child of children) { + this.nodes.set(child.element, child); + } + node.children.splice(0, node.children.length, ...children); + // TODO@joao this doesn't take filter into account + if (node !== this.root && this.autoExpandSingleChildren && children.length === 1 && childrenToRefresh.length === 0) { + children[0].forceExpanded = true; + childrenToRefresh.push(children[0]); + } + return childrenToRefresh; + } + render(node, viewStateContext, options) { + const children = node.children.map(node => this.asTreeElement(node, viewStateContext)); + const objectTreeOptions = options && { + ...options, + diffIdentityProvider: options.diffIdentityProvider && { + getId(node) { + return options.diffIdentityProvider.getId(node.element); + } + } + }; + this.tree.setChildren(node === this.root ? null : node, children, objectTreeOptions); + if (node !== this.root) { + this.tree.setCollapsible(node, node.hasChildren); + } + this._onDidRender.fire(); + } + asTreeElement(node, viewStateContext) { + if (node.stale) { + return { + element: node, + collapsible: node.hasChildren, + collapsed: true + }; + } + let collapsed; + if (viewStateContext && viewStateContext.viewState.expanded && node.id && viewStateContext.viewState.expanded.indexOf(node.id) > -1) { + collapsed = false; + } + else if (node.forceExpanded) { + collapsed = false; + node.forceExpanded = false; + } + else { + collapsed = node.defaultCollapseState; + } + return { + element: node, + children: node.hasChildren ? Iterable.map(node.children, child => this.asTreeElement(child, viewStateContext)) : [], + collapsible: node.hasChildren, + collapsed + }; + } + processChildren(children) { + if (this.sorter) { + children = [...children].sort(this.sorter.compare.bind(this.sorter)); + } + return children; + } + dispose() { + this.disposables.dispose(); + this.tree.dispose(); + } +} +class CompressibleAsyncDataTreeNodeWrapper { + get element() { + return { + elements: this.node.element.elements.map(e => e.element), + incompressible: this.node.element.incompressible + }; + } + get children() { return this.node.children.map(node => new CompressibleAsyncDataTreeNodeWrapper(node)); } + get depth() { return this.node.depth; } + get visibleChildrenCount() { return this.node.visibleChildrenCount; } + get visibleChildIndex() { return this.node.visibleChildIndex; } + get collapsible() { return this.node.collapsible; } + get collapsed() { return this.node.collapsed; } + get visible() { return this.node.visible; } + get filterData() { return this.node.filterData; } + constructor(node) { + this.node = node; + } +} +class CompressibleAsyncDataTreeRenderer { + constructor(renderer, nodeMapper, compressibleNodeMapperProvider, onDidChangeTwistieState) { + this.renderer = renderer; + this.nodeMapper = nodeMapper; + this.compressibleNodeMapperProvider = compressibleNodeMapperProvider; + this.onDidChangeTwistieState = onDidChangeTwistieState; + this.renderedNodes = new Map(); + this.disposables = []; + this.templateId = renderer.templateId; + } + renderTemplate(container) { + const templateData = this.renderer.renderTemplate(container); + return { templateData }; + } + renderElement(node, index, templateData, height) { + this.renderer.renderElement(this.nodeMapper.map(node), index, templateData.templateData, height); + } + renderCompressedElements(node, index, templateData, height) { + this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(node), index, templateData.templateData, height); + } + renderTwistie(element, twistieElement) { + if (element.slow) { + twistieElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading)); + return true; + } + else { + twistieElement.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading)); + return false; + } + } + disposeElement(node, index, templateData, height) { + this.renderer.disposeElement?.(this.nodeMapper.map(node), index, templateData.templateData, height); + } + disposeCompressedElements(node, index, templateData, height) { + this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(node), index, templateData.templateData, height); + } + disposeTemplate(templateData) { + this.renderer.disposeTemplate(templateData.templateData); + } + dispose() { + this.renderedNodes.clear(); + this.disposables = dispose(this.disposables); + } +} +function asCompressibleObjectTreeOptions(options) { + const objectTreeOptions = options && asObjectTreeOptions(options); + return objectTreeOptions && { + ...objectTreeOptions, + keyboardNavigationLabelProvider: objectTreeOptions.keyboardNavigationLabelProvider && { + ...objectTreeOptions.keyboardNavigationLabelProvider, + getCompressedNodeKeyboardNavigationLabel(els) { + return options.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(els.map(e => e.element)); + } + } + }; +} +export class CompressibleAsyncDataTree extends AsyncDataTree { + constructor(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, options = {}) { + super(user, container, virtualDelegate, renderers, dataSource, options); + this.compressionDelegate = compressionDelegate; + this.compressibleNodeMapper = new WeakMapper(node => new CompressibleAsyncDataTreeNodeWrapper(node)); + this.filter = options.filter; + } + createTree(user, container, delegate, renderers, options) { + const objectTreeDelegate = new ComposedTreeDelegate(delegate); + const objectTreeRenderers = renderers.map(r => new CompressibleAsyncDataTreeRenderer(r, this.nodeMapper, () => this.compressibleNodeMapper, this._onDidChangeNodeSlowState.event)); + const objectTreeOptions = asCompressibleObjectTreeOptions(options) || {}; + return new CompressibleObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions); + } + asTreeElement(node, viewStateContext) { + return { + incompressible: this.compressionDelegate.isIncompressible(node.element), + ...super.asTreeElement(node, viewStateContext) + }; + } + updateOptions(options = {}) { + this.tree.updateOptions(options); + } + render(node, viewStateContext, options) { + if (!this.identityProvider) { + return super.render(node, viewStateContext); + } + // Preserve traits across compressions. Hacky but does the trick. + // This is hard to fix properly since it requires rewriting the traits + // across trees and lists. Let's just keep it this way for now. + const getId = (element) => this.identityProvider.getId(element).toString(); + const getUncompressedIds = (nodes) => { + const result = new Set(); + for (const node of nodes) { + const compressedNode = this.tree.getCompressedTreeNode(node === this.root ? null : node); + if (!compressedNode.element) { + continue; + } + for (const node of compressedNode.element.elements) { + result.add(getId(node.element)); + } + } + return result; + }; + const oldSelection = getUncompressedIds(this.tree.getSelection()); + const oldFocus = getUncompressedIds(this.tree.getFocus()); + super.render(node, viewStateContext, options); + const selection = this.getSelection(); + let didChangeSelection = false; + const focus = this.getFocus(); + let didChangeFocus = false; + const visit = (node) => { + const compressedNode = node.element; + if (compressedNode) { + for (let i = 0; i < compressedNode.elements.length; i++) { + const id = getId(compressedNode.elements[i].element); + const element = compressedNode.elements[compressedNode.elements.length - 1].element; + // github.com/microsoft/vscode/issues/85938 + if (oldSelection.has(id) && selection.indexOf(element) === -1) { + selection.push(element); + didChangeSelection = true; + } + if (oldFocus.has(id) && focus.indexOf(element) === -1) { + focus.push(element); + didChangeFocus = true; + } + } + } + node.children.forEach(visit); + }; + visit(this.tree.getCompressedTreeNode(node === this.root ? null : node)); + if (didChangeSelection) { + this.setSelection(selection); + } + if (didChangeFocus) { + this.setFocus(focus); + } + } + // For compressed async data trees, `TreeVisibility.Recurse` doesn't currently work + // and we have to filter everything beforehand + // Related to #85193 and #85835 + processChildren(children) { + if (this.filter) { + children = Iterable.filter(children, e => { + const result = this.filter.filter(e, 1 /* TreeVisibility.Visible */); + const visibility = getVisibility(result); + if (visibility === 2 /* TreeVisibility.Recurse */) { + throw new Error('Recursive tree visibility not supported in async data compressed trees'); + } + return visibility === 1 /* TreeVisibility.Visible */; + }); + } + return super.processChildren(children); + } +} +function getVisibility(filterResult) { + if (typeof filterResult === 'boolean') { + return filterResult ? 1 /* TreeVisibility.Visible */ : 0 /* TreeVisibility.Hidden */; + } + else if (isFilterResult(filterResult)) { + return getVisibleState(filterResult.visibility); + } + else { + return getVisibleState(filterResult); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js new file mode 100644 index 0000000000000000000000000000000000000000..bc7d846e67eda5452ba7026830bb08e8159d4fbe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js @@ -0,0 +1,371 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { ObjectTreeModel } from './objectTreeModel.js'; +import { TreeError, WeakMapper } from './tree.js'; +import { equals } from '../../../common/arrays.js'; +import { Event } from '../../../common/event.js'; +import { Iterable } from '../../../common/iterator.js'; +function noCompress(element) { + const elements = [element.element]; + const incompressible = element.incompressible || false; + return { + element: { elements, incompressible }, + children: Iterable.map(Iterable.from(element.children), noCompress), + collapsible: element.collapsible, + collapsed: element.collapsed + }; +} +// Exported only for test reasons, do not use directly +export function compress(element) { + const elements = [element.element]; + const incompressible = element.incompressible || false; + let childrenIterator; + let children; + while (true) { + [children, childrenIterator] = Iterable.consume(Iterable.from(element.children), 2); + if (children.length !== 1) { + break; + } + if (children[0].incompressible) { + break; + } + element = children[0]; + elements.push(element.element); + } + return { + element: { elements, incompressible }, + children: Iterable.map(Iterable.concat(children, childrenIterator), compress), + collapsible: element.collapsible, + collapsed: element.collapsed + }; +} +function _decompress(element, index = 0) { + let children; + if (index < element.element.elements.length - 1) { + children = [_decompress(element, index + 1)]; + } + else { + children = Iterable.map(Iterable.from(element.children), el => _decompress(el, 0)); + } + if (index === 0 && element.element.incompressible) { + return { + element: element.element.elements[index], + children, + incompressible: true, + collapsible: element.collapsible, + collapsed: element.collapsed + }; + } + return { + element: element.element.elements[index], + children, + collapsible: element.collapsible, + collapsed: element.collapsed + }; +} +// Exported only for test reasons, do not use directly +export function decompress(element) { + return _decompress(element, 0); +} +function splice(treeElement, element, children) { + if (treeElement.element === element) { + return { ...treeElement, children }; + } + return { ...treeElement, children: Iterable.map(Iterable.from(treeElement.children), e => splice(e, element, children)) }; +} +const wrapIdentityProvider = (base) => ({ + getId(node) { + return node.elements.map(e => base.getId(e).toString()).join('\0'); + } +}); +// Exported only for test reasons, do not use directly +export class CompressedObjectTreeModel { + get onDidSplice() { return this.model.onDidSplice; } + get onDidChangeCollapseState() { return this.model.onDidChangeCollapseState; } + get onDidChangeRenderNodeCount() { return this.model.onDidChangeRenderNodeCount; } + constructor(user, list, options = {}) { + this.user = user; + this.rootRef = null; + this.nodes = new Map(); + this.model = new ObjectTreeModel(user, list, options); + this.enabled = typeof options.compressionEnabled === 'undefined' ? true : options.compressionEnabled; + this.identityProvider = options.identityProvider; + } + setChildren(element, children = Iterable.empty(), options) { + // Diffs must be deep, since the compression can affect nested elements. + // @see https://github.com/microsoft/vscode/pull/114237#issuecomment-759425034 + const diffIdentityProvider = options.diffIdentityProvider && wrapIdentityProvider(options.diffIdentityProvider); + if (element === null) { + const compressedChildren = Iterable.map(children, this.enabled ? compress : noCompress); + this._setChildren(null, compressedChildren, { diffIdentityProvider, diffDepth: Infinity }); + return; + } + const compressedNode = this.nodes.get(element); + if (!compressedNode) { + throw new TreeError(this.user, 'Unknown compressed tree node'); + } + const node = this.model.getNode(compressedNode); + const compressedParentNode = this.model.getParentNodeLocation(compressedNode); + const parent = this.model.getNode(compressedParentNode); + const decompressedElement = decompress(node); + const splicedElement = splice(decompressedElement, element, children); + const recompressedElement = (this.enabled ? compress : noCompress)(splicedElement); + // If the recompressed node is identical to the original, just set its children. + // Saves work and churn diffing the parent element. + const elementComparator = options.diffIdentityProvider + ? ((a, b) => options.diffIdentityProvider.getId(a) === options.diffIdentityProvider.getId(b)) + : undefined; + if (equals(recompressedElement.element.elements, node.element.elements, elementComparator)) { + this._setChildren(compressedNode, recompressedElement.children || Iterable.empty(), { diffIdentityProvider, diffDepth: 1 }); + return; + } + const parentChildren = parent.children + .map(child => child === node ? recompressedElement : child); + this._setChildren(parent.element, parentChildren, { + diffIdentityProvider, + diffDepth: node.depth - parent.depth, + }); + } + isCompressionEnabled() { + return this.enabled; + } + setCompressionEnabled(enabled) { + if (enabled === this.enabled) { + return; + } + this.enabled = enabled; + const root = this.model.getNode(); + const rootChildren = root.children; + const decompressedRootChildren = Iterable.map(rootChildren, decompress); + const recompressedRootChildren = Iterable.map(decompressedRootChildren, enabled ? compress : noCompress); + // it should be safe to always use deep diff mode here if an identity + // provider is available, since we know the raw nodes are unchanged. + this._setChildren(null, recompressedRootChildren, { + diffIdentityProvider: this.identityProvider, + diffDepth: Infinity, + }); + } + _setChildren(node, children, options) { + const insertedElements = new Set(); + const onDidCreateNode = (node) => { + for (const element of node.element.elements) { + insertedElements.add(element); + this.nodes.set(element, node.element); + } + }; + const onDidDeleteNode = (node) => { + for (const element of node.element.elements) { + if (!insertedElements.has(element)) { + this.nodes.delete(element); + } + } + }; + this.model.setChildren(node, children, { ...options, onDidCreateNode, onDidDeleteNode }); + } + has(element) { + return this.nodes.has(element); + } + getListIndex(location) { + const node = this.getCompressedNode(location); + return this.model.getListIndex(node); + } + getListRenderCount(location) { + const node = this.getCompressedNode(location); + return this.model.getListRenderCount(node); + } + getNode(location) { + if (typeof location === 'undefined') { + return this.model.getNode(); + } + const node = this.getCompressedNode(location); + return this.model.getNode(node); + } + // TODO: review this + getNodeLocation(node) { + const compressedNode = this.model.getNodeLocation(node); + if (compressedNode === null) { + return null; + } + return compressedNode.elements[compressedNode.elements.length - 1]; + } + // TODO: review this + getParentNodeLocation(location) { + const compressedNode = this.getCompressedNode(location); + const parentNode = this.model.getParentNodeLocation(compressedNode); + if (parentNode === null) { + return null; + } + return parentNode.elements[parentNode.elements.length - 1]; + } + getFirstElementChild(location) { + const compressedNode = this.getCompressedNode(location); + return this.model.getFirstElementChild(compressedNode); + } + isCollapsible(location) { + const compressedNode = this.getCompressedNode(location); + return this.model.isCollapsible(compressedNode); + } + setCollapsible(location, collapsible) { + const compressedNode = this.getCompressedNode(location); + return this.model.setCollapsible(compressedNode, collapsible); + } + isCollapsed(location) { + const compressedNode = this.getCompressedNode(location); + return this.model.isCollapsed(compressedNode); + } + setCollapsed(location, collapsed, recursive) { + const compressedNode = this.getCompressedNode(location); + return this.model.setCollapsed(compressedNode, collapsed, recursive); + } + expandTo(location) { + const compressedNode = this.getCompressedNode(location); + this.model.expandTo(compressedNode); + } + rerender(location) { + const compressedNode = this.getCompressedNode(location); + this.model.rerender(compressedNode); + } + refilter() { + this.model.refilter(); + } + getCompressedNode(element) { + if (element === null) { + return null; + } + const node = this.nodes.get(element); + if (!node) { + throw new TreeError(this.user, `Tree element not found: ${element}`); + } + return node; + } +} +export const DefaultElementMapper = elements => elements[elements.length - 1]; +class CompressedTreeNodeWrapper { + get element() { return this.node.element === null ? null : this.unwrapper(this.node.element); } + get children() { return this.node.children.map(node => new CompressedTreeNodeWrapper(this.unwrapper, node)); } + get depth() { return this.node.depth; } + get visibleChildrenCount() { return this.node.visibleChildrenCount; } + get visibleChildIndex() { return this.node.visibleChildIndex; } + get collapsible() { return this.node.collapsible; } + get collapsed() { return this.node.collapsed; } + get visible() { return this.node.visible; } + get filterData() { return this.node.filterData; } + constructor(unwrapper, node) { + this.unwrapper = unwrapper; + this.node = node; + } +} +function mapList(nodeMapper, list) { + return { + splice(start, deleteCount, toInsert) { + list.splice(start, deleteCount, toInsert.map(node => nodeMapper.map(node))); + }, + updateElementHeight(index, height) { + list.updateElementHeight(index, height); + } + }; +} +function mapOptions(compressedNodeUnwrapper, options) { + return { + ...options, + identityProvider: options.identityProvider && { + getId(node) { + return options.identityProvider.getId(compressedNodeUnwrapper(node)); + } + }, + sorter: options.sorter && { + compare(node, otherNode) { + return options.sorter.compare(node.elements[0], otherNode.elements[0]); + } + }, + filter: options.filter && { + filter(node, parentVisibility) { + return options.filter.filter(compressedNodeUnwrapper(node), parentVisibility); + } + } + }; +} +export class CompressibleObjectTreeModel { + get onDidSplice() { + return Event.map(this.model.onDidSplice, ({ insertedNodes, deletedNodes }) => ({ + insertedNodes: insertedNodes.map(node => this.nodeMapper.map(node)), + deletedNodes: deletedNodes.map(node => this.nodeMapper.map(node)), + })); + } + get onDidChangeCollapseState() { + return Event.map(this.model.onDidChangeCollapseState, ({ node, deep }) => ({ + node: this.nodeMapper.map(node), + deep + })); + } + get onDidChangeRenderNodeCount() { + return Event.map(this.model.onDidChangeRenderNodeCount, node => this.nodeMapper.map(node)); + } + constructor(user, list, options = {}) { + this.rootRef = null; + this.elementMapper = options.elementMapper || DefaultElementMapper; + const compressedNodeUnwrapper = node => this.elementMapper(node.elements); + this.nodeMapper = new WeakMapper(node => new CompressedTreeNodeWrapper(compressedNodeUnwrapper, node)); + this.model = new CompressedObjectTreeModel(user, mapList(this.nodeMapper, list), mapOptions(compressedNodeUnwrapper, options)); + } + setChildren(element, children = Iterable.empty(), options = {}) { + this.model.setChildren(element, children, options); + } + isCompressionEnabled() { + return this.model.isCompressionEnabled(); + } + setCompressionEnabled(enabled) { + this.model.setCompressionEnabled(enabled); + } + has(location) { + return this.model.has(location); + } + getListIndex(location) { + return this.model.getListIndex(location); + } + getListRenderCount(location) { + return this.model.getListRenderCount(location); + } + getNode(location) { + return this.nodeMapper.map(this.model.getNode(location)); + } + getNodeLocation(node) { + return node.element; + } + getParentNodeLocation(location) { + return this.model.getParentNodeLocation(location); + } + getFirstElementChild(location) { + const result = this.model.getFirstElementChild(location); + if (result === null || typeof result === 'undefined') { + return result; + } + return this.elementMapper(result.elements); + } + isCollapsible(location) { + return this.model.isCollapsible(location); + } + setCollapsible(location, collapsed) { + return this.model.setCollapsible(location, collapsed); + } + isCollapsed(location) { + return this.model.isCollapsed(location); + } + setCollapsed(location, collapsed, recursive) { + return this.model.setCollapsed(location, collapsed, recursive); + } + expandTo(location) { + return this.model.expandTo(location); + } + rerender(location) { + return this.model.rerender(location); + } + refilter() { + return this.model.refilter(); + } + getCompressedTreeNode(location = null) { + return this.model.getNode(location); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js new file mode 100644 index 0000000000000000000000000000000000000000..32e7dc98a6829a4b4768a1fb73cc655073069ee9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { AbstractTree } from './abstractTree.js'; +import { ObjectTreeModel } from './objectTreeModel.js'; +export class DataTree extends AbstractTree { + constructor(user, container, delegate, renderers, dataSource, options = {}) { + super(user, container, delegate, renderers, options); + this.user = user; + this.dataSource = dataSource; + this.identityProvider = options.identityProvider; + } + createModel(user, view, options) { + return new ObjectTreeModel(user, view, options); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js new file mode 100644 index 0000000000000000000000000000000000000000..b7265438199722b4f835daa983ef23e76bd212a2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js @@ -0,0 +1,534 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { TreeError } from './tree.js'; +import { splice, tail2 } from '../../../common/arrays.js'; +import { Delayer } from '../../../common/async.js'; +import { MicrotaskDelay } from '../../../common/symbols.js'; +import { LcsDiff } from '../../../common/diff/diff.js'; +import { Emitter, EventBufferer } from '../../../common/event.js'; +import { Iterable } from '../../../common/iterator.js'; +export function isFilterResult(obj) { + return typeof obj === 'object' && 'visibility' in obj && 'data' in obj; +} +export function getVisibleState(visibility) { + switch (visibility) { + case true: return 1 /* TreeVisibility.Visible */; + case false: return 0 /* TreeVisibility.Hidden */; + default: return visibility; + } +} +function isCollapsibleStateUpdate(update) { + return typeof update.collapsible === 'boolean'; +} +export class IndexTreeModel { + constructor(user, list, rootElement, options = {}) { + this.user = user; + this.list = list; + this.rootRef = []; + this.eventBufferer = new EventBufferer(); + this._onDidChangeCollapseState = new Emitter(); + this.onDidChangeCollapseState = this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event); + this._onDidChangeRenderNodeCount = new Emitter(); + this.onDidChangeRenderNodeCount = this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event); + this._onDidSplice = new Emitter(); + this.onDidSplice = this._onDidSplice.event; + this.refilterDelayer = new Delayer(MicrotaskDelay); + this.collapseByDefault = typeof options.collapseByDefault === 'undefined' ? false : options.collapseByDefault; + this.allowNonCollapsibleParents = options.allowNonCollapsibleParents ?? false; + this.filter = options.filter; + this.autoExpandSingleChildren = typeof options.autoExpandSingleChildren === 'undefined' ? false : options.autoExpandSingleChildren; + this.root = { + parent: undefined, + element: rootElement, + children: [], + depth: 0, + visibleChildrenCount: 0, + visibleChildIndex: -1, + collapsible: false, + collapsed: false, + renderNodeCount: 0, + visibility: 1 /* TreeVisibility.Visible */, + visible: true, + filterData: undefined + }; + } + splice(location, deleteCount, toInsert = Iterable.empty(), options = {}) { + if (location.length === 0) { + throw new TreeError(this.user, 'Invalid tree location'); + } + if (options.diffIdentityProvider) { + this.spliceSmart(options.diffIdentityProvider, location, deleteCount, toInsert, options); + } + else { + this.spliceSimple(location, deleteCount, toInsert, options); + } + } + spliceSmart(identity, location, deleteCount, toInsertIterable = Iterable.empty(), options, recurseLevels = options.diffDepth ?? 0) { + const { parentNode } = this.getParentNodeWithListIndex(location); + if (!parentNode.lastDiffIds) { + return this.spliceSimple(location, deleteCount, toInsertIterable, options); + } + const toInsert = [...toInsertIterable]; + const index = location[location.length - 1]; + const diff = new LcsDiff({ getElements: () => parentNode.lastDiffIds }, { + getElements: () => [ + ...parentNode.children.slice(0, index), + ...toInsert, + ...parentNode.children.slice(index + deleteCount), + ].map(e => identity.getId(e.element).toString()) + }).ComputeDiff(false); + // if we were given a 'best effort' diff, use default behavior + if (diff.quitEarly) { + parentNode.lastDiffIds = undefined; + return this.spliceSimple(location, deleteCount, toInsert, options); + } + const locationPrefix = location.slice(0, -1); + const recurseSplice = (fromOriginal, fromModified, count) => { + if (recurseLevels > 0) { + for (let i = 0; i < count; i++) { + fromOriginal--; + fromModified--; + this.spliceSmart(identity, [...locationPrefix, fromOriginal, 0], Number.MAX_SAFE_INTEGER, toInsert[fromModified].children, options, recurseLevels - 1); + } + } + }; + let lastStartO = Math.min(parentNode.children.length, index + deleteCount); + let lastStartM = toInsert.length; + for (const change of diff.changes.sort((a, b) => b.originalStart - a.originalStart)) { + recurseSplice(lastStartO, lastStartM, lastStartO - (change.originalStart + change.originalLength)); + lastStartO = change.originalStart; + lastStartM = change.modifiedStart - index; + this.spliceSimple([...locationPrefix, lastStartO], change.originalLength, Iterable.slice(toInsert, lastStartM, lastStartM + change.modifiedLength), options); + } + // at this point, startO === startM === count since any remaining prefix should match + recurseSplice(lastStartO, lastStartM, lastStartO); + } + spliceSimple(location, deleteCount, toInsert = Iterable.empty(), { onDidCreateNode, onDidDeleteNode, diffIdentityProvider }) { + const { parentNode, listIndex, revealed, visible } = this.getParentNodeWithListIndex(location); + const treeListElementsToInsert = []; + const nodesToInsertIterator = Iterable.map(toInsert, el => this.createTreeNode(el, parentNode, parentNode.visible ? 1 /* TreeVisibility.Visible */ : 0 /* TreeVisibility.Hidden */, revealed, treeListElementsToInsert, onDidCreateNode)); + const lastIndex = location[location.length - 1]; + // figure out what's the visible child start index right before the + // splice point + let visibleChildStartIndex = 0; + for (let i = lastIndex; i >= 0 && i < parentNode.children.length; i--) { + const child = parentNode.children[i]; + if (child.visible) { + visibleChildStartIndex = child.visibleChildIndex; + break; + } + } + const nodesToInsert = []; + let insertedVisibleChildrenCount = 0; + let renderNodeCount = 0; + for (const child of nodesToInsertIterator) { + nodesToInsert.push(child); + renderNodeCount += child.renderNodeCount; + if (child.visible) { + child.visibleChildIndex = visibleChildStartIndex + insertedVisibleChildrenCount++; + } + } + const deletedNodes = splice(parentNode.children, lastIndex, deleteCount, nodesToInsert); + if (!diffIdentityProvider) { + parentNode.lastDiffIds = undefined; + } + else if (parentNode.lastDiffIds) { + splice(parentNode.lastDiffIds, lastIndex, deleteCount, nodesToInsert.map(n => diffIdentityProvider.getId(n.element).toString())); + } + else { + parentNode.lastDiffIds = parentNode.children.map(n => diffIdentityProvider.getId(n.element).toString()); + } + // figure out what is the count of deleted visible children + let deletedVisibleChildrenCount = 0; + for (const child of deletedNodes) { + if (child.visible) { + deletedVisibleChildrenCount++; + } + } + // and adjust for all visible children after the splice point + if (deletedVisibleChildrenCount !== 0) { + for (let i = lastIndex + nodesToInsert.length; i < parentNode.children.length; i++) { + const child = parentNode.children[i]; + if (child.visible) { + child.visibleChildIndex -= deletedVisibleChildrenCount; + } + } + } + // update parent's visible children count + parentNode.visibleChildrenCount += insertedVisibleChildrenCount - deletedVisibleChildrenCount; + if (revealed && visible) { + const visibleDeleteCount = deletedNodes.reduce((r, node) => r + (node.visible ? node.renderNodeCount : 0), 0); + this._updateAncestorsRenderNodeCount(parentNode, renderNodeCount - visibleDeleteCount); + this.list.splice(listIndex, visibleDeleteCount, treeListElementsToInsert); + } + if (deletedNodes.length > 0 && onDidDeleteNode) { + const visit = (node) => { + onDidDeleteNode(node); + node.children.forEach(visit); + }; + deletedNodes.forEach(visit); + } + this._onDidSplice.fire({ insertedNodes: nodesToInsert, deletedNodes }); + let node = parentNode; + while (node) { + if (node.visibility === 2 /* TreeVisibility.Recurse */) { + // delayed to avoid excessive refiltering, see #135941 + this.refilterDelayer.trigger(() => this.refilter()); + break; + } + node = node.parent; + } + } + rerender(location) { + if (location.length === 0) { + throw new TreeError(this.user, 'Invalid tree location'); + } + const { node, listIndex, revealed } = this.getTreeNodeWithListIndex(location); + if (node.visible && revealed) { + this.list.splice(listIndex, 1, [node]); + } + } + has(location) { + return this.hasTreeNode(location); + } + getListIndex(location) { + const { listIndex, visible, revealed } = this.getTreeNodeWithListIndex(location); + return visible && revealed ? listIndex : -1; + } + getListRenderCount(location) { + return this.getTreeNode(location).renderNodeCount; + } + isCollapsible(location) { + return this.getTreeNode(location).collapsible; + } + setCollapsible(location, collapsible) { + const node = this.getTreeNode(location); + if (typeof collapsible === 'undefined') { + collapsible = !node.collapsible; + } + const update = { collapsible }; + return this.eventBufferer.bufferEvents(() => this._setCollapseState(location, update)); + } + isCollapsed(location) { + return this.getTreeNode(location).collapsed; + } + setCollapsed(location, collapsed, recursive) { + const node = this.getTreeNode(location); + if (typeof collapsed === 'undefined') { + collapsed = !node.collapsed; + } + const update = { collapsed, recursive: recursive || false }; + return this.eventBufferer.bufferEvents(() => this._setCollapseState(location, update)); + } + _setCollapseState(location, update) { + const { node, listIndex, revealed } = this.getTreeNodeWithListIndex(location); + const result = this._setListNodeCollapseState(node, listIndex, revealed, update); + if (node !== this.root && this.autoExpandSingleChildren && result && !isCollapsibleStateUpdate(update) && node.collapsible && !node.collapsed && !update.recursive) { + let onlyVisibleChildIndex = -1; + for (let i = 0; i < node.children.length; i++) { + const child = node.children[i]; + if (child.visible) { + if (onlyVisibleChildIndex > -1) { + onlyVisibleChildIndex = -1; + break; + } + else { + onlyVisibleChildIndex = i; + } + } + } + if (onlyVisibleChildIndex > -1) { + this._setCollapseState([...location, onlyVisibleChildIndex], update); + } + } + return result; + } + _setListNodeCollapseState(node, listIndex, revealed, update) { + const result = this._setNodeCollapseState(node, update, false); + if (!revealed || !node.visible || !result) { + return result; + } + const previousRenderNodeCount = node.renderNodeCount; + const toInsert = this.updateNodeAfterCollapseChange(node); + const deleteCount = previousRenderNodeCount - (listIndex === -1 ? 0 : 1); + this.list.splice(listIndex + 1, deleteCount, toInsert.slice(1)); + return result; + } + _setNodeCollapseState(node, update, deep) { + let result; + if (node === this.root) { + result = false; + } + else { + if (isCollapsibleStateUpdate(update)) { + result = node.collapsible !== update.collapsible; + node.collapsible = update.collapsible; + } + else if (!node.collapsible) { + result = false; + } + else { + result = node.collapsed !== update.collapsed; + node.collapsed = update.collapsed; + } + if (result) { + this._onDidChangeCollapseState.fire({ node, deep }); + } + } + if (!isCollapsibleStateUpdate(update) && update.recursive) { + for (const child of node.children) { + result = this._setNodeCollapseState(child, update, true) || result; + } + } + return result; + } + expandTo(location) { + this.eventBufferer.bufferEvents(() => { + let node = this.getTreeNode(location); + while (node.parent) { + node = node.parent; + location = location.slice(0, location.length - 1); + if (node.collapsed) { + this._setCollapseState(location, { collapsed: false, recursive: false }); + } + } + }); + } + refilter() { + const previousRenderNodeCount = this.root.renderNodeCount; + const toInsert = this.updateNodeAfterFilterChange(this.root); + this.list.splice(0, previousRenderNodeCount, toInsert); + this.refilterDelayer.cancel(); + } + createTreeNode(treeElement, parent, parentVisibility, revealed, treeListElements, onDidCreateNode) { + const node = { + parent, + element: treeElement.element, + children: [], + depth: parent.depth + 1, + visibleChildrenCount: 0, + visibleChildIndex: -1, + collapsible: typeof treeElement.collapsible === 'boolean' ? treeElement.collapsible : (typeof treeElement.collapsed !== 'undefined'), + collapsed: typeof treeElement.collapsed === 'undefined' ? this.collapseByDefault : treeElement.collapsed, + renderNodeCount: 1, + visibility: 1 /* TreeVisibility.Visible */, + visible: true, + filterData: undefined + }; + const visibility = this._filterNode(node, parentVisibility); + node.visibility = visibility; + if (revealed) { + treeListElements.push(node); + } + const childElements = treeElement.children || Iterable.empty(); + const childRevealed = revealed && visibility !== 0 /* TreeVisibility.Hidden */ && !node.collapsed; + let visibleChildrenCount = 0; + let renderNodeCount = 1; + for (const el of childElements) { + const child = this.createTreeNode(el, node, visibility, childRevealed, treeListElements, onDidCreateNode); + node.children.push(child); + renderNodeCount += child.renderNodeCount; + if (child.visible) { + child.visibleChildIndex = visibleChildrenCount++; + } + } + if (!this.allowNonCollapsibleParents) { + node.collapsible = node.collapsible || node.children.length > 0; + } + node.visibleChildrenCount = visibleChildrenCount; + node.visible = visibility === 2 /* TreeVisibility.Recurse */ ? visibleChildrenCount > 0 : (visibility === 1 /* TreeVisibility.Visible */); + if (!node.visible) { + node.renderNodeCount = 0; + if (revealed) { + treeListElements.pop(); + } + } + else if (!node.collapsed) { + node.renderNodeCount = renderNodeCount; + } + onDidCreateNode?.(node); + return node; + } + updateNodeAfterCollapseChange(node) { + const previousRenderNodeCount = node.renderNodeCount; + const result = []; + this._updateNodeAfterCollapseChange(node, result); + this._updateAncestorsRenderNodeCount(node.parent, result.length - previousRenderNodeCount); + return result; + } + _updateNodeAfterCollapseChange(node, result) { + if (node.visible === false) { + return 0; + } + result.push(node); + node.renderNodeCount = 1; + if (!node.collapsed) { + for (const child of node.children) { + node.renderNodeCount += this._updateNodeAfterCollapseChange(child, result); + } + } + this._onDidChangeRenderNodeCount.fire(node); + return node.renderNodeCount; + } + updateNodeAfterFilterChange(node) { + const previousRenderNodeCount = node.renderNodeCount; + const result = []; + this._updateNodeAfterFilterChange(node, node.visible ? 1 /* TreeVisibility.Visible */ : 0 /* TreeVisibility.Hidden */, result); + this._updateAncestorsRenderNodeCount(node.parent, result.length - previousRenderNodeCount); + return result; + } + _updateNodeAfterFilterChange(node, parentVisibility, result, revealed = true) { + let visibility; + if (node !== this.root) { + visibility = this._filterNode(node, parentVisibility); + if (visibility === 0 /* TreeVisibility.Hidden */) { + node.visible = false; + node.renderNodeCount = 0; + return false; + } + if (revealed) { + result.push(node); + } + } + const resultStartLength = result.length; + node.renderNodeCount = node === this.root ? 0 : 1; + let hasVisibleDescendants = false; + if (!node.collapsed || visibility !== 0 /* TreeVisibility.Hidden */) { + let visibleChildIndex = 0; + for (const child of node.children) { + hasVisibleDescendants = this._updateNodeAfterFilterChange(child, visibility, result, revealed && !node.collapsed) || hasVisibleDescendants; + if (child.visible) { + child.visibleChildIndex = visibleChildIndex++; + } + } + node.visibleChildrenCount = visibleChildIndex; + } + else { + node.visibleChildrenCount = 0; + } + if (node !== this.root) { + node.visible = visibility === 2 /* TreeVisibility.Recurse */ ? hasVisibleDescendants : (visibility === 1 /* TreeVisibility.Visible */); + node.visibility = visibility; + } + if (!node.visible) { + node.renderNodeCount = 0; + if (revealed) { + result.pop(); + } + } + else if (!node.collapsed) { + node.renderNodeCount += result.length - resultStartLength; + } + this._onDidChangeRenderNodeCount.fire(node); + return node.visible; + } + _updateAncestorsRenderNodeCount(node, diff) { + if (diff === 0) { + return; + } + while (node) { + node.renderNodeCount += diff; + this._onDidChangeRenderNodeCount.fire(node); + node = node.parent; + } + } + _filterNode(node, parentVisibility) { + const result = this.filter ? this.filter.filter(node.element, parentVisibility) : 1 /* TreeVisibility.Visible */; + if (typeof result === 'boolean') { + node.filterData = undefined; + return result ? 1 /* TreeVisibility.Visible */ : 0 /* TreeVisibility.Hidden */; + } + else if (isFilterResult(result)) { + node.filterData = result.data; + return getVisibleState(result.visibility); + } + else { + node.filterData = undefined; + return getVisibleState(result); + } + } + // cheap + hasTreeNode(location, node = this.root) { + if (!location || location.length === 0) { + return true; + } + const [index, ...rest] = location; + if (index < 0 || index > node.children.length) { + return false; + } + return this.hasTreeNode(rest, node.children[index]); + } + // cheap + getTreeNode(location, node = this.root) { + if (!location || location.length === 0) { + return node; + } + const [index, ...rest] = location; + if (index < 0 || index > node.children.length) { + throw new TreeError(this.user, 'Invalid tree location'); + } + return this.getTreeNode(rest, node.children[index]); + } + // expensive + getTreeNodeWithListIndex(location) { + if (location.length === 0) { + return { node: this.root, listIndex: -1, revealed: true, visible: false }; + } + const { parentNode, listIndex, revealed, visible } = this.getParentNodeWithListIndex(location); + const index = location[location.length - 1]; + if (index < 0 || index > parentNode.children.length) { + throw new TreeError(this.user, 'Invalid tree location'); + } + const node = parentNode.children[index]; + return { node, listIndex, revealed, visible: visible && node.visible }; + } + getParentNodeWithListIndex(location, node = this.root, listIndex = 0, revealed = true, visible = true) { + const [index, ...rest] = location; + if (index < 0 || index > node.children.length) { + throw new TreeError(this.user, 'Invalid tree location'); + } + // TODO@joao perf! + for (let i = 0; i < index; i++) { + listIndex += node.children[i].renderNodeCount; + } + revealed = revealed && !node.collapsed; + visible = visible && node.visible; + if (rest.length === 0) { + return { parentNode: node, listIndex, revealed, visible }; + } + return this.getParentNodeWithListIndex(rest, node.children[index], listIndex + 1, revealed, visible); + } + getNode(location = []) { + return this.getTreeNode(location); + } + // TODO@joao perf! + getNodeLocation(node) { + const location = []; + let indexTreeNode = node; // typing woes + while (indexTreeNode.parent) { + location.push(indexTreeNode.parent.children.indexOf(indexTreeNode)); + indexTreeNode = indexTreeNode.parent; + } + return location.reverse(); + } + getParentNodeLocation(location) { + if (location.length === 0) { + return undefined; + } + else if (location.length === 1) { + return []; + } + else { + return tail2(location)[0]; + } + } + getFirstElementChild(location) { + const node = this.getTreeNode(location); + if (node.children.length === 0) { + return undefined; + } + return node.children[0].element; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/media/tree.css b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/media/tree.css new file mode 100644 index 0000000000000000000000000000000000000000..58099a56c27c04b9b22430b833476735a2988dbe --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/media/tree.css @@ -0,0 +1,174 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-tl-row { + display: flex; + height: 100%; + align-items: center; + position: relative; +} + +.monaco-tl-row.disabled { + cursor: default; +} +.monaco-tl-indent { + height: 100%; + position: absolute; + top: 0; + left: 16px; + pointer-events: none; +} + +.hide-arrows .monaco-tl-indent { + left: 12px; +} + +.monaco-tl-indent > .indent-guide { + display: inline-block; + box-sizing: border-box; + height: 100%; + border-left: 1px solid transparent; +} + +.monaco-workbench:not(.reduce-motion) .monaco-tl-indent > .indent-guide { + transition: border-color 0.1s linear; +} + +.monaco-tl-twistie, +.monaco-tl-contents { + height: 100%; +} + +.monaco-tl-twistie { + font-size: 10px; + text-align: right; + padding-right: 6px; + flex-shrink: 0; + width: 16px; + display: flex !important; + align-items: center; + justify-content: center; + transform: translateX(3px); +} + +.monaco-tl-contents { + flex: 1; + overflow: hidden; +} + +.monaco-tl-twistie::before { + border-radius: 20px; +} + +.monaco-tl-twistie.collapsed::before { + transform: rotate(-90deg); +} + +.monaco-tl-twistie.codicon-tree-item-loading::before { + /* Use steps to throttle FPS to reduce CPU usage */ + animation: codicon-spin 1.25s steps(30) infinite; +} + +.monaco-tree-type-filter { + position: absolute; + top: 0; + display: flex; + padding: 3px; + max-width: 200px; + z-index: 100; + margin: 0 6px; + border: 1px solid var(--vscode-widget-border); + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; +} + +.monaco-workbench:not(.reduce-motion) .monaco-tree-type-filter { + transition: top 0.3s; +} + +.monaco-tree-type-filter.disabled { + top: -40px !important; +} + +.monaco-tree-type-filter-grab { + display: flex !important; + align-items: center; + justify-content: center; + cursor: grab; + margin-right: 2px; +} + +.monaco-tree-type-filter-grab.grabbing { + cursor: grabbing; +} + +.monaco-tree-type-filter-input { + flex: 1; +} + +.monaco-tree-type-filter-input .monaco-inputbox { + height: 23px; +} + +.monaco-tree-type-filter-input .monaco-inputbox > .ibwrapper > .input, +.monaco-tree-type-filter-input .monaco-inputbox > .ibwrapper > .mirror { + padding: 2px 4px; +} + +.monaco-tree-type-filter-input .monaco-findInput > .controls { + top: 2px; +} + +.monaco-tree-type-filter-actionbar { + margin-left: 4px; +} + +.monaco-tree-type-filter-actionbar .monaco-action-bar .action-label { + padding: 2px; +} + +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container{ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 0; + z-index: 13; /* Settings editor uses z-index: 12 */ + + /* Backup color in case the tree does not provide the background color */ + background-color: var(--vscode-sideBar-background); +} + +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row.monaco-list-row{ + position: absolute; + width: 100%; + opacity: 1 !important; /* Settings editor uses opacity < 1 */ + overflow: hidden; + + /* Backup color in case the tree does not provide the background color */ + background-color: var(--vscode-sideBar-background); +} + +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row:hover{ + background-color: var(--vscode-list-hoverBackground) !important; + cursor: pointer; +} + +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container.empty, +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container.empty .monaco-tree-sticky-container-shadow { + display: none; +} + +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { + position: absolute; + bottom: -3px; + left: 0px; + height: 0px; /* heigt is 3px and only set when there is a treeStickyScrollShadow color */ + width: 100%; +} + +.monaco-list .monaco-scrollable-element .monaco-tree-sticky-container[tabindex="0"]:focus{ + outline: none; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js new file mode 100644 index 0000000000000000000000000000000000000000..03b710c2869bd4c48d29241ab93dfde12812180b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js @@ -0,0 +1,201 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { AbstractTree } from './abstractTree.js'; +import { CompressibleObjectTreeModel } from './compressedObjectTreeModel.js'; +import { ObjectTreeModel } from './objectTreeModel.js'; +import { memoize } from '../../../common/decorators.js'; +import { Iterable } from '../../../common/iterator.js'; +export class ObjectTree extends AbstractTree { + get onDidChangeCollapseState() { return this.model.onDidChangeCollapseState; } + constructor(user, container, delegate, renderers, options = {}) { + super(user, container, delegate, renderers, options); + this.user = user; + } + setChildren(element, children = Iterable.empty(), options) { + this.model.setChildren(element, children, options); + } + rerender(element) { + if (element === undefined) { + this.view.rerender(); + return; + } + this.model.rerender(element); + } + hasElement(element) { + return this.model.has(element); + } + createModel(user, view, options) { + return new ObjectTreeModel(user, view, options); + } +} +class CompressibleRenderer { + get compressedTreeNodeProvider() { + return this._compressedTreeNodeProvider(); + } + constructor(_compressedTreeNodeProvider, stickyScrollDelegate, renderer) { + this._compressedTreeNodeProvider = _compressedTreeNodeProvider; + this.stickyScrollDelegate = stickyScrollDelegate; + this.renderer = renderer; + this.templateId = renderer.templateId; + if (renderer.onDidChangeTwistieState) { + this.onDidChangeTwistieState = renderer.onDidChangeTwistieState; + } + } + renderTemplate(container) { + const data = this.renderer.renderTemplate(container); + return { compressedTreeNode: undefined, data }; + } + renderElement(node, index, templateData, height) { + let compressedTreeNode = this.stickyScrollDelegate.getCompressedNode(node); + if (!compressedTreeNode) { + compressedTreeNode = this.compressedTreeNodeProvider.getCompressedTreeNode(node.element); + } + if (compressedTreeNode.element.elements.length === 1) { + templateData.compressedTreeNode = undefined; + this.renderer.renderElement(node, index, templateData.data, height); + } + else { + templateData.compressedTreeNode = compressedTreeNode; + this.renderer.renderCompressedElements(compressedTreeNode, index, templateData.data, height); + } + } + disposeElement(node, index, templateData, height) { + if (templateData.compressedTreeNode) { + this.renderer.disposeCompressedElements?.(templateData.compressedTreeNode, index, templateData.data, height); + } + else { + this.renderer.disposeElement?.(node, index, templateData.data, height); + } + } + disposeTemplate(templateData) { + this.renderer.disposeTemplate(templateData.data); + } + renderTwistie(element, twistieElement) { + if (this.renderer.renderTwistie) { + return this.renderer.renderTwistie(element, twistieElement); + } + return false; + } +} +__decorate([ + memoize +], CompressibleRenderer.prototype, "compressedTreeNodeProvider", null); +class CompressibleStickyScrollDelegate { + constructor(modelProvider) { + this.modelProvider = modelProvider; + this.compressedStickyNodes = new Map(); + } + getCompressedNode(node) { + return this.compressedStickyNodes.get(node); + } + constrainStickyScrollNodes(stickyNodes, stickyScrollMaxItemCount, maxWidgetHeight) { + this.compressedStickyNodes.clear(); + if (stickyNodes.length === 0) { + return []; + } + for (let i = 0; i < stickyNodes.length; i++) { + const stickyNode = stickyNodes[i]; + const stickyNodeBottom = stickyNode.position + stickyNode.height; + const followingReachesMaxHeight = i + 1 < stickyNodes.length && stickyNodeBottom + stickyNodes[i + 1].height > maxWidgetHeight; + if (followingReachesMaxHeight || i >= stickyScrollMaxItemCount - 1 && stickyScrollMaxItemCount < stickyNodes.length) { + const uncompressedStickyNodes = stickyNodes.slice(0, i); + const overflowingStickyNodes = stickyNodes.slice(i); + const compressedStickyNode = this.compressStickyNodes(overflowingStickyNodes); + return [...uncompressedStickyNodes, compressedStickyNode]; + } + } + return stickyNodes; + } + compressStickyNodes(stickyNodes) { + if (stickyNodes.length === 0) { + throw new Error('Can\'t compress empty sticky nodes'); + } + const compressionModel = this.modelProvider(); + if (!compressionModel.isCompressionEnabled()) { + return stickyNodes[0]; + } + // Collect all elements to be compressed + const elements = []; + for (let i = 0; i < stickyNodes.length; i++) { + const stickyNode = stickyNodes[i]; + const compressedNode = compressionModel.getCompressedTreeNode(stickyNode.node.element); + if (compressedNode.element) { + // if an element is incompressible, it can't be compressed with it's parent element + if (i !== 0 && compressedNode.element.incompressible) { + break; + } + elements.push(...compressedNode.element.elements); + } + } + if (elements.length < 2) { + return stickyNodes[0]; + } + // Compress the elements + const lastStickyNode = stickyNodes[stickyNodes.length - 1]; + const compressedElement = { elements, incompressible: false }; + const compressedNode = { ...lastStickyNode.node, children: [], element: compressedElement }; + const stickyTreeNode = new Proxy(stickyNodes[0].node, {}); + const compressedStickyNode = { + node: stickyTreeNode, + startIndex: stickyNodes[0].startIndex, + endIndex: lastStickyNode.endIndex, + position: stickyNodes[0].position, + height: stickyNodes[0].height, + }; + this.compressedStickyNodes.set(stickyTreeNode, compressedNode); + return compressedStickyNode; + } +} +function asObjectTreeOptions(compressedTreeNodeProvider, options) { + return options && { + ...options, + keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && { + getKeyboardNavigationLabel(e) { + let compressedTreeNode; + try { + compressedTreeNode = compressedTreeNodeProvider().getCompressedTreeNode(e); + } + catch { + return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e); + } + if (compressedTreeNode.element.elements.length === 1) { + return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e); + } + else { + return options.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(compressedTreeNode.element.elements); + } + } + } + }; +} +export class CompressibleObjectTree extends ObjectTree { + constructor(user, container, delegate, renderers, options = {}) { + const compressedTreeNodeProvider = () => this; + const stickyScrollDelegate = new CompressibleStickyScrollDelegate(() => this.model); + const compressibleRenderers = renderers.map(r => new CompressibleRenderer(compressedTreeNodeProvider, stickyScrollDelegate, r)); + super(user, container, delegate, compressibleRenderers, { ...asObjectTreeOptions(compressedTreeNodeProvider, options), stickyScrollDelegate }); + } + setChildren(element, children = Iterable.empty(), options) { + this.model.setChildren(element, children, options); + } + createModel(user, view, options) { + return new CompressibleObjectTreeModel(user, view, options); + } + updateOptions(optionsUpdate = {}) { + super.updateOptions(optionsUpdate); + if (typeof optionsUpdate.compressionEnabled !== 'undefined') { + this.model.setCompressionEnabled(optionsUpdate.compressionEnabled); + } + } + getCompressedTreeNode(element = null) { + return this.model.getCompressedTreeNode(element); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js new file mode 100644 index 0000000000000000000000000000000000000000..9c252c26ebfcdd4199c738564394b508711d6639 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js @@ -0,0 +1,196 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { IndexTreeModel } from './indexTreeModel.js'; +import { ObjectTreeElementCollapseState, TreeError } from './tree.js'; +import { Iterable } from '../../../common/iterator.js'; +export class ObjectTreeModel { + constructor(user, list, options = {}) { + this.user = user; + this.rootRef = null; + this.nodes = new Map(); + this.nodesByIdentity = new Map(); + this.model = new IndexTreeModel(user, list, null, options); + this.onDidSplice = this.model.onDidSplice; + this.onDidChangeCollapseState = this.model.onDidChangeCollapseState; + this.onDidChangeRenderNodeCount = this.model.onDidChangeRenderNodeCount; + if (options.sorter) { + this.sorter = { + compare(a, b) { + return options.sorter.compare(a.element, b.element); + } + }; + } + this.identityProvider = options.identityProvider; + } + setChildren(element, children = Iterable.empty(), options = {}) { + const location = this.getElementLocation(element); + this._setChildren(location, this.preserveCollapseState(children), options); + } + _setChildren(location, children = Iterable.empty(), options) { + const insertedElements = new Set(); + const insertedElementIds = new Set(); + const onDidCreateNode = (node) => { + if (node.element === null) { + return; + } + const tnode = node; + insertedElements.add(tnode.element); + this.nodes.set(tnode.element, tnode); + if (this.identityProvider) { + const id = this.identityProvider.getId(tnode.element).toString(); + insertedElementIds.add(id); + this.nodesByIdentity.set(id, tnode); + } + options.onDidCreateNode?.(tnode); + }; + const onDidDeleteNode = (node) => { + if (node.element === null) { + return; + } + const tnode = node; + if (!insertedElements.has(tnode.element)) { + this.nodes.delete(tnode.element); + } + if (this.identityProvider) { + const id = this.identityProvider.getId(tnode.element).toString(); + if (!insertedElementIds.has(id)) { + this.nodesByIdentity.delete(id); + } + } + options.onDidDeleteNode?.(tnode); + }; + this.model.splice([...location, 0], Number.MAX_VALUE, children, { ...options, onDidCreateNode, onDidDeleteNode }); + } + preserveCollapseState(elements = Iterable.empty()) { + if (this.sorter) { + elements = [...elements].sort(this.sorter.compare.bind(this.sorter)); + } + return Iterable.map(elements, treeElement => { + let node = this.nodes.get(treeElement.element); + if (!node && this.identityProvider) { + const id = this.identityProvider.getId(treeElement.element).toString(); + node = this.nodesByIdentity.get(id); + } + if (!node) { + let collapsed; + if (typeof treeElement.collapsed === 'undefined') { + collapsed = undefined; + } + else if (treeElement.collapsed === ObjectTreeElementCollapseState.Collapsed || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrCollapsed) { + collapsed = true; + } + else if (treeElement.collapsed === ObjectTreeElementCollapseState.Expanded || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrExpanded) { + collapsed = false; + } + else { + collapsed = Boolean(treeElement.collapsed); + } + return { + ...treeElement, + children: this.preserveCollapseState(treeElement.children), + collapsed + }; + } + const collapsible = typeof treeElement.collapsible === 'boolean' ? treeElement.collapsible : node.collapsible; + let collapsed; + if (typeof treeElement.collapsed === 'undefined' || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrCollapsed || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrExpanded) { + collapsed = node.collapsed; + } + else if (treeElement.collapsed === ObjectTreeElementCollapseState.Collapsed) { + collapsed = true; + } + else if (treeElement.collapsed === ObjectTreeElementCollapseState.Expanded) { + collapsed = false; + } + else { + collapsed = Boolean(treeElement.collapsed); + } + return { + ...treeElement, + collapsible, + collapsed, + children: this.preserveCollapseState(treeElement.children) + }; + }); + } + rerender(element) { + const location = this.getElementLocation(element); + this.model.rerender(location); + } + getFirstElementChild(ref = null) { + const location = this.getElementLocation(ref); + return this.model.getFirstElementChild(location); + } + has(element) { + return this.nodes.has(element); + } + getListIndex(element) { + const location = this.getElementLocation(element); + return this.model.getListIndex(location); + } + getListRenderCount(element) { + const location = this.getElementLocation(element); + return this.model.getListRenderCount(location); + } + isCollapsible(element) { + const location = this.getElementLocation(element); + return this.model.isCollapsible(location); + } + setCollapsible(element, collapsible) { + const location = this.getElementLocation(element); + return this.model.setCollapsible(location, collapsible); + } + isCollapsed(element) { + const location = this.getElementLocation(element); + return this.model.isCollapsed(location); + } + setCollapsed(element, collapsed, recursive) { + const location = this.getElementLocation(element); + return this.model.setCollapsed(location, collapsed, recursive); + } + expandTo(element) { + const location = this.getElementLocation(element); + this.model.expandTo(location); + } + refilter() { + this.model.refilter(); + } + getNode(element = null) { + if (element === null) { + return this.model.getNode(this.model.rootRef); + } + const node = this.nodes.get(element); + if (!node) { + throw new TreeError(this.user, `Tree element not found: ${element}`); + } + return node; + } + getNodeLocation(node) { + return node.element; + } + getParentNodeLocation(element) { + if (element === null) { + throw new TreeError(this.user, `Invalid getParentNodeLocation call`); + } + const node = this.nodes.get(element); + if (!node) { + throw new TreeError(this.user, `Tree element not found: ${element}`); + } + const location = this.model.getNodeLocation(node); + const parentLocation = this.model.getParentNodeLocation(location); + const parent = this.model.getNode(parentLocation); + return parent.element; + } + getElementLocation(element) { + if (element === null) { + return []; + } + const node = this.nodes.get(element); + if (!node) { + throw new TreeError(this.user, `Tree element not found: ${element}`); + } + return this.model.getNodeLocation(node); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js new file mode 100644 index 0000000000000000000000000000000000000000..c3998453c3adb562eb992b2bad4b2bdb0d7efb93 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export var ObjectTreeElementCollapseState; +(function (ObjectTreeElementCollapseState) { + ObjectTreeElementCollapseState[ObjectTreeElementCollapseState["Expanded"] = 0] = "Expanded"; + ObjectTreeElementCollapseState[ObjectTreeElementCollapseState["Collapsed"] = 1] = "Collapsed"; + /** + * If the element is already in the tree, preserve its current state. Else, expand it. + */ + ObjectTreeElementCollapseState[ObjectTreeElementCollapseState["PreserveOrExpanded"] = 2] = "PreserveOrExpanded"; + /** + * If the element is already in the tree, preserve its current state. Else, collapse it. + */ + ObjectTreeElementCollapseState[ObjectTreeElementCollapseState["PreserveOrCollapsed"] = 3] = "PreserveOrCollapsed"; +})(ObjectTreeElementCollapseState || (ObjectTreeElementCollapseState = {})); +export var TreeMouseEventTarget; +(function (TreeMouseEventTarget) { + TreeMouseEventTarget[TreeMouseEventTarget["Unknown"] = 0] = "Unknown"; + TreeMouseEventTarget[TreeMouseEventTarget["Twistie"] = 1] = "Twistie"; + TreeMouseEventTarget[TreeMouseEventTarget["Element"] = 2] = "Element"; + TreeMouseEventTarget[TreeMouseEventTarget["Filter"] = 3] = "Filter"; +})(TreeMouseEventTarget || (TreeMouseEventTarget = {})); +export class TreeError extends Error { + constructor(user, message) { + super(`TreeError [${user}] ${message}`); + } +} +export class WeakMapper { + constructor(fn) { + this.fn = fn; + this._map = new WeakMap(); + } + map(key) { + let result = this._map.get(key); + if (!result) { + result = this.fn(key); + this._map.set(key, result); + } + return result; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js new file mode 100644 index 0000000000000000000000000000000000000000..7b68dafbaadfdc4444821ad157c40088995a48a7 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as dom from '../dom.js'; +import { StandardKeyboardEvent } from '../keyboardEvent.js'; +import { StandardMouseEvent } from '../mouseEvent.js'; +import { Gesture } from '../touch.js'; +import { Disposable } from '../../common/lifecycle.js'; +export class Widget extends Disposable { + onclick(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e)))); + } + onmousedown(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e)))); + } + onmouseover(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e)))); + } + onmouseleave(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_LEAVE, (e) => listener(new StandardMouseEvent(dom.getWindow(domNode), e)))); + } + onkeydown(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e) => listener(new StandardKeyboardEvent(e)))); + } + onkeyup(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e) => listener(new StandardKeyboardEvent(e)))); + } + oninput(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener)); + } + onblur(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener)); + } + onfocus(domNode, listener) { + this._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener)); + } + ignoreGesture(domNode) { + return Gesture.ignoreTarget(domNode); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/window.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/window.js new file mode 100644 index 0000000000000000000000000000000000000000..898708314d00237320812deea777c64a52f030b9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/browser/window.js @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export function ensureCodeWindow(targetWindow, fallbackWindowId) { + const codeWindow = targetWindow; + if (typeof codeWindow.vscodeWindowId !== 'number') { + Object.defineProperty(codeWindow, 'vscodeWindowId', { + get: () => fallbackWindowId + }); + } +} +// eslint-disable-next-line no-restricted-globals +export const mainWindow = window; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/actions.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/actions.js new file mode 100644 index 0000000000000000000000000000000000000000..3cf979a90bafb8aa5b1e09990d903b53a4584031 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/actions.js @@ -0,0 +1,174 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Emitter } from './event.js'; +import { Disposable } from './lifecycle.js'; +import * as nls from '../../nls.js'; +export class Action extends Disposable { + constructor(id, label = '', cssClass = '', enabled = true, actionCallback) { + super(); + this._onDidChange = this._register(new Emitter()); + this.onDidChange = this._onDidChange.event; + this._enabled = true; + this._id = id; + this._label = label; + this._cssClass = cssClass; + this._enabled = enabled; + this._actionCallback = actionCallback; + } + get id() { + return this._id; + } + get label() { + return this._label; + } + set label(value) { + this._setLabel(value); + } + _setLabel(value) { + if (this._label !== value) { + this._label = value; + this._onDidChange.fire({ label: value }); + } + } + get tooltip() { + return this._tooltip || ''; + } + set tooltip(value) { + this._setTooltip(value); + } + _setTooltip(value) { + if (this._tooltip !== value) { + this._tooltip = value; + this._onDidChange.fire({ tooltip: value }); + } + } + get class() { + return this._cssClass; + } + set class(value) { + this._setClass(value); + } + _setClass(value) { + if (this._cssClass !== value) { + this._cssClass = value; + this._onDidChange.fire({ class: value }); + } + } + get enabled() { + return this._enabled; + } + set enabled(value) { + this._setEnabled(value); + } + _setEnabled(value) { + if (this._enabled !== value) { + this._enabled = value; + this._onDidChange.fire({ enabled: value }); + } + } + get checked() { + return this._checked; + } + set checked(value) { + this._setChecked(value); + } + _setChecked(value) { + if (this._checked !== value) { + this._checked = value; + this._onDidChange.fire({ checked: value }); + } + } + async run(event, data) { + if (this._actionCallback) { + await this._actionCallback(event); + } + } +} +export class ActionRunner extends Disposable { + constructor() { + super(...arguments); + this._onWillRun = this._register(new Emitter()); + this.onWillRun = this._onWillRun.event; + this._onDidRun = this._register(new Emitter()); + this.onDidRun = this._onDidRun.event; + } + async run(action, context) { + if (!action.enabled) { + return; + } + this._onWillRun.fire({ action }); + let error = undefined; + try { + await this.runAction(action, context); + } + catch (e) { + error = e; + } + this._onDidRun.fire({ action, error }); + } + async runAction(action, context) { + await action.run(context); + } +} +export class Separator { + constructor() { + this.id = Separator.ID; + this.label = ''; + this.tooltip = ''; + this.class = 'separator'; + this.enabled = false; + this.checked = false; + } + /** + * Joins all non-empty lists of actions with separators. + */ + static join(...actionLists) { + let out = []; + for (const list of actionLists) { + if (!list.length) { + // skip + } + else if (out.length) { + out = [...out, new Separator(), ...list]; + } + else { + out = list; + } + } + return out; + } + static { this.ID = 'vs.actions.separator'; } + async run() { } +} +export class SubmenuAction { + get actions() { return this._actions; } + constructor(id, label, actions, cssClass) { + this.tooltip = ''; + this.enabled = true; + this.checked = undefined; + this.id = id; + this.label = label; + this.class = cssClass; + this._actions = actions; + } + async run() { } +} +export class EmptySubmenuAction extends Action { + static { this.ID = 'vs.actions.empty'; } + constructor() { + super(EmptySubmenuAction.ID, nls.localize('submenu.empty', '(empty)'), undefined, false); + } +} +export function toAction(props) { + return { + id: props.id, + label: props.label, + tooltip: props.tooltip ?? props.label, + class: props.class, + enabled: props.enabled ?? true, + checked: props.checked, + run: async (...args) => props.run(...args), + }; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/arrays.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/arrays.js new file mode 100644 index 0000000000000000000000000000000000000000..4e55e4d379c4eecd0dca56b3e424717259835c9e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/arrays.js @@ -0,0 +1,501 @@ +/** + * Returns the last element of an array. + * @param array The array. + * @param n Which element from the end (default is zero). + */ +export function tail(array, n = 0) { + return array[array.length - (1 + n)]; +} +export function tail2(arr) { + if (arr.length === 0) { + throw new Error('Invalid tail call'); + } + return [arr.slice(0, arr.length - 1), arr[arr.length - 1]]; +} +export function equals(one, other, itemEquals = (a, b) => a === b) { + if (one === other) { + return true; + } + if (!one || !other) { + return false; + } + if (one.length !== other.length) { + return false; + } + for (let i = 0, len = one.length; i < len; i++) { + if (!itemEquals(one[i], other[i])) { + return false; + } + } + return true; +} +/** + * Remove the element at `index` by replacing it with the last element. This is faster than `splice` + * but changes the order of the array + */ +export function removeFastWithoutKeepingOrder(array, index) { + const last = array.length - 1; + if (index < last) { + array[index] = array[last]; + } + array.pop(); +} +/** + * Performs a binary search algorithm over a sorted array. + * + * @param array The array being searched. + * @param key The value we search for. + * @param comparator A function that takes two array elements and returns zero + * if they are equal, a negative number if the first element precedes the + * second one in the sorting order, or a positive number if the second element + * precedes the first one. + * @return See {@link binarySearch2} + */ +export function binarySearch(array, key, comparator) { + return binarySearch2(array.length, i => comparator(array[i], key)); +} +/** + * Performs a binary search algorithm over a sorted collection. Useful for cases + * when we need to perform a binary search over something that isn't actually an + * array, and converting data to an array would defeat the use of binary search + * in the first place. + * + * @param length The collection length. + * @param compareToKey A function that takes an index of an element in the + * collection and returns zero if the value at this index is equal to the + * search key, a negative number if the value precedes the search key in the + * sorting order, or a positive number if the search key precedes the value. + * @return A non-negative index of an element, if found. If not found, the + * result is -(n+1) (or ~n, using bitwise notation), where n is the index + * where the key should be inserted to maintain the sorting order. + */ +export function binarySearch2(length, compareToKey) { + let low = 0, high = length - 1; + while (low <= high) { + const mid = ((low + high) / 2) | 0; + const comp = compareToKey(mid); + if (comp < 0) { + low = mid + 1; + } + else if (comp > 0) { + high = mid - 1; + } + else { + return mid; + } + } + return -(low + 1); +} +export function quickSelect(nth, data, compare) { + nth = nth | 0; + if (nth >= data.length) { + throw new TypeError('invalid index'); + } + const pivotValue = data[Math.floor(data.length * Math.random())]; + const lower = []; + const higher = []; + const pivots = []; + for (const value of data) { + const val = compare(value, pivotValue); + if (val < 0) { + lower.push(value); + } + else if (val > 0) { + higher.push(value); + } + else { + pivots.push(value); + } + } + if (nth < lower.length) { + return quickSelect(nth, lower, compare); + } + else if (nth < lower.length + pivots.length) { + return pivots[0]; + } + else { + return quickSelect(nth - (lower.length + pivots.length), higher, compare); + } +} +export function groupBy(data, compare) { + const result = []; + let currentGroup = undefined; + for (const element of data.slice(0).sort(compare)) { + if (!currentGroup || compare(currentGroup[0], element) !== 0) { + currentGroup = [element]; + result.push(currentGroup); + } + else { + currentGroup.push(element); + } + } + return result; +} +/** + * Splits the given items into a list of (non-empty) groups. + * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group. + * The order of the items is preserved. + */ +export function* groupAdjacentBy(items, shouldBeGrouped) { + let currentGroup; + let last; + for (const item of items) { + if (last !== undefined && shouldBeGrouped(last, item)) { + currentGroup.push(item); + } + else { + if (currentGroup) { + yield currentGroup; + } + currentGroup = [item]; + } + last = item; + } + if (currentGroup) { + yield currentGroup; + } +} +export function forEachAdjacent(arr, f) { + for (let i = 0; i <= arr.length; i++) { + f(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]); + } +} +export function forEachWithNeighbors(arr, f) { + for (let i = 0; i < arr.length; i++) { + f(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]); + } +} +/** + * @returns New array with all falsy values removed. The original array IS NOT modified. + */ +export function coalesce(array) { + return array.filter((e) => !!e); +} +/** + * Remove all falsy values from `array`. The original array IS modified. + */ +export function coalesceInPlace(array) { + let to = 0; + for (let i = 0; i < array.length; i++) { + if (!!array[i]) { + array[to] = array[i]; + to += 1; + } + } + array.length = to; +} +/** + * @returns false if the provided object is an array and not empty. + */ +export function isFalsyOrEmpty(obj) { + return !Array.isArray(obj) || obj.length === 0; +} +export function isNonEmptyArray(obj) { + return Array.isArray(obj) && obj.length > 0; +} +/** + * Removes duplicates from the given array. The optional keyFn allows to specify + * how elements are checked for equality by returning an alternate value for each. + */ +export function distinct(array, keyFn = value => value) { + const seen = new Set(); + return array.filter(element => { + const key = keyFn(element); + if (seen.has(key)) { + return false; + } + seen.add(key); + return true; + }); +} +export function firstOrDefault(array, notFoundValue) { + return array.length > 0 ? array[0] : notFoundValue; +} +export function range(arg, to) { + let from = typeof to === 'number' ? arg : 0; + if (typeof to === 'number') { + from = arg; + } + else { + from = 0; + to = arg; + } + const result = []; + if (from <= to) { + for (let i = from; i < to; i++) { + result.push(i); + } + } + else { + for (let i = from; i > to; i--) { + result.push(i); + } + } + return result; +} +/** + * Insert `insertArr` inside `target` at `insertIndex`. + * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array + */ +export function arrayInsert(target, insertIndex, insertArr) { + const before = target.slice(0, insertIndex); + const after = target.slice(insertIndex); + return before.concat(insertArr, after); +} +/** + * Pushes an element to the start of the array, if found. + */ +export function pushToStart(arr, value) { + const index = arr.indexOf(value); + if (index > -1) { + arr.splice(index, 1); + arr.unshift(value); + } +} +/** + * Pushes an element to the end of the array, if found. + */ +export function pushToEnd(arr, value) { + const index = arr.indexOf(value); + if (index > -1) { + arr.splice(index, 1); + arr.push(value); + } +} +export function pushMany(arr, items) { + for (const item of items) { + arr.push(item); + } +} +export function asArray(x) { + return Array.isArray(x) ? x : [x]; +} +/** + * Insert the new items in the array. + * @param array The original array. + * @param start The zero-based location in the array from which to start inserting elements. + * @param newItems The items to be inserted + */ +export function insertInto(array, start, newItems) { + const startIdx = getActualStartIndex(array, start); + const originalLength = array.length; + const newItemsLength = newItems.length; + array.length = originalLength + newItemsLength; + // Move the items after the start index, start from the end so that we don't overwrite any value. + for (let i = originalLength - 1; i >= startIdx; i--) { + array[i + newItemsLength] = array[i]; + } + for (let i = 0; i < newItemsLength; i++) { + array[i + startIdx] = newItems[i]; + } +} +/** + * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it + * can only support limited number of items due to the maximum call stack size limit. + * @param array The original array. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @returns An array containing the elements that were deleted. + */ +export function splice(array, start, deleteCount, newItems) { + const index = getActualStartIndex(array, start); + let result = array.splice(index, deleteCount); + if (result === undefined) { + // see https://bugs.webkit.org/show_bug.cgi?id=261140 + result = []; + } + insertInto(array, index, newItems); + return result; +} +/** + * Determine the actual start index (same logic as the native splice() or slice()) + * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided. + * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0. + * @param array The target array. + * @param start The operation index. + */ +function getActualStartIndex(array, start) { + return start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length); +} +export var CompareResult; +(function (CompareResult) { + function isLessThan(result) { + return result < 0; + } + CompareResult.isLessThan = isLessThan; + function isLessThanOrEqual(result) { + return result <= 0; + } + CompareResult.isLessThanOrEqual = isLessThanOrEqual; + function isGreaterThan(result) { + return result > 0; + } + CompareResult.isGreaterThan = isGreaterThan; + function isNeitherLessOrGreaterThan(result) { + return result === 0; + } + CompareResult.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan; + CompareResult.greaterThan = 1; + CompareResult.lessThan = -1; + CompareResult.neitherLessOrGreaterThan = 0; +})(CompareResult || (CompareResult = {})); +export function compareBy(selector, comparator) { + return (a, b) => comparator(selector(a), selector(b)); +} +export function tieBreakComparators(...comparators) { + return (item1, item2) => { + for (const comparator of comparators) { + const result = comparator(item1, item2); + if (!CompareResult.isNeitherLessOrGreaterThan(result)) { + return result; + } + } + return CompareResult.neitherLessOrGreaterThan; + }; +} +/** + * The natural order on numbers. +*/ +export const numberComparator = (a, b) => a - b; +export const booleanComparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0); +export function reverseOrder(comparator) { + return (a, b) => -comparator(a, b); +} +export class ArrayQueue { + /** + * Constructs a queue that is backed by the given array. Runtime is O(1). + */ + constructor(items) { + this.items = items; + this.firstIdx = 0; + this.lastIdx = this.items.length - 1; + } + get length() { + return this.lastIdx - this.firstIdx + 1; + } + /** + * Consumes elements from the beginning of the queue as long as the predicate returns true. + * If no elements were consumed, `null` is returned. Has a runtime of O(result.length). + */ + takeWhile(predicate) { + // P(k) := k <= this.lastIdx && predicate(this.items[k]) + // Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s) + let startIdx = this.firstIdx; + while (startIdx < this.items.length && predicate(this.items[startIdx])) { + startIdx++; + } + const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx); + this.firstIdx = startIdx; + return result; + } + /** + * Consumes elements from the end of the queue as long as the predicate returns true. + * If no elements were consumed, `null` is returned. + * The result has the same order as the underlying array! + */ + takeFromEndWhile(predicate) { + // P(k) := this.firstIdx >= k && predicate(this.items[k]) + // Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx] + let endIdx = this.lastIdx; + while (endIdx >= 0 && predicate(this.items[endIdx])) { + endIdx--; + } + const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1); + this.lastIdx = endIdx; + return result; + } + peek() { + if (this.length === 0) { + return undefined; + } + return this.items[this.firstIdx]; + } + dequeue() { + const result = this.items[this.firstIdx]; + this.firstIdx++; + return result; + } + takeCount(count) { + const result = this.items.slice(this.firstIdx, this.firstIdx + count); + this.firstIdx += count; + return result; + } +} +/** + * This class is faster than an iterator and array for lazy computed data. +*/ +export class CallbackIterable { + static { this.empty = new CallbackIterable(_callback => { }); } + constructor( + /** + * Calls the callback for every item. + * Stops when the callback returns false. + */ + iterate) { + this.iterate = iterate; + } + toArray() { + const result = []; + this.iterate(item => { result.push(item); return true; }); + return result; + } + filter(predicate) { + return new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true)); + } + map(mapFn) { + return new CallbackIterable(cb => this.iterate(item => cb(mapFn(item)))); + } + findLast(predicate) { + let result; + this.iterate(item => { + if (predicate(item)) { + result = item; + } + return true; + }); + return result; + } + findLastMaxBy(comparator) { + let result; + let first = true; + this.iterate(item => { + if (first || CompareResult.isGreaterThan(comparator(item, result))) { + first = false; + result = item; + } + return true; + }); + return result; + } +} +/** + * Represents a re-arrangement of items in an array. + */ +export class Permutation { + constructor(_indexMap) { + this._indexMap = _indexMap; + } + /** + * Returns a permutation that sorts the given array according to the given compare function. + */ + static createSortPermutation(arr, compareFn) { + const sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2])); + return new Permutation(sortIndices); + } + /** + * Returns a new array with the elements of the given array re-arranged according to this permutation. + */ + apply(arr) { + return arr.map((_, index) => arr[this._indexMap[index]]); + } + /** + * Returns a new permutation that undoes the re-arrangement of this permutation. + */ + inverse() { + const inverseIndexMap = this._indexMap.slice(); + for (let i = 0; i < this._indexMap.length; i++) { + inverseIndexMap[this._indexMap[i]] = i; + } + return new Permutation(inverseIndexMap); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/arraysFind.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/arraysFind.js new file mode 100644 index 0000000000000000000000000000000000000000..a657d2424b5d1bf037ea612d559e23a0271b777b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/arraysFind.js @@ -0,0 +1,175 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export function findLast(array, predicate) { + const idx = findLastIdx(array, predicate); + if (idx === -1) { + return undefined; + } + return array[idx]; +} +export function findLastIdx(array, predicate, fromIndex = array.length - 1) { + for (let i = fromIndex; i >= 0; i--) { + const element = array[i]; + if (predicate(element)) { + return i; + } + } + return -1; +} +/** + * Finds the last item where predicate is true using binary search. + * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`! + * + * @returns `undefined` if no item matches, otherwise the last item that matches the predicate. + */ +export function findLastMonotonous(array, predicate) { + const idx = findLastIdxMonotonous(array, predicate); + return idx === -1 ? undefined : array[idx]; +} +/** + * Finds the last item where predicate is true using binary search. + * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`! + * + * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate. + */ +export function findLastIdxMonotonous(array, predicate, startIdx = 0, endIdxEx = array.length) { + let i = startIdx; + let j = endIdxEx; + while (i < j) { + const k = Math.floor((i + j) / 2); + if (predicate(array[k])) { + i = k + 1; + } + else { + j = k; + } + } + return i - 1; +} +/** + * Finds the first item where predicate is true using binary search. + * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`! + * + * @returns `undefined` if no item matches, otherwise the first item that matches the predicate. + */ +export function findFirstMonotonous(array, predicate) { + const idx = findFirstIdxMonotonousOrArrLen(array, predicate); + return idx === array.length ? undefined : array[idx]; +} +/** + * Finds the first item where predicate is true using binary search. + * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`! + * + * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate. + */ +export function findFirstIdxMonotonousOrArrLen(array, predicate, startIdx = 0, endIdxEx = array.length) { + let i = startIdx; + let j = endIdxEx; + while (i < j) { + const k = Math.floor((i + j) / 2); + if (predicate(array[k])) { + j = k; + } + else { + i = k + 1; + } + } + return i; +} +/** + * Use this when + * * You have a sorted array + * * You query this array with a monotonous predicate to find the last item that has a certain property. + * * You query this array multiple times with monotonous predicates that get weaker and weaker. + */ +export class MonotonousArray { + static { this.assertInvariants = false; } + constructor(_array) { + this._array = _array; + this._findLastMonotonousLastIdx = 0; + } + /** + * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`! + * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`. + */ + findLastMonotonous(predicate) { + if (MonotonousArray.assertInvariants) { + if (this._prevFindLastPredicate) { + for (const item of this._array) { + if (this._prevFindLastPredicate(item) && !predicate(item)) { + throw new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.'); + } + } + } + this._prevFindLastPredicate = predicate; + } + const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx); + this._findLastMonotonousLastIdx = idx + 1; + return idx === -1 ? undefined : this._array[idx]; + } +} +/** + * Returns the first item that is equal to or greater than every other item. +*/ +export function findFirstMax(array, comparator) { + if (array.length === 0) { + return undefined; + } + let max = array[0]; + for (let i = 1; i < array.length; i++) { + const item = array[i]; + if (comparator(item, max) > 0) { + max = item; + } + } + return max; +} +/** + * Returns the last item that is equal to or greater than every other item. +*/ +export function findLastMax(array, comparator) { + if (array.length === 0) { + return undefined; + } + let max = array[0]; + for (let i = 1; i < array.length; i++) { + const item = array[i]; + if (comparator(item, max) >= 0) { + max = item; + } + } + return max; +} +/** + * Returns the first item that is equal to or less than every other item. +*/ +export function findFirstMin(array, comparator) { + return findFirstMax(array, (a, b) => -comparator(a, b)); +} +export function findMaxIdx(array, comparator) { + if (array.length === 0) { + return -1; + } + let maxIdx = 0; + for (let i = 1; i < array.length; i++) { + const item = array[i]; + if (comparator(item, array[maxIdx]) > 0) { + maxIdx = i; + } + } + return maxIdx; +} +/** + * Returns the first mapped value of the array which is not undefined. + */ +export function mapFindFirst(items, mapFn) { + for (const value of items) { + const mapped = mapFn(value); + if (mapped !== undefined) { + return mapped; + } + } + return undefined; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/assert.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/assert.js new file mode 100644 index 0000000000000000000000000000000000000000..271e3833e9568d126d171b4449a7926b50b0b2d3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/assert.js @@ -0,0 +1,59 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { BugIndicatingError, onUnexpectedError } from './errors.js'; +/** + * Throws an error with the provided message if the provided value does not evaluate to a true Javascript value. + * + * @deprecated Use `assert(...)` instead. + * This method is usually used like this: + * ```ts + * import * as assert from 'vs/base/common/assert'; + * assert.ok(...); + * ``` + * + * However, `assert` in that example is a user chosen name. + * There is no tooling for generating such an import statement. + * Thus, the `assert(...)` function should be used instead. + */ +export function ok(value, message) { + if (!value) { + throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed'); + } +} +export function assertNever(value, message = 'Unreachable') { + throw new Error(message); +} +/** + * Like assert, but doesn't throw. + */ +export function softAssert(condition) { + if (!condition) { + onUnexpectedError(new BugIndicatingError('Soft Assertion Failed')); + } +} +/** + * condition must be side-effect free! + */ +export function assertFn(condition) { + if (!condition()) { + // eslint-disable-next-line no-debugger + debugger; + // Reevaluate `condition` again to make debugging easier + condition(); + onUnexpectedError(new BugIndicatingError('Assertion Failed')); + } +} +export function checkAdjacentItems(items, predicate) { + let i = 0; + while (i < items.length - 1) { + const a = items[i]; + const b = items[i + 1]; + if (!predicate(a, b)) { + return false; + } + i++; + } + return true; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/async.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/async.js new file mode 100644 index 0000000000000000000000000000000000000000..5a5588e64135d87ac643aa75dd339f96ec3613a8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/async.js @@ -0,0 +1,843 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { CancellationTokenSource } from './cancellation.js'; +import { BugIndicatingError, CancellationError } from './errors.js'; +import { Emitter, Event } from './event.js'; +import { toDisposable } from './lifecycle.js'; +import { setTimeout0 } from './platform.js'; +import { MicrotaskDelay } from './symbols.js'; +export function isThenable(obj) { + return !!obj && typeof obj.then === 'function'; +} +export function createCancelablePromise(callback) { + const source = new CancellationTokenSource(); + const thenable = callback(source.token); + const promise = new Promise((resolve, reject) => { + const subscription = source.token.onCancellationRequested(() => { + subscription.dispose(); + reject(new CancellationError()); + }); + Promise.resolve(thenable).then(value => { + subscription.dispose(); + source.dispose(); + resolve(value); + }, err => { + subscription.dispose(); + source.dispose(); + reject(err); + }); + }); + return new class { + cancel() { + source.cancel(); + source.dispose(); + } + then(resolve, reject) { + return promise.then(resolve, reject); + } + catch(reject) { + return this.then(undefined, reject); + } + finally(onfinally) { + return promise.finally(onfinally); + } + }; +} +export function raceCancellation(promise, token, defaultValue) { + return new Promise((resolve, reject) => { + const ref = token.onCancellationRequested(() => { + ref.dispose(); + resolve(defaultValue); + }); + promise.then(resolve, reject).finally(() => ref.dispose()); + }); +} +/** + * A helper to prevent accumulation of sequential async tasks. + * + * Imagine a mail man with the sole task of delivering letters. As soon as + * a letter submitted for delivery, he drives to the destination, delivers it + * and returns to his base. Imagine that during the trip, N more letters were submitted. + * When the mail man returns, he picks those N letters and delivers them all in a + * single trip. Even though N+1 submissions occurred, only 2 deliveries were made. + * + * The throttler implements this via the queue() method, by providing it a task + * factory. Following the example: + * + * const throttler = new Throttler(); + * const letters = []; + * + * function deliver() { + * const lettersToDeliver = letters; + * letters = []; + * return makeTheTrip(lettersToDeliver); + * } + * + * function onLetterReceived(l) { + * letters.push(l); + * throttler.queue(deliver); + * } + */ +export class Throttler { + constructor() { + this.isDisposed = false; + this.activePromise = null; + this.queuedPromise = null; + this.queuedPromiseFactory = null; + } + queue(promiseFactory) { + if (this.isDisposed) { + return Promise.reject(new Error('Throttler is disposed')); + } + if (this.activePromise) { + this.queuedPromiseFactory = promiseFactory; + if (!this.queuedPromise) { + const onComplete = () => { + this.queuedPromise = null; + if (this.isDisposed) { + return; + } + const result = this.queue(this.queuedPromiseFactory); + this.queuedPromiseFactory = null; + return result; + }; + this.queuedPromise = new Promise(resolve => { + this.activePromise.then(onComplete, onComplete).then(resolve); + }); + } + return new Promise((resolve, reject) => { + this.queuedPromise.then(resolve, reject); + }); + } + this.activePromise = promiseFactory(); + return new Promise((resolve, reject) => { + this.activePromise.then((result) => { + this.activePromise = null; + resolve(result); + }, (err) => { + this.activePromise = null; + reject(err); + }); + }); + } + dispose() { + this.isDisposed = true; + } +} +const timeoutDeferred = (timeout, fn) => { + let scheduled = true; + const handle = setTimeout(() => { + scheduled = false; + fn(); + }, timeout); + return { + isTriggered: () => scheduled, + dispose: () => { + clearTimeout(handle); + scheduled = false; + }, + }; +}; +const microtaskDeferred = (fn) => { + let scheduled = true; + queueMicrotask(() => { + if (scheduled) { + scheduled = false; + fn(); + } + }); + return { + isTriggered: () => scheduled, + dispose: () => { scheduled = false; }, + }; +}; +/** + * A helper to delay (debounce) execution of a task that is being requested often. + * + * Following the throttler, now imagine the mail man wants to optimize the number of + * trips proactively. The trip itself can be long, so he decides not to make the trip + * as soon as a letter is submitted. Instead he waits a while, in case more + * letters are submitted. After said waiting period, if no letters were submitted, he + * decides to make the trip. Imagine that N more letters were submitted after the first + * one, all within a short period of time between each other. Even though N+1 + * submissions occurred, only 1 delivery was made. + * + * The delayer offers this behavior via the trigger() method, into which both the task + * to be executed and the waiting period (delay) must be passed in as arguments. Following + * the example: + * + * const delayer = new Delayer(WAITING_PERIOD); + * const letters = []; + * + * function letterReceived(l) { + * letters.push(l); + * delayer.trigger(() => { return makeTheTrip(); }); + * } + */ +export class Delayer { + constructor(defaultDelay) { + this.defaultDelay = defaultDelay; + this.deferred = null; + this.completionPromise = null; + this.doResolve = null; + this.doReject = null; + this.task = null; + } + trigger(task, delay = this.defaultDelay) { + this.task = task; + this.cancelTimeout(); + if (!this.completionPromise) { + this.completionPromise = new Promise((resolve, reject) => { + this.doResolve = resolve; + this.doReject = reject; + }).then(() => { + this.completionPromise = null; + this.doResolve = null; + if (this.task) { + const task = this.task; + this.task = null; + return task(); + } + return undefined; + }); + } + const fn = () => { + this.deferred = null; + this.doResolve?.(null); + }; + this.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn); + return this.completionPromise; + } + isTriggered() { + return !!this.deferred?.isTriggered(); + } + cancel() { + this.cancelTimeout(); + if (this.completionPromise) { + this.doReject?.(new CancellationError()); + this.completionPromise = null; + } + } + cancelTimeout() { + this.deferred?.dispose(); + this.deferred = null; + } + dispose() { + this.cancel(); + } +} +/** + * A helper to delay execution of a task that is being requested often, while + * preventing accumulation of consecutive executions, while the task runs. + * + * The mail man is clever and waits for a certain amount of time, before going + * out to deliver letters. While the mail man is going out, more letters arrive + * and can only be delivered once he is back. Once he is back the mail man will + * do one more trip to deliver the letters that have accumulated while he was out. + */ +export class ThrottledDelayer { + constructor(defaultDelay) { + this.delayer = new Delayer(defaultDelay); + this.throttler = new Throttler(); + } + trigger(promiseFactory, delay) { + return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay); + } + cancel() { + this.delayer.cancel(); + } + dispose() { + this.delayer.dispose(); + this.throttler.dispose(); + } +} +export function timeout(millis, token) { + if (!token) { + return createCancelablePromise(token => timeout(millis, token)); + } + return new Promise((resolve, reject) => { + const handle = setTimeout(() => { + disposable.dispose(); + resolve(); + }, millis); + const disposable = token.onCancellationRequested(() => { + clearTimeout(handle); + disposable.dispose(); + reject(new CancellationError()); + }); + }); +} +/** + * Creates a timeout that can be disposed using its returned value. + * @param handler The timeout handler. + * @param timeout An optional timeout in milliseconds. + * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically. + * + * @example + * const store = new DisposableStore; + * // Call the timeout after 1000ms at which point it will be automatically + * // evicted from the store. + * const timeoutDisposable = disposableTimeout(() => {}, 1000, store); + * + * if (foo) { + * // Cancel the timeout and evict it from store. + * timeoutDisposable.dispose(); + * } + */ +export function disposableTimeout(handler, timeout = 0, store) { + const timer = setTimeout(() => { + handler(); + if (store) { + disposable.dispose(); + } + }, timeout); + const disposable = toDisposable(() => { + clearTimeout(timer); + store?.deleteAndLeak(disposable); + }); + store?.add(disposable); + return disposable; +} +export function first(promiseFactories, shouldStop = t => !!t, defaultValue = null) { + let index = 0; + const len = promiseFactories.length; + const loop = () => { + if (index >= len) { + return Promise.resolve(defaultValue); + } + const factory = promiseFactories[index++]; + const promise = Promise.resolve(factory()); + return promise.then(result => { + if (shouldStop(result)) { + return Promise.resolve(result); + } + return loop(); + }); + }; + return loop(); +} +export class TimeoutTimer { + constructor(runner, timeout) { + this._isDisposed = false; + this._token = -1; + if (typeof runner === 'function' && typeof timeout === 'number') { + this.setIfNotSet(runner, timeout); + } + } + dispose() { + this.cancel(); + this._isDisposed = true; + } + cancel() { + if (this._token !== -1) { + clearTimeout(this._token); + this._token = -1; + } + } + cancelAndSet(runner, timeout) { + if (this._isDisposed) { + throw new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`); + } + this.cancel(); + this._token = setTimeout(() => { + this._token = -1; + runner(); + }, timeout); + } + setIfNotSet(runner, timeout) { + if (this._isDisposed) { + throw new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`); + } + if (this._token !== -1) { + // timer is already set + return; + } + this._token = setTimeout(() => { + this._token = -1; + runner(); + }, timeout); + } +} +export class IntervalTimer { + constructor() { + this.disposable = undefined; + this.isDisposed = false; + } + cancel() { + this.disposable?.dispose(); + this.disposable = undefined; + } + cancelAndSet(runner, interval, context = globalThis) { + if (this.isDisposed) { + throw new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`); + } + this.cancel(); + const handle = context.setInterval(() => { + runner(); + }, interval); + this.disposable = toDisposable(() => { + context.clearInterval(handle); + this.disposable = undefined; + }); + } + dispose() { + this.cancel(); + this.isDisposed = true; + } +} +export class RunOnceScheduler { + constructor(runner, delay) { + this.timeoutToken = -1; + this.runner = runner; + this.timeout = delay; + this.timeoutHandler = this.onTimeout.bind(this); + } + /** + * Dispose RunOnceScheduler + */ + dispose() { + this.cancel(); + this.runner = null; + } + /** + * Cancel current scheduled runner (if any). + */ + cancel() { + if (this.isScheduled()) { + clearTimeout(this.timeoutToken); + this.timeoutToken = -1; + } + } + /** + * Cancel previous runner (if any) & schedule a new runner. + */ + schedule(delay = this.timeout) { + this.cancel(); + this.timeoutToken = setTimeout(this.timeoutHandler, delay); + } + get delay() { + return this.timeout; + } + set delay(value) { + this.timeout = value; + } + /** + * Returns true if scheduled. + */ + isScheduled() { + return this.timeoutToken !== -1; + } + onTimeout() { + this.timeoutToken = -1; + if (this.runner) { + this.doRun(); + } + } + doRun() { + this.runner?.(); + } +} +/** + * Execute the callback the next time the browser is idle, returning an + * {@link IDisposable} that will cancel the callback when disposed. This wraps + * [requestIdleCallback] so it will fallback to [setTimeout] if the environment + * doesn't support it. + * + * @param callback The callback to run when idle, this includes an + * [IdleDeadline] that provides the time alloted for the idle callback by the + * browser. Not respecting this deadline will result in a degraded user + * experience. + * @param timeout A timeout at which point to queue no longer wait for an idle + * callback but queue it on the regular event loop (like setTimeout). Typically + * this should not be used. + * + * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline + * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback + * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout + * + * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser + * context + */ +export let runWhenGlobalIdle; +export let _runWhenIdle; +(function () { + if (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') { + _runWhenIdle = (_targetWindow, runner) => { + setTimeout0(() => { + if (disposed) { + return; + } + const end = Date.now() + 15; // one frame at 64fps + const deadline = { + didTimeout: true, + timeRemaining() { + return Math.max(0, end - Date.now()); + } + }; + runner(Object.freeze(deadline)); + }); + let disposed = false; + return { + dispose() { + if (disposed) { + return; + } + disposed = true; + } + }; + }; + } + else { + _runWhenIdle = (targetWindow, runner, timeout) => { + const handle = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined); + let disposed = false; + return { + dispose() { + if (disposed) { + return; + } + disposed = true; + targetWindow.cancelIdleCallback(handle); + } + }; + }; + } + runWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner); +})(); +export class AbstractIdleValue { + constructor(targetWindow, executor) { + this._didRun = false; + this._executor = () => { + try { + this._value = executor(); + } + catch (err) { + this._error = err; + } + finally { + this._didRun = true; + } + }; + this._handle = _runWhenIdle(targetWindow, () => this._executor()); + } + dispose() { + this._handle.dispose(); + } + get value() { + if (!this._didRun) { + this._handle.dispose(); + this._executor(); + } + if (this._error) { + throw this._error; + } + return this._value; + } + get isInitialized() { + return this._didRun; + } +} +/** + * An `IdleValue` that always uses the current window (which might be throttled or inactive) + * + * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser + * context + */ +export class GlobalIdleValue extends AbstractIdleValue { + constructor(executor) { + super(globalThis, executor); + } +} +/** + * Creates a promise whose resolution or rejection can be controlled imperatively. + */ +export class DeferredPromise { + get isRejected() { + return this.outcome?.outcome === 1 /* DeferredOutcome.Rejected */; + } + get isSettled() { + return !!this.outcome; + } + constructor() { + this.p = new Promise((c, e) => { + this.completeCallback = c; + this.errorCallback = e; + }); + } + complete(value) { + return new Promise(resolve => { + this.completeCallback(value); + this.outcome = { outcome: 0 /* DeferredOutcome.Resolved */, value }; + resolve(); + }); + } + error(err) { + return new Promise(resolve => { + this.errorCallback(err); + this.outcome = { outcome: 1 /* DeferredOutcome.Rejected */, value: err }; + resolve(); + }); + } + cancel() { + return this.error(new CancellationError()); + } +} +//#endregion +//#region Promises +export var Promises; +(function (Promises) { + /** + * A drop-in replacement for `Promise.all` with the only difference + * that the method awaits every promise to either fulfill or reject. + * + * Similar to `Promise.all`, only the first error will be returned + * if any. + */ + async function settled(promises) { + let firstError = undefined; + const result = await Promise.all(promises.map(promise => promise.then(value => value, error => { + if (!firstError) { + firstError = error; + } + return undefined; // do not rethrow so that other promises can settle + }))); + if (typeof firstError !== 'undefined') { + throw firstError; + } + return result; // cast is needed and protected by the `throw` above + } + Promises.settled = settled; + /** + * A helper to create a new `Promise` with a body that is a promise + * itself. By default, an error that raises from the async body will + * end up as a unhandled rejection, so this utility properly awaits the + * body and rejects the promise as a normal promise does without async + * body. + * + * This method should only be used in rare cases where otherwise `async` + * cannot be used (e.g. when callbacks are involved that require this). + */ + function withAsyncBody(bodyFn) { + // eslint-disable-next-line no-async-promise-executor + return new Promise(async (resolve, reject) => { + try { + await bodyFn(resolve, reject); + } + catch (error) { + reject(error); + } + }); + } + Promises.withAsyncBody = withAsyncBody; +})(Promises || (Promises = {})); +/** + * A rich implementation for an `AsyncIterable`. + */ +export class AsyncIterableObject { + static fromArray(items) { + return new AsyncIterableObject((writer) => { + writer.emitMany(items); + }); + } + static fromPromise(promise) { + return new AsyncIterableObject(async (emitter) => { + emitter.emitMany(await promise); + }); + } + static fromPromises(promises) { + return new AsyncIterableObject(async (emitter) => { + await Promise.all(promises.map(async (p) => emitter.emitOne(await p))); + }); + } + static merge(iterables) { + return new AsyncIterableObject(async (emitter) => { + await Promise.all(iterables.map(async (iterable) => { + for await (const item of iterable) { + emitter.emitOne(item); + } + })); + }); + } + static { this.EMPTY = AsyncIterableObject.fromArray([]); } + constructor(executor, onReturn) { + this._state = 0 /* AsyncIterableSourceState.Initial */; + this._results = []; + this._error = null; + this._onReturn = onReturn; + this._onStateChanged = new Emitter(); + queueMicrotask(async () => { + const writer = { + emitOne: (item) => this.emitOne(item), + emitMany: (items) => this.emitMany(items), + reject: (error) => this.reject(error) + }; + try { + await Promise.resolve(executor(writer)); + this.resolve(); + } + catch (err) { + this.reject(err); + } + finally { + writer.emitOne = undefined; + writer.emitMany = undefined; + writer.reject = undefined; + } + }); + } + [Symbol.asyncIterator]() { + let i = 0; + return { + next: async () => { + do { + if (this._state === 2 /* AsyncIterableSourceState.DoneError */) { + throw this._error; + } + if (i < this._results.length) { + return { done: false, value: this._results[i++] }; + } + if (this._state === 1 /* AsyncIterableSourceState.DoneOK */) { + return { done: true, value: undefined }; + } + await Event.toPromise(this._onStateChanged.event); + } while (true); + }, + return: async () => { + this._onReturn?.(); + return { done: true, value: undefined }; + } + }; + } + static map(iterable, mapFn) { + return new AsyncIterableObject(async (emitter) => { + for await (const item of iterable) { + emitter.emitOne(mapFn(item)); + } + }); + } + map(mapFn) { + return AsyncIterableObject.map(this, mapFn); + } + static filter(iterable, filterFn) { + return new AsyncIterableObject(async (emitter) => { + for await (const item of iterable) { + if (filterFn(item)) { + emitter.emitOne(item); + } + } + }); + } + filter(filterFn) { + return AsyncIterableObject.filter(this, filterFn); + } + static coalesce(iterable) { + return AsyncIterableObject.filter(iterable, item => !!item); + } + coalesce() { + return AsyncIterableObject.coalesce(this); + } + static async toPromise(iterable) { + const result = []; + for await (const item of iterable) { + result.push(item); + } + return result; + } + toPromise() { + return AsyncIterableObject.toPromise(this); + } + /** + * The value will be appended at the end. + * + * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect. + */ + emitOne(value) { + if (this._state !== 0 /* AsyncIterableSourceState.Initial */) { + return; + } + // it is important to add new values at the end, + // as we may have iterators already running on the array + this._results.push(value); + this._onStateChanged.fire(); + } + /** + * The values will be appended at the end. + * + * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect. + */ + emitMany(values) { + if (this._state !== 0 /* AsyncIterableSourceState.Initial */) { + return; + } + // it is important to add new values at the end, + // as we may have iterators already running on the array + this._results = this._results.concat(values); + this._onStateChanged.fire(); + } + /** + * Calling `resolve()` will mark the result array as complete. + * + * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise. + * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect. + */ + resolve() { + if (this._state !== 0 /* AsyncIterableSourceState.Initial */) { + return; + } + this._state = 1 /* AsyncIterableSourceState.DoneOK */; + this._onStateChanged.fire(); + } + /** + * Writing an error will permanently invalidate this iterable. + * The current users will receive an error thrown, as will all future users. + * + * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect. + */ + reject(error) { + if (this._state !== 0 /* AsyncIterableSourceState.Initial */) { + return; + } + this._state = 2 /* AsyncIterableSourceState.DoneError */; + this._error = error; + this._onStateChanged.fire(); + } +} +export class CancelableAsyncIterableObject extends AsyncIterableObject { + constructor(_source, executor) { + super(executor); + this._source = _source; + } + cancel() { + this._source.cancel(); + } +} +export function createCancelableAsyncIterable(callback) { + const source = new CancellationTokenSource(); + const innerIterable = callback(source.token); + return new CancelableAsyncIterableObject(source, async (emitter) => { + const subscription = source.token.onCancellationRequested(() => { + subscription.dispose(); + source.dispose(); + emitter.reject(new CancellationError()); + }); + try { + for await (const item of innerIterable) { + if (source.token.isCancellationRequested) { + // canceled in the meantime + return; + } + emitter.emitOne(item); + } + subscription.dispose(); + source.dispose(); + } + catch (err) { + subscription.dispose(); + source.dispose(); + emitter.reject(err); + } + }); +} +//#endregion diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/buffer.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/buffer.js new file mode 100644 index 0000000000000000000000000000000000000000..453498188434e82eabb65371f0290bdf902730bb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/buffer.js @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Lazy } from './lazy.js'; +const hasBuffer = (typeof Buffer !== 'undefined'); +const indexOfTable = new Lazy(() => new Uint8Array(256)); +let textDecoder; +export class VSBuffer { + /** + * When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for + * the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool, + * which is not transferrable. + */ + static wrap(actual) { + if (hasBuffer && !(Buffer.isBuffer(actual))) { + // https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length + // Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array + actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength); + } + return new VSBuffer(actual); + } + constructor(buffer) { + this.buffer = buffer; + this.byteLength = this.buffer.byteLength; + } + toString() { + if (hasBuffer) { + return this.buffer.toString(); + } + else { + if (!textDecoder) { + textDecoder = new TextDecoder(); + } + return textDecoder.decode(this.buffer); + } + } +} +export function readUInt16LE(source, offset) { + return (((source[offset + 0] << 0) >>> 0) | + ((source[offset + 1] << 8) >>> 0)); +} +export function writeUInt16LE(destination, value, offset) { + destination[offset + 0] = (value & 0b11111111); + value = value >>> 8; + destination[offset + 1] = (value & 0b11111111); +} +export function readUInt32BE(source, offset) { + return (source[offset] * 2 ** 24 + + source[offset + 1] * 2 ** 16 + + source[offset + 2] * 2 ** 8 + + source[offset + 3]); +} +export function writeUInt32BE(destination, value, offset) { + destination[offset + 3] = value; + value = value >>> 8; + destination[offset + 2] = value; + value = value >>> 8; + destination[offset + 1] = value; + value = value >>> 8; + destination[offset] = value; +} +export function readUInt8(source, offset) { + return source[offset]; +} +export function writeUInt8(destination, value, offset) { + destination[offset] = value; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/cache.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/cache.js new file mode 100644 index 0000000000000000000000000000000000000000..3dc53cf6aab8cf5373e297348f64df73ff28e63e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/cache.js @@ -0,0 +1,59 @@ +export function identity(t) { + return t; +} +/** + * Uses a LRU cache to make a given parametrized function cached. + * Caches just the last key/value. +*/ +export class LRUCachedFunction { + constructor(arg1, arg2) { + this.lastCache = undefined; + this.lastArgKey = undefined; + if (typeof arg1 === 'function') { + this._fn = arg1; + this._computeKey = identity; + } + else { + this._fn = arg2; + this._computeKey = arg1.getCacheKey; + } + } + get(arg) { + const key = this._computeKey(arg); + if (this.lastArgKey !== key) { + this.lastArgKey = key; + this.lastCache = this._fn(arg); + } + return this.lastCache; + } +} +/** + * Uses an unbounded cache to memoize the results of the given function. +*/ +export class CachedFunction { + get cachedValues() { + return this._map; + } + constructor(arg1, arg2) { + this._map = new Map(); + this._map2 = new Map(); + if (typeof arg1 === 'function') { + this._fn = arg1; + this._computeKey = identity; + } + else { + this._fn = arg2; + this._computeKey = arg1.getCacheKey; + } + } + get(arg) { + const key = this._computeKey(arg); + if (this._map2.has(key)) { + return this._map2.get(key); + } + const value = this._fn(arg); + this._map.set(arg, value); + this._map2.set(key, value); + return value; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/cancellation.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/cancellation.js new file mode 100644 index 0000000000000000000000000000000000000000..63e2190336b5e3b9045cd7db1f1ab3e60c1c4206 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/cancellation.js @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Emitter, Event } from './event.js'; +const shortcutEvent = Object.freeze(function (callback, context) { + const handle = setTimeout(callback.bind(context), 0); + return { dispose() { clearTimeout(handle); } }; +}); +export var CancellationToken; +(function (CancellationToken) { + function isCancellationToken(thing) { + if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) { + return true; + } + if (thing instanceof MutableToken) { + return true; + } + if (!thing || typeof thing !== 'object') { + return false; + } + return typeof thing.isCancellationRequested === 'boolean' + && typeof thing.onCancellationRequested === 'function'; + } + CancellationToken.isCancellationToken = isCancellationToken; + CancellationToken.None = Object.freeze({ + isCancellationRequested: false, + onCancellationRequested: Event.None + }); + CancellationToken.Cancelled = Object.freeze({ + isCancellationRequested: true, + onCancellationRequested: shortcutEvent + }); +})(CancellationToken || (CancellationToken = {})); +class MutableToken { + constructor() { + this._isCancelled = false; + this._emitter = null; + } + cancel() { + if (!this._isCancelled) { + this._isCancelled = true; + if (this._emitter) { + this._emitter.fire(undefined); + this.dispose(); + } + } + } + get isCancellationRequested() { + return this._isCancelled; + } + get onCancellationRequested() { + if (this._isCancelled) { + return shortcutEvent; + } + if (!this._emitter) { + this._emitter = new Emitter(); + } + return this._emitter.event; + } + dispose() { + if (this._emitter) { + this._emitter.dispose(); + this._emitter = null; + } + } +} +export class CancellationTokenSource { + constructor(parent) { + this._token = undefined; + this._parentListener = undefined; + this._parentListener = parent && parent.onCancellationRequested(this.cancel, this); + } + get token() { + if (!this._token) { + // be lazy and create the token only when + // actually needed + this._token = new MutableToken(); + } + return this._token; + } + cancel() { + if (!this._token) { + // save an object by returning the default + // cancelled token when cancellation happens + // before someone asks for the token + this._token = CancellationToken.Cancelled; + } + else if (this._token instanceof MutableToken) { + // actually cancel + this._token.cancel(); + } + } + dispose(cancel = false) { + if (cancel) { + this.cancel(); + } + this._parentListener?.dispose(); + if (!this._token) { + // ensure to initialize with an empty token if we had none + this._token = CancellationToken.None; + } + else if (this._token instanceof MutableToken) { + // actually dispose + this._token.dispose(); + } + } +} +export function cancelOnDispose(store) { + const source = new CancellationTokenSource(); + store.add({ dispose() { source.cancel(); } }); + return source.token; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/charCode.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/charCode.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/charCode.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codicons.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codicons.js new file mode 100644 index 0000000000000000000000000000000000000000..127ab9431df0d69f7c591813de3bded576a2f966 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codicons.js @@ -0,0 +1,47 @@ +import { register } from './codiconsUtil.js'; +import { codiconsLibrary } from './codiconsLibrary.js'; +/** + * Derived icons, that could become separate icons. + * These mappings should be moved into the mapping file in the vscode-codicons repo at some point. + */ +export const codiconsDerived = { + dialogError: register('dialog-error', 'error'), + dialogWarning: register('dialog-warning', 'warning'), + dialogInfo: register('dialog-info', 'info'), + dialogClose: register('dialog-close', 'close'), + treeItemExpanded: register('tree-item-expanded', 'chevron-down'), // collapsed is done with rotation + treeFilterOnTypeOn: register('tree-filter-on-type-on', 'list-filter'), + treeFilterOnTypeOff: register('tree-filter-on-type-off', 'list-selection'), + treeFilterClear: register('tree-filter-clear', 'close'), + treeItemLoading: register('tree-item-loading', 'loading'), + menuSelection: register('menu-selection', 'check'), + menuSubmenu: register('menu-submenu', 'chevron-right'), + menuBarMore: register('menubar-more', 'more'), + scrollbarButtonLeft: register('scrollbar-button-left', 'triangle-left'), + scrollbarButtonRight: register('scrollbar-button-right', 'triangle-right'), + scrollbarButtonUp: register('scrollbar-button-up', 'triangle-up'), + scrollbarButtonDown: register('scrollbar-button-down', 'triangle-down'), + toolBarMore: register('toolbar-more', 'more'), + quickInputBack: register('quick-input-back', 'arrow-left'), + dropDownButton: register('drop-down-button', 0xeab4), + symbolCustomColor: register('symbol-customcolor', 0xeb5c), + exportIcon: register('export', 0xebac), + workspaceUnspecified: register('workspace-unspecified', 0xebc3), + newLine: register('newline', 0xebea), + thumbsDownFilled: register('thumbsdown-filled', 0xec13), + thumbsUpFilled: register('thumbsup-filled', 0xec14), + gitFetch: register('git-fetch', 0xec1d), + lightbulbSparkleAutofix: register('lightbulb-sparkle-autofix', 0xec1f), + debugBreakpointPending: register('debug-breakpoint-pending', 0xebd9), +}; +/** + * The Codicon library is a set of default icons that are built-in in VS Code. + * + * In the product (outside of base) Codicons should only be used as defaults. In order to have all icons in VS Code + * themeable, component should define new, UI component specific icons using `iconRegistry.registerIcon`. + * In that call a Codicon can be named as default. + */ +export const Codicon = { + ...codiconsLibrary, + ...codiconsDerived +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codiconsLibrary.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codiconsLibrary.js new file mode 100644 index 0000000000000000000000000000000000000000..263b4fd6b121f4c21ce83404024a799be81674bc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codiconsLibrary.js @@ -0,0 +1,580 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { register } from './codiconsUtil.js'; +// This file is automatically generated by (microsoft/vscode-codicons)/scripts/export-to-ts.js +// Please don't edit it, as your changes will be overwritten. +// Instead, add mappings to codiconsDerived in codicons.ts. +export const codiconsLibrary = { + add: register('add', 0xea60), + plus: register('plus', 0xea60), + gistNew: register('gist-new', 0xea60), + repoCreate: register('repo-create', 0xea60), + lightbulb: register('lightbulb', 0xea61), + lightBulb: register('light-bulb', 0xea61), + repo: register('repo', 0xea62), + repoDelete: register('repo-delete', 0xea62), + gistFork: register('gist-fork', 0xea63), + repoForked: register('repo-forked', 0xea63), + gitPullRequest: register('git-pull-request', 0xea64), + gitPullRequestAbandoned: register('git-pull-request-abandoned', 0xea64), + recordKeys: register('record-keys', 0xea65), + keyboard: register('keyboard', 0xea65), + tag: register('tag', 0xea66), + gitPullRequestLabel: register('git-pull-request-label', 0xea66), + tagAdd: register('tag-add', 0xea66), + tagRemove: register('tag-remove', 0xea66), + person: register('person', 0xea67), + personFollow: register('person-follow', 0xea67), + personOutline: register('person-outline', 0xea67), + personFilled: register('person-filled', 0xea67), + gitBranch: register('git-branch', 0xea68), + gitBranchCreate: register('git-branch-create', 0xea68), + gitBranchDelete: register('git-branch-delete', 0xea68), + sourceControl: register('source-control', 0xea68), + mirror: register('mirror', 0xea69), + mirrorPublic: register('mirror-public', 0xea69), + star: register('star', 0xea6a), + starAdd: register('star-add', 0xea6a), + starDelete: register('star-delete', 0xea6a), + starEmpty: register('star-empty', 0xea6a), + comment: register('comment', 0xea6b), + commentAdd: register('comment-add', 0xea6b), + alert: register('alert', 0xea6c), + warning: register('warning', 0xea6c), + search: register('search', 0xea6d), + searchSave: register('search-save', 0xea6d), + logOut: register('log-out', 0xea6e), + signOut: register('sign-out', 0xea6e), + logIn: register('log-in', 0xea6f), + signIn: register('sign-in', 0xea6f), + eye: register('eye', 0xea70), + eyeUnwatch: register('eye-unwatch', 0xea70), + eyeWatch: register('eye-watch', 0xea70), + circleFilled: register('circle-filled', 0xea71), + primitiveDot: register('primitive-dot', 0xea71), + closeDirty: register('close-dirty', 0xea71), + debugBreakpoint: register('debug-breakpoint', 0xea71), + debugBreakpointDisabled: register('debug-breakpoint-disabled', 0xea71), + debugHint: register('debug-hint', 0xea71), + terminalDecorationSuccess: register('terminal-decoration-success', 0xea71), + primitiveSquare: register('primitive-square', 0xea72), + edit: register('edit', 0xea73), + pencil: register('pencil', 0xea73), + info: register('info', 0xea74), + issueOpened: register('issue-opened', 0xea74), + gistPrivate: register('gist-private', 0xea75), + gitForkPrivate: register('git-fork-private', 0xea75), + lock: register('lock', 0xea75), + mirrorPrivate: register('mirror-private', 0xea75), + close: register('close', 0xea76), + removeClose: register('remove-close', 0xea76), + x: register('x', 0xea76), + repoSync: register('repo-sync', 0xea77), + sync: register('sync', 0xea77), + clone: register('clone', 0xea78), + desktopDownload: register('desktop-download', 0xea78), + beaker: register('beaker', 0xea79), + microscope: register('microscope', 0xea79), + vm: register('vm', 0xea7a), + deviceDesktop: register('device-desktop', 0xea7a), + file: register('file', 0xea7b), + fileText: register('file-text', 0xea7b), + more: register('more', 0xea7c), + ellipsis: register('ellipsis', 0xea7c), + kebabHorizontal: register('kebab-horizontal', 0xea7c), + mailReply: register('mail-reply', 0xea7d), + reply: register('reply', 0xea7d), + organization: register('organization', 0xea7e), + organizationFilled: register('organization-filled', 0xea7e), + organizationOutline: register('organization-outline', 0xea7e), + newFile: register('new-file', 0xea7f), + fileAdd: register('file-add', 0xea7f), + newFolder: register('new-folder', 0xea80), + fileDirectoryCreate: register('file-directory-create', 0xea80), + trash: register('trash', 0xea81), + trashcan: register('trashcan', 0xea81), + history: register('history', 0xea82), + clock: register('clock', 0xea82), + folder: register('folder', 0xea83), + fileDirectory: register('file-directory', 0xea83), + symbolFolder: register('symbol-folder', 0xea83), + logoGithub: register('logo-github', 0xea84), + markGithub: register('mark-github', 0xea84), + github: register('github', 0xea84), + terminal: register('terminal', 0xea85), + console: register('console', 0xea85), + repl: register('repl', 0xea85), + zap: register('zap', 0xea86), + symbolEvent: register('symbol-event', 0xea86), + error: register('error', 0xea87), + stop: register('stop', 0xea87), + variable: register('variable', 0xea88), + symbolVariable: register('symbol-variable', 0xea88), + array: register('array', 0xea8a), + symbolArray: register('symbol-array', 0xea8a), + symbolModule: register('symbol-module', 0xea8b), + symbolPackage: register('symbol-package', 0xea8b), + symbolNamespace: register('symbol-namespace', 0xea8b), + symbolObject: register('symbol-object', 0xea8b), + symbolMethod: register('symbol-method', 0xea8c), + symbolFunction: register('symbol-function', 0xea8c), + symbolConstructor: register('symbol-constructor', 0xea8c), + symbolBoolean: register('symbol-boolean', 0xea8f), + symbolNull: register('symbol-null', 0xea8f), + symbolNumeric: register('symbol-numeric', 0xea90), + symbolNumber: register('symbol-number', 0xea90), + symbolStructure: register('symbol-structure', 0xea91), + symbolStruct: register('symbol-struct', 0xea91), + symbolParameter: register('symbol-parameter', 0xea92), + symbolTypeParameter: register('symbol-type-parameter', 0xea92), + symbolKey: register('symbol-key', 0xea93), + symbolText: register('symbol-text', 0xea93), + symbolReference: register('symbol-reference', 0xea94), + goToFile: register('go-to-file', 0xea94), + symbolEnum: register('symbol-enum', 0xea95), + symbolValue: register('symbol-value', 0xea95), + symbolRuler: register('symbol-ruler', 0xea96), + symbolUnit: register('symbol-unit', 0xea96), + activateBreakpoints: register('activate-breakpoints', 0xea97), + archive: register('archive', 0xea98), + arrowBoth: register('arrow-both', 0xea99), + arrowDown: register('arrow-down', 0xea9a), + arrowLeft: register('arrow-left', 0xea9b), + arrowRight: register('arrow-right', 0xea9c), + arrowSmallDown: register('arrow-small-down', 0xea9d), + arrowSmallLeft: register('arrow-small-left', 0xea9e), + arrowSmallRight: register('arrow-small-right', 0xea9f), + arrowSmallUp: register('arrow-small-up', 0xeaa0), + arrowUp: register('arrow-up', 0xeaa1), + bell: register('bell', 0xeaa2), + bold: register('bold', 0xeaa3), + book: register('book', 0xeaa4), + bookmark: register('bookmark', 0xeaa5), + debugBreakpointConditionalUnverified: register('debug-breakpoint-conditional-unverified', 0xeaa6), + debugBreakpointConditional: register('debug-breakpoint-conditional', 0xeaa7), + debugBreakpointConditionalDisabled: register('debug-breakpoint-conditional-disabled', 0xeaa7), + debugBreakpointDataUnverified: register('debug-breakpoint-data-unverified', 0xeaa8), + debugBreakpointData: register('debug-breakpoint-data', 0xeaa9), + debugBreakpointDataDisabled: register('debug-breakpoint-data-disabled', 0xeaa9), + debugBreakpointLogUnverified: register('debug-breakpoint-log-unverified', 0xeaaa), + debugBreakpointLog: register('debug-breakpoint-log', 0xeaab), + debugBreakpointLogDisabled: register('debug-breakpoint-log-disabled', 0xeaab), + briefcase: register('briefcase', 0xeaac), + broadcast: register('broadcast', 0xeaad), + browser: register('browser', 0xeaae), + bug: register('bug', 0xeaaf), + calendar: register('calendar', 0xeab0), + caseSensitive: register('case-sensitive', 0xeab1), + check: register('check', 0xeab2), + checklist: register('checklist', 0xeab3), + chevronDown: register('chevron-down', 0xeab4), + chevronLeft: register('chevron-left', 0xeab5), + chevronRight: register('chevron-right', 0xeab6), + chevronUp: register('chevron-up', 0xeab7), + chromeClose: register('chrome-close', 0xeab8), + chromeMaximize: register('chrome-maximize', 0xeab9), + chromeMinimize: register('chrome-minimize', 0xeaba), + chromeRestore: register('chrome-restore', 0xeabb), + circleOutline: register('circle-outline', 0xeabc), + circle: register('circle', 0xeabc), + debugBreakpointUnverified: register('debug-breakpoint-unverified', 0xeabc), + terminalDecorationIncomplete: register('terminal-decoration-incomplete', 0xeabc), + circleSlash: register('circle-slash', 0xeabd), + circuitBoard: register('circuit-board', 0xeabe), + clearAll: register('clear-all', 0xeabf), + clippy: register('clippy', 0xeac0), + closeAll: register('close-all', 0xeac1), + cloudDownload: register('cloud-download', 0xeac2), + cloudUpload: register('cloud-upload', 0xeac3), + code: register('code', 0xeac4), + collapseAll: register('collapse-all', 0xeac5), + colorMode: register('color-mode', 0xeac6), + commentDiscussion: register('comment-discussion', 0xeac7), + creditCard: register('credit-card', 0xeac9), + dash: register('dash', 0xeacc), + dashboard: register('dashboard', 0xeacd), + database: register('database', 0xeace), + debugContinue: register('debug-continue', 0xeacf), + debugDisconnect: register('debug-disconnect', 0xead0), + debugPause: register('debug-pause', 0xead1), + debugRestart: register('debug-restart', 0xead2), + debugStart: register('debug-start', 0xead3), + debugStepInto: register('debug-step-into', 0xead4), + debugStepOut: register('debug-step-out', 0xead5), + debugStepOver: register('debug-step-over', 0xead6), + debugStop: register('debug-stop', 0xead7), + debug: register('debug', 0xead8), + deviceCameraVideo: register('device-camera-video', 0xead9), + deviceCamera: register('device-camera', 0xeada), + deviceMobile: register('device-mobile', 0xeadb), + diffAdded: register('diff-added', 0xeadc), + diffIgnored: register('diff-ignored', 0xeadd), + diffModified: register('diff-modified', 0xeade), + diffRemoved: register('diff-removed', 0xeadf), + diffRenamed: register('diff-renamed', 0xeae0), + diff: register('diff', 0xeae1), + diffSidebyside: register('diff-sidebyside', 0xeae1), + discard: register('discard', 0xeae2), + editorLayout: register('editor-layout', 0xeae3), + emptyWindow: register('empty-window', 0xeae4), + exclude: register('exclude', 0xeae5), + extensions: register('extensions', 0xeae6), + eyeClosed: register('eye-closed', 0xeae7), + fileBinary: register('file-binary', 0xeae8), + fileCode: register('file-code', 0xeae9), + fileMedia: register('file-media', 0xeaea), + filePdf: register('file-pdf', 0xeaeb), + fileSubmodule: register('file-submodule', 0xeaec), + fileSymlinkDirectory: register('file-symlink-directory', 0xeaed), + fileSymlinkFile: register('file-symlink-file', 0xeaee), + fileZip: register('file-zip', 0xeaef), + files: register('files', 0xeaf0), + filter: register('filter', 0xeaf1), + flame: register('flame', 0xeaf2), + foldDown: register('fold-down', 0xeaf3), + foldUp: register('fold-up', 0xeaf4), + fold: register('fold', 0xeaf5), + folderActive: register('folder-active', 0xeaf6), + folderOpened: register('folder-opened', 0xeaf7), + gear: register('gear', 0xeaf8), + gift: register('gift', 0xeaf9), + gistSecret: register('gist-secret', 0xeafa), + gist: register('gist', 0xeafb), + gitCommit: register('git-commit', 0xeafc), + gitCompare: register('git-compare', 0xeafd), + compareChanges: register('compare-changes', 0xeafd), + gitMerge: register('git-merge', 0xeafe), + githubAction: register('github-action', 0xeaff), + githubAlt: register('github-alt', 0xeb00), + globe: register('globe', 0xeb01), + grabber: register('grabber', 0xeb02), + graph: register('graph', 0xeb03), + gripper: register('gripper', 0xeb04), + heart: register('heart', 0xeb05), + home: register('home', 0xeb06), + horizontalRule: register('horizontal-rule', 0xeb07), + hubot: register('hubot', 0xeb08), + inbox: register('inbox', 0xeb09), + issueReopened: register('issue-reopened', 0xeb0b), + issues: register('issues', 0xeb0c), + italic: register('italic', 0xeb0d), + jersey: register('jersey', 0xeb0e), + json: register('json', 0xeb0f), + kebabVertical: register('kebab-vertical', 0xeb10), + key: register('key', 0xeb11), + law: register('law', 0xeb12), + lightbulbAutofix: register('lightbulb-autofix', 0xeb13), + linkExternal: register('link-external', 0xeb14), + link: register('link', 0xeb15), + listOrdered: register('list-ordered', 0xeb16), + listUnordered: register('list-unordered', 0xeb17), + liveShare: register('live-share', 0xeb18), + loading: register('loading', 0xeb19), + location: register('location', 0xeb1a), + mailRead: register('mail-read', 0xeb1b), + mail: register('mail', 0xeb1c), + markdown: register('markdown', 0xeb1d), + megaphone: register('megaphone', 0xeb1e), + mention: register('mention', 0xeb1f), + milestone: register('milestone', 0xeb20), + gitPullRequestMilestone: register('git-pull-request-milestone', 0xeb20), + mortarBoard: register('mortar-board', 0xeb21), + move: register('move', 0xeb22), + multipleWindows: register('multiple-windows', 0xeb23), + mute: register('mute', 0xeb24), + noNewline: register('no-newline', 0xeb25), + note: register('note', 0xeb26), + octoface: register('octoface', 0xeb27), + openPreview: register('open-preview', 0xeb28), + package: register('package', 0xeb29), + paintcan: register('paintcan', 0xeb2a), + pin: register('pin', 0xeb2b), + play: register('play', 0xeb2c), + run: register('run', 0xeb2c), + plug: register('plug', 0xeb2d), + preserveCase: register('preserve-case', 0xeb2e), + preview: register('preview', 0xeb2f), + project: register('project', 0xeb30), + pulse: register('pulse', 0xeb31), + question: register('question', 0xeb32), + quote: register('quote', 0xeb33), + radioTower: register('radio-tower', 0xeb34), + reactions: register('reactions', 0xeb35), + references: register('references', 0xeb36), + refresh: register('refresh', 0xeb37), + regex: register('regex', 0xeb38), + remoteExplorer: register('remote-explorer', 0xeb39), + remote: register('remote', 0xeb3a), + remove: register('remove', 0xeb3b), + replaceAll: register('replace-all', 0xeb3c), + replace: register('replace', 0xeb3d), + repoClone: register('repo-clone', 0xeb3e), + repoForcePush: register('repo-force-push', 0xeb3f), + repoPull: register('repo-pull', 0xeb40), + repoPush: register('repo-push', 0xeb41), + report: register('report', 0xeb42), + requestChanges: register('request-changes', 0xeb43), + rocket: register('rocket', 0xeb44), + rootFolderOpened: register('root-folder-opened', 0xeb45), + rootFolder: register('root-folder', 0xeb46), + rss: register('rss', 0xeb47), + ruby: register('ruby', 0xeb48), + saveAll: register('save-all', 0xeb49), + saveAs: register('save-as', 0xeb4a), + save: register('save', 0xeb4b), + screenFull: register('screen-full', 0xeb4c), + screenNormal: register('screen-normal', 0xeb4d), + searchStop: register('search-stop', 0xeb4e), + server: register('server', 0xeb50), + settingsGear: register('settings-gear', 0xeb51), + settings: register('settings', 0xeb52), + shield: register('shield', 0xeb53), + smiley: register('smiley', 0xeb54), + sortPrecedence: register('sort-precedence', 0xeb55), + splitHorizontal: register('split-horizontal', 0xeb56), + splitVertical: register('split-vertical', 0xeb57), + squirrel: register('squirrel', 0xeb58), + starFull: register('star-full', 0xeb59), + starHalf: register('star-half', 0xeb5a), + symbolClass: register('symbol-class', 0xeb5b), + symbolColor: register('symbol-color', 0xeb5c), + symbolConstant: register('symbol-constant', 0xeb5d), + symbolEnumMember: register('symbol-enum-member', 0xeb5e), + symbolField: register('symbol-field', 0xeb5f), + symbolFile: register('symbol-file', 0xeb60), + symbolInterface: register('symbol-interface', 0xeb61), + symbolKeyword: register('symbol-keyword', 0xeb62), + symbolMisc: register('symbol-misc', 0xeb63), + symbolOperator: register('symbol-operator', 0xeb64), + symbolProperty: register('symbol-property', 0xeb65), + wrench: register('wrench', 0xeb65), + wrenchSubaction: register('wrench-subaction', 0xeb65), + symbolSnippet: register('symbol-snippet', 0xeb66), + tasklist: register('tasklist', 0xeb67), + telescope: register('telescope', 0xeb68), + textSize: register('text-size', 0xeb69), + threeBars: register('three-bars', 0xeb6a), + thumbsdown: register('thumbsdown', 0xeb6b), + thumbsup: register('thumbsup', 0xeb6c), + tools: register('tools', 0xeb6d), + triangleDown: register('triangle-down', 0xeb6e), + triangleLeft: register('triangle-left', 0xeb6f), + triangleRight: register('triangle-right', 0xeb70), + triangleUp: register('triangle-up', 0xeb71), + twitter: register('twitter', 0xeb72), + unfold: register('unfold', 0xeb73), + unlock: register('unlock', 0xeb74), + unmute: register('unmute', 0xeb75), + unverified: register('unverified', 0xeb76), + verified: register('verified', 0xeb77), + versions: register('versions', 0xeb78), + vmActive: register('vm-active', 0xeb79), + vmOutline: register('vm-outline', 0xeb7a), + vmRunning: register('vm-running', 0xeb7b), + watch: register('watch', 0xeb7c), + whitespace: register('whitespace', 0xeb7d), + wholeWord: register('whole-word', 0xeb7e), + window: register('window', 0xeb7f), + wordWrap: register('word-wrap', 0xeb80), + zoomIn: register('zoom-in', 0xeb81), + zoomOut: register('zoom-out', 0xeb82), + listFilter: register('list-filter', 0xeb83), + listFlat: register('list-flat', 0xeb84), + listSelection: register('list-selection', 0xeb85), + selection: register('selection', 0xeb85), + listTree: register('list-tree', 0xeb86), + debugBreakpointFunctionUnverified: register('debug-breakpoint-function-unverified', 0xeb87), + debugBreakpointFunction: register('debug-breakpoint-function', 0xeb88), + debugBreakpointFunctionDisabled: register('debug-breakpoint-function-disabled', 0xeb88), + debugStackframeActive: register('debug-stackframe-active', 0xeb89), + circleSmallFilled: register('circle-small-filled', 0xeb8a), + debugStackframeDot: register('debug-stackframe-dot', 0xeb8a), + terminalDecorationMark: register('terminal-decoration-mark', 0xeb8a), + debugStackframe: register('debug-stackframe', 0xeb8b), + debugStackframeFocused: register('debug-stackframe-focused', 0xeb8b), + debugBreakpointUnsupported: register('debug-breakpoint-unsupported', 0xeb8c), + symbolString: register('symbol-string', 0xeb8d), + debugReverseContinue: register('debug-reverse-continue', 0xeb8e), + debugStepBack: register('debug-step-back', 0xeb8f), + debugRestartFrame: register('debug-restart-frame', 0xeb90), + debugAlt: register('debug-alt', 0xeb91), + callIncoming: register('call-incoming', 0xeb92), + callOutgoing: register('call-outgoing', 0xeb93), + menu: register('menu', 0xeb94), + expandAll: register('expand-all', 0xeb95), + feedback: register('feedback', 0xeb96), + gitPullRequestReviewer: register('git-pull-request-reviewer', 0xeb96), + groupByRefType: register('group-by-ref-type', 0xeb97), + ungroupByRefType: register('ungroup-by-ref-type', 0xeb98), + account: register('account', 0xeb99), + gitPullRequestAssignee: register('git-pull-request-assignee', 0xeb99), + bellDot: register('bell-dot', 0xeb9a), + debugConsole: register('debug-console', 0xeb9b), + library: register('library', 0xeb9c), + output: register('output', 0xeb9d), + runAll: register('run-all', 0xeb9e), + syncIgnored: register('sync-ignored', 0xeb9f), + pinned: register('pinned', 0xeba0), + githubInverted: register('github-inverted', 0xeba1), + serverProcess: register('server-process', 0xeba2), + serverEnvironment: register('server-environment', 0xeba3), + pass: register('pass', 0xeba4), + issueClosed: register('issue-closed', 0xeba4), + stopCircle: register('stop-circle', 0xeba5), + playCircle: register('play-circle', 0xeba6), + record: register('record', 0xeba7), + debugAltSmall: register('debug-alt-small', 0xeba8), + vmConnect: register('vm-connect', 0xeba9), + cloud: register('cloud', 0xebaa), + merge: register('merge', 0xebab), + export: register('export', 0xebac), + graphLeft: register('graph-left', 0xebad), + magnet: register('magnet', 0xebae), + notebook: register('notebook', 0xebaf), + redo: register('redo', 0xebb0), + checkAll: register('check-all', 0xebb1), + pinnedDirty: register('pinned-dirty', 0xebb2), + passFilled: register('pass-filled', 0xebb3), + circleLargeFilled: register('circle-large-filled', 0xebb4), + circleLarge: register('circle-large', 0xebb5), + circleLargeOutline: register('circle-large-outline', 0xebb5), + combine: register('combine', 0xebb6), + gather: register('gather', 0xebb6), + table: register('table', 0xebb7), + variableGroup: register('variable-group', 0xebb8), + typeHierarchy: register('type-hierarchy', 0xebb9), + typeHierarchySub: register('type-hierarchy-sub', 0xebba), + typeHierarchySuper: register('type-hierarchy-super', 0xebbb), + gitPullRequestCreate: register('git-pull-request-create', 0xebbc), + runAbove: register('run-above', 0xebbd), + runBelow: register('run-below', 0xebbe), + notebookTemplate: register('notebook-template', 0xebbf), + debugRerun: register('debug-rerun', 0xebc0), + workspaceTrusted: register('workspace-trusted', 0xebc1), + workspaceUntrusted: register('workspace-untrusted', 0xebc2), + workspaceUnknown: register('workspace-unknown', 0xebc3), + terminalCmd: register('terminal-cmd', 0xebc4), + terminalDebian: register('terminal-debian', 0xebc5), + terminalLinux: register('terminal-linux', 0xebc6), + terminalPowershell: register('terminal-powershell', 0xebc7), + terminalTmux: register('terminal-tmux', 0xebc8), + terminalUbuntu: register('terminal-ubuntu', 0xebc9), + terminalBash: register('terminal-bash', 0xebca), + arrowSwap: register('arrow-swap', 0xebcb), + copy: register('copy', 0xebcc), + personAdd: register('person-add', 0xebcd), + filterFilled: register('filter-filled', 0xebce), + wand: register('wand', 0xebcf), + debugLineByLine: register('debug-line-by-line', 0xebd0), + inspect: register('inspect', 0xebd1), + layers: register('layers', 0xebd2), + layersDot: register('layers-dot', 0xebd3), + layersActive: register('layers-active', 0xebd4), + compass: register('compass', 0xebd5), + compassDot: register('compass-dot', 0xebd6), + compassActive: register('compass-active', 0xebd7), + azure: register('azure', 0xebd8), + issueDraft: register('issue-draft', 0xebd9), + gitPullRequestClosed: register('git-pull-request-closed', 0xebda), + gitPullRequestDraft: register('git-pull-request-draft', 0xebdb), + debugAll: register('debug-all', 0xebdc), + debugCoverage: register('debug-coverage', 0xebdd), + runErrors: register('run-errors', 0xebde), + folderLibrary: register('folder-library', 0xebdf), + debugContinueSmall: register('debug-continue-small', 0xebe0), + beakerStop: register('beaker-stop', 0xebe1), + graphLine: register('graph-line', 0xebe2), + graphScatter: register('graph-scatter', 0xebe3), + pieChart: register('pie-chart', 0xebe4), + bracket: register('bracket', 0xeb0f), + bracketDot: register('bracket-dot', 0xebe5), + bracketError: register('bracket-error', 0xebe6), + lockSmall: register('lock-small', 0xebe7), + azureDevops: register('azure-devops', 0xebe8), + verifiedFilled: register('verified-filled', 0xebe9), + newline: register('newline', 0xebea), + layout: register('layout', 0xebeb), + layoutActivitybarLeft: register('layout-activitybar-left', 0xebec), + layoutActivitybarRight: register('layout-activitybar-right', 0xebed), + layoutPanelLeft: register('layout-panel-left', 0xebee), + layoutPanelCenter: register('layout-panel-center', 0xebef), + layoutPanelJustify: register('layout-panel-justify', 0xebf0), + layoutPanelRight: register('layout-panel-right', 0xebf1), + layoutPanel: register('layout-panel', 0xebf2), + layoutSidebarLeft: register('layout-sidebar-left', 0xebf3), + layoutSidebarRight: register('layout-sidebar-right', 0xebf4), + layoutStatusbar: register('layout-statusbar', 0xebf5), + layoutMenubar: register('layout-menubar', 0xebf6), + layoutCentered: register('layout-centered', 0xebf7), + target: register('target', 0xebf8), + indent: register('indent', 0xebf9), + recordSmall: register('record-small', 0xebfa), + errorSmall: register('error-small', 0xebfb), + terminalDecorationError: register('terminal-decoration-error', 0xebfb), + arrowCircleDown: register('arrow-circle-down', 0xebfc), + arrowCircleLeft: register('arrow-circle-left', 0xebfd), + arrowCircleRight: register('arrow-circle-right', 0xebfe), + arrowCircleUp: register('arrow-circle-up', 0xebff), + layoutSidebarRightOff: register('layout-sidebar-right-off', 0xec00), + layoutPanelOff: register('layout-panel-off', 0xec01), + layoutSidebarLeftOff: register('layout-sidebar-left-off', 0xec02), + blank: register('blank', 0xec03), + heartFilled: register('heart-filled', 0xec04), + map: register('map', 0xec05), + mapHorizontal: register('map-horizontal', 0xec05), + foldHorizontal: register('fold-horizontal', 0xec05), + mapFilled: register('map-filled', 0xec06), + mapHorizontalFilled: register('map-horizontal-filled', 0xec06), + foldHorizontalFilled: register('fold-horizontal-filled', 0xec06), + circleSmall: register('circle-small', 0xec07), + bellSlash: register('bell-slash', 0xec08), + bellSlashDot: register('bell-slash-dot', 0xec09), + commentUnresolved: register('comment-unresolved', 0xec0a), + gitPullRequestGoToChanges: register('git-pull-request-go-to-changes', 0xec0b), + gitPullRequestNewChanges: register('git-pull-request-new-changes', 0xec0c), + searchFuzzy: register('search-fuzzy', 0xec0d), + commentDraft: register('comment-draft', 0xec0e), + send: register('send', 0xec0f), + sparkle: register('sparkle', 0xec10), + insert: register('insert', 0xec11), + mic: register('mic', 0xec12), + thumbsdownFilled: register('thumbsdown-filled', 0xec13), + thumbsupFilled: register('thumbsup-filled', 0xec14), + coffee: register('coffee', 0xec15), + snake: register('snake', 0xec16), + game: register('game', 0xec17), + vr: register('vr', 0xec18), + chip: register('chip', 0xec19), + piano: register('piano', 0xec1a), + music: register('music', 0xec1b), + micFilled: register('mic-filled', 0xec1c), + repoFetch: register('repo-fetch', 0xec1d), + copilot: register('copilot', 0xec1e), + lightbulbSparkle: register('lightbulb-sparkle', 0xec1f), + robot: register('robot', 0xec20), + sparkleFilled: register('sparkle-filled', 0xec21), + diffSingle: register('diff-single', 0xec22), + diffMultiple: register('diff-multiple', 0xec23), + surroundWith: register('surround-with', 0xec24), + share: register('share', 0xec25), + gitStash: register('git-stash', 0xec26), + gitStashApply: register('git-stash-apply', 0xec27), + gitStashPop: register('git-stash-pop', 0xec28), + vscode: register('vscode', 0xec29), + vscodeInsiders: register('vscode-insiders', 0xec2a), + codeOss: register('code-oss', 0xec2b), + runCoverage: register('run-coverage', 0xec2c), + runAllCoverage: register('run-all-coverage', 0xec2d), + coverage: register('coverage', 0xec2e), + githubProject: register('github-project', 0xec2f), + mapVertical: register('map-vertical', 0xec30), + foldVertical: register('fold-vertical', 0xec30), + mapVerticalFilled: register('map-vertical-filled', 0xec31), + foldVerticalFilled: register('fold-vertical-filled', 0xec31), + goToSearch: register('go-to-search', 0xec32), + percentage: register('percentage', 0xec33), + sortPercentage: register('sort-percentage', 0xec33), + attach: register('attach', 0xec34), +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codiconsUtil.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codiconsUtil.js new file mode 100644 index 0000000000000000000000000000000000000000..3cf7e11a6787d51c565a0330e0f0d238aad27852 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/codiconsUtil.js @@ -0,0 +1,19 @@ +import { isString } from './types.js'; +const _codiconFontCharacters = Object.create(null); +export function register(id, fontCharacter) { + if (isString(fontCharacter)) { + const val = _codiconFontCharacters[fontCharacter]; + if (val === undefined) { + throw new Error(`${id} references an unknown codicon: ${fontCharacter}`); + } + fontCharacter = val; + } + _codiconFontCharacters[id] = fontCharacter; + return { id }; +} +/** + * Only to be used by the iconRegistry. + */ +export function getCodiconFontCharacters() { + return _codiconFontCharacters; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/collections.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/collections.js new file mode 100644 index 0000000000000000000000000000000000000000..c886a85f784cfc4f7f68a4b91670c8ca79ce48d3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/collections.js @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export function diffSets(before, after) { + const removed = []; + const added = []; + for (const element of before) { + if (!after.has(element)) { + removed.push(element); + } + } + for (const element of after) { + if (!before.has(element)) { + added.push(element); + } + } + return { removed, added }; +} +/** + * Computes the intersection of two sets. + * + * @param setA - The first set. + * @param setB - The second iterable. + * @returns A new set containing the elements that are in both `setA` and `setB`. + */ +export function intersection(setA, setB) { + const result = new Set(); + for (const elem of setB) { + if (setA.has(elem)) { + result.add(elem); + } + } + return result; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/color.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/color.js new file mode 100644 index 0000000000000000000000000000000000000000..bfb953ce9e72b1b343e2600a4eed005efaf754bb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/color.js @@ -0,0 +1,462 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +function roundFloat(number, decimalPoints) { + const decimal = Math.pow(10, decimalPoints); + return Math.round(number * decimal) / decimal; +} +export class RGBA { + constructor(r, g, b, a = 1) { + this._rgbaBrand = undefined; + this.r = Math.min(255, Math.max(0, r)) | 0; + this.g = Math.min(255, Math.max(0, g)) | 0; + this.b = Math.min(255, Math.max(0, b)) | 0; + this.a = roundFloat(Math.max(Math.min(1, a), 0), 3); + } + static equals(a, b) { + return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a; + } +} +export class HSLA { + constructor(h, s, l, a) { + this._hslaBrand = undefined; + this.h = Math.max(Math.min(360, h), 0) | 0; + this.s = roundFloat(Math.max(Math.min(1, s), 0), 3); + this.l = roundFloat(Math.max(Math.min(1, l), 0), 3); + this.a = roundFloat(Math.max(Math.min(1, a), 0), 3); + } + static equals(a, b) { + return a.h === b.h && a.s === b.s && a.l === b.l && a.a === b.a; + } + /** + * Converts an RGB color value to HSL. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes r, g, and b are contained in the set [0, 255] and + * returns h in the set [0, 360], s, and l in the set [0, 1]. + */ + static fromRGBA(rgba) { + const r = rgba.r / 255; + const g = rgba.g / 255; + const b = rgba.b / 255; + const a = rgba.a; + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + let h = 0; + let s = 0; + const l = (min + max) / 2; + const chroma = max - min; + if (chroma > 0) { + s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1); + switch (max) { + case r: + h = (g - b) / chroma + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / chroma + 2; + break; + case b: + h = (r - g) / chroma + 4; + break; + } + h *= 60; + h = Math.round(h); + } + return new HSLA(h, s, l, a); + } + static _hue2rgb(p, q, t) { + if (t < 0) { + t += 1; + } + if (t > 1) { + t -= 1; + } + if (t < 1 / 6) { + return p + (q - p) * 6 * t; + } + if (t < 1 / 2) { + return q; + } + if (t < 2 / 3) { + return p + (q - p) * (2 / 3 - t) * 6; + } + return p; + } + /** + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h in the set [0, 360] s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + */ + static toRGBA(hsla) { + const h = hsla.h / 360; + const { s, l, a } = hsla; + let r, g, b; + if (s === 0) { + r = g = b = l; // achromatic + } + else { + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + r = HSLA._hue2rgb(p, q, h + 1 / 3); + g = HSLA._hue2rgb(p, q, h); + b = HSLA._hue2rgb(p, q, h - 1 / 3); + } + return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a); + } +} +export class HSVA { + constructor(h, s, v, a) { + this._hsvaBrand = undefined; + this.h = Math.max(Math.min(360, h), 0) | 0; + this.s = roundFloat(Math.max(Math.min(1, s), 0), 3); + this.v = roundFloat(Math.max(Math.min(1, v), 0), 3); + this.a = roundFloat(Math.max(Math.min(1, a), 0), 3); + } + static equals(a, b) { + return a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a; + } + // from http://www.rapidtables.com/convert/color/rgb-to-hsv.htm + static fromRGBA(rgba) { + const r = rgba.r / 255; + const g = rgba.g / 255; + const b = rgba.b / 255; + const cmax = Math.max(r, g, b); + const cmin = Math.min(r, g, b); + const delta = cmax - cmin; + const s = cmax === 0 ? 0 : (delta / cmax); + let m; + if (delta === 0) { + m = 0; + } + else if (cmax === r) { + m = ((((g - b) / delta) % 6) + 6) % 6; + } + else if (cmax === g) { + m = ((b - r) / delta) + 2; + } + else { + m = ((r - g) / delta) + 4; + } + return new HSVA(Math.round(m * 60), s, cmax, rgba.a); + } + // from http://www.rapidtables.com/convert/color/hsv-to-rgb.htm + static toRGBA(hsva) { + const { h, s, v, a } = hsva; + const c = v * s; + const x = c * (1 - Math.abs((h / 60) % 2 - 1)); + const m = v - c; + let [r, g, b] = [0, 0, 0]; + if (h < 60) { + r = c; + g = x; + } + else if (h < 120) { + r = x; + g = c; + } + else if (h < 180) { + g = c; + b = x; + } + else if (h < 240) { + g = x; + b = c; + } + else if (h < 300) { + r = x; + b = c; + } + else if (h <= 360) { + r = c; + b = x; + } + r = Math.round((r + m) * 255); + g = Math.round((g + m) * 255); + b = Math.round((b + m) * 255); + return new RGBA(r, g, b, a); + } +} +export class Color { + static fromHex(hex) { + return Color.Format.CSS.parseHex(hex) || Color.red; + } + static equals(a, b) { + if (!a && !b) { + return true; + } + if (!a || !b) { + return false; + } + return a.equals(b); + } + get hsla() { + if (this._hsla) { + return this._hsla; + } + else { + return HSLA.fromRGBA(this.rgba); + } + } + get hsva() { + if (this._hsva) { + return this._hsva; + } + return HSVA.fromRGBA(this.rgba); + } + constructor(arg) { + if (!arg) { + throw new Error('Color needs a value'); + } + else if (arg instanceof RGBA) { + this.rgba = arg; + } + else if (arg instanceof HSLA) { + this._hsla = arg; + this.rgba = HSLA.toRGBA(arg); + } + else if (arg instanceof HSVA) { + this._hsva = arg; + this.rgba = HSVA.toRGBA(arg); + } + else { + throw new Error('Invalid color ctor argument'); + } + } + equals(other) { + return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva); + } + /** + * http://www.w3.org/TR/WCAG20/#relativeluminancedef + * Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white. + */ + getRelativeLuminance() { + const R = Color._relativeLuminanceForComponent(this.rgba.r); + const G = Color._relativeLuminanceForComponent(this.rgba.g); + const B = Color._relativeLuminanceForComponent(this.rgba.b); + const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B; + return roundFloat(luminance, 4); + } + static _relativeLuminanceForComponent(color) { + const c = color / 255; + return (c <= 0.03928) ? c / 12.92 : Math.pow(((c + 0.055) / 1.055), 2.4); + } + /** + * http://24ways.org/2010/calculating-color-contrast + * Return 'true' if lighter color otherwise 'false' + */ + isLighter() { + const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000; + return yiq >= 128; + } + isLighterThan(another) { + const lum1 = this.getRelativeLuminance(); + const lum2 = another.getRelativeLuminance(); + return lum1 > lum2; + } + isDarkerThan(another) { + const lum1 = this.getRelativeLuminance(); + const lum2 = another.getRelativeLuminance(); + return lum1 < lum2; + } + lighten(factor) { + return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l + this.hsla.l * factor, this.hsla.a)); + } + darken(factor) { + return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l - this.hsla.l * factor, this.hsla.a)); + } + transparent(factor) { + const { r, g, b, a } = this.rgba; + return new Color(new RGBA(r, g, b, a * factor)); + } + isTransparent() { + return this.rgba.a === 0; + } + isOpaque() { + return this.rgba.a === 1; + } + opposite() { + return new Color(new RGBA(255 - this.rgba.r, 255 - this.rgba.g, 255 - this.rgba.b, this.rgba.a)); + } + makeOpaque(opaqueBackground) { + if (this.isOpaque() || opaqueBackground.rgba.a !== 1) { + // only allow to blend onto a non-opaque color onto a opaque color + return this; + } + const { r, g, b, a } = this.rgba; + // https://stackoverflow.com/questions/12228548/finding-equivalent-color-with-opacity + return new Color(new RGBA(opaqueBackground.rgba.r - a * (opaqueBackground.rgba.r - r), opaqueBackground.rgba.g - a * (opaqueBackground.rgba.g - g), opaqueBackground.rgba.b - a * (opaqueBackground.rgba.b - b), 1)); + } + toString() { + if (!this._toString) { + this._toString = Color.Format.CSS.format(this); + } + return this._toString; + } + static getLighterColor(of, relative, factor) { + if (of.isLighterThan(relative)) { + return of; + } + factor = factor ? factor : 0.5; + const lum1 = of.getRelativeLuminance(); + const lum2 = relative.getRelativeLuminance(); + factor = factor * (lum2 - lum1) / lum2; + return of.lighten(factor); + } + static getDarkerColor(of, relative, factor) { + if (of.isDarkerThan(relative)) { + return of; + } + factor = factor ? factor : 0.5; + const lum1 = of.getRelativeLuminance(); + const lum2 = relative.getRelativeLuminance(); + factor = factor * (lum1 - lum2) / lum1; + return of.darken(factor); + } + static { this.white = new Color(new RGBA(255, 255, 255, 1)); } + static { this.black = new Color(new RGBA(0, 0, 0, 1)); } + static { this.red = new Color(new RGBA(255, 0, 0, 1)); } + static { this.blue = new Color(new RGBA(0, 0, 255, 1)); } + static { this.green = new Color(new RGBA(0, 255, 0, 1)); } + static { this.cyan = new Color(new RGBA(0, 255, 255, 1)); } + static { this.lightgrey = new Color(new RGBA(211, 211, 211, 1)); } + static { this.transparent = new Color(new RGBA(0, 0, 0, 0)); } +} +(function (Color) { + let Format; + (function (Format) { + let CSS; + (function (CSS) { + function formatRGB(color) { + if (color.rgba.a === 1) { + return `rgb(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b})`; + } + return Color.Format.CSS.formatRGBA(color); + } + CSS.formatRGB = formatRGB; + function formatRGBA(color) { + return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+(color.rgba.a).toFixed(2)})`; + } + CSS.formatRGBA = formatRGBA; + function formatHSL(color) { + if (color.hsla.a === 1) { + return `hsl(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%)`; + } + return Color.Format.CSS.formatHSLA(color); + } + CSS.formatHSL = formatHSL; + function formatHSLA(color) { + return `hsla(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%, ${color.hsla.a.toFixed(2)})`; + } + CSS.formatHSLA = formatHSLA; + function _toTwoDigitHex(n) { + const r = n.toString(16); + return r.length !== 2 ? '0' + r : r; + } + /** + * Formats the color as #RRGGBB + */ + function formatHex(color) { + return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}`; + } + CSS.formatHex = formatHex; + /** + * Formats the color as #RRGGBBAA + * If 'compact' is set, colors without transparancy will be printed as #RRGGBB + */ + function formatHexA(color, compact = false) { + if (compact && color.rgba.a === 1) { + return Color.Format.CSS.formatHex(color); + } + return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(Math.round(color.rgba.a * 255))}`; + } + CSS.formatHexA = formatHexA; + /** + * The default format will use HEX if opaque and RGBA otherwise. + */ + function format(color) { + if (color.isOpaque()) { + return Color.Format.CSS.formatHex(color); + } + return Color.Format.CSS.formatRGBA(color); + } + CSS.format = format; + /** + * Converts an Hex color value to a Color. + * returns r, g, and b are contained in the set [0, 255] + * @param hex string (#RGB, #RGBA, #RRGGBB or #RRGGBBAA). + */ + function parseHex(hex) { + const length = hex.length; + if (length === 0) { + // Invalid color + return null; + } + if (hex.charCodeAt(0) !== 35 /* CharCode.Hash */) { + // Does not begin with a # + return null; + } + if (length === 7) { + // #RRGGBB format + const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2)); + const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4)); + const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6)); + return new Color(new RGBA(r, g, b, 1)); + } + if (length === 9) { + // #RRGGBBAA format + const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2)); + const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4)); + const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6)); + const a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8)); + return new Color(new RGBA(r, g, b, a / 255)); + } + if (length === 4) { + // #RGB format + const r = _parseHexDigit(hex.charCodeAt(1)); + const g = _parseHexDigit(hex.charCodeAt(2)); + const b = _parseHexDigit(hex.charCodeAt(3)); + return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b)); + } + if (length === 5) { + // #RGBA format + const r = _parseHexDigit(hex.charCodeAt(1)); + const g = _parseHexDigit(hex.charCodeAt(2)); + const b = _parseHexDigit(hex.charCodeAt(3)); + const a = _parseHexDigit(hex.charCodeAt(4)); + return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255)); + } + // Invalid color + return null; + } + CSS.parseHex = parseHex; + function _parseHexDigit(charCode) { + switch (charCode) { + case 48 /* CharCode.Digit0 */: return 0; + case 49 /* CharCode.Digit1 */: return 1; + case 50 /* CharCode.Digit2 */: return 2; + case 51 /* CharCode.Digit3 */: return 3; + case 52 /* CharCode.Digit4 */: return 4; + case 53 /* CharCode.Digit5 */: return 5; + case 54 /* CharCode.Digit6 */: return 6; + case 55 /* CharCode.Digit7 */: return 7; + case 56 /* CharCode.Digit8 */: return 8; + case 57 /* CharCode.Digit9 */: return 9; + case 97 /* CharCode.a */: return 10; + case 65 /* CharCode.A */: return 10; + case 98 /* CharCode.b */: return 11; + case 66 /* CharCode.B */: return 11; + case 99 /* CharCode.c */: return 12; + case 67 /* CharCode.C */: return 12; + case 100 /* CharCode.d */: return 13; + case 68 /* CharCode.D */: return 13; + case 101 /* CharCode.e */: return 14; + case 69 /* CharCode.E */: return 14; + case 102 /* CharCode.f */: return 15; + case 70 /* CharCode.F */: return 15; + } + return 0; + } + })(CSS = Format.CSS || (Format.CSS = {})); + })(Format = Color.Format || (Color.Format = {})); +})(Color || (Color = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/comparers.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/comparers.js new file mode 100644 index 0000000000000000000000000000000000000000..d3052507e9ab80efc160f3f23ca010904e7fddd4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/comparers.js @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Lazy } from './lazy.js'; +// When comparing large numbers of strings it's better for performance to create an +// Intl.Collator object and use the function provided by its compare property +// than it is to use String.prototype.localeCompare() +// A collator with numeric sorting enabled, and no sensitivity to case, accents or diacritics. +const intlFileNameCollatorBaseNumeric = new Lazy(() => { + const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); + return { + collator, + collatorIsNumeric: collator.resolvedOptions().numeric + }; +}); +// A collator with numeric sorting enabled. +const intlFileNameCollatorNumeric = new Lazy(() => { + const collator = new Intl.Collator(undefined, { numeric: true }); + return { + collator + }; +}); +// A collator with numeric sorting enabled, and sensitivity to accents and diacritics but not case. +const intlFileNameCollatorNumericCaseInsensitive = new Lazy(() => { + const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'accent' }); + return { + collator + }; +}); +/** Compares filenames without distinguishing the name from the extension. Disambiguates by unicode comparison. */ +export function compareFileNames(one, other, caseSensitive = false) { + const a = one || ''; + const b = other || ''; + const result = intlFileNameCollatorBaseNumeric.value.collator.compare(a, b); + // Using the numeric option will make compare(`foo1`, `foo01`) === 0. Disambiguate. + if (intlFileNameCollatorBaseNumeric.value.collatorIsNumeric && result === 0 && a !== b) { + return a < b ? -1 : 1; + } + return result; +} +export function compareAnything(one, other, lookFor) { + const elementAName = one.toLowerCase(); + const elementBName = other.toLowerCase(); + // Sort prefix matches over non prefix matches + const prefixCompare = compareByPrefix(one, other, lookFor); + if (prefixCompare) { + return prefixCompare; + } + // Sort suffix matches over non suffix matches + const elementASuffixMatch = elementAName.endsWith(lookFor); + const elementBSuffixMatch = elementBName.endsWith(lookFor); + if (elementASuffixMatch !== elementBSuffixMatch) { + return elementASuffixMatch ? -1 : 1; + } + // Understand file names + const r = compareFileNames(elementAName, elementBName); + if (r !== 0) { + return r; + } + // Compare by name + return elementAName.localeCompare(elementBName); +} +export function compareByPrefix(one, other, lookFor) { + const elementAName = one.toLowerCase(); + const elementBName = other.toLowerCase(); + // Sort prefix matches over non prefix matches + const elementAPrefixMatch = elementAName.startsWith(lookFor); + const elementBPrefixMatch = elementBName.startsWith(lookFor); + if (elementAPrefixMatch !== elementBPrefixMatch) { + return elementAPrefixMatch ? -1 : 1; + } + // Same prefix: Sort shorter matches to the top to have those on top that match more precisely + else if (elementAPrefixMatch && elementBPrefixMatch) { + if (elementAName.length < elementBName.length) { + return -1; + } + if (elementAName.length > elementBName.length) { + return 1; + } + } + return 0; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/dataTransfer.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/dataTransfer.js new file mode 100644 index 0000000000000000000000000000000000000000..314bc001cd91599f9fbb981094eebb2f2770826e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/dataTransfer.js @@ -0,0 +1,128 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { distinct } from './arrays.js'; +import { Iterable } from './iterator.js'; +import { generateUuid } from './uuid.js'; +export function createStringDataTransferItem(stringOrPromise) { + return { + asString: async () => stringOrPromise, + asFile: () => undefined, + value: typeof stringOrPromise === 'string' ? stringOrPromise : undefined, + }; +} +export function createFileDataTransferItem(fileName, uri, data) { + const file = { id: generateUuid(), name: fileName, uri, data }; + return { + asString: async () => '', + asFile: () => file, + value: undefined, + }; +} +export class VSDataTransfer { + constructor() { + this._entries = new Map(); + } + get size() { + let size = 0; + for (const _ of this._entries) { + size++; + } + return size; + } + has(mimeType) { + return this._entries.has(this.toKey(mimeType)); + } + matches(pattern) { + const mimes = [...this._entries.keys()]; + if (Iterable.some(this, ([_, item]) => item.asFile())) { + mimes.push('files'); + } + return matchesMimeType_normalized(normalizeMimeType(pattern), mimes); + } + get(mimeType) { + return this._entries.get(this.toKey(mimeType))?.[0]; + } + /** + * Add a new entry to this data transfer. + * + * This does not replace existing entries for `mimeType`. + */ + append(mimeType, value) { + const existing = this._entries.get(mimeType); + if (existing) { + existing.push(value); + } + else { + this._entries.set(this.toKey(mimeType), [value]); + } + } + /** + * Set the entry for a given mime type. + * + * This replaces all existing entries for `mimeType`. + */ + replace(mimeType, value) { + this._entries.set(this.toKey(mimeType), [value]); + } + /** + * Remove all entries for `mimeType`. + */ + delete(mimeType) { + this._entries.delete(this.toKey(mimeType)); + } + /** + * Iterate over all `[mime, item]` pairs in this data transfer. + * + * There may be multiple entries for each mime type. + */ + *[Symbol.iterator]() { + for (const [mine, items] of this._entries) { + for (const item of items) { + yield [mine, item]; + } + } + } + toKey(mimeType) { + return normalizeMimeType(mimeType); + } +} +function normalizeMimeType(mimeType) { + return mimeType.toLowerCase(); +} +export function matchesMimeType(pattern, mimeTypes) { + return matchesMimeType_normalized(normalizeMimeType(pattern), mimeTypes.map(normalizeMimeType)); +} +function matchesMimeType_normalized(normalizedPattern, normalizedMimeTypes) { + // Anything wildcard + if (normalizedPattern === '*/*') { + return normalizedMimeTypes.length > 0; + } + // Exact match + if (normalizedMimeTypes.includes(normalizedPattern)) { + return true; + } + // Wildcard, such as `image/*` + const wildcard = normalizedPattern.match(/^([a-z]+)\/([a-z]+|\*)$/i); + if (!wildcard) { + return false; + } + const [_, type, subtype] = wildcard; + if (subtype === '*') { + return normalizedMimeTypes.some(mime => mime.startsWith(type + '/')); + } + return false; +} +export const UriList = Object.freeze({ + // http://amundsen.com/hypermedia/urilist/ + create: (entries) => { + return distinct(entries.map(x => x.toString())).join('\r\n'); + }, + split: (str) => { + return str.split('\r\n'); + }, + parse: (str) => { + return UriList.split(str).filter(value => !value.startsWith('#')); + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/decorators.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/decorators.js new file mode 100644 index 0000000000000000000000000000000000000000..b95571f625974ac3f9b075d7e2a274be2171f6b3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/decorators.js @@ -0,0 +1,30 @@ +export function memoize(_target, key, descriptor) { + let fnKey = null; + let fn = null; + if (typeof descriptor.value === 'function') { + fnKey = 'value'; + fn = descriptor.value; + if (fn.length !== 0) { + console.warn('Memoize should only be used in functions with zero parameters'); + } + } + else if (typeof descriptor.get === 'function') { + fnKey = 'get'; + fn = descriptor.get; + } + if (!fn) { + throw new Error('not supported'); + } + const memoizeKey = `$memoize$${key}`; + descriptor[fnKey] = function (...args) { + if (!this.hasOwnProperty(memoizeKey)) { + Object.defineProperty(this, memoizeKey, { + configurable: false, + enumerable: false, + writable: false, + value: fn.apply(this, args) + }); + } + return this[memoizeKey]; + }; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/diff/diff.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/diff/diff.js new file mode 100644 index 0000000000000000000000000000000000000000..505d6304d61da542c30966c52799ecfcc2df8518 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/diff/diff.js @@ -0,0 +1,899 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { DiffChange } from './diffChange.js'; +import { stringHash } from '../hash.js'; +export class StringDiffSequence { + constructor(source) { + this.source = source; + } + getElements() { + const source = this.source; + const characters = new Int32Array(source.length); + for (let i = 0, len = source.length; i < len; i++) { + characters[i] = source.charCodeAt(i); + } + return characters; + } +} +export function stringDiff(original, modified, pretty) { + return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty).changes; +} +// +// The code below has been ported from a C# implementation in VS +// +class Debug { + static Assert(condition, message) { + if (!condition) { + throw new Error(message); + } + } +} +class MyArray { + /** + * Copies a range of elements from an Array starting at the specified source index and pastes + * them to another Array starting at the specified destination index. The length and the indexes + * are specified as 64-bit integers. + * sourceArray: + * The Array that contains the data to copy. + * sourceIndex: + * A 64-bit integer that represents the index in the sourceArray at which copying begins. + * destinationArray: + * The Array that receives the data. + * destinationIndex: + * A 64-bit integer that represents the index in the destinationArray at which storing begins. + * length: + * A 64-bit integer that represents the number of elements to copy. + */ + static Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length) { + for (let i = 0; i < length; i++) { + destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i]; + } + } + static Copy2(sourceArray, sourceIndex, destinationArray, destinationIndex, length) { + for (let i = 0; i < length; i++) { + destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i]; + } + } +} +/** + * A utility class which helps to create the set of DiffChanges from + * a difference operation. This class accepts original DiffElements and + * modified DiffElements that are involved in a particular change. The + * MarkNextChange() method can be called to mark the separation between + * distinct changes. At the end, the Changes property can be called to retrieve + * the constructed changes. + */ +class DiffChangeHelper { + /** + * Constructs a new DiffChangeHelper for the given DiffSequences. + */ + constructor() { + this.m_changes = []; + this.m_originalStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */; + this.m_modifiedStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */; + this.m_originalCount = 0; + this.m_modifiedCount = 0; + } + /** + * Marks the beginning of the next change in the set of differences. + */ + MarkNextChange() { + // Only add to the list if there is something to add + if (this.m_originalCount > 0 || this.m_modifiedCount > 0) { + // Add the new change to our list + this.m_changes.push(new DiffChange(this.m_originalStart, this.m_originalCount, this.m_modifiedStart, this.m_modifiedCount)); + } + // Reset for the next change + this.m_originalCount = 0; + this.m_modifiedCount = 0; + this.m_originalStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */; + this.m_modifiedStart = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */; + } + /** + * Adds the original element at the given position to the elements + * affected by the current change. The modified index gives context + * to the change position with respect to the original sequence. + * @param originalIndex The index of the original element to add. + * @param modifiedIndex The index of the modified element that provides corresponding position in the modified sequence. + */ + AddOriginalElement(originalIndex, modifiedIndex) { + // The 'true' start index is the smallest of the ones we've seen + this.m_originalStart = Math.min(this.m_originalStart, originalIndex); + this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex); + this.m_originalCount++; + } + /** + * Adds the modified element at the given position to the elements + * affected by the current change. The original index gives context + * to the change position with respect to the modified sequence. + * @param originalIndex The index of the original element that provides corresponding position in the original sequence. + * @param modifiedIndex The index of the modified element to add. + */ + AddModifiedElement(originalIndex, modifiedIndex) { + // The 'true' start index is the smallest of the ones we've seen + this.m_originalStart = Math.min(this.m_originalStart, originalIndex); + this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex); + this.m_modifiedCount++; + } + /** + * Retrieves all of the changes marked by the class. + */ + getChanges() { + if (this.m_originalCount > 0 || this.m_modifiedCount > 0) { + // Finish up on whatever is left + this.MarkNextChange(); + } + return this.m_changes; + } + /** + * Retrieves all of the changes marked by the class in the reverse order + */ + getReverseChanges() { + if (this.m_originalCount > 0 || this.m_modifiedCount > 0) { + // Finish up on whatever is left + this.MarkNextChange(); + } + this.m_changes.reverse(); + return this.m_changes; + } +} +/** + * An implementation of the difference algorithm described in + * "An O(ND) Difference Algorithm and its variations" by Eugene W. Myers + */ +export class LcsDiff { + /** + * Constructs the DiffFinder + */ + constructor(originalSequence, modifiedSequence, continueProcessingPredicate = null) { + this.ContinueProcessingPredicate = continueProcessingPredicate; + this._originalSequence = originalSequence; + this._modifiedSequence = modifiedSequence; + const [originalStringElements, originalElementsOrHash, originalHasStrings] = LcsDiff._getElements(originalSequence); + const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = LcsDiff._getElements(modifiedSequence); + this._hasStrings = (originalHasStrings && modifiedHasStrings); + this._originalStringElements = originalStringElements; + this._originalElementsOrHash = originalElementsOrHash; + this._modifiedStringElements = modifiedStringElements; + this._modifiedElementsOrHash = modifiedElementsOrHash; + this.m_forwardHistory = []; + this.m_reverseHistory = []; + } + static _isStringArray(arr) { + return (arr.length > 0 && typeof arr[0] === 'string'); + } + static _getElements(sequence) { + const elements = sequence.getElements(); + if (LcsDiff._isStringArray(elements)) { + const hashes = new Int32Array(elements.length); + for (let i = 0, len = elements.length; i < len; i++) { + hashes[i] = stringHash(elements[i], 0); + } + return [elements, hashes, true]; + } + if (elements instanceof Int32Array) { + return [[], elements, false]; + } + return [[], new Int32Array(elements), false]; + } + ElementsAreEqual(originalIndex, newIndex) { + if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) { + return false; + } + return (this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true); + } + ElementsAreStrictEqual(originalIndex, newIndex) { + if (!this.ElementsAreEqual(originalIndex, newIndex)) { + return false; + } + const originalElement = LcsDiff._getStrictElement(this._originalSequence, originalIndex); + const modifiedElement = LcsDiff._getStrictElement(this._modifiedSequence, newIndex); + return (originalElement === modifiedElement); + } + static _getStrictElement(sequence, index) { + if (typeof sequence.getStrictElement === 'function') { + return sequence.getStrictElement(index); + } + return null; + } + OriginalElementsAreEqual(index1, index2) { + if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) { + return false; + } + return (this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true); + } + ModifiedElementsAreEqual(index1, index2) { + if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) { + return false; + } + return (this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true); + } + ComputeDiff(pretty) { + return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty); + } + /** + * Computes the differences between the original and modified input + * sequences on the bounded range. + * @returns An array of the differences between the two input sequences. + */ + _ComputeDiff(originalStart, originalEnd, modifiedStart, modifiedEnd, pretty) { + const quitEarlyArr = [false]; + let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr); + if (pretty) { + // We have to clean up the computed diff to be more intuitive + // but it turns out this cannot be done correctly until the entire set + // of diffs have been computed + changes = this.PrettifyChanges(changes); + } + return { + quitEarly: quitEarlyArr[0], + changes: changes + }; + } + /** + * Private helper method which computes the differences on the bounded range + * recursively. + * @returns An array of the differences between the two input sequences. + */ + ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr) { + quitEarlyArr[0] = false; + // Find the start of the differences + while (originalStart <= originalEnd && modifiedStart <= modifiedEnd && this.ElementsAreEqual(originalStart, modifiedStart)) { + originalStart++; + modifiedStart++; + } + // Find the end of the differences + while (originalEnd >= originalStart && modifiedEnd >= modifiedStart && this.ElementsAreEqual(originalEnd, modifiedEnd)) { + originalEnd--; + modifiedEnd--; + } + // In the special case where we either have all insertions or all deletions or the sequences are identical + if (originalStart > originalEnd || modifiedStart > modifiedEnd) { + let changes; + if (modifiedStart <= modifiedEnd) { + Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd'); + // All insertions + changes = [ + new DiffChange(originalStart, 0, modifiedStart, modifiedEnd - modifiedStart + 1) + ]; + } + else if (originalStart <= originalEnd) { + Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd'); + // All deletions + changes = [ + new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, 0) + ]; + } + else { + Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd'); + Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd'); + // Identical sequences - No differences + changes = []; + } + return changes; + } + // This problem can be solved using the Divide-And-Conquer technique. + const midOriginalArr = [0]; + const midModifiedArr = [0]; + const result = this.ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr); + const midOriginal = midOriginalArr[0]; + const midModified = midModifiedArr[0]; + if (result !== null) { + // Result is not-null when there was enough memory to compute the changes while + // searching for the recursion point + return result; + } + else if (!quitEarlyArr[0]) { + // We can break the problem down recursively by finding the changes in the + // First Half: (originalStart, modifiedStart) to (midOriginal, midModified) + // Second Half: (midOriginal + 1, minModified + 1) to (originalEnd, modifiedEnd) + // NOTE: ComputeDiff() is inclusive, therefore the second range starts on the next point + const leftChanges = this.ComputeDiffRecursive(originalStart, midOriginal, modifiedStart, midModified, quitEarlyArr); + let rightChanges = []; + if (!quitEarlyArr[0]) { + rightChanges = this.ComputeDiffRecursive(midOriginal + 1, originalEnd, midModified + 1, modifiedEnd, quitEarlyArr); + } + else { + // We didn't have time to finish the first half, so we don't have time to compute this half. + // Consider the entire rest of the sequence different. + rightChanges = [ + new DiffChange(midOriginal + 1, originalEnd - (midOriginal + 1) + 1, midModified + 1, modifiedEnd - (midModified + 1) + 1) + ]; + } + return this.ConcatenateChanges(leftChanges, rightChanges); + } + // If we hit here, we quit early, and so can't return anything meaningful + return [ + new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1) + ]; + } + WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr) { + let forwardChanges = null; + let reverseChanges = null; + // First, walk backward through the forward diagonals history + let changeHelper = new DiffChangeHelper(); + let diagonalMin = diagonalForwardStart; + let diagonalMax = diagonalForwardEnd; + let diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalForwardOffset; + let lastOriginalIndex = -1073741824 /* Constants.MIN_SAFE_SMALL_INTEGER */; + let historyIndex = this.m_forwardHistory.length - 1; + do { + // Get the diagonal index from the relative diagonal number + const diagonal = diagonalRelative + diagonalForwardBase; + // Figure out where we came from + if (diagonal === diagonalMin || (diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) { + // Vertical line (the element is an insert) + originalIndex = forwardPoints[diagonal + 1]; + modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset; + if (originalIndex < lastOriginalIndex) { + changeHelper.MarkNextChange(); + } + lastOriginalIndex = originalIndex; + changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex); + diagonalRelative = (diagonal + 1) - diagonalForwardBase; //Setup for the next iteration + } + else { + // Horizontal line (the element is a deletion) + originalIndex = forwardPoints[diagonal - 1] + 1; + modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset; + if (originalIndex < lastOriginalIndex) { + changeHelper.MarkNextChange(); + } + lastOriginalIndex = originalIndex - 1; + changeHelper.AddOriginalElement(originalIndex, modifiedIndex + 1); + diagonalRelative = (diagonal - 1) - diagonalForwardBase; //Setup for the next iteration + } + if (historyIndex >= 0) { + forwardPoints = this.m_forwardHistory[historyIndex]; + diagonalForwardBase = forwardPoints[0]; //We stored this in the first spot + diagonalMin = 1; + diagonalMax = forwardPoints.length - 1; + } + } while (--historyIndex >= -1); + // Ironically, we get the forward changes as the reverse of the + // order we added them since we technically added them backwards + forwardChanges = changeHelper.getReverseChanges(); + if (quitEarlyArr[0]) { + // TODO: Calculate a partial from the reverse diagonals. + // For now, just assume everything after the midOriginal/midModified point is a diff + let originalStartPoint = midOriginalArr[0] + 1; + let modifiedStartPoint = midModifiedArr[0] + 1; + if (forwardChanges !== null && forwardChanges.length > 0) { + const lastForwardChange = forwardChanges[forwardChanges.length - 1]; + originalStartPoint = Math.max(originalStartPoint, lastForwardChange.getOriginalEnd()); + modifiedStartPoint = Math.max(modifiedStartPoint, lastForwardChange.getModifiedEnd()); + } + reverseChanges = [ + new DiffChange(originalStartPoint, originalEnd - originalStartPoint + 1, modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1) + ]; + } + else { + // Now walk backward through the reverse diagonals history + changeHelper = new DiffChangeHelper(); + diagonalMin = diagonalReverseStart; + diagonalMax = diagonalReverseEnd; + diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalReverseOffset; + lastOriginalIndex = 1073741824 /* Constants.MAX_SAFE_SMALL_INTEGER */; + historyIndex = (deltaIsEven) ? this.m_reverseHistory.length - 1 : this.m_reverseHistory.length - 2; + do { + // Get the diagonal index from the relative diagonal number + const diagonal = diagonalRelative + diagonalReverseBase; + // Figure out where we came from + if (diagonal === diagonalMin || (diagonal < diagonalMax && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) { + // Horizontal line (the element is a deletion)) + originalIndex = reversePoints[diagonal + 1] - 1; + modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset; + if (originalIndex > lastOriginalIndex) { + changeHelper.MarkNextChange(); + } + lastOriginalIndex = originalIndex + 1; + changeHelper.AddOriginalElement(originalIndex + 1, modifiedIndex + 1); + diagonalRelative = (diagonal + 1) - diagonalReverseBase; //Setup for the next iteration + } + else { + // Vertical line (the element is an insertion) + originalIndex = reversePoints[diagonal - 1]; + modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset; + if (originalIndex > lastOriginalIndex) { + changeHelper.MarkNextChange(); + } + lastOriginalIndex = originalIndex; + changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex + 1); + diagonalRelative = (diagonal - 1) - diagonalReverseBase; //Setup for the next iteration + } + if (historyIndex >= 0) { + reversePoints = this.m_reverseHistory[historyIndex]; + diagonalReverseBase = reversePoints[0]; //We stored this in the first spot + diagonalMin = 1; + diagonalMax = reversePoints.length - 1; + } + } while (--historyIndex >= -1); + // There are cases where the reverse history will find diffs that + // are correct, but not intuitive, so we need shift them. + reverseChanges = changeHelper.getChanges(); + } + return this.ConcatenateChanges(forwardChanges, reverseChanges); + } + /** + * Given the range to compute the diff on, this method finds the point: + * (midOriginal, midModified) + * that exists in the middle of the LCS of the two sequences and + * is the point at which the LCS problem may be broken down recursively. + * This method will try to keep the LCS trace in memory. If the LCS recursion + * point is calculated and the full trace is available in memory, then this method + * will return the change list. + * @param originalStart The start bound of the original sequence range + * @param originalEnd The end bound of the original sequence range + * @param modifiedStart The start bound of the modified sequence range + * @param modifiedEnd The end bound of the modified sequence range + * @param midOriginal The middle point of the original sequence range + * @param midModified The middle point of the modified sequence range + * @returns The diff changes, if available, otherwise null + */ + ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr) { + let originalIndex = 0, modifiedIndex = 0; + let diagonalForwardStart = 0, diagonalForwardEnd = 0; + let diagonalReverseStart = 0, diagonalReverseEnd = 0; + // To traverse the edit graph and produce the proper LCS, our actual + // start position is just outside the given boundary + originalStart--; + modifiedStart--; + // We set these up to make the compiler happy, but they will + // be replaced before we return with the actual recursion point + midOriginalArr[0] = 0; + midModifiedArr[0] = 0; + // Clear out the history + this.m_forwardHistory = []; + this.m_reverseHistory = []; + // Each cell in the two arrays corresponds to a diagonal in the edit graph. + // The integer value in the cell represents the originalIndex of the furthest + // reaching point found so far that ends in that diagonal. + // The modifiedIndex can be computed mathematically from the originalIndex and the diagonal number. + const maxDifferences = (originalEnd - originalStart) + (modifiedEnd - modifiedStart); + const numDiagonals = maxDifferences + 1; + const forwardPoints = new Int32Array(numDiagonals); + const reversePoints = new Int32Array(numDiagonals); + // diagonalForwardBase: Index into forwardPoints of the diagonal which passes through (originalStart, modifiedStart) + // diagonalReverseBase: Index into reversePoints of the diagonal which passes through (originalEnd, modifiedEnd) + const diagonalForwardBase = (modifiedEnd - modifiedStart); + const diagonalReverseBase = (originalEnd - originalStart); + // diagonalForwardOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the + // diagonal number (relative to diagonalForwardBase) + // diagonalReverseOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the + // diagonal number (relative to diagonalReverseBase) + const diagonalForwardOffset = (originalStart - modifiedStart); + const diagonalReverseOffset = (originalEnd - modifiedEnd); + // delta: The difference between the end diagonal and the start diagonal. This is used to relate diagonal numbers + // relative to the start diagonal with diagonal numbers relative to the end diagonal. + // The Even/Oddn-ness of this delta is important for determining when we should check for overlap + const delta = diagonalReverseBase - diagonalForwardBase; + const deltaIsEven = (delta % 2 === 0); + // Here we set up the start and end points as the furthest points found so far + // in both the forward and reverse directions, respectively + forwardPoints[diagonalForwardBase] = originalStart; + reversePoints[diagonalReverseBase] = originalEnd; + // Remember if we quit early, and thus need to do a best-effort result instead of a real result. + quitEarlyArr[0] = false; + // A couple of points: + // --With this method, we iterate on the number of differences between the two sequences. + // The more differences there actually are, the longer this will take. + // --Also, as the number of differences increases, we have to search on diagonals further + // away from the reference diagonal (which is diagonalForwardBase for forward, diagonalReverseBase for reverse). + // --We extend on even diagonals (relative to the reference diagonal) only when numDifferences + // is even and odd diagonals only when numDifferences is odd. + for (let numDifferences = 1; numDifferences <= (maxDifferences / 2) + 1; numDifferences++) { + let furthestOriginalIndex = 0; + let furthestModifiedIndex = 0; + // Run the algorithm in the forward direction + diagonalForwardStart = this.ClipDiagonalBound(diagonalForwardBase - numDifferences, numDifferences, diagonalForwardBase, numDiagonals); + diagonalForwardEnd = this.ClipDiagonalBound(diagonalForwardBase + numDifferences, numDifferences, diagonalForwardBase, numDiagonals); + for (let diagonal = diagonalForwardStart; diagonal <= diagonalForwardEnd; diagonal += 2) { + // STEP 1: We extend the furthest reaching point in the present diagonal + // by looking at the diagonals above and below and picking the one whose point + // is further away from the start point (originalStart, modifiedStart) + if (diagonal === diagonalForwardStart || (diagonal < diagonalForwardEnd && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) { + originalIndex = forwardPoints[diagonal + 1]; + } + else { + originalIndex = forwardPoints[diagonal - 1] + 1; + } + modifiedIndex = originalIndex - (diagonal - diagonalForwardBase) - diagonalForwardOffset; + // Save the current originalIndex so we can test for false overlap in step 3 + const tempOriginalIndex = originalIndex; + // STEP 2: We can continue to extend the furthest reaching point in the present diagonal + // so long as the elements are equal. + while (originalIndex < originalEnd && modifiedIndex < modifiedEnd && this.ElementsAreEqual(originalIndex + 1, modifiedIndex + 1)) { + originalIndex++; + modifiedIndex++; + } + forwardPoints[diagonal] = originalIndex; + if (originalIndex + modifiedIndex > furthestOriginalIndex + furthestModifiedIndex) { + furthestOriginalIndex = originalIndex; + furthestModifiedIndex = modifiedIndex; + } + // STEP 3: If delta is odd (overlap first happens on forward when delta is odd) + // and diagonal is in the range of reverse diagonals computed for numDifferences-1 + // (the previous iteration; we haven't computed reverse diagonals for numDifferences yet) + // then check for overlap. + if (!deltaIsEven && Math.abs(diagonal - diagonalReverseBase) <= (numDifferences - 1)) { + if (originalIndex >= reversePoints[diagonal]) { + midOriginalArr[0] = originalIndex; + midModifiedArr[0] = modifiedIndex; + if (tempOriginalIndex <= reversePoints[diagonal] && 1447 /* LocalConstants.MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* LocalConstants.MaxDifferencesHistory */ + 1)) { + // BINGO! We overlapped, and we have the full trace in memory! + return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr); + } + else { + // Either false overlap, or we didn't have enough memory for the full trace + // Just return the recursion point + return null; + } + } + } + } + // Check to see if we should be quitting early, before moving on to the next iteration. + const matchLengthOfLongest = ((furthestOriginalIndex - originalStart) + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2; + if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) { + // We can't finish, so skip ahead to generating a result from what we have. + quitEarlyArr[0] = true; + // Use the furthest distance we got in the forward direction. + midOriginalArr[0] = furthestOriginalIndex; + midModifiedArr[0] = furthestModifiedIndex; + if (matchLengthOfLongest > 0 && 1447 /* LocalConstants.MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* LocalConstants.MaxDifferencesHistory */ + 1)) { + // Enough of the history is in memory to walk it backwards + return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr); + } + else { + // We didn't actually remember enough of the history. + //Since we are quitting the diff early, we need to shift back the originalStart and modified start + //back into the boundary limits since we decremented their value above beyond the boundary limit. + originalStart++; + modifiedStart++; + return [ + new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1) + ]; + } + } + // Run the algorithm in the reverse direction + diagonalReverseStart = this.ClipDiagonalBound(diagonalReverseBase - numDifferences, numDifferences, diagonalReverseBase, numDiagonals); + diagonalReverseEnd = this.ClipDiagonalBound(diagonalReverseBase + numDifferences, numDifferences, diagonalReverseBase, numDiagonals); + for (let diagonal = diagonalReverseStart; diagonal <= diagonalReverseEnd; diagonal += 2) { + // STEP 1: We extend the furthest reaching point in the present diagonal + // by looking at the diagonals above and below and picking the one whose point + // is further away from the start point (originalEnd, modifiedEnd) + if (diagonal === diagonalReverseStart || (diagonal < diagonalReverseEnd && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) { + originalIndex = reversePoints[diagonal + 1] - 1; + } + else { + originalIndex = reversePoints[diagonal - 1]; + } + modifiedIndex = originalIndex - (diagonal - diagonalReverseBase) - diagonalReverseOffset; + // Save the current originalIndex so we can test for false overlap + const tempOriginalIndex = originalIndex; + // STEP 2: We can continue to extend the furthest reaching point in the present diagonal + // as long as the elements are equal. + while (originalIndex > originalStart && modifiedIndex > modifiedStart && this.ElementsAreEqual(originalIndex, modifiedIndex)) { + originalIndex--; + modifiedIndex--; + } + reversePoints[diagonal] = originalIndex; + // STEP 4: If delta is even (overlap first happens on reverse when delta is even) + // and diagonal is in the range of forward diagonals computed for numDifferences + // then check for overlap. + if (deltaIsEven && Math.abs(diagonal - diagonalForwardBase) <= numDifferences) { + if (originalIndex <= forwardPoints[diagonal]) { + midOriginalArr[0] = originalIndex; + midModifiedArr[0] = modifiedIndex; + if (tempOriginalIndex >= forwardPoints[diagonal] && 1447 /* LocalConstants.MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* LocalConstants.MaxDifferencesHistory */ + 1)) { + // BINGO! We overlapped, and we have the full trace in memory! + return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr); + } + else { + // Either false overlap, or we didn't have enough memory for the full trace + // Just return the recursion point + return null; + } + } + } + } + // Save current vectors to history before the next iteration + if (numDifferences <= 1447 /* LocalConstants.MaxDifferencesHistory */) { + // We are allocating space for one extra int, which we fill with + // the index of the diagonal base index + let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2); + temp[0] = diagonalForwardBase - diagonalForwardStart + 1; + MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1); + this.m_forwardHistory.push(temp); + temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2); + temp[0] = diagonalReverseBase - diagonalReverseStart + 1; + MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1); + this.m_reverseHistory.push(temp); + } + } + // If we got here, then we have the full trace in history. We just have to convert it to a change list + // NOTE: This part is a bit messy + return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr); + } + /** + * Shifts the given changes to provide a more intuitive diff. + * While the first element in a diff matches the first element after the diff, + * we shift the diff down. + * + * @param changes The list of changes to shift + * @returns The shifted changes + */ + PrettifyChanges(changes) { + // Shift all the changes down first + for (let i = 0; i < changes.length; i++) { + const change = changes[i]; + const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this._originalElementsOrHash.length; + const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length; + const checkOriginal = change.originalLength > 0; + const checkModified = change.modifiedLength > 0; + while (change.originalStart + change.originalLength < originalStop + && change.modifiedStart + change.modifiedLength < modifiedStop + && (!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength)) + && (!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) { + const startStrictEqual = this.ElementsAreStrictEqual(change.originalStart, change.modifiedStart); + const endStrictEqual = this.ElementsAreStrictEqual(change.originalStart + change.originalLength, change.modifiedStart + change.modifiedLength); + if (endStrictEqual && !startStrictEqual) { + // moving the change down would create an equal change, but the elements are not strict equal + break; + } + change.originalStart++; + change.modifiedStart++; + } + const mergedChangeArr = [null]; + if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) { + changes[i] = mergedChangeArr[0]; + changes.splice(i + 1, 1); + i--; + continue; + } + } + // Shift changes back up until we hit empty or whitespace-only lines + for (let i = changes.length - 1; i >= 0; i--) { + const change = changes[i]; + let originalStop = 0; + let modifiedStop = 0; + if (i > 0) { + const prevChange = changes[i - 1]; + originalStop = prevChange.originalStart + prevChange.originalLength; + modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength; + } + const checkOriginal = change.originalLength > 0; + const checkModified = change.modifiedLength > 0; + let bestDelta = 0; + let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength); + for (let delta = 1;; delta++) { + const originalStart = change.originalStart - delta; + const modifiedStart = change.modifiedStart - delta; + if (originalStart < originalStop || modifiedStart < modifiedStop) { + break; + } + if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) { + break; + } + if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) { + break; + } + const touchingPreviousChange = (originalStart === originalStop && modifiedStart === modifiedStop); + const score = ((touchingPreviousChange ? 5 : 0) + + this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength)); + if (score > bestScore) { + bestScore = score; + bestDelta = delta; + } + } + change.originalStart -= bestDelta; + change.modifiedStart -= bestDelta; + const mergedChangeArr = [null]; + if (i > 0 && this.ChangesOverlap(changes[i - 1], changes[i], mergedChangeArr)) { + changes[i - 1] = mergedChangeArr[0]; + changes.splice(i, 1); + i++; + continue; + } + } + // There could be multiple longest common substrings. + // Give preference to the ones containing longer lines + if (this._hasStrings) { + for (let i = 1, len = changes.length; i < len; i++) { + const aChange = changes[i - 1]; + const bChange = changes[i]; + const matchedLength = bChange.originalStart - aChange.originalStart - aChange.originalLength; + const aOriginalStart = aChange.originalStart; + const bOriginalEnd = bChange.originalStart + bChange.originalLength; + const abOriginalLength = bOriginalEnd - aOriginalStart; + const aModifiedStart = aChange.modifiedStart; + const bModifiedEnd = bChange.modifiedStart + bChange.modifiedLength; + const abModifiedLength = bModifiedEnd - aModifiedStart; + // Avoid wasting a lot of time with these searches + if (matchedLength < 5 && abOriginalLength < 20 && abModifiedLength < 20) { + const t = this._findBetterContiguousSequence(aOriginalStart, abOriginalLength, aModifiedStart, abModifiedLength, matchedLength); + if (t) { + const [originalMatchStart, modifiedMatchStart] = t; + if (originalMatchStart !== aChange.originalStart + aChange.originalLength || modifiedMatchStart !== aChange.modifiedStart + aChange.modifiedLength) { + // switch to another sequence that has a better score + aChange.originalLength = originalMatchStart - aChange.originalStart; + aChange.modifiedLength = modifiedMatchStart - aChange.modifiedStart; + bChange.originalStart = originalMatchStart + matchedLength; + bChange.modifiedStart = modifiedMatchStart + matchedLength; + bChange.originalLength = bOriginalEnd - bChange.originalStart; + bChange.modifiedLength = bModifiedEnd - bChange.modifiedStart; + } + } + } + } + } + return changes; + } + _findBetterContiguousSequence(originalStart, originalLength, modifiedStart, modifiedLength, desiredLength) { + if (originalLength < desiredLength || modifiedLength < desiredLength) { + return null; + } + const originalMax = originalStart + originalLength - desiredLength + 1; + const modifiedMax = modifiedStart + modifiedLength - desiredLength + 1; + let bestScore = 0; + let bestOriginalStart = 0; + let bestModifiedStart = 0; + for (let i = originalStart; i < originalMax; i++) { + for (let j = modifiedStart; j < modifiedMax; j++) { + const score = this._contiguousSequenceScore(i, j, desiredLength); + if (score > 0 && score > bestScore) { + bestScore = score; + bestOriginalStart = i; + bestModifiedStart = j; + } + } + } + if (bestScore > 0) { + return [bestOriginalStart, bestModifiedStart]; + } + return null; + } + _contiguousSequenceScore(originalStart, modifiedStart, length) { + let score = 0; + for (let l = 0; l < length; l++) { + if (!this.ElementsAreEqual(originalStart + l, modifiedStart + l)) { + return 0; + } + score += this._originalStringElements[originalStart + l].length; + } + return score; + } + _OriginalIsBoundary(index) { + if (index <= 0 || index >= this._originalElementsOrHash.length - 1) { + return true; + } + return (this._hasStrings && /^\s*$/.test(this._originalStringElements[index])); + } + _OriginalRegionIsBoundary(originalStart, originalLength) { + if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) { + return true; + } + if (originalLength > 0) { + const originalEnd = originalStart + originalLength; + if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) { + return true; + } + } + return false; + } + _ModifiedIsBoundary(index) { + if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) { + return true; + } + return (this._hasStrings && /^\s*$/.test(this._modifiedStringElements[index])); + } + _ModifiedRegionIsBoundary(modifiedStart, modifiedLength) { + if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) { + return true; + } + if (modifiedLength > 0) { + const modifiedEnd = modifiedStart + modifiedLength; + if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) { + return true; + } + } + return false; + } + _boundaryScore(originalStart, originalLength, modifiedStart, modifiedLength) { + const originalScore = (this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0); + const modifiedScore = (this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0); + return (originalScore + modifiedScore); + } + /** + * Concatenates the two input DiffChange lists and returns the resulting + * list. + * @param The left changes + * @param The right changes + * @returns The concatenated list + */ + ConcatenateChanges(left, right) { + const mergedChangeArr = []; + if (left.length === 0 || right.length === 0) { + return (right.length > 0) ? right : left; + } + else if (this.ChangesOverlap(left[left.length - 1], right[0], mergedChangeArr)) { + // Since we break the problem down recursively, it is possible that we + // might recurse in the middle of a change thereby splitting it into + // two changes. Here in the combining stage, we detect and fuse those + // changes back together + const result = new Array(left.length + right.length - 1); + MyArray.Copy(left, 0, result, 0, left.length - 1); + result[left.length - 1] = mergedChangeArr[0]; + MyArray.Copy(right, 1, result, left.length, right.length - 1); + return result; + } + else { + const result = new Array(left.length + right.length); + MyArray.Copy(left, 0, result, 0, left.length); + MyArray.Copy(right, 0, result, left.length, right.length); + return result; + } + } + /** + * Returns true if the two changes overlap and can be merged into a single + * change + * @param left The left change + * @param right The right change + * @param mergedChange The merged change if the two overlap, null otherwise + * @returns True if the two changes overlap + */ + ChangesOverlap(left, right, mergedChangeArr) { + Debug.Assert(left.originalStart <= right.originalStart, 'Left change is not less than or equal to right change'); + Debug.Assert(left.modifiedStart <= right.modifiedStart, 'Left change is not less than or equal to right change'); + if (left.originalStart + left.originalLength >= right.originalStart || left.modifiedStart + left.modifiedLength >= right.modifiedStart) { + const originalStart = left.originalStart; + let originalLength = left.originalLength; + const modifiedStart = left.modifiedStart; + let modifiedLength = left.modifiedLength; + if (left.originalStart + left.originalLength >= right.originalStart) { + originalLength = right.originalStart + right.originalLength - left.originalStart; + } + if (left.modifiedStart + left.modifiedLength >= right.modifiedStart) { + modifiedLength = right.modifiedStart + right.modifiedLength - left.modifiedStart; + } + mergedChangeArr[0] = new DiffChange(originalStart, originalLength, modifiedStart, modifiedLength); + return true; + } + else { + mergedChangeArr[0] = null; + return false; + } + } + /** + * Helper method used to clip a diagonal index to the range of valid + * diagonals. This also decides whether or not the diagonal index, + * if it exceeds the boundary, should be clipped to the boundary or clipped + * one inside the boundary depending on the Even/Odd status of the boundary + * and numDifferences. + * @param diagonal The index of the diagonal to clip. + * @param numDifferences The current number of differences being iterated upon. + * @param diagonalBaseIndex The base reference diagonal. + * @param numDiagonals The total number of diagonals. + * @returns The clipped diagonal index. + */ + ClipDiagonalBound(diagonal, numDifferences, diagonalBaseIndex, numDiagonals) { + if (diagonal >= 0 && diagonal < numDiagonals) { + // Nothing to clip, its in range + return diagonal; + } + // diagonalsBelow: The number of diagonals below the reference diagonal + // diagonalsAbove: The number of diagonals above the reference diagonal + const diagonalsBelow = diagonalBaseIndex; + const diagonalsAbove = numDiagonals - diagonalBaseIndex - 1; + const diffEven = (numDifferences % 2 === 0); + if (diagonal < 0) { + const lowerBoundEven = (diagonalsBelow % 2 === 0); + return (diffEven === lowerBoundEven) ? 0 : 1; + } + else { + const upperBoundEven = (diagonalsAbove % 2 === 0); + return (diffEven === upperBoundEven) ? numDiagonals - 1 : numDiagonals - 2; + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js new file mode 100644 index 0000000000000000000000000000000000000000..86006ff178d20d48032d71e6c207abf864e02abb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/** + * Represents information about a specific difference between two sequences. + */ +export class DiffChange { + /** + * Constructs a new DiffChange with the given sequence information + * and content. + */ + constructor(originalStart, originalLength, modifiedStart, modifiedLength) { + //Debug.Assert(originalLength > 0 || modifiedLength > 0, "originalLength and modifiedLength cannot both be <= 0"); + this.originalStart = originalStart; + this.originalLength = originalLength; + this.modifiedStart = modifiedStart; + this.modifiedLength = modifiedLength; + } + /** + * The end point (exclusive) of the change in the original sequence. + */ + getOriginalEnd() { + return this.originalStart + this.originalLength; + } + /** + * The end point (exclusive) of the change in the modified sequence. + */ + getModifiedEnd() { + return this.modifiedStart + this.modifiedLength; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/equals.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/equals.js new file mode 100644 index 0000000000000000000000000000000000000000..52bb4b023e582bac38dfc590b55d954fe9ad6c9d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/equals.js @@ -0,0 +1,82 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as arrays from './arrays.js'; +/** + * Compares two items for equality using strict equality. +*/ +export const strictEquals = (a, b) => a === b; +/** + * Checks if the items of two arrays are equal. + * By default, strict equality is used to compare elements, but a custom equality comparer can be provided. + */ +export function itemsEquals(itemEquals = strictEquals) { + return (a, b) => arrays.equals(a, b, itemEquals); +} +/** + * Uses `item.equals(other)` to determine equality. + */ +export function itemEquals() { + return (a, b) => a.equals(b); +} +export function equalsIfDefined(equalsOrV1, v2, equals) { + if (equals !== undefined) { + const v1 = equalsOrV1; + if (v1 === undefined || v1 === null || v2 === undefined || v2 === null) { + return v2 === v1; + } + return equals(v1, v2); + } + else { + const equals = equalsOrV1; + return (v1, v2) => { + if (v1 === undefined || v1 === null || v2 === undefined || v2 === null) { + return v2 === v1; + } + return equals(v1, v2); + }; + } +} +/** + * Drills into arrays (items ordered) and objects (keys unordered) and uses strict equality on everything else. +*/ +export function structuralEquals(a, b) { + if (a === b) { + return true; + } + if (Array.isArray(a) && Array.isArray(b)) { + if (a.length !== b.length) { + return false; + } + for (let i = 0; i < a.length; i++) { + if (!structuralEquals(a[i], b[i])) { + return false; + } + } + return true; + } + if (a && typeof a === 'object' && b && typeof b === 'object') { + if (Object.getPrototypeOf(a) === Object.prototype && Object.getPrototypeOf(b) === Object.prototype) { + const aObj = a; + const bObj = b; + const keysA = Object.keys(aObj); + const keysB = Object.keys(bObj); + const keysBSet = new Set(keysB); + if (keysA.length !== keysB.length) { + return false; + } + for (const key of keysA) { + if (!keysBSet.has(key)) { + return false; + } + if (!structuralEquals(aObj[key], bObj[key])) { + return false; + } + } + return true; + } + } + return false; +} +const objIds = new WeakMap(); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/errorMessage.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/errorMessage.js new file mode 100644 index 0000000000000000000000000000000000000000..4cb4e1442d8b5433ed72833a78f9c7403482449c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/errorMessage.js @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as arrays from './arrays.js'; +import * as types from './types.js'; +import * as nls from '../../nls.js'; +function exceptionToErrorMessage(exception, verbose) { + if (verbose && (exception.stack || exception.stacktrace)) { + return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace)); + } + return detectSystemErrorMessage(exception); +} +function stackToString(stack) { + if (Array.isArray(stack)) { + return stack.join('\n'); + } + return stack; +} +function detectSystemErrorMessage(exception) { + // Custom node.js error from us + if (exception.code === 'ERR_UNC_HOST_NOT_ALLOWED') { + return `${exception.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`; + } + // See https://nodejs.org/api/errors.html#errors_class_system_error + if (typeof exception.code === 'string' && typeof exception.errno === 'number' && typeof exception.syscall === 'string') { + return nls.localize('nodeExceptionMessage', "A system error occurred ({0})", exception.message); + } + return exception.message || nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); +} +/** + * Tries to generate a human readable error message out of the error. If the verbose parameter + * is set to true, the error message will include stacktrace details if provided. + * + * @returns A string containing the error message. + */ +export function toErrorMessage(error = null, verbose = false) { + if (!error) { + return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); + } + if (Array.isArray(error)) { + const errors = arrays.coalesce(error); + const msg = toErrorMessage(errors[0], verbose); + if (errors.length > 1) { + return nls.localize('error.moreErrors', "{0} ({1} errors in total)", msg, errors.length); + } + return msg; + } + if (types.isString(error)) { + return error; + } + if (error.detail) { + const detail = error.detail; + if (detail.error) { + return exceptionToErrorMessage(detail.error, verbose); + } + if (detail.exception) { + return exceptionToErrorMessage(detail.exception, verbose); + } + } + if (error.stack) { + return exceptionToErrorMessage(error, verbose); + } + if (error.message) { + return error.message; + } + return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/errors.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..03c40ae920501ba49e568bf0e7d1010d1be92c82 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/errors.js @@ -0,0 +1,150 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// Avoid circular dependency on EventEmitter by implementing a subset of the interface. +export class ErrorHandler { + constructor() { + this.listeners = []; + this.unexpectedErrorHandler = function (e) { + setTimeout(() => { + if (e.stack) { + if (ErrorNoTelemetry.isErrorNoTelemetry(e)) { + throw new ErrorNoTelemetry(e.message + '\n\n' + e.stack); + } + throw new Error(e.message + '\n\n' + e.stack); + } + throw e; + }, 0); + }; + } + emit(e) { + this.listeners.forEach((listener) => { + listener(e); + }); + } + onUnexpectedError(e) { + this.unexpectedErrorHandler(e); + this.emit(e); + } + // For external errors, we don't want the listeners to be called + onUnexpectedExternalError(e) { + this.unexpectedErrorHandler(e); + } +} +export const errorHandler = new ErrorHandler(); +export function onUnexpectedError(e) { + // ignore errors from cancelled promises + if (!isCancellationError(e)) { + errorHandler.onUnexpectedError(e); + } + return undefined; +} +export function onUnexpectedExternalError(e) { + // ignore errors from cancelled promises + if (!isCancellationError(e)) { + errorHandler.onUnexpectedExternalError(e); + } + return undefined; +} +export function transformErrorForSerialization(error) { + if (error instanceof Error) { + const { name, message } = error; + const stack = error.stacktrace || error.stack; + return { + $isError: true, + name, + message, + stack, + noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error) + }; + } + // return as is + return error; +} +const canceledName = 'Canceled'; +/** + * Checks if the given error is a promise in canceled state + */ +export function isCancellationError(error) { + if (error instanceof CancellationError) { + return true; + } + return error instanceof Error && error.name === canceledName && error.message === canceledName; +} +// !!!IMPORTANT!!! +// Do NOT change this class because it is also used as an API-type. +export class CancellationError extends Error { + constructor() { + super(canceledName); + this.name = this.message; + } +} +/** + * @deprecated use {@link CancellationError `new CancellationError()`} instead + */ +export function canceled() { + const error = new Error(canceledName); + error.name = error.message; + return error; +} +export function illegalArgument(name) { + if (name) { + return new Error(`Illegal argument: ${name}`); + } + else { + return new Error('Illegal argument'); + } +} +export function illegalState(name) { + if (name) { + return new Error(`Illegal state: ${name}`); + } + else { + return new Error('Illegal state'); + } +} +export class NotSupportedError extends Error { + constructor(message) { + super('NotSupported'); + if (message) { + this.message = message; + } + } +} +/** + * Error that when thrown won't be logged in telemetry as an unhandled error. + */ +export class ErrorNoTelemetry extends Error { + constructor(msg) { + super(msg); + this.name = 'CodeExpectedError'; + } + static fromError(err) { + if (err instanceof ErrorNoTelemetry) { + return err; + } + const result = new ErrorNoTelemetry(); + result.message = err.message; + result.stack = err.stack; + return result; + } + static isErrorNoTelemetry(err) { + return err.name === 'CodeExpectedError'; + } +} +/** + * This error indicates a bug. + * Do not throw this for invalid user input. + * Only catch this error to recover gracefully from bugs. + */ +export class BugIndicatingError extends Error { + constructor(message) { + super(message || 'An unexpected bug occurred.'); + Object.setPrototypeOf(this, BugIndicatingError.prototype); + // Because we know for sure only buggy code throws this, + // we definitely want to break here and fix the bug. + // eslint-disable-next-line no-debugger + // debugger; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/event.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/event.js new file mode 100644 index 0000000000000000000000000000000000000000..e027a926f42b7395dfd24e754dcaf180e8f9c782 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/event.js @@ -0,0 +1,1280 @@ +import { onUnexpectedError } from './errors.js'; +import { createSingleCallFunction } from './functional.js'; +import { combinedDisposable, Disposable, DisposableStore, toDisposable } from './lifecycle.js'; +import { LinkedList } from './linkedList.js'; +import { StopWatch } from './stopwatch.js'; +// ----------------------------------------------------------------------------------------------------------------------- +// Uncomment the next line to print warnings whenever a listener is GC'ed without having been disposed. This is a LEAK. +// ----------------------------------------------------------------------------------------------------------------------- +const _enableListenerGCedWarning = false; +// ----------------------------------------------------------------------------------------------------------------------- +// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell. +// ----------------------------------------------------------------------------------------------------------------------- +const _enableDisposeWithListenerWarning = false; +// ----------------------------------------------------------------------------------------------------------------------- +// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup. +// See https://github.com/microsoft/vscode/issues/142851 +// ----------------------------------------------------------------------------------------------------------------------- +const _enableSnapshotPotentialLeakWarning = false; +export var Event; +(function (Event) { + Event.None = () => Disposable.None; + function _addLeakageTraceLogic(options) { + if (_enableSnapshotPotentialLeakWarning) { + const { onDidAddListener: origListenerDidAdd } = options; + const stack = Stacktrace.create(); + let count = 0; + options.onDidAddListener = () => { + if (++count === 2) { + console.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here'); + stack.print(); + } + origListenerDidAdd?.(); + }; + } + } + /** + * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared + * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a + * result of merging events and to try prevent race conditions that could arise when using related deferred and + * non-deferred events. + * + * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work + * (eg. latency of keypress to text rendered). + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + * + * @param event The event source for the new event. + * @param disposable A disposable store to add the new EventEmitter to. + */ + function defer(event, disposable) { + return debounce(event, () => void 0, 0, undefined, true, undefined, disposable); + } + Event.defer = defer; + /** + * Given an event, returns another event which only fires once. + * + * @param event The event source for the new event. + */ + function once(event) { + return (listener, thisArgs = null, disposables) => { + // we need this, in case the event fires during the listener call + let didFire = false; + let result = undefined; + result = event(e => { + if (didFire) { + return; + } + else if (result) { + result.dispose(); + } + else { + didFire = true; + } + return listener.call(thisArgs, e); + }, null, disposables); + if (didFire) { + result.dispose(); + } + return result; + }; + } + Event.once = once; + /** + * Given an event, returns another event which only fires once, and only when the condition is met. + * + * @param event The event source for the new event. + */ + function onceIf(event, condition) { + return Event.once(Event.filter(event, condition)); + } + Event.onceIf = onceIf; + /** + * Maps an event of one type into an event of another type using a mapping function, similar to how + * `Array.prototype.map` works. + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + * + * @param event The event source for the new event. + * @param map The mapping function. + * @param disposable A disposable store to add the new EventEmitter to. + */ + function map(event, map, disposable) { + return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable); + } + Event.map = map; + /** + * Wraps an event in another event that performs some function on the event object before firing. + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + * + * @param event The event source for the new event. + * @param each The function to perform on the event object. + * @param disposable A disposable store to add the new EventEmitter to. + */ + function forEach(event, each, disposable) { + return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable); + } + Event.forEach = forEach; + function filter(event, filter, disposable) { + return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable); + } + Event.filter = filter; + /** + * Given an event, returns the same event but typed as `Event`. + */ + function signal(event) { + return event; + } + Event.signal = signal; + function any(...events) { + return (listener, thisArgs = null, disposables) => { + const disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e)))); + return addAndReturnDisposable(disposable, disposables); + }; + } + Event.any = any; + /** + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + */ + function reduce(event, merge, initial, disposable) { + let output = initial; + return map(event, e => { + output = merge(output, e); + return output; + }, disposable); + } + Event.reduce = reduce; + function snapshot(event, disposable) { + let listener; + const options = { + onWillAddFirstListener() { + listener = event(emitter.fire, emitter); + }, + onDidRemoveLastListener() { + listener?.dispose(); + } + }; + if (!disposable) { + _addLeakageTraceLogic(options); + } + const emitter = new Emitter(options); + disposable?.add(emitter); + return emitter.event; + } + /** + * Adds the IDisposable to the store if it's set, and returns it. Useful to + * Event function implementation. + */ + function addAndReturnDisposable(d, store) { + if (store instanceof Array) { + store.push(d); + } + else if (store) { + store.add(d); + } + return d; + } + function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) { + let subscription; + let output = undefined; + let handle = undefined; + let numDebouncedCalls = 0; + let doFire; + const options = { + leakWarningThreshold, + onWillAddFirstListener() { + subscription = event(cur => { + numDebouncedCalls++; + output = merge(output, cur); + if (leading && !handle) { + emitter.fire(output); + output = undefined; + } + doFire = () => { + const _output = output; + output = undefined; + handle = undefined; + if (!leading || numDebouncedCalls > 1) { + emitter.fire(_output); + } + numDebouncedCalls = 0; + }; + if (typeof delay === 'number') { + clearTimeout(handle); + handle = setTimeout(doFire, delay); + } + else { + if (handle === undefined) { + handle = 0; + queueMicrotask(doFire); + } + } + }); + }, + onWillRemoveListener() { + if (flushOnListenerRemove && numDebouncedCalls > 0) { + doFire?.(); + } + }, + onDidRemoveLastListener() { + doFire = undefined; + subscription.dispose(); + } + }; + if (!disposable) { + _addLeakageTraceLogic(options); + } + const emitter = new Emitter(options); + disposable?.add(emitter); + return emitter.event; + } + Event.debounce = debounce; + /** + * Debounces an event, firing after some delay (default=0) with an array of all event original objects. + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + */ + function accumulate(event, delay = 0, disposable) { + return Event.debounce(event, (last, e) => { + if (!last) { + return [e]; + } + last.push(e); + return last; + }, delay, undefined, true, undefined, disposable); + } + Event.accumulate = accumulate; + /** + * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate + * event objects from different sources do not fire the same event object. + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + * + * @param event The event source for the new event. + * @param equals The equality condition. + * @param disposable A disposable store to add the new EventEmitter to. + * + * @example + * ``` + * // Fire only one time when a single window is opened or focused + * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow)) + * ``` + */ + function latch(event, equals = (a, b) => a === b, disposable) { + let firstCall = true; + let cache; + return filter(event, value => { + const shouldEmit = firstCall || !equals(value, cache); + firstCall = false; + cache = value; + return shouldEmit; + }, disposable); + } + Event.latch = latch; + /** + * Splits an event whose parameter is a union type into 2 separate events for each type in the union. + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + * + * @example + * ``` + * const event = new EventEmitter().event; + * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined); + * ``` + * + * @param event The event source for the new event. + * @param isT A function that determines what event is of the first type. + * @param disposable A disposable store to add the new EventEmitter to. + */ + function split(event, isT, disposable) { + return [ + Event.filter(event, isT, disposable), + Event.filter(event, e => !isT(e), disposable), + ]; + } + Event.split = split; + /** + * Buffers an event until it has a listener attached. + * + * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned + * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the + * returned event causes this utility to leak a listener on the original event. + * + * @param event The event source for the new event. + * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a + * `setTimeout` when the first event listener is added. + * @param _buffer Internal: A source event array used for tests. + * + * @example + * ``` + * // Start accumulating events, when the first listener is attached, flush + * // the event after a timeout such that multiple listeners attached before + * // the timeout would receive the event + * this.onInstallExtension = Event.buffer(service.onInstallExtension, true); + * ``` + */ + function buffer(event, flushAfterTimeout = false, _buffer = [], disposable) { + let buffer = _buffer.slice(); + let listener = event(e => { + if (buffer) { + buffer.push(e); + } + else { + emitter.fire(e); + } + }); + if (disposable) { + disposable.add(listener); + } + const flush = () => { + buffer?.forEach(e => emitter.fire(e)); + buffer = null; + }; + const emitter = new Emitter({ + onWillAddFirstListener() { + if (!listener) { + listener = event(e => emitter.fire(e)); + if (disposable) { + disposable.add(listener); + } + } + }, + onDidAddFirstListener() { + if (buffer) { + if (flushAfterTimeout) { + setTimeout(flush); + } + else { + flush(); + } + } + }, + onDidRemoveLastListener() { + if (listener) { + listener.dispose(); + } + listener = null; + } + }); + if (disposable) { + disposable.add(emitter); + } + return emitter.event; + } + Event.buffer = buffer; + /** + * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style. + * + * @example + * ``` + * // Normal + * const onEnterPressNormal = Event.filter( + * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)), + * e.keyCode === KeyCode.Enter + * ).event; + * + * // Using chain + * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $ + * .map(e => new StandardKeyboardEvent(e)) + * .filter(e => e.keyCode === KeyCode.Enter) + * ); + * ``` + */ + function chain(event, sythensize) { + const fn = (listener, thisArgs, disposables) => { + const cs = sythensize(new ChainableSynthesis()); + return event(function (value) { + const result = cs.evaluate(value); + if (result !== HaltChainable) { + listener.call(thisArgs, result); + } + }, undefined, disposables); + }; + return fn; + } + Event.chain = chain; + const HaltChainable = Symbol('HaltChainable'); + class ChainableSynthesis { + constructor() { + this.steps = []; + } + map(fn) { + this.steps.push(fn); + return this; + } + forEach(fn) { + this.steps.push(v => { + fn(v); + return v; + }); + return this; + } + filter(fn) { + this.steps.push(v => fn(v) ? v : HaltChainable); + return this; + } + reduce(merge, initial) { + let last = initial; + this.steps.push(v => { + last = merge(last, v); + return last; + }); + return this; + } + latch(equals = (a, b) => a === b) { + let firstCall = true; + let cache; + this.steps.push(value => { + const shouldEmit = firstCall || !equals(value, cache); + firstCall = false; + cache = value; + return shouldEmit ? value : HaltChainable; + }); + return this; + } + evaluate(value) { + for (const step of this.steps) { + value = step(value); + if (value === HaltChainable) { + break; + } + } + return value; + } + } + /** + * Creates an {@link Event} from a node event emitter. + */ + function fromNodeEventEmitter(emitter, eventName, map = id => id) { + const fn = (...args) => result.fire(map(...args)); + const onFirstListenerAdd = () => emitter.on(eventName, fn); + const onLastListenerRemove = () => emitter.removeListener(eventName, fn); + const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove }); + return result.event; + } + Event.fromNodeEventEmitter = fromNodeEventEmitter; + /** + * Creates an {@link Event} from a DOM event emitter. + */ + function fromDOMEventEmitter(emitter, eventName, map = id => id) { + const fn = (...args) => result.fire(map(...args)); + const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn); + const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn); + const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove }); + return result.event; + } + Event.fromDOMEventEmitter = fromDOMEventEmitter; + /** + * Creates a promise out of an event, using the {@link Event.once} helper. + */ + function toPromise(event) { + return new Promise(resolve => once(event)(resolve)); + } + Event.toPromise = toPromise; + /** + * Creates an event out of a promise that fires once when the promise is + * resolved with the result of the promise or `undefined`. + */ + function fromPromise(promise) { + const result = new Emitter(); + promise.then(res => { + result.fire(res); + }, () => { + result.fire(undefined); + }).finally(() => { + result.dispose(); + }); + return result.event; + } + Event.fromPromise = fromPromise; + /** + * A convenience function for forwarding an event to another emitter which + * improves readability. + * + * This is similar to {@link Relay} but allows instantiating and forwarding + * on a single line and also allows for multiple source events. + * @param from The event to forward. + * @param to The emitter to forward the event to. + * @example + * Event.forward(event, emitter); + * // equivalent to + * event(e => emitter.fire(e)); + * // equivalent to + * event(emitter.fire, emitter); + */ + function forward(from, to) { + return from(e => to.fire(e)); + } + Event.forward = forward; + function runAndSubscribe(event, handler, initial) { + handler(initial); + return event(e => handler(e)); + } + Event.runAndSubscribe = runAndSubscribe; + class EmitterObserver { + constructor(_observable, store) { + this._observable = _observable; + this._counter = 0; + this._hasChanged = false; + const options = { + onWillAddFirstListener: () => { + _observable.addObserver(this); + // Communicate to the observable that we received its current value and would like to be notified about future changes. + this._observable.reportChanges(); + }, + onDidRemoveLastListener: () => { + _observable.removeObserver(this); + } + }; + if (!store) { + _addLeakageTraceLogic(options); + } + this.emitter = new Emitter(options); + if (store) { + store.add(this.emitter); + } + } + beginUpdate(_observable) { + // assert(_observable === this.obs); + this._counter++; + } + handlePossibleChange(_observable) { + // assert(_observable === this.obs); + } + handleChange(_observable, _change) { + // assert(_observable === this.obs); + this._hasChanged = true; + } + endUpdate(_observable) { + // assert(_observable === this.obs); + this._counter--; + if (this._counter === 0) { + this._observable.reportChanges(); + if (this._hasChanged) { + this._hasChanged = false; + this.emitter.fire(this._observable.get()); + } + } + } + } + /** + * Creates an event emitter that is fired when the observable changes. + * Each listeners subscribes to the emitter. + */ + function fromObservable(obs, store) { + const observer = new EmitterObserver(obs, store); + return observer.emitter.event; + } + Event.fromObservable = fromObservable; + /** + * Each listener is attached to the observable directly. + */ + function fromObservableLight(observable) { + return (listener, thisArgs, disposables) => { + let count = 0; + let didChange = false; + const observer = { + beginUpdate() { + count++; + }, + endUpdate() { + count--; + if (count === 0) { + observable.reportChanges(); + if (didChange) { + didChange = false; + listener.call(thisArgs); + } + } + }, + handlePossibleChange() { + // noop + }, + handleChange() { + didChange = true; + } + }; + observable.addObserver(observer); + observable.reportChanges(); + const disposable = { + dispose() { + observable.removeObserver(observer); + } + }; + if (disposables instanceof DisposableStore) { + disposables.add(disposable); + } + else if (Array.isArray(disposables)) { + disposables.push(disposable); + } + return disposable; + }; + } + Event.fromObservableLight = fromObservableLight; +})(Event || (Event = {})); +export class EventProfiling { + static { this.all = new Set(); } + static { this._idPool = 0; } + constructor(name) { + this.listenerCount = 0; + this.invocationCount = 0; + this.elapsedOverall = 0; + this.durations = []; + this.name = `${name}_${EventProfiling._idPool++}`; + EventProfiling.all.add(this); + } + start(listenerCount) { + this._stopWatch = new StopWatch(); + this.listenerCount = listenerCount; + } + stop() { + if (this._stopWatch) { + const elapsed = this._stopWatch.elapsed(); + this.durations.push(elapsed); + this.elapsedOverall += elapsed; + this.invocationCount += 1; + this._stopWatch = undefined; + } + } +} +let _globalLeakWarningThreshold = -1; +class LeakageMonitor { + static { this._idPool = 1; } + constructor(_errorHandler, threshold, name = (LeakageMonitor._idPool++).toString(16).padStart(3, '0')) { + this._errorHandler = _errorHandler; + this.threshold = threshold; + this.name = name; + this._warnCountdown = 0; + } + dispose() { + this._stacks?.clear(); + } + check(stack, listenerCount) { + const threshold = this.threshold; + if (threshold <= 0 || listenerCount < threshold) { + return undefined; + } + if (!this._stacks) { + this._stacks = new Map(); + } + const count = (this._stacks.get(stack.value) || 0); + this._stacks.set(stack.value, count + 1); + this._warnCountdown -= 1; + if (this._warnCountdown <= 0) { + // only warn on first exceed and then every time the limit + // is exceeded by 50% again + this._warnCountdown = threshold * 0.5; + const [topStack, topCount] = this.getMostFrequentStack(); + const message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`; + console.warn(message); + console.warn(topStack); + const error = new ListenerLeakError(message, topStack); + this._errorHandler(error); + } + return () => { + const count = (this._stacks.get(stack.value) || 0); + this._stacks.set(stack.value, count - 1); + }; + } + getMostFrequentStack() { + if (!this._stacks) { + return undefined; + } + let topStack; + let topCount = 0; + for (const [stack, count] of this._stacks) { + if (!topStack || topCount < count) { + topStack = [stack, count]; + topCount = count; + } + } + return topStack; + } +} +class Stacktrace { + static create() { + const err = new Error(); + return new Stacktrace(err.stack ?? ''); + } + constructor(value) { + this.value = value; + } + print() { + console.warn(this.value.split('\n').slice(2).join('\n')); + } +} +// error that is logged when going over the configured listener threshold +export class ListenerLeakError extends Error { + constructor(message, stack) { + super(message); + this.name = 'ListenerLeakError'; + this.stack = stack; + } +} +// SEVERE error that is logged when having gone way over the configured listener +// threshold so that the emitter refuses to accept more listeners +export class ListenerRefusalError extends Error { + constructor(message, stack) { + super(message); + this.name = 'ListenerRefusalError'; + this.stack = stack; + } +} +class UniqueContainer { + constructor(value) { + this.value = value; + } +} +const compactionThreshold = 2; +const forEachListener = (listeners, fn) => { + if (listeners instanceof UniqueContainer) { + fn(listeners); + } + else { + for (let i = 0; i < listeners.length; i++) { + const l = listeners[i]; + if (l) { + fn(l); + } + } + } +}; +let _listenerFinalizers; +if (_enableListenerGCedWarning) { + const leaks = []; + setInterval(() => { + if (leaks.length === 0) { + return; + } + console.warn('[LEAKING LISTENERS] GC\'ed these listeners that were NOT yet disposed:'); + console.warn(leaks.join('\n')); + leaks.length = 0; + }, 3000); + _listenerFinalizers = new FinalizationRegistry(heldValue => { + if (typeof heldValue === 'string') { + leaks.push(heldValue); + } + }); +} +/** + * The Emitter can be used to expose an Event to the public + * to fire it from the insides. + * Sample: + class Document { + + private readonly _onDidChange = new Emitter<(value:string)=>any>(); + + public onDidChange = this._onDidChange.event; + + // getter-style + // get onDidChange(): Event<(value:string)=>any> { + // return this._onDidChange.event; + // } + + private _doIt() { + //... + this._onDidChange.fire(value); + } + } + */ +export class Emitter { + constructor(options) { + this._size = 0; + this._options = options; + this._leakageMon = (_globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold) + ? new LeakageMonitor(options?.onListenerError ?? onUnexpectedError, this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) : + undefined; + this._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined; + this._deliveryQueue = this._options?.deliveryQueue; + } + dispose() { + if (!this._disposed) { + this._disposed = true; + // It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter + // alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and + // unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the + // the following programming pattern is very popular: + // + // const someModel = this._disposables.add(new ModelObject()); // (1) create and register model + // this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener + // ...later... + // this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the "overall dispose" is done + if (this._deliveryQueue?.current === this) { + this._deliveryQueue.reset(); + } + if (this._listeners) { + if (_enableDisposeWithListenerWarning) { + const listeners = this._listeners; + queueMicrotask(() => { + forEachListener(listeners, l => l.stack?.print()); + }); + } + this._listeners = undefined; + this._size = 0; + } + this._options?.onDidRemoveLastListener?.(); + this._leakageMon?.dispose(); + } + } + /** + * For the public to allow to subscribe + * to events from this Emitter + */ + get event() { + this._event ??= (callback, thisArgs, disposables) => { + if (this._leakageMon && this._size > this._leakageMon.threshold ** 2) { + const message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`; + console.warn(message); + const tuple = this._leakageMon.getMostFrequentStack() ?? ['UNKNOWN stack', -1]; + const error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]); + const errorHandler = this._options?.onListenerError || onUnexpectedError; + errorHandler(error); + return Disposable.None; + } + if (this._disposed) { + // todo: should we warn if a listener is added to a disposed emitter? This happens often + return Disposable.None; + } + if (thisArgs) { + callback = callback.bind(thisArgs); + } + const contained = new UniqueContainer(callback); + let removeMonitor; + let stack; + if (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) { + // check and record this emitter for potential leakage + contained.stack = Stacktrace.create(); + removeMonitor = this._leakageMon.check(contained.stack, this._size + 1); + } + if (_enableDisposeWithListenerWarning) { + contained.stack = stack ?? Stacktrace.create(); + } + if (!this._listeners) { + this._options?.onWillAddFirstListener?.(this); + this._listeners = contained; + this._options?.onDidAddFirstListener?.(this); + } + else if (this._listeners instanceof UniqueContainer) { + this._deliveryQueue ??= new EventDeliveryQueuePrivate(); + this._listeners = [this._listeners, contained]; + } + else { + this._listeners.push(contained); + } + this._size++; + const result = toDisposable(() => { + _listenerFinalizers?.unregister(result); + removeMonitor?.(); + this._removeListener(contained); + }); + if (disposables instanceof DisposableStore) { + disposables.add(result); + } + else if (Array.isArray(disposables)) { + disposables.push(result); + } + if (_listenerFinalizers) { + const stack = new Error().stack.split('\n').slice(2, 3).join('\n').trim(); + const match = /(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(stack); + _listenerFinalizers.register(result, match?.[2] ?? stack, result); + } + return result; + }; + return this._event; + } + _removeListener(listener) { + this._options?.onWillRemoveListener?.(this); + if (!this._listeners) { + return; // expected if a listener gets disposed + } + if (this._size === 1) { + this._listeners = undefined; + this._options?.onDidRemoveLastListener?.(this); + this._size = 0; + return; + } + // size > 1 which requires that listeners be a list: + const listeners = this._listeners; + const index = listeners.indexOf(listener); + if (index === -1) { + console.log('disposed?', this._disposed); + console.log('size?', this._size); + console.log('arr?', JSON.stringify(this._listeners)); + throw new Error('Attempted to dispose unknown listener'); + } + this._size--; + listeners[index] = undefined; + const adjustDeliveryQueue = this._deliveryQueue.current === this; + if (this._size * compactionThreshold <= listeners.length) { + let n = 0; + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]) { + listeners[n++] = listeners[i]; + } + else if (adjustDeliveryQueue) { + this._deliveryQueue.end--; + if (n < this._deliveryQueue.i) { + this._deliveryQueue.i--; + } + } + } + listeners.length = n; + } + } + _deliver(listener, value) { + if (!listener) { + return; + } + const errorHandler = this._options?.onListenerError || onUnexpectedError; + if (!errorHandler) { + listener.value(value); + return; + } + try { + listener.value(value); + } + catch (e) { + errorHandler(e); + } + } + /** Delivers items in the queue. Assumes the queue is ready to go. */ + _deliverQueue(dq) { + const listeners = dq.current._listeners; + while (dq.i < dq.end) { + // important: dq.i is incremented before calling deliver() because it might reenter deliverQueue() + this._deliver(listeners[dq.i++], dq.value); + } + dq.reset(); + } + /** + * To be kept private to fire an event to + * subscribers + */ + fire(event) { + if (this._deliveryQueue?.current) { + this._deliverQueue(this._deliveryQueue); + this._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch + } + this._perfMon?.start(this._size); + if (!this._listeners) { + // no-op + } + else if (this._listeners instanceof UniqueContainer) { + this._deliver(this._listeners, event); + } + else { + const dq = this._deliveryQueue; + dq.enqueue(this, event, this._listeners.length); + this._deliverQueue(dq); + } + this._perfMon?.stop(); + } + hasListeners() { + return this._size > 0; + } +} +export const createEventDeliveryQueue = () => new EventDeliveryQueuePrivate(); +class EventDeliveryQueuePrivate { + constructor() { + /** + * Index in current's listener list. + */ + this.i = -1; + /** + * The last index in the listener's list to deliver. + */ + this.end = 0; + } + enqueue(emitter, value, end) { + this.i = 0; + this.end = end; + this.current = emitter; + this.value = value; + } + reset() { + this.i = this.end; // force any current emission loop to stop, mainly for during dispose + this.current = undefined; + this.value = undefined; + } +} +export class PauseableEmitter extends Emitter { + constructor(options) { + super(options); + this._isPaused = 0; + this._eventQueue = new LinkedList(); + this._mergeFn = options?.merge; + } + pause() { + this._isPaused++; + } + resume() { + if (this._isPaused !== 0 && --this._isPaused === 0) { + if (this._mergeFn) { + // use the merge function to create a single composite + // event. make a copy in case firing pauses this emitter + if (this._eventQueue.size > 0) { + const events = Array.from(this._eventQueue); + this._eventQueue.clear(); + super.fire(this._mergeFn(events)); + } + } + else { + // no merging, fire each event individually and test + // that this emitter isn't paused halfway through + while (!this._isPaused && this._eventQueue.size !== 0) { + super.fire(this._eventQueue.shift()); + } + } + } + } + fire(event) { + if (this._size) { + if (this._isPaused !== 0) { + this._eventQueue.push(event); + } + else { + super.fire(event); + } + } + } +} +export class DebounceEmitter extends PauseableEmitter { + constructor(options) { + super(options); + this._delay = options.delay ?? 100; + } + fire(event) { + if (!this._handle) { + this.pause(); + this._handle = setTimeout(() => { + this._handle = undefined; + this.resume(); + }, this._delay); + } + super.fire(event); + } +} +/** + * An emitter which queue all events and then process them at the + * end of the event loop. + */ +export class MicrotaskEmitter extends Emitter { + constructor(options) { + super(options); + this._queuedEvents = []; + this._mergeFn = options?.merge; + } + fire(event) { + if (!this.hasListeners()) { + return; + } + this._queuedEvents.push(event); + if (this._queuedEvents.length === 1) { + queueMicrotask(() => { + if (this._mergeFn) { + super.fire(this._mergeFn(this._queuedEvents)); + } + else { + this._queuedEvents.forEach(e => super.fire(e)); + } + this._queuedEvents = []; + }); + } + } +} +/** + * An event emitter that multiplexes many events into a single event. + * + * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s + * to the multiplexer as needed. + * + * ```typescript + * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>(); + * + * const thingListeners = DisposableMap(); + * + * thingService.onDidAddThing(thing => { + * thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData); + * }); + * thingService.onDidRemoveThing(thing => { + * thingListeners.deleteAndDispose(thing); + * }); + * + * anythingDataMultiplexer.event(e => { + * console.log('Something fired data ' + e.data) + * }); + * ``` + */ +export class EventMultiplexer { + constructor() { + this.hasListeners = false; + this.events = []; + this.emitter = new Emitter({ + onWillAddFirstListener: () => this.onFirstListenerAdd(), + onDidRemoveLastListener: () => this.onLastListenerRemove() + }); + } + get event() { + return this.emitter.event; + } + add(event) { + const e = { event: event, listener: null }; + this.events.push(e); + if (this.hasListeners) { + this.hook(e); + } + const dispose = () => { + if (this.hasListeners) { + this.unhook(e); + } + const idx = this.events.indexOf(e); + this.events.splice(idx, 1); + }; + return toDisposable(createSingleCallFunction(dispose)); + } + onFirstListenerAdd() { + this.hasListeners = true; + this.events.forEach(e => this.hook(e)); + } + onLastListenerRemove() { + this.hasListeners = false; + this.events.forEach(e => this.unhook(e)); + } + hook(e) { + e.listener = e.event(r => this.emitter.fire(r)); + } + unhook(e) { + e.listener?.dispose(); + e.listener = null; + } + dispose() { + this.emitter.dispose(); + for (const e of this.events) { + e.listener?.dispose(); + } + this.events = []; + } +} +/** + * The EventBufferer is useful in situations in which you want + * to delay firing your events during some code. + * You can wrap that code and be sure that the event will not + * be fired during that wrap. + * + * ``` + * const emitter: Emitter; + * const delayer = new EventDelayer(); + * const delayedEvent = delayer.wrapEvent(emitter.event); + * + * delayedEvent(console.log); + * + * delayer.bufferEvents(() => { + * emitter.fire(); // event will not be fired yet + * }); + * + * // event will only be fired at this point + * ``` + */ +export class EventBufferer { + constructor() { + this.data = []; + } + wrapEvent(event, reduce, initial) { + return (listener, thisArgs, disposables) => { + return event(i => { + const data = this.data[this.data.length - 1]; + // Non-reduce scenario + if (!reduce) { + // Buffering case + if (data) { + data.buffers.push(() => listener.call(thisArgs, i)); + } + else { + // Not buffering case + listener.call(thisArgs, i); + } + return; + } + // Reduce scenario + const reduceData = data; + // Not buffering case + if (!reduceData) { + // TODO: Is there a way to cache this reduce call for all listeners? + listener.call(thisArgs, reduce(initial, i)); + return; + } + // Buffering case + reduceData.items ??= []; + reduceData.items.push(i); + if (reduceData.buffers.length === 0) { + // Include a single buffered function that will reduce all events when we're done buffering events + data.buffers.push(() => { + // cache the reduced result so that the value can be shared across all listeners + reduceData.reducedResult ??= initial + ? reduceData.items.reduce(reduce, initial) + : reduceData.items.reduce(reduce); + listener.call(thisArgs, reduceData.reducedResult); + }); + } + }, undefined, disposables); + }; + } + bufferEvents(fn) { + const data = { buffers: new Array() }; + this.data.push(data); + const r = fn(); + this.data.pop(); + data.buffers.forEach(flush => flush()); + return r; + } +} +/** + * A Relay is an event forwarder which functions as a replugabble event pipe. + * Once created, you can connect an input event to it and it will simply forward + * events from that input event through its own `event` property. The `input` + * can be changed at any point in time. + */ +export class Relay { + constructor() { + this.listening = false; + this.inputEvent = Event.None; + this.inputEventListener = Disposable.None; + this.emitter = new Emitter({ + onDidAddFirstListener: () => { + this.listening = true; + this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter); + }, + onDidRemoveLastListener: () => { + this.listening = false; + this.inputEventListener.dispose(); + } + }); + this.event = this.emitter.event; + } + set input(event) { + this.inputEvent = event; + if (this.listening) { + this.inputEventListener.dispose(); + this.inputEventListener = event(this.emitter.fire, this.emitter); + } + } + dispose() { + this.inputEventListener.dispose(); + this.emitter.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/extpath.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/extpath.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ddb3378cd2f958f08e78f83c6d5c912ffd5f84 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/extpath.js @@ -0,0 +1,144 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { posix, sep } from './path.js'; +import { isWindows } from './platform.js'; +import { startsWithIgnoreCase } from './strings.js'; +export function isPathSeparator(code) { + return code === 47 /* CharCode.Slash */ || code === 92 /* CharCode.Backslash */; +} +/** + * Takes a Windows OS path and changes backward slashes to forward slashes. + * This should only be done for OS paths from Windows (or user provided paths potentially from Windows). + * Using it on a Linux or MaxOS path might change it. + */ +export function toSlashes(osPath) { + return osPath.replace(/[\\/]/g, posix.sep); +} +/** + * Takes a Windows OS path (using backward or forward slashes) and turns it into a posix path: + * - turns backward slashes into forward slashes + * - makes it absolute if it starts with a drive letter + * This should only be done for OS paths from Windows (or user provided paths potentially from Windows). + * Using it on a Linux or MaxOS path might change it. + */ +export function toPosixPath(osPath) { + if (osPath.indexOf('/') === -1) { + osPath = toSlashes(osPath); + } + if (/^[a-zA-Z]:(\/|$)/.test(osPath)) { // starts with a drive letter + osPath = '/' + osPath; + } + return osPath; +} +/** + * Computes the _root_ this path, like `getRoot('c:\files') === c:\`, + * `getRoot('files:///files/path') === files:///`, + * or `getRoot('\\server\shares\path') === \\server\shares\` + */ +export function getRoot(path, sep = posix.sep) { + if (!path) { + return ''; + } + const len = path.length; + const firstLetter = path.charCodeAt(0); + if (isPathSeparator(firstLetter)) { + if (isPathSeparator(path.charCodeAt(1))) { + // UNC candidate \\localhost\shares\ddd + // ^^^^^^^^^^^^^^^^^^^ + if (!isPathSeparator(path.charCodeAt(2))) { + let pos = 3; + const start = pos; + for (; pos < len; pos++) { + if (isPathSeparator(path.charCodeAt(pos))) { + break; + } + } + if (start !== pos && !isPathSeparator(path.charCodeAt(pos + 1))) { + pos += 1; + for (; pos < len; pos++) { + if (isPathSeparator(path.charCodeAt(pos))) { + return path.slice(0, pos + 1) // consume this separator + .replace(/[\\/]/g, sep); + } + } + } + } + } + // /user/far + // ^ + return sep; + } + else if (isWindowsDriveLetter(firstLetter)) { + // check for windows drive letter c:\ or c: + if (path.charCodeAt(1) === 58 /* CharCode.Colon */) { + if (isPathSeparator(path.charCodeAt(2))) { + // C:\fff + // ^^^ + return path.slice(0, 2) + sep; + } + else { + // C: + // ^^ + return path.slice(0, 2); + } + } + } + // check for URI + // scheme://authority/path + // ^^^^^^^^^^^^^^^^^^^ + let pos = path.indexOf('://'); + if (pos !== -1) { + pos += 3; // 3 -> "://".length + for (; pos < len; pos++) { + if (isPathSeparator(path.charCodeAt(pos))) { + return path.slice(0, pos + 1); // consume this separator + } + } + } + return ''; +} +/** + * @deprecated please use `IUriIdentityService.extUri.isEqualOrParent` instead. If + * you are in a context without services, consider to pass down the `extUri` from the + * outside, or use `extUriBiasedIgnorePathCase` if you know what you are doing. + */ +export function isEqualOrParent(base, parentCandidate, ignoreCase, separator = sep) { + if (base === parentCandidate) { + return true; + } + if (!base || !parentCandidate) { + return false; + } + if (parentCandidate.length > base.length) { + return false; + } + if (ignoreCase) { + const beginsWith = startsWithIgnoreCase(base, parentCandidate); + if (!beginsWith) { + return false; + } + if (parentCandidate.length === base.length) { + return true; // same path, different casing + } + let sepOffset = parentCandidate.length; + if (parentCandidate.charAt(parentCandidate.length - 1) === separator) { + sepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character + } + return base.charAt(sepOffset) === separator; + } + if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) { + parentCandidate += separator; + } + return base.indexOf(parentCandidate) === 0; +} +export function isWindowsDriveLetter(char0) { + return char0 >= 65 /* CharCode.A */ && char0 <= 90 /* CharCode.Z */ || char0 >= 97 /* CharCode.a */ && char0 <= 122 /* CharCode.z */; +} +export function hasDriveLetter(path, isWindowsOS = isWindows) { + if (isWindowsOS) { + return isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === 58 /* CharCode.Colon */; + } + return false; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/filters.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/filters.js new file mode 100644 index 0000000000000000000000000000000000000000..40fbb6926eba34510c3a51ab83aff31d6582505b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/filters.js @@ -0,0 +1,769 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { LRUCache } from './map.js'; +import { getKoreanAltChars } from './naturalLanguage/korean.js'; +import * as strings from './strings.js'; +// Combined filters +/** + * @returns A filter which combines the provided set + * of filters with an or. The *first* filters that + * matches defined the return value of the returned + * filter. + */ +export function or(...filter) { + return function (word, wordToMatchAgainst) { + for (let i = 0, len = filter.length; i < len; i++) { + const match = filter[i](word, wordToMatchAgainst); + if (match) { + return match; + } + } + return null; + }; +} +// Prefix +export const matchesStrictPrefix = _matchesPrefix.bind(undefined, false); +export const matchesPrefix = _matchesPrefix.bind(undefined, true); +function _matchesPrefix(ignoreCase, word, wordToMatchAgainst) { + if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) { + return null; + } + let matches; + if (ignoreCase) { + matches = strings.startsWithIgnoreCase(wordToMatchAgainst, word); + } + else { + matches = wordToMatchAgainst.indexOf(word) === 0; + } + if (!matches) { + return null; + } + return word.length > 0 ? [{ start: 0, end: word.length }] : []; +} +// Contiguous Substring +export function matchesContiguousSubString(word, wordToMatchAgainst) { + const index = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase()); + if (index === -1) { + return null; + } + return [{ start: index, end: index + word.length }]; +} +// Substring +export function matchesSubString(word, wordToMatchAgainst) { + return _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0); +} +function _matchesSubString(word, wordToMatchAgainst, i, j) { + if (i === word.length) { + return []; + } + else if (j === wordToMatchAgainst.length) { + return null; + } + else { + if (word[i] === wordToMatchAgainst[j]) { + let result = null; + if (result = _matchesSubString(word, wordToMatchAgainst, i + 1, j + 1)) { + return join({ start: j, end: j + 1 }, result); + } + return null; + } + return _matchesSubString(word, wordToMatchAgainst, i, j + 1); + } +} +// CamelCase +function isLower(code) { + return 97 /* CharCode.a */ <= code && code <= 122 /* CharCode.z */; +} +export function isUpper(code) { + return 65 /* CharCode.A */ <= code && code <= 90 /* CharCode.Z */; +} +function isNumber(code) { + return 48 /* CharCode.Digit0 */ <= code && code <= 57 /* CharCode.Digit9 */; +} +function isWhitespace(code) { + return (code === 32 /* CharCode.Space */ + || code === 9 /* CharCode.Tab */ + || code === 10 /* CharCode.LineFeed */ + || code === 13 /* CharCode.CarriageReturn */); +} +const wordSeparators = new Set(); +// These are chosen as natural word separators based on writen text. +// It is a subset of the word separators used by the monaco editor. +'()[]{}<>`\'"-/;:,.?!' + .split('') + .forEach(s => wordSeparators.add(s.charCodeAt(0))); +function isWordSeparator(code) { + return isWhitespace(code) || wordSeparators.has(code); +} +function charactersMatch(codeA, codeB) { + return (codeA === codeB) || (isWordSeparator(codeA) && isWordSeparator(codeB)); +} +const alternateCharsCache = new Map(); +/** + * Gets alternative codes to the character code passed in. This comes in the + * form of an array of character codes, all of which must match _in order_ to + * successfully match. + * + * @param code The character code to check. + */ +function getAlternateCodes(code) { + if (alternateCharsCache.has(code)) { + return alternateCharsCache.get(code); + } + // NOTE: This function is written in such a way that it can be extended in + // the future, but right now the return type takes into account it's only + // supported by a single "alt codes provider". + // `ArrayLike>` is a more appropriate type if changed. + let result; + const codes = getKoreanAltChars(code); + if (codes) { + result = codes; + } + alternateCharsCache.set(code, result); + return result; +} +function isAlphanumeric(code) { + return isLower(code) || isUpper(code) || isNumber(code); +} +function join(head, tail) { + if (tail.length === 0) { + tail = [head]; + } + else if (head.end === tail[0].start) { + tail[0].start = head.start; + } + else { + tail.unshift(head); + } + return tail; +} +function nextAnchor(camelCaseWord, start) { + for (let i = start; i < camelCaseWord.length; i++) { + const c = camelCaseWord.charCodeAt(i); + if (isUpper(c) || isNumber(c) || (i > 0 && !isAlphanumeric(camelCaseWord.charCodeAt(i - 1)))) { + return i; + } + } + return camelCaseWord.length; +} +function _matchesCamelCase(word, camelCaseWord, i, j) { + if (i === word.length) { + return []; + } + else if (j === camelCaseWord.length) { + return null; + } + else if (word[i] !== camelCaseWord[j].toLowerCase()) { + return null; + } + else { + let result = null; + let nextUpperIndex = j + 1; + result = _matchesCamelCase(word, camelCaseWord, i + 1, j + 1); + while (!result && (nextUpperIndex = nextAnchor(camelCaseWord, nextUpperIndex)) < camelCaseWord.length) { + result = _matchesCamelCase(word, camelCaseWord, i + 1, nextUpperIndex); + nextUpperIndex++; + } + return result === null ? null : join({ start: j, end: j + 1 }, result); + } +} +// Heuristic to avoid computing camel case matcher for words that don't +// look like camelCaseWords. +function analyzeCamelCaseWord(word) { + let upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0; + for (let i = 0; i < word.length; i++) { + code = word.charCodeAt(i); + if (isUpper(code)) { + upper++; + } + if (isLower(code)) { + lower++; + } + if (isAlphanumeric(code)) { + alpha++; + } + if (isNumber(code)) { + numeric++; + } + } + const upperPercent = upper / word.length; + const lowerPercent = lower / word.length; + const alphaPercent = alpha / word.length; + const numericPercent = numeric / word.length; + return { upperPercent, lowerPercent, alphaPercent, numericPercent }; +} +function isUpperCaseWord(analysis) { + const { upperPercent, lowerPercent } = analysis; + return lowerPercent === 0 && upperPercent > 0.6; +} +function isCamelCaseWord(analysis) { + const { upperPercent, lowerPercent, alphaPercent, numericPercent } = analysis; + return lowerPercent > 0.2 && upperPercent < 0.8 && alphaPercent > 0.6 && numericPercent < 0.2; +} +// Heuristic to avoid computing camel case matcher for words that don't +// look like camel case patterns. +function isCamelCasePattern(word) { + let upper = 0, lower = 0, code = 0, whitespace = 0; + for (let i = 0; i < word.length; i++) { + code = word.charCodeAt(i); + if (isUpper(code)) { + upper++; + } + if (isLower(code)) { + lower++; + } + if (isWhitespace(code)) { + whitespace++; + } + } + if ((upper === 0 || lower === 0) && whitespace === 0) { + return word.length <= 30; + } + else { + return upper <= 5; + } +} +export function matchesCamelCase(word, camelCaseWord) { + if (!camelCaseWord) { + return null; + } + camelCaseWord = camelCaseWord.trim(); + if (camelCaseWord.length === 0) { + return null; + } + if (!isCamelCasePattern(word)) { + return null; + } + // TODO: Consider removing this check + if (camelCaseWord.length > 60) { + camelCaseWord = camelCaseWord.substring(0, 60); + } + const analysis = analyzeCamelCaseWord(camelCaseWord); + if (!isCamelCaseWord(analysis)) { + if (!isUpperCaseWord(analysis)) { + return null; + } + camelCaseWord = camelCaseWord.toLowerCase(); + } + let result = null; + let i = 0; + word = word.toLowerCase(); + while (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) { + i = nextAnchor(camelCaseWord, i + 1); + } + return result; +} +// Matches beginning of words supporting non-ASCII languages +// If `contiguous` is true then matches word with beginnings of the words in the target. E.g. "pul" will match "Git: Pull" +// Otherwise also matches sub string of the word with beginnings of the words in the target. E.g. "gp" or "g p" will match "Git: Pull" +// Useful in cases where the target is words (e.g. command labels) +export function matchesWords(word, target, contiguous = false) { + if (!target || target.length === 0) { + return null; + } + let result = null; + let targetIndex = 0; + word = word.toLowerCase(); + target = target.toLowerCase(); + while (targetIndex < target.length) { + result = _matchesWords(word, target, 0, targetIndex, contiguous); + if (result !== null) { + break; + } + targetIndex = nextWord(target, targetIndex + 1); + } + return result; +} +function _matchesWords(word, target, wordIndex, targetIndex, contiguous) { + let targetIndexOffset = 0; + if (wordIndex === word.length) { + return []; + } + else if (targetIndex === target.length) { + return null; + } + else if (!charactersMatch(word.charCodeAt(wordIndex), target.charCodeAt(targetIndex))) { + // Verify alternate characters before exiting + const altChars = getAlternateCodes(word.charCodeAt(wordIndex)); + if (!altChars) { + return null; + } + for (let k = 0; k < altChars.length; k++) { + if (!charactersMatch(altChars[k], target.charCodeAt(targetIndex + k))) { + return null; + } + } + targetIndexOffset += altChars.length - 1; + } + let result = null; + let nextWordIndex = targetIndex + targetIndexOffset + 1; + result = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous); + if (!contiguous) { + while (!result && (nextWordIndex = nextWord(target, nextWordIndex)) < target.length) { + result = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous); + nextWordIndex++; + } + } + if (!result) { + return null; + } + // If the characters don't exactly match, then they must be word separators (see charactersMatch(...)). + // We don't want to include this in the matches but we don't want to throw the target out all together so we return `result`. + if (word.charCodeAt(wordIndex) !== target.charCodeAt(targetIndex)) { + // Verify alternate characters before exiting + const altChars = getAlternateCodes(word.charCodeAt(wordIndex)); + if (!altChars) { + return result; + } + for (let k = 0; k < altChars.length; k++) { + if (altChars[k] !== target.charCodeAt(targetIndex + k)) { + return result; + } + } + } + return join({ start: targetIndex, end: targetIndex + targetIndexOffset + 1 }, result); +} +function nextWord(word, start) { + for (let i = start; i < word.length; i++) { + if (isWordSeparator(word.charCodeAt(i)) || + (i > 0 && isWordSeparator(word.charCodeAt(i - 1)))) { + return i; + } + } + return word.length; +} +// Fuzzy +const fuzzyContiguousFilter = or(matchesPrefix, matchesCamelCase, matchesContiguousSubString); +const fuzzySeparateFilter = or(matchesPrefix, matchesCamelCase, matchesSubString); +const fuzzyRegExpCache = new LRUCache(10000); // bounded to 10000 elements +export function matchesFuzzy(word, wordToMatchAgainst, enableSeparateSubstringMatching = false) { + if (typeof word !== 'string' || typeof wordToMatchAgainst !== 'string') { + return null; // return early for invalid input + } + // Form RegExp for wildcard matches + let regexp = fuzzyRegExpCache.get(word); + if (!regexp) { + regexp = new RegExp(strings.convertSimple2RegExpPattern(word), 'i'); + fuzzyRegExpCache.set(word, regexp); + } + // RegExp Filter + const match = regexp.exec(wordToMatchAgainst); + if (match) { + return [{ start: match.index, end: match.index + match[0].length }]; + } + // Default Filter + return enableSeparateSubstringMatching ? fuzzySeparateFilter(word, wordToMatchAgainst) : fuzzyContiguousFilter(word, wordToMatchAgainst); +} +/** + * Match pattern against word in a fuzzy way. As in IntelliSense and faster and more + * powerful than `matchesFuzzy` + */ +export function matchesFuzzy2(pattern, word) { + const score = fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true }); + return score ? createMatches(score) : null; +} +export function anyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos) { + const max = Math.min(13, pattern.length); + for (; patternPos < max; patternPos++) { + const result = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, { firstMatchCanBeWeak: true, boostFullMatch: true }); + if (result) { + return result; + } + } + return [0, wordPos]; +} +//#region --- fuzzyScore --- +export function createMatches(score) { + if (typeof score === 'undefined') { + return []; + } + const res = []; + const wordPos = score[1]; + for (let i = score.length - 1; i > 1; i--) { + const pos = score[i] + wordPos; + const last = res[res.length - 1]; + if (last && last.end === pos) { + last.end = pos + 1; + } + else { + res.push({ start: pos, end: pos + 1 }); + } + } + return res; +} +const _maxLen = 128; +function initTable() { + const table = []; + const row = []; + for (let i = 0; i <= _maxLen; i++) { + row[i] = 0; + } + for (let i = 0; i <= _maxLen; i++) { + table.push(row.slice(0)); + } + return table; +} +function initArr(maxLen) { + const row = []; + for (let i = 0; i <= maxLen; i++) { + row[i] = 0; + } + return row; +} +const _minWordMatchPos = initArr(2 * _maxLen); // min word position for a certain pattern position +const _maxWordMatchPos = initArr(2 * _maxLen); // max word position for a certain pattern position +const _diag = initTable(); // the length of a contiguous diagonal match +const _table = initTable(); +const _arrows = initTable(); +const _debug = false; +function printTable(table, pattern, patternLen, word, wordLen) { + function pad(s, n, pad = ' ') { + while (s.length < n) { + s = pad + s; + } + return s; + } + let ret = ` | |${word.split('').map(c => pad(c, 3)).join('|')}\n`; + for (let i = 0; i <= patternLen; i++) { + if (i === 0) { + ret += ' |'; + } + else { + ret += `${pattern[i - 1]}|`; + } + ret += table[i].slice(0, wordLen + 1).map(n => pad(n.toString(), 3)).join('|') + '\n'; + } + return ret; +} +function printTables(pattern, patternStart, word, wordStart) { + pattern = pattern.substr(patternStart); + word = word.substr(wordStart); + console.log(printTable(_table, pattern, pattern.length, word, word.length)); + console.log(printTable(_arrows, pattern, pattern.length, word, word.length)); + console.log(printTable(_diag, pattern, pattern.length, word, word.length)); +} +function isSeparatorAtPos(value, index) { + if (index < 0 || index >= value.length) { + return false; + } + const code = value.codePointAt(index); + switch (code) { + case 95 /* CharCode.Underline */: + case 45 /* CharCode.Dash */: + case 46 /* CharCode.Period */: + case 32 /* CharCode.Space */: + case 47 /* CharCode.Slash */: + case 92 /* CharCode.Backslash */: + case 39 /* CharCode.SingleQuote */: + case 34 /* CharCode.DoubleQuote */: + case 58 /* CharCode.Colon */: + case 36 /* CharCode.DollarSign */: + case 60 /* CharCode.LessThan */: + case 62 /* CharCode.GreaterThan */: + case 40 /* CharCode.OpenParen */: + case 41 /* CharCode.CloseParen */: + case 91 /* CharCode.OpenSquareBracket */: + case 93 /* CharCode.CloseSquareBracket */: + case 123 /* CharCode.OpenCurlyBrace */: + case 125 /* CharCode.CloseCurlyBrace */: + return true; + case undefined: + return false; + default: + if (strings.isEmojiImprecise(code)) { + return true; + } + return false; + } +} +function isWhitespaceAtPos(value, index) { + if (index < 0 || index >= value.length) { + return false; + } + const code = value.charCodeAt(index); + switch (code) { + case 32 /* CharCode.Space */: + case 9 /* CharCode.Tab */: + return true; + default: + return false; + } +} +function isUpperCaseAtPos(pos, word, wordLow) { + return word[pos] !== wordLow[pos]; +} +export function isPatternInWord(patternLow, patternPos, patternLen, wordLow, wordPos, wordLen, fillMinWordPosArr = false) { + while (patternPos < patternLen && wordPos < wordLen) { + if (patternLow[patternPos] === wordLow[wordPos]) { + if (fillMinWordPosArr) { + // Remember the min word position for each pattern position + _minWordMatchPos[patternPos] = wordPos; + } + patternPos += 1; + } + wordPos += 1; + } + return patternPos === patternLen; // pattern must be exhausted +} +export var FuzzyScore; +(function (FuzzyScore) { + /** + * No matches and value `-100` + */ + FuzzyScore.Default = ([-100, 0]); + function isDefault(score) { + return !score || (score.length === 2 && score[0] === -100 && score[1] === 0); + } + FuzzyScore.isDefault = isDefault; +})(FuzzyScore || (FuzzyScore = {})); +export class FuzzyScoreOptions { + static { this.default = { boostFullMatch: true, firstMatchCanBeWeak: false }; } + constructor(firstMatchCanBeWeak, boostFullMatch) { + this.firstMatchCanBeWeak = firstMatchCanBeWeak; + this.boostFullMatch = boostFullMatch; + } +} +export function fuzzyScore(pattern, patternLow, patternStart, word, wordLow, wordStart, options = FuzzyScoreOptions.default) { + const patternLen = pattern.length > _maxLen ? _maxLen : pattern.length; + const wordLen = word.length > _maxLen ? _maxLen : word.length; + if (patternStart >= patternLen || wordStart >= wordLen || (patternLen - patternStart) > (wordLen - wordStart)) { + return undefined; + } + // Run a simple check if the characters of pattern occur + // (in order) at all in word. If that isn't the case we + // stop because no match will be possible + if (!isPatternInWord(patternLow, patternStart, patternLen, wordLow, wordStart, wordLen, true)) { + return undefined; + } + // Find the max matching word position for each pattern position + // NOTE: the min matching word position was filled in above, in the `isPatternInWord` call + _fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow); + let row = 1; + let column = 1; + let patternPos = patternStart; + let wordPos = wordStart; + const hasStrongFirstMatch = [false]; + // There will be a match, fill in tables + for (row = 1, patternPos = patternStart; patternPos < patternLen; row++, patternPos++) { + // Reduce search space to possible matching word positions and to possible access from next row + const minWordMatchPos = _minWordMatchPos[patternPos]; + const maxWordMatchPos = _maxWordMatchPos[patternPos]; + const nextMaxWordMatchPos = (patternPos + 1 < patternLen ? _maxWordMatchPos[patternPos + 1] : wordLen); + for (column = minWordMatchPos - wordStart + 1, wordPos = minWordMatchPos; wordPos < nextMaxWordMatchPos; column++, wordPos++) { + let score = Number.MIN_SAFE_INTEGER; + let canComeDiag = false; + if (wordPos <= maxWordMatchPos) { + score = _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos, wordLen, wordStart, _diag[row - 1][column - 1] === 0, hasStrongFirstMatch); + } + let diagScore = 0; + if (score !== Number.MAX_SAFE_INTEGER) { + canComeDiag = true; + diagScore = score + _table[row - 1][column - 1]; + } + const canComeLeft = wordPos > minWordMatchPos; + const leftScore = canComeLeft ? _table[row][column - 1] + (_diag[row][column - 1] > 0 ? -5 : 0) : 0; // penalty for a gap start + const canComeLeftLeft = wordPos > minWordMatchPos + 1 && _diag[row][column - 1] > 0; + const leftLeftScore = canComeLeftLeft ? _table[row][column - 2] + (_diag[row][column - 2] > 0 ? -5 : 0) : 0; // penalty for a gap start + if (canComeLeftLeft && (!canComeLeft || leftLeftScore >= leftScore) && (!canComeDiag || leftLeftScore >= diagScore)) { + // always prefer choosing left left to jump over a diagonal because that means a match is earlier in the word + _table[row][column] = leftLeftScore; + _arrows[row][column] = 3 /* Arrow.LeftLeft */; + _diag[row][column] = 0; + } + else if (canComeLeft && (!canComeDiag || leftScore >= diagScore)) { + // always prefer choosing left since that means a match is earlier in the word + _table[row][column] = leftScore; + _arrows[row][column] = 2 /* Arrow.Left */; + _diag[row][column] = 0; + } + else if (canComeDiag) { + _table[row][column] = diagScore; + _arrows[row][column] = 1 /* Arrow.Diag */; + _diag[row][column] = _diag[row - 1][column - 1] + 1; + } + else { + throw new Error(`not possible`); + } + } + } + if (_debug) { + printTables(pattern, patternStart, word, wordStart); + } + if (!hasStrongFirstMatch[0] && !options.firstMatchCanBeWeak) { + return undefined; + } + row--; + column--; + const result = [_table[row][column], wordStart]; + let backwardsDiagLength = 0; + let maxMatchColumn = 0; + while (row >= 1) { + // Find the column where we go diagonally up + let diagColumn = column; + do { + const arrow = _arrows[row][diagColumn]; + if (arrow === 3 /* Arrow.LeftLeft */) { + diagColumn = diagColumn - 2; + } + else if (arrow === 2 /* Arrow.Left */) { + diagColumn = diagColumn - 1; + } + else { + // found the diagonal + break; + } + } while (diagColumn >= 1); + // Overturn the "forwards" decision if keeping the "backwards" diagonal would give a better match + if (backwardsDiagLength > 1 // only if we would have a contiguous match of 3 characters + && patternLow[patternStart + row - 1] === wordLow[wordStart + column - 1] // only if we can do a contiguous match diagonally + && !isUpperCaseAtPos(diagColumn + wordStart - 1, word, wordLow) // only if the forwards chose diagonal is not an uppercase + && backwardsDiagLength + 1 > _diag[row][diagColumn] // only if our contiguous match would be longer than the "forwards" contiguous match + ) { + diagColumn = column; + } + if (diagColumn === column) { + // this is a contiguous match + backwardsDiagLength++; + } + else { + backwardsDiagLength = 1; + } + if (!maxMatchColumn) { + // remember the last matched column + maxMatchColumn = diagColumn; + } + row--; + column = diagColumn - 1; + result.push(column); + } + if (wordLen - wordStart === patternLen && options.boostFullMatch) { + // the word matches the pattern with all characters! + // giving the score a total match boost (to come up ahead other words) + result[0] += 2; + } + // Add 1 penalty for each skipped character in the word + const skippedCharsCount = maxMatchColumn - patternLen; + result[0] -= skippedCharsCount; + return result; +} +function _fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow) { + let patternPos = patternLen - 1; + let wordPos = wordLen - 1; + while (patternPos >= patternStart && wordPos >= wordStart) { + if (patternLow[patternPos] === wordLow[wordPos]) { + _maxWordMatchPos[patternPos] = wordPos; + patternPos--; + } + wordPos--; + } +} +function _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos, wordLen, wordStart, newMatchStart, outFirstMatchStrong) { + if (patternLow[patternPos] !== wordLow[wordPos]) { + return Number.MIN_SAFE_INTEGER; + } + let score = 1; + let isGapLocation = false; + if (wordPos === (patternPos - patternStart)) { + // common prefix: `foobar <-> foobaz` + // ^^^^^ + score = pattern[patternPos] === word[wordPos] ? 7 : 5; + } + else if (isUpperCaseAtPos(wordPos, word, wordLow) && (wordPos === 0 || !isUpperCaseAtPos(wordPos - 1, word, wordLow))) { + // hitting upper-case: `foo <-> forOthers` + // ^^ ^ + score = pattern[patternPos] === word[wordPos] ? 7 : 5; + isGapLocation = true; + } + else if (isSeparatorAtPos(wordLow, wordPos) && (wordPos === 0 || !isSeparatorAtPos(wordLow, wordPos - 1))) { + // hitting a separator: `. <-> foo.bar` + // ^ + score = 5; + } + else if (isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1)) { + // post separator: `foo <-> bar_foo` + // ^^^ + score = 5; + isGapLocation = true; + } + if (score > 1 && patternPos === patternStart) { + outFirstMatchStrong[0] = true; + } + if (!isGapLocation) { + isGapLocation = isUpperCaseAtPos(wordPos, word, wordLow) || isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1); + } + // + if (patternPos === patternStart) { // first character in pattern + if (wordPos > wordStart) { + // the first pattern character would match a word character that is not at the word start + // so introduce a penalty to account for the gap preceding this match + score -= isGapLocation ? 3 : 5; + } + } + else { + if (newMatchStart) { + // this would be the beginning of a new match (i.e. there would be a gap before this location) + score += isGapLocation ? 2 : 0; + } + else { + // this is part of a contiguous match, so give it a slight bonus, but do so only if it would not be a preferred gap location + score += isGapLocation ? 0 : 1; + } + } + if (wordPos + 1 === wordLen) { + // we always penalize gaps, but this gives unfair advantages to a match that would match the last character in the word + // so pretend there is a gap after the last character in the word to normalize things + score -= isGapLocation ? 3 : 5; + } + return score; +} +//#endregion +//#region --- graceful --- +export function fuzzyScoreGracefulAggressive(pattern, lowPattern, patternPos, word, lowWord, wordPos, options) { + return fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, true, options); +} +function fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, aggressive, options) { + let top = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, options); + if (top && !aggressive) { + // when using the original pattern yield a result we` + // return it unless we are aggressive and try to find + // a better alignment, e.g. `cno` -> `^co^ns^ole` or `^c^o^nsole`. + return top; + } + if (pattern.length >= 3) { + // When the pattern is long enough then try a few (max 7) + // permutations of the pattern to find a better match. The + // permutations only swap neighbouring characters, e.g + // `cnoso` becomes `conso`, `cnsoo`, `cnoos`. + const tries = Math.min(7, pattern.length - 1); + for (let movingPatternPos = patternPos + 1; movingPatternPos < tries; movingPatternPos++) { + const newPattern = nextTypoPermutation(pattern, movingPatternPos); + if (newPattern) { + const candidate = fuzzyScore(newPattern, newPattern.toLowerCase(), patternPos, word, lowWord, wordPos, options); + if (candidate) { + candidate[0] -= 3; // permutation penalty + if (!top || candidate[0] > top[0]) { + top = candidate; + } + } + } + } + } + return top; +} +function nextTypoPermutation(pattern, patternPos) { + if (patternPos + 1 >= pattern.length) { + return undefined; + } + const swap1 = pattern[patternPos]; + const swap2 = pattern[patternPos + 1]; + if (swap1 === swap2) { + return undefined; + } + return pattern.slice(0, patternPos) + + swap2 + + swap1 + + pattern.slice(patternPos + 2); +} +//#endregion diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/functional.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/functional.js new file mode 100644 index 0000000000000000000000000000000000000000..3e2e2978e17b5ad21f5450d4775d0ce4b376d82b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/functional.js @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/** + * Given a function, returns a function that is only calling that function once. + */ +export function createSingleCallFunction(fn, fnDidRunCallback) { + const _this = this; + let didCall = false; + let result; + return function () { + if (didCall) { + return result; + } + didCall = true; + if (fnDidRunCallback) { + try { + result = fn.apply(_this, arguments); + } + finally { + fnDidRunCallback(); + } + } + else { + result = fn.apply(_this, arguments); + } + return result; + }; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/fuzzyScorer.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/fuzzyScorer.js new file mode 100644 index 0000000000000000000000000000000000000000..f57eb016bf1e1c24aa76ff7f4eb9322b65122db1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/fuzzyScorer.js @@ -0,0 +1,138 @@ +import { createMatches as createFuzzyMatches, fuzzyScore } from './filters.js'; +import { sep } from './path.js'; +import { isWindows } from './platform.js'; +import { stripWildcards } from './strings.js'; +const NO_SCORE2 = [undefined, []]; +export function scoreFuzzy2(target, query, patternStart = 0, wordStart = 0) { + // Score: multiple inputs + const preparedQuery = query; + if (preparedQuery.values && preparedQuery.values.length > 1) { + return doScoreFuzzy2Multiple(target, preparedQuery.values, patternStart, wordStart); + } + // Score: single input + return doScoreFuzzy2Single(target, query, patternStart, wordStart); +} +function doScoreFuzzy2Multiple(target, query, patternStart, wordStart) { + let totalScore = 0; + const totalMatches = []; + for (const queryPiece of query) { + const [score, matches] = doScoreFuzzy2Single(target, queryPiece, patternStart, wordStart); + if (typeof score !== 'number') { + // if a single query value does not match, return with + // no score entirely, we require all queries to match + return NO_SCORE2; + } + totalScore += score; + totalMatches.push(...matches); + } + // if we have a score, ensure that the positions are + // sorted in ascending order and distinct + return [totalScore, normalizeMatches(totalMatches)]; +} +function doScoreFuzzy2Single(target, query, patternStart, wordStart) { + const score = fuzzyScore(query.original, query.originalLowercase, patternStart, target, target.toLowerCase(), wordStart, { firstMatchCanBeWeak: true, boostFullMatch: true }); + if (!score) { + return NO_SCORE2; + } + return [score[0], createFuzzyMatches(score)]; +} +const NO_ITEM_SCORE = Object.freeze({ score: 0 }); +function normalizeMatches(matches) { + // sort matches by start to be able to normalize + const sortedMatches = matches.sort((matchA, matchB) => { + return matchA.start - matchB.start; + }); + // merge matches that overlap + const normalizedMatches = []; + let currentMatch = undefined; + for (const match of sortedMatches) { + // if we have no current match or the matches + // do not overlap, we take it as is and remember + // it for future merging + if (!currentMatch || !matchOverlaps(currentMatch, match)) { + currentMatch = match; + normalizedMatches.push(match); + } + // otherwise we merge the matches + else { + currentMatch.start = Math.min(currentMatch.start, match.start); + currentMatch.end = Math.max(currentMatch.end, match.end); + } + } + return normalizedMatches; +} +function matchOverlaps(matchA, matchB) { + if (matchA.end < matchB.start) { + return false; // A ends before B starts + } + if (matchB.end < matchA.start) { + return false; // B ends before A starts + } + return true; +} +/* + * If a query is wrapped in quotes, the user does not want to + * use fuzzy search for this query. + */ +function queryExpectsExactMatch(query) { + return query.startsWith('"') && query.endsWith('"'); +} +/** + * Helper function to prepare a search value for scoring by removing unwanted characters + * and allowing to score on multiple pieces separated by whitespace character. + */ +const MULTIPLE_QUERY_VALUES_SEPARATOR = ' '; +export function prepareQuery(original) { + if (typeof original !== 'string') { + original = ''; + } + const originalLowercase = original.toLowerCase(); + const { pathNormalized, normalized, normalizedLowercase } = normalizeQuery(original); + const containsPathSeparator = pathNormalized.indexOf(sep) >= 0; + const expectExactMatch = queryExpectsExactMatch(original); + let values = undefined; + const originalSplit = original.split(MULTIPLE_QUERY_VALUES_SEPARATOR); + if (originalSplit.length > 1) { + for (const originalPiece of originalSplit) { + const expectExactMatchPiece = queryExpectsExactMatch(originalPiece); + const { pathNormalized: pathNormalizedPiece, normalized: normalizedPiece, normalizedLowercase: normalizedLowercasePiece } = normalizeQuery(originalPiece); + if (normalizedPiece) { + if (!values) { + values = []; + } + values.push({ + original: originalPiece, + originalLowercase: originalPiece.toLowerCase(), + pathNormalized: pathNormalizedPiece, + normalized: normalizedPiece, + normalizedLowercase: normalizedLowercasePiece, + expectContiguousMatch: expectExactMatchPiece + }); + } + } + } + return { original, originalLowercase, pathNormalized, normalized, normalizedLowercase, values, containsPathSeparator, expectContiguousMatch: expectExactMatch }; +} +function normalizeQuery(original) { + let pathNormalized; + if (isWindows) { + pathNormalized = original.replace(/\//g, sep); // Help Windows users to search for paths when using slash + } + else { + pathNormalized = original.replace(/\\/g, sep); // Help macOS/Linux users to search for paths when using backslash + } + // we remove quotes here because quotes are used for exact match search + const normalized = stripWildcards(pathNormalized).replace(/\s|"/g, ''); + return { + pathNormalized, + normalized, + normalizedLowercase: normalized.toLowerCase() + }; +} +export function pieceToQuery(arg1) { + if (Array.isArray(arg1)) { + return prepareQuery(arg1.map(piece => piece.original).join(MULTIPLE_QUERY_VALUES_SEPARATOR)); + } + return prepareQuery(arg1.original); +} +//#endregion diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/glob.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/glob.js new file mode 100644 index 0000000000000000000000000000000000000000..04de205e1dfc0c7dbdf8f10b6185cc4fd3a767fc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/glob.js @@ -0,0 +1,568 @@ +import { isThenable } from './async.js'; +import { isEqualOrParent } from './extpath.js'; +import { LRUCache } from './map.js'; +import { basename, extname, posix, sep } from './path.js'; +import { isLinux } from './platform.js'; +import { escapeRegExpCharacters, ltrim } from './strings.js'; +export const GLOBSTAR = '**'; +export const GLOB_SPLIT = '/'; +const PATH_REGEX = '[/\\\\]'; // any slash or backslash +const NO_PATH_REGEX = '[^/\\\\]'; // any non-slash and non-backslash +const ALL_FORWARD_SLASHES = /\//g; +function starsToRegExp(starCount, isLastPattern) { + switch (starCount) { + case 0: + return ''; + case 1: + return `${NO_PATH_REGEX}*?`; // 1 star matches any number of characters except path separator (/ and \) - non greedy (?) + default: + // Matches: (Path Sep OR Path Val followed by Path Sep) 0-many times except when it's the last pattern + // in which case also matches (Path Sep followed by Path Val) + // Group is non capturing because we don't need to capture at all (?:...) + // Overall we use non-greedy matching because it could be that we match too much + return `(?:${PATH_REGEX}|${NO_PATH_REGEX}+${PATH_REGEX}${isLastPattern ? `|${PATH_REGEX}${NO_PATH_REGEX}+` : ''})*?`; + } +} +export function splitGlobAware(pattern, splitChar) { + if (!pattern) { + return []; + } + const segments = []; + let inBraces = false; + let inBrackets = false; + let curVal = ''; + for (const char of pattern) { + switch (char) { + case splitChar: + if (!inBraces && !inBrackets) { + segments.push(curVal); + curVal = ''; + continue; + } + break; + case '{': + inBraces = true; + break; + case '}': + inBraces = false; + break; + case '[': + inBrackets = true; + break; + case ']': + inBrackets = false; + break; + } + curVal += char; + } + // Tail + if (curVal) { + segments.push(curVal); + } + return segments; +} +function parseRegExp(pattern) { + if (!pattern) { + return ''; + } + let regEx = ''; + // Split up into segments for each slash found + const segments = splitGlobAware(pattern, GLOB_SPLIT); + // Special case where we only have globstars + if (segments.every(segment => segment === GLOBSTAR)) { + regEx = '.*'; + } + // Build regex over segments + else { + let previousSegmentWasGlobStar = false; + segments.forEach((segment, index) => { + // Treat globstar specially + if (segment === GLOBSTAR) { + // if we have more than one globstar after another, just ignore it + if (previousSegmentWasGlobStar) { + return; + } + regEx += starsToRegExp(2, index === segments.length - 1); + } + // Anything else, not globstar + else { + // States + let inBraces = false; + let braceVal = ''; + let inBrackets = false; + let bracketVal = ''; + for (const char of segment) { + // Support brace expansion + if (char !== '}' && inBraces) { + braceVal += char; + continue; + } + // Support brackets + if (inBrackets && (char !== ']' || !bracketVal) /* ] is literally only allowed as first character in brackets to match it */) { + let res; + // range operator + if (char === '-') { + res = char; + } + // negation operator (only valid on first index in bracket) + else if ((char === '^' || char === '!') && !bracketVal) { + res = '^'; + } + // glob split matching is not allowed within character ranges + // see http://man7.org/linux/man-pages/man7/glob.7.html + else if (char === GLOB_SPLIT) { + res = ''; + } + // anything else gets escaped + else { + res = escapeRegExpCharacters(char); + } + bracketVal += res; + continue; + } + switch (char) { + case '{': + inBraces = true; + continue; + case '[': + inBrackets = true; + continue; + case '}': { + const choices = splitGlobAware(braceVal, ','); + // Converts {foo,bar} => [foo|bar] + const braceRegExp = `(?:${choices.map(choice => parseRegExp(choice)).join('|')})`; + regEx += braceRegExp; + inBraces = false; + braceVal = ''; + break; + } + case ']': { + regEx += ('[' + bracketVal + ']'); + inBrackets = false; + bracketVal = ''; + break; + } + case '?': + regEx += NO_PATH_REGEX; // 1 ? matches any single character except path separator (/ and \) + continue; + case '*': + regEx += starsToRegExp(1); + continue; + default: + regEx += escapeRegExpCharacters(char); + } + } + // Tail: Add the slash we had split on if there is more to + // come and the remaining pattern is not a globstar + // For example if pattern: some/**/*.js we want the "/" after + // some to be included in the RegEx to prevent a folder called + // "something" to match as well. + if (index < segments.length - 1 && // more segments to come after this + (segments[index + 1] !== GLOBSTAR || // next segment is not **, or... + index + 2 < segments.length // ...next segment is ** but there is more segments after that + )) { + regEx += PATH_REGEX; + } + } + // update globstar state + previousSegmentWasGlobStar = (segment === GLOBSTAR); + }); + } + return regEx; +} +// regexes to check for trivial glob patterns that just check for String#endsWith +const T1 = /^\*\*\/\*\.[\w\.-]+$/; // **/*.something +const T2 = /^\*\*\/([\w\.-]+)\/?$/; // **/something +const T3 = /^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/; // {**/*.something,**/*.else} or {**/package.json,**/project.json} +const T3_2 = /^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/; // Like T3, with optional trailing /** +const T4 = /^\*\*((\/[\w\.-]+)+)\/?$/; // **/something/else +const T5 = /^([\w\.-]+(\/[\w\.-]+)*)\/?$/; // something/else +const CACHE = new LRUCache(10000); // bounded to 10000 elements +const FALSE = function () { + return false; +}; +const NULL = function () { + return null; +}; +function parsePattern(arg1, options) { + if (!arg1) { + return NULL; + } + // Handle relative patterns + let pattern; + if (typeof arg1 !== 'string') { + pattern = arg1.pattern; + } + else { + pattern = arg1; + } + // Whitespace trimming + pattern = pattern.trim(); + // Check cache + const patternKey = `${pattern}_${!!options.trimForExclusions}`; + let parsedPattern = CACHE.get(patternKey); + if (parsedPattern) { + return wrapRelativePattern(parsedPattern, arg1); + } + // Check for Trivials + let match; + if (T1.test(pattern)) { + parsedPattern = trivia1(pattern.substr(4), pattern); // common pattern: **/*.txt just need endsWith check + } + else if (match = T2.exec(trimForExclusions(pattern, options))) { // common pattern: **/some.txt just need basename check + parsedPattern = trivia2(match[1], pattern); + } + else if ((options.trimForExclusions ? T3_2 : T3).test(pattern)) { // repetition of common patterns (see above) {**/*.txt,**/*.png} + parsedPattern = trivia3(pattern, options); + } + else if (match = T4.exec(trimForExclusions(pattern, options))) { // common pattern: **/something/else just need endsWith check + parsedPattern = trivia4and5(match[1].substr(1), pattern, true); + } + else if (match = T5.exec(trimForExclusions(pattern, options))) { // common pattern: something/else just need equals check + parsedPattern = trivia4and5(match[1], pattern, false); + } + // Otherwise convert to pattern + else { + parsedPattern = toRegExp(pattern); + } + // Cache + CACHE.set(patternKey, parsedPattern); + return wrapRelativePattern(parsedPattern, arg1); +} +function wrapRelativePattern(parsedPattern, arg2) { + if (typeof arg2 === 'string') { + return parsedPattern; + } + const wrappedPattern = function (path, basename) { + if (!isEqualOrParent(path, arg2.base, !isLinux)) { + // skip glob matching if `base` is not a parent of `path` + return null; + } + // Given we have checked `base` being a parent of `path`, + // we can now remove the `base` portion of the `path` + // and only match on the remaining path components + // For that we try to extract the portion of the `path` + // that comes after the `base` portion. We have to account + // for the fact that `base` might end in a path separator + // (https://github.com/microsoft/vscode/issues/162498) + return parsedPattern(ltrim(path.substr(arg2.base.length), sep), basename); + }; + // Make sure to preserve associated metadata + wrappedPattern.allBasenames = parsedPattern.allBasenames; + wrappedPattern.allPaths = parsedPattern.allPaths; + wrappedPattern.basenames = parsedPattern.basenames; + wrappedPattern.patterns = parsedPattern.patterns; + return wrappedPattern; +} +function trimForExclusions(pattern, options) { + return options.trimForExclusions && pattern.endsWith('/**') ? pattern.substr(0, pattern.length - 2) : pattern; // dropping **, tailing / is dropped later +} +// common pattern: **/*.txt just need endsWith check +function trivia1(base, pattern) { + return function (path, basename) { + return typeof path === 'string' && path.endsWith(base) ? pattern : null; + }; +} +// common pattern: **/some.txt just need basename check +function trivia2(base, pattern) { + const slashBase = `/${base}`; + const backslashBase = `\\${base}`; + const parsedPattern = function (path, basename) { + if (typeof path !== 'string') { + return null; + } + if (basename) { + return basename === base ? pattern : null; + } + return path === base || path.endsWith(slashBase) || path.endsWith(backslashBase) ? pattern : null; + }; + const basenames = [base]; + parsedPattern.basenames = basenames; + parsedPattern.patterns = [pattern]; + parsedPattern.allBasenames = basenames; + return parsedPattern; +} +// repetition of common patterns (see above) {**/*.txt,**/*.png} +function trivia3(pattern, options) { + const parsedPatterns = aggregateBasenameMatches(pattern.slice(1, -1) + .split(',') + .map(pattern => parsePattern(pattern, options)) + .filter(pattern => pattern !== NULL), pattern); + const patternsLength = parsedPatterns.length; + if (!patternsLength) { + return NULL; + } + if (patternsLength === 1) { + return parsedPatterns[0]; + } + const parsedPattern = function (path, basename) { + for (let i = 0, n = parsedPatterns.length; i < n; i++) { + if (parsedPatterns[i](path, basename)) { + return pattern; + } + } + return null; + }; + const withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames); + if (withBasenames) { + parsedPattern.allBasenames = withBasenames.allBasenames; + } + const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []); + if (allPaths.length) { + parsedPattern.allPaths = allPaths; + } + return parsedPattern; +} +// common patterns: **/something/else just need endsWith check, something/else just needs and equals check +function trivia4and5(targetPath, pattern, matchPathEnds) { + const usingPosixSep = sep === posix.sep; + const nativePath = usingPosixSep ? targetPath : targetPath.replace(ALL_FORWARD_SLASHES, sep); + const nativePathEnd = sep + nativePath; + const targetPathEnd = posix.sep + targetPath; + let parsedPattern; + if (matchPathEnds) { + parsedPattern = function (path, basename) { + return typeof path === 'string' && ((path === nativePath || path.endsWith(nativePathEnd)) || !usingPosixSep && (path === targetPath || path.endsWith(targetPathEnd))) ? pattern : null; + }; + } + else { + parsedPattern = function (path, basename) { + return typeof path === 'string' && (path === nativePath || (!usingPosixSep && path === targetPath)) ? pattern : null; + }; + } + parsedPattern.allPaths = [(matchPathEnds ? '*/' : './') + targetPath]; + return parsedPattern; +} +function toRegExp(pattern) { + try { + const regExp = new RegExp(`^${parseRegExp(pattern)}$`); + return function (path) { + regExp.lastIndex = 0; // reset RegExp to its initial state to reuse it! + return typeof path === 'string' && regExp.test(path) ? pattern : null; + }; + } + catch (error) { + return NULL; + } +} +export function match(arg1, path, hasSibling) { + if (!arg1 || typeof path !== 'string') { + return false; + } + return parse(arg1)(path, undefined, hasSibling); +} +export function parse(arg1, options = {}) { + if (!arg1) { + return FALSE; + } + // Glob with String + if (typeof arg1 === 'string' || isRelativePattern(arg1)) { + const parsedPattern = parsePattern(arg1, options); + if (parsedPattern === NULL) { + return FALSE; + } + const resultPattern = function (path, basename) { + return !!parsedPattern(path, basename); + }; + if (parsedPattern.allBasenames) { + resultPattern.allBasenames = parsedPattern.allBasenames; + } + if (parsedPattern.allPaths) { + resultPattern.allPaths = parsedPattern.allPaths; + } + return resultPattern; + } + // Glob with Expression + return parsedExpression(arg1, options); +} +export function isRelativePattern(obj) { + const rp = obj; + if (!rp) { + return false; + } + return typeof rp.base === 'string' && typeof rp.pattern === 'string'; +} +function parsedExpression(expression, options) { + const parsedPatterns = aggregateBasenameMatches(Object.getOwnPropertyNames(expression) + .map(pattern => parseExpressionPattern(pattern, expression[pattern], options)) + .filter(pattern => pattern !== NULL)); + const patternsLength = parsedPatterns.length; + if (!patternsLength) { + return NULL; + } + if (!parsedPatterns.some(parsedPattern => !!parsedPattern.requiresSiblings)) { + if (patternsLength === 1) { + return parsedPatterns[0]; + } + const resultExpression = function (path, basename) { + let resultPromises = undefined; + for (let i = 0, n = parsedPatterns.length; i < n; i++) { + const result = parsedPatterns[i](path, basename); + if (typeof result === 'string') { + return result; // immediately return as soon as the first expression matches + } + // If the result is a promise, we have to keep it for + // later processing and await the result properly. + if (isThenable(result)) { + if (!resultPromises) { + resultPromises = []; + } + resultPromises.push(result); + } + } + // With result promises, we have to loop over each and + // await the result before we can return any result. + if (resultPromises) { + return (async () => { + for (const resultPromise of resultPromises) { + const result = await resultPromise; + if (typeof result === 'string') { + return result; + } + } + return null; + })(); + } + return null; + }; + const withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames); + if (withBasenames) { + resultExpression.allBasenames = withBasenames.allBasenames; + } + const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []); + if (allPaths.length) { + resultExpression.allPaths = allPaths; + } + return resultExpression; + } + const resultExpression = function (path, base, hasSibling) { + let name = undefined; + let resultPromises = undefined; + for (let i = 0, n = parsedPatterns.length; i < n; i++) { + // Pattern matches path + const parsedPattern = parsedPatterns[i]; + if (parsedPattern.requiresSiblings && hasSibling) { + if (!base) { + base = basename(path); + } + if (!name) { + name = base.substr(0, base.length - extname(path).length); + } + } + const result = parsedPattern(path, base, name, hasSibling); + if (typeof result === 'string') { + return result; // immediately return as soon as the first expression matches + } + // If the result is a promise, we have to keep it for + // later processing and await the result properly. + if (isThenable(result)) { + if (!resultPromises) { + resultPromises = []; + } + resultPromises.push(result); + } + } + // With result promises, we have to loop over each and + // await the result before we can return any result. + if (resultPromises) { + return (async () => { + for (const resultPromise of resultPromises) { + const result = await resultPromise; + if (typeof result === 'string') { + return result; + } + } + return null; + })(); + } + return null; + }; + const withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames); + if (withBasenames) { + resultExpression.allBasenames = withBasenames.allBasenames; + } + const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []); + if (allPaths.length) { + resultExpression.allPaths = allPaths; + } + return resultExpression; +} +function parseExpressionPattern(pattern, value, options) { + if (value === false) { + return NULL; // pattern is disabled + } + const parsedPattern = parsePattern(pattern, options); + if (parsedPattern === NULL) { + return NULL; + } + // Expression Pattern is + if (typeof value === 'boolean') { + return parsedPattern; + } + // Expression Pattern is + if (value) { + const when = value.when; + if (typeof when === 'string') { + const result = (path, basename, name, hasSibling) => { + if (!hasSibling || !parsedPattern(path, basename)) { + return null; + } + const clausePattern = when.replace('$(basename)', () => name); + const matched = hasSibling(clausePattern); + return isThenable(matched) ? + matched.then(match => match ? pattern : null) : + matched ? pattern : null; + }; + result.requiresSiblings = true; + return result; + } + } + // Expression is anything + return parsedPattern; +} +function aggregateBasenameMatches(parsedPatterns, result) { + const basenamePatterns = parsedPatterns.filter(parsedPattern => !!parsedPattern.basenames); + if (basenamePatterns.length < 2) { + return parsedPatterns; + } + const basenames = basenamePatterns.reduce((all, current) => { + const basenames = current.basenames; + return basenames ? all.concat(basenames) : all; + }, []); + let patterns; + if (result) { + patterns = []; + for (let i = 0, n = basenames.length; i < n; i++) { + patterns.push(result); + } + } + else { + patterns = basenamePatterns.reduce((all, current) => { + const patterns = current.patterns; + return patterns ? all.concat(patterns) : all; + }, []); + } + const aggregate = function (path, basename) { + if (typeof path !== 'string') { + return null; + } + if (!basename) { + let i; + for (i = path.length; i > 0; i--) { + const ch = path.charCodeAt(i - 1); + if (ch === 47 /* CharCode.Slash */ || ch === 92 /* CharCode.Backslash */) { + break; + } + } + basename = path.substr(i); + } + const index = basenames.indexOf(basename); + return index !== -1 ? patterns[index] : null; + }; + aggregate.basenames = basenames; + aggregate.patterns = patterns; + aggregate.allBasenames = basenames; + const aggregatedPatterns = parsedPatterns.filter(parsedPattern => !parsedPattern.basenames); + aggregatedPatterns.push(aggregate); + return aggregatedPatterns; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hash.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hash.js new file mode 100644 index 0000000000000000000000000000000000000000..07672b5d94a4f81e26f22dce2b1487dcc251b03f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hash.js @@ -0,0 +1,258 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as strings from './strings.js'; +/** + * Return a hash value for an object. + */ +export function hash(obj) { + return doHash(obj, 0); +} +export function doHash(obj, hashVal) { + switch (typeof obj) { + case 'object': + if (obj === null) { + return numberHash(349, hashVal); + } + else if (Array.isArray(obj)) { + return arrayHash(obj, hashVal); + } + return objectHash(obj, hashVal); + case 'string': + return stringHash(obj, hashVal); + case 'boolean': + return booleanHash(obj, hashVal); + case 'number': + return numberHash(obj, hashVal); + case 'undefined': + return numberHash(937, hashVal); + default: + return numberHash(617, hashVal); + } +} +export function numberHash(val, initialHashVal) { + return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32 +} +function booleanHash(b, initialHashVal) { + return numberHash(b ? 433 : 863, initialHashVal); +} +export function stringHash(s, hashVal) { + hashVal = numberHash(149417, hashVal); + for (let i = 0, length = s.length; i < length; i++) { + hashVal = numberHash(s.charCodeAt(i), hashVal); + } + return hashVal; +} +function arrayHash(arr, initialHashVal) { + initialHashVal = numberHash(104579, initialHashVal); + return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal); +} +function objectHash(obj, initialHashVal) { + initialHashVal = numberHash(181387, initialHashVal); + return Object.keys(obj).sort().reduce((hashVal, key) => { + hashVal = stringHash(key, hashVal); + return doHash(obj[key], hashVal); + }, initialHashVal); +} +function leftRotate(value, bits, totalBits = 32) { + // delta + bits = totalBits + const delta = totalBits - bits; + // All ones, expect `delta` zeros aligned to the right + const mask = ~((1 << delta) - 1); + // Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits) + return ((value << bits) | ((mask & value) >>> delta)) >>> 0; +} +function fill(dest, index = 0, count = dest.byteLength, value = 0) { + for (let i = 0; i < count; i++) { + dest[index + i] = value; + } +} +function leftPad(value, length, char = '0') { + while (value.length < length) { + value = char + value; + } + return value; +} +export function toHexString(bufferOrValue, bitsize = 32) { + if (bufferOrValue instanceof ArrayBuffer) { + return Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join(''); + } + return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4); +} +/** + * A SHA1 implementation that works with strings and does not allocate. + */ +export class StringSHA1 { + static { this._bigBlock32 = new DataView(new ArrayBuffer(320)); } // 80 * 4 = 320 + constructor() { + this._h0 = 0x67452301; + this._h1 = 0xEFCDAB89; + this._h2 = 0x98BADCFE; + this._h3 = 0x10325476; + this._h4 = 0xC3D2E1F0; + this._buff = new Uint8Array(64 /* SHA1Constant.BLOCK_SIZE */ + 3 /* to fit any utf-8 */); + this._buffDV = new DataView(this._buff.buffer); + this._buffLen = 0; + this._totalLen = 0; + this._leftoverHighSurrogate = 0; + this._finished = false; + } + update(str) { + const strLen = str.length; + if (strLen === 0) { + return; + } + const buff = this._buff; + let buffLen = this._buffLen; + let leftoverHighSurrogate = this._leftoverHighSurrogate; + let charCode; + let offset; + if (leftoverHighSurrogate !== 0) { + charCode = leftoverHighSurrogate; + offset = -1; + leftoverHighSurrogate = 0; + } + else { + charCode = str.charCodeAt(0); + offset = 0; + } + while (true) { + let codePoint = charCode; + if (strings.isHighSurrogate(charCode)) { + if (offset + 1 < strLen) { + const nextCharCode = str.charCodeAt(offset + 1); + if (strings.isLowSurrogate(nextCharCode)) { + offset++; + codePoint = strings.computeCodePoint(charCode, nextCharCode); + } + else { + // illegal => unicode replacement character + codePoint = 65533 /* SHA1Constant.UNICODE_REPLACEMENT */; + } + } + else { + // last character is a surrogate pair + leftoverHighSurrogate = charCode; + break; + } + } + else if (strings.isLowSurrogate(charCode)) { + // illegal => unicode replacement character + codePoint = 65533 /* SHA1Constant.UNICODE_REPLACEMENT */; + } + buffLen = this._push(buff, buffLen, codePoint); + offset++; + if (offset < strLen) { + charCode = str.charCodeAt(offset); + } + else { + break; + } + } + this._buffLen = buffLen; + this._leftoverHighSurrogate = leftoverHighSurrogate; + } + _push(buff, buffLen, codePoint) { + if (codePoint < 0x0080) { + buff[buffLen++] = codePoint; + } + else if (codePoint < 0x0800) { + buff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6); + buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0); + } + else if (codePoint < 0x10000) { + buff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12); + buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6); + buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0); + } + else { + buff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18); + buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12); + buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6); + buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0); + } + if (buffLen >= 64 /* SHA1Constant.BLOCK_SIZE */) { + this._step(); + buffLen -= 64 /* SHA1Constant.BLOCK_SIZE */; + this._totalLen += 64 /* SHA1Constant.BLOCK_SIZE */; + // take last 3 in case of UTF8 overflow + buff[0] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 0]; + buff[1] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 1]; + buff[2] = buff[64 /* SHA1Constant.BLOCK_SIZE */ + 2]; + } + return buffLen; + } + digest() { + if (!this._finished) { + this._finished = true; + if (this._leftoverHighSurrogate) { + // illegal => unicode replacement character + this._leftoverHighSurrogate = 0; + this._buffLen = this._push(this._buff, this._buffLen, 65533 /* SHA1Constant.UNICODE_REPLACEMENT */); + } + this._totalLen += this._buffLen; + this._wrapUp(); + } + return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4); + } + _wrapUp() { + this._buff[this._buffLen++] = 0x80; + fill(this._buff, this._buffLen); + if (this._buffLen > 56) { + this._step(); + fill(this._buff); + } + // this will fit because the mantissa can cover up to 52 bits + const ml = 8 * this._totalLen; + this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false); + this._buffDV.setUint32(60, ml % 4294967296, false); + this._step(); + } + _step() { + const bigBlock32 = StringSHA1._bigBlock32; + const data = this._buffDV; + for (let j = 0; j < 64 /* 16*4 */; j += 4) { + bigBlock32.setUint32(j, data.getUint32(j, false), false); + } + for (let j = 64; j < 320 /* 80*4 */; j += 4) { + bigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false); + } + let a = this._h0; + let b = this._h1; + let c = this._h2; + let d = this._h3; + let e = this._h4; + let f, k; + let temp; + for (let j = 0; j < 80; j++) { + if (j < 20) { + f = (b & c) | ((~b) & d); + k = 0x5A827999; + } + else if (j < 40) { + f = b ^ c ^ d; + k = 0x6ED9EBA1; + } + else if (j < 60) { + f = (b & c) | (b & d) | (c & d); + k = 0x8F1BBCDC; + } + else { + f = b ^ c ^ d; + k = 0xCA62C1D6; + } + temp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff; + e = d; + d = c; + c = leftRotate(b, 30); + b = a; + a = temp; + } + this._h0 = (this._h0 + a) & 0xffffffff; + this._h1 = (this._h1 + b) & 0xffffffff; + this._h2 = (this._h2 + c) & 0xffffffff; + this._h3 = (this._h3 + d) & 0xffffffff; + this._h4 = (this._h4 + e) & 0xffffffff; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hierarchicalKind.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hierarchicalKind.js new file mode 100644 index 0000000000000000000000000000000000000000..e2ade5165c2bf1d39ddbe05194a69c13626cf399 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hierarchicalKind.js @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class HierarchicalKind { + static { this.sep = '.'; } + static { this.None = new HierarchicalKind('@@none@@'); } // Special kind that matches nothing + static { this.Empty = new HierarchicalKind(''); } + constructor(value) { + this.value = value; + } + equals(other) { + return this.value === other.value; + } + contains(other) { + return this.equals(other) || this.value === '' || other.value.startsWith(this.value + HierarchicalKind.sep); + } + intersects(other) { + return this.contains(other) || other.contains(this); + } + append(...parts) { + return new HierarchicalKind((this.value ? [this.value, ...parts] : parts).join(HierarchicalKind.sep)); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/history.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/history.js new file mode 100644 index 0000000000000000000000000000000000000000..6e75bdd50a3c46a97376e84c705ed4c07fd498c1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/history.js @@ -0,0 +1,73 @@ +import { ArrayNavigator } from './navigator.js'; +export class HistoryNavigator { + constructor(history = [], limit = 10) { + this._initialize(history); + this._limit = limit; + this._onChange(); + } + getHistory() { + return this._elements; + } + add(t) { + this._history.delete(t); + this._history.add(t); + this._onChange(); + } + next() { + // This will navigate past the end of the last element, and in that case the input should be cleared + return this._navigator.next(); + } + previous() { + if (this._currentPosition() !== 0) { + return this._navigator.previous(); + } + return null; + } + current() { + return this._navigator.current(); + } + first() { + return this._navigator.first(); + } + last() { + return this._navigator.last(); + } + isLast() { + return this._currentPosition() >= this._elements.length - 1; + } + isNowhere() { + return this._navigator.current() === null; + } + has(t) { + return this._history.has(t); + } + _onChange() { + this._reduceToLimit(); + const elements = this._elements; + this._navigator = new ArrayNavigator(elements, 0, elements.length, elements.length); + } + _reduceToLimit() { + const data = this._elements; + if (data.length > this._limit) { + this._initialize(data.slice(data.length - this._limit)); + } + } + _currentPosition() { + const currentElement = this._navigator.current(); + if (!currentElement) { + return -1; + } + return this._elements.indexOf(currentElement); + } + _initialize(history) { + this._history = new Set(); + for (const entry of history) { + this._history.add(entry); + } + } + get _elements() { + const elements = []; + this._history.forEach(e => elements.push(e)); + return elements; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hotReload.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hotReload.js new file mode 100644 index 0000000000000000000000000000000000000000..d001b529113c033735c934cc907678b3cc464959 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hotReload.js @@ -0,0 +1,81 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { env } from './process.js'; +export function isHotReloadEnabled() { + return env && !!env['VSCODE_DEV']; +} +export function registerHotReloadHandler(handler) { + if (!isHotReloadEnabled()) { + return { dispose() { } }; + } + else { + const handlers = registerGlobalHotReloadHandler(); + handlers.add(handler); + return { + dispose() { handlers.delete(handler); } + }; + } +} +function registerGlobalHotReloadHandler() { + if (!hotReloadHandlers) { + hotReloadHandlers = new Set(); + } + const g = globalThis; + if (!g.$hotReload_applyNewExports) { + g.$hotReload_applyNewExports = args => { + const args2 = { config: { mode: undefined }, ...args }; + const results = []; + for (const h of hotReloadHandlers) { + const result = h(args2); + if (result) { + results.push(result); + } + } + if (results.length > 0) { + return newExports => { + let result = false; + for (const r of results) { + if (r(newExports)) { + result = true; + } + } + return result; + }; + } + return undefined; + }; + } + return hotReloadHandlers; +} +let hotReloadHandlers = undefined; +if (isHotReloadEnabled()) { + // This code does not run in production. + registerHotReloadHandler(({ oldExports, newSrc, config }) => { + if (config.mode !== 'patch-prototype') { + return undefined; + } + return newExports => { + for (const key in newExports) { + const exportedItem = newExports[key]; + console.log(`[hot-reload] Patching prototype methods of '${key}'`, { exportedItem }); + if (typeof exportedItem === 'function' && exportedItem.prototype) { + const oldExportedItem = oldExports[key]; + if (oldExportedItem) { + for (const prop of Object.getOwnPropertyNames(exportedItem.prototype)) { + const descriptor = Object.getOwnPropertyDescriptor(exportedItem.prototype, prop); + const oldDescriptor = Object.getOwnPropertyDescriptor(oldExportedItem.prototype, prop); + if (descriptor?.value?.toString() !== oldDescriptor?.value?.toString()) { + console.log(`[hot-reload] Patching prototype method '${key}.${prop}'`); + } + Object.defineProperty(oldExportedItem.prototype, prop, descriptor); + } + newExports[key] = oldExportedItem; + } + } + } + return true; + }; + }); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hotReloadHelpers.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hotReloadHelpers.js new file mode 100644 index 0000000000000000000000000000000000000000..6285427e065289d315ac78745ac99147c2ba129d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/hotReloadHelpers.js @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { isHotReloadEnabled, registerHotReloadHandler } from './hotReload.js'; +import { observableSignalFromEvent } from './observable.js'; +export function readHotReloadableExport(value, reader) { + observeHotReloadableExports([value], reader); + return value; +} +export function observeHotReloadableExports(values, reader) { + if (isHotReloadEnabled()) { + const o = observableSignalFromEvent('reload', event => registerHotReloadHandler(({ oldExports }) => { + if (![...Object.values(oldExports)].some(v => values.includes(v))) { + return undefined; + } + return (_newExports) => { + event(undefined); + return true; + }; + })); + o.read(reader); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/htmlContent.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/htmlContent.js new file mode 100644 index 0000000000000000000000000000000000000000..c4461c09207e4dacf2ff1acf9147d8492f770bf1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/htmlContent.js @@ -0,0 +1,149 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { illegalArgument } from './errors.js'; +import { escapeIcons } from './iconLabels.js'; +import { isEqual } from './resources.js'; +import { escapeRegExpCharacters } from './strings.js'; +import { URI } from './uri.js'; +export class MarkdownString { + constructor(value = '', isTrustedOrOptions = false) { + this.value = value; + if (typeof this.value !== 'string') { + throw illegalArgument('value'); + } + if (typeof isTrustedOrOptions === 'boolean') { + this.isTrusted = isTrustedOrOptions; + this.supportThemeIcons = false; + this.supportHtml = false; + } + else { + this.isTrusted = isTrustedOrOptions.isTrusted ?? undefined; + this.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false; + this.supportHtml = isTrustedOrOptions.supportHtml ?? false; + } + } + appendText(value, newlineStyle = 0 /* MarkdownStringTextNewlineStyle.Paragraph */) { + this.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered. + .replace(/([ \t]+)/g, (_match, g1) => ' '.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered. + .replace(/\>/gm, '\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered. + .replace(/\n/g, newlineStyle === 1 /* MarkdownStringTextNewlineStyle.Break */ ? '\\\n' : '\n\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered. + return this; + } + appendMarkdown(value) { + this.value += value; + return this; + } + appendCodeblock(langId, code) { + this.value += `\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\n`; + return this; + } + appendLink(target, label, title) { + this.value += '['; + this.value += this._escape(label, ']'); + this.value += ']('; + this.value += this._escape(String(target), ')'); + if (title) { + this.value += ` "${this._escape(this._escape(title, '"'), ')')}"`; + } + this.value += ')'; + return this; + } + _escape(value, ch) { + const r = new RegExp(escapeRegExpCharacters(ch), 'g'); + return value.replace(r, (match, offset) => { + if (value.charAt(offset - 1) !== '\\') { + return `\\${match}`; + } + else { + return match; + } + }); + } +} +export function isEmptyMarkdownString(oneOrMany) { + if (isMarkdownString(oneOrMany)) { + return !oneOrMany.value; + } + else if (Array.isArray(oneOrMany)) { + return oneOrMany.every(isEmptyMarkdownString); + } + else { + return true; + } +} +export function isMarkdownString(thing) { + if (thing instanceof MarkdownString) { + return true; + } + else if (thing && typeof thing === 'object') { + return typeof thing.value === 'string' + && (typeof thing.isTrusted === 'boolean' || typeof thing.isTrusted === 'object' || thing.isTrusted === undefined) + && (typeof thing.supportThemeIcons === 'boolean' || thing.supportThemeIcons === undefined); + } + return false; +} +export function markdownStringEqual(a, b) { + if (a === b) { + return true; + } + else if (!a || !b) { + return false; + } + else { + return a.value === b.value + && a.isTrusted === b.isTrusted + && a.supportThemeIcons === b.supportThemeIcons + && a.supportHtml === b.supportHtml + && (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri))); + } +} +export function escapeMarkdownSyntaxTokens(text) { + // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash + return text.replace(/[\\`*_{}[\]()#+\-!~]/g, '\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class +} +/** + * @see https://github.com/microsoft/vscode/issues/193746 + */ +export function appendEscapedMarkdownCodeBlockFence(code, langId) { + const longestFenceLength = code.match(/^`+/gm)?.reduce((a, b) => (a.length > b.length ? a : b)).length ?? + 0; + const desiredFenceLength = longestFenceLength >= 3 ? longestFenceLength + 1 : 3; + // the markdown result + return [ + `${'`'.repeat(desiredFenceLength)}${langId}`, + code, + `${'`'.repeat(desiredFenceLength)}`, + ].join('\n'); +} +export function escapeDoubleQuotes(input) { + return input.replace(/"/g, '"'); +} +export function removeMarkdownEscapes(text) { + if (!text) { + return text; + } + return text.replace(/\\([\\`*_{}[\]()#+\-.!~])/g, '$1'); +} +export function parseHrefAndDimensions(href) { + const dimensions = []; + const splitted = href.split('|').map(s => s.trim()); + href = splitted[0]; + const parameters = splitted[1]; + if (parameters) { + const heightFromParams = /height=(\d+)/.exec(parameters); + const widthFromParams = /width=(\d+)/.exec(parameters); + const height = heightFromParams ? heightFromParams[1] : ''; + const width = widthFromParams ? widthFromParams[1] : ''; + const widthIsFinite = isFinite(parseInt(width)); + const heightIsFinite = isFinite(parseInt(height)); + if (widthIsFinite) { + dimensions.push(`width="${width}"`); + } + if (heightIsFinite) { + dimensions.push(`height="${height}"`); + } + } + return { href, dimensions }; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/iconLabels.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/iconLabels.js new file mode 100644 index 0000000000000000000000000000000000000000..87666a8a3546c849d43e1f06ab9358fcc7fbe80b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/iconLabels.js @@ -0,0 +1,85 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { matchesFuzzy } from './filters.js'; +import { ltrim } from './strings.js'; +import { ThemeIcon } from './themables.js'; +const iconStartMarker = '$('; +const iconsRegex = new RegExp(`\\$\\(${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?\\)`, 'g'); // no capturing groups +const escapeIconsRegex = new RegExp(`(\\\\)?${iconsRegex.source}`, 'g'); +export function escapeIcons(text) { + return text.replace(escapeIconsRegex, (match, escaped) => escaped ? match : `\\${match}`); +} +const markdownEscapedIconsRegex = new RegExp(`\\\\${iconsRegex.source}`, 'g'); +export function markdownEscapeEscapedIcons(text) { + // Need to add an extra \ for escaping in markdown + return text.replace(markdownEscapedIconsRegex, match => `\\${match}`); +} +const stripIconsRegex = new RegExp(`(\\s)?(\\\\)?${iconsRegex.source}(\\s)?`, 'g'); +/** + * Takes a label with icons (`$(iconId)xyz`) and strips the icons out (`xyz`) + */ +export function stripIcons(text) { + if (text.indexOf(iconStartMarker) === -1) { + return text; + } + return text.replace(stripIconsRegex, (match, preWhitespace, escaped, postWhitespace) => escaped ? match : preWhitespace || postWhitespace || ''); +} +/** + * Takes a label with icons (`$(iconId)xyz`), removes the icon syntax adds whitespace so that screen readers can read the text better. + */ +export function getCodiconAriaLabel(text) { + if (!text) { + return ''; + } + return text.replace(/\$\((.*?)\)/g, (_match, codiconName) => ` ${codiconName} `).trim(); +} +const _parseIconsRegex = new RegExp(`\\$\\(${ThemeIcon.iconNameCharacter}+\\)`, 'g'); +/** + * Takes a label with icons (`abc $(iconId)xyz`) and returns the text (`abc xyz`) and the offsets of the icons (`[3]`) + */ +export function parseLabelWithIcons(input) { + _parseIconsRegex.lastIndex = 0; + let text = ''; + const iconOffsets = []; + let iconsOffset = 0; + while (true) { + const pos = _parseIconsRegex.lastIndex; + const match = _parseIconsRegex.exec(input); + const chars = input.substring(pos, match?.index); + if (chars.length > 0) { + text += chars; + for (let i = 0; i < chars.length; i++) { + iconOffsets.push(iconsOffset); + } + } + if (!match) { + break; + } + iconsOffset += match[0].length; + } + return { text, iconOffsets }; +} +export function matchesFuzzyIconAware(query, target, enableSeparateSubstringMatching = false) { + const { text, iconOffsets } = target; + // Return early if there are no icon markers in the word to match against + if (!iconOffsets || iconOffsets.length === 0) { + return matchesFuzzy(query, text, enableSeparateSubstringMatching); + } + // Trim the word to match against because it could have leading + // whitespace now if the word started with an icon + const wordToMatchAgainstWithoutIconsTrimmed = ltrim(text, ' '); + const leadingWhitespaceOffset = text.length - wordToMatchAgainstWithoutIconsTrimmed.length; + // match on value without icon + const matches = matchesFuzzy(query, wordToMatchAgainstWithoutIconsTrimmed, enableSeparateSubstringMatching); + // Map matches back to offsets with icon and trimming + if (matches) { + for (const match of matches) { + const iconOffset = iconOffsets[match.start + leadingWhitespaceOffset] /* icon offsets at index */ + leadingWhitespaceOffset /* overall leading whitespace offset */; + match.start += iconOffset; + match.end += iconOffset; + } + } + return matches; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/idGenerator.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/idGenerator.js new file mode 100644 index 0000000000000000000000000000000000000000..b96e2c8b21811caaf13ef9eff3264408a003a818 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/idGenerator.js @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class IdGenerator { + constructor(prefix) { + this._prefix = prefix; + this._lastId = 0; + } + nextId() { + return this._prefix + (++this._lastId); + } +} +export const defaultGenerator = new IdGenerator('id#'); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/ime.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/ime.js new file mode 100644 index 0000000000000000000000000000000000000000..afa916b17eac9c2cc3195d98a1c5b095d78c6d74 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/ime.js @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Emitter } from './event.js'; +export class IMEImpl { + constructor() { + this._onDidChange = new Emitter(); + this.onDidChange = this._onDidChange.event; + this._enabled = true; + } + get enabled() { + return this._enabled; + } + /** + * Enable IME + */ + enable() { + this._enabled = true; + this._onDidChange.fire(); + } + /** + * Disable IME + */ + disable() { + this._enabled = false; + this._onDidChange.fire(); + } +} +export const IME = new IMEImpl(); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/iterator.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/iterator.js new file mode 100644 index 0000000000000000000000000000000000000000..19bfb46a3293880a2e77a02552c3ea89477dccdc --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/iterator.js @@ -0,0 +1,148 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export var Iterable; +(function (Iterable) { + function is(thing) { + return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function'; + } + Iterable.is = is; + const _empty = Object.freeze([]); + function empty() { + return _empty; + } + Iterable.empty = empty; + function* single(element) { + yield element; + } + Iterable.single = single; + function wrap(iterableOrElement) { + if (is(iterableOrElement)) { + return iterableOrElement; + } + else { + return single(iterableOrElement); + } + } + Iterable.wrap = wrap; + function from(iterable) { + return iterable || _empty; + } + Iterable.from = from; + function* reverse(array) { + for (let i = array.length - 1; i >= 0; i--) { + yield array[i]; + } + } + Iterable.reverse = reverse; + function isEmpty(iterable) { + return !iterable || iterable[Symbol.iterator]().next().done === true; + } + Iterable.isEmpty = isEmpty; + function first(iterable) { + return iterable[Symbol.iterator]().next().value; + } + Iterable.first = first; + function some(iterable, predicate) { + let i = 0; + for (const element of iterable) { + if (predicate(element, i++)) { + return true; + } + } + return false; + } + Iterable.some = some; + function find(iterable, predicate) { + for (const element of iterable) { + if (predicate(element)) { + return element; + } + } + return undefined; + } + Iterable.find = find; + function* filter(iterable, predicate) { + for (const element of iterable) { + if (predicate(element)) { + yield element; + } + } + } + Iterable.filter = filter; + function* map(iterable, fn) { + let index = 0; + for (const element of iterable) { + yield fn(element, index++); + } + } + Iterable.map = map; + function* flatMap(iterable, fn) { + let index = 0; + for (const element of iterable) { + yield* fn(element, index++); + } + } + Iterable.flatMap = flatMap; + function* concat(...iterables) { + for (const iterable of iterables) { + yield* iterable; + } + } + Iterable.concat = concat; + function reduce(iterable, reducer, initialValue) { + let value = initialValue; + for (const element of iterable) { + value = reducer(value, element); + } + return value; + } + Iterable.reduce = reduce; + /** + * Returns an iterable slice of the array, with the same semantics as `array.slice()`. + */ + function* slice(arr, from, to = arr.length) { + if (from < 0) { + from += arr.length; + } + if (to < 0) { + to += arr.length; + } + else if (to > arr.length) { + to = arr.length; + } + for (; from < to; from++) { + yield arr[from]; + } + } + Iterable.slice = slice; + /** + * Consumes `atMost` elements from iterable and returns the consumed elements, + * and an iterable for the rest of the elements. + */ + function consume(iterable, atMost = Number.POSITIVE_INFINITY) { + const consumed = []; + if (atMost === 0) { + return [consumed, iterable]; + } + const iterator = iterable[Symbol.iterator](); + for (let i = 0; i < atMost; i++) { + const next = iterator.next(); + if (next.done) { + return [consumed, Iterable.empty()]; + } + consumed.push(next.value); + } + return [consumed, { [Symbol.iterator]() { return iterator; } }]; + } + Iterable.consume = consume; + async function asyncToArray(iterable) { + const result = []; + for await (const item of iterable) { + result.push(item); + } + return Promise.resolve(result); + } + Iterable.asyncToArray = asyncToArray; +})(Iterable || (Iterable = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/jsonSchema.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/jsonSchema.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/jsonSchema.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keyCodes.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keyCodes.js new file mode 100644 index 0000000000000000000000000000000000000000..39d08e8acaac42d334da96ea361f6cefa00d3745 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keyCodes.js @@ -0,0 +1,372 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +class KeyCodeStrMap { + constructor() { + this._keyCodeToStr = []; + this._strToKeyCode = Object.create(null); + } + define(keyCode, str) { + this._keyCodeToStr[keyCode] = str; + this._strToKeyCode[str.toLowerCase()] = keyCode; + } + keyCodeToStr(keyCode) { + return this._keyCodeToStr[keyCode]; + } + strToKeyCode(str) { + return this._strToKeyCode[str.toLowerCase()] || 0 /* KeyCode.Unknown */; + } +} +const uiMap = new KeyCodeStrMap(); +const userSettingsUSMap = new KeyCodeStrMap(); +const userSettingsGeneralMap = new KeyCodeStrMap(); +export const EVENT_KEY_CODE_MAP = new Array(230); +export const NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE = {}; +const scanCodeIntToStr = []; +const scanCodeStrToInt = Object.create(null); +const scanCodeLowerCaseStrToInt = Object.create(null); +/** + * -1 if a ScanCode => KeyCode mapping depends on kb layout. + */ +export const IMMUTABLE_CODE_TO_KEY_CODE = []; +/** + * -1 if a KeyCode => ScanCode mapping depends on kb layout. + */ +export const IMMUTABLE_KEY_CODE_TO_CODE = []; +for (let i = 0; i <= 193 /* ScanCode.MAX_VALUE */; i++) { + IMMUTABLE_CODE_TO_KEY_CODE[i] = -1 /* KeyCode.DependsOnKbLayout */; +} +for (let i = 0; i <= 132 /* KeyCode.MAX_VALUE */; i++) { + IMMUTABLE_KEY_CODE_TO_CODE[i] = -1 /* ScanCode.DependsOnKbLayout */; +} +(function () { + // See https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx + // See https://github.com/microsoft/node-native-keymap/blob/88c0b0e5/deps/chromium/keyboard_codes_win.h + const empty = ''; + const mappings = [ + // immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel + [1, 0 /* ScanCode.None */, 'None', 0 /* KeyCode.Unknown */, 'unknown', 0, 'VK_UNKNOWN', empty, empty], + [1, 1 /* ScanCode.Hyper */, 'Hyper', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 2 /* ScanCode.Super */, 'Super', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 3 /* ScanCode.Fn */, 'Fn', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 4 /* ScanCode.FnLock */, 'FnLock', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 5 /* ScanCode.Suspend */, 'Suspend', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 6 /* ScanCode.Resume */, 'Resume', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 7 /* ScanCode.Turbo */, 'Turbo', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 8 /* ScanCode.Sleep */, 'Sleep', 0 /* KeyCode.Unknown */, empty, 0, 'VK_SLEEP', empty, empty], + [1, 9 /* ScanCode.WakeUp */, 'WakeUp', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [0, 10 /* ScanCode.KeyA */, 'KeyA', 31 /* KeyCode.KeyA */, 'A', 65, 'VK_A', empty, empty], + [0, 11 /* ScanCode.KeyB */, 'KeyB', 32 /* KeyCode.KeyB */, 'B', 66, 'VK_B', empty, empty], + [0, 12 /* ScanCode.KeyC */, 'KeyC', 33 /* KeyCode.KeyC */, 'C', 67, 'VK_C', empty, empty], + [0, 13 /* ScanCode.KeyD */, 'KeyD', 34 /* KeyCode.KeyD */, 'D', 68, 'VK_D', empty, empty], + [0, 14 /* ScanCode.KeyE */, 'KeyE', 35 /* KeyCode.KeyE */, 'E', 69, 'VK_E', empty, empty], + [0, 15 /* ScanCode.KeyF */, 'KeyF', 36 /* KeyCode.KeyF */, 'F', 70, 'VK_F', empty, empty], + [0, 16 /* ScanCode.KeyG */, 'KeyG', 37 /* KeyCode.KeyG */, 'G', 71, 'VK_G', empty, empty], + [0, 17 /* ScanCode.KeyH */, 'KeyH', 38 /* KeyCode.KeyH */, 'H', 72, 'VK_H', empty, empty], + [0, 18 /* ScanCode.KeyI */, 'KeyI', 39 /* KeyCode.KeyI */, 'I', 73, 'VK_I', empty, empty], + [0, 19 /* ScanCode.KeyJ */, 'KeyJ', 40 /* KeyCode.KeyJ */, 'J', 74, 'VK_J', empty, empty], + [0, 20 /* ScanCode.KeyK */, 'KeyK', 41 /* KeyCode.KeyK */, 'K', 75, 'VK_K', empty, empty], + [0, 21 /* ScanCode.KeyL */, 'KeyL', 42 /* KeyCode.KeyL */, 'L', 76, 'VK_L', empty, empty], + [0, 22 /* ScanCode.KeyM */, 'KeyM', 43 /* KeyCode.KeyM */, 'M', 77, 'VK_M', empty, empty], + [0, 23 /* ScanCode.KeyN */, 'KeyN', 44 /* KeyCode.KeyN */, 'N', 78, 'VK_N', empty, empty], + [0, 24 /* ScanCode.KeyO */, 'KeyO', 45 /* KeyCode.KeyO */, 'O', 79, 'VK_O', empty, empty], + [0, 25 /* ScanCode.KeyP */, 'KeyP', 46 /* KeyCode.KeyP */, 'P', 80, 'VK_P', empty, empty], + [0, 26 /* ScanCode.KeyQ */, 'KeyQ', 47 /* KeyCode.KeyQ */, 'Q', 81, 'VK_Q', empty, empty], + [0, 27 /* ScanCode.KeyR */, 'KeyR', 48 /* KeyCode.KeyR */, 'R', 82, 'VK_R', empty, empty], + [0, 28 /* ScanCode.KeyS */, 'KeyS', 49 /* KeyCode.KeyS */, 'S', 83, 'VK_S', empty, empty], + [0, 29 /* ScanCode.KeyT */, 'KeyT', 50 /* KeyCode.KeyT */, 'T', 84, 'VK_T', empty, empty], + [0, 30 /* ScanCode.KeyU */, 'KeyU', 51 /* KeyCode.KeyU */, 'U', 85, 'VK_U', empty, empty], + [0, 31 /* ScanCode.KeyV */, 'KeyV', 52 /* KeyCode.KeyV */, 'V', 86, 'VK_V', empty, empty], + [0, 32 /* ScanCode.KeyW */, 'KeyW', 53 /* KeyCode.KeyW */, 'W', 87, 'VK_W', empty, empty], + [0, 33 /* ScanCode.KeyX */, 'KeyX', 54 /* KeyCode.KeyX */, 'X', 88, 'VK_X', empty, empty], + [0, 34 /* ScanCode.KeyY */, 'KeyY', 55 /* KeyCode.KeyY */, 'Y', 89, 'VK_Y', empty, empty], + [0, 35 /* ScanCode.KeyZ */, 'KeyZ', 56 /* KeyCode.KeyZ */, 'Z', 90, 'VK_Z', empty, empty], + [0, 36 /* ScanCode.Digit1 */, 'Digit1', 22 /* KeyCode.Digit1 */, '1', 49, 'VK_1', empty, empty], + [0, 37 /* ScanCode.Digit2 */, 'Digit2', 23 /* KeyCode.Digit2 */, '2', 50, 'VK_2', empty, empty], + [0, 38 /* ScanCode.Digit3 */, 'Digit3', 24 /* KeyCode.Digit3 */, '3', 51, 'VK_3', empty, empty], + [0, 39 /* ScanCode.Digit4 */, 'Digit4', 25 /* KeyCode.Digit4 */, '4', 52, 'VK_4', empty, empty], + [0, 40 /* ScanCode.Digit5 */, 'Digit5', 26 /* KeyCode.Digit5 */, '5', 53, 'VK_5', empty, empty], + [0, 41 /* ScanCode.Digit6 */, 'Digit6', 27 /* KeyCode.Digit6 */, '6', 54, 'VK_6', empty, empty], + [0, 42 /* ScanCode.Digit7 */, 'Digit7', 28 /* KeyCode.Digit7 */, '7', 55, 'VK_7', empty, empty], + [0, 43 /* ScanCode.Digit8 */, 'Digit8', 29 /* KeyCode.Digit8 */, '8', 56, 'VK_8', empty, empty], + [0, 44 /* ScanCode.Digit9 */, 'Digit9', 30 /* KeyCode.Digit9 */, '9', 57, 'VK_9', empty, empty], + [0, 45 /* ScanCode.Digit0 */, 'Digit0', 21 /* KeyCode.Digit0 */, '0', 48, 'VK_0', empty, empty], + [1, 46 /* ScanCode.Enter */, 'Enter', 3 /* KeyCode.Enter */, 'Enter', 13, 'VK_RETURN', empty, empty], + [1, 47 /* ScanCode.Escape */, 'Escape', 9 /* KeyCode.Escape */, 'Escape', 27, 'VK_ESCAPE', empty, empty], + [1, 48 /* ScanCode.Backspace */, 'Backspace', 1 /* KeyCode.Backspace */, 'Backspace', 8, 'VK_BACK', empty, empty], + [1, 49 /* ScanCode.Tab */, 'Tab', 2 /* KeyCode.Tab */, 'Tab', 9, 'VK_TAB', empty, empty], + [1, 50 /* ScanCode.Space */, 'Space', 10 /* KeyCode.Space */, 'Space', 32, 'VK_SPACE', empty, empty], + [0, 51 /* ScanCode.Minus */, 'Minus', 88 /* KeyCode.Minus */, '-', 189, 'VK_OEM_MINUS', '-', 'OEM_MINUS'], + [0, 52 /* ScanCode.Equal */, 'Equal', 86 /* KeyCode.Equal */, '=', 187, 'VK_OEM_PLUS', '=', 'OEM_PLUS'], + [0, 53 /* ScanCode.BracketLeft */, 'BracketLeft', 92 /* KeyCode.BracketLeft */, '[', 219, 'VK_OEM_4', '[', 'OEM_4'], + [0, 54 /* ScanCode.BracketRight */, 'BracketRight', 94 /* KeyCode.BracketRight */, ']', 221, 'VK_OEM_6', ']', 'OEM_6'], + [0, 55 /* ScanCode.Backslash */, 'Backslash', 93 /* KeyCode.Backslash */, '\\', 220, 'VK_OEM_5', '\\', 'OEM_5'], + [0, 56 /* ScanCode.IntlHash */, 'IntlHash', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], // has been dropped from the w3c spec + [0, 57 /* ScanCode.Semicolon */, 'Semicolon', 85 /* KeyCode.Semicolon */, ';', 186, 'VK_OEM_1', ';', 'OEM_1'], + [0, 58 /* ScanCode.Quote */, 'Quote', 95 /* KeyCode.Quote */, '\'', 222, 'VK_OEM_7', '\'', 'OEM_7'], + [0, 59 /* ScanCode.Backquote */, 'Backquote', 91 /* KeyCode.Backquote */, '`', 192, 'VK_OEM_3', '`', 'OEM_3'], + [0, 60 /* ScanCode.Comma */, 'Comma', 87 /* KeyCode.Comma */, ',', 188, 'VK_OEM_COMMA', ',', 'OEM_COMMA'], + [0, 61 /* ScanCode.Period */, 'Period', 89 /* KeyCode.Period */, '.', 190, 'VK_OEM_PERIOD', '.', 'OEM_PERIOD'], + [0, 62 /* ScanCode.Slash */, 'Slash', 90 /* KeyCode.Slash */, '/', 191, 'VK_OEM_2', '/', 'OEM_2'], + [1, 63 /* ScanCode.CapsLock */, 'CapsLock', 8 /* KeyCode.CapsLock */, 'CapsLock', 20, 'VK_CAPITAL', empty, empty], + [1, 64 /* ScanCode.F1 */, 'F1', 59 /* KeyCode.F1 */, 'F1', 112, 'VK_F1', empty, empty], + [1, 65 /* ScanCode.F2 */, 'F2', 60 /* KeyCode.F2 */, 'F2', 113, 'VK_F2', empty, empty], + [1, 66 /* ScanCode.F3 */, 'F3', 61 /* KeyCode.F3 */, 'F3', 114, 'VK_F3', empty, empty], + [1, 67 /* ScanCode.F4 */, 'F4', 62 /* KeyCode.F4 */, 'F4', 115, 'VK_F4', empty, empty], + [1, 68 /* ScanCode.F5 */, 'F5', 63 /* KeyCode.F5 */, 'F5', 116, 'VK_F5', empty, empty], + [1, 69 /* ScanCode.F6 */, 'F6', 64 /* KeyCode.F6 */, 'F6', 117, 'VK_F6', empty, empty], + [1, 70 /* ScanCode.F7 */, 'F7', 65 /* KeyCode.F7 */, 'F7', 118, 'VK_F7', empty, empty], + [1, 71 /* ScanCode.F8 */, 'F8', 66 /* KeyCode.F8 */, 'F8', 119, 'VK_F8', empty, empty], + [1, 72 /* ScanCode.F9 */, 'F9', 67 /* KeyCode.F9 */, 'F9', 120, 'VK_F9', empty, empty], + [1, 73 /* ScanCode.F10 */, 'F10', 68 /* KeyCode.F10 */, 'F10', 121, 'VK_F10', empty, empty], + [1, 74 /* ScanCode.F11 */, 'F11', 69 /* KeyCode.F11 */, 'F11', 122, 'VK_F11', empty, empty], + [1, 75 /* ScanCode.F12 */, 'F12', 70 /* KeyCode.F12 */, 'F12', 123, 'VK_F12', empty, empty], + [1, 76 /* ScanCode.PrintScreen */, 'PrintScreen', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 77 /* ScanCode.ScrollLock */, 'ScrollLock', 84 /* KeyCode.ScrollLock */, 'ScrollLock', 145, 'VK_SCROLL', empty, empty], + [1, 78 /* ScanCode.Pause */, 'Pause', 7 /* KeyCode.PauseBreak */, 'PauseBreak', 19, 'VK_PAUSE', empty, empty], + [1, 79 /* ScanCode.Insert */, 'Insert', 19 /* KeyCode.Insert */, 'Insert', 45, 'VK_INSERT', empty, empty], + [1, 80 /* ScanCode.Home */, 'Home', 14 /* KeyCode.Home */, 'Home', 36, 'VK_HOME', empty, empty], + [1, 81 /* ScanCode.PageUp */, 'PageUp', 11 /* KeyCode.PageUp */, 'PageUp', 33, 'VK_PRIOR', empty, empty], + [1, 82 /* ScanCode.Delete */, 'Delete', 20 /* KeyCode.Delete */, 'Delete', 46, 'VK_DELETE', empty, empty], + [1, 83 /* ScanCode.End */, 'End', 13 /* KeyCode.End */, 'End', 35, 'VK_END', empty, empty], + [1, 84 /* ScanCode.PageDown */, 'PageDown', 12 /* KeyCode.PageDown */, 'PageDown', 34, 'VK_NEXT', empty, empty], + [1, 85 /* ScanCode.ArrowRight */, 'ArrowRight', 17 /* KeyCode.RightArrow */, 'RightArrow', 39, 'VK_RIGHT', 'Right', empty], + [1, 86 /* ScanCode.ArrowLeft */, 'ArrowLeft', 15 /* KeyCode.LeftArrow */, 'LeftArrow', 37, 'VK_LEFT', 'Left', empty], + [1, 87 /* ScanCode.ArrowDown */, 'ArrowDown', 18 /* KeyCode.DownArrow */, 'DownArrow', 40, 'VK_DOWN', 'Down', empty], + [1, 88 /* ScanCode.ArrowUp */, 'ArrowUp', 16 /* KeyCode.UpArrow */, 'UpArrow', 38, 'VK_UP', 'Up', empty], + [1, 89 /* ScanCode.NumLock */, 'NumLock', 83 /* KeyCode.NumLock */, 'NumLock', 144, 'VK_NUMLOCK', empty, empty], + [1, 90 /* ScanCode.NumpadDivide */, 'NumpadDivide', 113 /* KeyCode.NumpadDivide */, 'NumPad_Divide', 111, 'VK_DIVIDE', empty, empty], + [1, 91 /* ScanCode.NumpadMultiply */, 'NumpadMultiply', 108 /* KeyCode.NumpadMultiply */, 'NumPad_Multiply', 106, 'VK_MULTIPLY', empty, empty], + [1, 92 /* ScanCode.NumpadSubtract */, 'NumpadSubtract', 111 /* KeyCode.NumpadSubtract */, 'NumPad_Subtract', 109, 'VK_SUBTRACT', empty, empty], + [1, 93 /* ScanCode.NumpadAdd */, 'NumpadAdd', 109 /* KeyCode.NumpadAdd */, 'NumPad_Add', 107, 'VK_ADD', empty, empty], + [1, 94 /* ScanCode.NumpadEnter */, 'NumpadEnter', 3 /* KeyCode.Enter */, empty, 0, empty, empty, empty], + [1, 95 /* ScanCode.Numpad1 */, 'Numpad1', 99 /* KeyCode.Numpad1 */, 'NumPad1', 97, 'VK_NUMPAD1', empty, empty], + [1, 96 /* ScanCode.Numpad2 */, 'Numpad2', 100 /* KeyCode.Numpad2 */, 'NumPad2', 98, 'VK_NUMPAD2', empty, empty], + [1, 97 /* ScanCode.Numpad3 */, 'Numpad3', 101 /* KeyCode.Numpad3 */, 'NumPad3', 99, 'VK_NUMPAD3', empty, empty], + [1, 98 /* ScanCode.Numpad4 */, 'Numpad4', 102 /* KeyCode.Numpad4 */, 'NumPad4', 100, 'VK_NUMPAD4', empty, empty], + [1, 99 /* ScanCode.Numpad5 */, 'Numpad5', 103 /* KeyCode.Numpad5 */, 'NumPad5', 101, 'VK_NUMPAD5', empty, empty], + [1, 100 /* ScanCode.Numpad6 */, 'Numpad6', 104 /* KeyCode.Numpad6 */, 'NumPad6', 102, 'VK_NUMPAD6', empty, empty], + [1, 101 /* ScanCode.Numpad7 */, 'Numpad7', 105 /* KeyCode.Numpad7 */, 'NumPad7', 103, 'VK_NUMPAD7', empty, empty], + [1, 102 /* ScanCode.Numpad8 */, 'Numpad8', 106 /* KeyCode.Numpad8 */, 'NumPad8', 104, 'VK_NUMPAD8', empty, empty], + [1, 103 /* ScanCode.Numpad9 */, 'Numpad9', 107 /* KeyCode.Numpad9 */, 'NumPad9', 105, 'VK_NUMPAD9', empty, empty], + [1, 104 /* ScanCode.Numpad0 */, 'Numpad0', 98 /* KeyCode.Numpad0 */, 'NumPad0', 96, 'VK_NUMPAD0', empty, empty], + [1, 105 /* ScanCode.NumpadDecimal */, 'NumpadDecimal', 112 /* KeyCode.NumpadDecimal */, 'NumPad_Decimal', 110, 'VK_DECIMAL', empty, empty], + [0, 106 /* ScanCode.IntlBackslash */, 'IntlBackslash', 97 /* KeyCode.IntlBackslash */, 'OEM_102', 226, 'VK_OEM_102', empty, empty], + [1, 107 /* ScanCode.ContextMenu */, 'ContextMenu', 58 /* KeyCode.ContextMenu */, 'ContextMenu', 93, empty, empty, empty], + [1, 108 /* ScanCode.Power */, 'Power', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 109 /* ScanCode.NumpadEqual */, 'NumpadEqual', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 110 /* ScanCode.F13 */, 'F13', 71 /* KeyCode.F13 */, 'F13', 124, 'VK_F13', empty, empty], + [1, 111 /* ScanCode.F14 */, 'F14', 72 /* KeyCode.F14 */, 'F14', 125, 'VK_F14', empty, empty], + [1, 112 /* ScanCode.F15 */, 'F15', 73 /* KeyCode.F15 */, 'F15', 126, 'VK_F15', empty, empty], + [1, 113 /* ScanCode.F16 */, 'F16', 74 /* KeyCode.F16 */, 'F16', 127, 'VK_F16', empty, empty], + [1, 114 /* ScanCode.F17 */, 'F17', 75 /* KeyCode.F17 */, 'F17', 128, 'VK_F17', empty, empty], + [1, 115 /* ScanCode.F18 */, 'F18', 76 /* KeyCode.F18 */, 'F18', 129, 'VK_F18', empty, empty], + [1, 116 /* ScanCode.F19 */, 'F19', 77 /* KeyCode.F19 */, 'F19', 130, 'VK_F19', empty, empty], + [1, 117 /* ScanCode.F20 */, 'F20', 78 /* KeyCode.F20 */, 'F20', 131, 'VK_F20', empty, empty], + [1, 118 /* ScanCode.F21 */, 'F21', 79 /* KeyCode.F21 */, 'F21', 132, 'VK_F21', empty, empty], + [1, 119 /* ScanCode.F22 */, 'F22', 80 /* KeyCode.F22 */, 'F22', 133, 'VK_F22', empty, empty], + [1, 120 /* ScanCode.F23 */, 'F23', 81 /* KeyCode.F23 */, 'F23', 134, 'VK_F23', empty, empty], + [1, 121 /* ScanCode.F24 */, 'F24', 82 /* KeyCode.F24 */, 'F24', 135, 'VK_F24', empty, empty], + [1, 122 /* ScanCode.Open */, 'Open', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 123 /* ScanCode.Help */, 'Help', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 124 /* ScanCode.Select */, 'Select', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 125 /* ScanCode.Again */, 'Again', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 126 /* ScanCode.Undo */, 'Undo', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 127 /* ScanCode.Cut */, 'Cut', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 128 /* ScanCode.Copy */, 'Copy', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 129 /* ScanCode.Paste */, 'Paste', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 130 /* ScanCode.Find */, 'Find', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 131 /* ScanCode.AudioVolumeMute */, 'AudioVolumeMute', 117 /* KeyCode.AudioVolumeMute */, 'AudioVolumeMute', 173, 'VK_VOLUME_MUTE', empty, empty], + [1, 132 /* ScanCode.AudioVolumeUp */, 'AudioVolumeUp', 118 /* KeyCode.AudioVolumeUp */, 'AudioVolumeUp', 175, 'VK_VOLUME_UP', empty, empty], + [1, 133 /* ScanCode.AudioVolumeDown */, 'AudioVolumeDown', 119 /* KeyCode.AudioVolumeDown */, 'AudioVolumeDown', 174, 'VK_VOLUME_DOWN', empty, empty], + [1, 134 /* ScanCode.NumpadComma */, 'NumpadComma', 110 /* KeyCode.NUMPAD_SEPARATOR */, 'NumPad_Separator', 108, 'VK_SEPARATOR', empty, empty], + [0, 135 /* ScanCode.IntlRo */, 'IntlRo', 115 /* KeyCode.ABNT_C1 */, 'ABNT_C1', 193, 'VK_ABNT_C1', empty, empty], + [1, 136 /* ScanCode.KanaMode */, 'KanaMode', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [0, 137 /* ScanCode.IntlYen */, 'IntlYen', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 138 /* ScanCode.Convert */, 'Convert', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 139 /* ScanCode.NonConvert */, 'NonConvert', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 140 /* ScanCode.Lang1 */, 'Lang1', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 141 /* ScanCode.Lang2 */, 'Lang2', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 142 /* ScanCode.Lang3 */, 'Lang3', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 143 /* ScanCode.Lang4 */, 'Lang4', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 144 /* ScanCode.Lang5 */, 'Lang5', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 145 /* ScanCode.Abort */, 'Abort', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 146 /* ScanCode.Props */, 'Props', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 147 /* ScanCode.NumpadParenLeft */, 'NumpadParenLeft', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 148 /* ScanCode.NumpadParenRight */, 'NumpadParenRight', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 149 /* ScanCode.NumpadBackspace */, 'NumpadBackspace', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 150 /* ScanCode.NumpadMemoryStore */, 'NumpadMemoryStore', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 151 /* ScanCode.NumpadMemoryRecall */, 'NumpadMemoryRecall', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 152 /* ScanCode.NumpadMemoryClear */, 'NumpadMemoryClear', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 153 /* ScanCode.NumpadMemoryAdd */, 'NumpadMemoryAdd', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 154 /* ScanCode.NumpadMemorySubtract */, 'NumpadMemorySubtract', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 155 /* ScanCode.NumpadClear */, 'NumpadClear', 131 /* KeyCode.Clear */, 'Clear', 12, 'VK_CLEAR', empty, empty], + [1, 156 /* ScanCode.NumpadClearEntry */, 'NumpadClearEntry', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 0 /* ScanCode.None */, empty, 5 /* KeyCode.Ctrl */, 'Ctrl', 17, 'VK_CONTROL', empty, empty], + [1, 0 /* ScanCode.None */, empty, 4 /* KeyCode.Shift */, 'Shift', 16, 'VK_SHIFT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 6 /* KeyCode.Alt */, 'Alt', 18, 'VK_MENU', empty, empty], + [1, 0 /* ScanCode.None */, empty, 57 /* KeyCode.Meta */, 'Meta', 91, 'VK_COMMAND', empty, empty], + [1, 157 /* ScanCode.ControlLeft */, 'ControlLeft', 5 /* KeyCode.Ctrl */, empty, 0, 'VK_LCONTROL', empty, empty], + [1, 158 /* ScanCode.ShiftLeft */, 'ShiftLeft', 4 /* KeyCode.Shift */, empty, 0, 'VK_LSHIFT', empty, empty], + [1, 159 /* ScanCode.AltLeft */, 'AltLeft', 6 /* KeyCode.Alt */, empty, 0, 'VK_LMENU', empty, empty], + [1, 160 /* ScanCode.MetaLeft */, 'MetaLeft', 57 /* KeyCode.Meta */, empty, 0, 'VK_LWIN', empty, empty], + [1, 161 /* ScanCode.ControlRight */, 'ControlRight', 5 /* KeyCode.Ctrl */, empty, 0, 'VK_RCONTROL', empty, empty], + [1, 162 /* ScanCode.ShiftRight */, 'ShiftRight', 4 /* KeyCode.Shift */, empty, 0, 'VK_RSHIFT', empty, empty], + [1, 163 /* ScanCode.AltRight */, 'AltRight', 6 /* KeyCode.Alt */, empty, 0, 'VK_RMENU', empty, empty], + [1, 164 /* ScanCode.MetaRight */, 'MetaRight', 57 /* KeyCode.Meta */, empty, 0, 'VK_RWIN', empty, empty], + [1, 165 /* ScanCode.BrightnessUp */, 'BrightnessUp', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 166 /* ScanCode.BrightnessDown */, 'BrightnessDown', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 167 /* ScanCode.MediaPlay */, 'MediaPlay', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 168 /* ScanCode.MediaRecord */, 'MediaRecord', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 169 /* ScanCode.MediaFastForward */, 'MediaFastForward', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 170 /* ScanCode.MediaRewind */, 'MediaRewind', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 171 /* ScanCode.MediaTrackNext */, 'MediaTrackNext', 124 /* KeyCode.MediaTrackNext */, 'MediaTrackNext', 176, 'VK_MEDIA_NEXT_TRACK', empty, empty], + [1, 172 /* ScanCode.MediaTrackPrevious */, 'MediaTrackPrevious', 125 /* KeyCode.MediaTrackPrevious */, 'MediaTrackPrevious', 177, 'VK_MEDIA_PREV_TRACK', empty, empty], + [1, 173 /* ScanCode.MediaStop */, 'MediaStop', 126 /* KeyCode.MediaStop */, 'MediaStop', 178, 'VK_MEDIA_STOP', empty, empty], + [1, 174 /* ScanCode.Eject */, 'Eject', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 175 /* ScanCode.MediaPlayPause */, 'MediaPlayPause', 127 /* KeyCode.MediaPlayPause */, 'MediaPlayPause', 179, 'VK_MEDIA_PLAY_PAUSE', empty, empty], + [1, 176 /* ScanCode.MediaSelect */, 'MediaSelect', 128 /* KeyCode.LaunchMediaPlayer */, 'LaunchMediaPlayer', 181, 'VK_MEDIA_LAUNCH_MEDIA_SELECT', empty, empty], + [1, 177 /* ScanCode.LaunchMail */, 'LaunchMail', 129 /* KeyCode.LaunchMail */, 'LaunchMail', 180, 'VK_MEDIA_LAUNCH_MAIL', empty, empty], + [1, 178 /* ScanCode.LaunchApp2 */, 'LaunchApp2', 130 /* KeyCode.LaunchApp2 */, 'LaunchApp2', 183, 'VK_MEDIA_LAUNCH_APP2', empty, empty], + [1, 179 /* ScanCode.LaunchApp1 */, 'LaunchApp1', 0 /* KeyCode.Unknown */, empty, 0, 'VK_MEDIA_LAUNCH_APP1', empty, empty], + [1, 180 /* ScanCode.SelectTask */, 'SelectTask', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 181 /* ScanCode.LaunchScreenSaver */, 'LaunchScreenSaver', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 182 /* ScanCode.BrowserSearch */, 'BrowserSearch', 120 /* KeyCode.BrowserSearch */, 'BrowserSearch', 170, 'VK_BROWSER_SEARCH', empty, empty], + [1, 183 /* ScanCode.BrowserHome */, 'BrowserHome', 121 /* KeyCode.BrowserHome */, 'BrowserHome', 172, 'VK_BROWSER_HOME', empty, empty], + [1, 184 /* ScanCode.BrowserBack */, 'BrowserBack', 122 /* KeyCode.BrowserBack */, 'BrowserBack', 166, 'VK_BROWSER_BACK', empty, empty], + [1, 185 /* ScanCode.BrowserForward */, 'BrowserForward', 123 /* KeyCode.BrowserForward */, 'BrowserForward', 167, 'VK_BROWSER_FORWARD', empty, empty], + [1, 186 /* ScanCode.BrowserStop */, 'BrowserStop', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_STOP', empty, empty], + [1, 187 /* ScanCode.BrowserRefresh */, 'BrowserRefresh', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_REFRESH', empty, empty], + [1, 188 /* ScanCode.BrowserFavorites */, 'BrowserFavorites', 0 /* KeyCode.Unknown */, empty, 0, 'VK_BROWSER_FAVORITES', empty, empty], + [1, 189 /* ScanCode.ZoomToggle */, 'ZoomToggle', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 190 /* ScanCode.MailReply */, 'MailReply', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 191 /* ScanCode.MailForward */, 'MailForward', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + [1, 192 /* ScanCode.MailSend */, 'MailSend', 0 /* KeyCode.Unknown */, empty, 0, empty, empty, empty], + // See https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html + // If an Input Method Editor is processing key input and the event is keydown, return 229. + [1, 0 /* ScanCode.None */, empty, 114 /* KeyCode.KEY_IN_COMPOSITION */, 'KeyInComposition', 229, empty, empty, empty], + [1, 0 /* ScanCode.None */, empty, 116 /* KeyCode.ABNT_C2 */, 'ABNT_C2', 194, 'VK_ABNT_C2', empty, empty], + [1, 0 /* ScanCode.None */, empty, 96 /* KeyCode.OEM_8 */, 'OEM_8', 223, 'VK_OEM_8', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_KANA', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HANGUL', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_JUNJA', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_FINAL', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HANJA', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_KANJI', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_CONVERT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_NONCONVERT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ACCEPT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_MODECHANGE', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_SELECT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PRINT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EXECUTE', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_SNAPSHOT', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_HELP', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_APPS', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PROCESSKEY', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PACKET', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_DBE_SBCSCHAR', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_DBE_DBCSCHAR', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ATTN', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_CRSEL', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EXSEL', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_EREOF', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PLAY', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_ZOOM', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_NONAME', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_PA1', empty, empty], + [1, 0 /* ScanCode.None */, empty, 0 /* KeyCode.Unknown */, empty, 0, 'VK_OEM_CLEAR', empty, empty], + ]; + const seenKeyCode = []; + const seenScanCode = []; + for (const mapping of mappings) { + const [immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel] = mapping; + if (!seenScanCode[scanCode]) { + seenScanCode[scanCode] = true; + scanCodeIntToStr[scanCode] = scanCodeStr; + scanCodeStrToInt[scanCodeStr] = scanCode; + scanCodeLowerCaseStrToInt[scanCodeStr.toLowerCase()] = scanCode; + if (immutable) { + IMMUTABLE_CODE_TO_KEY_CODE[scanCode] = keyCode; + if ((keyCode !== 0 /* KeyCode.Unknown */) + && (keyCode !== 3 /* KeyCode.Enter */) + && (keyCode !== 5 /* KeyCode.Ctrl */) + && (keyCode !== 4 /* KeyCode.Shift */) + && (keyCode !== 6 /* KeyCode.Alt */) + && (keyCode !== 57 /* KeyCode.Meta */)) { + IMMUTABLE_KEY_CODE_TO_CODE[keyCode] = scanCode; + } + } + } + if (!seenKeyCode[keyCode]) { + seenKeyCode[keyCode] = true; + if (!keyCodeStr) { + throw new Error(`String representation missing for key code ${keyCode} around scan code ${scanCodeStr}`); + } + uiMap.define(keyCode, keyCodeStr); + userSettingsUSMap.define(keyCode, usUserSettingsLabel || keyCodeStr); + userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel || usUserSettingsLabel || keyCodeStr); + } + if (eventKeyCode) { + EVENT_KEY_CODE_MAP[eventKeyCode] = keyCode; + } + if (vkey) { + NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[vkey] = keyCode; + } + } + // Manually added due to the exclusion above (due to duplication with NumpadEnter) + IMMUTABLE_KEY_CODE_TO_CODE[3 /* KeyCode.Enter */] = 46 /* ScanCode.Enter */; +})(); +export var KeyCodeUtils; +(function (KeyCodeUtils) { + function toString(keyCode) { + return uiMap.keyCodeToStr(keyCode); + } + KeyCodeUtils.toString = toString; + function fromString(key) { + return uiMap.strToKeyCode(key); + } + KeyCodeUtils.fromString = fromString; + function toUserSettingsUS(keyCode) { + return userSettingsUSMap.keyCodeToStr(keyCode); + } + KeyCodeUtils.toUserSettingsUS = toUserSettingsUS; + function toUserSettingsGeneral(keyCode) { + return userSettingsGeneralMap.keyCodeToStr(keyCode); + } + KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral; + function fromUserSettings(key) { + return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key); + } + KeyCodeUtils.fromUserSettings = fromUserSettings; + function toElectronAccelerator(keyCode) { + if (keyCode >= 98 /* KeyCode.Numpad0 */ && keyCode <= 113 /* KeyCode.NumpadDivide */) { + // [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it + // renders them just as regular keys in menus. For example, num0 is rendered as "0", + // numdiv is rendered as "/", numsub is rendered as "-". + // + // This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable + // from keybindings based on regular keys. + // + // We therefore need to fall back to custom rendering for numpad keys. + return null; + } + switch (keyCode) { + case 16 /* KeyCode.UpArrow */: + return 'Up'; + case 18 /* KeyCode.DownArrow */: + return 'Down'; + case 15 /* KeyCode.LeftArrow */: + return 'Left'; + case 17 /* KeyCode.RightArrow */: + return 'Right'; + } + return uiMap.keyCodeToStr(keyCode); + } + KeyCodeUtils.toElectronAccelerator = toElectronAccelerator; +})(KeyCodeUtils || (KeyCodeUtils = {})); +export function KeyChord(firstPart, secondPart) { + const chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0; + return (firstPart | chordPart) >>> 0; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js new file mode 100644 index 0000000000000000000000000000000000000000..a883a04e930ad9505705c3da963c1f0edb9924b6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js @@ -0,0 +1,136 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as nls from '../../nls.js'; +export class ModifierLabelProvider { + constructor(mac, windows, linux = windows) { + this.modifierLabels = [null]; // index 0 will never me accessed. + this.modifierLabels[2 /* OperatingSystem.Macintosh */] = mac; + this.modifierLabels[1 /* OperatingSystem.Windows */] = windows; + this.modifierLabels[3 /* OperatingSystem.Linux */] = linux; + } + toLabel(OS, chords, keyLabelProvider) { + if (chords.length === 0) { + return null; + } + const result = []; + for (let i = 0, len = chords.length; i < len; i++) { + const chord = chords[i]; + const keyLabel = keyLabelProvider(chord); + if (keyLabel === null) { + // this keybinding cannot be expressed... + return null; + } + result[i] = _simpleAsString(chord, keyLabel, this.modifierLabels[OS]); + } + return result.join(' '); + } +} +/** + * A label provider that prints modifiers in a suitable format for displaying in the UI. + */ +export const UILabelProvider = new ModifierLabelProvider({ + ctrlKey: '\u2303', + shiftKey: '⇧', + altKey: '⌥', + metaKey: '⌘', + separator: '', +}, { + ctrlKey: nls.localize({ key: 'ctrlKey', comment: ['This is the short form for the Control key on the keyboard'] }, "Ctrl"), + shiftKey: nls.localize({ key: 'shiftKey', comment: ['This is the short form for the Shift key on the keyboard'] }, "Shift"), + altKey: nls.localize({ key: 'altKey', comment: ['This is the short form for the Alt key on the keyboard'] }, "Alt"), + metaKey: nls.localize({ key: 'windowsKey', comment: ['This is the short form for the Windows key on the keyboard'] }, "Windows"), + separator: '+', +}, { + ctrlKey: nls.localize({ key: 'ctrlKey', comment: ['This is the short form for the Control key on the keyboard'] }, "Ctrl"), + shiftKey: nls.localize({ key: 'shiftKey', comment: ['This is the short form for the Shift key on the keyboard'] }, "Shift"), + altKey: nls.localize({ key: 'altKey', comment: ['This is the short form for the Alt key on the keyboard'] }, "Alt"), + metaKey: nls.localize({ key: 'superKey', comment: ['This is the short form for the Super key on the keyboard'] }, "Super"), + separator: '+', +}); +/** + * A label provider that prints modifiers in a suitable format for ARIA. + */ +export const AriaLabelProvider = new ModifierLabelProvider({ + ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, "Control"), + shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, "Shift"), + altKey: nls.localize({ key: 'optKey.long', comment: ['This is the long form for the Alt/Option key on the keyboard'] }, "Option"), + metaKey: nls.localize({ key: 'cmdKey.long', comment: ['This is the long form for the Command key on the keyboard'] }, "Command"), + separator: '+', +}, { + ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, "Control"), + shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, "Shift"), + altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, "Alt"), + metaKey: nls.localize({ key: 'windowsKey.long', comment: ['This is the long form for the Windows key on the keyboard'] }, "Windows"), + separator: '+', +}, { + ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, "Control"), + shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, "Shift"), + altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, "Alt"), + metaKey: nls.localize({ key: 'superKey.long', comment: ['This is the long form for the Super key on the keyboard'] }, "Super"), + separator: '+', +}); +/** + * A label provider that prints modifiers in a suitable format for Electron Accelerators. + * See https://github.com/electron/electron/blob/master/docs/api/accelerator.md + */ +export const ElectronAcceleratorLabelProvider = new ModifierLabelProvider({ + ctrlKey: 'Ctrl', + shiftKey: 'Shift', + altKey: 'Alt', + metaKey: 'Cmd', + separator: '+', +}, { + ctrlKey: 'Ctrl', + shiftKey: 'Shift', + altKey: 'Alt', + metaKey: 'Super', + separator: '+', +}); +/** + * A label provider that prints modifiers in a suitable format for user settings. + */ +export const UserSettingsLabelProvider = new ModifierLabelProvider({ + ctrlKey: 'ctrl', + shiftKey: 'shift', + altKey: 'alt', + metaKey: 'cmd', + separator: '+', +}, { + ctrlKey: 'ctrl', + shiftKey: 'shift', + altKey: 'alt', + metaKey: 'win', + separator: '+', +}, { + ctrlKey: 'ctrl', + shiftKey: 'shift', + altKey: 'alt', + metaKey: 'meta', + separator: '+', +}); +function _simpleAsString(modifiers, key, labels) { + if (key === null) { + return ''; + } + const result = []; + // translate modifier keys: Ctrl-Shift-Alt-Meta + if (modifiers.ctrlKey) { + result.push(labels.ctrlKey); + } + if (modifiers.shiftKey) { + result.push(labels.shiftKey); + } + if (modifiers.altKey) { + result.push(labels.altKey); + } + if (modifiers.metaKey) { + result.push(labels.metaKey); + } + // the actual key + if (key !== '') { + result.push(key); + } + return result.join(labels.separator); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keybindings.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keybindings.js new file mode 100644 index 0000000000000000000000000000000000000000..c3c048ed73d0039392002c82af323aeb02ba38c9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/keybindings.js @@ -0,0 +1,123 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { illegalArgument } from './errors.js'; +export function decodeKeybinding(keybinding, OS) { + if (typeof keybinding === 'number') { + if (keybinding === 0) { + return null; + } + const firstChord = (keybinding & 0x0000FFFF) >>> 0; + const secondChord = (keybinding & 0xFFFF0000) >>> 16; + if (secondChord !== 0) { + return new Keybinding([ + createSimpleKeybinding(firstChord, OS), + createSimpleKeybinding(secondChord, OS) + ]); + } + return new Keybinding([createSimpleKeybinding(firstChord, OS)]); + } + else { + const chords = []; + for (let i = 0; i < keybinding.length; i++) { + chords.push(createSimpleKeybinding(keybinding[i], OS)); + } + return new Keybinding(chords); + } +} +export function createSimpleKeybinding(keybinding, OS) { + const ctrlCmd = (keybinding & 2048 /* BinaryKeybindingsMask.CtrlCmd */ ? true : false); + const winCtrl = (keybinding & 256 /* BinaryKeybindingsMask.WinCtrl */ ? true : false); + const ctrlKey = (OS === 2 /* OperatingSystem.Macintosh */ ? winCtrl : ctrlCmd); + const shiftKey = (keybinding & 1024 /* BinaryKeybindingsMask.Shift */ ? true : false); + const altKey = (keybinding & 512 /* BinaryKeybindingsMask.Alt */ ? true : false); + const metaKey = (OS === 2 /* OperatingSystem.Macintosh */ ? ctrlCmd : winCtrl); + const keyCode = (keybinding & 255 /* BinaryKeybindingsMask.KeyCode */); + return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode); +} +/** + * Represents a chord which uses the `keyCode` field of keyboard events. + * A chord is a combination of keys pressed simultaneously. + */ +export class KeyCodeChord { + constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) { + this.ctrlKey = ctrlKey; + this.shiftKey = shiftKey; + this.altKey = altKey; + this.metaKey = metaKey; + this.keyCode = keyCode; + } + equals(other) { + return (other instanceof KeyCodeChord + && this.ctrlKey === other.ctrlKey + && this.shiftKey === other.shiftKey + && this.altKey === other.altKey + && this.metaKey === other.metaKey + && this.keyCode === other.keyCode); + } + isModifierKey() { + return (this.keyCode === 0 /* KeyCode.Unknown */ + || this.keyCode === 5 /* KeyCode.Ctrl */ + || this.keyCode === 57 /* KeyCode.Meta */ + || this.keyCode === 6 /* KeyCode.Alt */ + || this.keyCode === 4 /* KeyCode.Shift */); + } + /** + * Does this keybinding refer to the key code of a modifier and it also has the modifier flag? + */ + isDuplicateModifierCase() { + return ((this.ctrlKey && this.keyCode === 5 /* KeyCode.Ctrl */) + || (this.shiftKey && this.keyCode === 4 /* KeyCode.Shift */) + || (this.altKey && this.keyCode === 6 /* KeyCode.Alt */) + || (this.metaKey && this.keyCode === 57 /* KeyCode.Meta */)); + } +} +/** + * Represents a chord which uses the `code` field of keyboard events. + * A chord is a combination of keys pressed simultaneously. + */ +export class ScanCodeChord { + constructor(ctrlKey, shiftKey, altKey, metaKey, scanCode) { + this.ctrlKey = ctrlKey; + this.shiftKey = shiftKey; + this.altKey = altKey; + this.metaKey = metaKey; + this.scanCode = scanCode; + } + /** + * Does this keybinding refer to the key code of a modifier and it also has the modifier flag? + */ + isDuplicateModifierCase() { + return ((this.ctrlKey && (this.scanCode === 157 /* ScanCode.ControlLeft */ || this.scanCode === 161 /* ScanCode.ControlRight */)) + || (this.shiftKey && (this.scanCode === 158 /* ScanCode.ShiftLeft */ || this.scanCode === 162 /* ScanCode.ShiftRight */)) + || (this.altKey && (this.scanCode === 159 /* ScanCode.AltLeft */ || this.scanCode === 163 /* ScanCode.AltRight */)) + || (this.metaKey && (this.scanCode === 160 /* ScanCode.MetaLeft */ || this.scanCode === 164 /* ScanCode.MetaRight */))); + } +} +/** + * A keybinding is a sequence of chords. + */ +export class Keybinding { + constructor(chords) { + if (chords.length === 0) { + throw illegalArgument(`chords`); + } + this.chords = chords; + } +} +export class ResolvedChord { + constructor(ctrlKey, shiftKey, altKey, metaKey, keyLabel, keyAriaLabel) { + this.ctrlKey = ctrlKey; + this.shiftKey = shiftKey; + this.altKey = altKey; + this.metaKey = metaKey; + this.keyLabel = keyLabel; + this.keyAriaLabel = keyAriaLabel; + } +} +/** + * A resolved keybinding. Consists of one or multiple chords. + */ +export class ResolvedKeybinding { +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/labels.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/labels.js new file mode 100644 index 0000000000000000000000000000000000000000..2a0cc940b9bb9f01135517b7d2808e18b7adccb4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/labels.js @@ -0,0 +1,9 @@ +import { hasDriveLetter } from './extpath.js'; +import { isWindows } from './platform.js'; +export function normalizeDriveLetter(path, isWindowsOS = isWindows) { + if (hasDriveLetter(path, isWindowsOS)) { + return path.charAt(0).toUpperCase() + path.slice(1); + } + return path; +} +let normalizedUserHomeCached = Object.create(null); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/lazy.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/lazy.js new file mode 100644 index 0000000000000000000000000000000000000000..bd7a0e86303973528144f4dedc0495bea6169c09 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/lazy.js @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class Lazy { + constructor(executor) { + this.executor = executor; + this._didRun = false; + } + /** + * Get the wrapped value. + * + * This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only + * resolved once. `getValue` will re-throw exceptions that are hit while resolving the value + */ + get value() { + if (!this._didRun) { + try { + this._value = this.executor(); + } + catch (err) { + this._error = err; + } + finally { + this._didRun = true; + } + } + if (this._error) { + throw this._error; + } + return this._value; + } + /** + * Get the wrapped value without forcing evaluation. + */ + get rawValue() { return this._value; } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/lifecycle.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/lifecycle.js new file mode 100644 index 0000000000000000000000000000000000000000..76ed1aa9328f29a47eec2050092965273113df57 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/lifecycle.js @@ -0,0 +1,355 @@ +import { createSingleCallFunction } from './functional.js'; +import { Iterable } from './iterator.js'; +// #region Disposable Tracking +/** + * Enables logging of potentially leaked disposables. + * + * A disposable is considered leaked if it is not disposed or not registered as the child of + * another disposable. This tracking is very simple an only works for classes that either + * extend Disposable or use a DisposableStore. This means there are a lot of false positives. + */ +const TRACK_DISPOSABLES = false; +let disposableTracker = null; +export function setDisposableTracker(tracker) { + disposableTracker = tracker; +} +if (TRACK_DISPOSABLES) { + const __is_disposable_tracked__ = '__is_disposable_tracked__'; + setDisposableTracker(new class { + trackDisposable(x) { + const stack = new Error('Potentially leaked disposable').stack; + setTimeout(() => { + if (!x[__is_disposable_tracked__]) { + console.log(stack); + } + }, 3000); + } + setParent(child, parent) { + if (child && child !== Disposable.None) { + try { + child[__is_disposable_tracked__] = true; + } + catch { + // noop + } + } + } + markAsDisposed(disposable) { + if (disposable && disposable !== Disposable.None) { + try { + disposable[__is_disposable_tracked__] = true; + } + catch { + // noop + } + } + } + markAsSingleton(disposable) { } + }); +} +export function trackDisposable(x) { + disposableTracker?.trackDisposable(x); + return x; +} +export function markAsDisposed(disposable) { + disposableTracker?.markAsDisposed(disposable); +} +function setParentOfDisposable(child, parent) { + disposableTracker?.setParent(child, parent); +} +function setParentOfDisposables(children, parent) { + if (!disposableTracker) { + return; + } + for (const child of children) { + disposableTracker.setParent(child, parent); + } +} +/** + * Indicates that the given object is a singleton which does not need to be disposed. +*/ +export function markAsSingleton(singleton) { + disposableTracker?.markAsSingleton(singleton); + return singleton; +} +/** + * Check if `thing` is {@link IDisposable disposable}. + */ +export function isDisposable(thing) { + return typeof thing === 'object' && thing !== null && typeof thing.dispose === 'function' && thing.dispose.length === 0; +} +export function dispose(arg) { + if (Iterable.is(arg)) { + const errors = []; + for (const d of arg) { + if (d) { + try { + d.dispose(); + } + catch (e) { + errors.push(e); + } + } + } + if (errors.length === 1) { + throw errors[0]; + } + else if (errors.length > 1) { + throw new AggregateError(errors, 'Encountered errors while disposing of store'); + } + return Array.isArray(arg) ? [] : arg; + } + else if (arg) { + arg.dispose(); + return arg; + } +} +/** + * Combine multiple disposable values into a single {@link IDisposable}. + */ +export function combinedDisposable(...disposables) { + const parent = toDisposable(() => dispose(disposables)); + setParentOfDisposables(disposables, parent); + return parent; +} +/** + * Turn a function that implements dispose into an {@link IDisposable}. + * + * @param fn Clean up function, guaranteed to be called only **once**. + */ +export function toDisposable(fn) { + const self = trackDisposable({ + dispose: createSingleCallFunction(() => { + markAsDisposed(self); + fn(); + }) + }); + return self; +} +/** + * Manages a collection of disposable values. + * + * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an + * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a + * store that has already been disposed of. + */ +export class DisposableStore { + static { this.DISABLE_DISPOSED_WARNING = false; } + constructor() { + this._toDispose = new Set(); + this._isDisposed = false; + trackDisposable(this); + } + /** + * Dispose of all registered disposables and mark this object as disposed. + * + * Any future disposables added to this object will be disposed of on `add`. + */ + dispose() { + if (this._isDisposed) { + return; + } + markAsDisposed(this); + this._isDisposed = true; + this.clear(); + } + /** + * @return `true` if this object has been disposed of. + */ + get isDisposed() { + return this._isDisposed; + } + /** + * Dispose of all registered disposables but do not mark this object as disposed. + */ + clear() { + if (this._toDispose.size === 0) { + return; + } + try { + dispose(this._toDispose); + } + finally { + this._toDispose.clear(); + } + } + /** + * Add a new {@link IDisposable disposable} to the collection. + */ + add(o) { + if (!o) { + return o; + } + if (o === this) { + throw new Error('Cannot register a disposable on itself!'); + } + setParentOfDisposable(o, this); + if (this._isDisposed) { + if (!DisposableStore.DISABLE_DISPOSED_WARNING) { + console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack); + } + } + else { + this._toDispose.add(o); + } + return o; + } + /** + * Deletes the value from the store, but does not dispose it. + */ + deleteAndLeak(o) { + if (!o) { + return; + } + if (this._toDispose.has(o)) { + this._toDispose.delete(o); + setParentOfDisposable(o, null); + } + } +} +/** + * Abstract base class for a {@link IDisposable disposable} object. + * + * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of. + */ +export class Disposable { + /** + * A disposable that does nothing when it is disposed of. + * + * TODO: This should not be a static property. + */ + static { this.None = Object.freeze({ dispose() { } }); } + constructor() { + this._store = new DisposableStore(); + trackDisposable(this); + setParentOfDisposable(this._store, this); + } + dispose() { + markAsDisposed(this); + this._store.dispose(); + } + /** + * Adds `o` to the collection of disposables managed by this object. + */ + _register(o) { + if (o === this) { + throw new Error('Cannot register a disposable on itself!'); + } + return this._store.add(o); + } +} +/** + * Manages the lifecycle of a disposable value that may be changed. + * + * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can + * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up. + */ +export class MutableDisposable { + constructor() { + this._isDisposed = false; + trackDisposable(this); + } + get value() { + return this._isDisposed ? undefined : this._value; + } + set value(value) { + if (this._isDisposed || value === this._value) { + return; + } + this._value?.dispose(); + if (value) { + setParentOfDisposable(value, this); + } + this._value = value; + } + /** + * Resets the stored value and disposed of the previously stored value. + */ + clear() { + this.value = undefined; + } + dispose() { + this._isDisposed = true; + markAsDisposed(this); + this._value?.dispose(); + this._value = undefined; + } +} +export class RefCountedDisposable { + constructor(_disposable) { + this._disposable = _disposable; + this._counter = 1; + } + acquire() { + this._counter++; + return this; + } + release() { + if (--this._counter === 0) { + this._disposable.dispose(); + } + return this; + } +} +export class ImmortalReference { + constructor(object) { + this.object = object; + } + dispose() { } +} +/** + * A map the manages the lifecycle of the values that it stores. + */ +export class DisposableMap { + constructor() { + this._store = new Map(); + this._isDisposed = false; + trackDisposable(this); + } + /** + * Disposes of all stored values and mark this object as disposed. + * + * Trying to use this object after it has been disposed of is an error. + */ + dispose() { + markAsDisposed(this); + this._isDisposed = true; + this.clearAndDisposeAll(); + } + /** + * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed. + */ + clearAndDisposeAll() { + if (!this._store.size) { + return; + } + try { + dispose(this._store.values()); + } + finally { + this._store.clear(); + } + } + get(key) { + return this._store.get(key); + } + set(key, value, skipDisposeOnOverwrite = false) { + if (this._isDisposed) { + console.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack); + } + if (!skipDisposeOnOverwrite) { + this._store.get(key)?.dispose(); + } + this._store.set(key, value); + } + /** + * Delete the value stored for `key` from this map and also dispose of it. + */ + deleteAndDispose(key) { + this._store.get(key)?.dispose(); + this._store.delete(key); + } + [Symbol.iterator]() { + return this._store[Symbol.iterator](); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/linkedList.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/linkedList.js new file mode 100644 index 0000000000000000000000000000000000000000..6f3053eb311e8deac1e403fb1926fa5a6630fdce --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/linkedList.js @@ -0,0 +1,124 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +class Node { + static { this.Undefined = new Node(undefined); } + constructor(element) { + this.element = element; + this.next = Node.Undefined; + this.prev = Node.Undefined; + } +} +export class LinkedList { + constructor() { + this._first = Node.Undefined; + this._last = Node.Undefined; + this._size = 0; + } + get size() { + return this._size; + } + isEmpty() { + return this._first === Node.Undefined; + } + clear() { + let node = this._first; + while (node !== Node.Undefined) { + const next = node.next; + node.prev = Node.Undefined; + node.next = Node.Undefined; + node = next; + } + this._first = Node.Undefined; + this._last = Node.Undefined; + this._size = 0; + } + unshift(element) { + return this._insert(element, false); + } + push(element) { + return this._insert(element, true); + } + _insert(element, atTheEnd) { + const newNode = new Node(element); + if (this._first === Node.Undefined) { + this._first = newNode; + this._last = newNode; + } + else if (atTheEnd) { + // push + const oldLast = this._last; + this._last = newNode; + newNode.prev = oldLast; + oldLast.next = newNode; + } + else { + // unshift + const oldFirst = this._first; + this._first = newNode; + newNode.next = oldFirst; + oldFirst.prev = newNode; + } + this._size += 1; + let didRemove = false; + return () => { + if (!didRemove) { + didRemove = true; + this._remove(newNode); + } + }; + } + shift() { + if (this._first === Node.Undefined) { + return undefined; + } + else { + const res = this._first.element; + this._remove(this._first); + return res; + } + } + pop() { + if (this._last === Node.Undefined) { + return undefined; + } + else { + const res = this._last.element; + this._remove(this._last); + return res; + } + } + _remove(node) { + if (node.prev !== Node.Undefined && node.next !== Node.Undefined) { + // middle + const anchor = node.prev; + anchor.next = node.next; + node.next.prev = anchor; + } + else if (node.prev === Node.Undefined && node.next === Node.Undefined) { + // only node + this._first = Node.Undefined; + this._last = Node.Undefined; + } + else if (node.next === Node.Undefined) { + // last + this._last = this._last.prev; + this._last.next = Node.Undefined; + } + else if (node.prev === Node.Undefined) { + // first + this._first = this._first.next; + this._first.prev = Node.Undefined; + } + // done + this._size -= 1; + } + *[Symbol.iterator]() { + let node = this._first; + while (node !== Node.Undefined) { + yield node.element; + node = node.next; + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/linkedText.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/linkedText.js new file mode 100644 index 0000000000000000000000000000000000000000..aaab14c4f1261dc9bc2dd0138dcfb0f120b44637 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/linkedText.js @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + 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; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { memoize } from './decorators.js'; +export class LinkedText { + constructor(nodes) { + this.nodes = nodes; + } + toString() { + return this.nodes.map(node => typeof node === 'string' ? node : node.label).join(''); + } +} +__decorate([ + memoize +], LinkedText.prototype, "toString", null); +const LINK_REGEX = /\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi; +export function parseLinkedText(text) { + const result = []; + let index = 0; + let match; + while (match = LINK_REGEX.exec(text)) { + if (match.index - index > 0) { + result.push(text.substring(index, match.index)); + } + const [, label, href, , title] = match; + if (title) { + result.push({ label, href, title }); + } + else { + result.push({ label, href }); + } + index = match.index + match[0].length; + } + if (index < text.length) { + result.push(text.substring(index)); + } + return new LinkedText(result); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/map.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/map.js new file mode 100644 index 0000000000000000000000000000000000000000..b5ff8cfad9535267b0c56191faa925a172b8253b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/map.js @@ -0,0 +1,573 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a, _b; +class ResourceMapEntry { + constructor(uri, value) { + this.uri = uri; + this.value = value; + } +} +function isEntries(arg) { + return Array.isArray(arg); +} +export class ResourceMap { + static { this.defaultToKey = (resource) => resource.toString(); } + constructor(arg, toKey) { + this[_a] = 'ResourceMap'; + if (arg instanceof ResourceMap) { + this.map = new Map(arg.map); + this.toKey = toKey ?? ResourceMap.defaultToKey; + } + else if (isEntries(arg)) { + this.map = new Map(); + this.toKey = toKey ?? ResourceMap.defaultToKey; + for (const [resource, value] of arg) { + this.set(resource, value); + } + } + else { + this.map = new Map(); + this.toKey = arg ?? ResourceMap.defaultToKey; + } + } + set(resource, value) { + this.map.set(this.toKey(resource), new ResourceMapEntry(resource, value)); + return this; + } + get(resource) { + return this.map.get(this.toKey(resource))?.value; + } + has(resource) { + return this.map.has(this.toKey(resource)); + } + get size() { + return this.map.size; + } + clear() { + this.map.clear(); + } + delete(resource) { + return this.map.delete(this.toKey(resource)); + } + forEach(clb, thisArg) { + if (typeof thisArg !== 'undefined') { + clb = clb.bind(thisArg); + } + for (const [_, entry] of this.map) { + clb(entry.value, entry.uri, this); + } + } + *values() { + for (const entry of this.map.values()) { + yield entry.value; + } + } + *keys() { + for (const entry of this.map.values()) { + yield entry.uri; + } + } + *entries() { + for (const entry of this.map.values()) { + yield [entry.uri, entry.value]; + } + } + *[(_a = Symbol.toStringTag, Symbol.iterator)]() { + for (const [, entry] of this.map) { + yield [entry.uri, entry.value]; + } + } +} +export class LinkedMap { + constructor() { + this[_b] = 'LinkedMap'; + this._map = new Map(); + this._head = undefined; + this._tail = undefined; + this._size = 0; + this._state = 0; + } + clear() { + this._map.clear(); + this._head = undefined; + this._tail = undefined; + this._size = 0; + this._state++; + } + isEmpty() { + return !this._head && !this._tail; + } + get size() { + return this._size; + } + get first() { + return this._head?.value; + } + get last() { + return this._tail?.value; + } + has(key) { + return this._map.has(key); + } + get(key, touch = 0 /* Touch.None */) { + const item = this._map.get(key); + if (!item) { + return undefined; + } + if (touch !== 0 /* Touch.None */) { + this.touch(item, touch); + } + return item.value; + } + set(key, value, touch = 0 /* Touch.None */) { + let item = this._map.get(key); + if (item) { + item.value = value; + if (touch !== 0 /* Touch.None */) { + this.touch(item, touch); + } + } + else { + item = { key, value, next: undefined, previous: undefined }; + switch (touch) { + case 0 /* Touch.None */: + this.addItemLast(item); + break; + case 1 /* Touch.AsOld */: + this.addItemFirst(item); + break; + case 2 /* Touch.AsNew */: + this.addItemLast(item); + break; + default: + this.addItemLast(item); + break; + } + this._map.set(key, item); + this._size++; + } + return this; + } + delete(key) { + return !!this.remove(key); + } + remove(key) { + const item = this._map.get(key); + if (!item) { + return undefined; + } + this._map.delete(key); + this.removeItem(item); + this._size--; + return item.value; + } + shift() { + if (!this._head && !this._tail) { + return undefined; + } + if (!this._head || !this._tail) { + throw new Error('Invalid list'); + } + const item = this._head; + this._map.delete(item.key); + this.removeItem(item); + this._size--; + return item.value; + } + forEach(callbackfn, thisArg) { + const state = this._state; + let current = this._head; + while (current) { + if (thisArg) { + callbackfn.bind(thisArg)(current.value, current.key, this); + } + else { + callbackfn(current.value, current.key, this); + } + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + current = current.next; + } + } + keys() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.key, done: false }; + current = current.next; + return result; + } + else { + return { value: undefined, done: true }; + } + } + }; + return iterator; + } + values() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.value, done: false }; + current = current.next; + return result; + } + else { + return { value: undefined, done: true }; + } + } + }; + return iterator; + } + entries() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: [current.key, current.value], done: false }; + current = current.next; + return result; + } + else { + return { value: undefined, done: true }; + } + } + }; + return iterator; + } + [(_b = Symbol.toStringTag, Symbol.iterator)]() { + return this.entries(); + } + trimOld(newSize) { + if (newSize >= this.size) { + return; + } + if (newSize === 0) { + this.clear(); + return; + } + let current = this._head; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.next; + currentSize--; + } + this._head = current; + this._size = currentSize; + if (current) { + current.previous = undefined; + } + this._state++; + } + trimNew(newSize) { + if (newSize >= this.size) { + return; + } + if (newSize === 0) { + this.clear(); + return; + } + let current = this._tail; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.previous; + currentSize--; + } + this._tail = current; + this._size = currentSize; + if (current) { + current.next = undefined; + } + this._state++; + } + addItemFirst(item) { + // First time Insert + if (!this._head && !this._tail) { + this._tail = item; + } + else if (!this._head) { + throw new Error('Invalid list'); + } + else { + item.next = this._head; + this._head.previous = item; + } + this._head = item; + this._state++; + } + addItemLast(item) { + // First time Insert + if (!this._head && !this._tail) { + this._head = item; + } + else if (!this._tail) { + throw new Error('Invalid list'); + } + else { + item.previous = this._tail; + this._tail.next = item; + } + this._tail = item; + this._state++; + } + removeItem(item) { + if (item === this._head && item === this._tail) { + this._head = undefined; + this._tail = undefined; + } + else if (item === this._head) { + // This can only happen if size === 1 which is handled + // by the case above. + if (!item.next) { + throw new Error('Invalid list'); + } + item.next.previous = undefined; + this._head = item.next; + } + else if (item === this._tail) { + // This can only happen if size === 1 which is handled + // by the case above. + if (!item.previous) { + throw new Error('Invalid list'); + } + item.previous.next = undefined; + this._tail = item.previous; + } + else { + const next = item.next; + const previous = item.previous; + if (!next || !previous) { + throw new Error('Invalid list'); + } + next.previous = previous; + previous.next = next; + } + item.next = undefined; + item.previous = undefined; + this._state++; + } + touch(item, touch) { + if (!this._head || !this._tail) { + throw new Error('Invalid list'); + } + if ((touch !== 1 /* Touch.AsOld */ && touch !== 2 /* Touch.AsNew */)) { + return; + } + if (touch === 1 /* Touch.AsOld */) { + if (item === this._head) { + return; + } + const next = item.next; + const previous = item.previous; + // Unlink the item + if (item === this._tail) { + // previous must be defined since item was not head but is tail + // So there are more than on item in the map + previous.next = undefined; + this._tail = previous; + } + else { + // Both next and previous are not undefined since item was neither head nor tail. + next.previous = previous; + previous.next = next; + } + // Insert the node at head + item.previous = undefined; + item.next = this._head; + this._head.previous = item; + this._head = item; + this._state++; + } + else if (touch === 2 /* Touch.AsNew */) { + if (item === this._tail) { + return; + } + const next = item.next; + const previous = item.previous; + // Unlink the item. + if (item === this._head) { + // next must be defined since item was not tail but is head + // So there are more than on item in the map + next.previous = undefined; + this._head = next; + } + else { + // Both next and previous are not undefined since item was neither head nor tail. + next.previous = previous; + previous.next = next; + } + item.next = undefined; + item.previous = this._tail; + this._tail.next = item; + this._tail = item; + this._state++; + } + } + toJSON() { + const data = []; + this.forEach((value, key) => { + data.push([key, value]); + }); + return data; + } + fromJSON(data) { + this.clear(); + for (const [key, value] of data) { + this.set(key, value); + } + } +} +class Cache extends LinkedMap { + constructor(limit, ratio = 1) { + super(); + this._limit = limit; + this._ratio = Math.min(Math.max(0, ratio), 1); + } + get limit() { + return this._limit; + } + set limit(limit) { + this._limit = limit; + this.checkTrim(); + } + get(key, touch = 2 /* Touch.AsNew */) { + return super.get(key, touch); + } + peek(key) { + return super.get(key, 0 /* Touch.None */); + } + set(key, value) { + super.set(key, value, 2 /* Touch.AsNew */); + return this; + } + checkTrim() { + if (this.size > this._limit) { + this.trim(Math.round(this._limit * this._ratio)); + } + } +} +export class LRUCache extends Cache { + constructor(limit, ratio = 1) { + super(limit, ratio); + } + trim(newSize) { + this.trimOld(newSize); + } + set(key, value) { + super.set(key, value); + this.checkTrim(); + return this; + } +} +/** + * A map that allows access both by keys and values. + * **NOTE**: values need to be unique. + */ +export class BidirectionalMap { + constructor(entries) { + this._m1 = new Map(); + this._m2 = new Map(); + if (entries) { + for (const [key, value] of entries) { + this.set(key, value); + } + } + } + clear() { + this._m1.clear(); + this._m2.clear(); + } + set(key, value) { + this._m1.set(key, value); + this._m2.set(value, key); + } + get(key) { + return this._m1.get(key); + } + getKey(value) { + return this._m2.get(value); + } + delete(key) { + const value = this._m1.get(key); + if (value === undefined) { + return false; + } + this._m1.delete(key); + this._m2.delete(value); + return true; + } + keys() { + return this._m1.keys(); + } + values() { + return this._m1.values(); + } +} +export class SetMap { + constructor() { + this.map = new Map(); + } + add(key, value) { + let values = this.map.get(key); + if (!values) { + values = new Set(); + this.map.set(key, values); + } + values.add(value); + } + delete(key, value) { + const values = this.map.get(key); + if (!values) { + return; + } + values.delete(value); + if (values.size === 0) { + this.map.delete(key); + } + } + forEach(key, fn) { + const values = this.map.get(key); + if (!values) { + return; + } + values.forEach(fn); + } + get(key) { + const values = this.map.get(key); + if (!values) { + return new Set(); + } + return values; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marked/marked.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marked/marked.js new file mode 100644 index 0000000000000000000000000000000000000000..56333ffeb738907f144d15c6ebe44494d1b13330 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marked/marked.js @@ -0,0 +1,2538 @@ +/** + * marked v14.0.0 - a markdown parser + * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ + +/** + * DO NOT EDIT THIS FILE + * The code in this file is generated from files in ./src/ + */ + +// ESM-uncomment-begin +let __marked_exports = {}; +(function() { + function define(deps, factory) { + factory(__marked_exports); + } + define.amd = true; +// ESM-uncomment-end + +(function (global, factory) { + typeof define === 'function' && define.amd ? define(['exports'], factory) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.marked = {})); + })(this, (function (exports) { + 'use strict'; + + /** + * Gets the original marked default options. + */ + function _getDefaults() { + return { + async: false, + breaks: false, + extensions: null, + gfm: true, + hooks: null, + pedantic: false, + renderer: null, + silent: false, + tokenizer: null, + walkTokens: null, + }; + } + exports.defaults = _getDefaults(); + function changeDefaults(newDefaults) { + exports.defaults = newDefaults; + } + + /** + * Helpers + */ + const escapeTest = /[&<>"']/; + const escapeReplace = new RegExp(escapeTest.source, 'g'); + const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/; + const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g'); + const escapeReplacements = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + }; + const getEscapeReplacement = (ch) => escapeReplacements[ch]; + function escape$1(html, encode) { + if (encode) { + if (escapeTest.test(html)) { + return html.replace(escapeReplace, getEscapeReplacement); + } + } + else { + if (escapeTestNoEncode.test(html)) { + return html.replace(escapeReplaceNoEncode, getEscapeReplacement); + } + } + return html; + } + const caret = /(^|[^\[])\^/g; + function edit(regex, opt) { + let source = typeof regex === 'string' ? regex : regex.source; + opt = opt || ''; + const obj = { + replace: (name, val) => { + let valSource = typeof val === 'string' ? val : val.source; + valSource = valSource.replace(caret, '$1'); + source = source.replace(name, valSource); + return obj; + }, + getRegex: () => { + return new RegExp(source, opt); + }, + }; + return obj; + } + function cleanUrl(href) { + try { + href = encodeURI(href).replace(/%25/g, '%'); + } + catch { + return null; + } + return href; + } + const noopTest = { exec: () => null }; + function splitCells(tableRow, count) { + // ensure that every cell-delimiting pipe has a space + // before it to distinguish it from an escaped pipe + const row = tableRow.replace(/\|/g, (match, offset, str) => { + let escaped = false; + let curr = offset; + while (--curr >= 0 && str[curr] === '\\') + escaped = !escaped; + if (escaped) { + // odd number of slashes means | is escaped + // so we leave it alone + return '|'; + } + else { + // add space before unescaped | + return ' |'; + } + }), cells = row.split(/ \|/); + let i = 0; + // First/last cell in a row cannot be empty if it has no leading/trailing pipe + if (!cells[0].trim()) { + cells.shift(); + } + if (cells.length > 0 && !cells[cells.length - 1].trim()) { + cells.pop(); + } + if (count) { + if (cells.length > count) { + cells.splice(count); + } + else { + while (cells.length < count) + cells.push(''); + } + } + for (; i < cells.length; i++) { + // leading or trailing whitespace is ignored per the gfm spec + cells[i] = cells[i].trim().replace(/\\\|/g, '|'); + } + return cells; + } + /** + * Remove trailing 'c's. Equivalent to str.replace(/c*$/, ''). + * /c*$/ is vulnerable to REDOS. + * + * @param str + * @param c + * @param invert Remove suffix of non-c chars instead. Default falsey. + */ + function rtrim(str, c, invert) { + const l = str.length; + if (l === 0) { + return ''; + } + // Length of suffix matching the invert condition. + let suffLen = 0; + // Step left until we fail to match the invert condition. + while (suffLen < l) { + const currChar = str.charAt(l - suffLen - 1); + if (currChar === c && !invert) { + suffLen++; + } + else if (currChar !== c && invert) { + suffLen++; + } + else { + break; + } + } + return str.slice(0, l - suffLen); + } + function findClosingBracket(str, b) { + if (str.indexOf(b[1]) === -1) { + return -1; + } + let level = 0; + for (let i = 0; i < str.length; i++) { + if (str[i] === '\\') { + i++; + } + else if (str[i] === b[0]) { + level++; + } + else if (str[i] === b[1]) { + level--; + if (level < 0) { + return i; + } + } + } + return -1; + } + + function outputLink(cap, link, raw, lexer) { + const href = link.href; + const title = link.title ? escape$1(link.title) : null; + const text = cap[1].replace(/\\([\[\]])/g, '$1'); + if (cap[0].charAt(0) !== '!') { + lexer.state.inLink = true; + const token = { + type: 'link', + raw, + href, + title, + text, + tokens: lexer.inlineTokens(text), + }; + lexer.state.inLink = false; + return token; + } + return { + type: 'image', + raw, + href, + title, + text: escape$1(text), + }; + } + function indentCodeCompensation(raw, text) { + const matchIndentToCode = raw.match(/^(\s+)(?:```)/); + if (matchIndentToCode === null) { + return text; + } + const indentToCode = matchIndentToCode[1]; + return text + .split('\n') + .map(node => { + const matchIndentInNode = node.match(/^\s+/); + if (matchIndentInNode === null) { + return node; + } + const [indentInNode] = matchIndentInNode; + if (indentInNode.length >= indentToCode.length) { + return node.slice(indentToCode.length); + } + return node; + }) + .join('\n'); + } + /** + * Tokenizer + */ + class _Tokenizer { + options; + rules; // set by the lexer + lexer; // set by the lexer + constructor(options) { + this.options = options || exports.defaults; + } + space(src) { + const cap = this.rules.block.newline.exec(src); + if (cap && cap[0].length > 0) { + return { + type: 'space', + raw: cap[0], + }; + } + } + code(src) { + const cap = this.rules.block.code.exec(src); + if (cap) { + const text = cap[0].replace(/^ {1,4}/gm, ''); + return { + type: 'code', + raw: cap[0], + codeBlockStyle: 'indented', + text: !this.options.pedantic + ? rtrim(text, '\n') + : text, + }; + } + } + fences(src) { + const cap = this.rules.block.fences.exec(src); + if (cap) { + const raw = cap[0]; + const text = indentCodeCompensation(raw, cap[3] || ''); + return { + type: 'code', + raw, + lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2], + text, + }; + } + } + heading(src) { + const cap = this.rules.block.heading.exec(src); + if (cap) { + let text = cap[2].trim(); + // remove trailing #s + if (/#$/.test(text)) { + const trimmed = rtrim(text, '#'); + if (this.options.pedantic) { + text = trimmed.trim(); + } + else if (!trimmed || / $/.test(trimmed)) { + // CommonMark requires space before trailing #s + text = trimmed.trim(); + } + } + return { + type: 'heading', + raw: cap[0], + depth: cap[1].length, + text, + tokens: this.lexer.inline(text), + }; + } + } + hr(src) { + const cap = this.rules.block.hr.exec(src); + if (cap) { + return { + type: 'hr', + raw: rtrim(cap[0], '\n'), + }; + } + } + blockquote(src) { + const cap = this.rules.block.blockquote.exec(src); + if (cap) { + let lines = rtrim(cap[0], '\n').split('\n'); + let raw = ''; + let text = ''; + const tokens = []; + while (lines.length > 0) { + let inBlockquote = false; + const currentLines = []; + let i; + for (i = 0; i < lines.length; i++) { + // get lines up to a continuation + if (/^ {0,3}>/.test(lines[i])) { + currentLines.push(lines[i]); + inBlockquote = true; + } + else if (!inBlockquote) { + currentLines.push(lines[i]); + } + else { + break; + } + } + lines = lines.slice(i); + const currentRaw = currentLines.join('\n'); + const currentText = currentRaw + // precede setext continuation with 4 spaces so it isn't a setext + .replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1') + .replace(/^ {0,3}>[ \t]?/gm, ''); + raw = raw ? `${raw}\n${currentRaw}` : currentRaw; + text = text ? `${text}\n${currentText}` : currentText; + // parse blockquote lines as top level tokens + // merge paragraphs if this is a continuation + const top = this.lexer.state.top; + this.lexer.state.top = true; + this.lexer.blockTokens(currentText, tokens, true); + this.lexer.state.top = top; + // if there is no continuation then we are done + if (lines.length === 0) { + break; + } + const lastToken = tokens[tokens.length - 1]; + if (lastToken?.type === 'code') { + // blockquote continuation cannot be preceded by a code block + break; + } + else if (lastToken?.type === 'blockquote') { + // include continuation in nested blockquote + const oldToken = lastToken; + const newText = oldToken.raw + '\n' + lines.join('\n'); + const newToken = this.blockquote(newText); + tokens[tokens.length - 1] = newToken; + raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw; + text = text.substring(0, text.length - oldToken.text.length) + newToken.text; + break; + } + else if (lastToken?.type === 'list') { + // include continuation in nested list + const oldToken = lastToken; + const newText = oldToken.raw + '\n' + lines.join('\n'); + const newToken = this.list(newText); + tokens[tokens.length - 1] = newToken; + raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw; + text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw; + lines = newText.substring(tokens[tokens.length - 1].raw.length).split('\n'); + continue; + } + } + return { + type: 'blockquote', + raw, + tokens, + text, + }; + } + } + list(src) { + let cap = this.rules.block.list.exec(src); + if (cap) { + let bull = cap[1].trim(); + const isordered = bull.length > 1; + const list = { + type: 'list', + raw: '', + ordered: isordered, + start: isordered ? +bull.slice(0, -1) : '', + loose: false, + items: [], + }; + bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`; + if (this.options.pedantic) { + bull = isordered ? bull : '[*+-]'; + } + // Get next list item + const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`); + let endsWithBlankLine = false; + // Check if current bullet point can start a new List Item + while (src) { + let endEarly = false; + let raw = ''; + let itemContents = ''; + if (!(cap = itemRegex.exec(src))) { + break; + } + if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?) + break; + } + raw = cap[0]; + src = src.substring(raw.length); + let line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length)); + let nextLine = src.split('\n', 1)[0]; + let blankLine = !line.trim(); + let indent = 0; + if (this.options.pedantic) { + indent = 2; + itemContents = line.trimStart(); + } + else if (blankLine) { + indent = cap[1].length + 1; + } + else { + indent = cap[2].search(/[^ ]/); // Find first non-space char + indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent + itemContents = line.slice(indent); + indent += cap[1].length; + } + if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line + raw += nextLine + '\n'; + src = src.substring(nextLine.length + 1); + endEarly = true; + } + if (!endEarly) { + const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`); + const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`); + const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`); + const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`); + // Check if following lines should be included in List Item + while (src) { + const rawLine = src.split('\n', 1)[0]; + nextLine = rawLine; + // Re-align to follow commonmark nesting rules + if (this.options.pedantic) { + nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' '); + } + // End list item if found code fences + if (fencesBeginRegex.test(nextLine)) { + break; + } + // End list item if found start of new heading + if (headingBeginRegex.test(nextLine)) { + break; + } + // End list item if found start of new bullet + if (nextBulletRegex.test(nextLine)) { + break; + } + // Horizontal rule found + if (hrRegex.test(src)) { + break; + } + if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible + itemContents += '\n' + nextLine.slice(indent); + } + else { + // not enough indentation + if (blankLine) { + break; + } + // paragraph continuation unless last line was a different block level element + if (line.search(/[^ ]/) >= 4) { // indented code block + break; + } + if (fencesBeginRegex.test(line)) { + break; + } + if (headingBeginRegex.test(line)) { + break; + } + if (hrRegex.test(line)) { + break; + } + itemContents += '\n' + nextLine; + } + if (!blankLine && !nextLine.trim()) { // Check if current line is blank + blankLine = true; + } + raw += rawLine + '\n'; + src = src.substring(rawLine.length + 1); + line = nextLine.slice(indent); + } + } + if (!list.loose) { + // If the previous item ended with a blank line, the list is loose + if (endsWithBlankLine) { + list.loose = true; + } + else if (/\n *\n *$/.test(raw)) { + endsWithBlankLine = true; + } + } + let istask = null; + let ischecked; + // Check for task list items + if (this.options.gfm) { + istask = /^\[[ xX]\] /.exec(itemContents); + if (istask) { + ischecked = istask[0] !== '[ ] '; + itemContents = itemContents.replace(/^\[[ xX]\] +/, ''); + } + } + list.items.push({ + type: 'list_item', + raw, + task: !!istask, + checked: ischecked, + loose: false, + text: itemContents, + tokens: [], + }); + list.raw += raw; + } + // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic + list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd(); + list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd(); + list.raw = list.raw.trimEnd(); + // Item child tokens handled here at end because we needed to have the final item to trim it first + for (let i = 0; i < list.items.length; i++) { + this.lexer.state.top = false; + list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []); + if (!list.loose) { + // Check if list should be loose + const spacers = list.items[i].tokens.filter(t => t.type === 'space'); + const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw)); + list.loose = hasMultipleLineBreaks; + } + } + // Set all items to loose if list is loose + if (list.loose) { + for (let i = 0; i < list.items.length; i++) { + list.items[i].loose = true; + } + } + return list; + } + } + html(src) { + const cap = this.rules.block.html.exec(src); + if (cap) { + const token = { + type: 'html', + block: true, + raw: cap[0], + pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style', + text: cap[0], + }; + return token; + } + } + def(src) { + const cap = this.rules.block.def.exec(src); + if (cap) { + const tag = cap[1].toLowerCase().replace(/\s+/g, ' '); + const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline.anyPunctuation, '$1') : ''; + const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3]; + return { + type: 'def', + tag, + raw: cap[0], + href, + title, + }; + } + } + table(src) { + const cap = this.rules.block.table.exec(src); + if (!cap) { + return; + } + if (!/[:|]/.test(cap[2])) { + // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading + return; + } + const headers = splitCells(cap[1]); + const aligns = cap[2].replace(/^\||\| *$/g, '').split('|'); + const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []; + const item = { + type: 'table', + raw: cap[0], + header: [], + align: [], + rows: [], + }; + if (headers.length !== aligns.length) { + // header and align columns must be equal, rows can be different. + return; + } + for (const align of aligns) { + if (/^ *-+: *$/.test(align)) { + item.align.push('right'); + } + else if (/^ *:-+: *$/.test(align)) { + item.align.push('center'); + } + else if (/^ *:-+ *$/.test(align)) { + item.align.push('left'); + } + else { + item.align.push(null); + } + } + for (let i = 0; i < headers.length; i++) { + item.header.push({ + text: headers[i], + tokens: this.lexer.inline(headers[i]), + header: true, + align: item.align[i], + }); + } + for (const row of rows) { + item.rows.push(splitCells(row, item.header.length).map((cell, i) => { + return { + text: cell, + tokens: this.lexer.inline(cell), + header: false, + align: item.align[i], + }; + })); + } + return item; + } + lheading(src) { + const cap = this.rules.block.lheading.exec(src); + if (cap) { + return { + type: 'heading', + raw: cap[0], + depth: cap[2].charAt(0) === '=' ? 1 : 2, + text: cap[1], + tokens: this.lexer.inline(cap[1]), + }; + } + } + paragraph(src) { + const cap = this.rules.block.paragraph.exec(src); + if (cap) { + const text = cap[1].charAt(cap[1].length - 1) === '\n' + ? cap[1].slice(0, -1) + : cap[1]; + return { + type: 'paragraph', + raw: cap[0], + text, + tokens: this.lexer.inline(text), + }; + } + } + text(src) { + const cap = this.rules.block.text.exec(src); + if (cap) { + return { + type: 'text', + raw: cap[0], + text: cap[0], + tokens: this.lexer.inline(cap[0]), + }; + } + } + escape(src) { + const cap = this.rules.inline.escape.exec(src); + if (cap) { + return { + type: 'escape', + raw: cap[0], + text: escape$1(cap[1]), + }; + } + } + tag(src) { + const cap = this.rules.inline.tag.exec(src); + if (cap) { + if (!this.lexer.state.inLink && /^/i.test(cap[0])) { + this.lexer.state.inLink = false; + } + if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { + this.lexer.state.inRawBlock = true; + } + else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { + this.lexer.state.inRawBlock = false; + } + return { + type: 'html', + raw: cap[0], + inLink: this.lexer.state.inLink, + inRawBlock: this.lexer.state.inRawBlock, + block: false, + text: cap[0], + }; + } + } + link(src) { + const cap = this.rules.inline.link.exec(src); + if (cap) { + const trimmedUrl = cap[2].trim(); + if (!this.options.pedantic && /^$/.test(trimmedUrl))) { + return; + } + // ending angle bracket cannot be escaped + const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\'); + if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { + return; + } + } + else { + // find closing parenthesis + const lastParenIndex = findClosingBracket(cap[2], '()'); + if (lastParenIndex > -1) { + const start = cap[0].indexOf('!') === 0 ? 5 : 4; + const linkLen = start + cap[1].length + lastParenIndex; + cap[2] = cap[2].substring(0, lastParenIndex); + cap[0] = cap[0].substring(0, linkLen).trim(); + cap[3] = ''; + } + } + let href = cap[2]; + let title = ''; + if (this.options.pedantic) { + // split pedantic href and title + const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); + if (link) { + href = link[1]; + title = link[3]; + } + } + else { + title = cap[3] ? cap[3].slice(1, -1) : ''; + } + href = href.trim(); + if (/^$/.test(trimmedUrl))) { + // pedantic allows starting angle bracket without ending angle bracket + href = href.slice(1); + } + else { + href = href.slice(1, -1); + } + } + return outputLink(cap, { + href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href, + title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title, + }, cap[0], this.lexer); + } + } + reflink(src, links) { + let cap; + if ((cap = this.rules.inline.reflink.exec(src)) + || (cap = this.rules.inline.nolink.exec(src))) { + const linkString = (cap[2] || cap[1]).replace(/\s+/g, ' '); + const link = links[linkString.toLowerCase()]; + if (!link) { + const text = cap[0].charAt(0); + return { + type: 'text', + raw: text, + text, + }; + } + return outputLink(cap, link, cap[0], this.lexer); + } + } + emStrong(src, maskedSrc, prevChar = '') { + let match = this.rules.inline.emStrongLDelim.exec(src); + if (!match) + return; + // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well + if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) + return; + const nextChar = match[1] || match[2] || ''; + if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) { + // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below) + const lLength = [...match[0]].length - 1; + let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0; + const endReg = match[0][0] === '*' ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; + endReg.lastIndex = 0; + // Clip maskedSrc to same section of string as src (move to lexer?) + maskedSrc = maskedSrc.slice(-1 * src.length + lLength); + while ((match = endReg.exec(maskedSrc)) != null) { + rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6]; + if (!rDelim) + continue; // skip single * in __abc*abc__ + rLength = [...rDelim].length; + if (match[3] || match[4]) { // found another Left Delim + delimTotal += rLength; + continue; + } + else if (match[5] || match[6]) { // either Left or Right Delim + if (lLength % 3 && !((lLength + rLength) % 3)) { + midDelimTotal += rLength; + continue; // CommonMark Emphasis Rules 9-10 + } + } + delimTotal -= rLength; + if (delimTotal > 0) + continue; // Haven't found enough closing delimiters + // Remove extra characters. *a*** -> *a* + rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); + // char length can be >1 for unicode characters; + const lastCharLength = [...match[0]][0].length; + const raw = src.slice(0, lLength + match.index + lastCharLength + rLength); + // Create `em` if smallest delimiter has odd char count. *a*** + if (Math.min(lLength, rLength) % 2) { + const text = raw.slice(1, -1); + return { + type: 'em', + raw, + text, + tokens: this.lexer.inlineTokens(text), + }; + } + // Create 'strong' if smallest delimiter has even char count. **a*** + const text = raw.slice(2, -2); + return { + type: 'strong', + raw, + text, + tokens: this.lexer.inlineTokens(text), + }; + } + } + } + codespan(src) { + const cap = this.rules.inline.code.exec(src); + if (cap) { + let text = cap[2].replace(/\n/g, ' '); + const hasNonSpaceChars = /[^ ]/.test(text); + const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text); + if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { + text = text.substring(1, text.length - 1); + } + text = escape$1(text, true); + return { + type: 'codespan', + raw: cap[0], + text, + }; + } + } + br(src) { + const cap = this.rules.inline.br.exec(src); + if (cap) { + return { + type: 'br', + raw: cap[0], + }; + } + } + del(src) { + const cap = this.rules.inline.del.exec(src); + if (cap) { + return { + type: 'del', + raw: cap[0], + text: cap[2], + tokens: this.lexer.inlineTokens(cap[2]), + }; + } + } + autolink(src) { + const cap = this.rules.inline.autolink.exec(src); + if (cap) { + let text, href; + if (cap[2] === '@') { + text = escape$1(cap[1]); + href = 'mailto:' + text; + } + else { + text = escape$1(cap[1]); + href = text; + } + return { + type: 'link', + raw: cap[0], + text, + href, + tokens: [ + { + type: 'text', + raw: text, + text, + }, + ], + }; + } + } + url(src) { + let cap; + if (cap = this.rules.inline.url.exec(src)) { + let text, href; + if (cap[2] === '@') { + text = escape$1(cap[0]); + href = 'mailto:' + text; + } + else { + // do extended autolink path validation + let prevCapZero; + do { + prevCapZero = cap[0]; + cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? ''; + } while (prevCapZero !== cap[0]); + text = escape$1(cap[0]); + if (cap[1] === 'www.') { + href = 'http://' + cap[0]; + } + else { + href = cap[0]; + } + } + return { + type: 'link', + raw: cap[0], + text, + href, + tokens: [ + { + type: 'text', + raw: text, + text, + }, + ], + }; + } + } + inlineText(src) { + const cap = this.rules.inline.text.exec(src); + if (cap) { + let text; + if (this.lexer.state.inRawBlock) { + text = cap[0]; + } + else { + text = escape$1(cap[0]); + } + return { + type: 'text', + raw: cap[0], + text, + }; + } + } + } + + /** + * Block-Level Grammar + */ + const newline = /^(?: *(?:\n|$))+/; + const blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/; + const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/; + const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/; + const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/; + const bullet = /(?:[*+-]|\d{1,9}[.)])/; + const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/) + .replace(/bull/g, bullet) // lists can interrupt + .replace(/blockCode/g, / {4}/) // indented code blocks can interrupt + .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt + .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt + .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt + .replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt + .getRegex(); + const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/; + const blockText = /^[^\n]+/; + const _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/; + const def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/) + .replace('label', _blockLabel) + .replace('title', /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/) + .getRegex(); + const list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/) + .replace(/bull/g, bullet) + .getRegex(); + const _tag = 'address|article|aside|base|basefont|blockquote|body|caption' + + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title' + + '|tr|track|ul'; + const _comment = /|$))/; + const html = edit('^ {0,3}(?:' // optional indentation + + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' // (1) + + '|comment[^\\n]*(\\n+|$)' // (2) + + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3) + + '|\\n*|$)' // (4) + + '|\\n*|$)' // (5) + + '|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6) + + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag + + '|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag + + ')', 'i') + .replace('comment', _comment) + .replace('tag', _tag) + .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) + .getRegex(); + const paragraph = edit(_paragraph) + .replace('hr', hr) + .replace('heading', ' {0,3}#{1,6}(?:\\s|$)') + .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs + .replace('|table', '') + .replace('blockquote', ' {0,3}>') + .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') + .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt + .replace('html', ')|<(?:script|pre|style|textarea|!--)') + .replace('tag', _tag) // pars can be interrupted by type (6) html blocks + .getRegex(); + const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/) + .replace('paragraph', paragraph) + .getRegex(); + /** + * Normal Block Grammar + */ + const blockNormal = { + blockquote, + code: blockCode, + def, + fences, + heading, + hr, + html, + lheading, + list, + newline, + paragraph, + table: noopTest, + text: blockText, + }; + /** + * GFM Block Grammar + */ + const gfmTable = edit('^ *([^\\n ].*)\\n' // Header + + ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align + + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)') // Cells + .replace('hr', hr) + .replace('heading', ' {0,3}#{1,6}(?:\\s|$)') + .replace('blockquote', ' {0,3}>') + .replace('code', ' {4}[^\\n]') + .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') + .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt + .replace('html', ')|<(?:script|pre|style|textarea|!--)') + .replace('tag', _tag) // tables can be interrupted by type (6) html blocks + .getRegex(); + const blockGfm = { + ...blockNormal, + table: gfmTable, + paragraph: edit(_paragraph) + .replace('hr', hr) + .replace('heading', ' {0,3}#{1,6}(?:\\s|$)') + .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs + .replace('table', gfmTable) // interrupt paragraphs with table + .replace('blockquote', ' {0,3}>') + .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n') + .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt + .replace('html', ')|<(?:script|pre|style|textarea|!--)') + .replace('tag', _tag) // pars can be interrupted by type (6) html blocks + .getRegex(), + }; + /** + * Pedantic grammar (original John Gruber's loose markdown specification) + */ + const blockPedantic = { + ...blockNormal, + html: edit('^ *(?:comment *(?:\\n|\\s*$)' + + '|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' // closed tag + + '|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))') + .replace('comment', _comment) + .replace(/tag/g, '(?!(?:' + + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') + .getRegex(), + def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, + heading: /^(#{1,6})(.*)(?:\n+|$)/, + fences: noopTest, // fences not supported + lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, + paragraph: edit(_paragraph) + .replace('hr', hr) + .replace('heading', ' *#{1,6} *[^\n]') + .replace('lheading', lheading) + .replace('|table', '') + .replace('blockquote', ' {0,3}>') + .replace('|fences', '') + .replace('|list', '') + .replace('|html', '') + .replace('|tag', '') + .getRegex(), + }; + /** + * Inline-Level Grammar + */ + const escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/; + const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/; + const br = /^( {2,}|\\)\n(?!\s*$)/; + const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\ + const blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g; + const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u') + .replace(/punct/g, _punctuation) + .getRegex(); + const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong + + '|[^*]+(?=[^*])' // Consume to delim + + '|(?!\\*)[punct](\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter + + '|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter + + '|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])' // (3) #***a, ***a can only be Left Delimiter + + '|[\\s](\\*+)(?!\\*)(?=[punct])' // (4) ***# can only be Left Delimiter + + '|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter + + '|[^punct\\s](\\*+)(?=[^punct\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter + .replace(/punct/g, _punctuation) + .getRegex(); + // (6) Not allowed for _ + const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong + + '|[^_]+(?=[^_])' // Consume to delim + + '|(?!_)[punct](_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter + + '|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter + + '|(?!_)[punct\\s](_+)(?=[^punct\\s])' // (3) #___a, ___a can only be Left Delimiter + + '|[\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter + + '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter + .replace(/punct/g, _punctuation) + .getRegex(); + const anyPunctuation = edit(/\\([punct])/, 'gu') + .replace(/punct/g, _punctuation) + .getRegex(); + const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/) + .replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/) + .replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/) + .getRegex(); + const _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex(); + const tag = edit('^comment' + + '|^' // self-closing tag + + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag + + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. + + '|^' // declaration, e.g. + + '|^') // CDATA section + .replace('comment', _inlineComment) + .replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/) + .getRegex(); + const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; + const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/) + .replace('label', _inlineLabel) + .replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/) + .replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/) + .getRegex(); + const reflink = edit(/^!?\[(label)\]\[(ref)\]/) + .replace('label', _inlineLabel) + .replace('ref', _blockLabel) + .getRegex(); + const nolink = edit(/^!?\[(ref)\](?:\[\])?/) + .replace('ref', _blockLabel) + .getRegex(); + const reflinkSearch = edit('reflink|nolink(?!\\()', 'g') + .replace('reflink', reflink) + .replace('nolink', nolink) + .getRegex(); + /** + * Normal Inline Grammar + */ + const inlineNormal = { + _backpedal: noopTest, // only used for GFM url + anyPunctuation, + autolink, + blockSkip, + br, + code: inlineCode, + del: noopTest, + emStrongLDelim, + emStrongRDelimAst, + emStrongRDelimUnd, + escape, + link, + nolink, + punctuation, + reflink, + reflinkSearch, + tag, + text: inlineText, + url: noopTest, + }; + /** + * Pedantic Inline Grammar + */ + const inlinePedantic = { + ...inlineNormal, + link: edit(/^!?\[(label)\]\((.*?)\)/) + .replace('label', _inlineLabel) + .getRegex(), + reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/) + .replace('label', _inlineLabel) + .getRegex(), + }; + /** + * GFM Inline Grammar + */ + const inlineGfm = { + ...inlineNormal, + escape: edit(escape).replace('])', '~|])').getRegex(), + url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i') + .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/) + .getRegex(), + _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, + del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, + text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ { + return leading + ' '.repeat(tabs.length); + }); + } + let token; + let lastToken; + let cutSrc; + while (src) { + if (this.options.extensions + && this.options.extensions.block + && this.options.extensions.block.some((extTokenizer) => { + if (token = extTokenizer.call({ lexer: this }, src, tokens)) { + src = src.substring(token.raw.length); + tokens.push(token); + return true; + } + return false; + })) { + continue; + } + // newline + if (token = this.tokenizer.space(src)) { + src = src.substring(token.raw.length); + if (token.raw.length === 1 && tokens.length > 0) { + // if there's a single \n as a spacer, it's terminating the last line, + // so move it there so that we don't get unnecessary paragraph tags + tokens[tokens.length - 1].raw += '\n'; + } + else { + tokens.push(token); + } + continue; + } + // code + if (token = this.tokenizer.code(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + // An indented code block cannot interrupt a paragraph. + if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) { + lastToken.raw += '\n' + token.raw; + lastToken.text += '\n' + token.text; + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } + else { + tokens.push(token); + } + continue; + } + // fences + if (token = this.tokenizer.fences(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // heading + if (token = this.tokenizer.heading(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // hr + if (token = this.tokenizer.hr(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // blockquote + if (token = this.tokenizer.blockquote(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // list + if (token = this.tokenizer.list(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // html + if (token = this.tokenizer.html(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // def + if (token = this.tokenizer.def(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) { + lastToken.raw += '\n' + token.raw; + lastToken.text += '\n' + token.raw; + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } + else if (!this.tokens.links[token.tag]) { + this.tokens.links[token.tag] = { + href: token.href, + title: token.title, + }; + } + continue; + } + // table (gfm) + if (token = this.tokenizer.table(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // lheading + if (token = this.tokenizer.lheading(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // top-level paragraph + // prevent paragraph consuming extensions by clipping 'src' to extension start + cutSrc = src; + if (this.options.extensions && this.options.extensions.startBlock) { + let startIndex = Infinity; + const tempSrc = src.slice(1); + let tempStart; + this.options.extensions.startBlock.forEach((getStartIndex) => { + tempStart = getStartIndex.call({ lexer: this }, tempSrc); + if (typeof tempStart === 'number' && tempStart >= 0) { + startIndex = Math.min(startIndex, tempStart); + } + }); + if (startIndex < Infinity && startIndex >= 0) { + cutSrc = src.substring(0, startIndex + 1); + } + } + if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) { + lastToken = tokens[tokens.length - 1]; + if (lastParagraphClipped && lastToken?.type === 'paragraph') { + lastToken.raw += '\n' + token.raw; + lastToken.text += '\n' + token.text; + this.inlineQueue.pop(); + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } + else { + tokens.push(token); + } + lastParagraphClipped = (cutSrc.length !== src.length); + src = src.substring(token.raw.length); + continue; + } + // text + if (token = this.tokenizer.text(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && lastToken.type === 'text') { + lastToken.raw += '\n' + token.raw; + lastToken.text += '\n' + token.text; + this.inlineQueue.pop(); + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } + else { + tokens.push(token); + } + continue; + } + if (src) { + const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); + if (this.options.silent) { + console.error(errMsg); + break; + } + else { + throw new Error(errMsg); + } + } + } + this.state.top = true; + return tokens; + } + inline(src, tokens = []) { + this.inlineQueue.push({ src, tokens }); + return tokens; + } + /** + * Lexing/Compiling + */ + inlineTokens(src, tokens = []) { + let token, lastToken, cutSrc; + // String with links masked to avoid interference with em and strong + let maskedSrc = src; + let match; + let keepPrevChar, prevChar; + // Mask out reflinks + if (this.tokens.links) { + const links = Object.keys(this.tokens.links); + if (links.length > 0) { + while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { + if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) { + maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); + } + } + } + } + // Mask out other blocks + while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { + maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); + } + // Mask out escaped characters + while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) { + maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); + } + while (src) { + if (!keepPrevChar) { + prevChar = ''; + } + keepPrevChar = false; + // extensions + if (this.options.extensions + && this.options.extensions.inline + && this.options.extensions.inline.some((extTokenizer) => { + if (token = extTokenizer.call({ lexer: this }, src, tokens)) { + src = src.substring(token.raw.length); + tokens.push(token); + return true; + } + return false; + })) { + continue; + } + // escape + if (token = this.tokenizer.escape(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // tag + if (token = this.tokenizer.tag(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && token.type === 'text' && lastToken.type === 'text') { + lastToken.raw += token.raw; + lastToken.text += token.text; + } + else { + tokens.push(token); + } + continue; + } + // link + if (token = this.tokenizer.link(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // reflink, nolink + if (token = this.tokenizer.reflink(src, this.tokens.links)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && token.type === 'text' && lastToken.type === 'text') { + lastToken.raw += token.raw; + lastToken.text += token.text; + } + else { + tokens.push(token); + } + continue; + } + // em & strong + if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // code + if (token = this.tokenizer.codespan(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // br + if (token = this.tokenizer.br(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // del (gfm) + if (token = this.tokenizer.del(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // autolink + if (token = this.tokenizer.autolink(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // url (gfm) + if (!this.state.inLink && (token = this.tokenizer.url(src))) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + // text + // prevent inlineText consuming extensions by clipping 'src' to extension start + cutSrc = src; + if (this.options.extensions && this.options.extensions.startInline) { + let startIndex = Infinity; + const tempSrc = src.slice(1); + let tempStart; + this.options.extensions.startInline.forEach((getStartIndex) => { + tempStart = getStartIndex.call({ lexer: this }, tempSrc); + if (typeof tempStart === 'number' && tempStart >= 0) { + startIndex = Math.min(startIndex, tempStart); + } + }); + if (startIndex < Infinity && startIndex >= 0) { + cutSrc = src.substring(0, startIndex + 1); + } + } + if (token = this.tokenizer.inlineText(cutSrc)) { + src = src.substring(token.raw.length); + if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started + prevChar = token.raw.slice(-1); + } + keepPrevChar = true; + lastToken = tokens[tokens.length - 1]; + if (lastToken && lastToken.type === 'text') { + lastToken.raw += token.raw; + lastToken.text += token.text; + } + else { + tokens.push(token); + } + continue; + } + if (src) { + const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0); + if (this.options.silent) { + console.error(errMsg); + break; + } + else { + throw new Error(errMsg); + } + } + } + return tokens; + } + } + + /** + * Renderer + */ + class _Renderer { + options; + parser; // set by the parser + constructor(options) { + this.options = options || exports.defaults; + } + space(token) { + return ''; + } + code({ text, lang, escaped }) { + const langString = (lang || '').match(/^\S*/)?.[0]; + const code = text.replace(/\n$/, '') + '\n'; + if (!langString) { + return '

'
+					+ (escaped ? code : escape$1(code, true))
+					+ '
\n'; + } + return '
'
+				+ (escaped ? code : escape$1(code, true))
+				+ '
\n'; + } + blockquote({ tokens }) { + const body = this.parser.parse(tokens); + return `
\n${body}
\n`; + } + html({ text }) { + return text; + } + heading({ tokens, depth }) { + return `${this.parser.parseInline(tokens)}\n`; + } + hr(token) { + return '
\n'; + } + list(token) { + const ordered = token.ordered; + const start = token.start; + let body = ''; + for (let j = 0; j < token.items.length; j++) { + const item = token.items[j]; + body += this.listitem(item); + } + const type = ordered ? 'ol' : 'ul'; + const startAttr = (ordered && start !== 1) ? (' start="' + start + '"') : ''; + return '<' + type + startAttr + '>\n' + body + '\n'; + } + listitem(item) { + let itemBody = ''; + if (item.task) { + const checkbox = this.checkbox({ checked: !!item.checked }); + if (item.loose) { + if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') { + item.tokens[0].text = checkbox + ' ' + item.tokens[0].text; + if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') { + item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text; + } + } + else { + item.tokens.unshift({ + type: 'text', + raw: checkbox + ' ', + text: checkbox + ' ', + }); + } + } + else { + itemBody += checkbox + ' '; + } + } + itemBody += this.parser.parse(item.tokens, !!item.loose); + return `
  • ${itemBody}
  • \n`; + } + checkbox({ checked }) { + return ''; + } + paragraph({ tokens }) { + return `

    ${this.parser.parseInline(tokens)}

    \n`; + } + table(token) { + let header = ''; + // header + let cell = ''; + for (let j = 0; j < token.header.length; j++) { + cell += this.tablecell(token.header[j]); + } + header += this.tablerow({ text: cell }); + let body = ''; + for (let j = 0; j < token.rows.length; j++) { + const row = token.rows[j]; + cell = ''; + for (let k = 0; k < row.length; k++) { + cell += this.tablecell(row[k]); + } + body += this.tablerow({ text: cell }); + } + if (body) + body = `${body}`; + return '\n' + + '\n' + + header + + '\n' + + body + + '
    \n'; + } + tablerow({ text }) { + return `\n${text}\n`; + } + tablecell(token) { + const content = this.parser.parseInline(token.tokens); + const type = token.header ? 'th' : 'td'; + const tag = token.align + ? `<${type} align="${token.align}">` + : `<${type}>`; + return tag + content + `\n`; + } + /** + * span level renderer + */ + strong({ tokens }) { + return `${this.parser.parseInline(tokens)}`; + } + em({ tokens }) { + return `${this.parser.parseInline(tokens)}`; + } + codespan({ text }) { + return `${text}`; + } + br(token) { + return '
    '; + } + del({ tokens }) { + return `${this.parser.parseInline(tokens)}`; + } + link({ href, title, tokens }) { + const text = this.parser.parseInline(tokens); + const cleanHref = cleanUrl(href); + if (cleanHref === null) { + return text; + } + href = cleanHref; + let out = '
    '; + return out; + } + image({ href, title, text }) { + const cleanHref = cleanUrl(href); + if (cleanHref === null) { + return text; + } + href = cleanHref; + let out = `${text} { + const tokens = genericToken[childTokens].flat(Infinity); + values = values.concat(this.walkTokens(tokens, callback)); + }); + } + else if (genericToken.tokens) { + values = values.concat(this.walkTokens(genericToken.tokens, callback)); + } + } + } + } + return values; + } + use(...args) { + const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} }; + args.forEach((pack) => { + // copy options to new object + const opts = { ...pack }; + // set async to true if it was set to true before + opts.async = this.defaults.async || opts.async || false; + // ==-- Parse "addon" extensions --== // + if (pack.extensions) { + pack.extensions.forEach((ext) => { + if (!ext.name) { + throw new Error('extension name required'); + } + if ('renderer' in ext) { // Renderer extensions + const prevRenderer = extensions.renderers[ext.name]; + if (prevRenderer) { + // Replace extension with func to run new extension but fall back if false + extensions.renderers[ext.name] = function (...args) { + let ret = ext.renderer.apply(this, args); + if (ret === false) { + ret = prevRenderer.apply(this, args); + } + return ret; + }; + } + else { + extensions.renderers[ext.name] = ext.renderer; + } + } + if ('tokenizer' in ext) { // Tokenizer Extensions + if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) { + throw new Error("extension level must be 'block' or 'inline'"); + } + const extLevel = extensions[ext.level]; + if (extLevel) { + extLevel.unshift(ext.tokenizer); + } + else { + extensions[ext.level] = [ext.tokenizer]; + } + if (ext.start) { // Function to check for start of token + if (ext.level === 'block') { + if (extensions.startBlock) { + extensions.startBlock.push(ext.start); + } + else { + extensions.startBlock = [ext.start]; + } + } + else if (ext.level === 'inline') { + if (extensions.startInline) { + extensions.startInline.push(ext.start); + } + else { + extensions.startInline = [ext.start]; + } + } + } + } + if ('childTokens' in ext && ext.childTokens) { // Child tokens to be visited by walkTokens + extensions.childTokens[ext.name] = ext.childTokens; + } + }); + opts.extensions = extensions; + } + // ==-- Parse "overwrite" extensions --== // + if (pack.renderer) { + const renderer = this.defaults.renderer || new _Renderer(this.defaults); + for (const prop in pack.renderer) { + if (!(prop in renderer)) { + throw new Error(`renderer '${prop}' does not exist`); + } + if (['options', 'parser'].includes(prop)) { + // ignore options property + continue; + } + const rendererProp = prop; + const rendererFunc = pack.renderer[rendererProp]; + const prevRenderer = renderer[rendererProp]; + // Replace renderer with func to run extension, but fall back if false + renderer[rendererProp] = (...args) => { + let ret = rendererFunc.apply(renderer, args); + if (ret === false) { + ret = prevRenderer.apply(renderer, args); + } + return ret || ''; + }; + } + opts.renderer = renderer; + } + if (pack.tokenizer) { + const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults); + for (const prop in pack.tokenizer) { + if (!(prop in tokenizer)) { + throw new Error(`tokenizer '${prop}' does not exist`); + } + if (['options', 'rules', 'lexer'].includes(prop)) { + // ignore options, rules, and lexer properties + continue; + } + const tokenizerProp = prop; + const tokenizerFunc = pack.tokenizer[tokenizerProp]; + const prevTokenizer = tokenizer[tokenizerProp]; + // Replace tokenizer with func to run extension, but fall back if false + // @ts-expect-error cannot type tokenizer function dynamically + tokenizer[tokenizerProp] = (...args) => { + let ret = tokenizerFunc.apply(tokenizer, args); + if (ret === false) { + ret = prevTokenizer.apply(tokenizer, args); + } + return ret; + }; + } + opts.tokenizer = tokenizer; + } + // ==-- Parse Hooks extensions --== // + if (pack.hooks) { + const hooks = this.defaults.hooks || new _Hooks(); + for (const prop in pack.hooks) { + if (!(prop in hooks)) { + throw new Error(`hook '${prop}' does not exist`); + } + if (prop === 'options') { + // ignore options property + continue; + } + const hooksProp = prop; + const hooksFunc = pack.hooks[hooksProp]; + const prevHook = hooks[hooksProp]; + if (_Hooks.passThroughHooks.has(prop)) { + // @ts-expect-error cannot type hook function dynamically + hooks[hooksProp] = (arg) => { + if (this.defaults.async) { + return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => { + return prevHook.call(hooks, ret); + }); + } + const ret = hooksFunc.call(hooks, arg); + return prevHook.call(hooks, ret); + }; + } + else { + // @ts-expect-error cannot type hook function dynamically + hooks[hooksProp] = (...args) => { + let ret = hooksFunc.apply(hooks, args); + if (ret === false) { + ret = prevHook.apply(hooks, args); + } + return ret; + }; + } + } + opts.hooks = hooks; + } + // ==-- Parse WalkTokens extensions --== // + if (pack.walkTokens) { + const walkTokens = this.defaults.walkTokens; + const packWalktokens = pack.walkTokens; + opts.walkTokens = function (token) { + let values = []; + values.push(packWalktokens.call(this, token)); + if (walkTokens) { + values = values.concat(walkTokens.call(this, token)); + } + return values; + }; + } + this.defaults = { ...this.defaults, ...opts }; + }); + return this; + } + setOptions(opt) { + this.defaults = { ...this.defaults, ...opt }; + return this; + } + lexer(src, options) { + return _Lexer.lex(src, options ?? this.defaults); + } + parser(tokens, options) { + return _Parser.parse(tokens, options ?? this.defaults); + } + parseMarkdown(lexer, parser) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const parse = (src, options) => { + const origOpt = { ...options }; + const opt = { ...this.defaults, ...origOpt }; + const throwError = this.onError(!!opt.silent, !!opt.async); + // throw error if an extension set async to true but parse was called with async: false + if (this.defaults.async === true && origOpt.async === false) { + return throwError(new Error('marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.')); + } + // throw error in case of non string input + if (typeof src === 'undefined' || src === null) { + return throwError(new Error('marked(): input parameter is undefined or null')); + } + if (typeof src !== 'string') { + return throwError(new Error('marked(): input parameter is of type ' + + Object.prototype.toString.call(src) + ', string expected')); + } + if (opt.hooks) { + opt.hooks.options = opt; + } + if (opt.async) { + return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src) + .then(src => lexer(src, opt)) + .then(tokens => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens) + .then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens) + .then(tokens => parser(tokens, opt)) + .then(html => opt.hooks ? opt.hooks.postprocess(html) : html) + .catch(throwError); + } + try { + if (opt.hooks) { + src = opt.hooks.preprocess(src); + } + let tokens = lexer(src, opt); + if (opt.hooks) { + tokens = opt.hooks.processAllTokens(tokens); + } + if (opt.walkTokens) { + this.walkTokens(tokens, opt.walkTokens); + } + let html = parser(tokens, opt); + if (opt.hooks) { + html = opt.hooks.postprocess(html); + } + return html; + } + catch (e) { + return throwError(e); + } + }; + return parse; + } + onError(silent, async) { + return (e) => { + e.message += '\nPlease report this to https://github.com/markedjs/marked.'; + if (silent) { + const msg = '

    An error occurred:

    '
    +						+ escape$1(e.message + '', true)
    +						+ '
    '; + if (async) { + return Promise.resolve(msg); + } + return msg; + } + if (async) { + return Promise.reject(e); + } + throw e; + }; + } + } + + const markedInstance = new Marked(); + function marked(src, opt) { + return markedInstance.parse(src, opt); + } + /** + * Sets the default options. + * + * @param options Hash of options + */ + marked.options = + marked.setOptions = function (options) { + markedInstance.setOptions(options); + marked.defaults = markedInstance.defaults; + changeDefaults(marked.defaults); + return marked; + }; + /** + * Gets the original marked default options. + */ + marked.getDefaults = _getDefaults; + marked.defaults = exports.defaults; + /** + * Use Extension + */ + marked.use = function (...args) { + markedInstance.use(...args); + marked.defaults = markedInstance.defaults; + changeDefaults(marked.defaults); + return marked; + }; + /** + * Run callback for every token + */ + marked.walkTokens = function (tokens, callback) { + return markedInstance.walkTokens(tokens, callback); + }; + /** + * Compiles markdown to HTML without enclosing `p` tag. + * + * @param src String of markdown source to be compiled + * @param options Hash of options + * @return String of compiled HTML + */ + marked.parseInline = markedInstance.parseInline; + /** + * Expose + */ + marked.Parser = _Parser; + marked.parser = _Parser.parse; + marked.Renderer = _Renderer; + marked.TextRenderer = _TextRenderer; + marked.Lexer = _Lexer; + marked.lexer = _Lexer.lex; + marked.Tokenizer = _Tokenizer; + marked.Hooks = _Hooks; + marked.parse = marked; + const options = marked.options; + const setOptions = marked.setOptions; + const use = marked.use; + const walkTokens = marked.walkTokens; + const parseInline = marked.parseInline; + const parse = marked; + const parser = _Parser.parse; + const lexer = _Lexer.lex; + + exports.Hooks = _Hooks; + exports.Lexer = _Lexer; + exports.Marked = Marked; + exports.Parser = _Parser; + exports.Renderer = _Renderer; + exports.TextRenderer = _TextRenderer; + exports.Tokenizer = _Tokenizer; + exports.getDefaults = _getDefaults; + exports.lexer = lexer; + exports.marked = marked; + exports.options = options; + exports.parse = parse; + exports.parseInline = parseInline; + exports.parser = parser; + exports.setOptions = setOptions; + exports.use = use; + exports.walkTokens = walkTokens; +})); + +// ESM-uncomment-begin +})(); +export var Hooks = (__marked_exports.Hooks || exports.Hooks); +export var Lexer = (__marked_exports.Lexer || exports.Lexer); +export var Marked = (__marked_exports.Marked || exports.Marked); +export var Parser = (__marked_exports.Parser || exports.Parser); +export var Renderer = (__marked_exports.Renderer || exports.Renderer); +export var TextRenderer = (__marked_exports.TextRenderer || exports.TextRenderer); +export var Tokenizer = (__marked_exports.Tokenizer || exports.Tokenizer); +export var defaults = (__marked_exports.defaults || exports.defaults); +export var getDefaults = (__marked_exports.getDefaults || exports.getDefaults); +export var lexer = (__marked_exports.lexer || exports.lexer); +export var marked = (__marked_exports.marked || exports.marked); +export var options = (__marked_exports.options || exports.options); +export var parse = (__marked_exports.parse || exports.parse); +export var parseInline = (__marked_exports.parseInline || exports.parseInline); +export var parser = (__marked_exports.parser || exports.parser); +export var setOptions = (__marked_exports.setOptions || exports.setOptions); +export var use = (__marked_exports.use || exports.use); +export var walkTokens = (__marked_exports.walkTokens || exports.walkTokens); +// ESM-uncomment-end + +//# sourceMappingURL=marked.umd.js.map diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marshalling.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marshalling.js new file mode 100644 index 0000000000000000000000000000000000000000..05905eb6401dc8206e9d984903467aede218c1a9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marshalling.js @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { VSBuffer } from './buffer.js'; +import { URI } from './uri.js'; +export function stringify(obj) { + return JSON.stringify(obj, replacer); +} +export function parse(text) { + let data = JSON.parse(text); + data = revive(data); + return data; +} +function replacer(key, value) { + // URI is done via toJSON-member + if (value instanceof RegExp) { + return { + $mid: 2 /* MarshalledId.Regexp */, + source: value.source, + flags: value.flags, + }; + } + return value; +} +export function revive(obj, depth = 0) { + if (!obj || depth > 200) { + return obj; + } + if (typeof obj === 'object') { + switch (obj.$mid) { + case 1 /* MarshalledId.Uri */: return URI.revive(obj); + case 2 /* MarshalledId.Regexp */: return new RegExp(obj.source, obj.flags); + case 17 /* MarshalledId.Date */: return new Date(obj.source); + } + if (obj instanceof VSBuffer + || obj instanceof Uint8Array) { + return obj; + } + if (Array.isArray(obj)) { + for (let i = 0; i < obj.length; ++i) { + obj[i] = revive(obj[i], depth + 1); + } + } + else { + // walk object + for (const key in obj) { + if (Object.hasOwnProperty.call(obj, key)) { + obj[key] = revive(obj[key], depth + 1); + } + } + } + } + return obj; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marshallingIds.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marshallingIds.js new file mode 100644 index 0000000000000000000000000000000000000000..22ebee8610dbc3bd2ffd7060edf7818d5261dde2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/marshallingIds.js @@ -0,0 +1,5 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/mime.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/mime.js new file mode 100644 index 0000000000000000000000000000000000000000..8b663cc13b6d7e730f058143d7a3bf076b642bcb --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/mime.js @@ -0,0 +1,8 @@ +export const Mimes = Object.freeze({ + text: 'text/plain', + binary: 'application/octet-stream', + unknown: 'application/unknown', + markdown: 'text/markdown', + latex: 'text/latex', + uriList: 'text/uri-list', +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/naturalLanguage/korean.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/naturalLanguage/korean.js new file mode 100644 index 0000000000000000000000000000000000000000..bef6639cc535628a929e92cfe13dfa8d649ada41 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/naturalLanguage/korean.js @@ -0,0 +1,319 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// allow-any-unicode-comment-file +/** + * Gets alternative Korean characters for the character code. This will return the ascii + * character code(s) that a Hangul character may have been input with using a qwerty layout. + * + * This only aims to cover modern (not archaic) Hangul syllables. + * + * @param code The character code to get alternate characters for + */ +export function getKoreanAltChars(code) { + const result = disassembleKorean(code); + if (result && result.length > 0) { + return new Uint32Array(result); + } + return undefined; +} +let codeBufferLength = 0; +const codeBuffer = new Uint32Array(10); +function disassembleKorean(code) { + codeBufferLength = 0; + // Initial consonants (초성) + getCodesFromArray(code, modernConsonants, 4352 /* HangulRangeStartCode.InitialConsonant */); + if (codeBufferLength > 0) { + return codeBuffer.subarray(0, codeBufferLength); + } + // Vowels (중성) + getCodesFromArray(code, modernVowels, 4449 /* HangulRangeStartCode.Vowel */); + if (codeBufferLength > 0) { + return codeBuffer.subarray(0, codeBufferLength); + } + // Final consonants (종성) + getCodesFromArray(code, modernFinalConsonants, 4520 /* HangulRangeStartCode.FinalConsonant */); + if (codeBufferLength > 0) { + return codeBuffer.subarray(0, codeBufferLength); + } + // Hangul Compatibility Jamo + getCodesFromArray(code, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */); + if (codeBufferLength) { + return codeBuffer.subarray(0, codeBufferLength); + } + // Hangul Syllables + if (code >= 0xAC00 && code <= 0xD7A3) { + const hangulIndex = code - 0xAC00; + const vowelAndFinalConsonantProduct = hangulIndex % 588; + // 0-based starting at 0x1100 + const initialConsonantIndex = Math.floor(hangulIndex / 588); + // 0-based starting at 0x1161 + const vowelIndex = Math.floor(vowelAndFinalConsonantProduct / 28); + // 0-based starting at 0x11A8 + // Subtract 1 as the standard algorithm uses the 0 index to represent no + // final consonant + const finalConsonantIndex = vowelAndFinalConsonantProduct % 28 - 1; + if (initialConsonantIndex < modernConsonants.length) { + getCodesFromArray(initialConsonantIndex, modernConsonants, 0); + } + else if (4352 /* HangulRangeStartCode.InitialConsonant */ + initialConsonantIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */ < compatibilityJamo.length) { + getCodesFromArray(4352 /* HangulRangeStartCode.InitialConsonant */ + initialConsonantIndex, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */); + } + if (vowelIndex < modernVowels.length) { + getCodesFromArray(vowelIndex, modernVowels, 0); + } + else if (4449 /* HangulRangeStartCode.Vowel */ + vowelIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */ < compatibilityJamo.length) { + getCodesFromArray(4449 /* HangulRangeStartCode.Vowel */ + vowelIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */); + } + if (finalConsonantIndex >= 0) { + if (finalConsonantIndex < modernFinalConsonants.length) { + getCodesFromArray(finalConsonantIndex, modernFinalConsonants, 0); + } + else if (4520 /* HangulRangeStartCode.FinalConsonant */ + finalConsonantIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */ < compatibilityJamo.length) { + getCodesFromArray(4520 /* HangulRangeStartCode.FinalConsonant */ + finalConsonantIndex - 12593 /* HangulRangeStartCode.CompatibilityJamo */, compatibilityJamo, 12593 /* HangulRangeStartCode.CompatibilityJamo */); + } + } + if (codeBufferLength > 0) { + return codeBuffer.subarray(0, codeBufferLength); + } + } + return undefined; +} +function getCodesFromArray(code, array, arrayStartIndex) { + // Verify the code is within the array's range + if (code >= arrayStartIndex && code < arrayStartIndex + array.length) { + addCodesToBuffer(array[code - arrayStartIndex]); + } +} +function addCodesToBuffer(codes) { + // NUL is ignored, this is used for archaic characters to avoid using a Map + // for the data + if (codes === 0 /* AsciiCode.NUL */) { + return; + } + // Number stored in format: OptionalThirdCode << 16 | OptionalSecondCode << 8 | Code + codeBuffer[codeBufferLength++] = codes & 0xFF; + if (codes >> 8) { + codeBuffer[codeBufferLength++] = (codes >> 8) & 0xFF; + } + if (codes >> 16) { + codeBuffer[codeBufferLength++] = (codes >> 16) & 0xFF; + } +} +/** + * Hangul Jamo - Modern consonants #1 + * + * Range U+1100..U+1112 + * + * | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | + * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| + * | U+110x | ᄀ | ᄁ | ᄂ | ᄃ | ᄄ | ᄅ | ᄆ | ᄇ | ᄈ | ᄉ | ᄊ | ᄋ | ᄌ | ᄍ | ᄎ | ᄏ | + * | U+111x | ᄐ | ᄑ | ᄒ | + */ +const modernConsonants = new Uint8Array([ + 114 /* AsciiCode.r */, // ㄱ + 82 /* AsciiCode.R */, // ㄲ + 115 /* AsciiCode.s */, // ㄴ + 101 /* AsciiCode.e */, // ㄷ + 69 /* AsciiCode.E */, // ㄸ + 102 /* AsciiCode.f */, // ㄹ + 97 /* AsciiCode.a */, // ㅁ + 113 /* AsciiCode.q */, // ㅂ + 81 /* AsciiCode.Q */, // ㅃ + 116 /* AsciiCode.t */, // ㅅ + 84 /* AsciiCode.T */, // ㅆ + 100 /* AsciiCode.d */, // ㅇ + 119 /* AsciiCode.w */, // ㅈ + 87 /* AsciiCode.W */, // ㅉ + 99 /* AsciiCode.c */, // ㅊ + 122 /* AsciiCode.z */, // ㅋ + 120 /* AsciiCode.x */, // ㅌ + 118 /* AsciiCode.v */, // ㅍ + 103 /* AsciiCode.g */, // ㅎ +]); +/** + * Hangul Jamo - Modern Vowels + * + * Range U+1161..U+1175 + * + * | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | + * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| + * | U+116x | | ᅡ | ᅢ | ᅣ | ᅤ | ᅥ | ᅦ | ᅧ | ᅨ | ᅩ | ᅪ | ᅫ | ᅬ | ᅭ | ᅮ | ᅯ | + * | U+117x | ᅰ | ᅱ | ᅲ | ᅳ | ᅴ | ᅵ | + */ +const modernVowels = new Uint16Array([ + 107 /* AsciiCode.k */, // -> ㅏ + 111 /* AsciiCode.o */, // -> ㅐ + 105 /* AsciiCode.i */, // -> ㅑ + 79 /* AsciiCode.O */, // -> ㅒ + 106 /* AsciiCode.j */, // -> ㅓ + 112 /* AsciiCode.p */, // -> ㅔ + 117 /* AsciiCode.u */, // -> ㅕ + 80 /* AsciiCode.P */, // -> ㅖ + 104 /* AsciiCode.h */, // -> ㅗ + 27496 /* AsciiCodeCombo.hk */, // -> ㅘ + 28520 /* AsciiCodeCombo.ho */, // -> ㅙ + 27752 /* AsciiCodeCombo.hl */, // -> ㅚ + 121 /* AsciiCode.y */, // -> ㅛ + 110 /* AsciiCode.n */, // -> ㅜ + 27246 /* AsciiCodeCombo.nj */, // -> ㅝ + 28782 /* AsciiCodeCombo.np */, // -> ㅞ + 27758 /* AsciiCodeCombo.nl */, // -> ㅟ + 98 /* AsciiCode.b */, // -> ㅠ + 109 /* AsciiCode.m */, // -> ㅡ + 27757 /* AsciiCodeCombo.ml */, // -> ㅢ + 108 /* AsciiCode.l */, // -> ㅣ +]); +/** + * Hangul Jamo - Modern Consonants #2 + * + * Range U+11A8..U+11C2 + * + * | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | + * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| + * | U+11Ax | | | | | | | | | ᆨ | ᆩ | ᆪ | ᆫ | ᆬ | ᆭ | ᆮ | ᆯ | + * | U+11Bx | ᆰ | ᆱ | ᆲ | ᆳ | ᆴ | ᆵ | ᆶ | ᆷ | ᆸ | ᆹ | ᆺ | ᆻ | ᆼ | ᆽ | ᆾ | ᆿ | + * | U+11Cx | ᇀ | ᇁ | ᇂ | + */ +const modernFinalConsonants = new Uint16Array([ + 114 /* AsciiCode.r */, // ㄱ + 82 /* AsciiCode.R */, // ㄲ + 29810 /* AsciiCodeCombo.rt */, // ㄳ + 115 /* AsciiCode.s */, // ㄴ + 30579 /* AsciiCodeCombo.sw */, // ㄵ + 26483 /* AsciiCodeCombo.sg */, // ㄶ + 101 /* AsciiCode.e */, // ㄷ + 102 /* AsciiCode.f */, // ㄹ + 29286 /* AsciiCodeCombo.fr */, // ㄺ + 24934 /* AsciiCodeCombo.fa */, // ㄻ + 29030 /* AsciiCodeCombo.fq */, // ㄼ + 29798 /* AsciiCodeCombo.ft */, // ㄽ + 30822 /* AsciiCodeCombo.fx */, // ㄾ + 30310 /* AsciiCodeCombo.fv */, // ㄿ + 26470 /* AsciiCodeCombo.fg */, // ㅀ + 97 /* AsciiCode.a */, // ㅁ + 113 /* AsciiCode.q */, // ㅂ + 29809 /* AsciiCodeCombo.qt */, // ㅄ + 116 /* AsciiCode.t */, // ㅅ + 84 /* AsciiCode.T */, // ㅆ + 100 /* AsciiCode.d */, // ㅇ + 119 /* AsciiCode.w */, // ㅈ + 99 /* AsciiCode.c */, // ㅊ + 122 /* AsciiCode.z */, // ㅋ + 120 /* AsciiCode.x */, // ㅌ + 118 /* AsciiCode.v */, // ㅍ + 103 /* AsciiCode.g */, // ㅎ +]); +/** + * Hangul Compatibility Jamo + * + * Range U+3131..U+318F + * + * This includes range includes archaic jamo which we don't consider, these are + * given the NUL character code in order to be ignored. + * + * | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | + * |--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| + * | U+313x | | ㄱ | ㄲ | ㄳ | ㄴ | ㄵ | ㄶ | ㄷ | ㄸ | ㄹ | ㄺ | ㄻ | ㄼ | ㄽ | ㄾ | ㄿ | + * | U+314x | ㅀ | ㅁ | ㅂ | ㅃ | ㅄ | ㅅ | ㅆ | ㅇ | ㅈ | ㅉ | ㅊ | ㅋ | ㅌ | ㅍ | ㅎ | ㅏ | + * | U+315x | ㅐ | ㅑ | ㅒ | ㅓ | ㅔ | ㅕ | ㅖ | ㅗ | ㅘ | ㅙ | ㅚ | ㅛ | ㅜ | ㅝ | ㅞ | ㅟ | + * | U+316x | ㅠ | ㅡ | ㅢ | ㅣ | HF | ㅥ | ㅦ | ㅧ | ㅨ | ㅩ | ㅪ | ㅫ | ㅬ | ㅭ | ㅮ | ㅯ | + * | U+317x | ㅰ | ㅱ | ㅲ | ㅳ | ㅴ | ㅵ | ㅶ | ㅷ | ㅸ | ㅹ | ㅺ | ㅻ | ㅼ | ㅽ | ㅾ | ㅿ | + * | U+318x | ㆀ | ㆁ | ㆂ | ㆃ | ㆄ | ㆅ | ㆆ | ㆇ | ㆈ | ㆉ | ㆊ | ㆋ | ㆌ | ㆍ | ㆎ | + */ +const compatibilityJamo = new Uint16Array([ + 114 /* AsciiCode.r */, // ㄱ + 82 /* AsciiCode.R */, // ㄲ + 29810 /* AsciiCodeCombo.rt */, // ㄳ + 115 /* AsciiCode.s */, // ㄴ + 30579 /* AsciiCodeCombo.sw */, // ㄵ + 26483 /* AsciiCodeCombo.sg */, // ㄶ + 101 /* AsciiCode.e */, // ㄷ + 69 /* AsciiCode.E */, // ㄸ + 102 /* AsciiCode.f */, // ㄹ + 29286 /* AsciiCodeCombo.fr */, // ㄺ + 24934 /* AsciiCodeCombo.fa */, // ㄻ + 29030 /* AsciiCodeCombo.fq */, // ㄼ + 29798 /* AsciiCodeCombo.ft */, // ㄽ + 30822 /* AsciiCodeCombo.fx */, // ㄾ + 30310 /* AsciiCodeCombo.fv */, // ㄿ + 26470 /* AsciiCodeCombo.fg */, // ㅀ + 97 /* AsciiCode.a */, // ㅁ + 113 /* AsciiCode.q */, // ㅂ + 81 /* AsciiCode.Q */, // ㅃ + 29809 /* AsciiCodeCombo.qt */, // ㅄ + 116 /* AsciiCode.t */, // ㅅ + 84 /* AsciiCode.T */, // ㅆ + 100 /* AsciiCode.d */, // ㅇ + 119 /* AsciiCode.w */, // ㅈ + 87 /* AsciiCode.W */, // ㅉ + 99 /* AsciiCode.c */, // ㅊ + 122 /* AsciiCode.z */, // ㅋ + 120 /* AsciiCode.x */, // ㅌ + 118 /* AsciiCode.v */, // ㅍ + 103 /* AsciiCode.g */, // ㅎ + 107 /* AsciiCode.k */, // ㅏ + 111 /* AsciiCode.o */, // ㅐ + 105 /* AsciiCode.i */, // ㅑ + 79 /* AsciiCode.O */, // ㅒ + 106 /* AsciiCode.j */, // ㅓ + 112 /* AsciiCode.p */, // ㅔ + 117 /* AsciiCode.u */, // ㅕ + 80 /* AsciiCode.P */, // ㅖ + 104 /* AsciiCode.h */, // ㅗ + 27496 /* AsciiCodeCombo.hk */, // ㅘ + 28520 /* AsciiCodeCombo.ho */, // ㅙ + 27752 /* AsciiCodeCombo.hl */, // ㅚ + 121 /* AsciiCode.y */, // ㅛ + 110 /* AsciiCode.n */, // ㅜ + 27246 /* AsciiCodeCombo.nj */, // ㅝ + 28782 /* AsciiCodeCombo.np */, // ㅞ + 27758 /* AsciiCodeCombo.nl */, // ㅟ + 98 /* AsciiCode.b */, // ㅠ + 109 /* AsciiCode.m */, // ㅡ + 27757 /* AsciiCodeCombo.ml */, // ㅢ + 108 /* AsciiCode.l */, // ㅣ + // HF: Hangul Filler (everything after this is archaic) + // ㅥ + // ㅦ + // ㅧ + // ㅨ + // ㅩ + // ㅪ + // ㅫ + // ㅬ + // ㅮ + // ㅯ + // ㅰ + // ㅱ + // ㅲ + // ㅳ + // ㅴ + // ㅵ + // ㅶ + // ㅷ + // ㅸ + // ㅹ + // ㅺ + // ㅻ + // ㅼ + // ㅽ + // ㅾ + // ㅿ + // ㆀ + // ㆁ + // ㆂ + // ㆃ + // ㆄ + // ㆅ + // ㆆ + // ㆇ + // ㆈ + // ㆉ + // ㆊ + // ㆋ + // ㆌ + // ㆍ + // ㆎ +]); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/navigator.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/navigator.js new file mode 100644 index 0000000000000000000000000000000000000000..7018eda9b17ccfeb2e76f93ec3ea7d32be72f17f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/navigator.js @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class ArrayNavigator { + constructor(items, start = 0, end = items.length, index = start - 1) { + this.items = items; + this.start = start; + this.end = end; + this.index = index; + } + current() { + if (this.index === this.start - 1 || this.index === this.end) { + return null; + } + return this.items[this.index]; + } + next() { + this.index = Math.min(this.index + 1, this.end); + return this.current(); + } + previous() { + this.index = Math.max(this.index - 1, this.start - 1); + return this.current(); + } + first() { + this.index = this.start; + return this.current(); + } + last() { + this.index = this.end - 1; + return this.current(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/network.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/network.js new file mode 100644 index 0000000000000000000000000000000000000000..524046b86426583e22538010e64c3c9d4d196d80 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/network.js @@ -0,0 +1,277 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as errors from './errors.js'; +import * as platform from './platform.js'; +import { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js'; +import { URI } from './uri.js'; +import * as paths from './path.js'; +export var Schemas; +(function (Schemas) { + /** + * A schema that is used for models that exist in memory + * only and that have no correspondence on a server or such. + */ + Schemas.inMemory = 'inmemory'; + /** + * A schema that is used for setting files + */ + Schemas.vscode = 'vscode'; + /** + * A schema that is used for internal private files + */ + Schemas.internal = 'private'; + /** + * A walk-through document. + */ + Schemas.walkThrough = 'walkThrough'; + /** + * An embedded code snippet. + */ + Schemas.walkThroughSnippet = 'walkThroughSnippet'; + Schemas.http = 'http'; + Schemas.https = 'https'; + Schemas.file = 'file'; + Schemas.mailto = 'mailto'; + Schemas.untitled = 'untitled'; + Schemas.data = 'data'; + Schemas.command = 'command'; + Schemas.vscodeRemote = 'vscode-remote'; + Schemas.vscodeRemoteResource = 'vscode-remote-resource'; + Schemas.vscodeManagedRemoteResource = 'vscode-managed-remote-resource'; + Schemas.vscodeUserData = 'vscode-userdata'; + Schemas.vscodeCustomEditor = 'vscode-custom-editor'; + Schemas.vscodeNotebookCell = 'vscode-notebook-cell'; + Schemas.vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata'; + Schemas.vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff'; + Schemas.vscodeNotebookCellOutput = 'vscode-notebook-cell-output'; + Schemas.vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff'; + Schemas.vscodeNotebookMetadata = 'vscode-notebook-metadata'; + Schemas.vscodeInteractiveInput = 'vscode-interactive-input'; + Schemas.vscodeSettings = 'vscode-settings'; + Schemas.vscodeWorkspaceTrust = 'vscode-workspace-trust'; + Schemas.vscodeTerminal = 'vscode-terminal'; + /** Scheme used for code blocks in chat. */ + Schemas.vscodeChatCodeBlock = 'vscode-chat-code-block'; + /** Scheme used for LHS of code compare (aka diff) blocks in chat. */ + Schemas.vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block'; + /** Scheme used for the chat input editor. */ + Schemas.vscodeChatSesssion = 'vscode-chat-editor'; + /** + * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors) + */ + Schemas.webviewPanel = 'webview-panel'; + /** + * Scheme used for loading the wrapper html and script in webviews. + */ + Schemas.vscodeWebview = 'vscode-webview'; + /** + * Scheme used for extension pages + */ + Schemas.extension = 'extension'; + /** + * Scheme used as a replacement of `file` scheme to load + * files with our custom protocol handler (desktop only). + */ + Schemas.vscodeFileResource = 'vscode-file'; + /** + * Scheme used for temporary resources + */ + Schemas.tmp = 'tmp'; + /** + * Scheme used vs live share + */ + Schemas.vsls = 'vsls'; + /** + * Scheme used for the Source Control commit input's text document + */ + Schemas.vscodeSourceControl = 'vscode-scm'; + /** + * Scheme used for input box for creating comments. + */ + Schemas.commentsInput = 'comment'; + /** + * Scheme used for special rendering of settings in the release notes + */ + Schemas.codeSetting = 'code-setting'; + /** + * Scheme used for output panel resources + */ + Schemas.outputChannel = 'output'; +})(Schemas || (Schemas = {})); +export function matchesScheme(target, scheme) { + if (URI.isUri(target)) { + return equalsIgnoreCase(target.scheme, scheme); + } + else { + return startsWithIgnoreCase(target, scheme + ':'); + } +} +export function matchesSomeScheme(target, ...schemes) { + return schemes.some(scheme => matchesScheme(target, scheme)); +} +export const connectionTokenQueryName = 'tkn'; +class RemoteAuthoritiesImpl { + constructor() { + this._hosts = Object.create(null); + this._ports = Object.create(null); + this._connectionTokens = Object.create(null); + this._preferredWebSchema = 'http'; + this._delegate = null; + this._serverRootPath = '/'; + } + setPreferredWebSchema(schema) { + this._preferredWebSchema = schema; + } + get _remoteResourcesPath() { + return paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource); + } + rewrite(uri) { + if (this._delegate) { + try { + return this._delegate(uri); + } + catch (err) { + errors.onUnexpectedError(err); + return uri; + } + } + const authority = uri.authority; + let host = this._hosts[authority]; + if (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) { + host = `[${host}]`; + } + const port = this._ports[authority]; + const connectionToken = this._connectionTokens[authority]; + let query = `path=${encodeURIComponent(uri.path)}`; + if (typeof connectionToken === 'string') { + query += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`; + } + return URI.from({ + scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource, + authority: `${host}:${port}`, + path: this._remoteResourcesPath, + query + }); + } +} +export const RemoteAuthorities = new RemoteAuthoritiesImpl(); +export const VSCODE_AUTHORITY = 'vscode-app'; +class FileAccessImpl { + static { this.FALLBACK_AUTHORITY = VSCODE_AUTHORITY; } + /** + * Returns a URI to use in contexts where the browser is responsible + * for loading (e.g. fetch()) or when used within the DOM. + * + * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context. + */ + asBrowserUri(resourcePath) { + // ESM-comment-begin + // const uri = this.toUri(resourcePath, require); + // ESM-comment-end + // ESM-uncomment-begin + const uri = this.toUri(resourcePath); + // ESM-uncomment-end + return this.uriToBrowserUri(uri); + } + /** + * Returns a URI to use in contexts where the browser is responsible + * for loading (e.g. fetch()) or when used within the DOM. + * + * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context. + */ + uriToBrowserUri(uri) { + // Handle remote URIs via `RemoteAuthorities` + if (uri.scheme === Schemas.vscodeRemote) { + return RemoteAuthorities.rewrite(uri); + } + // Convert to `vscode-file` resource.. + if ( + // ...only ever for `file` resources + uri.scheme === Schemas.file && + ( + // ...and we run in native environments + platform.isNative || + // ...or web worker extensions on desktop + (platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`))) { + return uri.with({ + scheme: Schemas.vscodeFileResource, + // We need to provide an authority here so that it can serve + // as origin for network and loading matters in chromium. + // If the URI is not coming with an authority already, we + // add our own + authority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY, + query: null, + fragment: null + }); + } + return uri; + } + toUri(uriOrModule, moduleIdToUrl) { + if (URI.isUri(uriOrModule)) { + return uriOrModule; + } + if (globalThis._VSCODE_FILE_ROOT) { + const rootUriOrPath = globalThis._VSCODE_FILE_ROOT; + // File URL (with scheme) + if (/^\w[\w\d+.-]*:\/\//.test(rootUriOrPath)) { + return URI.joinPath(URI.parse(rootUriOrPath, true), uriOrModule); + } + // File Path (no scheme) + const modulePath = paths.join(rootUriOrPath, uriOrModule); + return URI.file(modulePath); + } + return URI.parse(moduleIdToUrl.toUrl(uriOrModule)); + } +} +export const FileAccess = new FileAccessImpl(); +export var COI; +(function (COI) { + const coiHeaders = new Map([ + ['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }], + ['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }], + ['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }], + ]); + COI.CoopAndCoep = Object.freeze(coiHeaders.get('3')); + const coiSearchParamName = 'vscode-coi'; + /** + * Extract desired headers from `vscode-coi` invocation + */ + function getHeadersFromQuery(url) { + let params; + if (typeof url === 'string') { + params = new URL(url).searchParams; + } + else if (url instanceof URL) { + params = url.searchParams; + } + else if (URI.isUri(url)) { + params = new URL(url.toString(true)).searchParams; + } + const value = params?.get(coiSearchParamName); + if (!value) { + return undefined; + } + return coiHeaders.get(value); + } + COI.getHeadersFromQuery = getHeadersFromQuery; + /** + * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated` + * isn't enabled the current context + */ + function addSearchParam(urlOrSearch, coop, coep) { + if (!globalThis.crossOriginIsolated) { + // depends on the current context being COI + return; + } + const value = coop && coep ? '3' : coep ? '2' : '1'; + if (urlOrSearch instanceof URLSearchParams) { + urlOrSearch.set(coiSearchParamName, value); + } + else { + urlOrSearch[coiSearchParamName] = value; + } + } + COI.addSearchParam = addSearchParam; +})(COI || (COI = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/numbers.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/numbers.js new file mode 100644 index 0000000000000000000000000000000000000000..cf974661953d1b25e84e05482b6cefb48c40fac5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/numbers.js @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export function clamp(value, min, max) { + return Math.min(Math.max(value, min), max); +} +export class MovingAverage { + constructor() { + this._n = 1; + this._val = 0; + } + update(value) { + this._val = this._val + (value - this._val) / this._n; + this._n += 1; + return this._val; + } + get value() { + return this._val; + } +} +export class SlidingWindowAverage { + constructor(size) { + this._n = 0; + this._val = 0; + this._values = []; + this._index = 0; + this._sum = 0; + this._values = new Array(size); + this._values.fill(0, 0, size); + } + update(value) { + const oldValue = this._values[this._index]; + this._values[this._index] = value; + this._index = (this._index + 1) % this._values.length; + this._sum -= oldValue; + this._sum += value; + if (this._n < this._values.length) { + this._n += 1; + } + this._val = this._sum / this._n; + return this._val; + } + get value() { + return this._val; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/objects.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/objects.js new file mode 100644 index 0000000000000000000000000000000000000000..c08589356aef66f115c98231a5a26102cd0a2254 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/objects.js @@ -0,0 +1,179 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { isTypedArray, isObject, isUndefinedOrNull } from './types.js'; +export function deepClone(obj) { + if (!obj || typeof obj !== 'object') { + return obj; + } + if (obj instanceof RegExp) { + return obj; + } + const result = Array.isArray(obj) ? [] : {}; + Object.entries(obj).forEach(([key, value]) => { + result[key] = value && typeof value === 'object' ? deepClone(value) : value; + }); + return result; +} +export function deepFreeze(obj) { + if (!obj || typeof obj !== 'object') { + return obj; + } + const stack = [obj]; + while (stack.length > 0) { + const obj = stack.shift(); + Object.freeze(obj); + for (const key in obj) { + if (_hasOwnProperty.call(obj, key)) { + const prop = obj[key]; + if (typeof prop === 'object' && !Object.isFrozen(prop) && !isTypedArray(prop)) { + stack.push(prop); + } + } + } + } + return obj; +} +const _hasOwnProperty = Object.prototype.hasOwnProperty; +export function cloneAndChange(obj, changer) { + return _cloneAndChange(obj, changer, new Set()); +} +function _cloneAndChange(obj, changer, seen) { + if (isUndefinedOrNull(obj)) { + return obj; + } + const changed = changer(obj); + if (typeof changed !== 'undefined') { + return changed; + } + if (Array.isArray(obj)) { + const r1 = []; + for (const e of obj) { + r1.push(_cloneAndChange(e, changer, seen)); + } + return r1; + } + if (isObject(obj)) { + if (seen.has(obj)) { + throw new Error('Cannot clone recursive data-structure'); + } + seen.add(obj); + const r2 = {}; + for (const i2 in obj) { + if (_hasOwnProperty.call(obj, i2)) { + r2[i2] = _cloneAndChange(obj[i2], changer, seen); + } + } + seen.delete(obj); + return r2; + } + return obj; +} +/** + * Copies all properties of source into destination. The optional parameter "overwrite" allows to control + * if existing properties on the destination should be overwritten or not. Defaults to true (overwrite). + */ +export function mixin(destination, source, overwrite = true) { + if (!isObject(destination)) { + return source; + } + if (isObject(source)) { + Object.keys(source).forEach(key => { + if (key in destination) { + if (overwrite) { + if (isObject(destination[key]) && isObject(source[key])) { + mixin(destination[key], source[key], overwrite); + } + else { + destination[key] = source[key]; + } + } + } + else { + destination[key] = source[key]; + } + }); + } + return destination; +} +export function equals(one, other) { + if (one === other) { + return true; + } + if (one === null || one === undefined || other === null || other === undefined) { + return false; + } + if (typeof one !== typeof other) { + return false; + } + if (typeof one !== 'object') { + return false; + } + if ((Array.isArray(one)) !== (Array.isArray(other))) { + return false; + } + let i; + let key; + if (Array.isArray(one)) { + if (one.length !== other.length) { + return false; + } + for (i = 0; i < one.length; i++) { + if (!equals(one[i], other[i])) { + return false; + } + } + } + else { + const oneKeys = []; + for (key in one) { + oneKeys.push(key); + } + oneKeys.sort(); + const otherKeys = []; + for (key in other) { + otherKeys.push(key); + } + otherKeys.sort(); + if (!equals(oneKeys, otherKeys)) { + return false; + } + for (i = 0; i < oneKeys.length; i++) { + if (!equals(one[oneKeys[i]], other[oneKeys[i]])) { + return false; + } + } + } + return true; +} +export function getAllPropertyNames(obj) { + let res = []; + while (Object.prototype !== obj) { + res = res.concat(Object.getOwnPropertyNames(obj)); + obj = Object.getPrototypeOf(obj); + } + return res; +} +export function getAllMethodNames(obj) { + const methods = []; + for (const prop of getAllPropertyNames(obj)) { + if (typeof obj[prop] === 'function') { + methods.push(prop); + } + } + return methods; +} +export function createProxyObject(methodNames, invoke) { + const createProxyMethod = (method) => { + return function () { + const args = Array.prototype.slice.call(arguments, 0); + return invoke(method, args); + }; + }; + const result = {}; + for (const methodName of methodNames) { + result[methodName] = createProxyMethod(methodName); + } + return result; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observable.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observable.js new file mode 100644 index 0000000000000000000000000000000000000000..e6728a76e7756b42b2859c489efe9fe5fa698413 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observable.js @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export { observableValue, disposableObservableValue, transaction, subtransaction } from './observableInternal/base.js'; +export { derived, derivedOpts, derivedHandleChanges, derivedWithStore } from './observableInternal/derived.js'; +export { autorun, autorunHandleChanges, autorunWithStore, autorunOpts, autorunWithStoreHandleChanges } from './observableInternal/autorun.js'; +export { constObservable, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, recomputeInitiallyAndOnChange, observableFromEvent, observableSignal, observableSignalFromEvent } from './observableInternal/utils.js'; +export { ObservablePromise, PromiseResult, waitForState } from './observableInternal/promise.js'; +export { observableValueOpts } from './observableInternal/api.js'; +import { ConsoleObservableLogger, setLogger } from './observableInternal/logging.js'; +// Remove "//" in the next line to enable logging +const enableLogging = false; +if (enableLogging) { + setLogger(new ConsoleObservableLogger()); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/api.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/api.js new file mode 100644 index 0000000000000000000000000000000000000000..50b5242ac141589836469f7aec7a01065535519d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/api.js @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { strictEquals } from '../equals.js'; +import { ObservableValue } from './base.js'; +import { DebugNameData } from './debugName.js'; +import { LazyObservableValue } from './lazyObservableValue.js'; +export function observableValueOpts(options, initialValue) { + if (options.lazy) { + return new LazyObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals); + } + return new ObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/autorun.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/autorun.js new file mode 100644 index 0000000000000000000000000000000000000000..bc6d3a0b5f5451f78a7bc549b7670bdd36c25ba4 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/autorun.js @@ -0,0 +1,192 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { assertFn } from '../assert.js'; +import { DisposableStore, markAsDisposed, toDisposable, trackDisposable } from '../lifecycle.js'; +import { DebugNameData } from './debugName.js'; +import { getLogger } from './logging.js'; +/** + * Runs immediately and whenever a transaction ends and an observed observable changed. + * {@link fn} should start with a JS Doc using `@description` to name the autorun. + */ +export function autorun(fn) { + return new AutorunObserver(new DebugNameData(undefined, undefined, fn), fn, undefined, undefined); +} +/** + * Runs immediately and whenever a transaction ends and an observed observable changed. + * {@link fn} should start with a JS Doc using `@description` to name the autorun. + */ +export function autorunOpts(options, fn) { + return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, undefined, undefined); +} +/** + * Runs immediately and whenever a transaction ends and an observed observable changed. + * {@link fn} should start with a JS Doc using `@description` to name the autorun. + * + * Use `createEmptyChangeSummary` to create a "change summary" that can collect the changes. + * Use `handleChange` to add a reported change to the change summary. + * The run function is given the last change summary. + * The change summary is discarded after the run function was called. + * + * @see autorun + */ +export function autorunHandleChanges(options, fn) { + return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, options.createEmptyChangeSummary, options.handleChange); +} +/** + * @see autorunHandleChanges (but with a disposable store that is cleared before the next run or on dispose) + */ +export function autorunWithStoreHandleChanges(options, fn) { + const store = new DisposableStore(); + const disposable = autorunHandleChanges({ + owner: options.owner, + debugName: options.debugName, + debugReferenceFn: options.debugReferenceFn ?? fn, + createEmptyChangeSummary: options.createEmptyChangeSummary, + handleChange: options.handleChange, + }, (reader, changeSummary) => { + store.clear(); + fn(reader, changeSummary, store); + }); + return toDisposable(() => { + disposable.dispose(); + store.dispose(); + }); +} +/** + * @see autorun (but with a disposable store that is cleared before the next run or on dispose) + */ +export function autorunWithStore(fn) { + const store = new DisposableStore(); + const disposable = autorunOpts({ + owner: undefined, + debugName: undefined, + debugReferenceFn: fn, + }, reader => { + store.clear(); + fn(reader, store); + }); + return toDisposable(() => { + disposable.dispose(); + store.dispose(); + }); +} +export class AutorunObserver { + get debugName() { + return this._debugNameData.getDebugName(this) ?? '(anonymous)'; + } + constructor(_debugNameData, _runFn, createChangeSummary, _handleChange) { + this._debugNameData = _debugNameData; + this._runFn = _runFn; + this.createChangeSummary = createChangeSummary; + this._handleChange = _handleChange; + this.state = 2 /* AutorunState.stale */; + this.updateCount = 0; + this.disposed = false; + this.dependencies = new Set(); + this.dependenciesToBeRemoved = new Set(); + this.changeSummary = this.createChangeSummary?.(); + getLogger()?.handleAutorunCreated(this); + this._runIfNeeded(); + trackDisposable(this); + } + dispose() { + this.disposed = true; + for (const o of this.dependencies) { + o.removeObserver(this); + } + this.dependencies.clear(); + markAsDisposed(this); + } + _runIfNeeded() { + if (this.state === 3 /* AutorunState.upToDate */) { + return; + } + const emptySet = this.dependenciesToBeRemoved; + this.dependenciesToBeRemoved = this.dependencies; + this.dependencies = emptySet; + this.state = 3 /* AutorunState.upToDate */; + const isDisposed = this.disposed; + try { + if (!isDisposed) { + getLogger()?.handleAutorunTriggered(this); + const changeSummary = this.changeSummary; + this.changeSummary = this.createChangeSummary?.(); + this._runFn(this, changeSummary); + } + } + finally { + if (!isDisposed) { + getLogger()?.handleAutorunFinished(this); + } + // We don't want our observed observables to think that they are (not even temporarily) not being observed. + // Thus, we only unsubscribe from observables that are definitely not read anymore. + for (const o of this.dependenciesToBeRemoved) { + o.removeObserver(this); + } + this.dependenciesToBeRemoved.clear(); + } + } + toString() { + return `Autorun<${this.debugName}>`; + } + // IObserver implementation + beginUpdate() { + if (this.state === 3 /* AutorunState.upToDate */) { + this.state = 1 /* AutorunState.dependenciesMightHaveChanged */; + } + this.updateCount++; + } + endUpdate() { + if (this.updateCount === 1) { + do { + if (this.state === 1 /* AutorunState.dependenciesMightHaveChanged */) { + this.state = 3 /* AutorunState.upToDate */; + for (const d of this.dependencies) { + d.reportChanges(); + if (this.state === 2 /* AutorunState.stale */) { + // The other dependencies will refresh on demand + break; + } + } + } + this._runIfNeeded(); + } while (this.state !== 3 /* AutorunState.upToDate */); + } + this.updateCount--; + assertFn(() => this.updateCount >= 0); + } + handlePossibleChange(observable) { + if (this.state === 3 /* AutorunState.upToDate */ && this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) { + this.state = 1 /* AutorunState.dependenciesMightHaveChanged */; + } + } + handleChange(observable, change) { + if (this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) { + const shouldReact = this._handleChange ? this._handleChange({ + changedObservable: observable, + change, + didChange: (o) => o === observable, + }, this.changeSummary) : true; + if (shouldReact) { + this.state = 2 /* AutorunState.stale */; + } + } + } + // IReader implementation + readObservable(observable) { + // In case the run action disposes the autorun + if (this.disposed) { + return observable.get(); + } + observable.addObserver(this); + const value = observable.get(); + this.dependencies.add(observable); + this.dependenciesToBeRemoved.delete(observable); + return value; + } +} +(function (autorun) { + autorun.Observer = AutorunObserver; +})(autorun || (autorun = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/base.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/base.js new file mode 100644 index 0000000000000000000000000000000000000000..47784e900438abb9072e925049812a10540047c0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/base.js @@ -0,0 +1,268 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { strictEquals } from '../equals.js'; +import { DebugNameData, getFunctionName } from './debugName.js'; +import { getLogger } from './logging.js'; +let _recomputeInitiallyAndOnChange; +export function _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) { + _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange; +} +let _keepObserved; +export function _setKeepObserved(keepObserved) { + _keepObserved = keepObserved; +} +let _derived; +/** + * @internal + * This is to allow splitting files. +*/ +export function _setDerivedOpts(derived) { + _derived = derived; +} +export class ConvenientObservable { + get TChange() { return null; } + reportChanges() { + this.get(); + } + /** @sealed */ + read(reader) { + if (reader) { + return reader.readObservable(this); + } + else { + return this.get(); + } + } + map(fnOrOwner, fnOrUndefined) { + const owner = fnOrUndefined === undefined ? undefined : fnOrOwner; + const fn = fnOrUndefined === undefined ? fnOrOwner : fnOrUndefined; + return _derived({ + owner, + debugName: () => { + const name = getFunctionName(fn); + if (name !== undefined) { + return name; + } + // regexp to match `x => x.y` or `x => x?.y` where x and y can be arbitrary identifiers (uses backref): + const regexp = /^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/; + const match = regexp.exec(fn.toString()); + if (match) { + return `${this.debugName}.${match[2]}`; + } + if (!owner) { + return `${this.debugName} (mapped)`; + } + return undefined; + }, + debugReferenceFn: fn, + }, (reader) => fn(this.read(reader), reader)); + } + /** + * @sealed + * Converts an observable of an observable value into a direct observable of the value. + */ + flatten() { + return _derived({ + owner: undefined, + debugName: () => `${this.debugName} (flattened)`, + }, (reader) => this.read(reader).read(reader)); + } + recomputeInitiallyAndOnChange(store, handleValue) { + store.add(_recomputeInitiallyAndOnChange(this, handleValue)); + return this; + } + /** + * Ensures that this observable is observed. This keeps the cache alive. + * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get). + * Use `recomputeInitiallyAndOnChange` for eager evaluation. + */ + keepObserved(store) { + store.add(_keepObserved(this)); + return this; + } +} +export class BaseObservable extends ConvenientObservable { + constructor() { + super(...arguments); + this.observers = new Set(); + } + addObserver(observer) { + const len = this.observers.size; + this.observers.add(observer); + if (len === 0) { + this.onFirstObserverAdded(); + } + } + removeObserver(observer) { + const deleted = this.observers.delete(observer); + if (deleted && this.observers.size === 0) { + this.onLastObserverRemoved(); + } + } + onFirstObserverAdded() { } + onLastObserverRemoved() { } +} +/** + * Starts a transaction in which many observables can be changed at once. + * {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name. + * Reaction run on demand or when the transaction ends. + */ +export function transaction(fn, getDebugName) { + const tx = new TransactionImpl(fn, getDebugName); + try { + fn(tx); + } + finally { + tx.finish(); + } +} +let _globalTransaction = undefined; +export function globalTransaction(fn) { + if (_globalTransaction) { + fn(_globalTransaction); + } + else { + const tx = new TransactionImpl(fn, undefined); + _globalTransaction = tx; + try { + fn(tx); + } + finally { + tx.finish(); // During finish, more actions might be added to the transaction. + // Which is why we only clear the global transaction after finish. + _globalTransaction = undefined; + } + } +} +export async function asyncTransaction(fn, getDebugName) { + const tx = new TransactionImpl(fn, getDebugName); + try { + await fn(tx); + } + finally { + tx.finish(); + } +} +/** + * Allows to chain transactions. + */ +export function subtransaction(tx, fn, getDebugName) { + if (!tx) { + transaction(fn, getDebugName); + } + else { + fn(tx); + } +} +export class TransactionImpl { + constructor(_fn, _getDebugName) { + this._fn = _fn; + this._getDebugName = _getDebugName; + this.updatingObservers = []; + getLogger()?.handleBeginTransaction(this); + } + getDebugName() { + if (this._getDebugName) { + return this._getDebugName(); + } + return getFunctionName(this._fn); + } + updateObserver(observer, observable) { + // When this gets called while finish is active, they will still get considered + this.updatingObservers.push({ observer, observable }); + observer.beginUpdate(observable); + } + finish() { + const updatingObservers = this.updatingObservers; + for (let i = 0; i < updatingObservers.length; i++) { + const { observer, observable } = updatingObservers[i]; + observer.endUpdate(observable); + } + // Prevent anyone from updating observers from now on. + this.updatingObservers = null; + getLogger()?.handleEndTransaction(); + } +} +export function observableValue(nameOrOwner, initialValue) { + let debugNameData; + if (typeof nameOrOwner === 'string') { + debugNameData = new DebugNameData(undefined, nameOrOwner, undefined); + } + else { + debugNameData = new DebugNameData(nameOrOwner, undefined, undefined); + } + return new ObservableValue(debugNameData, initialValue, strictEquals); +} +export class ObservableValue extends BaseObservable { + get debugName() { + return this._debugNameData.getDebugName(this) ?? 'ObservableValue'; + } + constructor(_debugNameData, initialValue, _equalityComparator) { + super(); + this._debugNameData = _debugNameData; + this._equalityComparator = _equalityComparator; + this._value = initialValue; + } + get() { + return this._value; + } + set(value, tx, change) { + if (change === undefined && this._equalityComparator(this._value, value)) { + return; + } + let _tx; + if (!tx) { + tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`); + } + try { + const oldValue = this._value; + this._setValue(value); + getLogger()?.handleObservableChanged(this, { oldValue, newValue: value, change, didChange: true, hadValue: true }); + for (const observer of this.observers) { + tx.updateObserver(observer, this); + observer.handleChange(this, change); + } + } + finally { + if (_tx) { + _tx.finish(); + } + } + } + toString() { + return `${this.debugName}: ${this._value}`; + } + _setValue(newValue) { + this._value = newValue; + } +} +/** + * A disposable observable. When disposed, its value is also disposed. + * When a new value is set, the previous value is disposed. + */ +export function disposableObservableValue(nameOrOwner, initialValue) { + let debugNameData; + if (typeof nameOrOwner === 'string') { + debugNameData = new DebugNameData(undefined, nameOrOwner, undefined); + } + else { + debugNameData = new DebugNameData(nameOrOwner, undefined, undefined); + } + return new DisposableObservableValue(debugNameData, initialValue, strictEquals); +} +export class DisposableObservableValue extends ObservableValue { + _setValue(newValue) { + if (this._value === newValue) { + return; + } + if (this._value) { + this._value.dispose(); + } + this._value = newValue; + } + dispose() { + this._value?.dispose(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/debugName.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/debugName.js new file mode 100644 index 0000000000000000000000000000000000000000..480444fb6d4d7a823ca1e400e0036ef8f751ba79 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/debugName.js @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export class DebugNameData { + constructor(owner, debugNameSource, referenceFn) { + this.owner = owner; + this.debugNameSource = debugNameSource; + this.referenceFn = referenceFn; + } + getDebugName(target) { + return getDebugName(target, this); + } +} +const countPerName = new Map(); +const cachedDebugName = new WeakMap(); +export function getDebugName(target, data) { + const cached = cachedDebugName.get(target); + if (cached) { + return cached; + } + const dbgName = computeDebugName(target, data); + if (dbgName) { + let count = countPerName.get(dbgName) ?? 0; + count++; + countPerName.set(dbgName, count); + const result = count === 1 ? dbgName : `${dbgName}#${count}`; + cachedDebugName.set(target, result); + return result; + } + return undefined; +} +function computeDebugName(self, data) { + const cached = cachedDebugName.get(self); + if (cached) { + return cached; + } + const ownerStr = data.owner ? formatOwner(data.owner) + `.` : ''; + let result; + const debugNameSource = data.debugNameSource; + if (debugNameSource !== undefined) { + if (typeof debugNameSource === 'function') { + result = debugNameSource(); + if (result !== undefined) { + return ownerStr + result; + } + } + else { + return ownerStr + debugNameSource; + } + } + const referenceFn = data.referenceFn; + if (referenceFn !== undefined) { + result = getFunctionName(referenceFn); + if (result !== undefined) { + return ownerStr + result; + } + } + if (data.owner !== undefined) { + const key = findKey(data.owner, self); + if (key !== undefined) { + return ownerStr + key; + } + } + return undefined; +} +function findKey(obj, value) { + for (const key in obj) { + if (obj[key] === value) { + return key; + } + } + return undefined; +} +const countPerClassName = new Map(); +const ownerId = new WeakMap(); +function formatOwner(owner) { + const id = ownerId.get(owner); + if (id) { + return id; + } + const className = getClassName(owner); + let count = countPerClassName.get(className) ?? 0; + count++; + countPerClassName.set(className, count); + const result = count === 1 ? className : `${className}#${count}`; + ownerId.set(owner, result); + return result; +} +function getClassName(obj) { + const ctor = obj.constructor; + if (ctor) { + return ctor.name; + } + return 'Object'; +} +export function getFunctionName(fn) { + const fnSrc = fn.toString(); + // Pattern: /** @description ... */ + const regexp = /\/\*\*\s*@description\s*([^*]*)\*\//; + const match = regexp.exec(fnSrc); + const result = match ? match[1] : undefined; + return result?.trim(); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/derived.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/derived.js new file mode 100644 index 0000000000000000000000000000000000000000..f8315012f0860d23d7aa4e9afb653848f25bdd9c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/derived.js @@ -0,0 +1,286 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { assertFn } from '../assert.js'; +import { strictEquals } from '../equals.js'; +import { DisposableStore } from '../lifecycle.js'; +import { BaseObservable, _setDerivedOpts } from './base.js'; +import { DebugNameData } from './debugName.js'; +import { getLogger } from './logging.js'; +export function derived(computeFnOrOwner, computeFn) { + if (computeFn !== undefined) { + return new Derived(new DebugNameData(computeFnOrOwner, undefined, computeFn), computeFn, undefined, undefined, undefined, strictEquals); + } + return new Derived(new DebugNameData(undefined, undefined, computeFnOrOwner), computeFnOrOwner, undefined, undefined, undefined, strictEquals); +} +export function derivedWithSetter(owner, computeFn, setter) { + return new DerivedWithSetter(new DebugNameData(owner, undefined, computeFn), computeFn, undefined, undefined, undefined, strictEquals, setter); +} +export function derivedOpts(options, computeFn) { + return new Derived(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn), computeFn, undefined, undefined, options.onLastObserverRemoved, options.equalsFn ?? strictEquals); +} +_setDerivedOpts(derivedOpts); +/** + * Represents an observable that is derived from other observables. + * The value is only recomputed when absolutely needed. + * + * {@link computeFn} should start with a JS Doc using `@description` to name the derived. + * + * Use `createEmptyChangeSummary` to create a "change summary" that can collect the changes. + * Use `handleChange` to add a reported change to the change summary. + * The compute function is given the last change summary. + * The change summary is discarded after the compute function was called. + * + * @see derived + */ +export function derivedHandleChanges(options, computeFn) { + return new Derived(new DebugNameData(options.owner, options.debugName, undefined), computeFn, options.createEmptyChangeSummary, options.handleChange, undefined, options.equalityComparer ?? strictEquals); +} +export function derivedWithStore(computeFnOrOwner, computeFnOrUndefined) { + let computeFn; + let owner; + if (computeFnOrUndefined === undefined) { + computeFn = computeFnOrOwner; + owner = undefined; + } + else { + owner = computeFnOrOwner; + computeFn = computeFnOrUndefined; + } + const store = new DisposableStore(); + return new Derived(new DebugNameData(owner, undefined, computeFn), r => { + store.clear(); + return computeFn(r, store); + }, undefined, undefined, () => store.dispose(), strictEquals); +} +export function derivedDisposable(computeFnOrOwner, computeFnOrUndefined) { + let computeFn; + let owner; + if (computeFnOrUndefined === undefined) { + computeFn = computeFnOrOwner; + owner = undefined; + } + else { + owner = computeFnOrOwner; + computeFn = computeFnOrUndefined; + } + let store = undefined; + return new Derived(new DebugNameData(owner, undefined, computeFn), r => { + if (!store) { + store = new DisposableStore(); + } + else { + store.clear(); + } + const result = computeFn(r); + if (result) { + store.add(result); + } + return result; + }, undefined, undefined, () => { + if (store) { + store.dispose(); + store = undefined; + } + }, strictEquals); +} +export class Derived extends BaseObservable { + get debugName() { + return this._debugNameData.getDebugName(this) ?? '(anonymous)'; + } + constructor(_debugNameData, _computeFn, createChangeSummary, _handleChange, _handleLastObserverRemoved = undefined, _equalityComparator) { + super(); + this._debugNameData = _debugNameData; + this._computeFn = _computeFn; + this.createChangeSummary = createChangeSummary; + this._handleChange = _handleChange; + this._handleLastObserverRemoved = _handleLastObserverRemoved; + this._equalityComparator = _equalityComparator; + this.state = 0 /* DerivedState.initial */; + this.value = undefined; + this.updateCount = 0; + this.dependencies = new Set(); + this.dependenciesToBeRemoved = new Set(); + this.changeSummary = undefined; + this.changeSummary = this.createChangeSummary?.(); + getLogger()?.handleDerivedCreated(this); + } + onLastObserverRemoved() { + /** + * We are not tracking changes anymore, thus we have to assume + * that our cache is invalid. + */ + this.state = 0 /* DerivedState.initial */; + this.value = undefined; + for (const d of this.dependencies) { + d.removeObserver(this); + } + this.dependencies.clear(); + this._handleLastObserverRemoved?.(); + } + get() { + if (this.observers.size === 0) { + // Without observers, we don't know when to clean up stuff. + // Thus, we don't cache anything to prevent memory leaks. + const result = this._computeFn(this, this.createChangeSummary?.()); + // Clear new dependencies + this.onLastObserverRemoved(); + return result; + } + else { + do { + // We might not get a notification for a dependency that changed while it is updating, + // thus we also have to ask all our depedencies if they changed in this case. + if (this.state === 1 /* DerivedState.dependenciesMightHaveChanged */) { + for (const d of this.dependencies) { + /** might call {@link handleChange} indirectly, which could make us stale */ + d.reportChanges(); + if (this.state === 2 /* DerivedState.stale */) { + // The other dependencies will refresh on demand, so early break + break; + } + } + } + // We called report changes of all dependencies. + // If we are still not stale, we can assume to be up to date again. + if (this.state === 1 /* DerivedState.dependenciesMightHaveChanged */) { + this.state = 3 /* DerivedState.upToDate */; + } + this._recomputeIfNeeded(); + // In case recomputation changed one of our dependencies, we need to recompute again. + } while (this.state !== 3 /* DerivedState.upToDate */); + return this.value; + } + } + _recomputeIfNeeded() { + if (this.state === 3 /* DerivedState.upToDate */) { + return; + } + const emptySet = this.dependenciesToBeRemoved; + this.dependenciesToBeRemoved = this.dependencies; + this.dependencies = emptySet; + const hadValue = this.state !== 0 /* DerivedState.initial */; + const oldValue = this.value; + this.state = 3 /* DerivedState.upToDate */; + const changeSummary = this.changeSummary; + this.changeSummary = this.createChangeSummary?.(); + try { + /** might call {@link handleChange} indirectly, which could invalidate us */ + this.value = this._computeFn(this, changeSummary); + } + finally { + // We don't want our observed observables to think that they are (not even temporarily) not being observed. + // Thus, we only unsubscribe from observables that are definitely not read anymore. + for (const o of this.dependenciesToBeRemoved) { + o.removeObserver(this); + } + this.dependenciesToBeRemoved.clear(); + } + const didChange = hadValue && !(this._equalityComparator(oldValue, this.value)); + getLogger()?.handleDerivedRecomputed(this, { + oldValue, + newValue: this.value, + change: undefined, + didChange, + hadValue, + }); + if (didChange) { + for (const r of this.observers) { + r.handleChange(this, undefined); + } + } + } + toString() { + return `LazyDerived<${this.debugName}>`; + } + // IObserver Implementation + beginUpdate(_observable) { + this.updateCount++; + const propagateBeginUpdate = this.updateCount === 1; + if (this.state === 3 /* DerivedState.upToDate */) { + this.state = 1 /* DerivedState.dependenciesMightHaveChanged */; + // If we propagate begin update, that will already signal a possible change. + if (!propagateBeginUpdate) { + for (const r of this.observers) { + r.handlePossibleChange(this); + } + } + } + if (propagateBeginUpdate) { + for (const r of this.observers) { + r.beginUpdate(this); // This signals a possible change + } + } + } + endUpdate(_observable) { + this.updateCount--; + if (this.updateCount === 0) { + // End update could change the observer list. + const observers = [...this.observers]; + for (const r of observers) { + r.endUpdate(this); + } + } + assertFn(() => this.updateCount >= 0); + } + handlePossibleChange(observable) { + // In all other states, observers already know that we might have changed. + if (this.state === 3 /* DerivedState.upToDate */ && this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) { + this.state = 1 /* DerivedState.dependenciesMightHaveChanged */; + for (const r of this.observers) { + r.handlePossibleChange(this); + } + } + } + handleChange(observable, change) { + if (this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) { + const shouldReact = this._handleChange ? this._handleChange({ + changedObservable: observable, + change, + didChange: (o) => o === observable, + }, this.changeSummary) : true; + const wasUpToDate = this.state === 3 /* DerivedState.upToDate */; + if (shouldReact && (this.state === 1 /* DerivedState.dependenciesMightHaveChanged */ || wasUpToDate)) { + this.state = 2 /* DerivedState.stale */; + if (wasUpToDate) { + for (const r of this.observers) { + r.handlePossibleChange(this); + } + } + } + } + } + // IReader Implementation + readObservable(observable) { + // Subscribe before getting the value to enable caching + observable.addObserver(this); + /** This might call {@link handleChange} indirectly, which could invalidate us */ + const value = observable.get(); + // Which is why we only add the observable to the dependencies now. + this.dependencies.add(observable); + this.dependenciesToBeRemoved.delete(observable); + return value; + } + addObserver(observer) { + const shouldCallBeginUpdate = !this.observers.has(observer) && this.updateCount > 0; + super.addObserver(observer); + if (shouldCallBeginUpdate) { + observer.beginUpdate(this); + } + } + removeObserver(observer) { + const shouldCallEndUpdate = this.observers.has(observer) && this.updateCount > 0; + super.removeObserver(observer); + if (shouldCallEndUpdate) { + // Calling end update after removing the observer makes sure endUpdate cannot be called twice here. + observer.endUpdate(this); + } + } +} +export class DerivedWithSetter extends Derived { + constructor(debugNameData, computeFn, createChangeSummary, handleChange, handleLastObserverRemoved = undefined, equalityComparator, set) { + super(debugNameData, computeFn, createChangeSummary, handleChange, handleLastObserverRemoved, equalityComparator); + this.set = set; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/lazyObservableValue.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/lazyObservableValue.js new file mode 100644 index 0000000000000000000000000000000000000000..f19a0b3d18836c13b0e5697abffb17813491429c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/lazyObservableValue.js @@ -0,0 +1,118 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { BaseObservable, TransactionImpl } from './base.js'; +/** + * Holds off updating observers until the value is actually read. +*/ +export class LazyObservableValue extends BaseObservable { + get debugName() { + return this._debugNameData.getDebugName(this) ?? 'LazyObservableValue'; + } + constructor(_debugNameData, initialValue, _equalityComparator) { + super(); + this._debugNameData = _debugNameData; + this._equalityComparator = _equalityComparator; + this._isUpToDate = true; + this._deltas = []; + this._updateCounter = 0; + this._value = initialValue; + } + get() { + this._update(); + return this._value; + } + _update() { + if (this._isUpToDate) { + return; + } + this._isUpToDate = true; + if (this._deltas.length > 0) { + for (const observer of this.observers) { + for (const change of this._deltas) { + observer.handleChange(this, change); + } + } + this._deltas.length = 0; + } + else { + for (const observer of this.observers) { + observer.handleChange(this, undefined); + } + } + } + _beginUpdate() { + this._updateCounter++; + if (this._updateCounter === 1) { + for (const observer of this.observers) { + observer.beginUpdate(this); + } + } + } + _endUpdate() { + this._updateCounter--; + if (this._updateCounter === 0) { + this._update(); + // End update could change the observer list. + const observers = [...this.observers]; + for (const r of observers) { + r.endUpdate(this); + } + } + } + addObserver(observer) { + const shouldCallBeginUpdate = !this.observers.has(observer) && this._updateCounter > 0; + super.addObserver(observer); + if (shouldCallBeginUpdate) { + observer.beginUpdate(this); + } + } + removeObserver(observer) { + const shouldCallEndUpdate = this.observers.has(observer) && this._updateCounter > 0; + super.removeObserver(observer); + if (shouldCallEndUpdate) { + // Calling end update after removing the observer makes sure endUpdate cannot be called twice here. + observer.endUpdate(this); + } + } + set(value, tx, change) { + if (change === undefined && this._equalityComparator(this._value, value)) { + return; + } + let _tx; + if (!tx) { + tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`); + } + try { + this._isUpToDate = false; + this._setValue(value); + if (change !== undefined) { + this._deltas.push(change); + } + tx.updateObserver({ + beginUpdate: () => this._beginUpdate(), + endUpdate: () => this._endUpdate(), + handleChange: (observable, change) => { }, + handlePossibleChange: (observable) => { }, + }, this); + if (this._updateCounter > 1) { + // We already started begin/end update, so we need to manually call handlePossibleChange + for (const observer of this.observers) { + observer.handlePossibleChange(this); + } + } + } + finally { + if (_tx) { + _tx.finish(); + } + } + } + toString() { + return `${this.debugName}: ${this._value}`; + } + _setValue(newValue) { + this._value = newValue; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/logging.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/logging.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ac38b9314faa56ad077eb33fb114a1b376f6b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/logging.js @@ -0,0 +1,258 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +let globalObservableLogger; +export function setLogger(logger) { + globalObservableLogger = logger; +} +export function getLogger() { + return globalObservableLogger; +} +export class ConsoleObservableLogger { + constructor() { + this.indentation = 0; + this.changedObservablesSets = new WeakMap(); + } + textToConsoleArgs(text) { + return consoleTextToArgs([ + normalText(repeat('| ', this.indentation)), + text, + ]); + } + formatInfo(info) { + if (!info.hadValue) { + return [ + normalText(` `), + styled(formatValue(info.newValue, 60), { + color: 'green', + }), + normalText(` (initial)`), + ]; + } + return info.didChange + ? [ + normalText(` `), + styled(formatValue(info.oldValue, 70), { + color: 'red', + strikeThrough: true, + }), + normalText(` `), + styled(formatValue(info.newValue, 60), { + color: 'green', + }), + ] + : [normalText(` (unchanged)`)]; + } + handleObservableChanged(observable, info) { + console.log(...this.textToConsoleArgs([ + formatKind('observable value changed'), + styled(observable.debugName, { color: 'BlueViolet' }), + ...this.formatInfo(info), + ])); + } + formatChanges(changes) { + if (changes.size === 0) { + return undefined; + } + return styled(' (changed deps: ' + + [...changes].map((o) => o.debugName).join(', ') + + ')', { color: 'gray' }); + } + handleDerivedCreated(derived) { + const existingHandleChange = derived.handleChange; + this.changedObservablesSets.set(derived, new Set()); + derived.handleChange = (observable, change) => { + this.changedObservablesSets.get(derived).add(observable); + return existingHandleChange.apply(derived, [observable, change]); + }; + } + handleDerivedRecomputed(derived, info) { + const changedObservables = this.changedObservablesSets.get(derived); + console.log(...this.textToConsoleArgs([ + formatKind('derived recomputed'), + styled(derived.debugName, { color: 'BlueViolet' }), + ...this.formatInfo(info), + this.formatChanges(changedObservables), + { data: [{ fn: derived._debugNameData.referenceFn ?? derived._computeFn }] } + ])); + changedObservables.clear(); + } + handleFromEventObservableTriggered(observable, info) { + console.log(...this.textToConsoleArgs([ + formatKind('observable from event triggered'), + styled(observable.debugName, { color: 'BlueViolet' }), + ...this.formatInfo(info), + { data: [{ fn: observable._getValue }] } + ])); + } + handleAutorunCreated(autorun) { + const existingHandleChange = autorun.handleChange; + this.changedObservablesSets.set(autorun, new Set()); + autorun.handleChange = (observable, change) => { + this.changedObservablesSets.get(autorun).add(observable); + return existingHandleChange.apply(autorun, [observable, change]); + }; + } + handleAutorunTriggered(autorun) { + const changedObservables = this.changedObservablesSets.get(autorun); + console.log(...this.textToConsoleArgs([ + formatKind('autorun'), + styled(autorun.debugName, { color: 'BlueViolet' }), + this.formatChanges(changedObservables), + { data: [{ fn: autorun._debugNameData.referenceFn ?? autorun._runFn }] } + ])); + changedObservables.clear(); + this.indentation++; + } + handleAutorunFinished(autorun) { + this.indentation--; + } + handleBeginTransaction(transaction) { + let transactionName = transaction.getDebugName(); + if (transactionName === undefined) { + transactionName = ''; + } + console.log(...this.textToConsoleArgs([ + formatKind('transaction'), + styled(transactionName, { color: 'BlueViolet' }), + { data: [{ fn: transaction._fn }] } + ])); + this.indentation++; + } + handleEndTransaction() { + this.indentation--; + } +} +function consoleTextToArgs(text) { + const styles = new Array(); + const data = []; + let firstArg = ''; + function process(t) { + if ('length' in t) { + for (const item of t) { + if (item) { + process(item); + } + } + } + else if ('text' in t) { + firstArg += `%c${t.text}`; + styles.push(t.style); + if (t.data) { + data.push(...t.data); + } + } + else if ('data' in t) { + data.push(...t.data); + } + } + process(text); + const result = [firstArg, ...styles]; + result.push(...data); + return result; +} +function normalText(text) { + return styled(text, { color: 'black' }); +} +function formatKind(kind) { + return styled(padStr(`${kind}: `, 10), { color: 'black', bold: true }); +} +function styled(text, options = { + color: 'black', +}) { + function objToCss(styleObj) { + return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => { + return `${styleString}${propName}:${propValue};`; + }, ''); + } + const style = { + color: options.color, + }; + if (options.strikeThrough) { + style['text-decoration'] = 'line-through'; + } + if (options.bold) { + style['font-weight'] = 'bold'; + } + return { + text, + style: objToCss(style), + }; +} +function formatValue(value, availableLen) { + switch (typeof value) { + case 'number': + return '' + value; + case 'string': + if (value.length + 2 <= availableLen) { + return `"${value}"`; + } + return `"${value.substr(0, availableLen - 7)}"+...`; + case 'boolean': + return value ? 'true' : 'false'; + case 'undefined': + return 'undefined'; + case 'object': + if (value === null) { + return 'null'; + } + if (Array.isArray(value)) { + return formatArray(value, availableLen); + } + return formatObject(value, availableLen); + case 'symbol': + return value.toString(); + case 'function': + return `[[Function${value.name ? ' ' + value.name : ''}]]`; + default: + return '' + value; + } +} +function formatArray(value, availableLen) { + let result = '[ '; + let first = true; + for (const val of value) { + if (!first) { + result += ', '; + } + if (result.length - 5 > availableLen) { + result += '...'; + break; + } + first = false; + result += `${formatValue(val, availableLen - result.length)}`; + } + result += ' ]'; + return result; +} +function formatObject(value, availableLen) { + let result = '{ '; + let first = true; + for (const [key, val] of Object.entries(value)) { + if (!first) { + result += ', '; + } + if (result.length - 5 > availableLen) { + result += '...'; + break; + } + first = false; + result += `${key}: ${formatValue(val, availableLen - result.length)}`; + } + result += ' }'; + return result; +} +function repeat(str, count) { + let result = ''; + for (let i = 1; i <= count; i++) { + result += str; + } + return result; +} +function padStr(str, length) { + while (str.length < length) { + str += ' '; + } + return str; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/promise.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/promise.js new file mode 100644 index 0000000000000000000000000000000000000000..8a12b13d980ee019e905fa11b5382c6262084137 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/promise.js @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { autorun } from './autorun.js'; +import { observableValue, transaction } from './base.js'; +import { CancellationError } from '../errors.js'; +/** + * A promise whose state is observable. + */ +export class ObservablePromise { + static fromFn(fn) { + return new ObservablePromise(fn()); + } + constructor(promise) { + this._value = observableValue(this, undefined); + /** + * The current state of the promise. + * Is `undefined` if the promise didn't resolve yet. + */ + this.promiseResult = this._value; + this.promise = promise.then(value => { + transaction(tx => { + /** @description onPromiseResolved */ + this._value.set(new PromiseResult(value, undefined), tx); + }); + return value; + }, error => { + transaction(tx => { + /** @description onPromiseRejected */ + this._value.set(new PromiseResult(undefined, error), tx); + }); + throw error; + }); + } +} +export class PromiseResult { + constructor( + /** + * The value of the resolved promise. + * Undefined if the promise rejected. + */ + data, + /** + * The error in case of a rejected promise. + * Undefined if the promise resolved. + */ + error) { + this.data = data; + this.error = error; + } +} +export function waitForState(observable, predicate, isError, cancellationToken) { + if (!predicate) { + predicate = state => state !== null && state !== undefined; + } + return new Promise((resolve, reject) => { + let isImmediateRun = true; + let shouldDispose = false; + const stateObs = observable.map(state => { + /** @description waitForState.state */ + return { + isFinished: predicate(state), + error: isError ? isError(state) : false, + state + }; + }); + const d = autorun(reader => { + /** @description waitForState */ + const { isFinished, error, state } = stateObs.read(reader); + if (isFinished || error) { + if (isImmediateRun) { + // The variable `d` is not initialized yet + shouldDispose = true; + } + else { + d.dispose(); + } + if (error) { + reject(error === true ? state : error); + } + else { + resolve(state); + } + } + }); + if (cancellationToken) { + const dc = cancellationToken.onCancellationRequested(() => { + d.dispose(); + dc.dispose(); + reject(new CancellationError()); + }); + if (cancellationToken.isCancellationRequested) { + d.dispose(); + dc.dispose(); + reject(new CancellationError()); + return; + } + } + isImmediateRun = false; + if (shouldDispose) { + d.dispose(); + } + }); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/utils.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..82c83ee8f452c30eabededf3fe14ba87fe59b409 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/observableInternal/utils.js @@ -0,0 +1,366 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Event } from '../event.js'; +import { DisposableStore, toDisposable } from '../lifecycle.js'; +import { BaseObservable, ConvenientObservable, _setKeepObserved, _setRecomputeInitiallyAndOnChange, subtransaction, transaction } from './base.js'; +import { DebugNameData } from './debugName.js'; +import { derived, derivedOpts } from './derived.js'; +import { getLogger } from './logging.js'; +import { strictEquals } from '../equals.js'; +/** + * Represents an efficient observable whose value never changes. + */ +export function constObservable(value) { + return new ConstObservable(value); +} +class ConstObservable extends ConvenientObservable { + constructor(value) { + super(); + this.value = value; + } + get debugName() { + return this.toString(); + } + get() { + return this.value; + } + addObserver(observer) { + // NO OP + } + removeObserver(observer) { + // NO OP + } + toString() { + return `Const: ${this.value}`; + } +} +export function observableFromEvent(...args) { + let owner; + let event; + let getValue; + if (args.length === 3) { + [owner, event, getValue] = args; + } + else { + [event, getValue] = args; + } + return new FromEventObservable(new DebugNameData(owner, undefined, getValue), event, getValue, () => FromEventObservable.globalTransaction, strictEquals); +} +export function observableFromEventOpts(options, event, getValue) { + return new FromEventObservable(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? getValue), event, getValue, () => FromEventObservable.globalTransaction, options.equalsFn ?? strictEquals); +} +export class FromEventObservable extends BaseObservable { + constructor(_debugNameData, event, _getValue, _getTransaction, _equalityComparator) { + super(); + this._debugNameData = _debugNameData; + this.event = event; + this._getValue = _getValue; + this._getTransaction = _getTransaction; + this._equalityComparator = _equalityComparator; + this.hasValue = false; + this.handleEvent = (args) => { + const newValue = this._getValue(args); + const oldValue = this.value; + const didChange = !this.hasValue || !(this._equalityComparator(oldValue, newValue)); + let didRunTransaction = false; + if (didChange) { + this.value = newValue; + if (this.hasValue) { + didRunTransaction = true; + subtransaction(this._getTransaction(), (tx) => { + getLogger()?.handleFromEventObservableTriggered(this, { oldValue, newValue, change: undefined, didChange, hadValue: this.hasValue }); + for (const o of this.observers) { + tx.updateObserver(o, this); + o.handleChange(this, undefined); + } + }, () => { + const name = this.getDebugName(); + return 'Event fired' + (name ? `: ${name}` : ''); + }); + } + this.hasValue = true; + } + if (!didRunTransaction) { + getLogger()?.handleFromEventObservableTriggered(this, { oldValue, newValue, change: undefined, didChange, hadValue: this.hasValue }); + } + }; + } + getDebugName() { + return this._debugNameData.getDebugName(this); + } + get debugName() { + const name = this.getDebugName(); + return 'From Event' + (name ? `: ${name}` : ''); + } + onFirstObserverAdded() { + this.subscription = this.event(this.handleEvent); + } + onLastObserverRemoved() { + this.subscription.dispose(); + this.subscription = undefined; + this.hasValue = false; + this.value = undefined; + } + get() { + if (this.subscription) { + if (!this.hasValue) { + this.handleEvent(undefined); + } + return this.value; + } + else { + // no cache, as there are no subscribers to keep it updated + const value = this._getValue(undefined); + return value; + } + } +} +(function (observableFromEvent) { + observableFromEvent.Observer = FromEventObservable; + function batchEventsGlobally(tx, fn) { + let didSet = false; + if (FromEventObservable.globalTransaction === undefined) { + FromEventObservable.globalTransaction = tx; + didSet = true; + } + try { + fn(); + } + finally { + if (didSet) { + FromEventObservable.globalTransaction = undefined; + } + } + } + observableFromEvent.batchEventsGlobally = batchEventsGlobally; +})(observableFromEvent || (observableFromEvent = {})); +export function observableSignalFromEvent(debugName, event) { + return new FromEventObservableSignal(debugName, event); +} +class FromEventObservableSignal extends BaseObservable { + constructor(debugName, event) { + super(); + this.debugName = debugName; + this.event = event; + this.handleEvent = () => { + transaction((tx) => { + for (const o of this.observers) { + tx.updateObserver(o, this); + o.handleChange(this, undefined); + } + }, () => this.debugName); + }; + } + onFirstObserverAdded() { + this.subscription = this.event(this.handleEvent); + } + onLastObserverRemoved() { + this.subscription.dispose(); + this.subscription = undefined; + } + get() { + // NO OP + } +} +export function observableSignal(debugNameOrOwner) { + if (typeof debugNameOrOwner === 'string') { + return new ObservableSignal(debugNameOrOwner); + } + else { + return new ObservableSignal(undefined, debugNameOrOwner); + } +} +class ObservableSignal extends BaseObservable { + get debugName() { + return new DebugNameData(this._owner, this._debugName, undefined).getDebugName(this) ?? 'Observable Signal'; + } + toString() { + return this.debugName; + } + constructor(_debugName, _owner) { + super(); + this._debugName = _debugName; + this._owner = _owner; + } + trigger(tx, change) { + if (!tx) { + transaction(tx => { + this.trigger(tx, change); + }, () => `Trigger signal ${this.debugName}`); + return; + } + for (const o of this.observers) { + tx.updateObserver(o, this); + o.handleChange(this, change); + } + } + get() { + // NO OP + } +} +/** + * This makes sure the observable is being observed and keeps its cache alive. + */ +export function keepObserved(observable) { + const o = new KeepAliveObserver(false, undefined); + observable.addObserver(o); + return toDisposable(() => { + observable.removeObserver(o); + }); +} +_setKeepObserved(keepObserved); +/** + * This converts the given observable into an autorun. + */ +export function recomputeInitiallyAndOnChange(observable, handleValue) { + const o = new KeepAliveObserver(true, handleValue); + observable.addObserver(o); + if (handleValue) { + handleValue(observable.get()); + } + else { + observable.reportChanges(); + } + return toDisposable(() => { + observable.removeObserver(o); + }); +} +_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange); +export class KeepAliveObserver { + constructor(_forceRecompute, _handleValue) { + this._forceRecompute = _forceRecompute; + this._handleValue = _handleValue; + this._counter = 0; + } + beginUpdate(observable) { + this._counter++; + } + endUpdate(observable) { + this._counter--; + if (this._counter === 0 && this._forceRecompute) { + if (this._handleValue) { + this._handleValue(observable.get()); + } + else { + observable.reportChanges(); + } + } + } + handlePossibleChange(observable) { + // NO OP + } + handleChange(observable, change) { + // NO OP + } +} +export function derivedObservableWithCache(owner, computeFn) { + let lastValue = undefined; + const observable = derivedOpts({ owner, debugReferenceFn: computeFn }, reader => { + lastValue = computeFn(reader, lastValue); + return lastValue; + }); + return observable; +} +export function derivedObservableWithWritableCache(owner, computeFn) { + let lastValue = undefined; + const onChange = observableSignal('derivedObservableWithWritableCache'); + const observable = derived(owner, reader => { + onChange.read(reader); + lastValue = computeFn(reader, lastValue); + return lastValue; + }); + return Object.assign(observable, { + clearCache: (tx) => { + lastValue = undefined; + onChange.trigger(tx); + }, + setCache: (newValue, tx) => { + lastValue = newValue; + onChange.trigger(tx); + } + }); +} +/** + * When the items array changes, referential equal items are not mapped again. + */ +export function mapObservableArrayCached(owner, items, map, keySelector) { + let m = new ArrayMap(map, keySelector); + const self = derivedOpts({ + debugReferenceFn: map, + owner, + onLastObserverRemoved: () => { + m.dispose(); + m = new ArrayMap(map); + } + }, (reader) => { + m.setItems(items.read(reader)); + return m.getItems(); + }); + return self; +} +class ArrayMap { + constructor(_map, _keySelector) { + this._map = _map; + this._keySelector = _keySelector; + this._cache = new Map(); + this._items = []; + } + dispose() { + this._cache.forEach(entry => entry.store.dispose()); + this._cache.clear(); + } + setItems(items) { + const newItems = []; + const itemsToRemove = new Set(this._cache.keys()); + for (const item of items) { + const key = this._keySelector ? this._keySelector(item) : item; + let entry = this._cache.get(key); + if (!entry) { + const store = new DisposableStore(); + const out = this._map(item, store); + entry = { out, store }; + this._cache.set(key, entry); + } + else { + itemsToRemove.delete(key); + } + newItems.push(entry.out); + } + for (const item of itemsToRemove) { + const entry = this._cache.get(item); + entry.store.dispose(); + this._cache.delete(item); + } + this._items = newItems; + } + getItems() { + return this._items; + } +} +export class ValueWithChangeEventFromObservable { + constructor(observable) { + this.observable = observable; + } + get onDidChange() { + return Event.fromObservableLight(this.observable); + } + get value() { + return this.observable.get(); + } +} +export function observableFromValueWithChangeEvent(owner, value) { + if (value instanceof ValueWithChangeEventFromObservable) { + return value.observable; + } + return observableFromEvent(owner, value.onDidChange, () => value.value); +} +/** + * Works like a derived. + * However, if the value is not undefined, it is cached and will not be recomputed anymore. + * In that case, the derived will unsubscribe from its dependencies. +*/ +export function derivedConstOnceDefined(owner, fn) { + return derivedObservableWithCache(owner, (reader, lastValue) => lastValue ?? fn(reader)); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/paging.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/paging.js new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/paging.js @@ -0,0 +1 @@ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/path.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/path.js new file mode 100644 index 0000000000000000000000000000000000000000..09fd7569a80d53c57cefb4233997d009f3f59645 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/path.js @@ -0,0 +1,1399 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace +// Copied from: https://github.com/nodejs/node/commits/v20.9.0/lib/path.js +// Excluding: the change that adds primordials +// (https://github.com/nodejs/node/commit/187a862d221dec42fa9a5c4214e7034d9092792f and others) +/** + * Copyright Joyent, Inc. and other Node contributors. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +import * as process from './process.js'; +const CHAR_UPPERCASE_A = 65; /* A */ +const CHAR_LOWERCASE_A = 97; /* a */ +const CHAR_UPPERCASE_Z = 90; /* Z */ +const CHAR_LOWERCASE_Z = 122; /* z */ +const CHAR_DOT = 46; /* . */ +const CHAR_FORWARD_SLASH = 47; /* / */ +const CHAR_BACKWARD_SLASH = 92; /* \ */ +const CHAR_COLON = 58; /* : */ +const CHAR_QUESTION_MARK = 63; /* ? */ +class ErrorInvalidArgType extends Error { + constructor(name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && expected.indexOf('not ') === 0) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } + else { + determiner = 'must be'; + } + const type = name.indexOf('.') !== -1 ? 'property' : 'argument'; + let msg = `The "${name}" ${type} ${determiner} of type ${expected}`; + msg += `. Received type ${typeof actual}`; + super(msg); + this.code = 'ERR_INVALID_ARG_TYPE'; + } +} +function validateObject(pathObject, name) { + if (pathObject === null || typeof pathObject !== 'object') { + throw new ErrorInvalidArgType(name, 'Object', pathObject); + } +} +function validateString(value, name) { + if (typeof value !== 'string') { + throw new ErrorInvalidArgType(name, 'string', value); + } +} +const platformIsWin32 = (process.platform === 'win32'); +function isPathSeparator(code) { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +} +function isPosixPathSeparator(code) { + return code === CHAR_FORWARD_SLASH; +} +function isWindowsDeviceRoot(code) { + return (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) || + (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z); +} +// Resolves . and .. elements in a path with directory names +function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { + let res = ''; + let lastSegmentLength = 0; + let lastSlash = -1; + let dots = 0; + let code = 0; + for (let i = 0; i <= path.length; ++i) { + if (i < path.length) { + code = path.charCodeAt(i); + } + else if (isPathSeparator(code)) { + break; + } + else { + code = CHAR_FORWARD_SLASH; + } + if (isPathSeparator(code)) { + if (lastSlash === i - 1 || dots === 1) { + // NOOP + } + else if (dots === 2) { + if (res.length < 2 || lastSegmentLength !== 2 || + res.charCodeAt(res.length - 1) !== CHAR_DOT || + res.charCodeAt(res.length - 2) !== CHAR_DOT) { + if (res.length > 2) { + const lastSlashIndex = res.lastIndexOf(separator); + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } + else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); + } + lastSlash = i; + dots = 0; + continue; + } + else if (res.length !== 0) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + res += res.length > 0 ? `${separator}..` : '..'; + lastSegmentLength = 2; + } + } + else { + if (res.length > 0) { + res += `${separator}${path.slice(lastSlash + 1, i)}`; + } + else { + res = path.slice(lastSlash + 1, i); + } + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } + else if (code === CHAR_DOT && dots !== -1) { + ++dots; + } + else { + dots = -1; + } + } + return res; +} +function formatExt(ext) { + return ext ? `${ext[0] === '.' ? '' : '.'}${ext}` : ''; +} +function _format(sep, pathObject) { + validateObject(pathObject, 'pathObject'); + const dir = pathObject.dir || pathObject.root; + const base = pathObject.base || + `${pathObject.name || ''}${formatExt(pathObject.ext)}`; + if (!dir) { + return base; + } + return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep}${base}`; +} +export const win32 = { + // path.resolve([from ...], to) + resolve(...pathSegments) { + let resolvedDevice = ''; + let resolvedTail = ''; + let resolvedAbsolute = false; + for (let i = pathSegments.length - 1; i >= -1; i--) { + let path; + if (i >= 0) { + path = pathSegments[i]; + validateString(path, `paths[${i}]`); + // Skip empty entries + if (path.length === 0) { + continue; + } + } + else if (resolvedDevice.length === 0) { + path = process.cwd(); + } + else { + // Windows has the concept of drive-specific current working + // directories. If we've resolved a drive letter but not yet an + // absolute path, get cwd for that drive, or the process cwd if + // the drive cwd is not available. We're sure the device is not + // a UNC path at this points, because UNC paths are always absolute. + path = process.env[`=${resolvedDevice}`] || process.cwd(); + // Verify that a cwd was found and that it actually points + // to our drive. If not, default to the drive's root. + if (path === undefined || + (path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() && + path.charCodeAt(2) === CHAR_BACKWARD_SLASH)) { + path = `${resolvedDevice}\\`; + } + } + const len = path.length; + let rootEnd = 0; + let device = ''; + let isAbsolute = false; + const code = path.charCodeAt(0); + // Try to match a root + if (len === 1) { + if (isPathSeparator(code)) { + // `path` contains just a path separator + rootEnd = 1; + isAbsolute = true; + } + } + else if (isPathSeparator(code)) { + // Possible UNC root + // If we started with a separator, we know we at least have an + // absolute path of some kind (UNC or otherwise) + isAbsolute = true; + if (isPathSeparator(path.charCodeAt(1))) { + // Matched double path separator at beginning + let j = 2; + let last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + const firstPart = path.slice(last, j); + // Matched! + last = j; + // Match 1 or more path separators + while (j < len && isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j === len || j !== last) { + // We matched a UNC root + device = `\\\\${firstPart}\\${path.slice(last, j)}`; + rootEnd = j; + } + } + } + } + else { + rootEnd = 1; + } + } + else if (isWindowsDeviceRoot(code) && + path.charCodeAt(1) === CHAR_COLON) { + // Possible device root + device = path.slice(0, 2); + rootEnd = 2; + if (len > 2 && isPathSeparator(path.charCodeAt(2))) { + // Treat separator following drive name as an absolute path + // indicator + isAbsolute = true; + rootEnd = 3; + } + } + if (device.length > 0) { + if (resolvedDevice.length > 0) { + if (device.toLowerCase() !== resolvedDevice.toLowerCase()) { + // This path points to another device so it is not applicable + continue; + } + } + else { + resolvedDevice = device; + } + } + if (resolvedAbsolute) { + if (resolvedDevice.length > 0) { + break; + } + } + else { + resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`; + resolvedAbsolute = isAbsolute; + if (isAbsolute && resolvedDevice.length > 0) { + break; + } + } + } + // At this point the path should be resolved to a full absolute path, + // but handle relative paths to be safe (might happen when process.cwd() + // fails) + // Normalize the tail path + resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\', isPathSeparator); + return resolvedAbsolute ? + `${resolvedDevice}\\${resolvedTail}` : + `${resolvedDevice}${resolvedTail}` || '.'; + }, + normalize(path) { + validateString(path, 'path'); + const len = path.length; + if (len === 0) { + return '.'; + } + let rootEnd = 0; + let device; + let isAbsolute = false; + const code = path.charCodeAt(0); + // Try to match a root + if (len === 1) { + // `path` contains just a single char, exit early to avoid + // unnecessary work + return isPosixPathSeparator(code) ? '\\' : path; + } + if (isPathSeparator(code)) { + // Possible UNC root + // If we started with a separator, we know we at least have an absolute + // path of some kind (UNC or otherwise) + isAbsolute = true; + if (isPathSeparator(path.charCodeAt(1))) { + // Matched double path separator at beginning + let j = 2; + let last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + const firstPart = path.slice(last, j); + // Matched! + last = j; + // Match 1 or more path separators + while (j < len && isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j === len) { + // We matched a UNC root only + // Return the normalized version of the UNC root since there + // is nothing left to process + return `\\\\${firstPart}\\${path.slice(last)}\\`; + } + if (j !== last) { + // We matched a UNC root with leftovers + device = `\\\\${firstPart}\\${path.slice(last, j)}`; + rootEnd = j; + } + } + } + } + else { + rootEnd = 1; + } + } + else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) { + // Possible device root + device = path.slice(0, 2); + rootEnd = 2; + if (len > 2 && isPathSeparator(path.charCodeAt(2))) { + // Treat separator following drive name as an absolute path + // indicator + isAbsolute = true; + rootEnd = 3; + } + } + let tail = rootEnd < len ? + normalizeString(path.slice(rootEnd), !isAbsolute, '\\', isPathSeparator) : + ''; + if (tail.length === 0 && !isAbsolute) { + tail = '.'; + } + if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { + tail += '\\'; + } + if (device === undefined) { + return isAbsolute ? `\\${tail}` : tail; + } + return isAbsolute ? `${device}\\${tail}` : `${device}${tail}`; + }, + isAbsolute(path) { + validateString(path, 'path'); + const len = path.length; + if (len === 0) { + return false; + } + const code = path.charCodeAt(0); + return isPathSeparator(code) || + // Possible device root + (len > 2 && + isWindowsDeviceRoot(code) && + path.charCodeAt(1) === CHAR_COLON && + isPathSeparator(path.charCodeAt(2))); + }, + join(...paths) { + if (paths.length === 0) { + return '.'; + } + let joined; + let firstPart; + for (let i = 0; i < paths.length; ++i) { + const arg = paths[i]; + validateString(arg, 'path'); + if (arg.length > 0) { + if (joined === undefined) { + joined = firstPart = arg; + } + else { + joined += `\\${arg}`; + } + } + } + if (joined === undefined) { + return '.'; + } + // Make sure that the joined path doesn't start with two slashes, because + // normalize() will mistake it for a UNC path then. + // + // This step is skipped when it is very clear that the user actually + // intended to point at a UNC path. This is assumed when the first + // non-empty string arguments starts with exactly two slashes followed by + // at least one more non-slash character. + // + // Note that for normalize() to treat a path as a UNC path it needs to + // have at least 2 components, so we don't filter for that here. + // This means that the user can use join to construct UNC paths from + // a server name and a share name; for example: + // path.join('//server', 'share') -> '\\\\server\\share\\') + let needsReplace = true; + let slashCount = 0; + if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) { + ++slashCount; + const firstLen = firstPart.length; + if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) { + ++slashCount; + if (firstLen > 2) { + if (isPathSeparator(firstPart.charCodeAt(2))) { + ++slashCount; + } + else { + // We matched a UNC path in the first part + needsReplace = false; + } + } + } + } + if (needsReplace) { + // Find any more consecutive slashes we need to replace + while (slashCount < joined.length && + isPathSeparator(joined.charCodeAt(slashCount))) { + slashCount++; + } + // Replace the slashes if needed + if (slashCount >= 2) { + joined = `\\${joined.slice(slashCount)}`; + } + } + return win32.normalize(joined); + }, + // It will solve the relative path from `from` to `to`, for instance: + // from = 'C:\\orandea\\test\\aaa' + // to = 'C:\\orandea\\impl\\bbb' + // The output of the function should be: '..\\..\\impl\\bbb' + relative(from, to) { + validateString(from, 'from'); + validateString(to, 'to'); + if (from === to) { + return ''; + } + const fromOrig = win32.resolve(from); + const toOrig = win32.resolve(to); + if (fromOrig === toOrig) { + return ''; + } + from = fromOrig.toLowerCase(); + to = toOrig.toLowerCase(); + if (from === to) { + return ''; + } + // Trim any leading backslashes + let fromStart = 0; + while (fromStart < from.length && + from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) { + fromStart++; + } + // Trim trailing backslashes (applicable to UNC paths only) + let fromEnd = from.length; + while (fromEnd - 1 > fromStart && + from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) { + fromEnd--; + } + const fromLen = fromEnd - fromStart; + // Trim any leading backslashes + let toStart = 0; + while (toStart < to.length && + to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) { + toStart++; + } + // Trim trailing backslashes (applicable to UNC paths only) + let toEnd = to.length; + while (toEnd - 1 > toStart && + to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) { + toEnd--; + } + const toLen = toEnd - toStart; + // Compare paths to find the longest common path from root + const length = fromLen < toLen ? fromLen : toLen; + let lastCommonSep = -1; + let i = 0; + for (; i < length; i++) { + const fromCode = from.charCodeAt(fromStart + i); + if (fromCode !== to.charCodeAt(toStart + i)) { + break; + } + else if (fromCode === CHAR_BACKWARD_SLASH) { + lastCommonSep = i; + } + } + // We found a mismatch before the first common path separator was seen, so + // return the original `to`. + if (i !== length) { + if (lastCommonSep === -1) { + return toOrig; + } + } + else { + if (toLen > length) { + if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) { + // We get here if `from` is the exact base path for `to`. + // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz' + return toOrig.slice(toStart + i + 1); + } + if (i === 2) { + // We get here if `from` is the device root. + // For example: from='C:\\'; to='C:\\foo' + return toOrig.slice(toStart + i); + } + } + if (fromLen > length) { + if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) { + // We get here if `to` is the exact base path for `from`. + // For example: from='C:\\foo\\bar'; to='C:\\foo' + lastCommonSep = i; + } + else if (i === 2) { + // We get here if `to` is the device root. + // For example: from='C:\\foo\\bar'; to='C:\\' + lastCommonSep = 3; + } + } + if (lastCommonSep === -1) { + lastCommonSep = 0; + } + } + let out = ''; + // Generate the relative path based on the path difference between `to` and + // `from` + for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { + if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) { + out += out.length === 0 ? '..' : '\\..'; + } + } + toStart += lastCommonSep; + // Lastly, append the rest of the destination (`to`) path that comes after + // the common path parts + if (out.length > 0) { + return `${out}${toOrig.slice(toStart, toEnd)}`; + } + if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) { + ++toStart; + } + return toOrig.slice(toStart, toEnd); + }, + toNamespacedPath(path) { + // Note: this will *probably* throw somewhere. + if (typeof path !== 'string' || path.length === 0) { + return path; + } + const resolvedPath = win32.resolve(path); + if (resolvedPath.length <= 2) { + return path; + } + if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { + // Possible UNC root + if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { + const code = resolvedPath.charCodeAt(2); + if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { + // Matched non-long UNC root, convert the path to a long UNC path + return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; + } + } + } + else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) && + resolvedPath.charCodeAt(1) === CHAR_COLON && + resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) { + // Matched device root, convert the path to a long UNC path + return `\\\\?\\${resolvedPath}`; + } + return path; + }, + dirname(path) { + validateString(path, 'path'); + const len = path.length; + if (len === 0) { + return '.'; + } + let rootEnd = -1; + let offset = 0; + const code = path.charCodeAt(0); + if (len === 1) { + // `path` contains just a path separator, exit early to avoid + // unnecessary work or a dot. + return isPathSeparator(code) ? path : '.'; + } + // Try to match a root + if (isPathSeparator(code)) { + // Possible UNC root + rootEnd = offset = 1; + if (isPathSeparator(path.charCodeAt(1))) { + // Matched double path separator at beginning + let j = 2; + let last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more path separators + while (j < len && isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j === len) { + // We matched a UNC root only + return path; + } + if (j !== last) { + // We matched a UNC root with leftovers + // Offset by 1 to include the separator after the UNC root to + // treat it as a "normal root" on top of a (UNC) root + rootEnd = offset = j + 1; + } + } + } + } + // Possible device root + } + else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) { + rootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2; + offset = rootEnd; + } + let end = -1; + let matchedSlash = true; + for (let i = len - 1; i >= offset; --i) { + if (isPathSeparator(path.charCodeAt(i))) { + if (!matchedSlash) { + end = i; + break; + } + } + else { + // We saw the first non-path separator + matchedSlash = false; + } + } + if (end === -1) { + if (rootEnd === -1) { + return '.'; + } + end = rootEnd; + } + return path.slice(0, end); + }, + basename(path, suffix) { + if (suffix !== undefined) { + validateString(suffix, 'suffix'); + } + validateString(path, 'path'); + let start = 0; + let end = -1; + let matchedSlash = true; + let i; + // Check for a drive letter prefix so as not to mistake the following + // path separator as an extra separator at the end of the path that can be + // disregarded + if (path.length >= 2 && + isWindowsDeviceRoot(path.charCodeAt(0)) && + path.charCodeAt(1) === CHAR_COLON) { + start = 2; + } + if (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) { + if (suffix === path) { + return ''; + } + let extIdx = suffix.length - 1; + let firstNonSlashEnd = -1; + for (i = path.length - 1; i >= start; --i) { + const code = path.charCodeAt(i); + if (isPathSeparator(code)) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === suffix.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } + else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) { + end = firstNonSlashEnd; + } + else if (end === -1) { + end = path.length; + } + return path.slice(start, end); + } + for (i = path.length - 1; i >= start; --i) { + if (isPathSeparator(path.charCodeAt(i))) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + if (end === -1) { + return ''; + } + return path.slice(start, end); + }, + extname(path) { + validateString(path, 'path'); + let start = 0; + let startDot = -1; + let startPart = 0; + let end = -1; + let matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + let preDotState = 0; + // Check for a drive letter prefix so as not to mistake the following + // path separator as an extra separator at the end of the path that can be + // disregarded + if (path.length >= 2 && + path.charCodeAt(1) === CHAR_COLON && + isWindowsDeviceRoot(path.charCodeAt(0))) { + start = startPart = 2; + } + for (let i = path.length - 1; i >= start; --i) { + const code = path.charCodeAt(i); + if (isPathSeparator(code)) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === CHAR_DOT) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) { + startDot = i; + } + else if (preDotState !== 1) { + preDotState = 1; + } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || + end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + (preDotState === 1 && + startDot === end - 1 && + startDot === startPart + 1)) { + return ''; + } + return path.slice(startDot, end); + }, + format: _format.bind(null, '\\'), + parse(path) { + validateString(path, 'path'); + const ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) { + return ret; + } + const len = path.length; + let rootEnd = 0; + let code = path.charCodeAt(0); + if (len === 1) { + if (isPathSeparator(code)) { + // `path` contains just a path separator, exit early to avoid + // unnecessary work + ret.root = ret.dir = path; + return ret; + } + ret.base = ret.name = path; + return ret; + } + // Try to match a root + if (isPathSeparator(code)) { + // Possible UNC root + rootEnd = 1; + if (isPathSeparator(path.charCodeAt(1))) { + // Matched double path separator at beginning + let j = 2; + let last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more path separators + while (j < len && isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more non-path separators + while (j < len && !isPathSeparator(path.charCodeAt(j))) { + j++; + } + if (j === len) { + // We matched a UNC root only + rootEnd = j; + } + else if (j !== last) { + // We matched a UNC root with leftovers + rootEnd = j + 1; + } + } + } + } + } + else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) { + // Possible device root + if (len <= 2) { + // `path` contains just a drive root, exit early to avoid + // unnecessary work + ret.root = ret.dir = path; + return ret; + } + rootEnd = 2; + if (isPathSeparator(path.charCodeAt(2))) { + if (len === 3) { + // `path` contains just a drive root, exit early to avoid + // unnecessary work + ret.root = ret.dir = path; + return ret; + } + rootEnd = 3; + } + } + if (rootEnd > 0) { + ret.root = path.slice(0, rootEnd); + } + let startDot = -1; + let startPart = rootEnd; + let end = -1; + let matchedSlash = true; + let i = path.length - 1; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + let preDotState = 0; + // Get non-dir info + for (; i >= rootEnd; --i) { + code = path.charCodeAt(i); + if (isPathSeparator(code)) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === CHAR_DOT) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) { + startDot = i; + } + else if (preDotState !== 1) { + preDotState = 1; + } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (end !== -1) { + if (startDot === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + (preDotState === 1 && + startDot === end - 1 && + startDot === startPart + 1)) { + ret.base = ret.name = path.slice(startPart, end); + } + else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + ret.ext = path.slice(startDot, end); + } + } + // If the directory is the root, use the entire root as the `dir` including + // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the + // trailing slash (`C:\abc\def` -> `C:\abc`). + if (startPart > 0 && startPart !== rootEnd) { + ret.dir = path.slice(0, startPart - 1); + } + else { + ret.dir = ret.root; + } + return ret; + }, + sep: '\\', + delimiter: ';', + win32: null, + posix: null +}; +const posixCwd = (() => { + if (platformIsWin32) { + // Converts Windows' backslash path separators to POSIX forward slashes + // and truncates any drive indicator + const regexp = /\\/g; + return () => { + const cwd = process.cwd().replace(regexp, '/'); + return cwd.slice(cwd.indexOf('/')); + }; + } + // We're already on POSIX, no need for any transformations + return () => process.cwd(); +})(); +export const posix = { + // path.resolve([from ...], to) + resolve(...pathSegments) { + let resolvedPath = ''; + let resolvedAbsolute = false; + for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + const path = i >= 0 ? pathSegments[i] : posixCwd(); + validateString(path, `paths[${i}]`); + // Skip empty entries + if (path.length === 0) { + continue; + } + resolvedPath = `${path}/${resolvedPath}`; + resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; + } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + // Normalize the path + resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/', isPosixPathSeparator); + if (resolvedAbsolute) { + return `/${resolvedPath}`; + } + return resolvedPath.length > 0 ? resolvedPath : '.'; + }, + normalize(path) { + validateString(path, 'path'); + if (path.length === 0) { + return '.'; + } + const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; + const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH; + // Normalize the path + path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator); + if (path.length === 0) { + if (isAbsolute) { + return '/'; + } + return trailingSeparator ? './' : '.'; + } + if (trailingSeparator) { + path += '/'; + } + return isAbsolute ? `/${path}` : path; + }, + isAbsolute(path) { + validateString(path, 'path'); + return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH; + }, + join(...paths) { + if (paths.length === 0) { + return '.'; + } + let joined; + for (let i = 0; i < paths.length; ++i) { + const arg = paths[i]; + validateString(arg, 'path'); + if (arg.length > 0) { + if (joined === undefined) { + joined = arg; + } + else { + joined += `/${arg}`; + } + } + } + if (joined === undefined) { + return '.'; + } + return posix.normalize(joined); + }, + relative(from, to) { + validateString(from, 'from'); + validateString(to, 'to'); + if (from === to) { + return ''; + } + // Trim leading forward slashes. + from = posix.resolve(from); + to = posix.resolve(to); + if (from === to) { + return ''; + } + const fromStart = 1; + const fromEnd = from.length; + const fromLen = fromEnd - fromStart; + const toStart = 1; + const toLen = to.length - toStart; + // Compare paths to find the longest common path from root + const length = (fromLen < toLen ? fromLen : toLen); + let lastCommonSep = -1; + let i = 0; + for (; i < length; i++) { + const fromCode = from.charCodeAt(fromStart + i); + if (fromCode !== to.charCodeAt(toStart + i)) { + break; + } + else if (fromCode === CHAR_FORWARD_SLASH) { + lastCommonSep = i; + } + } + if (i === length) { + if (toLen > length) { + if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) { + // We get here if `from` is the exact base path for `to`. + // For example: from='/foo/bar'; to='/foo/bar/baz' + return to.slice(toStart + i + 1); + } + if (i === 0) { + // We get here if `from` is the root + // For example: from='/'; to='/foo' + return to.slice(toStart + i); + } + } + else if (fromLen > length) { + if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) { + // We get here if `to` is the exact base path for `from`. + // For example: from='/foo/bar/baz'; to='/foo/bar' + lastCommonSep = i; + } + else if (i === 0) { + // We get here if `to` is the root. + // For example: from='/foo/bar'; to='/' + lastCommonSep = 0; + } + } + } + let out = ''; + // Generate the relative path based on the path difference between `to` + // and `from`. + for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { + if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) { + out += out.length === 0 ? '..' : '/..'; + } + } + // Lastly, append the rest of the destination (`to`) path that comes after + // the common path parts. + return `${out}${to.slice(toStart + lastCommonSep)}`; + }, + toNamespacedPath(path) { + // Non-op on posix systems + return path; + }, + dirname(path) { + validateString(path, 'path'); + if (path.length === 0) { + return '.'; + } + const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH; + let end = -1; + let matchedSlash = true; + for (let i = path.length - 1; i >= 1; --i) { + if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) { + if (!matchedSlash) { + end = i; + break; + } + } + else { + // We saw the first non-path separator + matchedSlash = false; + } + } + if (end === -1) { + return hasRoot ? '/' : '.'; + } + if (hasRoot && end === 1) { + return '//'; + } + return path.slice(0, end); + }, + basename(path, suffix) { + if (suffix !== undefined) { + validateString(suffix, 'ext'); + } + validateString(path, 'path'); + let start = 0; + let end = -1; + let matchedSlash = true; + let i; + if (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) { + if (suffix === path) { + return ''; + } + let extIdx = suffix.length - 1; + let firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + const code = path.charCodeAt(i); + if (code === CHAR_FORWARD_SLASH) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === suffix.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } + else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) { + end = firstNonSlashEnd; + } + else if (end === -1) { + end = path.length; + } + return path.slice(start, end); + } + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + if (end === -1) { + return ''; + } + return path.slice(start, end); + }, + extname(path) { + validateString(path, 'path'); + let startDot = -1; + let startPart = 0; + let end = -1; + let matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + let preDotState = 0; + for (let i = path.length - 1; i >= 0; --i) { + const code = path.charCodeAt(i); + if (code === CHAR_FORWARD_SLASH) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === CHAR_DOT) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) { + startDot = i; + } + else if (preDotState !== 1) { + preDotState = 1; + } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || + end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + (preDotState === 1 && + startDot === end - 1 && + startDot === startPart + 1)) { + return ''; + } + return path.slice(startDot, end); + }, + format: _format.bind(null, '/'), + parse(path) { + validateString(path, 'path'); + const ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) { + return ret; + } + const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; + let start; + if (isAbsolute) { + ret.root = '/'; + start = 1; + } + else { + start = 0; + } + let startDot = -1; + let startPart = 0; + let end = -1; + let matchedSlash = true; + let i = path.length - 1; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + let preDotState = 0; + // Get non-dir info + for (; i >= start; --i) { + const code = path.charCodeAt(i); + if (code === CHAR_FORWARD_SLASH) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === CHAR_DOT) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) { + startDot = i; + } + else if (preDotState !== 1) { + preDotState = 1; + } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (end !== -1) { + const start = startPart === 0 && isAbsolute ? 1 : startPart; + if (startDot === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + (preDotState === 1 && + startDot === end - 1 && + startDot === startPart + 1)) { + ret.base = ret.name = path.slice(start, end); + } + else { + ret.name = path.slice(start, startDot); + ret.base = path.slice(start, end); + ret.ext = path.slice(startDot, end); + } + } + if (startPart > 0) { + ret.dir = path.slice(0, startPart - 1); + } + else if (isAbsolute) { + ret.dir = '/'; + } + return ret; + }, + sep: '/', + delimiter: ':', + win32: null, + posix: null +}; +posix.win32 = win32.win32 = win32; +posix.posix = win32.posix = posix; +export const normalize = (platformIsWin32 ? win32.normalize : posix.normalize); +export const join = (platformIsWin32 ? win32.join : posix.join); +export const resolve = (platformIsWin32 ? win32.resolve : posix.resolve); +export const relative = (platformIsWin32 ? win32.relative : posix.relative); +export const dirname = (platformIsWin32 ? win32.dirname : posix.dirname); +export const basename = (platformIsWin32 ? win32.basename : posix.basename); +export const extname = (platformIsWin32 ? win32.extname : posix.extname); +export const sep = (platformIsWin32 ? win32.sep : posix.sep); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/platform.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/platform.js new file mode 100644 index 0000000000000000000000000000000000000000..2bf4a301e61c949907119674825201540e9e8ef1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/platform.js @@ -0,0 +1,153 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as nls from '../../nls.js'; +export const LANGUAGE_DEFAULT = 'en'; +let _isWindows = false; +let _isMacintosh = false; +let _isLinux = false; +let _isLinuxSnap = false; +let _isNative = false; +let _isWeb = false; +let _isElectron = false; +let _isIOS = false; +let _isCI = false; +let _isMobile = false; +let _locale = undefined; +let _language = LANGUAGE_DEFAULT; +let _platformLocale = LANGUAGE_DEFAULT; +let _translationsConfigFile = undefined; +let _userAgent = undefined; +const $globalThis = globalThis; +let nodeProcess = undefined; +if (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') { + // Native environment (sandboxed) + nodeProcess = $globalThis.vscode.process; +} +else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') { + // Native environment (non-sandboxed) + nodeProcess = process; +} +const isElectronProcess = typeof nodeProcess?.versions?.electron === 'string'; +const isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer'; +// Native environment +if (typeof nodeProcess === 'object') { + _isWindows = (nodeProcess.platform === 'win32'); + _isMacintosh = (nodeProcess.platform === 'darwin'); + _isLinux = (nodeProcess.platform === 'linux'); + _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION']; + _isElectron = isElectronProcess; + _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY']; + _locale = LANGUAGE_DEFAULT; + _language = LANGUAGE_DEFAULT; + const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG']; + if (rawNlsConfig) { + try { + const nlsConfig = JSON.parse(rawNlsConfig); + _locale = nlsConfig.userLocale; + _platformLocale = nlsConfig.osLocale; + _language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT; + _translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile; + } + catch (e) { + } + } + _isNative = true; +} +// Web environment +else if (typeof navigator === 'object' && !isElectronRenderer) { + _userAgent = navigator.userAgent; + _isWindows = _userAgent.indexOf('Windows') >= 0; + _isMacintosh = _userAgent.indexOf('Macintosh') >= 0; + _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0; + _isLinux = _userAgent.indexOf('Linux') >= 0; + _isMobile = _userAgent?.indexOf('Mobi') >= 0; + _isWeb = true; + _language = nls.getNLSLanguage() || LANGUAGE_DEFAULT; + _locale = navigator.language.toLowerCase(); + _platformLocale = _locale; +} +// Unknown environment +else { + console.error('Unable to resolve platform.'); +} +let _platform = 0 /* Platform.Web */; +if (_isMacintosh) { + _platform = 1 /* Platform.Mac */; +} +else if (_isWindows) { + _platform = 3 /* Platform.Windows */; +} +else if (_isLinux) { + _platform = 2 /* Platform.Linux */; +} +export const isWindows = _isWindows; +export const isMacintosh = _isMacintosh; +export const isLinux = _isLinux; +export const isNative = _isNative; +export const isWeb = _isWeb; +export const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function'); +export const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined; +export const isIOS = _isIOS; +export const isMobile = _isMobile; +export const userAgent = _userAgent; +/** + * The language used for the user interface. The format of + * the string is all lower case (e.g. zh-tw for Traditional + * Chinese or de for German) + */ +export const language = _language; +export const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts); +/** + * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-. + * + * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay + * that browsers set when the nesting level is > 5. + */ +export const setTimeout0 = (() => { + if (setTimeout0IsFaster) { + const pending = []; + $globalThis.addEventListener('message', (e) => { + if (e.data && e.data.vscodeScheduleAsyncWork) { + for (let i = 0, len = pending.length; i < len; i++) { + const candidate = pending[i]; + if (candidate.id === e.data.vscodeScheduleAsyncWork) { + pending.splice(i, 1); + candidate.callback(); + return; + } + } + } + }); + let lastId = 0; + return (callback) => { + const myId = ++lastId; + pending.push({ + id: myId, + callback: callback + }); + $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*'); + }; + } + return (callback) => setTimeout(callback); +})(); +export const OS = (_isMacintosh || _isIOS ? 2 /* OperatingSystem.Macintosh */ : (_isWindows ? 1 /* OperatingSystem.Windows */ : 3 /* OperatingSystem.Linux */)); +let _isLittleEndian = true; +let _isLittleEndianComputed = false; +export function isLittleEndian() { + if (!_isLittleEndianComputed) { + _isLittleEndianComputed = true; + const test = new Uint8Array(2); + test[0] = 1; + test[1] = 2; + const view = new Uint16Array(test.buffer); + _isLittleEndian = (view[0] === (2 << 8) + 1); + } + return _isLittleEndian; +} +export const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0); +export const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0); +export const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0)); +export const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0); +export const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/process.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/process.js new file mode 100644 index 0000000000000000000000000000000000000000..2055113e649893184d86c4bc8c52930438ac33ce --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/process.js @@ -0,0 +1,58 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { isMacintosh, isWindows } from './platform.js'; +let safeProcess; +// Native sandbox environment +const vscodeGlobal = globalThis.vscode; +if (typeof vscodeGlobal !== 'undefined' && typeof vscodeGlobal.process !== 'undefined') { + const sandboxProcess = vscodeGlobal.process; + safeProcess = { + get platform() { return sandboxProcess.platform; }, + get arch() { return sandboxProcess.arch; }, + get env() { return sandboxProcess.env; }, + cwd() { return sandboxProcess.cwd(); } + }; +} +// Native node.js environment +else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') { + safeProcess = { + get platform() { return process.platform; }, + get arch() { return process.arch; }, + get env() { return process.env; }, + cwd() { return process.env['VSCODE_CWD'] || process.cwd(); } + }; +} +// Web environment +else { + safeProcess = { + // Supported + get platform() { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; }, + get arch() { return undefined; /* arch is undefined in web */ }, + // Unsupported + get env() { return {}; }, + cwd() { return '/'; } + }; +} +/** + * Provides safe access to the `cwd` property in node.js, sandboxed or web + * environments. + * + * Note: in web, this property is hardcoded to be `/`. + * + * @skipMangle + */ +export const cwd = safeProcess.cwd; +/** + * Provides safe access to the `env` property in node.js, sandboxed or web + * environments. + * + * Note: in web, this property is hardcoded to be `{}`. + */ +export const env = safeProcess.env; +/** + * Provides safe access to the `platform` property in node.js, sandboxed or web + * environments. + */ +export const platform = safeProcess.platform; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/range.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/range.js new file mode 100644 index 0000000000000000000000000000000000000000..22ed646ee53e71371831b86fe6509f4c4def1a50 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/range.js @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export var Range; +(function (Range) { + /** + * Returns the intersection between two ranges as a range itself. + * Returns `{ start: 0, end: 0 }` if the intersection is empty. + */ + function intersect(one, other) { + if (one.start >= other.end || other.start >= one.end) { + return { start: 0, end: 0 }; + } + const start = Math.max(one.start, other.start); + const end = Math.min(one.end, other.end); + if (end - start <= 0) { + return { start: 0, end: 0 }; + } + return { start, end }; + } + Range.intersect = intersect; + function isEmpty(range) { + return range.end - range.start <= 0; + } + Range.isEmpty = isEmpty; + function intersects(one, other) { + return !isEmpty(intersect(one, other)); + } + Range.intersects = intersects; + function relativeComplement(one, other) { + const result = []; + const first = { start: one.start, end: Math.min(other.start, one.end) }; + const second = { start: Math.max(other.end, one.start), end: one.end }; + if (!isEmpty(first)) { + result.push(first); + } + if (!isEmpty(second)) { + result.push(second); + } + return result; + } + Range.relativeComplement = relativeComplement; +})(Range || (Range = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/resources.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/resources.js new file mode 100644 index 0000000000000000000000000000000000000000..323c9e47d63e233a6559ce2c1e25df3d0c7f7c0a --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/resources.js @@ -0,0 +1,256 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as extpath from './extpath.js'; +import { Schemas } from './network.js'; +import * as paths from './path.js'; +import { isLinux, isWindows } from './platform.js'; +import { compare as strCompare, equalsIgnoreCase } from './strings.js'; +import { URI, uriToFsPath } from './uri.js'; +export function originalFSPath(uri) { + return uriToFsPath(uri, true); +} +export class ExtUri { + constructor(_ignorePathCasing) { + this._ignorePathCasing = _ignorePathCasing; + } + compare(uri1, uri2, ignoreFragment = false) { + if (uri1 === uri2) { + return 0; + } + return strCompare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment)); + } + isEqual(uri1, uri2, ignoreFragment = false) { + if (uri1 === uri2) { + return true; + } + if (!uri1 || !uri2) { + return false; + } + return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment); + } + getComparisonKey(uri, ignoreFragment = false) { + return uri.with({ + path: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : undefined, + fragment: ignoreFragment ? null : undefined + }).toString(); + } + isEqualOrParent(base, parentCandidate, ignoreFragment = false) { + if (base.scheme === parentCandidate.scheme) { + if (base.scheme === Schemas.file) { + return extpath.isEqualOrParent(originalFSPath(base), originalFSPath(parentCandidate), this._ignorePathCasing(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment); + } + if (isEqualAuthority(base.authority, parentCandidate.authority)) { + return extpath.isEqualOrParent(base.path, parentCandidate.path, this._ignorePathCasing(base), '/') && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment); + } + } + return false; + } + // --- path math + joinPath(resource, ...pathFragment) { + return URI.joinPath(resource, ...pathFragment); + } + basenameOrAuthority(resource) { + return basename(resource) || resource.authority; + } + basename(resource) { + return paths.posix.basename(resource.path); + } + extname(resource) { + return paths.posix.extname(resource.path); + } + dirname(resource) { + if (resource.path.length === 0) { + return resource; + } + let dirname; + if (resource.scheme === Schemas.file) { + dirname = URI.file(paths.dirname(originalFSPath(resource))).path; + } + else { + dirname = paths.posix.dirname(resource.path); + if (resource.authority && dirname.length && dirname.charCodeAt(0) !== 47 /* CharCode.Slash */) { + console.error(`dirname("${resource.toString})) resulted in a relative path`); + dirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash ("/") character + } + } + return resource.with({ + path: dirname + }); + } + normalizePath(resource) { + if (!resource.path.length) { + return resource; + } + let normalizedPath; + if (resource.scheme === Schemas.file) { + normalizedPath = URI.file(paths.normalize(originalFSPath(resource))).path; + } + else { + normalizedPath = paths.posix.normalize(resource.path); + } + return resource.with({ + path: normalizedPath + }); + } + relativePath(from, to) { + if (from.scheme !== to.scheme || !isEqualAuthority(from.authority, to.authority)) { + return undefined; + } + if (from.scheme === Schemas.file) { + const relativePath = paths.relative(originalFSPath(from), originalFSPath(to)); + return isWindows ? extpath.toSlashes(relativePath) : relativePath; + } + let fromPath = from.path || '/'; + const toPath = to.path || '/'; + if (this._ignorePathCasing(from)) { + // make casing of fromPath match toPath + let i = 0; + for (const len = Math.min(fromPath.length, toPath.length); i < len; i++) { + if (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) { + if (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) { + break; + } + } + } + fromPath = toPath.substr(0, i) + fromPath.substr(i); + } + return paths.posix.relative(fromPath, toPath); + } + resolvePath(base, path) { + if (base.scheme === Schemas.file) { + const newURI = URI.file(paths.resolve(originalFSPath(base), path)); + return base.with({ + authority: newURI.authority, + path: newURI.path + }); + } + path = extpath.toPosixPath(path); // we allow path to be a windows path + return base.with({ + path: paths.posix.resolve(base.path, path) + }); + } + // --- misc + isAbsolutePath(resource) { + return !!resource.path && resource.path[0] === '/'; + } + isEqualAuthority(a1, a2) { + return a1 === a2 || (a1 !== undefined && a2 !== undefined && equalsIgnoreCase(a1, a2)); + } + hasTrailingPathSeparator(resource, sep = paths.sep) { + if (resource.scheme === Schemas.file) { + const fsp = originalFSPath(resource); + return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep; + } + else { + const p = resource.path; + return (p.length > 1 && p.charCodeAt(p.length - 1) === 47 /* CharCode.Slash */) && !(/^[a-zA-Z]:(\/$|\\$)/.test(resource.fsPath)); // ignore the slash at offset 0 + } + } + removeTrailingPathSeparator(resource, sep = paths.sep) { + // Make sure that the path isn't a drive letter. A trailing separator there is not removable. + if (hasTrailingPathSeparator(resource, sep)) { + return resource.with({ path: resource.path.substr(0, resource.path.length - 1) }); + } + return resource; + } + addTrailingPathSeparator(resource, sep = paths.sep) { + let isRootSep = false; + if (resource.scheme === Schemas.file) { + const fsp = originalFSPath(resource); + isRootSep = ((fsp !== undefined) && (fsp.length === extpath.getRoot(fsp).length) && (fsp[fsp.length - 1] === sep)); + } + else { + sep = '/'; + const p = resource.path; + isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === 47 /* CharCode.Slash */; + } + if (!isRootSep && !hasTrailingPathSeparator(resource, sep)) { + return resource.with({ path: resource.path + '/' }); + } + return resource; + } +} +/** + * Unbiased utility that takes uris "as they are". This means it can be interchanged with + * uri#toString() usages. The following is true + * ``` + * assertEqual(aUri.toString() === bUri.toString(), exturi.isEqual(aUri, bUri)) + * ``` + */ +export const extUri = new ExtUri(() => false); +/** + * BIASED utility that _mostly_ ignored the case of urs paths. ONLY use this util if you + * understand what you are doing. + * + * This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged. + * + * When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient + * because those uris come from a "trustworthy source". When creating unknown uris it's always + * better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path + * casing matters. + */ +export const extUriBiasedIgnorePathCase = new ExtUri(uri => { + // A file scheme resource is in the same platform as code, so ignore case for non linux platforms + // Resource can be from another platform. Lowering the case as an hack. Should come from File system provider + return uri.scheme === Schemas.file ? !isLinux : true; +}); +/** + * BIASED utility that always ignores the casing of uris paths. ONLY use this util if you + * understand what you are doing. + * + * This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged. + * + * When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient + * because those uris come from a "trustworthy source". When creating unknown uris it's always + * better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path + * casing matters. + */ +export const extUriIgnorePathCase = new ExtUri(_ => true); +export const isEqual = extUri.isEqual.bind(extUri); +export const isEqualOrParent = extUri.isEqualOrParent.bind(extUri); +export const getComparisonKey = extUri.getComparisonKey.bind(extUri); +export const basenameOrAuthority = extUri.basenameOrAuthority.bind(extUri); +export const basename = extUri.basename.bind(extUri); +export const extname = extUri.extname.bind(extUri); +export const dirname = extUri.dirname.bind(extUri); +export const joinPath = extUri.joinPath.bind(extUri); +export const normalizePath = extUri.normalizePath.bind(extUri); +export const relativePath = extUri.relativePath.bind(extUri); +export const resolvePath = extUri.resolvePath.bind(extUri); +export const isAbsolutePath = extUri.isAbsolutePath.bind(extUri); +export const isEqualAuthority = extUri.isEqualAuthority.bind(extUri); +export const hasTrailingPathSeparator = extUri.hasTrailingPathSeparator.bind(extUri); +export const removeTrailingPathSeparator = extUri.removeTrailingPathSeparator.bind(extUri); +export const addTrailingPathSeparator = extUri.addTrailingPathSeparator.bind(extUri); +/** + * Data URI related helpers. + */ +export var DataUri; +(function (DataUri) { + DataUri.META_DATA_LABEL = 'label'; + DataUri.META_DATA_DESCRIPTION = 'description'; + DataUri.META_DATA_SIZE = 'size'; + DataUri.META_DATA_MIME = 'mime'; + function parseMetaData(dataUri) { + const metadata = new Map(); + // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5... + // the metadata is: size:2313;label:SomeLabel;description:SomeDescription + const meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';')); + meta.split(';').forEach(property => { + const [key, value] = property.split(':'); + if (key && value) { + metadata.set(key, value); + } + }); + // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5... + // the mime is: image/png + const mime = dataUri.path.substring(0, dataUri.path.indexOf(';')); + if (mime) { + metadata.set(DataUri.META_DATA_MIME, mime); + } + return metadata; + } + DataUri.parseMetaData = parseMetaData; +})(DataUri || (DataUri = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/scrollable.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/scrollable.js new file mode 100644 index 0000000000000000000000000000000000000000..20e6f89dc126bee10e92a2505e8cbb0699b53290 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/scrollable.js @@ -0,0 +1,320 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Emitter } from './event.js'; +import { Disposable } from './lifecycle.js'; +export class ScrollState { + constructor(_forceIntegerValues, width, scrollWidth, scrollLeft, height, scrollHeight, scrollTop) { + this._forceIntegerValues = _forceIntegerValues; + this._scrollStateBrand = undefined; + if (this._forceIntegerValues) { + width = width | 0; + scrollWidth = scrollWidth | 0; + scrollLeft = scrollLeft | 0; + height = height | 0; + scrollHeight = scrollHeight | 0; + scrollTop = scrollTop | 0; + } + this.rawScrollLeft = scrollLeft; // before validation + this.rawScrollTop = scrollTop; // before validation + if (width < 0) { + width = 0; + } + if (scrollLeft + width > scrollWidth) { + scrollLeft = scrollWidth - width; + } + if (scrollLeft < 0) { + scrollLeft = 0; + } + if (height < 0) { + height = 0; + } + if (scrollTop + height > scrollHeight) { + scrollTop = scrollHeight - height; + } + if (scrollTop < 0) { + scrollTop = 0; + } + this.width = width; + this.scrollWidth = scrollWidth; + this.scrollLeft = scrollLeft; + this.height = height; + this.scrollHeight = scrollHeight; + this.scrollTop = scrollTop; + } + equals(other) { + return (this.rawScrollLeft === other.rawScrollLeft + && this.rawScrollTop === other.rawScrollTop + && this.width === other.width + && this.scrollWidth === other.scrollWidth + && this.scrollLeft === other.scrollLeft + && this.height === other.height + && this.scrollHeight === other.scrollHeight + && this.scrollTop === other.scrollTop); + } + withScrollDimensions(update, useRawScrollPositions) { + return new ScrollState(this._forceIntegerValues, (typeof update.width !== 'undefined' ? update.width : this.width), (typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth), useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft, (typeof update.height !== 'undefined' ? update.height : this.height), (typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight), useRawScrollPositions ? this.rawScrollTop : this.scrollTop); + } + withScrollPosition(update) { + return new ScrollState(this._forceIntegerValues, this.width, this.scrollWidth, (typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft), this.height, this.scrollHeight, (typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop)); + } + createScrollEvent(previous, inSmoothScrolling) { + const widthChanged = (this.width !== previous.width); + const scrollWidthChanged = (this.scrollWidth !== previous.scrollWidth); + const scrollLeftChanged = (this.scrollLeft !== previous.scrollLeft); + const heightChanged = (this.height !== previous.height); + const scrollHeightChanged = (this.scrollHeight !== previous.scrollHeight); + const scrollTopChanged = (this.scrollTop !== previous.scrollTop); + return { + inSmoothScrolling: inSmoothScrolling, + oldWidth: previous.width, + oldScrollWidth: previous.scrollWidth, + oldScrollLeft: previous.scrollLeft, + width: this.width, + scrollWidth: this.scrollWidth, + scrollLeft: this.scrollLeft, + oldHeight: previous.height, + oldScrollHeight: previous.scrollHeight, + oldScrollTop: previous.scrollTop, + height: this.height, + scrollHeight: this.scrollHeight, + scrollTop: this.scrollTop, + widthChanged: widthChanged, + scrollWidthChanged: scrollWidthChanged, + scrollLeftChanged: scrollLeftChanged, + heightChanged: heightChanged, + scrollHeightChanged: scrollHeightChanged, + scrollTopChanged: scrollTopChanged, + }; + } +} +export class Scrollable extends Disposable { + constructor(options) { + super(); + this._scrollableBrand = undefined; + this._onScroll = this._register(new Emitter()); + this.onScroll = this._onScroll.event; + this._smoothScrollDuration = options.smoothScrollDuration; + this._scheduleAtNextAnimationFrame = options.scheduleAtNextAnimationFrame; + this._state = new ScrollState(options.forceIntegerValues, 0, 0, 0, 0, 0, 0); + this._smoothScrolling = null; + } + dispose() { + if (this._smoothScrolling) { + this._smoothScrolling.dispose(); + this._smoothScrolling = null; + } + super.dispose(); + } + setSmoothScrollDuration(smoothScrollDuration) { + this._smoothScrollDuration = smoothScrollDuration; + } + validateScrollPosition(scrollPosition) { + return this._state.withScrollPosition(scrollPosition); + } + getScrollDimensions() { + return this._state; + } + setScrollDimensions(dimensions, useRawScrollPositions) { + const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions); + this._setState(newState, Boolean(this._smoothScrolling)); + // Validate outstanding animated scroll position target + this._smoothScrolling?.acceptScrollDimensions(this._state); + } + /** + * Returns the final scroll position that the instance will have once the smooth scroll animation concludes. + * If no scroll animation is occurring, it will return the current scroll position instead. + */ + getFutureScrollPosition() { + if (this._smoothScrolling) { + return this._smoothScrolling.to; + } + return this._state; + } + /** + * Returns the current scroll position. + * Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation. + */ + getCurrentScrollPosition() { + return this._state; + } + setScrollPositionNow(update) { + // no smooth scrolling requested + const newState = this._state.withScrollPosition(update); + // Terminate any outstanding smooth scrolling + if (this._smoothScrolling) { + this._smoothScrolling.dispose(); + this._smoothScrolling = null; + } + this._setState(newState, false); + } + setScrollPositionSmooth(update, reuseAnimation) { + if (this._smoothScrollDuration === 0) { + // Smooth scrolling not supported. + return this.setScrollPositionNow(update); + } + if (this._smoothScrolling) { + // Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop + update = { + scrollLeft: (typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft), + scrollTop: (typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop) + }; + // Validate `update` + const validTarget = this._state.withScrollPosition(update); + if (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) { + // No need to interrupt or extend the current animation since we're going to the same place + return; + } + let newSmoothScrolling; + if (reuseAnimation) { + newSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration); + } + else { + newSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration); + } + this._smoothScrolling.dispose(); + this._smoothScrolling = newSmoothScrolling; + } + else { + // Validate `update` + const validTarget = this._state.withScrollPosition(update); + this._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration); + } + // Begin smooth scrolling animation + this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => { + if (!this._smoothScrolling) { + return; + } + this._smoothScrolling.animationFrameDisposable = null; + this._performSmoothScrolling(); + }); + } + hasPendingScrollAnimation() { + return Boolean(this._smoothScrolling); + } + _performSmoothScrolling() { + if (!this._smoothScrolling) { + return; + } + const update = this._smoothScrolling.tick(); + const newState = this._state.withScrollPosition(update); + this._setState(newState, true); + if (!this._smoothScrolling) { + // Looks like someone canceled the smooth scrolling + // from the scroll event handler + return; + } + if (update.isDone) { + this._smoothScrolling.dispose(); + this._smoothScrolling = null; + return; + } + // Continue smooth scrolling animation + this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => { + if (!this._smoothScrolling) { + return; + } + this._smoothScrolling.animationFrameDisposable = null; + this._performSmoothScrolling(); + }); + } + _setState(newState, inSmoothScrolling) { + const oldState = this._state; + if (oldState.equals(newState)) { + // no change + return; + } + this._state = newState; + this._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling)); + } +} +export class SmoothScrollingUpdate { + constructor(scrollLeft, scrollTop, isDone) { + this.scrollLeft = scrollLeft; + this.scrollTop = scrollTop; + this.isDone = isDone; + } +} +function createEaseOutCubic(from, to) { + const delta = to - from; + return function (completion) { + return from + delta * easeOutCubic(completion); + }; +} +function createComposed(a, b, cut) { + return function (completion) { + if (completion < cut) { + return a(completion / cut); + } + return b((completion - cut) / (1 - cut)); + }; +} +export class SmoothScrollingOperation { + constructor(from, to, startTime, duration) { + this.from = from; + this.to = to; + this.duration = duration; + this.startTime = startTime; + this.animationFrameDisposable = null; + this._initAnimations(); + } + _initAnimations() { + this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width); + this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height); + } + _initAnimation(from, to, viewportSize) { + const delta = Math.abs(from - to); + if (delta > 2.5 * viewportSize) { + let stop1, stop2; + if (from < to) { + // scroll to 75% of the viewportSize + stop1 = from + 0.75 * viewportSize; + stop2 = to - 0.75 * viewportSize; + } + else { + stop1 = from - 0.75 * viewportSize; + stop2 = to + 0.75 * viewportSize; + } + return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33); + } + return createEaseOutCubic(from, to); + } + dispose() { + if (this.animationFrameDisposable !== null) { + this.animationFrameDisposable.dispose(); + this.animationFrameDisposable = null; + } + } + acceptScrollDimensions(state) { + this.to = state.withScrollPosition(this.to); + this._initAnimations(); + } + tick() { + return this._tick(Date.now()); + } + _tick(now) { + const completion = (now - this.startTime) / this.duration; + if (completion < 1) { + const newScrollLeft = this.scrollLeft(completion); + const newScrollTop = this.scrollTop(completion); + return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false); + } + return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true); + } + combine(from, to, duration) { + return SmoothScrollingOperation.start(from, to, duration); + } + static start(from, to, duration) { + // +10 / -10 : pretend the animation already started for a quicker response to a scroll request + duration = duration + 10; + const startTime = Date.now() - 10; + return new SmoothScrollingOperation(from, to, startTime, duration); + } +} +function easeInCubic(t) { + return Math.pow(t, 3); +} +function easeOutCubic(t) { + return 1 - easeInCubic(1 - t); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/search.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/search.js new file mode 100644 index 0000000000000000000000000000000000000000..c5a5545cbd2549f901755efa40959ebb4397fd52 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/search.js @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as strings from './strings.js'; +export function buildReplaceStringWithCasePreserved(matches, pattern) { + if (matches && (matches[0] !== '')) { + const containsHyphens = validateSpecificSpecialCharacter(matches, pattern, '-'); + const containsUnderscores = validateSpecificSpecialCharacter(matches, pattern, '_'); + if (containsHyphens && !containsUnderscores) { + return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '-'); + } + else if (!containsHyphens && containsUnderscores) { + return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '_'); + } + if (matches[0].toUpperCase() === matches[0]) { + return pattern.toUpperCase(); + } + else if (matches[0].toLowerCase() === matches[0]) { + return pattern.toLowerCase(); + } + else if (strings.containsUppercaseCharacter(matches[0][0]) && pattern.length > 0) { + return pattern[0].toUpperCase() + pattern.substr(1); + } + else if (matches[0][0].toUpperCase() !== matches[0][0] && pattern.length > 0) { + return pattern[0].toLowerCase() + pattern.substr(1); + } + else { + // we don't understand its pattern yet. + return pattern; + } + } + else { + return pattern; + } +} +function validateSpecificSpecialCharacter(matches, pattern, specialCharacter) { + const doesContainSpecialCharacter = matches[0].indexOf(specialCharacter) !== -1 && pattern.indexOf(specialCharacter) !== -1; + return doesContainSpecialCharacter && matches[0].split(specialCharacter).length === pattern.split(specialCharacter).length; +} +function buildReplaceStringForSpecificSpecialCharacter(matches, pattern, specialCharacter) { + const splitPatternAtSpecialCharacter = pattern.split(specialCharacter); + const splitMatchAtSpecialCharacter = matches[0].split(specialCharacter); + let replaceString = ''; + splitPatternAtSpecialCharacter.forEach((splitValue, index) => { + replaceString += buildReplaceStringWithCasePreserved([splitMatchAtSpecialCharacter[index]], splitValue) + specialCharacter; + }); + return replaceString.slice(0, -1); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/sequence.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/sequence.js new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/sequence.js @@ -0,0 +1 @@ +export {}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/severity.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/severity.js new file mode 100644 index 0000000000000000000000000000000000000000..0907f709fbd71a2e99d30d0fc044838f8a9bde53 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/severity.js @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as strings from './strings.js'; +var Severity; +(function (Severity) { + Severity[Severity["Ignore"] = 0] = "Ignore"; + Severity[Severity["Info"] = 1] = "Info"; + Severity[Severity["Warning"] = 2] = "Warning"; + Severity[Severity["Error"] = 3] = "Error"; +})(Severity || (Severity = {})); +(function (Severity) { + const _error = 'error'; + const _warning = 'warning'; + const _warn = 'warn'; + const _info = 'info'; + const _ignore = 'ignore'; + /** + * Parses 'error', 'warning', 'warn', 'info' in call casings + * and falls back to ignore. + */ + function fromValue(value) { + if (!value) { + return Severity.Ignore; + } + if (strings.equalsIgnoreCase(_error, value)) { + return Severity.Error; + } + if (strings.equalsIgnoreCase(_warning, value) || strings.equalsIgnoreCase(_warn, value)) { + return Severity.Warning; + } + if (strings.equalsIgnoreCase(_info, value)) { + return Severity.Info; + } + return Severity.Ignore; + } + Severity.fromValue = fromValue; + function toString(severity) { + switch (severity) { + case Severity.Error: return _error; + case Severity.Warning: return _warning; + case Severity.Info: return _info; + default: return _ignore; + } + } + Severity.toString = toString; +})(Severity || (Severity = {})); +export default Severity; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/stopwatch.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/stopwatch.js new file mode 100644 index 0000000000000000000000000000000000000000..df21fc1826dc4d2f95657a2396305b54bab553af --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/stopwatch.js @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function'); +export class StopWatch { + static create(highResolution) { + return new StopWatch(highResolution); + } + constructor(highResolution) { + this._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance.now.bind(globalThis.performance); + this._startTime = this._now(); + this._stopTime = -1; + } + stop() { + this._stopTime = this._now(); + } + reset() { + this._startTime = this._now(); + this._stopTime = -1; + } + elapsed() { + if (this._stopTime !== -1) { + return this._stopTime - this._startTime; + } + return this._now() - this._startTime; + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/strings.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/strings.js new file mode 100644 index 0000000000000000000000000000000000000000..148a870034d853831adca208b00af4485bd56d07 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/strings.js @@ -0,0 +1,840 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { LRUCachedFunction } from './cache.js'; +import { Lazy } from './lazy.js'; +export function isFalsyOrWhitespace(str) { + if (!str || typeof str !== 'string') { + return true; + } + return str.trim().length === 0; +} +const _formatRegexp = /{(\d+)}/g; +/** + * Helper to produce a string with a variable number of arguments. Insert variable segments + * into the string using the {n} notation where N is the index of the argument following the string. + * @param value string to which formatting is applied + * @param args replacements for {n}-entries + */ +export function format(value, ...args) { + if (args.length === 0) { + return value; + } + return value.replace(_formatRegexp, function (match, group) { + const idx = parseInt(group, 10); + return isNaN(idx) || idx < 0 || idx >= args.length ? + match : + args[idx]; + }); +} +/** + * Encodes the given value so that it can be used as literal value in html attributes. + * + * In other words, computes `$val`, such that `attr` in `
    ` has the runtime value `value`. + * This prevents XSS injection. + */ +export function htmlAttributeEncodeValue(value) { + return value.replace(/[<>"'&]/g, ch => { + switch (ch) { + case '<': return '<'; + case '>': return '>'; + case '"': return '"'; + case '\'': return '''; + case '&': return '&'; + } + return ch; + }); +} +/** + * Converts HTML characters inside the string to use entities instead. Makes the string safe from + * being used e.g. in HTMLElement.innerHTML. + */ +export function escape(html) { + return html.replace(/[<>&]/g, function (match) { + switch (match) { + case '<': return '<'; + case '>': return '>'; + case '&': return '&'; + default: return match; + } + }); +} +/** + * Escapes regular expression characters in a given string + */ +export function escapeRegExpCharacters(value) { + return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, '\\$&'); +} +/** + * Removes all occurrences of needle from the beginning and end of haystack. + * @param haystack string to trim + * @param needle the thing to trim (default is a blank) + */ +export function trim(haystack, needle = ' ') { + const trimmed = ltrim(haystack, needle); + return rtrim(trimmed, needle); +} +/** + * Removes all occurrences of needle from the beginning of haystack. + * @param haystack string to trim + * @param needle the thing to trim + */ +export function ltrim(haystack, needle) { + if (!haystack || !needle) { + return haystack; + } + const needleLen = needle.length; + if (needleLen === 0 || haystack.length === 0) { + return haystack; + } + let offset = 0; + while (haystack.indexOf(needle, offset) === offset) { + offset = offset + needleLen; + } + return haystack.substring(offset); +} +/** + * Removes all occurrences of needle from the end of haystack. + * @param haystack string to trim + * @param needle the thing to trim + */ +export function rtrim(haystack, needle) { + if (!haystack || !needle) { + return haystack; + } + const needleLen = needle.length, haystackLen = haystack.length; + if (needleLen === 0 || haystackLen === 0) { + return haystack; + } + let offset = haystackLen, idx = -1; + while (true) { + idx = haystack.lastIndexOf(needle, offset - 1); + if (idx === -1 || idx + needleLen !== offset) { + break; + } + if (idx === 0) { + return ''; + } + offset = idx; + } + return haystack.substring(0, offset); +} +export function convertSimple2RegExpPattern(pattern) { + return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*'); +} +export function stripWildcards(pattern) { + return pattern.replace(/\*/g, ''); +} +export function createRegExp(searchString, isRegex, options = {}) { + if (!searchString) { + throw new Error('Cannot create regex from empty string'); + } + if (!isRegex) { + searchString = escapeRegExpCharacters(searchString); + } + if (options.wholeWord) { + if (!/\B/.test(searchString.charAt(0))) { + searchString = '\\b' + searchString; + } + if (!/\B/.test(searchString.charAt(searchString.length - 1))) { + searchString = searchString + '\\b'; + } + } + let modifiers = ''; + if (options.global) { + modifiers += 'g'; + } + if (!options.matchCase) { + modifiers += 'i'; + } + if (options.multiline) { + modifiers += 'm'; + } + if (options.unicode) { + modifiers += 'u'; + } + return new RegExp(searchString, modifiers); +} +export function regExpLeadsToEndlessLoop(regexp) { + // Exit early if it's one of these special cases which are meant to match + // against an empty string + if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\s*$') { + return false; + } + // We check against an empty string. If the regular expression doesn't advance + // (e.g. ends in an endless loop) it will match an empty string. + const match = regexp.exec(''); + return !!(match && regexp.lastIndex === 0); +} +export function splitLines(str) { + return str.split(/\r\n|\r|\n/); +} +export function splitLinesIncludeSeparators(str) { + const linesWithSeparators = []; + const splitLinesAndSeparators = str.split(/(\r\n|\r|\n)/); + for (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) { + linesWithSeparators.push(splitLinesAndSeparators[2 * i] + (splitLinesAndSeparators[2 * i + 1] ?? '')); + } + return linesWithSeparators; +} +/** + * Returns first index of the string that is not whitespace. + * If string is empty or contains only whitespaces, returns -1 + */ +export function firstNonWhitespaceIndex(str) { + for (let i = 0, len = str.length; i < len; i++) { + const chCode = str.charCodeAt(i); + if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) { + return i; + } + } + return -1; +} +/** + * Returns the leading whitespace of the string. + * If the string contains only whitespaces, returns entire string + */ +export function getLeadingWhitespace(str, start = 0, end = str.length) { + for (let i = start; i < end; i++) { + const chCode = str.charCodeAt(i); + if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) { + return str.substring(start, i); + } + } + return str.substring(start, end); +} +/** + * Returns last index of the string that is not whitespace. + * If string is empty or contains only whitespaces, returns -1 + */ +export function lastNonWhitespaceIndex(str, startIndex = str.length - 1) { + for (let i = startIndex; i >= 0; i--) { + const chCode = str.charCodeAt(i); + if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) { + return i; + } + } + return -1; +} +export function compare(a, b) { + if (a < b) { + return -1; + } + else if (a > b) { + return 1; + } + else { + return 0; + } +} +export function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) { + for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) { + const codeA = a.charCodeAt(aStart); + const codeB = b.charCodeAt(bStart); + if (codeA < codeB) { + return -1; + } + else if (codeA > codeB) { + return 1; + } + } + const aLen = aEnd - aStart; + const bLen = bEnd - bStart; + if (aLen < bLen) { + return -1; + } + else if (aLen > bLen) { + return 1; + } + return 0; +} +export function compareIgnoreCase(a, b) { + return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length); +} +export function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) { + for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) { + let codeA = a.charCodeAt(aStart); + let codeB = b.charCodeAt(bStart); + if (codeA === codeB) { + // equal + continue; + } + if (codeA >= 128 || codeB >= 128) { + // not ASCII letters -> fallback to lower-casing strings + return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd); + } + // mapper lower-case ascii letter onto upper-case varinats + // [97-122] (lower ascii) --> [65-90] (upper ascii) + if (isLowerAsciiLetter(codeA)) { + codeA -= 32; + } + if (isLowerAsciiLetter(codeB)) { + codeB -= 32; + } + // compare both code points + const diff = codeA - codeB; + if (diff === 0) { + continue; + } + return diff; + } + const aLen = aEnd - aStart; + const bLen = bEnd - bStart; + if (aLen < bLen) { + return -1; + } + else if (aLen > bLen) { + return 1; + } + return 0; +} +export function isAsciiDigit(code) { + return code >= 48 /* CharCode.Digit0 */ && code <= 57 /* CharCode.Digit9 */; +} +export function isLowerAsciiLetter(code) { + return code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */; +} +export function isUpperAsciiLetter(code) { + return code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */; +} +export function equalsIgnoreCase(a, b) { + return a.length === b.length && compareSubstringIgnoreCase(a, b) === 0; +} +export function startsWithIgnoreCase(str, candidate) { + const candidateLength = candidate.length; + if (candidate.length > str.length) { + return false; + } + return compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0; +} +/** + * @returns the length of the common prefix of the two strings. + */ +export function commonPrefixLength(a, b) { + const len = Math.min(a.length, b.length); + let i; + for (i = 0; i < len; i++) { + if (a.charCodeAt(i) !== b.charCodeAt(i)) { + return i; + } + } + return len; +} +/** + * @returns the length of the common suffix of the two strings. + */ +export function commonSuffixLength(a, b) { + const len = Math.min(a.length, b.length); + let i; + const aLastIndex = a.length - 1; + const bLastIndex = b.length - 1; + for (i = 0; i < len; i++) { + if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) { + return i; + } + } + return len; +} +/** + * See http://en.wikipedia.org/wiki/Surrogate_pair + */ +export function isHighSurrogate(charCode) { + return (0xD800 <= charCode && charCode <= 0xDBFF); +} +/** + * See http://en.wikipedia.org/wiki/Surrogate_pair + */ +export function isLowSurrogate(charCode) { + return (0xDC00 <= charCode && charCode <= 0xDFFF); +} +/** + * See http://en.wikipedia.org/wiki/Surrogate_pair + */ +export function computeCodePoint(highSurrogate, lowSurrogate) { + return ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000; +} +/** + * get the code point that begins at offset `offset` + */ +export function getNextCodePoint(str, len, offset) { + const charCode = str.charCodeAt(offset); + if (isHighSurrogate(charCode) && offset + 1 < len) { + const nextCharCode = str.charCodeAt(offset + 1); + if (isLowSurrogate(nextCharCode)) { + return computeCodePoint(charCode, nextCharCode); + } + } + return charCode; +} +/** + * get the code point that ends right before offset `offset` + */ +function getPrevCodePoint(str, offset) { + const charCode = str.charCodeAt(offset - 1); + if (isLowSurrogate(charCode) && offset > 1) { + const prevCharCode = str.charCodeAt(offset - 2); + if (isHighSurrogate(prevCharCode)) { + return computeCodePoint(prevCharCode, charCode); + } + } + return charCode; +} +export class CodePointIterator { + get offset() { + return this._offset; + } + constructor(str, offset = 0) { + this._str = str; + this._len = str.length; + this._offset = offset; + } + setOffset(offset) { + this._offset = offset; + } + prevCodePoint() { + const codePoint = getPrevCodePoint(this._str, this._offset); + this._offset -= (codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1); + return codePoint; + } + nextCodePoint() { + const codePoint = getNextCodePoint(this._str, this._len, this._offset); + this._offset += (codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1); + return codePoint; + } + eol() { + return (this._offset >= this._len); + } +} +export class GraphemeIterator { + get offset() { + return this._iterator.offset; + } + constructor(str, offset = 0) { + this._iterator = new CodePointIterator(str, offset); + } + nextGraphemeLength() { + const graphemeBreakTree = GraphemeBreakTree.getInstance(); + const iterator = this._iterator; + const initialOffset = iterator.offset; + let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint()); + while (!iterator.eol()) { + const offset = iterator.offset; + const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint()); + if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) { + // move iterator back + iterator.setOffset(offset); + break; + } + graphemeBreakType = nextGraphemeBreakType; + } + return (iterator.offset - initialOffset); + } + prevGraphemeLength() { + const graphemeBreakTree = GraphemeBreakTree.getInstance(); + const iterator = this._iterator; + const initialOffset = iterator.offset; + let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint()); + while (iterator.offset > 0) { + const offset = iterator.offset; + const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint()); + if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) { + // move iterator back + iterator.setOffset(offset); + break; + } + graphemeBreakType = prevGraphemeBreakType; + } + return (initialOffset - iterator.offset); + } + eol() { + return this._iterator.eol(); + } +} +export function nextCharLength(str, initialOffset) { + const iterator = new GraphemeIterator(str, initialOffset); + return iterator.nextGraphemeLength(); +} +export function prevCharLength(str, initialOffset) { + const iterator = new GraphemeIterator(str, initialOffset); + return iterator.prevGraphemeLength(); +} +export function getCharContainingOffset(str, offset) { + if (offset > 0 && isLowSurrogate(str.charCodeAt(offset))) { + offset--; + } + const endOffset = offset + nextCharLength(str, offset); + const startOffset = endOffset - prevCharLength(str, endOffset); + return [startOffset, endOffset]; +} +let CONTAINS_RTL = undefined; +function makeContainsRtl() { + // Generated using https://github.com/alexdima/unicode-utils/blob/main/rtl-test.js + return /(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/; +} +/** + * Returns true if `str` contains any Unicode character that is classified as "R" or "AL". + */ +export function containsRTL(str) { + if (!CONTAINS_RTL) { + CONTAINS_RTL = makeContainsRtl(); + } + return CONTAINS_RTL.test(str); +} +const IS_BASIC_ASCII = /^[\t\n\r\x20-\x7E]*$/; +/** + * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \n, \r, \t + */ +export function isBasicASCII(str) { + return IS_BASIC_ASCII.test(str); +} +export const UNUSUAL_LINE_TERMINATORS = /[\u2028\u2029]/; // LINE SEPARATOR (LS) or PARAGRAPH SEPARATOR (PS) +/** + * Returns true if `str` contains unusual line terminators, like LS or PS + */ +export function containsUnusualLineTerminators(str) { + return UNUSUAL_LINE_TERMINATORS.test(str); +} +export function isFullWidthCharacter(charCode) { + // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns + // http://jrgraphix.net/research/unicode_blocks.php + // 2E80 - 2EFF CJK Radicals Supplement + // 2F00 - 2FDF Kangxi Radicals + // 2FF0 - 2FFF Ideographic Description Characters + // 3000 - 303F CJK Symbols and Punctuation + // 3040 - 309F Hiragana + // 30A0 - 30FF Katakana + // 3100 - 312F Bopomofo + // 3130 - 318F Hangul Compatibility Jamo + // 3190 - 319F Kanbun + // 31A0 - 31BF Bopomofo Extended + // 31F0 - 31FF Katakana Phonetic Extensions + // 3200 - 32FF Enclosed CJK Letters and Months + // 3300 - 33FF CJK Compatibility + // 3400 - 4DBF CJK Unified Ideographs Extension A + // 4DC0 - 4DFF Yijing Hexagram Symbols + // 4E00 - 9FFF CJK Unified Ideographs + // A000 - A48F Yi Syllables + // A490 - A4CF Yi Radicals + // AC00 - D7AF Hangul Syllables + // [IGNORE] D800 - DB7F High Surrogates + // [IGNORE] DB80 - DBFF High Private Use Surrogates + // [IGNORE] DC00 - DFFF Low Surrogates + // [IGNORE] E000 - F8FF Private Use Area + // F900 - FAFF CJK Compatibility Ideographs + // [IGNORE] FB00 - FB4F Alphabetic Presentation Forms + // [IGNORE] FB50 - FDFF Arabic Presentation Forms-A + // [IGNORE] FE00 - FE0F Variation Selectors + // [IGNORE] FE20 - FE2F Combining Half Marks + // [IGNORE] FE30 - FE4F CJK Compatibility Forms + // [IGNORE] FE50 - FE6F Small Form Variants + // [IGNORE] FE70 - FEFF Arabic Presentation Forms-B + // FF00 - FFEF Halfwidth and Fullwidth Forms + // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms] + // of which FF01 - FF5E fullwidth ASCII of 21 to 7E + // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul + // [IGNORE] FFF0 - FFFF Specials + return ((charCode >= 0x2E80 && charCode <= 0xD7AF) + || (charCode >= 0xF900 && charCode <= 0xFAFF) + || (charCode >= 0xFF01 && charCode <= 0xFF5E)); +} +/** + * A fast function (therefore imprecise) to check if code points are emojis. + * Generated using https://github.com/alexdima/unicode-utils/blob/main/emoji-test.js + */ +export function isEmojiImprecise(x) { + return ((x >= 0x1F1E6 && x <= 0x1F1FF) || (x === 8986) || (x === 8987) || (x === 9200) + || (x === 9203) || (x >= 9728 && x <= 10175) || (x === 11088) || (x === 11093) + || (x >= 127744 && x <= 128591) || (x >= 128640 && x <= 128764) + || (x >= 128992 && x <= 129008) || (x >= 129280 && x <= 129535) + || (x >= 129648 && x <= 129782)); +} +// -- UTF-8 BOM +export const UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* CharCode.UTF8_BOM */); +export function startsWithUTF8BOM(str) { + return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* CharCode.UTF8_BOM */); +} +export function containsUppercaseCharacter(target, ignoreEscapedChars = false) { + if (!target) { + return false; + } + if (ignoreEscapedChars) { + target = target.replace(/\\./g, ''); + } + return target.toLowerCase() !== target; +} +/** + * Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc. + */ +export function singleLetterHash(n) { + const LETTERS_CNT = (90 /* CharCode.Z */ - 65 /* CharCode.A */ + 1); + n = n % (2 * LETTERS_CNT); + if (n < LETTERS_CNT) { + return String.fromCharCode(97 /* CharCode.a */ + n); + } + return String.fromCharCode(65 /* CharCode.A */ + n - LETTERS_CNT); +} +function breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) { + // http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules + // !!! Let's make the common case a bit faster + if (breakTypeA === 0 /* GraphemeBreakType.Other */) { + // see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table + return (breakTypeB !== 5 /* GraphemeBreakType.Extend */ && breakTypeB !== 7 /* GraphemeBreakType.SpacingMark */); + } + // Do not break between a CR and LF. Otherwise, break before and after controls. + // GB3 CR × LF + // GB4 (Control | CR | LF) ÷ + // GB5 ÷ (Control | CR | LF) + if (breakTypeA === 2 /* GraphemeBreakType.CR */) { + if (breakTypeB === 3 /* GraphemeBreakType.LF */) { + return false; // GB3 + } + } + if (breakTypeA === 4 /* GraphemeBreakType.Control */ || breakTypeA === 2 /* GraphemeBreakType.CR */ || breakTypeA === 3 /* GraphemeBreakType.LF */) { + return true; // GB4 + } + if (breakTypeB === 4 /* GraphemeBreakType.Control */ || breakTypeB === 2 /* GraphemeBreakType.CR */ || breakTypeB === 3 /* GraphemeBreakType.LF */) { + return true; // GB5 + } + // Do not break Hangul syllable sequences. + // GB6 L × (L | V | LV | LVT) + // GB7 (LV | V) × (V | T) + // GB8 (LVT | T) × T + if (breakTypeA === 8 /* GraphemeBreakType.L */) { + if (breakTypeB === 8 /* GraphemeBreakType.L */ || breakTypeB === 9 /* GraphemeBreakType.V */ || breakTypeB === 11 /* GraphemeBreakType.LV */ || breakTypeB === 12 /* GraphemeBreakType.LVT */) { + return false; // GB6 + } + } + if (breakTypeA === 11 /* GraphemeBreakType.LV */ || breakTypeA === 9 /* GraphemeBreakType.V */) { + if (breakTypeB === 9 /* GraphemeBreakType.V */ || breakTypeB === 10 /* GraphemeBreakType.T */) { + return false; // GB7 + } + } + if (breakTypeA === 12 /* GraphemeBreakType.LVT */ || breakTypeA === 10 /* GraphemeBreakType.T */) { + if (breakTypeB === 10 /* GraphemeBreakType.T */) { + return false; // GB8 + } + } + // Do not break before extending characters or ZWJ. + // GB9 × (Extend | ZWJ) + if (breakTypeB === 5 /* GraphemeBreakType.Extend */ || breakTypeB === 13 /* GraphemeBreakType.ZWJ */) { + return false; // GB9 + } + // The GB9a and GB9b rules only apply to extended grapheme clusters: + // Do not break before SpacingMarks, or after Prepend characters. + // GB9a × SpacingMark + // GB9b Prepend × + if (breakTypeB === 7 /* GraphemeBreakType.SpacingMark */) { + return false; // GB9a + } + if (breakTypeA === 1 /* GraphemeBreakType.Prepend */) { + return false; // GB9b + } + // Do not break within emoji modifier sequences or emoji zwj sequences. + // GB11 \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic} + if (breakTypeA === 13 /* GraphemeBreakType.ZWJ */ && breakTypeB === 14 /* GraphemeBreakType.Extended_Pictographic */) { + // Note: we are not implementing the rule entirely here to avoid introducing states + return false; // GB11 + } + // GB12 sot (RI RI)* RI × RI + // GB13 [^RI] (RI RI)* RI × RI + if (breakTypeA === 6 /* GraphemeBreakType.Regional_Indicator */ && breakTypeB === 6 /* GraphemeBreakType.Regional_Indicator */) { + // Note: we are not implementing the rule entirely here to avoid introducing states + return false; // GB12 & GB13 + } + // GB999 Any ÷ Any + return true; +} +class GraphemeBreakTree { + static { this._INSTANCE = null; } + static getInstance() { + if (!GraphemeBreakTree._INSTANCE) { + GraphemeBreakTree._INSTANCE = new GraphemeBreakTree(); + } + return GraphemeBreakTree._INSTANCE; + } + constructor() { + this._data = getGraphemeBreakRawData(); + } + getGraphemeBreakType(codePoint) { + // !!! Let's make 7bit ASCII a bit faster: 0..31 + if (codePoint < 32) { + if (codePoint === 10 /* CharCode.LineFeed */) { + return 3 /* GraphemeBreakType.LF */; + } + if (codePoint === 13 /* CharCode.CarriageReturn */) { + return 2 /* GraphemeBreakType.CR */; + } + return 4 /* GraphemeBreakType.Control */; + } + // !!! Let's make 7bit ASCII a bit faster: 32..126 + if (codePoint < 127) { + return 0 /* GraphemeBreakType.Other */; + } + const data = this._data; + const nodeCount = data.length / 3; + let nodeIndex = 1; + while (nodeIndex <= nodeCount) { + if (codePoint < data[3 * nodeIndex]) { + // go left + nodeIndex = 2 * nodeIndex; + } + else if (codePoint > data[3 * nodeIndex + 1]) { + // go right + nodeIndex = 2 * nodeIndex + 1; + } + else { + // hit + return data[3 * nodeIndex + 2]; + } + } + return 0 /* GraphemeBreakType.Other */; + } +} +function getGraphemeBreakRawData() { + // generated using https://github.com/alexdima/unicode-utils/blob/main/grapheme-break.js + return JSON.parse('[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]'); +} +//#endregion +/** + * Computes the offset after performing a left delete on the given string, + * while considering unicode grapheme/emoji rules. +*/ +export function getLeftDeleteOffset(offset, str) { + if (offset === 0) { + return 0; + } + // Try to delete emoji part. + const emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str); + if (emojiOffset !== undefined) { + return emojiOffset; + } + // Otherwise, just skip a single code point. + const iterator = new CodePointIterator(str, offset); + iterator.prevCodePoint(); + return iterator.offset; +} +function getOffsetBeforeLastEmojiComponent(initialOffset, str) { + // See https://www.unicode.org/reports/tr51/tr51-14.html#EBNF_and_Regex for the + // structure of emojis. + const iterator = new CodePointIterator(str, initialOffset); + let codePoint = iterator.prevCodePoint(); + // Skip modifiers + while ((isEmojiModifier(codePoint) || codePoint === 65039 /* CodePoint.emojiVariantSelector */ || codePoint === 8419 /* CodePoint.enclosingKeyCap */)) { + if (iterator.offset === 0) { + // Cannot skip modifier, no preceding emoji base. + return undefined; + } + codePoint = iterator.prevCodePoint(); + } + // Expect base emoji + if (!isEmojiImprecise(codePoint)) { + // Unexpected code point, not a valid emoji. + return undefined; + } + let resultOffset = iterator.offset; + if (resultOffset > 0) { + // Skip optional ZWJ code points that combine multiple emojis. + // In theory, we should check if that ZWJ actually combines multiple emojis + // to prevent deleting ZWJs in situations we didn't account for. + const optionalZwjCodePoint = iterator.prevCodePoint(); + if (optionalZwjCodePoint === 8205 /* CodePoint.zwj */) { + resultOffset = iterator.offset; + } + } + return resultOffset; +} +function isEmojiModifier(codePoint) { + return 0x1F3FB <= codePoint && codePoint <= 0x1F3FF; +} +export const noBreakWhitespace = '\xa0'; +export class AmbiguousCharacters { + static { this.ambiguousCharacterData = new Lazy(() => { + // Generated using https://github.com/hediet/vscode-unicode-data + // Stored as key1, value1, key2, value2, ... + return JSON.parse('{\"_common\":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,8218,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,8242,96,1370,96,1523,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71922,67,71913,67,65315,67,8557,67,8450,67,8493,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71919,87,71910,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,66293,90,71909,90,65338,90,8484,90,8488,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],\"_default\":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"cs\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"de\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"es\":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"fr\":[65374,126,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"it\":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"ja\":[8211,45,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65292,44,65307,59],\"ko\":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"pl\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"pt-BR\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"qps-ploc\":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"ru\":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"tr\":[160,32,8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],\"zh-hans\":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],\"zh-hant\":[8211,45,65374,126,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65307,59]}'); + }); } + static { this.cache = new LRUCachedFunction({ getCacheKey: JSON.stringify }, (locales) => { + function arrayToMap(arr) { + const result = new Map(); + for (let i = 0; i < arr.length; i += 2) { + result.set(arr[i], arr[i + 1]); + } + return result; + } + function mergeMaps(map1, map2) { + const result = new Map(map1); + for (const [key, value] of map2) { + result.set(key, value); + } + return result; + } + function intersectMaps(map1, map2) { + if (!map1) { + return map2; + } + const result = new Map(); + for (const [key, value] of map1) { + if (map2.has(key)) { + result.set(key, value); + } + } + return result; + } + const data = this.ambiguousCharacterData.value; + let filteredLocales = locales.filter((l) => !l.startsWith('_') && l in data); + if (filteredLocales.length === 0) { + filteredLocales = ['_default']; + } + let languageSpecificMap = undefined; + for (const locale of filteredLocales) { + const map = arrayToMap(data[locale]); + languageSpecificMap = intersectMaps(languageSpecificMap, map); + } + const commonMap = arrayToMap(data['_common']); + const map = mergeMaps(commonMap, languageSpecificMap); + return new AmbiguousCharacters(map); + }); } + static getInstance(locales) { + return AmbiguousCharacters.cache.get(Array.from(locales)); + } + static { this._locales = new Lazy(() => Object.keys(AmbiguousCharacters.ambiguousCharacterData.value).filter((k) => !k.startsWith('_'))); } + static getLocales() { + return AmbiguousCharacters._locales.value; + } + constructor(confusableDictionary) { + this.confusableDictionary = confusableDictionary; + } + isAmbiguous(codePoint) { + return this.confusableDictionary.has(codePoint); + } + /** + * Returns the non basic ASCII code point that the given code point can be confused, + * or undefined if such code point does note exist. + */ + getPrimaryConfusable(codePoint) { + return this.confusableDictionary.get(codePoint); + } + getConfusableCodePoints() { + return new Set(this.confusableDictionary.keys()); + } +} +export class InvisibleCharacters { + static getRawData() { + // Generated using https://github.com/hediet/vscode-unicode-data + return JSON.parse('[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12288,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999]'); + } + static { this._data = undefined; } + static getData() { + if (!this._data) { + this._data = new Set(InvisibleCharacters.getRawData()); + } + return this._data; + } + static isInvisibleCharacter(codePoint) { + return InvisibleCharacters.getData().has(codePoint); + } + static get codePoints() { + return InvisibleCharacters.getData(); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/symbols.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/symbols.js new file mode 100644 index 0000000000000000000000000000000000000000..ab9fb7f5ab1b06a270ec0cd9a74e907f0badf636 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/symbols.js @@ -0,0 +1,8 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/** + * Can be passed into the Delayed to defer using a microtask + * */ +export const MicrotaskDelay = Symbol('MicrotaskDelay'); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/ternarySearchTree.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/ternarySearchTree.js new file mode 100644 index 0000000000000000000000000000000000000000..b3fd8e2a335759e5c2f8a72a6d732a357de2af54 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/ternarySearchTree.js @@ -0,0 +1,618 @@ +import { compare, compareIgnoreCase, compareSubstring, compareSubstringIgnoreCase } from './strings.js'; +export class StringIterator { + constructor() { + this._value = ''; + this._pos = 0; + } + reset(key) { + this._value = key; + this._pos = 0; + return this; + } + next() { + this._pos += 1; + return this; + } + hasNext() { + return this._pos < this._value.length - 1; + } + cmp(a) { + const aCode = a.charCodeAt(0); + const thisCode = this._value.charCodeAt(this._pos); + return aCode - thisCode; + } + value() { + return this._value[this._pos]; + } +} +export class ConfigKeysIterator { + constructor(_caseSensitive = true) { + this._caseSensitive = _caseSensitive; + } + reset(key) { + this._value = key; + this._from = 0; + this._to = 0; + return this.next(); + } + hasNext() { + return this._to < this._value.length; + } + next() { + // this._data = key.split(/[\\/]/).filter(s => !!s); + this._from = this._to; + let justSeps = true; + for (; this._to < this._value.length; this._to++) { + const ch = this._value.charCodeAt(this._to); + if (ch === 46 /* CharCode.Period */) { + if (justSeps) { + this._from++; + } + else { + break; + } + } + else { + justSeps = false; + } + } + return this; + } + cmp(a) { + return this._caseSensitive + ? compareSubstring(a, this._value, 0, a.length, this._from, this._to) + : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to); + } + value() { + return this._value.substring(this._from, this._to); + } +} +export class PathIterator { + constructor(_splitOnBackslash = true, _caseSensitive = true) { + this._splitOnBackslash = _splitOnBackslash; + this._caseSensitive = _caseSensitive; + } + reset(key) { + this._from = 0; + this._to = 0; + this._value = key; + this._valueLen = key.length; + for (let pos = key.length - 1; pos >= 0; pos--, this._valueLen--) { + const ch = this._value.charCodeAt(pos); + if (!(ch === 47 /* CharCode.Slash */ || this._splitOnBackslash && ch === 92 /* CharCode.Backslash */)) { + break; + } + } + return this.next(); + } + hasNext() { + return this._to < this._valueLen; + } + next() { + // this._data = key.split(/[\\/]/).filter(s => !!s); + this._from = this._to; + let justSeps = true; + for (; this._to < this._valueLen; this._to++) { + const ch = this._value.charCodeAt(this._to); + if (ch === 47 /* CharCode.Slash */ || this._splitOnBackslash && ch === 92 /* CharCode.Backslash */) { + if (justSeps) { + this._from++; + } + else { + break; + } + } + else { + justSeps = false; + } + } + return this; + } + cmp(a) { + return this._caseSensitive + ? compareSubstring(a, this._value, 0, a.length, this._from, this._to) + : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to); + } + value() { + return this._value.substring(this._from, this._to); + } +} +export class UriIterator { + constructor(_ignorePathCasing, _ignoreQueryAndFragment) { + this._ignorePathCasing = _ignorePathCasing; + this._ignoreQueryAndFragment = _ignoreQueryAndFragment; + this._states = []; + this._stateIdx = 0; + } + reset(key) { + this._value = key; + this._states = []; + if (this._value.scheme) { + this._states.push(1 /* UriIteratorState.Scheme */); + } + if (this._value.authority) { + this._states.push(2 /* UriIteratorState.Authority */); + } + if (this._value.path) { + this._pathIterator = new PathIterator(false, !this._ignorePathCasing(key)); + this._pathIterator.reset(key.path); + if (this._pathIterator.value()) { + this._states.push(3 /* UriIteratorState.Path */); + } + } + if (!this._ignoreQueryAndFragment(key)) { + if (this._value.query) { + this._states.push(4 /* UriIteratorState.Query */); + } + if (this._value.fragment) { + this._states.push(5 /* UriIteratorState.Fragment */); + } + } + this._stateIdx = 0; + return this; + } + next() { + if (this._states[this._stateIdx] === 3 /* UriIteratorState.Path */ && this._pathIterator.hasNext()) { + this._pathIterator.next(); + } + else { + this._stateIdx += 1; + } + return this; + } + hasNext() { + return (this._states[this._stateIdx] === 3 /* UriIteratorState.Path */ && this._pathIterator.hasNext()) + || this._stateIdx < this._states.length - 1; + } + cmp(a) { + if (this._states[this._stateIdx] === 1 /* UriIteratorState.Scheme */) { + return compareIgnoreCase(a, this._value.scheme); + } + else if (this._states[this._stateIdx] === 2 /* UriIteratorState.Authority */) { + return compareIgnoreCase(a, this._value.authority); + } + else if (this._states[this._stateIdx] === 3 /* UriIteratorState.Path */) { + return this._pathIterator.cmp(a); + } + else if (this._states[this._stateIdx] === 4 /* UriIteratorState.Query */) { + return compare(a, this._value.query); + } + else if (this._states[this._stateIdx] === 5 /* UriIteratorState.Fragment */) { + return compare(a, this._value.fragment); + } + throw new Error(); + } + value() { + if (this._states[this._stateIdx] === 1 /* UriIteratorState.Scheme */) { + return this._value.scheme; + } + else if (this._states[this._stateIdx] === 2 /* UriIteratorState.Authority */) { + return this._value.authority; + } + else if (this._states[this._stateIdx] === 3 /* UriIteratorState.Path */) { + return this._pathIterator.value(); + } + else if (this._states[this._stateIdx] === 4 /* UriIteratorState.Query */) { + return this._value.query; + } + else if (this._states[this._stateIdx] === 5 /* UriIteratorState.Fragment */) { + return this._value.fragment; + } + throw new Error(); + } +} +class TernarySearchTreeNode { + constructor() { + this.height = 1; + } + rotateLeft() { + const tmp = this.right; + this.right = tmp.left; + tmp.left = this; + this.updateHeight(); + tmp.updateHeight(); + return tmp; + } + rotateRight() { + const tmp = this.left; + this.left = tmp.right; + tmp.right = this; + this.updateHeight(); + tmp.updateHeight(); + return tmp; + } + updateHeight() { + this.height = 1 + Math.max(this.heightLeft, this.heightRight); + } + balanceFactor() { + return this.heightRight - this.heightLeft; + } + get heightLeft() { + return this.left?.height ?? 0; + } + get heightRight() { + return this.right?.height ?? 0; + } +} +export class TernarySearchTree { + static forUris(ignorePathCasing = () => false, ignoreQueryAndFragment = () => false) { + return new TernarySearchTree(new UriIterator(ignorePathCasing, ignoreQueryAndFragment)); + } + static forStrings() { + return new TernarySearchTree(new StringIterator()); + } + static forConfigKeys() { + return new TernarySearchTree(new ConfigKeysIterator()); + } + constructor(segments) { + this._iter = segments; + } + clear() { + this._root = undefined; + } + set(key, element) { + const iter = this._iter.reset(key); + let node; + if (!this._root) { + this._root = new TernarySearchTreeNode(); + this._root.segment = iter.value(); + } + const stack = []; + // find insert_node + node = this._root; + while (true) { + const val = iter.cmp(node.segment); + if (val > 0) { + // left + if (!node.left) { + node.left = new TernarySearchTreeNode(); + node.left.segment = iter.value(); + } + stack.push([-1 /* Dir.Left */, node]); + node = node.left; + } + else if (val < 0) { + // right + if (!node.right) { + node.right = new TernarySearchTreeNode(); + node.right.segment = iter.value(); + } + stack.push([1 /* Dir.Right */, node]); + node = node.right; + } + else if (iter.hasNext()) { + // mid + iter.next(); + if (!node.mid) { + node.mid = new TernarySearchTreeNode(); + node.mid.segment = iter.value(); + } + stack.push([0 /* Dir.Mid */, node]); + node = node.mid; + } + else { + break; + } + } + // set value + const oldElement = node.value; + node.value = element; + node.key = key; + // balance + for (let i = stack.length - 1; i >= 0; i--) { + const node = stack[i][1]; + node.updateHeight(); + const bf = node.balanceFactor(); + if (bf < -1 || bf > 1) { + // needs rotate + const d1 = stack[i][0]; + const d2 = stack[i + 1][0]; + if (d1 === 1 /* Dir.Right */ && d2 === 1 /* Dir.Right */) { + //right, right -> rotate left + stack[i][1] = node.rotateLeft(); + } + else if (d1 === -1 /* Dir.Left */ && d2 === -1 /* Dir.Left */) { + // left, left -> rotate right + stack[i][1] = node.rotateRight(); + } + else if (d1 === 1 /* Dir.Right */ && d2 === -1 /* Dir.Left */) { + // right, left -> double rotate right, left + node.right = stack[i + 1][1] = stack[i + 1][1].rotateRight(); + stack[i][1] = node.rotateLeft(); + } + else if (d1 === -1 /* Dir.Left */ && d2 === 1 /* Dir.Right */) { + // left, right -> double rotate left, right + node.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft(); + stack[i][1] = node.rotateRight(); + } + else { + throw new Error(); + } + // patch path to parent + if (i > 0) { + switch (stack[i - 1][0]) { + case -1 /* Dir.Left */: + stack[i - 1][1].left = stack[i][1]; + break; + case 1 /* Dir.Right */: + stack[i - 1][1].right = stack[i][1]; + break; + case 0 /* Dir.Mid */: + stack[i - 1][1].mid = stack[i][1]; + break; + } + } + else { + this._root = stack[0][1]; + } + } + } + return oldElement; + } + get(key) { + return this._getNode(key)?.value; + } + _getNode(key) { + const iter = this._iter.reset(key); + let node = this._root; + while (node) { + const val = iter.cmp(node.segment); + if (val > 0) { + // left + node = node.left; + } + else if (val < 0) { + // right + node = node.right; + } + else if (iter.hasNext()) { + // mid + iter.next(); + node = node.mid; + } + else { + break; + } + } + return node; + } + has(key) { + const node = this._getNode(key); + return !(node?.value === undefined && node?.mid === undefined); + } + delete(key) { + return this._delete(key, false); + } + deleteSuperstr(key) { + return this._delete(key, true); + } + _delete(key, superStr) { + const iter = this._iter.reset(key); + const stack = []; + let node = this._root; + // find node + while (node) { + const val = iter.cmp(node.segment); + if (val > 0) { + // left + stack.push([-1 /* Dir.Left */, node]); + node = node.left; + } + else if (val < 0) { + // right + stack.push([1 /* Dir.Right */, node]); + node = node.right; + } + else if (iter.hasNext()) { + // mid + iter.next(); + stack.push([0 /* Dir.Mid */, node]); + node = node.mid; + } + else { + break; + } + } + if (!node) { + // node not found + return; + } + if (superStr) { + // removing children, reset height + node.left = undefined; + node.mid = undefined; + node.right = undefined; + node.height = 1; + } + else { + // removing element + node.key = undefined; + node.value = undefined; + } + // BST node removal + if (!node.mid && !node.value) { + if (node.left && node.right) { + // full node + // replace deleted-node with the min-node of the right branch. + // If there is no true min-node leave things as they are + const min = this._min(node.right); + if (min.key) { + const { key, value, segment } = min; + this._delete(min.key, false); + node.key = key; + node.value = value; + node.segment = segment; + } + } + else { + // empty or half empty + const newChild = node.left ?? node.right; + if (stack.length > 0) { + const [dir, parent] = stack[stack.length - 1]; + switch (dir) { + case -1 /* Dir.Left */: + parent.left = newChild; + break; + case 0 /* Dir.Mid */: + parent.mid = newChild; + break; + case 1 /* Dir.Right */: + parent.right = newChild; + break; + } + } + else { + this._root = newChild; + } + } + } + // AVL balance + for (let i = stack.length - 1; i >= 0; i--) { + const node = stack[i][1]; + node.updateHeight(); + const bf = node.balanceFactor(); + if (bf > 1) { + // right heavy + if (node.right.balanceFactor() >= 0) { + // right, right -> rotate left + stack[i][1] = node.rotateLeft(); + } + else { + // right, left -> double rotate + node.right = node.right.rotateRight(); + stack[i][1] = node.rotateLeft(); + } + } + else if (bf < -1) { + // left heavy + if (node.left.balanceFactor() <= 0) { + // left, left -> rotate right + stack[i][1] = node.rotateRight(); + } + else { + // left, right -> double rotate + node.left = node.left.rotateLeft(); + stack[i][1] = node.rotateRight(); + } + } + // patch path to parent + if (i > 0) { + switch (stack[i - 1][0]) { + case -1 /* Dir.Left */: + stack[i - 1][1].left = stack[i][1]; + break; + case 1 /* Dir.Right */: + stack[i - 1][1].right = stack[i][1]; + break; + case 0 /* Dir.Mid */: + stack[i - 1][1].mid = stack[i][1]; + break; + } + } + else { + this._root = stack[0][1]; + } + } + } + _min(node) { + while (node.left) { + node = node.left; + } + return node; + } + findSubstr(key) { + const iter = this._iter.reset(key); + let node = this._root; + let candidate = undefined; + while (node) { + const val = iter.cmp(node.segment); + if (val > 0) { + // left + node = node.left; + } + else if (val < 0) { + // right + node = node.right; + } + else if (iter.hasNext()) { + // mid + iter.next(); + candidate = node.value || candidate; + node = node.mid; + } + else { + break; + } + } + return node && node.value || candidate; + } + findSuperstr(key) { + return this._findSuperstrOrElement(key, false); + } + _findSuperstrOrElement(key, allowValue) { + const iter = this._iter.reset(key); + let node = this._root; + while (node) { + const val = iter.cmp(node.segment); + if (val > 0) { + // left + node = node.left; + } + else if (val < 0) { + // right + node = node.right; + } + else if (iter.hasNext()) { + // mid + iter.next(); + node = node.mid; + } + else { + // collect + if (!node.mid) { + if (allowValue) { + return node.value; + } + else { + return undefined; + } + } + else { + return this._entries(node.mid); + } + } + } + return undefined; + } + forEach(callback) { + for (const [key, value] of this) { + callback(value, key); + } + } + *[Symbol.iterator]() { + yield* this._entries(this._root); + } + _entries(node) { + const result = []; + this._dfsEntries(node, result); + return result[Symbol.iterator](); + } + _dfsEntries(node, bucket) { + // DFS + if (!node) { + return; + } + if (node.left) { + this._dfsEntries(node.left, bucket); + } + if (node.value) { + bucket.push([node.key, node.value]); + } + if (node.mid) { + this._dfsEntries(node.mid, bucket); + } + if (node.right) { + this._dfsEntries(node.right, bucket); + } + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/tfIdf.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/tfIdf.js new file mode 100644 index 0000000000000000000000000000000000000000..97d5b0908aa41df1fbefaa0b8bf0a6da10c31c58 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/tfIdf.js @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +function countMapFrom(values) { + const map = new Map(); + for (const value of values) { + map.set(value, (map.get(value) ?? 0) + 1); + } + return map; +} +/** + * Implementation of tf-idf (term frequency-inverse document frequency) for a set of + * documents where each document contains one or more chunks of text. + * Each document is identified by a key, and the score for each document is computed + * by taking the max score over all the chunks in the document. + */ +export class TfIdfCalculator { + constructor() { + /** + * Total number of chunks + */ + this.chunkCount = 0; + this.chunkOccurrences = new Map(); + this.documents = new Map(); + } + calculateScores(query, token) { + const embedding = this.computeEmbedding(query); + const idfCache = new Map(); + const scores = []; + // For each document, generate one score + for (const [key, doc] of this.documents) { + if (token.isCancellationRequested) { + return []; + } + for (const chunk of doc.chunks) { + const score = this.computeSimilarityScore(chunk, embedding, idfCache); + if (score > 0) { + scores.push({ key, score }); + } + } + } + return scores; + } + /** + * Count how many times each term (word) appears in a string. + */ + static termFrequencies(input) { + return countMapFrom(TfIdfCalculator.splitTerms(input)); + } + /** + * Break a string into terms (words). + */ + static *splitTerms(input) { + const normalize = (word) => word.toLowerCase(); + // Only match on words that are at least 3 characters long and start with a letter + for (const [word] of input.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)) { + yield normalize(word); + const camelParts = word.replace(/([a-z])([A-Z])/g, '$1 $2').split(/\s+/g); + if (camelParts.length > 1) { + for (const part of camelParts) { + // Require at least 3 letters in the parts of a camel case word + if (part.length > 2 && /\p{Letter}{3,}/gu.test(part)) { + yield normalize(part); + } + } + } + } + } + updateDocuments(documents) { + for (const { key } of documents) { + this.deleteDocument(key); + } + for (const doc of documents) { + const chunks = []; + for (const text of doc.textChunks) { + // TODO: See if we can compute the tf lazily + // The challenge is that we need to also update the `chunkOccurrences` + // and all of those updates need to get flushed before the real TF-IDF of + // anything is computed. + const tf = TfIdfCalculator.termFrequencies(text); + // Update occurrences list + for (const term of tf.keys()) { + this.chunkOccurrences.set(term, (this.chunkOccurrences.get(term) ?? 0) + 1); + } + chunks.push({ text, tf }); + } + this.chunkCount += chunks.length; + this.documents.set(doc.key, { chunks }); + } + return this; + } + deleteDocument(key) { + const doc = this.documents.get(key); + if (!doc) { + return; + } + this.documents.delete(key); + this.chunkCount -= doc.chunks.length; + // Update term occurrences for the document + for (const chunk of doc.chunks) { + for (const term of chunk.tf.keys()) { + const currentOccurrences = this.chunkOccurrences.get(term); + if (typeof currentOccurrences === 'number') { + const newOccurrences = currentOccurrences - 1; + if (newOccurrences <= 0) { + this.chunkOccurrences.delete(term); + } + else { + this.chunkOccurrences.set(term, newOccurrences); + } + } + } + } + } + computeSimilarityScore(chunk, queryEmbedding, idfCache) { + // Compute the dot product between the chunk's embedding and the query embedding + // Note that the chunk embedding is computed lazily on a per-term basis. + // This lets us skip a large number of calculations because the majority + // of chunks do not share any terms with the query. + let sum = 0; + for (const [term, termTfidf] of Object.entries(queryEmbedding)) { + const chunkTf = chunk.tf.get(term); + if (!chunkTf) { + // Term does not appear in chunk so it has no contribution + continue; + } + let chunkIdf = idfCache.get(term); + if (typeof chunkIdf !== 'number') { + chunkIdf = this.computeIdf(term); + idfCache.set(term, chunkIdf); + } + const chunkTfidf = chunkTf * chunkIdf; + sum += chunkTfidf * termTfidf; + } + return sum; + } + computeEmbedding(input) { + const tf = TfIdfCalculator.termFrequencies(input); + return this.computeTfidf(tf); + } + computeIdf(term) { + const chunkOccurrences = this.chunkOccurrences.get(term) ?? 0; + return chunkOccurrences > 0 + ? Math.log((this.chunkCount + 1) / chunkOccurrences) + : 0; + } + computeTfidf(termFrequencies) { + const embedding = Object.create(null); + for (const [word, occurrences] of termFrequencies) { + const idf = this.computeIdf(word); + if (idf > 0) { + embedding[word] = occurrences * idf; + } + } + return embedding; + } +} +/** + * Normalize the scores to be between 0 and 1 and sort them decending. + * @param scores array of scores from {@link TfIdfCalculator.calculateScores} + * @returns normalized scores + */ +export function normalizeTfIdfScores(scores) { + // copy of scores + const result = scores.slice(0); + // sort descending + result.sort((a, b) => b.score - a.score); + // normalize + const max = result[0]?.score ?? 0; + if (max > 0) { + for (const score of result) { + score.score /= max; + } + } + return result; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/themables.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/themables.js new file mode 100644 index 0000000000000000000000000000000000000000..569688c87bbeaeffe2387226b9ab652539d1db28 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/themables.js @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { Codicon } from './codicons.js'; +export var ThemeColor; +(function (ThemeColor) { + function isThemeColor(obj) { + return obj && typeof obj === 'object' && typeof obj.id === 'string'; + } + ThemeColor.isThemeColor = isThemeColor; +})(ThemeColor || (ThemeColor = {})); +export var ThemeIcon; +(function (ThemeIcon) { + ThemeIcon.iconNameSegment = '[A-Za-z0-9]+'; + ThemeIcon.iconNameExpression = '[A-Za-z0-9-]+'; + ThemeIcon.iconModifierExpression = '~[A-Za-z]+'; + ThemeIcon.iconNameCharacter = '[A-Za-z0-9~-]'; + const ThemeIconIdRegex = new RegExp(`^(${ThemeIcon.iconNameExpression})(${ThemeIcon.iconModifierExpression})?$`); + function asClassNameArray(icon) { + const match = ThemeIconIdRegex.exec(icon.id); + if (!match) { + return asClassNameArray(Codicon.error); + } + const [, id, modifier] = match; + const classNames = ['codicon', 'codicon-' + id]; + if (modifier) { + classNames.push('codicon-modifier-' + modifier.substring(1)); + } + return classNames; + } + ThemeIcon.asClassNameArray = asClassNameArray; + function asClassName(icon) { + return asClassNameArray(icon).join(' '); + } + ThemeIcon.asClassName = asClassName; + function asCSSSelector(icon) { + return '.' + asClassNameArray(icon).join('.'); + } + ThemeIcon.asCSSSelector = asCSSSelector; + function isThemeIcon(obj) { + return obj && typeof obj === 'object' && typeof obj.id === 'string' && (typeof obj.color === 'undefined' || ThemeColor.isThemeColor(obj.color)); + } + ThemeIcon.isThemeIcon = isThemeIcon; + const _regexFromString = new RegExp(`^\\$\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\)$`); + function fromString(str) { + const match = _regexFromString.exec(str); + if (!match) { + return undefined; + } + const [, name] = match; + return { id: name }; + } + ThemeIcon.fromString = fromString; + function fromId(id) { + return { id }; + } + ThemeIcon.fromId = fromId; + function modify(icon, modifier) { + let id = icon.id; + const tildeIndex = id.lastIndexOf('~'); + if (tildeIndex !== -1) { + id = id.substring(0, tildeIndex); + } + if (modifier) { + id = `${id}~${modifier}`; + } + return { id }; + } + ThemeIcon.modify = modify; + function getModifier(icon) { + const tildeIndex = icon.id.lastIndexOf('~'); + if (tildeIndex !== -1) { + return icon.id.substring(tildeIndex + 1); + } + return undefined; + } + ThemeIcon.getModifier = getModifier; + function isEqual(ti1, ti2) { + return ti1.id === ti2.id && ti1.color?.id === ti2.color?.id; + } + ThemeIcon.isEqual = isEqual; +})(ThemeIcon || (ThemeIcon = {})); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/types.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/types.js new file mode 100644 index 0000000000000000000000000000000000000000..37c44b5b8435124dd931f758b5b8796aee527e72 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/types.js @@ -0,0 +1,119 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/** + * @returns whether the provided parameter is a JavaScript String or not. + */ +export function isString(str) { + return (typeof str === 'string'); +} +/** + * @returns whether the provided parameter is of type `object` but **not** + * `null`, an `array`, a `regexp`, nor a `date`. + */ +export function isObject(obj) { + // The method can't do a type cast since there are type (like strings) which + // are subclasses of any put not positvely matched by the function. Hence type + // narrowing results in wrong results. + return typeof obj === 'object' + && obj !== null + && !Array.isArray(obj) + && !(obj instanceof RegExp) + && !(obj instanceof Date); +} +/** + * @returns whether the provided parameter is of type `Buffer` or Uint8Array dervived type + */ +export function isTypedArray(obj) { + const TypedArray = Object.getPrototypeOf(Uint8Array); + return typeof obj === 'object' + && obj instanceof TypedArray; +} +/** + * In **contrast** to just checking `typeof` this will return `false` for `NaN`. + * @returns whether the provided parameter is a JavaScript Number or not. + */ +export function isNumber(obj) { + return (typeof obj === 'number' && !isNaN(obj)); +} +/** + * @returns whether the provided parameter is an Iterable, casting to the given generic + */ +export function isIterable(obj) { + return !!obj && typeof obj[Symbol.iterator] === 'function'; +} +/** + * @returns whether the provided parameter is a JavaScript Boolean or not. + */ +export function isBoolean(obj) { + return (obj === true || obj === false); +} +/** + * @returns whether the provided parameter is undefined. + */ +export function isUndefined(obj) { + return (typeof obj === 'undefined'); +} +/** + * @returns whether the provided parameter is defined. + */ +export function isDefined(arg) { + return !isUndefinedOrNull(arg); +} +/** + * @returns whether the provided parameter is undefined or null. + */ +export function isUndefinedOrNull(obj) { + return (isUndefined(obj) || obj === null); +} +export function assertType(condition, type) { + if (!condition) { + throw new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type'); + } +} +/** + * Asserts that the argument passed in is neither undefined nor null. + */ +export function assertIsDefined(arg) { + if (isUndefinedOrNull(arg)) { + throw new Error('Assertion Failed: argument is undefined or null'); + } + return arg; +} +/** + * @returns whether the provided parameter is a JavaScript Function or not. + */ +export function isFunction(obj) { + return (typeof obj === 'function'); +} +export function validateConstraints(args, constraints) { + const len = Math.min(args.length, constraints.length); + for (let i = 0; i < len; i++) { + validateConstraint(args[i], constraints[i]); + } +} +export function validateConstraint(arg, constraint) { + if (isString(constraint)) { + if (typeof arg !== constraint) { + throw new Error(`argument does not match constraint: typeof ${constraint}`); + } + } + else if (isFunction(constraint)) { + try { + if (arg instanceof constraint) { + return; + } + } + catch { + // ignore + } + if (!isUndefinedOrNull(arg) && arg.constructor === constraint) { + return; + } + if (constraint.length === 1 && constraint.call(undefined, arg) === true) { + return; + } + throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uint.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uint.js new file mode 100644 index 0000000000000000000000000000000000000000..c845be802082df83801195328371b4c2c61a404d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uint.js @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +export function toUint8(v) { + if (v < 0) { + return 0; + } + if (v > 255 /* Constants.MAX_UINT_8 */) { + return 255 /* Constants.MAX_UINT_8 */; + } + return v | 0; +} +export function toUint32(v) { + if (v < 0) { + return 0; + } + if (v > 4294967295 /* Constants.MAX_UINT_32 */) { + return 4294967295 /* Constants.MAX_UINT_32 */; + } + return v | 0; +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uri.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uri.js new file mode 100644 index 0000000000000000000000000000000000000000..ba625be414a89729802ae4415d6cf7d61f30907d --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uri.js @@ -0,0 +1,602 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import * as paths from './path.js'; +import { isWindows } from './platform.js'; +const _schemePattern = /^\w[\w\d+.-]*$/; +const _singleSlashStart = /^\//; +const _doubleSlashStart = /^\/\//; +function _validateUri(ret, _strict) { + // scheme, must be set + if (!ret.scheme && _strict) { + throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${ret.authority}", path: "${ret.path}", query: "${ret.query}", fragment: "${ret.fragment}"}`); + } + // scheme, https://tools.ietf.org/html/rfc3986#section-3.1 + // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + if (ret.scheme && !_schemePattern.test(ret.scheme)) { + throw new Error('[UriError]: Scheme contains illegal characters.'); + } + // path, http://tools.ietf.org/html/rfc3986#section-3.3 + // If a URI contains an authority component, then the path component + // must either be empty or begin with a slash ("/") character. If a URI + // does not contain an authority component, then the path cannot begin + // with two slash characters ("//"). + if (ret.path) { + if (ret.authority) { + if (!_singleSlashStart.test(ret.path)) { + throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); + } + } + else { + if (_doubleSlashStart.test(ret.path)) { + throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); + } + } + } +} +// for a while we allowed uris *without* schemes and this is the migration +// for them, e.g. an uri without scheme and without strict-mode warns and falls +// back to the file-scheme. that should cause the least carnage and still be a +// clear warning +function _schemeFix(scheme, _strict) { + if (!scheme && !_strict) { + return 'file'; + } + return scheme; +} +// implements a bit of https://tools.ietf.org/html/rfc3986#section-5 +function _referenceResolution(scheme, path) { + // the slash-character is our 'default base' as we don't + // support constructing URIs relative to other URIs. This + // also means that we alter and potentially break paths. + // see https://tools.ietf.org/html/rfc3986#section-5.1.4 + switch (scheme) { + case 'https': + case 'http': + case 'file': + if (!path) { + path = _slash; + } + else if (path[0] !== _slash) { + path = _slash + path; + } + break; + } + return path; +} +const _empty = ''; +const _slash = '/'; +const _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; +/** + * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986. + * This class is a simple parser which creates the basic component parts + * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation + * and encoding. + * + * ```txt + * foo://example.com:8042/over/there?name=ferret#nose + * \_/ \______________/\_________/ \_________/ \__/ + * | | | | | + * scheme authority path query fragment + * | _____________________|__ + * / \ / \ + * urn:example:animal:ferret:nose + * ``` + */ +export class URI { + static isUri(thing) { + if (thing instanceof URI) { + return true; + } + if (!thing) { + return false; + } + return typeof thing.authority === 'string' + && typeof thing.fragment === 'string' + && typeof thing.path === 'string' + && typeof thing.query === 'string' + && typeof thing.scheme === 'string' + && typeof thing.fsPath === 'string' + && typeof thing.with === 'function' + && typeof thing.toString === 'function'; + } + /** + * @internal + */ + constructor(schemeOrData, authority, path, query, fragment, _strict = false) { + if (typeof schemeOrData === 'object') { + this.scheme = schemeOrData.scheme || _empty; + this.authority = schemeOrData.authority || _empty; + this.path = schemeOrData.path || _empty; + this.query = schemeOrData.query || _empty; + this.fragment = schemeOrData.fragment || _empty; + // no validation because it's this URI + // that creates uri components. + // _validateUri(this); + } + else { + this.scheme = _schemeFix(schemeOrData, _strict); + this.authority = authority || _empty; + this.path = _referenceResolution(this.scheme, path || _empty); + this.query = query || _empty; + this.fragment = fragment || _empty; + _validateUri(this, _strict); + } + } + // ---- filesystem path ----------------------- + /** + * Returns a string representing the corresponding file system path of this URI. + * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the + * platform specific path separator. + * + * * Will *not* validate the path for invalid characters and semantics. + * * Will *not* look at the scheme of this URI. + * * The result shall *not* be used for display purposes but for accessing a file on disk. + * + * + * The *difference* to `URI#path` is the use of the platform specific separator and the handling + * of UNC paths. See the below sample of a file-uri with an authority (UNC path). + * + * ```ts + const u = URI.parse('file://server/c$/folder/file.txt') + u.authority === 'server' + u.path === '/shares/c$/file.txt' + u.fsPath === '\\server\c$\folder\file.txt' + ``` + * + * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path, + * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working + * with URIs that represent files on disk (`file` scheme). + */ + get fsPath() { + // if (this.scheme !== 'file') { + // console.warn(`[UriError] calling fsPath with scheme ${this.scheme}`); + // } + return uriToFsPath(this, false); + } + // ---- modify to new ------------------------- + with(change) { + if (!change) { + return this; + } + let { scheme, authority, path, query, fragment } = change; + if (scheme === undefined) { + scheme = this.scheme; + } + else if (scheme === null) { + scheme = _empty; + } + if (authority === undefined) { + authority = this.authority; + } + else if (authority === null) { + authority = _empty; + } + if (path === undefined) { + path = this.path; + } + else if (path === null) { + path = _empty; + } + if (query === undefined) { + query = this.query; + } + else if (query === null) { + query = _empty; + } + if (fragment === undefined) { + fragment = this.fragment; + } + else if (fragment === null) { + fragment = _empty; + } + if (scheme === this.scheme + && authority === this.authority + && path === this.path + && query === this.query + && fragment === this.fragment) { + return this; + } + return new Uri(scheme, authority, path, query, fragment); + } + // ---- parse & validate ------------------------ + /** + * Creates a new URI from a string, e.g. `http://www.example.com/some/path`, + * `file:///usr/home`, or `scheme:with/path`. + * + * @param value A string which represents an URI (see `URI#toString`). + */ + static parse(value, _strict = false) { + const match = _regexp.exec(value); + if (!match) { + return new Uri(_empty, _empty, _empty, _empty, _empty); + } + return new Uri(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict); + } + /** + * Creates a new URI from a file system path, e.g. `c:\my\files`, + * `/usr/home`, or `\\server\share\some\path`. + * + * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument + * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as** + * `URI.parse('file://' + path)` because the path might contain characters that are + * interpreted (# and ?). See the following sample: + * ```ts + const good = URI.file('/coding/c#/project1'); + good.scheme === 'file'; + good.path === '/coding/c#/project1'; + good.fragment === ''; + const bad = URI.parse('file://' + '/coding/c#/project1'); + bad.scheme === 'file'; + bad.path === '/coding/c'; // path is now broken + bad.fragment === '/project1'; + ``` + * + * @param path A file system path (see `URI#fsPath`) + */ + static file(path) { + let authority = _empty; + // normalize to fwd-slashes on windows, + // on other systems bwd-slashes are valid + // filename character, eg /f\oo/ba\r.txt + if (isWindows) { + path = path.replace(/\\/g, _slash); + } + // check for authority as used in UNC shares + // or use the path as given + if (path[0] === _slash && path[1] === _slash) { + const idx = path.indexOf(_slash, 2); + if (idx === -1) { + authority = path.substring(2); + path = _slash; + } + else { + authority = path.substring(2, idx); + path = path.substring(idx) || _slash; + } + } + return new Uri('file', authority, path, _empty, _empty); + } + /** + * Creates new URI from uri components. + * + * Unless `strict` is `true` the scheme is defaults to be `file`. This function performs + * validation and should be used for untrusted uri components retrieved from storage, + * user input, command arguments etc + */ + static from(components, strict) { + const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment, strict); + return result; + } + /** + * Join a URI path with path fragments and normalizes the resulting path. + * + * @param uri The input URI. + * @param pathFragment The path fragment to add to the URI path. + * @returns The resulting URI. + */ + static joinPath(uri, ...pathFragment) { + if (!uri.path) { + throw new Error(`[UriError]: cannot call joinPath on URI without path`); + } + let newPath; + if (isWindows && uri.scheme === 'file') { + newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path; + } + else { + newPath = paths.posix.join(uri.path, ...pathFragment); + } + return uri.with({ path: newPath }); + } + // ---- printing/externalize --------------------------- + /** + * Creates a string representation for this URI. It's guaranteed that calling + * `URI.parse` with the result of this function creates an URI which is equal + * to this URI. + * + * * The result shall *not* be used for display purposes but for externalization or transport. + * * The result will be encoded using the percentage encoding and encoding happens mostly + * ignore the scheme-specific encoding rules. + * + * @param skipEncoding Do not encode the result, default is `false` + */ + toString(skipEncoding = false) { + return _asFormatted(this, skipEncoding); + } + toJSON() { + return this; + } + static revive(data) { + if (!data) { + return data; + } + else if (data instanceof URI) { + return data; + } + else { + const result = new Uri(data); + result._formatted = data.external ?? null; + result._fsPath = data._sep === _pathSepMarker ? data.fsPath ?? null : null; + return result; + } + } +} +const _pathSepMarker = isWindows ? 1 : undefined; +// This class exists so that URI is compatible with vscode.Uri (API). +class Uri extends URI { + constructor() { + super(...arguments); + this._formatted = null; + this._fsPath = null; + } + get fsPath() { + if (!this._fsPath) { + this._fsPath = uriToFsPath(this, false); + } + return this._fsPath; + } + toString(skipEncoding = false) { + if (!skipEncoding) { + if (!this._formatted) { + this._formatted = _asFormatted(this, false); + } + return this._formatted; + } + else { + // we don't cache that + return _asFormatted(this, true); + } + } + toJSON() { + const res = { + $mid: 1 /* MarshalledId.Uri */ + }; + // cached state + if (this._fsPath) { + res.fsPath = this._fsPath; + res._sep = _pathSepMarker; + } + if (this._formatted) { + res.external = this._formatted; + } + //--- uri components + if (this.path) { + res.path = this.path; + } + // TODO + // this isn't correct and can violate the UriComponents contract but + // this is part of the vscode.Uri API and we shouldn't change how that + // works anymore + if (this.scheme) { + res.scheme = this.scheme; + } + if (this.authority) { + res.authority = this.authority; + } + if (this.query) { + res.query = this.query; + } + if (this.fragment) { + res.fragment = this.fragment; + } + return res; + } +} +// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2 +const encodeTable = { + [58 /* CharCode.Colon */]: '%3A', // gen-delims + [47 /* CharCode.Slash */]: '%2F', + [63 /* CharCode.QuestionMark */]: '%3F', + [35 /* CharCode.Hash */]: '%23', + [91 /* CharCode.OpenSquareBracket */]: '%5B', + [93 /* CharCode.CloseSquareBracket */]: '%5D', + [64 /* CharCode.AtSign */]: '%40', + [33 /* CharCode.ExclamationMark */]: '%21', // sub-delims + [36 /* CharCode.DollarSign */]: '%24', + [38 /* CharCode.Ampersand */]: '%26', + [39 /* CharCode.SingleQuote */]: '%27', + [40 /* CharCode.OpenParen */]: '%28', + [41 /* CharCode.CloseParen */]: '%29', + [42 /* CharCode.Asterisk */]: '%2A', + [43 /* CharCode.Plus */]: '%2B', + [44 /* CharCode.Comma */]: '%2C', + [59 /* CharCode.Semicolon */]: '%3B', + [61 /* CharCode.Equals */]: '%3D', + [32 /* CharCode.Space */]: '%20', +}; +function encodeURIComponentFast(uriComponent, isPath, isAuthority) { + let res = undefined; + let nativeEncodePos = -1; + for (let pos = 0; pos < uriComponent.length; pos++) { + const code = uriComponent.charCodeAt(pos); + // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3 + if ((code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */) + || (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) + || (code >= 48 /* CharCode.Digit0 */ && code <= 57 /* CharCode.Digit9 */) + || code === 45 /* CharCode.Dash */ + || code === 46 /* CharCode.Period */ + || code === 95 /* CharCode.Underline */ + || code === 126 /* CharCode.Tilde */ + || (isPath && code === 47 /* CharCode.Slash */) + || (isAuthority && code === 91 /* CharCode.OpenSquareBracket */) + || (isAuthority && code === 93 /* CharCode.CloseSquareBracket */) + || (isAuthority && code === 58 /* CharCode.Colon */)) { + // check if we are delaying native encode + if (nativeEncodePos !== -1) { + res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); + nativeEncodePos = -1; + } + // check if we write into a new string (by default we try to return the param) + if (res !== undefined) { + res += uriComponent.charAt(pos); + } + } + else { + // encoding needed, we need to allocate a new string + if (res === undefined) { + res = uriComponent.substr(0, pos); + } + // check with default table first + const escaped = encodeTable[code]; + if (escaped !== undefined) { + // check if we are delaying native encode + if (nativeEncodePos !== -1) { + res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); + nativeEncodePos = -1; + } + // append escaped variant to result + res += escaped; + } + else if (nativeEncodePos === -1) { + // use native encode only when needed + nativeEncodePos = pos; + } + } + } + if (nativeEncodePos !== -1) { + res += encodeURIComponent(uriComponent.substring(nativeEncodePos)); + } + return res !== undefined ? res : uriComponent; +} +function encodeURIComponentMinimal(path) { + let res = undefined; + for (let pos = 0; pos < path.length; pos++) { + const code = path.charCodeAt(pos); + if (code === 35 /* CharCode.Hash */ || code === 63 /* CharCode.QuestionMark */) { + if (res === undefined) { + res = path.substr(0, pos); + } + res += encodeTable[code]; + } + else { + if (res !== undefined) { + res += path[pos]; + } + } + } + return res !== undefined ? res : path; +} +/** + * Compute `fsPath` for the given uri + */ +export function uriToFsPath(uri, keepDriveLetterCasing) { + let value; + if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') { + // unc path: file://shares/c$/far/boo + value = `//${uri.authority}${uri.path}`; + } + else if (uri.path.charCodeAt(0) === 47 /* CharCode.Slash */ + && (uri.path.charCodeAt(1) >= 65 /* CharCode.A */ && uri.path.charCodeAt(1) <= 90 /* CharCode.Z */ || uri.path.charCodeAt(1) >= 97 /* CharCode.a */ && uri.path.charCodeAt(1) <= 122 /* CharCode.z */) + && uri.path.charCodeAt(2) === 58 /* CharCode.Colon */) { + if (!keepDriveLetterCasing) { + // windows drive letter: file:///c:/far/boo + value = uri.path[1].toLowerCase() + uri.path.substr(2); + } + else { + value = uri.path.substr(1); + } + } + else { + // other path + value = uri.path; + } + if (isWindows) { + value = value.replace(/\//g, '\\'); + } + return value; +} +/** + * Create the external version of a uri + */ +function _asFormatted(uri, skipEncoding) { + const encoder = !skipEncoding + ? encodeURIComponentFast + : encodeURIComponentMinimal; + let res = ''; + let { scheme, authority, path, query, fragment } = uri; + if (scheme) { + res += scheme; + res += ':'; + } + if (authority || scheme === 'file') { + res += _slash; + res += _slash; + } + if (authority) { + let idx = authority.indexOf('@'); + if (idx !== -1) { + // @ + const userinfo = authority.substr(0, idx); + authority = authority.substr(idx + 1); + idx = userinfo.lastIndexOf(':'); + if (idx === -1) { + res += encoder(userinfo, false, false); + } + else { + // :@ + res += encoder(userinfo.substr(0, idx), false, false); + res += ':'; + res += encoder(userinfo.substr(idx + 1), false, true); + } + res += '@'; + } + authority = authority.toLowerCase(); + idx = authority.lastIndexOf(':'); + if (idx === -1) { + res += encoder(authority, false, true); + } + else { + // : + res += encoder(authority.substr(0, idx), false, true); + res += authority.substr(idx); + } + } + if (path) { + // lower-case windows drive letters in /C:/fff or C:/fff + if (path.length >= 3 && path.charCodeAt(0) === 47 /* CharCode.Slash */ && path.charCodeAt(2) === 58 /* CharCode.Colon */) { + const code = path.charCodeAt(1); + if (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) { + path = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // "/c:".length === 3 + } + } + else if (path.length >= 2 && path.charCodeAt(1) === 58 /* CharCode.Colon */) { + const code = path.charCodeAt(0); + if (code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */) { + path = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // "/c:".length === 3 + } + } + // encode the rest of the path + res += encoder(path, true, false); + } + if (query) { + res += '?'; + res += encoder(query, false, false); + } + if (fragment) { + res += '#'; + res += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment; + } + return res; +} +// --- decode +function decodeURIComponentGraceful(str) { + try { + return decodeURIComponent(str); + } + catch { + if (str.length > 3) { + return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3)); + } + else { + return str; + } + } +} +const _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g; +function percentDecode(str) { + if (!str.match(_rEncodedAsHex)) { + return str; + } + return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match)); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uuid.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uuid.js new file mode 100644 index 0000000000000000000000000000000000000000..72e1db5f3675641e1aa4a3c5adcb624ac4d59a52 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/uuid.js @@ -0,0 +1,56 @@ +export const generateUuid = (function () { + // use `randomUUID` if possible + if (typeof crypto === 'object' && typeof crypto.randomUUID === 'function') { + return crypto.randomUUID.bind(crypto); + } + // use `randomValues` if possible + let getRandomValues; + if (typeof crypto === 'object' && typeof crypto.getRandomValues === 'function') { + getRandomValues = crypto.getRandomValues.bind(crypto); + } + else { + getRandomValues = function (bucket) { + for (let i = 0; i < bucket.length; i++) { + bucket[i] = Math.floor(Math.random() * 256); + } + return bucket; + }; + } + // prep-work + const _data = new Uint8Array(16); + const _hex = []; + for (let i = 0; i < 256; i++) { + _hex.push(i.toString(16).padStart(2, '0')); + } + return function generateUuid() { + // get data + getRandomValues(_data); + // set version bits + _data[6] = (_data[6] & 0x0f) | 0x40; + _data[8] = (_data[8] & 0x3f) | 0x80; + // print as string + let i = 0; + let result = ''; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += '-'; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += '-'; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += '-'; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += '-'; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + result += _hex[_data[i++]]; + return result; + }; +})(); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js new file mode 100644 index 0000000000000000000000000000000000000000..85005f72fa8f356259711355424370f4b52acb8f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js @@ -0,0 +1,461 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { onUnexpectedError, transformErrorForSerialization } from '../errors.js'; +import { Emitter } from '../event.js'; +import { Disposable } from '../lifecycle.js'; +import { FileAccess } from '../network.js'; +import { isWeb } from '../platform.js'; +import * as strings from '../strings.js'; +// ESM-comment-begin +// const isESM = false; +// ESM-comment-end +// ESM-uncomment-begin +const isESM = true; +// ESM-uncomment-end +const DEFAULT_CHANNEL = 'default'; +const INITIALIZE = '$initialize'; +let webWorkerWarningLogged = false; +export function logOnceWebWorkerWarning(err) { + if (!isWeb) { + // running tests + return; + } + if (!webWorkerWarningLogged) { + webWorkerWarningLogged = true; + console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq'); + } + console.warn(err.message); +} +class RequestMessage { + constructor(vsWorker, req, channel, method, args) { + this.vsWorker = vsWorker; + this.req = req; + this.channel = channel; + this.method = method; + this.args = args; + this.type = 0 /* MessageType.Request */; + } +} +class ReplyMessage { + constructor(vsWorker, seq, res, err) { + this.vsWorker = vsWorker; + this.seq = seq; + this.res = res; + this.err = err; + this.type = 1 /* MessageType.Reply */; + } +} +class SubscribeEventMessage { + constructor(vsWorker, req, channel, eventName, arg) { + this.vsWorker = vsWorker; + this.req = req; + this.channel = channel; + this.eventName = eventName; + this.arg = arg; + this.type = 2 /* MessageType.SubscribeEvent */; + } +} +class EventMessage { + constructor(vsWorker, req, event) { + this.vsWorker = vsWorker; + this.req = req; + this.event = event; + this.type = 3 /* MessageType.Event */; + } +} +class UnsubscribeEventMessage { + constructor(vsWorker, req) { + this.vsWorker = vsWorker; + this.req = req; + this.type = 4 /* MessageType.UnsubscribeEvent */; + } +} +class SimpleWorkerProtocol { + constructor(handler) { + this._workerId = -1; + this._handler = handler; + this._lastSentReq = 0; + this._pendingReplies = Object.create(null); + this._pendingEmitters = new Map(); + this._pendingEvents = new Map(); + } + setWorkerId(workerId) { + this._workerId = workerId; + } + sendMessage(channel, method, args) { + const req = String(++this._lastSentReq); + return new Promise((resolve, reject) => { + this._pendingReplies[req] = { + resolve: resolve, + reject: reject + }; + this._send(new RequestMessage(this._workerId, req, channel, method, args)); + }); + } + listen(channel, eventName, arg) { + let req = null; + const emitter = new Emitter({ + onWillAddFirstListener: () => { + req = String(++this._lastSentReq); + this._pendingEmitters.set(req, emitter); + this._send(new SubscribeEventMessage(this._workerId, req, channel, eventName, arg)); + }, + onDidRemoveLastListener: () => { + this._pendingEmitters.delete(req); + this._send(new UnsubscribeEventMessage(this._workerId, req)); + req = null; + } + }); + return emitter.event; + } + handleMessage(message) { + if (!message || !message.vsWorker) { + return; + } + if (this._workerId !== -1 && message.vsWorker !== this._workerId) { + return; + } + this._handleMessage(message); + } + createProxyToRemoteChannel(channel, sendMessageBarrier) { + const handler = { + get: (target, name) => { + if (typeof name === 'string' && !target[name]) { + if (propertyIsDynamicEvent(name)) { // onDynamic... + target[name] = (arg) => { + return this.listen(channel, name, arg); + }; + } + else if (propertyIsEvent(name)) { // on... + target[name] = this.listen(channel, name, undefined); + } + else if (name.charCodeAt(0) === 36 /* CharCode.DollarSign */) { // $... + target[name] = async (...myArgs) => { + await sendMessageBarrier?.(); + return this.sendMessage(channel, name, myArgs); + }; + } + } + return target[name]; + } + }; + return new Proxy(Object.create(null), handler); + } + _handleMessage(msg) { + switch (msg.type) { + case 1 /* MessageType.Reply */: + return this._handleReplyMessage(msg); + case 0 /* MessageType.Request */: + return this._handleRequestMessage(msg); + case 2 /* MessageType.SubscribeEvent */: + return this._handleSubscribeEventMessage(msg); + case 3 /* MessageType.Event */: + return this._handleEventMessage(msg); + case 4 /* MessageType.UnsubscribeEvent */: + return this._handleUnsubscribeEventMessage(msg); + } + } + _handleReplyMessage(replyMessage) { + if (!this._pendingReplies[replyMessage.seq]) { + console.warn('Got reply to unknown seq'); + return; + } + const reply = this._pendingReplies[replyMessage.seq]; + delete this._pendingReplies[replyMessage.seq]; + if (replyMessage.err) { + let err = replyMessage.err; + if (replyMessage.err.$isError) { + err = new Error(); + err.name = replyMessage.err.name; + err.message = replyMessage.err.message; + err.stack = replyMessage.err.stack; + } + reply.reject(err); + return; + } + reply.resolve(replyMessage.res); + } + _handleRequestMessage(requestMessage) { + const req = requestMessage.req; + const result = this._handler.handleMessage(requestMessage.channel, requestMessage.method, requestMessage.args); + result.then((r) => { + this._send(new ReplyMessage(this._workerId, req, r, undefined)); + }, (e) => { + if (e.detail instanceof Error) { + // Loading errors have a detail property that points to the actual error + e.detail = transformErrorForSerialization(e.detail); + } + this._send(new ReplyMessage(this._workerId, req, undefined, transformErrorForSerialization(e))); + }); + } + _handleSubscribeEventMessage(msg) { + const req = msg.req; + const disposable = this._handler.handleEvent(msg.channel, msg.eventName, msg.arg)((event) => { + this._send(new EventMessage(this._workerId, req, event)); + }); + this._pendingEvents.set(req, disposable); + } + _handleEventMessage(msg) { + if (!this._pendingEmitters.has(msg.req)) { + console.warn('Got event for unknown req'); + return; + } + this._pendingEmitters.get(msg.req).fire(msg.event); + } + _handleUnsubscribeEventMessage(msg) { + if (!this._pendingEvents.has(msg.req)) { + console.warn('Got unsubscribe for unknown req'); + return; + } + this._pendingEvents.get(msg.req).dispose(); + this._pendingEvents.delete(msg.req); + } + _send(msg) { + const transfer = []; + if (msg.type === 0 /* MessageType.Request */) { + for (let i = 0; i < msg.args.length; i++) { + if (msg.args[i] instanceof ArrayBuffer) { + transfer.push(msg.args[i]); + } + } + } + else if (msg.type === 1 /* MessageType.Reply */) { + if (msg.res instanceof ArrayBuffer) { + transfer.push(msg.res); + } + } + this._handler.sendMessage(msg, transfer); + } +} +/** + * Main thread side + */ +export class SimpleWorkerClient extends Disposable { + constructor(workerFactory, workerDescriptor) { + super(); + this._localChannels = new Map(); + this._worker = this._register(workerFactory.create({ + amdModuleId: 'vs/base/common/worker/simpleWorker', + esmModuleLocation: workerDescriptor.esmModuleLocation, + label: workerDescriptor.label + }, (msg) => { + this._protocol.handleMessage(msg); + }, (err) => { + // in Firefox, web workers fail lazily :( + // we will reject the proxy + onUnexpectedError(err); + })); + this._protocol = new SimpleWorkerProtocol({ + sendMessage: (msg, transfer) => { + this._worker.postMessage(msg, transfer); + }, + handleMessage: (channel, method, args) => { + return this._handleMessage(channel, method, args); + }, + handleEvent: (channel, eventName, arg) => { + return this._handleEvent(channel, eventName, arg); + } + }); + this._protocol.setWorkerId(this._worker.getId()); + // Gather loader configuration + let loaderConfiguration = null; + const globalRequire = globalThis.require; + if (typeof globalRequire !== 'undefined' && typeof globalRequire.getConfig === 'function') { + // Get the configuration from the Monaco AMD Loader + loaderConfiguration = globalRequire.getConfig(); + } + else if (typeof globalThis.requirejs !== 'undefined') { + // Get the configuration from requirejs + loaderConfiguration = globalThis.requirejs.s.contexts._.config; + } + // Send initialize message + this._onModuleLoaded = this._protocol.sendMessage(DEFAULT_CHANNEL, INITIALIZE, [ + this._worker.getId(), + JSON.parse(JSON.stringify(loaderConfiguration)), + workerDescriptor.amdModuleId, + ]); + this.proxy = this._protocol.createProxyToRemoteChannel(DEFAULT_CHANNEL, async () => { await this._onModuleLoaded; }); + this._onModuleLoaded.catch((e) => { + this._onError('Worker failed to load ' + workerDescriptor.amdModuleId, e); + }); + } + _handleMessage(channelName, method, args) { + const channel = this._localChannels.get(channelName); + if (!channel) { + return Promise.reject(new Error(`Missing channel ${channelName} on main thread`)); + } + if (typeof channel[method] !== 'function') { + return Promise.reject(new Error(`Missing method ${method} on main thread channel ${channelName}`)); + } + try { + return Promise.resolve(channel[method].apply(channel, args)); + } + catch (e) { + return Promise.reject(e); + } + } + _handleEvent(channelName, eventName, arg) { + const channel = this._localChannels.get(channelName); + if (!channel) { + throw new Error(`Missing channel ${channelName} on main thread`); + } + if (propertyIsDynamicEvent(eventName)) { + const event = channel[eventName].call(channel, arg); + if (typeof event !== 'function') { + throw new Error(`Missing dynamic event ${eventName} on main thread channel ${channelName}.`); + } + return event; + } + if (propertyIsEvent(eventName)) { + const event = channel[eventName]; + if (typeof event !== 'function') { + throw new Error(`Missing event ${eventName} on main thread channel ${channelName}.`); + } + return event; + } + throw new Error(`Malformed event name ${eventName}`); + } + setChannel(channel, handler) { + this._localChannels.set(channel, handler); + } + _onError(message, error) { + console.error(message); + console.info(error); + } +} +function propertyIsEvent(name) { + // Assume a property is an event if it has a form of "onSomething" + return name[0] === 'o' && name[1] === 'n' && strings.isUpperAsciiLetter(name.charCodeAt(2)); +} +function propertyIsDynamicEvent(name) { + // Assume a property is a dynamic event (a method that returns an event) if it has a form of "onDynamicSomething" + return /^onDynamic/.test(name) && strings.isUpperAsciiLetter(name.charCodeAt(9)); +} +/** + * Worker side + */ +export class SimpleWorkerServer { + constructor(postMessage, requestHandlerFactory) { + this._localChannels = new Map(); + this._remoteChannels = new Map(); + this._requestHandlerFactory = requestHandlerFactory; + this._requestHandler = null; + this._protocol = new SimpleWorkerProtocol({ + sendMessage: (msg, transfer) => { + postMessage(msg, transfer); + }, + handleMessage: (channel, method, args) => this._handleMessage(channel, method, args), + handleEvent: (channel, eventName, arg) => this._handleEvent(channel, eventName, arg) + }); + } + onmessage(msg) { + this._protocol.handleMessage(msg); + } + _handleMessage(channel, method, args) { + if (channel === DEFAULT_CHANNEL && method === INITIALIZE) { + return this.initialize(args[0], args[1], args[2]); + } + const requestHandler = (channel === DEFAULT_CHANNEL ? this._requestHandler : this._localChannels.get(channel)); + if (!requestHandler) { + return Promise.reject(new Error(`Missing channel ${channel} on worker thread`)); + } + if (typeof requestHandler[method] !== 'function') { + return Promise.reject(new Error(`Missing method ${method} on worker thread channel ${channel}`)); + } + try { + return Promise.resolve(requestHandler[method].apply(requestHandler, args)); + } + catch (e) { + return Promise.reject(e); + } + } + _handleEvent(channel, eventName, arg) { + const requestHandler = (channel === DEFAULT_CHANNEL ? this._requestHandler : this._localChannels.get(channel)); + if (!requestHandler) { + throw new Error(`Missing channel ${channel} on worker thread`); + } + if (propertyIsDynamicEvent(eventName)) { + const event = requestHandler[eventName].call(requestHandler, arg); + if (typeof event !== 'function') { + throw new Error(`Missing dynamic event ${eventName} on request handler.`); + } + return event; + } + if (propertyIsEvent(eventName)) { + const event = requestHandler[eventName]; + if (typeof event !== 'function') { + throw new Error(`Missing event ${eventName} on request handler.`); + } + return event; + } + throw new Error(`Malformed event name ${eventName}`); + } + getChannel(channel) { + if (!this._remoteChannels.has(channel)) { + const inst = this._protocol.createProxyToRemoteChannel(channel); + this._remoteChannels.set(channel, inst); + } + return this._remoteChannels.get(channel); + } + async initialize(workerId, loaderConfig, moduleId) { + this._protocol.setWorkerId(workerId); + if (this._requestHandlerFactory) { + // static request handler + this._requestHandler = this._requestHandlerFactory(this); + return; + } + if (loaderConfig) { + // Remove 'baseUrl', handling it is beyond scope for now + if (typeof loaderConfig.baseUrl !== 'undefined') { + delete loaderConfig['baseUrl']; + } + if (typeof loaderConfig.paths !== 'undefined') { + if (typeof loaderConfig.paths.vs !== 'undefined') { + delete loaderConfig.paths['vs']; + } + } + if (typeof loaderConfig.trustedTypesPolicy !== 'undefined') { + // don't use, it has been destroyed during serialize + delete loaderConfig['trustedTypesPolicy']; + } + // Since this is in a web worker, enable catching errors + loaderConfig.catchError = true; + globalThis.require.config(loaderConfig); + } + if (isESM) { + const url = FileAccess.asBrowserUri(`${moduleId}.js`).toString(true); + return import(`${url}`).then((module) => { + this._requestHandler = module.create(this); + if (!this._requestHandler) { + throw new Error(`No RequestHandler!`); + } + }); + } + return new Promise((resolve, reject) => { + // Use the global require to be sure to get the global config + // ESM-comment-begin + // const req = (globalThis.require || require); + // ESM-comment-end + // ESM-uncomment-begin + const req = globalThis.require; + // ESM-uncomment-end + req([moduleId], (module) => { + this._requestHandler = module.create(this); + if (!this._requestHandler) { + reject(new Error(`No RequestHandler!`)); + return; + } + resolve(); + }, reject); + }); + } +} +/** + * Defines the worker entry point. Must be exported and named `create`. + * @skipMangle + */ +export function create(postMessage) { + return new SimpleWorkerServer(postMessage, null); +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js new file mode 100644 index 0000000000000000000000000000000000000000..79ee4e7ae910d1a61231aa823b57bb15c2a07705 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js @@ -0,0 +1,182 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +import { ThrottledDelayer } from '../../../common/async.js'; +import { Event, PauseableEmitter } from '../../../common/event.js'; +import { Disposable } from '../../../common/lifecycle.js'; +import { stringify } from '../../../common/marshalling.js'; +import { isObject, isUndefinedOrNull } from '../../../common/types.js'; +export var StorageHint; +(function (StorageHint) { + // A hint to the storage that the storage + // does not exist on disk yet. This allows + // the storage library to improve startup + // time by not checking the storage for data. + StorageHint[StorageHint["STORAGE_DOES_NOT_EXIST"] = 0] = "STORAGE_DOES_NOT_EXIST"; + // A hint to the storage that the storage + // is backed by an in-memory storage. + StorageHint[StorageHint["STORAGE_IN_MEMORY"] = 1] = "STORAGE_IN_MEMORY"; +})(StorageHint || (StorageHint = {})); +export var StorageState; +(function (StorageState) { + StorageState[StorageState["None"] = 0] = "None"; + StorageState[StorageState["Initialized"] = 1] = "Initialized"; + StorageState[StorageState["Closed"] = 2] = "Closed"; +})(StorageState || (StorageState = {})); +export class Storage extends Disposable { + static { this.DEFAULT_FLUSH_DELAY = 100; } + constructor(database, options = Object.create(null)) { + super(); + this.database = database; + this.options = options; + this._onDidChangeStorage = this._register(new PauseableEmitter()); + this.onDidChangeStorage = this._onDidChangeStorage.event; + this.state = StorageState.None; + this.cache = new Map(); + this.flushDelayer = this._register(new ThrottledDelayer(Storage.DEFAULT_FLUSH_DELAY)); + this.pendingDeletes = new Set(); + this.pendingInserts = new Map(); + this.whenFlushedCallbacks = []; + this.registerListeners(); + } + registerListeners() { + this._register(this.database.onDidChangeItemsExternal(e => this.onDidChangeItemsExternal(e))); + } + onDidChangeItemsExternal(e) { + this._onDidChangeStorage.pause(); + try { + // items that change external require us to update our + // caches with the values. we just accept the value and + // emit an event if there is a change. + e.changed?.forEach((value, key) => this.acceptExternal(key, value)); + e.deleted?.forEach(key => this.acceptExternal(key, undefined)); + } + finally { + this._onDidChangeStorage.resume(); + } + } + acceptExternal(key, value) { + if (this.state === StorageState.Closed) { + return; // Return early if we are already closed + } + let changed = false; + // Item got removed, check for deletion + if (isUndefinedOrNull(value)) { + changed = this.cache.delete(key); + } + // Item got updated, check for change + else { + const currentValue = this.cache.get(key); + if (currentValue !== value) { + this.cache.set(key, value); + changed = true; + } + } + // Signal to outside listeners + if (changed) { + this._onDidChangeStorage.fire({ key, external: true }); + } + } + get(key, fallbackValue) { + const value = this.cache.get(key); + if (isUndefinedOrNull(value)) { + return fallbackValue; + } + return value; + } + getBoolean(key, fallbackValue) { + const value = this.get(key); + if (isUndefinedOrNull(value)) { + return fallbackValue; + } + return value === 'true'; + } + getNumber(key, fallbackValue) { + const value = this.get(key); + if (isUndefinedOrNull(value)) { + return fallbackValue; + } + return parseInt(value, 10); + } + async set(key, value, external = false) { + if (this.state === StorageState.Closed) { + return; // Return early if we are already closed + } + // We remove the key for undefined/null values + if (isUndefinedOrNull(value)) { + return this.delete(key, external); + } + // Otherwise, convert to String and store + const valueStr = isObject(value) || Array.isArray(value) ? stringify(value) : String(value); + // Return early if value already set + const currentValue = this.cache.get(key); + if (currentValue === valueStr) { + return; + } + // Update in cache and pending + this.cache.set(key, valueStr); + this.pendingInserts.set(key, valueStr); + this.pendingDeletes.delete(key); + // Event + this._onDidChangeStorage.fire({ key, external }); + // Accumulate work by scheduling after timeout + return this.doFlush(); + } + async delete(key, external = false) { + if (this.state === StorageState.Closed) { + return; // Return early if we are already closed + } + // Remove from cache and add to pending + const wasDeleted = this.cache.delete(key); + if (!wasDeleted) { + return; // Return early if value already deleted + } + if (!this.pendingDeletes.has(key)) { + this.pendingDeletes.add(key); + } + this.pendingInserts.delete(key); + // Event + this._onDidChangeStorage.fire({ key, external }); + // Accumulate work by scheduling after timeout + return this.doFlush(); + } + get hasPending() { + return this.pendingInserts.size > 0 || this.pendingDeletes.size > 0; + } + async flushPending() { + if (!this.hasPending) { + return; // return early if nothing to do + } + // Get pending data + const updateRequest = { insert: this.pendingInserts, delete: this.pendingDeletes }; + // Reset pending data for next run + this.pendingDeletes = new Set(); + this.pendingInserts = new Map(); + // Update in storage and release any + // waiters we have once done + return this.database.updateItems(updateRequest).finally(() => { + if (!this.hasPending) { + while (this.whenFlushedCallbacks.length) { + this.whenFlushedCallbacks.pop()?.(); + } + } + }); + } + async doFlush(delay) { + if (this.options.hint === StorageHint.STORAGE_IN_MEMORY) { + return this.flushPending(); // return early if in-memory + } + return this.flushDelayer.trigger(() => this.flushPending(), delay); + } +} +export class InMemoryStorageDatabase { + constructor() { + this.onDidChangeItemsExternal = Event.None; + this.items = new Map(); + } + async updateItems(request) { + request.insert?.forEach((value, key) => this.items.set(key, value)); + request.delete?.forEach(key => this.items.delete(key)); + } +} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..cfdb001fe2e8ceb3608b964f1d7f4114996dab62 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/abap/abap.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "abap", + extensions: [".abap"], + aliases: ["abap", "ABAP"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/abap/abap"], resolve, reject); + }); + } else { + return import("./abap.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.js new file mode 100644 index 0000000000000000000000000000000000000000..c15f5d7240428b542b923927d63170c9f7954ec0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.js @@ -0,0 +1,1408 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/abap/abap.ts +var conf = { + comments: { + lineComment: "*" + }, + brackets: [ + ["[", "]"], + ["(", ")"] + ] +}; +var language = { + defaultToken: "invalid", + ignoreCase: true, + tokenPostfix: ".abap", + keywords: [ + "abap-source", + "abbreviated", + "abstract", + "accept", + "accepting", + "according", + "activation", + "actual", + "add", + "add-corresponding", + "adjacent", + "after", + "alias", + "aliases", + "align", + "all", + "allocate", + "alpha", + "analysis", + "analyzer", + "and", + // also an operator + "append", + "appendage", + "appending", + "application", + "archive", + "area", + "arithmetic", + "as", + "ascending", + "aspect", + "assert", + "assign", + "assigned", + "assigning", + "association", + "asynchronous", + "at", + "attributes", + "authority", + "authority-check", + "avg", + "back", + "background", + "backup", + "backward", + "badi", + "base", + "before", + "begin", + "between", + // also an operator + "big", + "binary", + "bintohex", + "bit", + "black", + "blank", + "blanks", + "blob", + "block", + "blocks", + "blue", + "bound", + "boundaries", + "bounds", + "boxed", + "break-point", + "buffer", + "by", + "bypassing", + "byte", + "byte-order", + "call", + "calling", + "case", + "cast", + "casting", + "catch", + "center", + "centered", + "chain", + "chain-input", + "chain-request", + "change", + "changing", + "channels", + "character", + "char-to-hex", + "check", + "checkbox", + "ci_", + "circular", + "class", + "class-coding", + "class-data", + "class-events", + "class-methods", + "class-pool", + "cleanup", + "clear", + "client", + "clob", + "clock", + "close", + "coalesce", + "code", + "coding", + "col_background", + "col_group", + "col_heading", + "col_key", + "col_negative", + "col_normal", + "col_positive", + "col_total", + "collect", + "color", + "column", + "columns", + "comment", + "comments", + "commit", + "common", + "communication", + "comparing", + "component", + "components", + "compression", + "compute", + "concat", + "concat_with_space", + "concatenate", + "cond", + "condense", + // also a built-in + "condition", + "connect", + "connection", + "constants", + "context", + "contexts", + "continue", + "control", + "controls", + "conv", + "conversion", + "convert", + "copies", + "copy", + "corresponding", + "country", + "cover", + "cpi", + "create", + "creating", + "critical", + "currency", + "currency_conversion", + "current", + "cursor", + "cursor-selection", + "customer", + "customer-function", + "dangerous", + "data", + "database", + "datainfo", + "dataset", + "date", + "dats_add_days", + "dats_add_months", + "dats_days_between", + "dats_is_valid", + "daylight", + "dd/mm/yy", + "dd/mm/yyyy", + "ddmmyy", + "deallocate", + "decimal_shift", + "decimals", + "declarations", + "deep", + "default", + "deferred", + "define", + "defining", + "definition", + "delete", + "deleting", + "demand", + "department", + "descending", + "describe", + "destination", + "detail", + "dialog", + "directory", + "disconnect", + "display", + "display-mode", + "distinct", + "divide", + "divide-corresponding", + "division", + "do", + "dummy", + "duplicate", + "duplicates", + "duration", + "during", + "dynamic", + "dynpro", + "edit", + "editor-call", + "else", + "elseif", + "empty", + "enabled", + "enabling", + "encoding", + "end", + "endat", + "endcase", + "endcatch", + "endchain", + "endclass", + "enddo", + "endenhancement", + "end-enhancement-section", + "endexec", + "endform", + "endfunction", + "endian", + "endif", + "ending", + "endinterface", + "end-lines", + "endloop", + "endmethod", + "endmodule", + "end-of-definition", + "end-of-editing", + "end-of-file", + "end-of-page", + "end-of-selection", + "endon", + "endprovide", + "endselect", + "end-test-injection", + "end-test-seam", + "endtry", + "endwhile", + "endwith", + "engineering", + "enhancement", + "enhancement-point", + "enhancements", + "enhancement-section", + "entries", + "entry", + "enum", + "environment", + "equiv", + // also an operator + "errormessage", + "errors", + "escaping", + "event", + "events", + "exact", + "except", + "exception", + "exceptions", + "exception-table", + "exclude", + "excluding", + "exec", + "execute", + "exists", + "exit", + "exit-command", + "expand", + "expanding", + "expiration", + "explicit", + "exponent", + "export", + "exporting", + "extend", + "extended", + "extension", + "extract", + "fail", + "fetch", + "field", + "field-groups", + "fields", + "field-symbol", + "field-symbols", + "file", + "filter", + "filters", + "filter-table", + "final", + "find", + // also a built-in + "first", + "first-line", + "fixed-point", + "fkeq", + "fkge", + "flush", + "font", + "for", + "form", + "format", + "forward", + "found", + "frame", + "frames", + "free", + "friends", + "from", + "function", + "functionality", + "function-pool", + "further", + "gaps", + "generate", + "get", + "giving", + "gkeq", + "gkge", + "global", + "grant", + "green", + "group", + "groups", + "handle", + "handler", + "harmless", + "hashed", + // also a table type + "having", + "hdb", + "header", + "headers", + "heading", + "head-lines", + "help-id", + "help-request", + "hextobin", + "hide", + "high", + "hint", + "hold", + "hotspot", + "icon", + "id", + "identification", + "identifier", + "ids", + "if", + "ignore", + "ignoring", + "immediately", + "implementation", + "implementations", + "implemented", + "implicit", + "import", + "importing", + "in", + // also an operator + "inactive", + "incl", + "include", + "includes", + "including", + "increment", + "index", + // also a table type + "index-line", + "infotypes", + "inheriting", + "init", + "initial", + "initialization", + "inner", + "inout", + "input", + "insert", + // also a built-in + "instance", + "instances", + "instr", + "intensified", + "interface", + "interface-pool", + "interfaces", + "internal", + "intervals", + "into", + "inverse", + "inverted-date", + "is", + "iso", + "job", + "join", + "keep", + "keeping", + "kernel", + "key", + "keys", + "keywords", + "kind", + "language", + "last", + "late", + "layout", + "leading", + "leave", + "left", + "left-justified", + "leftplus", + "leftspace", + "legacy", + "length", + "let", + "level", + "levels", + "like", + "line", + "lines", + // also a built-in + "line-count", + "linefeed", + "line-selection", + "line-size", + "list", + "listbox", + "list-processing", + "little", + "llang", + "load", + "load-of-program", + "lob", + "local", + "locale", + "locator", + "logfile", + "logical", + "log-point", + "long", + "loop", + "low", + "lower", + "lpad", + "lpi", + "ltrim", + "mail", + "main", + "major-id", + "mapping", + "margin", + "mark", + "mask", + "match", + // also a built-in + "matchcode", + "max", + "maximum", + "medium", + "members", + "memory", + "mesh", + "message", + "message-id", + "messages", + "messaging", + "method", + "methods", + "min", + "minimum", + "minor-id", + "mm/dd/yy", + "mm/dd/yyyy", + "mmddyy", + "mode", + "modif", + "modifier", + "modify", + "module", + "move", + "move-corresponding", + "multiply", + "multiply-corresponding", + "name", + "nametab", + "native", + "nested", + "nesting", + "new", + "new-line", + "new-page", + "new-section", + "next", + "no", + "no-display", + "no-extension", + "no-gap", + "no-gaps", + "no-grouping", + "no-heading", + "no-scrolling", + "no-sign", + "no-title", + "no-topofpage", + "no-zero", + "node", + "nodes", + "non-unicode", + "non-unique", + "not", + // also an operator + "null", + "number", + "object", + // also a data type + "objects", + "obligatory", + "occurrence", + "occurrences", + "occurs", + "of", + "off", + "offset", + "ole", + "on", + "only", + "open", + "option", + "optional", + "options", + "or", + // also an operator + "order", + "other", + "others", + "out", + "outer", + "output", + "output-length", + "overflow", + "overlay", + "pack", + "package", + "pad", + "padding", + "page", + "pages", + "parameter", + "parameters", + "parameter-table", + "part", + "partially", + "pattern", + "percentage", + "perform", + "performing", + "person", + "pf1", + "pf10", + "pf11", + "pf12", + "pf13", + "pf14", + "pf15", + "pf2", + "pf3", + "pf4", + "pf5", + "pf6", + "pf7", + "pf8", + "pf9", + "pf-status", + "pink", + "places", + "pool", + "pos_high", + "pos_low", + "position", + "pragmas", + "precompiled", + "preferred", + "preserving", + "primary", + "print", + "print-control", + "priority", + "private", + "procedure", + "process", + "program", + "property", + "protected", + "provide", + "public", + "push", + "pushbutton", + "put", + "queue-only", + "quickinfo", + "radiobutton", + "raise", + "raising", + "range", + "ranges", + "read", + "reader", + "read-only", + "receive", + "received", + "receiver", + "receiving", + "red", + "redefinition", + "reduce", + "reduced", + "ref", + "reference", + "refresh", + "regex", + "reject", + "remote", + "renaming", + "replace", + // also a built-in + "replacement", + "replacing", + "report", + "request", + "requested", + "reserve", + "reset", + "resolution", + "respecting", + "responsible", + "result", + "results", + "resumable", + "resume", + "retry", + "return", + "returncode", + "returning", + "returns", + "right", + "right-justified", + "rightplus", + "rightspace", + "risk", + "rmc_communication_failure", + "rmc_invalid_status", + "rmc_system_failure", + "role", + "rollback", + "rows", + "rpad", + "rtrim", + "run", + "sap", + "sap-spool", + "saving", + "scale_preserving", + "scale_preserving_scientific", + "scan", + "scientific", + "scientific_with_leading_zero", + "scroll", + "scroll-boundary", + "scrolling", + "search", + "secondary", + "seconds", + "section", + "select", + "selection", + "selections", + "selection-screen", + "selection-set", + "selection-sets", + "selection-table", + "select-options", + "send", + "separate", + "separated", + "set", + "shared", + "shift", + "short", + "shortdump-id", + "sign_as_postfix", + "single", + "size", + "skip", + "skipping", + "smart", + "some", + "sort", + "sortable", + "sorted", + // also a table type + "source", + "specified", + "split", + "spool", + "spots", + "sql", + "sqlscript", + "stable", + "stamp", + "standard", + // also a table type + "starting", + "start-of-editing", + "start-of-selection", + "state", + "statement", + "statements", + "static", + "statics", + "statusinfo", + "step-loop", + "stop", + "structure", + "structures", + "style", + "subkey", + "submatches", + "submit", + "subroutine", + "subscreen", + "subtract", + "subtract-corresponding", + "suffix", + "sum", + "summary", + "summing", + "supplied", + "supply", + "suppress", + "switch", + "switchstates", + "symbol", + "syncpoints", + "syntax", + "syntax-check", + "syntax-trace", + "system-call", + "system-exceptions", + "system-exit", + "tab", + "tabbed", + "table", + "tables", + "tableview", + "tabstrip", + "target", + "task", + "tasks", + "test", + "testing", + "test-injection", + "test-seam", + "text", + "textpool", + "then", + "throw", + "time", + "times", + "timestamp", + "timezone", + "tims_is_valid", + "title", + "titlebar", + "title-lines", + "to", + "tokenization", + "tokens", + "top-lines", + "top-of-page", + "trace-file", + "trace-table", + "trailing", + "transaction", + "transfer", + "transformation", + "translate", + // also a built-in + "transporting", + "trmac", + "truncate", + "truncation", + "try", + "tstmp_add_seconds", + "tstmp_current_utctimestamp", + "tstmp_is_valid", + "tstmp_seconds_between", + "type", + "type-pool", + "type-pools", + "types", + "uline", + "unassign", + "under", + "unicode", + "union", + "unique", + "unit_conversion", + "unix", + "unpack", + "until", + "unwind", + "up", + "update", + "upper", + "user", + "user-command", + "using", + "utf-8", + "valid", + "value", + "value-request", + "values", + "vary", + "varying", + "verification-message", + "version", + "via", + "view", + "visible", + "wait", + "warning", + "when", + "whenever", + "where", + "while", + "width", + "window", + "windows", + "with", + "with-heading", + "without", + "with-title", + "word", + "work", + "write", + "writer", + "xml", + "xsd", + "yellow", + "yes", + "yymmdd", + "zero", + "zone", + // since 7.55: + "abap_system_timezone", + "abap_user_timezone", + "access", + "action", + "adabas", + "adjust_numbers", + "allow_precision_loss", + "allowed", + "amdp", + "applicationuser", + "as_geo_json", + "as400", + "associations", + "balance", + "behavior", + "breakup", + "bulk", + "cds", + "cds_client", + "check_before_save", + "child", + "clients", + "corr", + "corr_spearman", + "cross", + "cycles", + "datn_add_days", + "datn_add_months", + "datn_days_between", + "dats_from_datn", + "dats_tims_to_tstmp", + "dats_to_datn", + "db2", + "db6", + "ddl", + "dense_rank", + "depth", + "deterministic", + "discarding", + "entities", + "entity", + "error", + "failed", + "finalize", + "first_value", + "fltp_to_dec", + "following", + "fractional", + "full", + "graph", + "grouping", + "hierarchy", + "hierarchy_ancestors", + "hierarchy_ancestors_aggregate", + "hierarchy_descendants", + "hierarchy_descendants_aggregate", + "hierarchy_siblings", + "incremental", + "indicators", + "lag", + "last_value", + "lead", + "leaves", + "like_regexpr", + "link", + "locale_sap", + "lock", + "locks", + "many", + "mapped", + "matched", + "measures", + "median", + "mssqlnt", + "multiple", + "nodetype", + "ntile", + "nulls", + "occurrences_regexpr", + "one", + "operations", + "oracle", + "orphans", + "over", + "parent", + "parents", + "partition", + "pcre", + "period", + "pfcg_mapping", + "preceding", + "privileged", + "product", + "projection", + "rank", + "redirected", + "replace_regexpr", + "reported", + "response", + "responses", + "root", + "row", + "row_number", + "sap_system_date", + "save", + "schema", + "session", + "sets", + "shortdump", + "siblings", + "spantree", + "start", + "stddev", + "string_agg", + "subtotal", + "sybase", + "tims_from_timn", + "tims_to_timn", + "to_blob", + "to_clob", + "total", + "trace-entry", + "tstmp_to_dats", + "tstmp_to_dst", + "tstmp_to_tims", + "tstmpl_from_utcl", + "tstmpl_to_utcl", + "unbounded", + "utcl_add_seconds", + "utcl_current", + "utcl_seconds_between", + "uuid", + "var", + "verbatim" + ], + // + // Built-in Functions + // + // Functions that are also statements have been moved to keywords + // + builtinFunctions: [ + "abs", + "acos", + "asin", + "atan", + "bit-set", + "boolc", + "boolx", + "ceil", + "char_off", + "charlen", + "cmax", + "cmin", + "concat_lines_of", + // 'condense', // moved to keywords + "contains", + "contains_any_not_of", + "contains_any_of", + "cos", + "cosh", + "count", + "count_any_not_of", + "count_any_of", + "dbmaxlen", + "distance", + "escape", + "exp", + // 'find', // moved to keywords + "find_any_not_of", + "find_any_of", + "find_end", + "floor", + "frac", + "from_mixed", + // 'insert', // moved to keywords + "ipow", + "line_exists", + "line_index", + // 'lines', // moved to keywords + "log", + "log10", + // 'match', // moved to keywords + "matches", + "nmax", + "nmin", + "numofchar", + "repeat", + // 'replace', // moved to keywords + "rescale", + "reverse", + "round", + "segment", + "shift_left", + "shift_right", + "sign", + "sin", + "sinh", + "sqrt", + "strlen", + "substring", + "substring_after", + "substring_before", + "substring_from", + "substring_to", + "tan", + "tanh", + "to_lower", + "to_mixed", + "to_upper", + // 'translate', // moved to keywords + "trunc", + "utclong_add", + // since 7.54 + "utclong_current", + // since 7.54 + "utclong_diff", + // since 7.54 + "xsdbool", + "xstrlen" + ], + // + // Data Types + // + // Data types that are also part of statements have been moved to keywords + // + typeKeywords: [ + // built-in abap types + "b", + "c", + "d", + "decfloat16", + "decfloat34", + "f", + "i", + "int8", + // since 7.54 + "n", + "p", + "s", + "string", + "t", + "utclong", + // since 7.54 + "x", + "xstring", + // generic data types + "any", + "clike", + "csequence", + "decfloat", + // 'object', // moved to keywords + "numeric", + "simple", + "xsequence", + // ddic/sql data types + "accp", + "char", + "clnt", + "cuky", + "curr", + "datn", + // since 7.55 + "dats", + "d16d", + // since 7.55 + "d16n", + // since 7.55 + "d16r", + // since 7.55 + "d34d", + // since 7.55 + "d34n", + // since 7.55 + "d34r", + // since 7.55 + "dec", + "df16_dec", + "df16_raw", + "df34_dec", + "df34_raw", + "fltp", + "geom_ewkb", + // since 7.55 + "int1", + "int2", + "int4", + "lang", + "lchr", + "lraw", + "numc", + "quan", + "raw", + "rawstring", + "sstring", + "timn", + // since 7.55 + "tims", + "unit", + "utcl", + // since 7.55 + // ddic data types (obsolete) + "df16_scl", + "df34_scl", + "prec", + "varc", + // special data types and constants + "abap_bool", + "abap_false", + "abap_true", + "abap_undefined", + "me", + "screen", + "space", + "super", + "sy", + "syst", + "table_line", + // obsolete data object + "*sys*" + ], + builtinMethods: ["class_constructor", "constructor"], + derivedTypes: [ + "%CID", + "%CID_REF", + "%CONTROL", + "%DATA", + "%ELEMENT", + "%FAIL", + "%KEY", + "%MSG", + "%PARAM", + "%PID", + "%PID_ASSOC", + "%PID_PARENT", + "%_HINTS" + ], + cdsLanguage: [ + "@AbapAnnotation", + "@AbapCatalog", + "@AccessControl", + "@API", + "@ClientDependent", + "@ClientHandling", + "@CompatibilityContract", + "@DataAging", + "@EndUserText", + "@Environment", + "@LanguageDependency", + "@MappingRole", + "@Metadata", + "@MetadataExtension", + "@ObjectModel", + "@Scope", + "@Semantics", + "$EXTENSION", + "$SELF" + ], + selectors: ["->", "->*", "=>", "~", "~*"], + // + // Operators + // + // Operators that can be part of statements have been moved to keywords + // + operators: [ + // arithmetic operators + " +", + " -", + "/", + "*", + "**", + "div", + "mod", + // assignment operators + "=", + "#", + "@", + "+=", + "-=", + "*=", + "/=", + "**=", + "&&=", + // casting operator + "?=", + // concat operators + "&", + "&&", + // bit operators + "bit-and", + "bit-not", + "bit-or", + "bit-xor", + "m", + "o", + "z", + // boolean operators + // 'and', // moved to keywords + // 'equiv', // moved to keywords + // 'not', // moved to keywords + // 'or', // moved to keywords + // comparison operators + "<", + " >", + // todo: separate from -> and => + "<=", + ">=", + "<>", + "><", + // obsolete + "=<", + // obsolete + "=>", + // obsolete + // 'between', // moved to keywords + "bt", + "byte-ca", + "byte-cn", + "byte-co", + "byte-cs", + "byte-na", + "byte-ns", + "ca", + "cn", + "co", + "cp", + "cs", + "eq", + // obsolete + "ge", + // obsolete + "gt", + // obsolete + // 'in', // moved to keywords + "le", + // obsolete + "lt", + // obsolete + "na", + "nb", + "ne", + // obsolete + "np", + "ns", + // cds + "*/", + "*:", + "--", + "/*", + "//" + ], + symbols: /[=>))*/, + // exclude '->' selector + { + cases: { + "@typeKeywords": "type", + "@keywords": "keyword", + "@cdsLanguage": "annotation", + "@derivedTypes": "type", + "@builtinFunctions": "type", + "@builtinMethods": "type", + "@operators": "key", + "@default": "identifier" + } + } + ], + [/<[\w]+>/, "identifier"], + // field symbols + [/##[\w|_]+/, "comment"], + // pragmas + { include: "@whitespace" }, + [/[:,.]/, "delimiter"], + [/[{}()\[\]]/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@selectors": "tag", + "@operators": "key", + "@default": "" + } + } + ], + [/'/, { token: "string", bracket: "@open", next: "@stringquote" }], + [/`/, { token: "string", bracket: "@open", next: "@stringping" }], + [/\|/, { token: "string", bracket: "@open", next: "@stringtemplate" }], + [/\d+/, "number"] + ], + stringtemplate: [ + [/[^\\\|]+/, "string"], + [/\\\|/, "string"], + [/\|/, { token: "string", bracket: "@close", next: "@pop" }] + ], + stringping: [ + [/[^\\`]+/, "string"], + [/`/, { token: "string", bracket: "@close", next: "@pop" }] + ], + stringquote: [ + [/[^\\']+/, "string"], + [/'/, { token: "string", bracket: "@close", next: "@pop" }] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/^\*.*$/, "comment"], + [/\".*$/, "comment"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..61662bed9fbb3c95f597bbbcc9871d2af03762c2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.contribution.js @@ -0,0 +1,25 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/apex/apex.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "apex", + extensions: [".cls"], + aliases: ["Apex", "apex"], + mimetypes: ["text/x-apex-source", "text/x-apex"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/apex/apex"], resolve, reject); + }); + } else { + return import("./apex.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.js new file mode 100644 index 0000000000000000000000000000000000000000..416e669dd054a7583a402f5dea7872f3dd075e42 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.js @@ -0,0 +1,340 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/apex/apex.ts +var conf = { + // the default separators except `@$` + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: "<", close: ">" } + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))") + } + } +}; +var keywords = [ + "abstract", + "activate", + "and", + "any", + "array", + "as", + "asc", + "assert", + "autonomous", + "begin", + "bigdecimal", + "blob", + "boolean", + "break", + "bulk", + "by", + "case", + "cast", + "catch", + "char", + "class", + "collect", + "commit", + "const", + "continue", + "convertcurrency", + "decimal", + "default", + "delete", + "desc", + "do", + "double", + "else", + "end", + "enum", + "exception", + "exit", + "export", + "extends", + "false", + "final", + "finally", + "float", + "for", + "from", + "future", + "get", + "global", + "goto", + "group", + "having", + "hint", + "if", + "implements", + "import", + "in", + "inner", + "insert", + "instanceof", + "int", + "interface", + "into", + "join", + "last_90_days", + "last_month", + "last_n_days", + "last_week", + "like", + "limit", + "list", + "long", + "loop", + "map", + "merge", + "native", + "new", + "next_90_days", + "next_month", + "next_n_days", + "next_week", + "not", + "null", + "nulls", + "number", + "object", + "of", + "on", + "or", + "outer", + "override", + "package", + "parallel", + "pragma", + "private", + "protected", + "public", + "retrieve", + "return", + "returning", + "rollback", + "savepoint", + "search", + "select", + "set", + "short", + "sort", + "stat", + "static", + "strictfp", + "super", + "switch", + "synchronized", + "system", + "testmethod", + "then", + "this", + "this_month", + "this_week", + "throw", + "throws", + "today", + "tolabel", + "tomorrow", + "transaction", + "transient", + "trigger", + "true", + "try", + "type", + "undelete", + "update", + "upsert", + "using", + "virtual", + "void", + "volatile", + "webservice", + "when", + "where", + "while", + "yesterday" +]; +var uppercaseFirstLetter = (lowercase) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1); +var keywordsWithCaseVariations = []; +keywords.forEach((lowercase) => { + keywordsWithCaseVariations.push(lowercase); + keywordsWithCaseVariations.push(lowercase.toUpperCase()); + keywordsWithCaseVariations.push(uppercaseFirstLetter(lowercase)); +}); +var language = { + defaultToken: "", + tokenPostfix: ".apex", + keywords: keywordsWithCaseVariations, + operators: [ + "=", + ">", + "<", + "!", + "~", + "?", + ":", + "==", + "<=", + ">=", + "!=", + "&&", + "||", + "++", + "--", + "+", + "-", + "*", + "/", + "&", + "|", + "^", + "%", + "<<", + ">>", + ">>>", + "+=", + "-=", + "*=", + "/=", + "&=", + "|=", + "^=", + "%=", + "<<=", + ">>=", + ">>>=" + ], + // we include these common regular expressions + symbols: /[=>](?!@symbols)/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // @ annotations. + [/@\s*[a-zA-Z_\$][\w\$]*/, "annotation"], + // numbers + [/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, "number.float"], + [/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, "number.float"], + [/(@digits)[fFdD]/, "number.float"], + [/(@digits)[lL]?/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/'([^'\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, "string", '@string."'], + [/'/, "string", "@string.'"], + // characters + [/'[^\\']'/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/\/\*\*(?!\/)/, "comment.doc", "@apexdoc"], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^\/*]+/, "comment"], + // [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-( + // [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/ + [/\*\//, "comment", "@pop"], + [/[\/*]/, "comment"] + ], + //Identical copy of comment above, except for the addition of .doc + apexdoc: [ + [/[^\/*]+/, "comment.doc"], + [/\*\//, "comment.doc", "@pop"], + [/[\/*]/, "comment.doc"] + ], + string: [ + [/[^\\"']+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [ + /["']/, + { + cases: { + "$#==$S2": { token: "string", next: "@pop" }, + "@default": "string" + } + } + ] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..d49cd2d4c2b064f5a979eb694d7f2dbfad8c480e --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/azcli/azcli.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "azcli", + extensions: [".azcli"], + aliases: ["Azure CLI", "azcli"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/azcli/azcli"], resolve, reject); + }); + } else { + return import("./azcli.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.js new file mode 100644 index 0000000000000000000000000000000000000000..0b4706e8f8be0e877eb90cab8566e775a751ba2f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.js @@ -0,0 +1,78 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/azcli/azcli.ts +var conf = { + comments: { + lineComment: "#" + } +}; +var language = { + defaultToken: "keyword", + ignoreCase: true, + tokenPostfix: ".azcli", + str: /[^#\s]/, + tokenizer: { + root: [ + { include: "@comment" }, + [ + /\s-+@str*\s*/, + { + cases: { + "@eos": { token: "key.identifier", next: "@popall" }, + "@default": { token: "key.identifier", next: "@type" } + } + } + ], + [ + /^-+@str*\s*/, + { + cases: { + "@eos": { token: "key.identifier", next: "@popall" }, + "@default": { token: "key.identifier", next: "@type" } + } + } + ] + ], + type: [ + { include: "@comment" }, + [ + /-+@str*\s*/, + { + cases: { + "@eos": { token: "key.identifier", next: "@popall" }, + "@default": "key.identifier" + } + } + ], + [ + /@str+\s*/, + { + cases: { + "@eos": { token: "string", next: "@popall" }, + "@default": "string" + } + } + ] + ], + comment: [ + [ + /#.*$/, + { + cases: { + "@eos": { token: "comment", next: "@popall" } + } + } + ] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..993afd84148e40e5e6717bebf83c35bd601beda5 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/bat/bat.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "bat", + extensions: [".bat", ".cmd"], + aliases: ["Batch", "bat"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/bat/bat"], resolve, reject); + }); + } else { + return import("./bat.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.js new file mode 100644 index 0000000000000000000000000000000000000000..b14dd4a298716c3db255d035f80edc357dc09ae3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.js @@ -0,0 +1,110 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/bat/bat.ts +var conf = { + comments: { + lineComment: "REM" + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' } + ], + surroundingPairs: [ + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' } + ], + folding: { + markers: { + start: new RegExp("^\\s*(::\\s*|REM\\s+)#region"), + end: new RegExp("^\\s*(::\\s*|REM\\s+)#endregion") + } + } +}; +var language = { + defaultToken: "", + ignoreCase: true, + tokenPostfix: ".bat", + brackets: [ + { token: "delimiter.bracket", open: "{", close: "}" }, + { token: "delimiter.parenthesis", open: "(", close: ")" }, + { token: "delimiter.square", open: "[", close: "]" } + ], + keywords: /call|defined|echo|errorlevel|exist|for|goto|if|pause|set|shift|start|title|not|pushd|popd/, + // we include these common regular expressions + symbols: /[=> { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/bicep/bicep"], resolve, reject); + }); + } else { + return import("./bicep.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bicep/bicep.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bicep/bicep.js new file mode 100644 index 0000000000000000000000000000000000000000..7ed2572496de206611768af12d10c7b82c2e9fde --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/bicep/bicep.js @@ -0,0 +1,119 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/bicep/bicep.ts +var bounded = (text) => `\\b${text}\\b`; +var identifierStart = "[_a-zA-Z]"; +var identifierContinue = "[_a-zA-Z0-9]"; +var identifier = bounded(`${identifierStart}${identifierContinue}*`); +var keywords = [ + "targetScope", + "resource", + "module", + "param", + "var", + "output", + "for", + "in", + "if", + "existing" +]; +var namedLiterals = ["true", "false", "null"]; +var nonCommentWs = `[ \\t\\r\\n]`; +var numericLiteral = `[0-9]+`; +var conf = { + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "'", close: "'" }, + { open: "'''", close: "'''" } + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: "'''", close: "'''", notIn: ["string", "comment"] } + ], + autoCloseBefore: ":.,=}])' \n ", + indentationRules: { + increaseIndentPattern: new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"), + decreaseIndentPattern: new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$") + } +}; +var language = { + defaultToken: "", + tokenPostfix: ".bicep", + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" } + ], + symbols: /[=> { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/cameligo/cameligo"], resolve, reject); + }); + } else { + return import("./cameligo.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cameligo/cameligo.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cameligo/cameligo.js new file mode 100644 index 0000000000000000000000000000000000000000..63dcabbb2bc32d6f3c2030cb8e328e064b88b9b0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cameligo/cameligo.js @@ -0,0 +1,184 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/cameligo/cameligo.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["(*", "*)"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["<", ">"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" }, + { open: "'", close: "'" }, + { open: '"', close: '"' }, + { open: "(*", close: "*)" } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" }, + { open: "'", close: "'" }, + { open: '"', close: '"' }, + { open: "(*", close: "*)" } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: ".cameligo", + ignoreCase: true, + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "<", close: ">", token: "delimiter.angle" } + ], + keywords: [ + "abs", + "assert", + "block", + "Bytes", + "case", + "Crypto", + "Current", + "else", + "failwith", + "false", + "for", + "fun", + "if", + "in", + "let", + "let%entry", + "let%init", + "List", + "list", + "Map", + "map", + "match", + "match%nat", + "mod", + "not", + "operation", + "Operation", + "of", + "record", + "Set", + "set", + "sender", + "skip", + "source", + "String", + "then", + "to", + "true", + "type", + "with" + ], + typeKeywords: ["int", "unit", "string", "tz", "nat", "bool"], + operators: [ + "=", + ">", + "<", + "<=", + ">=", + "<>", + ":", + ":=", + "and", + "mod", + "or", + "+", + "-", + "*", + "/", + "@", + "&", + "^", + "%", + "->", + "<-", + "&&", + "||" + ], + // we include these common regular expressions + symbols: /[=><:@\^&|+\-*\/\^%]+/, + // The main tokenizer for our languages + tokenizer: { + root: [ + // identifiers and keywords + [ + /[a-zA-Z_][\w]*/, + { + cases: { + "@keywords": { token: "keyword.$0" }, + "@default": "identifier" + } + } + ], + // whitespace + { include: "@whitespace" }, + // delimiters and operators + [/[{}()\[\]]/, "@brackets"], + [/[<>](?!@symbols)/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], + [/\$[0-9a-fA-F]{1,16}/, "number.hex"], + [/\d+/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/'([^'\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/'/, "string", "@string"], + // characters + [/'[^\\']'/, "string"], + [/'/, "string.invalid"], + [/\#\d+/, "string"] + ], + /* */ + comment: [ + [/[^\(\*]+/, "comment"], + //[/\(\*/, 'comment', '@push' ], // nested comment not allowed :-( + [/\*\)/, "comment", "@pop"], + [/\(\*/, "comment"] + ], + string: [ + [/[^\\']+/, "string"], + [/\\./, "string.escape.invalid"], + [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }] + ], + whitespace: [ + [/[ \t\r\n]+/, "white"], + [/\(\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..93ee7c6ca6e385d855cd33ae9c4617664991e472 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/clojure/clojure.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "clojure", + extensions: [".clj", ".cljs", ".cljc", ".edn"], + aliases: ["clojure", "Clojure"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/clojure/clojure"], resolve, reject); + }); + } else { + return import("./clojure.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fe18e864142eb91aaabb9e938b38bdc75af162 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.js @@ -0,0 +1,771 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/clojure/clojure.ts +var conf = { + comments: { + lineComment: ";;" + }, + brackets: [ + ["[", "]"], + ["(", ")"], + ["{", "}"] + ], + autoClosingPairs: [ + { open: "[", close: "]" }, + { open: '"', close: '"' }, + { open: "(", close: ")" }, + { open: "{", close: "}" } + ], + surroundingPairs: [ + { open: "[", close: "]" }, + { open: '"', close: '"' }, + { open: "(", close: ")" }, + { open: "{", close: "}" } + ] +}; +var language = { + defaultToken: "", + ignoreCase: true, + tokenPostfix: ".clj", + brackets: [ + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "{", close: "}", token: "delimiter.curly" } + ], + constants: ["true", "false", "nil"], + // delimiters: /[\\\[\]\s"#'(),;@^`{}~]|$/, + numbers: /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/, + characters: /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/, + escapes: /^\\(?:["'\\bfnrt]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, + // simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*/ + // simple-symbol := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/ + // qualified-symbol := ((<.>)*)? + qualifiedSymbols: /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/, + specialForms: [ + ".", + "catch", + "def", + "do", + "if", + "monitor-enter", + "monitor-exit", + "new", + "quote", + "recur", + "set!", + "throw", + "try", + "var" + ], + coreSymbols: [ + "*", + "*'", + "*1", + "*2", + "*3", + "*agent*", + "*allow-unresolved-vars*", + "*assert*", + "*clojure-version*", + "*command-line-args*", + "*compile-files*", + "*compile-path*", + "*compiler-options*", + "*data-readers*", + "*default-data-reader-fn*", + "*e", + "*err*", + "*file*", + "*flush-on-newline*", + "*fn-loader*", + "*in*", + "*math-context*", + "*ns*", + "*out*", + "*print-dup*", + "*print-length*", + "*print-level*", + "*print-meta*", + "*print-namespace-maps*", + "*print-readably*", + "*read-eval*", + "*reader-resolver*", + "*source-path*", + "*suppress-read*", + "*unchecked-math*", + "*use-context-classloader*", + "*verbose-defrecords*", + "*warn-on-reflection*", + "+", + "+'", + "-", + "-'", + "->", + "->>", + "->ArrayChunk", + "->Eduction", + "->Vec", + "->VecNode", + "->VecSeq", + "-cache-protocol-fn", + "-reset-methods", + "..", + "/", + "<", + "<=", + "=", + "==", + ">", + ">=", + "EMPTY-NODE", + "Inst", + "StackTraceElement->vec", + "Throwable->map", + "accessor", + "aclone", + "add-classpath", + "add-watch", + "agent", + "agent-error", + "agent-errors", + "aget", + "alength", + "alias", + "all-ns", + "alter", + "alter-meta!", + "alter-var-root", + "amap", + "ancestors", + "and", + "any?", + "apply", + "areduce", + "array-map", + "as->", + "aset", + "aset-boolean", + "aset-byte", + "aset-char", + "aset-double", + "aset-float", + "aset-int", + "aset-long", + "aset-short", + "assert", + "assoc", + "assoc!", + "assoc-in", + "associative?", + "atom", + "await", + "await-for", + "await1", + "bases", + "bean", + "bigdec", + "bigint", + "biginteger", + "binding", + "bit-and", + "bit-and-not", + "bit-clear", + "bit-flip", + "bit-not", + "bit-or", + "bit-set", + "bit-shift-left", + "bit-shift-right", + "bit-test", + "bit-xor", + "boolean", + "boolean-array", + "boolean?", + "booleans", + "bound-fn", + "bound-fn*", + "bound?", + "bounded-count", + "butlast", + "byte", + "byte-array", + "bytes", + "bytes?", + "case", + "cast", + "cat", + "char", + "char-array", + "char-escape-string", + "char-name-string", + "char?", + "chars", + "chunk", + "chunk-append", + "chunk-buffer", + "chunk-cons", + "chunk-first", + "chunk-next", + "chunk-rest", + "chunked-seq?", + "class", + "class?", + "clear-agent-errors", + "clojure-version", + "coll?", + "comment", + "commute", + "comp", + "comparator", + "compare", + "compare-and-set!", + "compile", + "complement", + "completing", + "concat", + "cond", + "cond->", + "cond->>", + "condp", + "conj", + "conj!", + "cons", + "constantly", + "construct-proxy", + "contains?", + "count", + "counted?", + "create-ns", + "create-struct", + "cycle", + "dec", + "dec'", + "decimal?", + "declare", + "dedupe", + "default-data-readers", + "definline", + "definterface", + "defmacro", + "defmethod", + "defmulti", + "defn", + "defn-", + "defonce", + "defprotocol", + "defrecord", + "defstruct", + "deftype", + "delay", + "delay?", + "deliver", + "denominator", + "deref", + "derive", + "descendants", + "destructure", + "disj", + "disj!", + "dissoc", + "dissoc!", + "distinct", + "distinct?", + "doall", + "dorun", + "doseq", + "dosync", + "dotimes", + "doto", + "double", + "double-array", + "double?", + "doubles", + "drop", + "drop-last", + "drop-while", + "eduction", + "empty", + "empty?", + "ensure", + "ensure-reduced", + "enumeration-seq", + "error-handler", + "error-mode", + "eval", + "even?", + "every-pred", + "every?", + "ex-data", + "ex-info", + "extend", + "extend-protocol", + "extend-type", + "extenders", + "extends?", + "false?", + "ffirst", + "file-seq", + "filter", + "filterv", + "find", + "find-keyword", + "find-ns", + "find-protocol-impl", + "find-protocol-method", + "find-var", + "first", + "flatten", + "float", + "float-array", + "float?", + "floats", + "flush", + "fn", + "fn?", + "fnext", + "fnil", + "for", + "force", + "format", + "frequencies", + "future", + "future-call", + "future-cancel", + "future-cancelled?", + "future-done?", + "future?", + "gen-class", + "gen-interface", + "gensym", + "get", + "get-in", + "get-method", + "get-proxy-class", + "get-thread-bindings", + "get-validator", + "group-by", + "halt-when", + "hash", + "hash-combine", + "hash-map", + "hash-ordered-coll", + "hash-set", + "hash-unordered-coll", + "ident?", + "identical?", + "identity", + "if-let", + "if-not", + "if-some", + "ifn?", + "import", + "in-ns", + "inc", + "inc'", + "indexed?", + "init-proxy", + "inst-ms", + "inst-ms*", + "inst?", + "instance?", + "int", + "int-array", + "int?", + "integer?", + "interleave", + "intern", + "interpose", + "into", + "into-array", + "ints", + "io!", + "isa?", + "iterate", + "iterator-seq", + "juxt", + "keep", + "keep-indexed", + "key", + "keys", + "keyword", + "keyword?", + "last", + "lazy-cat", + "lazy-seq", + "let", + "letfn", + "line-seq", + "list", + "list*", + "list?", + "load", + "load-file", + "load-reader", + "load-string", + "loaded-libs", + "locking", + "long", + "long-array", + "longs", + "loop", + "macroexpand", + "macroexpand-1", + "make-array", + "make-hierarchy", + "map", + "map-entry?", + "map-indexed", + "map?", + "mapcat", + "mapv", + "max", + "max-key", + "memfn", + "memoize", + "merge", + "merge-with", + "meta", + "method-sig", + "methods", + "min", + "min-key", + "mix-collection-hash", + "mod", + "munge", + "name", + "namespace", + "namespace-munge", + "nat-int?", + "neg-int?", + "neg?", + "newline", + "next", + "nfirst", + "nil?", + "nnext", + "not", + "not-any?", + "not-empty", + "not-every?", + "not=", + "ns", + "ns-aliases", + "ns-imports", + "ns-interns", + "ns-map", + "ns-name", + "ns-publics", + "ns-refers", + "ns-resolve", + "ns-unalias", + "ns-unmap", + "nth", + "nthnext", + "nthrest", + "num", + "number?", + "numerator", + "object-array", + "odd?", + "or", + "parents", + "partial", + "partition", + "partition-all", + "partition-by", + "pcalls", + "peek", + "persistent!", + "pmap", + "pop", + "pop!", + "pop-thread-bindings", + "pos-int?", + "pos?", + "pr", + "pr-str", + "prefer-method", + "prefers", + "primitives-classnames", + "print", + "print-ctor", + "print-dup", + "print-method", + "print-simple", + "print-str", + "printf", + "println", + "println-str", + "prn", + "prn-str", + "promise", + "proxy", + "proxy-call-with-super", + "proxy-mappings", + "proxy-name", + "proxy-super", + "push-thread-bindings", + "pvalues", + "qualified-ident?", + "qualified-keyword?", + "qualified-symbol?", + "quot", + "rand", + "rand-int", + "rand-nth", + "random-sample", + "range", + "ratio?", + "rational?", + "rationalize", + "re-find", + "re-groups", + "re-matcher", + "re-matches", + "re-pattern", + "re-seq", + "read", + "read-line", + "read-string", + "reader-conditional", + "reader-conditional?", + "realized?", + "record?", + "reduce", + "reduce-kv", + "reduced", + "reduced?", + "reductions", + "ref", + "ref-history-count", + "ref-max-history", + "ref-min-history", + "ref-set", + "refer", + "refer-clojure", + "reify", + "release-pending-sends", + "rem", + "remove", + "remove-all-methods", + "remove-method", + "remove-ns", + "remove-watch", + "repeat", + "repeatedly", + "replace", + "replicate", + "require", + "reset!", + "reset-meta!", + "reset-vals!", + "resolve", + "rest", + "restart-agent", + "resultset-seq", + "reverse", + "reversible?", + "rseq", + "rsubseq", + "run!", + "satisfies?", + "second", + "select-keys", + "send", + "send-off", + "send-via", + "seq", + "seq?", + "seqable?", + "seque", + "sequence", + "sequential?", + "set", + "set-agent-send-executor!", + "set-agent-send-off-executor!", + "set-error-handler!", + "set-error-mode!", + "set-validator!", + "set?", + "short", + "short-array", + "shorts", + "shuffle", + "shutdown-agents", + "simple-ident?", + "simple-keyword?", + "simple-symbol?", + "slurp", + "some", + "some->", + "some->>", + "some-fn", + "some?", + "sort", + "sort-by", + "sorted-map", + "sorted-map-by", + "sorted-set", + "sorted-set-by", + "sorted?", + "special-symbol?", + "spit", + "split-at", + "split-with", + "str", + "string?", + "struct", + "struct-map", + "subs", + "subseq", + "subvec", + "supers", + "swap!", + "swap-vals!", + "symbol", + "symbol?", + "sync", + "tagged-literal", + "tagged-literal?", + "take", + "take-last", + "take-nth", + "take-while", + "test", + "the-ns", + "thread-bound?", + "time", + "to-array", + "to-array-2d", + "trampoline", + "transduce", + "transient", + "tree-seq", + "true?", + "type", + "unchecked-add", + "unchecked-add-int", + "unchecked-byte", + "unchecked-char", + "unchecked-dec", + "unchecked-dec-int", + "unchecked-divide-int", + "unchecked-double", + "unchecked-float", + "unchecked-inc", + "unchecked-inc-int", + "unchecked-int", + "unchecked-long", + "unchecked-multiply", + "unchecked-multiply-int", + "unchecked-negate", + "unchecked-negate-int", + "unchecked-remainder-int", + "unchecked-short", + "unchecked-subtract", + "unchecked-subtract-int", + "underive", + "unquote", + "unquote-splicing", + "unreduced", + "unsigned-bit-shift-right", + "update", + "update-in", + "update-proxy", + "uri?", + "use", + "uuid?", + "val", + "vals", + "var-get", + "var-set", + "var?", + "vary-meta", + "vec", + "vector", + "vector-of", + "vector?", + "volatile!", + "volatile?", + "vreset!", + "vswap!", + "when", + "when-first", + "when-let", + "when-not", + "when-some", + "while", + "with-bindings", + "with-bindings*", + "with-in-str", + "with-loading-context", + "with-local-vars", + "with-meta", + "with-open", + "with-out-str", + "with-precision", + "with-redefs", + "with-redefs-fn", + "xml-seq", + "zero?", + "zipmap" + ], + tokenizer: { + root: [ + // whitespaces and comments + { include: "@whitespace" }, + // numbers + [/@numbers/, "number"], + // characters + [/@characters/, "string"], + // strings + { include: "@string" }, + // brackets + [/[()\[\]{}]/, "@brackets"], + // regular expressions + [/\/#"(?:\.|(?:")|[^"\n])*"\/g/, "regexp"], + // reader macro characters + [/[#'@^`~]/, "meta"], + // symbols + [ + /@qualifiedSymbols/, + { + cases: { + "^:.+$": "constant", + // Clojure keywords (e.g., `:foo/bar`) + "@specialForms": "keyword", + "@coreSymbols": "keyword", + "@constants": "constant", + "@default": "identifier" + } + } + ] + ], + whitespace: [ + [/[\s,]+/, "white"], + [/;.*$/, "comment"], + [/\(comment\b/, "comment", "@comment"] + ], + comment: [ + [/\(/, "comment", "@push"], + [/\)/, "comment", "@pop"], + [/[^()]/, "comment"] + ], + string: [[/"/, "string", "@multiLineString"]], + multiLineString: [ + [/"/, "string", "@popall"], + [/@escapes/, "string.escape"], + [/./, "string"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..bbeeebbe06daf4472665be2d9a871cda56d0df33 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.contribution.js @@ -0,0 +1,25 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/coffee/coffee.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "coffeescript", + extensions: [".coffee"], + aliases: ["CoffeeScript", "coffeescript", "coffee"], + mimetypes: ["text/x-coffeescript", "text/coffeescript"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/coffee/coffee"], resolve, reject); + }); + } else { + return import("./coffee.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.js new file mode 100644 index 0000000000000000000000000000000000000000..4f5b93c860490bfd0d64ddfa6131ee22b9e2bce9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.js @@ -0,0 +1,242 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/coffee/coffee.ts +var conf = { + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + comments: { + blockComment: ["###", "###"], + lineComment: "#" + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } +}; +var language = { + defaultToken: "", + ignoreCase: true, + tokenPostfix: ".coffee", + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" } + ], + regEx: /\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/, + keywords: [ + "and", + "or", + "is", + "isnt", + "not", + "on", + "yes", + "@", + "no", + "off", + "true", + "false", + "null", + "this", + "new", + "delete", + "typeof", + "in", + "instanceof", + "return", + "throw", + "break", + "continue", + "debugger", + "if", + "else", + "switch", + "for", + "while", + "do", + "try", + "catch", + "finally", + "class", + "extends", + "super", + "undefined", + "then", + "unless", + "until", + "loop", + "of", + "by", + "when" + ], + // we include these common regular expressions + symbols: /[=> { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/cpp/cpp"], resolve, reject); + }); + } else { + return import("./cpp.js"); + } + } +}); +registerLanguage({ + id: "cpp", + extensions: [".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx"], + aliases: ["C++", "Cpp", "cpp"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/cpp/cpp"], resolve, reject); + }); + } else { + return import("./cpp.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cpp/cpp.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cpp/cpp.js new file mode 100644 index 0000000000000000000000000000000000000000..5888ff9effaf87f7ef8a3f5c6f41020ea4c680db --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cpp/cpp.js @@ -0,0 +1,399 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/cpp/cpp.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "[", close: "]" }, + { open: "{", close: "}" }, + { open: "(", close: ")" }, + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["string"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + folding: { + markers: { + start: new RegExp("^\\s*#pragma\\s+region\\b"), + end: new RegExp("^\\s*#pragma\\s+endregion\\b") + } + } +}; +var language = { + defaultToken: "", + tokenPostfix: ".cpp", + brackets: [ + { token: "delimiter.curly", open: "{", close: "}" }, + { token: "delimiter.parenthesis", open: "(", close: ")" }, + { token: "delimiter.square", open: "[", close: "]" }, + { token: "delimiter.angle", open: "<", close: ">" } + ], + keywords: [ + "abstract", + "amp", + "array", + "auto", + "bool", + "break", + "case", + "catch", + "char", + "class", + "const", + "constexpr", + "const_cast", + "continue", + "cpu", + "decltype", + "default", + "delegate", + "delete", + "do", + "double", + "dynamic_cast", + "each", + "else", + "enum", + "event", + "explicit", + "export", + "extern", + "false", + "final", + "finally", + "float", + "for", + "friend", + "gcnew", + "generic", + "goto", + "if", + "in", + "initonly", + "inline", + "int", + "interface", + "interior_ptr", + "internal", + "literal", + "long", + "mutable", + "namespace", + "new", + "noexcept", + "nullptr", + "__nullptr", + "operator", + "override", + "partial", + "pascal", + "pin_ptr", + "private", + "property", + "protected", + "public", + "ref", + "register", + "reinterpret_cast", + "restrict", + "return", + "safe_cast", + "sealed", + "short", + "signed", + "sizeof", + "static", + "static_assert", + "static_cast", + "struct", + "switch", + "template", + "this", + "thread_local", + "throw", + "tile_static", + "true", + "try", + "typedef", + "typeid", + "typename", + "union", + "unsigned", + "using", + "virtual", + "void", + "volatile", + "wchar_t", + "where", + "while", + "_asm", + // reserved word with one underscores + "_based", + "_cdecl", + "_declspec", + "_fastcall", + "_if_exists", + "_if_not_exists", + "_inline", + "_multiple_inheritance", + "_pascal", + "_single_inheritance", + "_stdcall", + "_virtual_inheritance", + "_w64", + "__abstract", + // reserved word with two underscores + "__alignof", + "__asm", + "__assume", + "__based", + "__box", + "__builtin_alignof", + "__cdecl", + "__clrcall", + "__declspec", + "__delegate", + "__event", + "__except", + "__fastcall", + "__finally", + "__forceinline", + "__gc", + "__hook", + "__identifier", + "__if_exists", + "__if_not_exists", + "__inline", + "__int128", + "__int16", + "__int32", + "__int64", + "__int8", + "__interface", + "__leave", + "__m128", + "__m128d", + "__m128i", + "__m256", + "__m256d", + "__m256i", + "__m512", + "__m512d", + "__m512i", + "__m64", + "__multiple_inheritance", + "__newslot", + "__nogc", + "__noop", + "__nounwind", + "__novtordisp", + "__pascal", + "__pin", + "__pragma", + "__property", + "__ptr32", + "__ptr64", + "__raise", + "__restrict", + "__resume", + "__sealed", + "__single_inheritance", + "__stdcall", + "__super", + "__thiscall", + "__try", + "__try_cast", + "__typeof", + "__unaligned", + "__unhook", + "__uuidof", + "__value", + "__virtual_inheritance", + "__w64", + "__wchar_t" + ], + operators: [ + "=", + ">", + "<", + "!", + "~", + "?", + ":", + "==", + "<=", + ">=", + "!=", + "&&", + "||", + "++", + "--", + "+", + "-", + "*", + "/", + "&", + "|", + "^", + "%", + "<<", + ">>", + "+=", + "-=", + "*=", + "/=", + "&=", + "|=", + "^=", + "%=", + "<<=", + ">>=" + ], + // we include these common regular expressions + symbols: /[=>\[\]]/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"], + [/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"], + [/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/, "number.hex"], + [/0[0-7']*[0-7](@integersuffix)/, "number.octal"], + [/0[bB][0-1']*[0-1](@integersuffix)/, "number.binary"], + [/\d[\d']*\d(@integersuffix)/, "number"], + [/\d(@integersuffix)/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, "string", "@string"], + // characters + [/'[^\\']'/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/\/\*\*(?!\/)/, "comment.doc", "@doccomment"], + [/\/\*/, "comment", "@comment"], + [/\/\/.*\\$/, "comment", "@linecomment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^\/*]+/, "comment"], + [/\*\//, "comment", "@pop"], + [/[\/*]/, "comment"] + ], + //For use with continuous line comments + linecomment: [ + [/.*[^\\]$/, "comment", "@pop"], + [/[^]+/, "comment"] + ], + //Identical copy of comment above, except for the addition of .doc + doccomment: [ + [/[^\/*]+/, "comment.doc"], + [/\*\//, "comment.doc", "@pop"], + [/[\/*]/, "comment.doc"] + ], + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, "string", "@pop"] + ], + raw: [ + [/[^)]+/, "string.raw"], + [/\)$S2\"/, { token: "string.raw.end", next: "@pop" }], + [/\)/, "string.raw"] + ], + annotation: [ + { include: "@whitespace" }, + [/using|alignas/, "keyword"], + [/[a-zA-Z0-9_]+/, "annotation"], + [/[,:]/, "delimiter"], + [/[()]/, "@brackets"], + [/\]\s*\]/, { token: "annotation", next: "@pop" }] + ], + include: [ + [ + /(\s*)(<)([^<>]*)(>)/, + [ + "", + "keyword.directive.include.begin", + "string.include.identifier", + { token: "keyword.directive.include.end", next: "@pop" } + ] + ], + [ + /(\s*)(")([^"]*)(")/, + [ + "", + "keyword.directive.include.begin", + "string.include.identifier", + { token: "keyword.directive.include.end", next: "@pop" } + ] + ] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..79638784c9056649cdf1620c5ce44094ba74f1c3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/csharp/csharp.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "csharp", + extensions: [".cs", ".csx", ".cake"], + aliases: ["C#", "csharp"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/csharp/csharp"], resolve, reject); + }); + } else { + return import("./csharp.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.js new file mode 100644 index 0000000000000000000000000000000000000000..8ecdbc2c8fc38c48e58a53a8c6c3712547ea38da --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.js @@ -0,0 +1,336 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/csharp/csharp.ts +var conf = { + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["string", "comment"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" }, + { open: "'", close: "'" }, + { open: '"', close: '"' } + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } +}; +var language = { + defaultToken: "", + tokenPostfix: ".cs", + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "<", close: ">", token: "delimiter.angle" } + ], + keywords: [ + "extern", + "alias", + "using", + "bool", + "decimal", + "sbyte", + "byte", + "short", + "ushort", + "int", + "uint", + "long", + "ulong", + "char", + "float", + "double", + "object", + "dynamic", + "string", + "assembly", + "is", + "as", + "ref", + "out", + "this", + "base", + "new", + "typeof", + "void", + "checked", + "unchecked", + "default", + "delegate", + "var", + "const", + "if", + "else", + "switch", + "case", + "while", + "do", + "for", + "foreach", + "in", + "break", + "continue", + "goto", + "return", + "throw", + "try", + "catch", + "finally", + "lock", + "yield", + "from", + "let", + "where", + "join", + "on", + "equals", + "into", + "orderby", + "ascending", + "descending", + "select", + "group", + "by", + "namespace", + "partial", + "class", + "field", + "event", + "method", + "param", + "public", + "protected", + "internal", + "private", + "abstract", + "sealed", + "static", + "struct", + "readonly", + "volatile", + "virtual", + "override", + "params", + "get", + "set", + "add", + "remove", + "operator", + "true", + "false", + "implicit", + "explicit", + "interface", + "enum", + "null", + "async", + "await", + "fixed", + "sizeof", + "stackalloc", + "unsafe", + "nameof", + "when" + ], + namespaceFollows: ["namespace", "using"], + parenFollows: ["if", "for", "while", "switch", "foreach", "using", "catch", "when"], + operators: [ + "=", + "??", + "||", + "&&", + "|", + "^", + "&", + "==", + "!=", + "<=", + ">=", + "<<", + "+", + "-", + "*", + "/", + "%", + "!", + "~", + "++", + "--", + "+=", + "-=", + "*=", + "/=", + "%=", + "&=", + "|=", + "^=", + "<<=", + ">>=", + ">>", + "=>" + ], + symbols: /[=>](?!@symbols)/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?[fFdD]?/, "number.float"], + [/0[xX][0-9a-fA-F_]+/, "number.hex"], + [/0[bB][01_]+/, "number.hex"], + // binary: use same theme style as hex + [/[0-9_]+/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, { token: "string.quote", next: "@string" }], + [/\$\@"/, { token: "string.quote", next: "@litinterpstring" }], + [/\@"/, { token: "string.quote", next: "@litstring" }], + [/\$"/, { token: "string.quote", next: "@interpolatedstring" }], + // characters + [/'[^\\']'/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"] + ], + qualified: [ + [ + /[a-zA-Z_][\w]*/, + { + cases: { + "@keywords": { token: "keyword.$0" }, + "@default": "identifier" + } + } + ], + [/\./, "delimiter"], + ["", "", "@pop"] + ], + namespace: [ + { include: "@whitespace" }, + [/[A-Z]\w*/, "namespace"], + [/[\.=]/, "delimiter"], + ["", "", "@pop"] + ], + comment: [ + [/[^\/*]+/, "comment"], + // [/\/\*/, 'comment', '@push' ], // no nested comments :-( + ["\\*/", "comment", "@pop"], + [/[\/*]/, "comment"] + ], + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, { token: "string.quote", next: "@pop" }] + ], + litstring: [ + [/[^"]+/, "string"], + [/""/, "string.escape"], + [/"/, { token: "string.quote", next: "@pop" }] + ], + litinterpstring: [ + [/[^"{]+/, "string"], + [/""/, "string.escape"], + [/{{/, "string.escape"], + [/}}/, "string.escape"], + [/{/, { token: "string.quote", next: "root.litinterpstring" }], + [/"/, { token: "string.quote", next: "@pop" }] + ], + interpolatedstring: [ + [/[^\\"{]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/{{/, "string.escape"], + [/}}/, "string.escape"], + [/{/, { token: "string.quote", next: "root.interpolatedstring" }], + [/"/, { token: "string.quote", next: "@pop" }] + ], + whitespace: [ + [/^[ \t\v\f]*#((r)|(load))(?=\s)/, "directive.csx"], + [/^[ \t\v\f]*#\w.*$/, "namespace.cpp"], + [/[ \t\v\f\r\n]+/, ""], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..d0f2926aca15dcd00622ce6091603ea05a2923da --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/csp/csp.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "csp", + extensions: [".csp"], + aliases: ["CSP", "csp"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/csp/csp"], resolve, reject); + }); + } else { + return import("./csp.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.js new file mode 100644 index 0000000000000000000000000000000000000000..927c2160b13dbc2e745750261a68baaa2bc3bbf2 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.js @@ -0,0 +1,63 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/csp/csp.ts +var conf = { + brackets: [], + autoClosingPairs: [], + surroundingPairs: [] +}; +var language = { + // Set defaultToken to invalid to see what you do not tokenize yet + // defaultToken: 'invalid', + keywords: [], + typeKeywords: [], + tokenPostfix: ".csp", + operators: [], + symbols: /[=> { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/css/css"], resolve, reject); + }); + } else { + return import("./css.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/css/css.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/css/css.js new file mode 100644 index 0000000000000000000000000000000000000000..a739f8f7837ef2b3b8f22a0fca2cb7c4627f591f --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/css/css.js @@ -0,0 +1,195 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/css/css.ts +var conf = { + wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g, + comments: { + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}", notIn: ["string", "comment"] }, + { open: "[", close: "]", notIn: ["string", "comment"] }, + { open: "(", close: ")", notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["string", "comment"] }, + { open: "'", close: "'", notIn: ["string", "comment"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } +}; +var language = { + defaultToken: "", + tokenPostfix: ".css", + ws: "[ \n\r\f]*", + // whitespaces (referenced in several rules) + identifier: "-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*", + brackets: [ + { open: "{", close: "}", token: "delimiter.bracket" }, + { open: "[", close: "]", token: "delimiter.bracket" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "<", close: ">", token: "delimiter.angle" } + ], + tokenizer: { + root: [{ include: "@selector" }], + selector: [ + { include: "@comments" }, + { include: "@import" }, + { include: "@strings" }, + [ + "[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)", + { token: "keyword", next: "@keyframedeclaration" } + ], + ["[@](page|content|font-face|-moz-document)", { token: "keyword" }], + ["[@](charset|namespace)", { token: "keyword", next: "@declarationbody" }], + [ + "(url-prefix)(\\()", + ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }] + ], + [ + "(url)(\\()", + ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }] + ], + { include: "@selectorname" }, + ["[\\*]", "tag"], + // selector symbols + ["[>\\+,]", "delimiter"], + // selector operators + ["\\[", { token: "delimiter.bracket", next: "@selectorattribute" }], + ["{", { token: "delimiter.bracket", next: "@selectorbody" }] + ], + selectorbody: [ + { include: "@comments" }, + ["[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))", "attribute.name", "@rulevalue"], + // rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon + ["}", { token: "delimiter.bracket", next: "@pop" }] + ], + selectorname: [ + ["(\\.|#(?=[^{])|%|(@identifier)|:)+", "tag"] + // selector (.foo, div, ...) + ], + selectorattribute: [{ include: "@term" }, ["]", { token: "delimiter.bracket", next: "@pop" }]], + term: [ + { include: "@comments" }, + [ + "(url-prefix)(\\()", + ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }] + ], + [ + "(url)(\\()", + ["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }] + ], + { include: "@functioninvocation" }, + { include: "@numbers" }, + { include: "@name" }, + { include: "@strings" }, + ["([<>=\\+\\-\\*\\/\\^\\|\\~,])", "delimiter"], + [",", "delimiter"] + ], + rulevalue: [ + { include: "@comments" }, + { include: "@strings" }, + { include: "@term" }, + ["!important", "keyword"], + [";", "delimiter", "@pop"], + ["(?=})", { token: "", next: "@pop" }] + // missing semicolon + ], + warndebug: [["[@](warn|debug)", { token: "keyword", next: "@declarationbody" }]], + import: [["[@](import)", { token: "keyword", next: "@declarationbody" }]], + urldeclaration: [ + { include: "@strings" }, + ["[^)\r\n]+", "string"], + ["\\)", { token: "delimiter.parenthesis", next: "@pop" }] + ], + parenthizedterm: [ + { include: "@term" }, + ["\\)", { token: "delimiter.parenthesis", next: "@pop" }] + ], + declarationbody: [ + { include: "@term" }, + [";", "delimiter", "@pop"], + ["(?=})", { token: "", next: "@pop" }] + // missing semicolon + ], + comments: [ + ["\\/\\*", "comment", "@comment"], + ["\\/\\/+.*", "comment"] + ], + comment: [ + ["\\*\\/", "comment", "@pop"], + [/[^*/]+/, "comment"], + [/./, "comment"] + ], + name: [["@identifier", "attribute.value"]], + numbers: [ + ["-?(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?", { token: "attribute.value.number", next: "@units" }], + ["#[0-9a-fA-F_]+(?!\\w)", "attribute.value.hex"] + ], + units: [ + [ + "(em|ex|ch|rem|fr|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?", + "attribute.value.unit", + "@pop" + ] + ], + keyframedeclaration: [ + ["@identifier", "attribute.value"], + ["{", { token: "delimiter.bracket", switchTo: "@keyframebody" }] + ], + keyframebody: [ + { include: "@term" }, + ["{", { token: "delimiter.bracket", next: "@selectorbody" }], + ["}", { token: "delimiter.bracket", next: "@pop" }] + ], + functioninvocation: [ + ["@identifier\\(", { token: "attribute.value", next: "@functionarguments" }] + ], + functionarguments: [ + ["\\$@identifier@ws:", "attribute.name"], + ["[,]", "delimiter"], + { include: "@term" }, + ["\\)", { token: "attribute.value", next: "@pop" }] + ], + strings: [ + ['~?"', { token: "string", next: "@stringenddoublequote" }], + ["~?'", { token: "string", next: "@stringendquote" }] + ], + stringenddoublequote: [ + ["\\\\.", "string"], + ['"', { token: "string", next: "@pop" }], + [/[^\\"]+/, "string"], + [".", "string"] + ], + stringendquote: [ + ["\\\\.", "string"], + ["'", { token: "string", next: "@pop" }], + [/[^\\']+/, "string"], + [".", "string"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..f3cb7a98a9dbff0bda7a0348c5be7c021dc9f1c8 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/cypher/cypher.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "cypher", + extensions: [".cypher", ".cyp"], + aliases: ["Cypher", "OpenCypher"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/cypher/cypher"], resolve, reject); + }); + } else { + return import("./cypher.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.js new file mode 100644 index 0000000000000000000000000000000000000000..aad50f95302136573046cdeea8c966267a586780 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.js @@ -0,0 +1,273 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/cypher/cypher.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: "`", close: "`" } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: "`", close: "`" } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: `.cypher`, + ignoreCase: true, + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.bracket" }, + { open: "(", close: ")", token: "delimiter.parenthesis" } + ], + keywords: [ + "ALL", + "AND", + "AS", + "ASC", + "ASCENDING", + "BY", + "CALL", + "CASE", + "CONTAINS", + "CREATE", + "DELETE", + "DESC", + "DESCENDING", + "DETACH", + "DISTINCT", + "ELSE", + "END", + "ENDS", + "EXISTS", + "IN", + "IS", + "LIMIT", + "MANDATORY", + "MATCH", + "MERGE", + "NOT", + "ON", + "ON", + "OPTIONAL", + "OR", + "ORDER", + "REMOVE", + "RETURN", + "SET", + "SKIP", + "STARTS", + "THEN", + "UNION", + "UNWIND", + "WHEN", + "WHERE", + "WITH", + "XOR", + "YIELD" + ], + builtinLiterals: ["true", "TRUE", "false", "FALSE", "null", "NULL"], + builtinFunctions: [ + "abs", + "acos", + "asin", + "atan", + "atan2", + "avg", + "ceil", + "coalesce", + "collect", + "cos", + "cot", + "count", + "degrees", + "e", + "endNode", + "exists", + "exp", + "floor", + "head", + "id", + "keys", + "labels", + "last", + "left", + "length", + "log", + "log10", + "lTrim", + "max", + "min", + "nodes", + "percentileCont", + "percentileDisc", + "pi", + "properties", + "radians", + "rand", + "range", + "relationships", + "replace", + "reverse", + "right", + "round", + "rTrim", + "sign", + "sin", + "size", + "split", + "sqrt", + "startNode", + "stDev", + "stDevP", + "substring", + "sum", + "tail", + "tan", + "timestamp", + "toBoolean", + "toFloat", + "toInteger", + "toLower", + "toString", + "toUpper", + "trim", + "type" + ], + operators: [ + // Math operators + "+", + "-", + "*", + "/", + "%", + "^", + // Comparison operators + "=", + "<>", + "<", + ">", + "<=", + ">=", + // Pattern operators + "->", + "<-", + "-->", + "<--" + ], + escapes: /\\(?:[tbnrf\\"'`]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, + digits: /\d+/, + octaldigits: /[0-7]+/, + hexdigits: /[0-9a-fA-F]+/, + tokenizer: { + root: [[/[{}[\]()]/, "@brackets"], { include: "common" }], + common: [ + { include: "@whitespace" }, + { include: "@numbers" }, + { include: "@strings" }, + // Cypher labels on nodes/relationships, e.g. (n:NodeLabel)-[e:RelationshipLabel] + [/:[a-zA-Z_][\w]*/, "type.identifier"], + [ + /[a-zA-Z_][\w]*(?=\()/, + { + cases: { + "@builtinFunctions": "predefined.function" + } + } + ], + [ + /[a-zA-Z_$][\w$]*/, + { + cases: { + "@keywords": "keyword", + "@builtinLiterals": "predefined.literal", + "@default": "identifier" + } + } + ], + [/`/, "identifier.escape", "@identifierBacktick"], + // delimiter and operator after number because of `.\d` floats and `:` in labels + [/[;,.:|]/, "delimiter"], + [ + /[<>=%+\-*/^]+/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ] + ], + numbers: [ + [/-?(@digits)[eE](-?(@digits))?/, "number.float"], + [/-?(@digits)?\.(@digits)([eE]-?(@digits))?/, "number.float"], + [/-?0x(@hexdigits)/, "number.hex"], + [/-?0(@octaldigits)/, "number.octal"], + [/-?(@digits)/, "number"] + ], + strings: [ + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/'([^'\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, "string", "@stringDouble"], + [/'/, "string", "@stringSingle"] + ], + whitespace: [ + [/[ \t\r\n]+/, "white"], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/\/\/.*/, "comment"], + [/[^/*]+/, "comment"], + [/\*\//, "comment", "@pop"], + [/[/*]/, "comment"] + ], + stringDouble: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string"], + [/\\./, "string.invalid"], + [/"/, "string", "@pop"] + ], + stringSingle: [ + [/[^\\']+/, "string"], + [/@escapes/, "string"], + [/\\./, "string.invalid"], + [/'/, "string", "@pop"] + ], + identifierBacktick: [ + [/[^\\`]+/, "identifier.escape"], + [/@escapes/, "identifier.escape"], + [/\\./, "identifier.escape.invalid"], + [/`/, "identifier.escape", "@pop"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..7d03c36c431347cd9e29046f948aa5512a381757 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.contribution.js @@ -0,0 +1,25 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/dart/dart.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "dart", + extensions: [".dart"], + aliases: ["Dart", "dart"], + mimetypes: ["text/x-dart-source", "text/x-dart"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/dart/dart"], resolve, reject); + }); + } else { + return import("./dart.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.js new file mode 100644 index 0000000000000000000000000000000000000000..7134990c279e43a5477754a0dbe17787c4c295aa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.js @@ -0,0 +1,291 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/dart/dart.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["string"] }, + { open: "`", close: "`", notIn: ["string", "comment"] }, + { open: "/**", close: " */", notIn: ["string"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" }, + { open: "'", close: "'" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "`", close: "`" } + ], + folding: { + markers: { + start: /^\s*\s*#?region\b/, + end: /^\s*\s*#?endregion\b/ + } + } +}; +var language = { + defaultToken: "invalid", + tokenPostfix: ".dart", + keywords: [ + "abstract", + "dynamic", + "implements", + "show", + "as", + "else", + "import", + "static", + "assert", + "enum", + "in", + "super", + "async", + "export", + "interface", + "switch", + "await", + "extends", + "is", + "sync", + "break", + "external", + "library", + "this", + "case", + "factory", + "mixin", + "throw", + "catch", + "false", + "new", + "true", + "class", + "final", + "null", + "try", + "const", + "finally", + "on", + "typedef", + "continue", + "for", + "operator", + "var", + "covariant", + "Function", + "part", + "void", + "default", + "get", + "rethrow", + "while", + "deferred", + "hide", + "return", + "with", + "do", + "if", + "set", + "yield" + ], + typeKeywords: ["int", "double", "String", "bool"], + operators: [ + "+", + "-", + "*", + "/", + "~/", + "%", + "++", + "--", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "=", + "-=", + "/=", + "%=", + ">>=", + "^=", + "+=", + "*=", + "~/=", + "<<=", + "&=", + "!=", + "||", + "&&", + "&", + "|", + "^", + "~", + "<<", + ">>", + "!", + ">>>", + "??", + "?", + ":", + "|=" + ], + // we include these common regular expressions + symbols: /[=>](?!@symbols)/, "@brackets"], + [/!(?=([^=]|$))/, "delimiter"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"], + [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"], + [/0[xX](@hexdigits)n?/, "number.hex"], + [/0[oO]?(@octaldigits)n?/, "number.octal"], + [/0[bB](@binarydigits)n?/, "number.binary"], + [/(@digits)n?/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/'([^'\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, "string", "@string_double"], + [/'/, "string", "@string_single"] + // [/[a-zA-Z]+/, "variable"] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"], + [/\/\*/, "comment", "@comment"], + [/\/\/\/.*$/, "comment.doc"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^\/*]+/, "comment"], + [/\*\//, "comment", "@pop"], + [/[\/*]/, "comment"] + ], + jsdoc: [ + [/[^\/*]+/, "comment.doc"], + [/\*\//, "comment.doc", "@pop"], + [/[\/*]/, "comment.doc"] + ], + // We match regular expression quite precisely + regexp: [ + [ + /(\{)(\d+(?:,\d*)?)(\})/, + ["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"] + ], + [ + /(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/, + ["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }] + ], + [/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]], + [/[()]/, "regexp.escape.control"], + [/@regexpctl/, "regexp.escape.control"], + [/[^\\\/]/, "regexp"], + [/@regexpesc/, "regexp.escape"], + [/\\\./, "regexp.invalid"], + [/(\/)([gimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]] + ], + regexrange: [ + [/-/, "regexp.escape.control"], + [/\^/, "regexp.invalid"], + [/@regexpesc/, "regexp.escape"], + [/[^\]]/, "regexp"], + [ + /\]/, + { + token: "regexp.escape.control", + next: "@pop", + bracket: "@close" + } + ] + ], + string_double: [ + [/[^\\"\$]+/, "string"], + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, "string", "@pop"], + [/\$\w+/, "identifier"] + ], + string_single: [ + [/[^\\'\$]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/'/, "string", "@pop"], + [/\$\w+/, "identifier"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..fd47b283644469e66548b0b16efdac3876683e34 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.contribution.js @@ -0,0 +1,25 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/dockerfile/dockerfile.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "dockerfile", + extensions: [".dockerfile"], + filenames: ["Dockerfile"], + aliases: ["Dockerfile"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/dockerfile/dockerfile"], resolve, reject); + }); + } else { + return import("./dockerfile.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.js new file mode 100644 index 0000000000000000000000000000000000000000..204528188f1bf61a9c1bbec60c8bf8ace1c251cf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.js @@ -0,0 +1,140 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/dockerfile/dockerfile.ts +var conf = { + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: ".dockerfile", + variable: /\${?[\w]+}?/, + tokenizer: { + root: [ + { include: "@whitespace" }, + { include: "@comment" }, + [/(ONBUILD)(\s+)/, ["keyword", ""]], + [/(ENV)(\s+)([\w]+)/, ["keyword", "", { token: "variable", next: "@arguments" }]], + [ + /(FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|ARG|VOLUME|LABEL|USER|WORKDIR|COPY|CMD|STOPSIGNAL|SHELL|HEALTHCHECK|ENTRYPOINT)/, + { token: "keyword", next: "@arguments" } + ] + ], + arguments: [ + { include: "@whitespace" }, + { include: "@strings" }, + [ + /(@variable)/, + { + cases: { + "@eos": { token: "variable", next: "@popall" }, + "@default": "variable" + } + } + ], + [ + /\\/, + { + cases: { + "@eos": "", + "@default": "" + } + } + ], + [ + /./, + { + cases: { + "@eos": { token: "", next: "@popall" }, + "@default": "" + } + } + ] + ], + // Deal with white space, including comments + whitespace: [ + [ + /\s+/, + { + cases: { + "@eos": { token: "", next: "@popall" }, + "@default": "" + } + } + ] + ], + comment: [[/(^#.*$)/, "comment", "@popall"]], + // Recognize strings, including those broken across lines with \ (but not without) + strings: [ + [/\\'$/, "", "@popall"], + // \' leaves @arguments at eol + [/\\'/, ""], + // \' is not a string + [/'$/, "string", "@popall"], + [/'/, "string", "@stringBody"], + [/"$/, "string", "@popall"], + [/"/, "string", "@dblStringBody"] + ], + stringBody: [ + [ + /[^\\\$']/, + { + cases: { + "@eos": { token: "string", next: "@popall" }, + "@default": "string" + } + } + ], + [/\\./, "string.escape"], + [/'$/, "string", "@popall"], + [/'/, "string", "@pop"], + [/(@variable)/, "variable"], + [/\\$/, "string"], + [/$/, "string", "@popall"] + ], + dblStringBody: [ + [ + /[^\\\$"]/, + { + cases: { + "@eos": { token: "string", next: "@popall" }, + "@default": "string" + } + } + ], + [/\\./, "string.escape"], + [/"$/, "string", "@popall"], + [/"/, "string", "@pop"], + [/(@variable)/, "variable"], + [/\\$/, "string"], + [/$/, "string", "@popall"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..bc3f380f313ab72f252a50d59ae49388feea6bf0 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/ecl/ecl.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "ecl", + extensions: [".ecl"], + aliases: ["ECL", "Ecl", "ecl"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/ecl/ecl"], resolve, reject); + }); + } else { + return import("./ecl.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js new file mode 100644 index 0000000000000000000000000000000000000000..da1c3dd5325f48f3bdf98d749e65694bd450008c --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js @@ -0,0 +1,466 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/ecl/ecl.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["string", "comment"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" }, + { open: "'", close: "'" }, + { open: '"', close: '"' } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: ".ecl", + ignoreCase: true, + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "<", close: ">", token: "delimiter.angle" } + ], + pounds: [ + "append", + "break", + "declare", + "demangle", + "end", + "for", + "getdatatype", + "if", + "inmodule", + "loop", + "mangle", + "onwarning", + "option", + "set", + "stored", + "uniquename" + ].join("|"), + keywords: [ + "__compressed__", + "after", + "all", + "and", + "any", + "as", + "atmost", + "before", + "beginc", + "best", + "between", + "case", + "cluster", + "compressed", + "compression", + "const", + "counter", + "csv", + "default", + "descend", + "embed", + "encoding", + "encrypt", + "end", + "endc", + "endembed", + "endmacro", + "enum", + "escape", + "except", + "exclusive", + "expire", + "export", + "extend", + "fail", + "few", + "fileposition", + "first", + "flat", + "forward", + "from", + "full", + "function", + "functionmacro", + "group", + "grouped", + "heading", + "hole", + "ifblock", + "import", + "in", + "inner", + "interface", + "internal", + "joined", + "keep", + "keyed", + "last", + "left", + "limit", + "linkcounted", + "literal", + "little_endian", + "load", + "local", + "locale", + "lookup", + "lzw", + "macro", + "many", + "maxcount", + "maxlength", + "min skew", + "module", + "mofn", + "multiple", + "named", + "namespace", + "nocase", + "noroot", + "noscan", + "nosort", + "not", + "noxpath", + "of", + "onfail", + "only", + "opt", + "or", + "outer", + "overwrite", + "packed", + "partition", + "penalty", + "physicallength", + "pipe", + "prefetch", + "quote", + "record", + "repeat", + "retry", + "return", + "right", + "right1", + "right2", + "rows", + "rowset", + "scan", + "scope", + "self", + "separator", + "service", + "shared", + "skew", + "skip", + "smart", + "soapaction", + "sql", + "stable", + "store", + "terminator", + "thor", + "threshold", + "timelimit", + "timeout", + "token", + "transform", + "trim", + "type", + "unicodeorder", + "unordered", + "unsorted", + "unstable", + "update", + "use", + "validate", + "virtual", + "whole", + "width", + "wild", + "within", + "wnotrim", + "xml", + "xpath" + ], + functions: [ + "abs", + "acos", + "aggregate", + "allnodes", + "apply", + "ascii", + "asin", + "assert", + "asstring", + "atan", + "atan2", + "ave", + "build", + "buildindex", + "case", + "catch", + "choose", + "choosen", + "choosesets", + "clustersize", + "combine", + "correlation", + "cos", + "cosh", + "count", + "covariance", + "cron", + "dataset", + "dedup", + "define", + "denormalize", + "dictionary", + "distribute", + "distributed", + "distribution", + "ebcdic", + "enth", + "error", + "evaluate", + "event", + "eventextra", + "eventname", + "exists", + "exp", + "fail", + "failcode", + "failmessage", + "fetch", + "fromunicode", + "fromxml", + "getenv", + "getisvalid", + "global", + "graph", + "group", + "hash", + "hash32", + "hash64", + "hashcrc", + "hashmd5", + "having", + "httpcall", + "httpheader", + "if", + "iff", + "index", + "intformat", + "isvalid", + "iterate", + "join", + "keydiff", + "keypatch", + "keyunicode", + "length", + "library", + "limit", + "ln", + "loadxml", + "local", + "log", + "loop", + "map", + "matched", + "matchlength", + "matchposition", + "matchtext", + "matchunicode", + "max", + "merge", + "mergejoin", + "min", + "nofold", + "nolocal", + "nonempty", + "normalize", + "nothor", + "notify", + "output", + "parallel", + "parse", + "pipe", + "power", + "preload", + "process", + "project", + "pull", + "random", + "range", + "rank", + "ranked", + "realformat", + "recordof", + "regexfind", + "regexreplace", + "regroup", + "rejected", + "rollup", + "round", + "roundup", + "row", + "rowdiff", + "sample", + "sequential", + "set", + "sin", + "sinh", + "sizeof", + "soapcall", + "sort", + "sorted", + "sqrt", + "stepped", + "stored", + "sum", + "table", + "tan", + "tanh", + "thisnode", + "topn", + "tounicode", + "toxml", + "transfer", + "transform", + "trim", + "truncate", + "typeof", + "ungroup", + "unicodeorder", + "variance", + "wait", + "which", + "workunit", + "xmldecode", + "xmlencode", + "xmltext", + "xmlunicode" + ], + typesint: ["integer", "unsigned"].join("|"), + typesnum: ["data", "qstring", "string", "unicode", "utf8", "varstring", "varunicode"], + typesone: [ + "ascii", + "big_endian", + "boolean", + "data", + "decimal", + "ebcdic", + "grouped", + "integer", + "linkcounted", + "pattern", + "qstring", + "real", + "record", + "rule", + "set of", + "streamed", + "string", + "token", + "udecimal", + "unicode", + "unsigned", + "utf8", + "varstring", + "varunicode" + ].join("|"), + operators: ["+", "-", "/", ":=", "<", "<>", "=", ">", "\\", "and", "in", "not", "or"], + symbols: /[=>](?!@symbols)/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?/, "number.float"], + [/0[xX][0-9a-fA-F_]+/, "number.hex"], + [/0[bB][01]+/, "number.hex"], + // binary: use same theme style as hex + [/[0-9_]+/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + [/"/, "string", "@string"], + // characters + [/'[^\\']'/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"] + ], + whitespace: [ + [/[ \t\v\f\r\n]+/, ""], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^\/*]+/, "comment"], + [/\*\//, "comment", "@pop"], + [/[\/*]/, "comment"] + ], + string: [ + [/[^\\']+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/'/, "string", "@pop"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..c46925cfb4ba4ed5a1c9bda5aa72e62d344a1704 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/elixir/elixir.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "elixir", + extensions: [".ex", ".exs"], + aliases: ["Elixir", "elixir", "ex"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/elixir/elixir"], resolve, reject); + }); + } else { + return import("./elixir.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js new file mode 100644 index 0000000000000000000000000000000000000000..5f7f3d59ef7bee7304079b3ca447004c879028cf --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js @@ -0,0 +1,579 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/elixir/elixir.ts +var conf = { + comments: { + lineComment: "#" + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "'", close: "'" }, + { open: '"', close: '"' } + ], + autoClosingPairs: [ + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["comment"] }, + { open: '"""', close: '"""' }, + { open: "`", close: "`", notIn: ["string", "comment"] }, + { open: "(", close: ")" }, + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "<<", close: ">>" } + ], + indentationRules: { + increaseIndentPattern: /^\s*(after|else|catch|rescue|fn|[^#]*(do|<\-|\->|\{|\[|\=))\s*$/, + decreaseIndentPattern: /^\s*((\}|\])\s*$|(after|else|catch|rescue|end)\b)/ + } +}; +var language = { + defaultToken: "source", + tokenPostfix: ".elixir", + brackets: [ + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "<<", close: ">>", token: "delimiter.angle.special" } + ], + // Below are lists/regexps to which we reference later. + declarationKeywords: [ + "def", + "defp", + "defn", + "defnp", + "defguard", + "defguardp", + "defmacro", + "defmacrop", + "defdelegate", + "defcallback", + "defmacrocallback", + "defmodule", + "defprotocol", + "defexception", + "defimpl", + "defstruct" + ], + operatorKeywords: ["and", "in", "not", "or", "when"], + namespaceKeywords: ["alias", "import", "require", "use"], + otherKeywords: [ + "after", + "case", + "catch", + "cond", + "do", + "else", + "end", + "fn", + "for", + "if", + "quote", + "raise", + "receive", + "rescue", + "super", + "throw", + "try", + "unless", + "unquote_splicing", + "unquote", + "with" + ], + constants: ["true", "false", "nil"], + nameBuiltin: ["__MODULE__", "__DIR__", "__ENV__", "__CALLER__", "__STACKTRACE__"], + // Matches any of the operator names: + // <<< >>> ||| &&& ^^^ ~~~ === !== ~>> <~> |~> <|> == != <= >= && || \\ <> ++ -- |> =~ -> <- ~> <~ :: .. = < > + - * / | . ^ & ! + operator: /-[->]?|!={0,2}|\*{1,2}|\/|\\\\|&{1,3}|\.\.?|\^(?:\^\^)?|\+\+?|<(?:-|<<|=|>|\|>|~>?)?|=~|={1,3}|>(?:=|>>)?|\|~>|\|>|\|{1,3}|~>>?|~~~|::/, + // See https://hexdocs.pm/elixir/syntax-reference.html#variables + variableName: /[a-z_][a-zA-Z0-9_]*[?!]?/, + // See https://hexdocs.pm/elixir/syntax-reference.html#atoms + atomName: /[a-zA-Z_][a-zA-Z0-9_@]*[?!]?|@specialAtomName|@operator/, + specialAtomName: /\.\.\.|<<>>|%\{\}|%|\{\}/, + aliasPart: /[A-Z][a-zA-Z0-9_]*/, + moduleName: /@aliasPart(?:\.@aliasPart)*/, + // Sigil pairs are: """ """, ''' ''', " ", ' ', / /, | |, < >, { }, [ ], ( ) + sigilSymmetricDelimiter: /"""|'''|"|'|\/|\|/, + sigilStartDelimiter: /@sigilSymmetricDelimiter|<|\{|\[|\(/, + sigilEndDelimiter: /@sigilSymmetricDelimiter|>|\}|\]|\)/, + sigilModifiers: /[a-zA-Z0-9]*/, + decimal: /\d(?:_?\d)*/, + hex: /[0-9a-fA-F](_?[0-9a-fA-F])*/, + octal: /[0-7](_?[0-7])*/, + binary: /[01](_?[01])*/, + // See https://hexdocs.pm/elixir/master/String.html#module-escape-characters + escape: /\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}|\\./, + // The keys below correspond to tokenizer states. + // We start from the root state and match against its rules + // until we explicitly transition into another state. + // The `include` simply brings in all operations from the given state + // and is useful for improving readability. + tokenizer: { + root: [ + { include: "@whitespace" }, + { include: "@comments" }, + // Keywords start as either an identifier or a string, + // but end with a : so it's important to match this first. + { include: "@keywordsShorthand" }, + { include: "@numbers" }, + { include: "@identifiers" }, + { include: "@strings" }, + { include: "@atoms" }, + { include: "@sigils" }, + { include: "@attributes" }, + { include: "@symbols" } + ], + // Whitespace + whitespace: [[/\s+/, "white"]], + // Comments + comments: [[/(#)(.*)/, ["comment.punctuation", "comment"]]], + // Keyword list shorthand + keywordsShorthand: [ + [/(@atomName)(:)(\s+)/, ["constant", "constant.punctuation", "white"]], + // Use positive look-ahead to ensure the string is followed by : + // and should be considered a keyword. + [ + /"(?=([^"]|#\{.*?\}|\\")*":)/, + { token: "constant.delimiter", next: "@doubleQuotedStringKeyword" } + ], + [ + /'(?=([^']|#\{.*?\}|\\')*':)/, + { token: "constant.delimiter", next: "@singleQuotedStringKeyword" } + ] + ], + doubleQuotedStringKeyword: [ + [/":/, { token: "constant.delimiter", next: "@pop" }], + { include: "@stringConstantContentInterpol" } + ], + singleQuotedStringKeyword: [ + [/':/, { token: "constant.delimiter", next: "@pop" }], + { include: "@stringConstantContentInterpol" } + ], + // Numbers + numbers: [ + [/0b@binary/, "number.binary"], + [/0o@octal/, "number.octal"], + [/0x@hex/, "number.hex"], + [/@decimal\.@decimal([eE]-?@decimal)?/, "number.float"], + [/@decimal/, "number"] + ], + // Identifiers + identifiers: [ + // Tokenize identifier name in function-like definitions. + // Note: given `def a + b, do: nil`, `a` is not a function name, + // so we use negative look-ahead to ensure there's no operator. + [ + /\b(defp?|defnp?|defmacrop?|defguardp?|defdelegate)(\s+)(@variableName)(?!\s+@operator)/, + [ + "keyword.declaration", + "white", + { + cases: { + unquote: "keyword", + "@default": "function" + } + } + ] + ], + // Tokenize function calls + [ + // In-scope call - an identifier followed by ( or .( + /(@variableName)(?=\s*\.?\s*\()/, + { + cases: { + // Tokenize as keyword in cases like `if(..., do: ..., else: ...)` + "@declarationKeywords": "keyword.declaration", + "@namespaceKeywords": "keyword", + "@otherKeywords": "keyword", + "@default": "function.call" + } + } + ], + [ + // Referencing function in a module + /(@moduleName)(\s*)(\.)(\s*)(@variableName)/, + ["type.identifier", "white", "operator", "white", "function.call"] + ], + [ + // Referencing function in an Erlang module + /(:)(@atomName)(\s*)(\.)(\s*)(@variableName)/, + ["constant.punctuation", "constant", "white", "operator", "white", "function.call"] + ], + [ + // Piping into a function (tokenized separately as it may not have parentheses) + /(\|>)(\s*)(@variableName)/, + [ + "operator", + "white", + { + cases: { + "@otherKeywords": "keyword", + "@default": "function.call" + } + } + ] + ], + [ + // Function reference passed to another function + /(&)(\s*)(@variableName)/, + ["operator", "white", "function.call"] + ], + // Language keywords, builtins, constants and variables + [ + /@variableName/, + { + cases: { + "@declarationKeywords": "keyword.declaration", + "@operatorKeywords": "keyword.operator", + "@namespaceKeywords": "keyword", + "@otherKeywords": "keyword", + "@constants": "constant.language", + "@nameBuiltin": "variable.language", + "_.*": "comment.unused", + "@default": "identifier" + } + } + ], + // Module names + [/@moduleName/, "type.identifier"] + ], + // Strings + strings: [ + [/"""/, { token: "string.delimiter", next: "@doubleQuotedHeredoc" }], + [/'''/, { token: "string.delimiter", next: "@singleQuotedHeredoc" }], + [/"/, { token: "string.delimiter", next: "@doubleQuotedString" }], + [/'/, { token: "string.delimiter", next: "@singleQuotedString" }] + ], + doubleQuotedHeredoc: [ + [/"""/, { token: "string.delimiter", next: "@pop" }], + { include: "@stringContentInterpol" } + ], + singleQuotedHeredoc: [ + [/'''/, { token: "string.delimiter", next: "@pop" }], + { include: "@stringContentInterpol" } + ], + doubleQuotedString: [ + [/"/, { token: "string.delimiter", next: "@pop" }], + { include: "@stringContentInterpol" } + ], + singleQuotedString: [ + [/'/, { token: "string.delimiter", next: "@pop" }], + { include: "@stringContentInterpol" } + ], + // Atoms + atoms: [ + [/(:)(@atomName)/, ["constant.punctuation", "constant"]], + [/:"/, { token: "constant.delimiter", next: "@doubleQuotedStringAtom" }], + [/:'/, { token: "constant.delimiter", next: "@singleQuotedStringAtom" }] + ], + doubleQuotedStringAtom: [ + [/"/, { token: "constant.delimiter", next: "@pop" }], + { include: "@stringConstantContentInterpol" } + ], + singleQuotedStringAtom: [ + [/'/, { token: "constant.delimiter", next: "@pop" }], + { include: "@stringConstantContentInterpol" } + ], + // Sigils + // See https://elixir-lang.org/getting-started/sigils.html + // Sigils allow for typing values using their textual representation. + // All sigils start with ~ followed by a letter or + // multi-letter uppercase starting at Elixir v1.15.0, indicating sigil type + // and then a delimiter pair enclosing the textual representation. + // Optional modifiers are allowed after the closing delimiter. + // For instance a regular expressions can be written as: + // ~r/foo|bar/ ~r{foo|bar} ~r/foo|bar/g + // + // In general lowercase sigils allow for interpolation + // and escaped characters, whereas uppercase sigils don't + // + // During tokenization we want to distinguish some + // specific sigil types, namely string and regexp, + // so that they cen be themed separately. + // + // To reasonably handle all those combinations we leverage + // dot-separated states, so if we transition to @sigilStart.interpol.s.{.} + // then "sigilStart.interpol.s" state will match and also all + // the individual dot-separated parameters can be accessed. + sigils: [ + [/~[a-z]@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.interpol" }], + [/~([A-Z]+)@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.noInterpol" }] + ], + sigil: [ + [/~([a-z]|[A-Z]+)\{/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.{.}" }], + [/~([a-z]|[A-Z]+)\[/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.[.]" }], + [/~([a-z]|[A-Z]+)\(/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.(.)" }], + [/~([a-z]|[A-Z]+)\" }], + [ + /~([a-z]|[A-Z]+)(@sigilSymmetricDelimiter)/, + { token: "@rematch", switchTo: "@sigilStart.$S2.$1.$2.$2" } + ] + ], + // The definitions below expect states to be of the form: + // + // sigilStart.... + // sigilContinue.... + // + // The sigilStart state is used only to properly classify the token (as string/regex/sigil) + // and immediately switches to the sigilContinue sate, which handles the actual content + // and waits for the corresponding end delimiter. + "sigilStart.interpol.s": [ + [ + /~s@sigilStartDelimiter/, + { + token: "string.delimiter", + switchTo: "@sigilContinue.$S2.$S3.$S4.$S5" + } + ] + ], + "sigilContinue.interpol.s": [ + [ + /(@sigilEndDelimiter)@sigilModifiers/, + { + cases: { + "$1==$S5": { token: "string.delimiter", next: "@pop" }, + "@default": "string" + } + } + ], + { include: "@stringContentInterpol" } + ], + "sigilStart.noInterpol.S": [ + [ + /~S@sigilStartDelimiter/, + { + token: "string.delimiter", + switchTo: "@sigilContinue.$S2.$S3.$S4.$S5" + } + ] + ], + "sigilContinue.noInterpol.S": [ + // Ignore escaped sigil end + [/(^|[^\\])\\@sigilEndDelimiter/, "string"], + [ + /(@sigilEndDelimiter)@sigilModifiers/, + { + cases: { + "$1==$S5": { token: "string.delimiter", next: "@pop" }, + "@default": "string" + } + } + ], + { include: "@stringContent" } + ], + "sigilStart.interpol.r": [ + [ + /~r@sigilStartDelimiter/, + { + token: "regexp.delimiter", + switchTo: "@sigilContinue.$S2.$S3.$S4.$S5" + } + ] + ], + "sigilContinue.interpol.r": [ + [ + /(@sigilEndDelimiter)@sigilModifiers/, + { + cases: { + "$1==$S5": { token: "regexp.delimiter", next: "@pop" }, + "@default": "regexp" + } + } + ], + { include: "@regexpContentInterpol" } + ], + "sigilStart.noInterpol.R": [ + [ + /~R@sigilStartDelimiter/, + { + token: "regexp.delimiter", + switchTo: "@sigilContinue.$S2.$S3.$S4.$S5" + } + ] + ], + "sigilContinue.noInterpol.R": [ + // Ignore escaped sigil end + [/(^|[^\\])\\@sigilEndDelimiter/, "regexp"], + [ + /(@sigilEndDelimiter)@sigilModifiers/, + { + cases: { + "$1==$S5": { token: "regexp.delimiter", next: "@pop" }, + "@default": "regexp" + } + } + ], + { include: "@regexpContent" } + ], + // Fallback to the generic sigil by default + "sigilStart.interpol": [ + [ + /~([a-z]|[A-Z]+)@sigilStartDelimiter/, + { + token: "sigil.delimiter", + switchTo: "@sigilContinue.$S2.$S3.$S4.$S5" + } + ] + ], + "sigilContinue.interpol": [ + [ + /(@sigilEndDelimiter)@sigilModifiers/, + { + cases: { + "$1==$S5": { token: "sigil.delimiter", next: "@pop" }, + "@default": "sigil" + } + } + ], + { include: "@sigilContentInterpol" } + ], + "sigilStart.noInterpol": [ + [ + /~([a-z]|[A-Z]+)@sigilStartDelimiter/, + { + token: "sigil.delimiter", + switchTo: "@sigilContinue.$S2.$S3.$S4.$S5" + } + ] + ], + "sigilContinue.noInterpol": [ + // Ignore escaped sigil end + [/(^|[^\\])\\@sigilEndDelimiter/, "sigil"], + [ + /(@sigilEndDelimiter)@sigilModifiers/, + { + cases: { + "$1==$S5": { token: "sigil.delimiter", next: "@pop" }, + "@default": "sigil" + } + } + ], + { include: "@sigilContent" } + ], + // Attributes + attributes: [ + // Module @doc* attributes - tokenized as comments + [ + /\@(module|type)?doc (~[sS])?"""/, + { + token: "comment.block.documentation", + next: "@doubleQuotedHeredocDocstring" + } + ], + [ + /\@(module|type)?doc (~[sS])?'''/, + { + token: "comment.block.documentation", + next: "@singleQuotedHeredocDocstring" + } + ], + [ + /\@(module|type)?doc (~[sS])?"/, + { + token: "comment.block.documentation", + next: "@doubleQuotedStringDocstring" + } + ], + [ + /\@(module|type)?doc (~[sS])?'/, + { + token: "comment.block.documentation", + next: "@singleQuotedStringDocstring" + } + ], + [/\@(module|type)?doc false/, "comment.block.documentation"], + // Module attributes + [/\@(@variableName)/, "variable"] + ], + doubleQuotedHeredocDocstring: [ + [/"""/, { token: "comment.block.documentation", next: "@pop" }], + { include: "@docstringContent" } + ], + singleQuotedHeredocDocstring: [ + [/'''/, { token: "comment.block.documentation", next: "@pop" }], + { include: "@docstringContent" } + ], + doubleQuotedStringDocstring: [ + [/"/, { token: "comment.block.documentation", next: "@pop" }], + { include: "@docstringContent" } + ], + singleQuotedStringDocstring: [ + [/'/, { token: "comment.block.documentation", next: "@pop" }], + { include: "@docstringContent" } + ], + // Operators, punctuation, brackets + symbols: [ + // Code point operator (either with regular character ?a or an escaped one ?\n) + [/\?(\\.|[^\\\s])/, "number.constant"], + // Anonymous function arguments + [/&\d+/, "operator"], + // Bitshift operators (must go before delimiters, so that << >> don't match first) + [/<<<|>>>/, "operator"], + // Delimiter pairs + [/[()\[\]\{\}]|<<|>>/, "@brackets"], + // Triple dot is a valid name (must go before operators, so that .. doesn't match instead) + [/\.\.\./, "identifier"], + // Punctuation => (must go before operators, so it's not tokenized as = then >) + [/=>/, "punctuation"], + // Operators + [/@operator/, "operator"], + // Punctuation + [/[:;,.%]/, "punctuation"] + ], + // Generic helpers + stringContentInterpol: [ + { include: "@interpolation" }, + { include: "@escapeChar" }, + { include: "@stringContent" } + ], + stringContent: [[/./, "string"]], + stringConstantContentInterpol: [ + { include: "@interpolation" }, + { include: "@escapeChar" }, + { include: "@stringConstantContent" } + ], + stringConstantContent: [[/./, "constant"]], + regexpContentInterpol: [ + { include: "@interpolation" }, + { include: "@escapeChar" }, + { include: "@regexpContent" } + ], + regexpContent: [ + // # may be a regular regexp char, so we use a heuristic + // assuming a # surrounded by whitespace is actually a comment. + [/(\s)(#)(\s.*)$/, ["white", "comment.punctuation", "comment"]], + [/./, "regexp"] + ], + sigilContentInterpol: [ + { include: "@interpolation" }, + { include: "@escapeChar" }, + { include: "@sigilContent" } + ], + sigilContent: [[/./, "sigil"]], + docstringContent: [[/./, "comment.block.documentation"]], + escapeChar: [[/@escape/, "constant.character.escape"]], + interpolation: [[/#{/, { token: "delimiter.bracket.embed", next: "@interpolationContinue" }]], + interpolationContinue: [ + [/}/, { token: "delimiter.bracket.embed", next: "@pop" }], + // Interpolation brackets may contain arbitrary code, + // so we simply match against all the root rules, + // until we reach interpolation end (the above matches). + { include: "@root" } + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..42cb4e66ec8907c4ca975f764e6ff22b1604c35b --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/flow9/flow9.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "flow9", + extensions: [".flow"], + aliases: ["Flow9", "Flow", "flow9", "flow"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/flow9/flow9"], resolve, reject); + }); + } else { + return import("./flow9.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.js new file mode 100644 index 0000000000000000000000000000000000000000..659847b2242e80ed01baebd5daafb0d0ed2bee08 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.js @@ -0,0 +1,152 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/flow9/flow9.ts +var conf = { + comments: { + blockComment: ["/*", "*/"], + lineComment: "//" + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}", notIn: ["string"] }, + { open: "[", close: "]", notIn: ["string"] }, + { open: "(", close: ")", notIn: ["string"] }, + { open: '"', close: '"', notIn: ["string"] }, + { open: "'", close: "'", notIn: ["string"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: "<", close: ">" } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: ".flow", + keywords: [ + "import", + "require", + "export", + "forbid", + "native", + "if", + "else", + "cast", + "unsafe", + "switch", + "default" + ], + types: [ + "io", + "mutable", + "bool", + "int", + "double", + "string", + "flow", + "void", + "ref", + "true", + "false", + "with" + ], + operators: [ + "=", + ">", + "<", + "<=", + ">=", + "==", + "!", + "!=", + ":=", + "::=", + "&&", + "||", + "+", + "-", + "*", + "/", + "@", + "&", + "%", + ":", + "->", + "\\", + "$", + "??", + "^" + ], + symbols: /[@$=>](?!@symbols)/, "delimiter"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + [/"/, "string", "@string"] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^\/*]+/, "comment"], + [/\*\//, "comment", "@pop"], + [/[\/*]/, "comment"] + ], + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, "string", "@pop"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..fe221f8f07f3d5a9a43b779b43b8a3803c7fcec1 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.contribution.js @@ -0,0 +1,102 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/freemarker2/freemarker2.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "freemarker2", + extensions: [".ftl", ".ftlh", ".ftlx"], + aliases: ["FreeMarker2", "Apache FreeMarker2"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagAngleInterpolationDollar); + } else { + return import("./freemarker2.js").then((m) => m.TagAutoInterpolationDollar); + } + } +}); +registerLanguage({ + id: "freemarker2.tag-angle.interpolation-dollar", + aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagAngleInterpolationDollar); + } else { + return import("./freemarker2.js").then((m) => m.TagAngleInterpolationDollar); + } + } +}); +registerLanguage({ + id: "freemarker2.tag-bracket.interpolation-dollar", + aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagBracketInterpolationDollar); + } else { + return import("./freemarker2.js").then((m) => m.TagBracketInterpolationDollar); + } + } +}); +registerLanguage({ + id: "freemarker2.tag-angle.interpolation-bracket", + aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagAngleInterpolationBracket); + } else { + return import("./freemarker2.js").then((m) => m.TagAngleInterpolationBracket); + } + } +}); +registerLanguage({ + id: "freemarker2.tag-bracket.interpolation-bracket", + aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagBracketInterpolationBracket); + } else { + return import("./freemarker2.js").then((m) => m.TagBracketInterpolationBracket); + } + } +}); +registerLanguage({ + id: "freemarker2.tag-auto.interpolation-dollar", + aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagAutoInterpolationDollar); + } else { + return import("./freemarker2.js").then((m) => m.TagAutoInterpolationDollar); + } + } +}); +registerLanguage({ + id: "freemarker2.tag-auto.interpolation-bracket", + aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/freemarker2/freemarker2"], resolve, reject); + }).then((m) => m.TagAutoInterpolationBracket); + } else { + return import("./freemarker2.js").then((m) => m.TagAutoInterpolationBracket); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.js new file mode 100644 index 0000000000000000000000000000000000000000..d710845402b4730eb6102958d17fd3e300843743 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.js @@ -0,0 +1,1021 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); + +// src/fillers/monaco-editor-core.ts +var monaco_editor_core_exports = {}; +__reExport(monaco_editor_core_exports, monaco_editor_core_star); +import * as monaco_editor_core_star from "../../editor/editor.api.js"; + +// src/basic-languages/freemarker2/freemarker2.ts +var EMPTY_ELEMENTS = [ + "assign", + "flush", + "ftl", + "return", + "global", + "import", + "include", + "break", + "continue", + "local", + "nested", + "nt", + "setting", + "stop", + "t", + "lt", + "rt", + "fallback" +]; +var BLOCK_ELEMENTS = [ + "attempt", + "autoesc", + "autoEsc", + "compress", + "comment", + "escape", + "noescape", + "function", + "if", + "list", + "items", + "sep", + "macro", + "noparse", + "noParse", + "noautoesc", + "noAutoEsc", + "outputformat", + "switch", + "visit", + "recurse" +]; +var TagSyntaxAngle = { + close: ">", + id: "angle", + open: "<" +}; +var TagSyntaxBracket = { + close: "\\]", + id: "bracket", + open: "\\[" +}; +var TagSyntaxAuto = { + close: "[>\\]]", + id: "auto", + open: "[<\\[]" +}; +var InterpolationSyntaxDollar = { + close: "\\}", + id: "dollar", + open1: "\\$", + open2: "\\{" +}; +var InterpolationSyntaxBracket = { + close: "\\]", + id: "bracket", + open1: "\\[", + open2: "=" +}; +function createLangConfiguration(ts) { + return { + brackets: [ + ["<", ">"], + ["[", "]"], + ["(", ")"], + ["{", "}"] + ], + comments: { + blockComment: [`${ts.open}--`, `--${ts.close}`] + }, + autoCloseBefore: "\n\r }]),.:;=", + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"', notIn: ["string"] }, + { open: "'", close: "'", notIn: ["string"] } + ], + surroundingPairs: [ + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" } + ], + folding: { + markers: { + start: new RegExp( + `${ts.open}#(?:${BLOCK_ELEMENTS.join("|")})([^/${ts.close}]*(?!/)${ts.close})[^${ts.open}]*$` + ), + end: new RegExp(`${ts.open}/#(?:${BLOCK_ELEMENTS.join("|")})[\\r\\n\\t ]*>`) + } + }, + onEnterRules: [ + { + beforeText: new RegExp( + `${ts.open}#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/${ts.close}]*(?!/)${ts.close})[^${ts.open}]*$` + ), + afterText: new RegExp(`^${ts.open}/#([a-zA-Z_]+)[\\r\\n\\t ]*${ts.close}$`), + action: { + indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent + } + }, + { + beforeText: new RegExp( + `${ts.open}#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/${ts.close}]*(?!/)${ts.close})[^${ts.open}]*$` + ), + action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent } + } + ] + }; +} +function createLangConfigurationAuto() { + return { + // Cannot set block comment delimiter in auto mode... + // It depends on the content and the cursor position of the file... + brackets: [ + ["<", ">"], + ["[", "]"], + ["(", ")"], + ["{", "}"] + ], + autoCloseBefore: "\n\r }]),.:;=", + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"', notIn: ["string"] }, + { open: "'", close: "'", notIn: ["string"] } + ], + surroundingPairs: [ + { open: '"', close: '"' }, + { open: "'", close: "'" }, + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "<", close: ">" } + ], + folding: { + markers: { + start: new RegExp(`[<\\[]#(?:${BLOCK_ELEMENTS.join("|")})([^/>\\]]*(?!/)[>\\]])[^<\\[]*$`), + end: new RegExp(`[<\\[]/#(?:${BLOCK_ELEMENTS.join("|")})[\\r\\n\\t ]*>`) + } + }, + onEnterRules: [ + { + beforeText: new RegExp( + `[<\\[]#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$` + ), + afterText: new RegExp(`^[<\\[]/#([a-zA-Z_]+)[\\r\\n\\t ]*[>\\]]$`), + action: { + indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent + } + }, + { + beforeText: new RegExp( + `[<\\[]#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$` + ), + action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent } + } + ] + }; +} +function createMonarchLanguage(ts, is) { + const id = `_${ts.id}_${is.id}`; + const s = (name) => name.replace(/__id__/g, id); + const r = (regexp) => { + const source = regexp.source.replace(/__id__/g, id); + return new RegExp(source, regexp.flags); + }; + return { + // Settings + unicode: true, + includeLF: false, + start: s("default__id__"), + ignoreCase: false, + defaultToken: "invalid", + tokenPostfix: `.freemarker2`, + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "<", close: ">", token: "delimiter.angle" } + ], + // Dynamic RegExp + [s("open__id__")]: new RegExp(ts.open), + [s("close__id__")]: new RegExp(ts.close), + [s("iOpen1__id__")]: new RegExp(is.open1), + [s("iOpen2__id__")]: new RegExp(is.open2), + [s("iClose__id__")]: new RegExp(is.close), + // <#START_TAG : "<" | "<#" | "[#"> + // <#END_TAG : " + [s("startTag__id__")]: r(/(@open__id__)(#)/), + [s("endTag__id__")]: r(/(@open__id__)(\/#)/), + [s("startOrEndTag__id__")]: r(/(@open__id__)(\/?#)/), + // <#CLOSE_TAG1 : ()* (">" | "]")> + [s("closeTag1__id__")]: r(/((?:@blank)*)(@close__id__)/), + // <#CLOSE_TAG2 : ()* ("/")? (">" | "]")> + [s("closeTag2__id__")]: r(/((?:@blank)*\/?)(@close__id__)/), + // Static RegExp + // <#BLANK : " " | "\t" | "\n" | "\r"> + blank: /[ \t\n\r]/, + // + // + // + // + // + keywords: ["false", "true", "in", "as", "using"], + // Directive names that cannot have an expression parameters and cannot be self-closing + // E.g. <#if id==2> ... + directiveStartCloseTag1: /attempt|recover|sep|auto[eE]sc|no(?:autoe|AutoE)sc|compress|default|no[eE]scape|comment|no[pP]arse/, + // Directive names that cannot have an expression parameter and can be self-closing + // E.g. <#if> ... <#else> ... + // E.g. <#if> ... <#else /> + directiveStartCloseTag2: /else|break|continue|return|stop|flush|t|lt|rt|nt|nested|recurse|fallback|ftl/, + // Directive names that can have an expression parameter and cannot be self-closing + // E.g. <#if id==2> ... + directiveStartBlank: /if|else[iI]f|list|for[eE]ach|switch|case|assign|global|local|include|import|function|macro|transform|visit|stop|return|call|setting|output[fF]ormat|nested|recurse|escape|ftl|items/, + // Directive names that can have an end tag + // E.g. + directiveEndCloseTag1: /if|list|items|sep|recover|attempt|for[eE]ach|local|global|assign|function|macro|output[fF]ormat|auto[eE]sc|no(?:autoe|AutoE)sc|compress|transform|switch|escape|no[eE]scape/, + // <#ESCAPED_CHAR : + // "\\" + // ( + // ("n" | "t" | "r" | "f" | "b" | "g" | "l" | "a" | "\\" | "'" | "\"" | "{" | "=") + // | + // ("x" ["0"-"9", "A"-"F", "a"-"f"]) + // ) + // > + // Note: While the JavaCC tokenizer rule only specifies one hex digit, + // FreeMarker actually interprets up to 4 hex digits. + escapedChar: /\\(?:[ntrfbgla\\'"\{=]|(?:x[0-9A-Fa-f]{1,4}))/, + // <#ASCII_DIGIT: ["0" - "9"]> + asciiDigit: /[0-9]/, + // + integer: /[0-9]+/, + // <#NON_ESCAPED_ID_START_CHAR: + // [ + // // This was generated on JDK 1.8.0_20 Win64 with src/main/misc/identifierChars/IdentifierCharGenerator.java + // ... + // ] + nonEscapedIdStartChar: /[\$@-Z_a-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u1FFF\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183-\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3006\u3031-\u3035\u303B-\u303C\u3040-\u318F\u31A0-\u31BA\u31F0-\u31FF\u3300-\u337F\u3400-\u4DB5\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, + // <#ESCAPED_ID_CHAR: "\\" ("-" | "." | ":" | "#")> + escapedIdChar: /\\[\-\.:#]/, + // <#ID_START_CHAR: |> + idStartChar: /(?:@nonEscapedIdStartChar)|(?:@escapedIdChar)/, + // (|)*> + id: /(?:@idStartChar)(?:(?:@idStartChar)|(?:@asciiDigit))*/, + // Certain keywords / operators are allowed to index hashes + // + // Expression DotVariable(Expression exp) : + // { + // Token t; + // } + // { + // + // ( + // t = | t = | t = + // | + // ( + // t = + // | + // t = + // | + // t = + // | + // t = + // | + // t = + // | + // t = + // | + // t = + // | + // t = + // | + // t = + // ) + // { + // if (!Character.isLetter(t.image.charAt(0))) { + // throw new ParseException(t.image + " is not a valid identifier.", template, t); + // } + // } + // ) + // { + // notListLiteral(exp, "hash"); + // notStringLiteral(exp, "hash"); + // notBooleanLiteral(exp, "hash"); + // Dot dot = new Dot(exp, t.image); + // dot.setLocation(template, exp, t); + // return dot; + // } + // } + specialHashKeys: /\*\*|\*|false|true|in|as|using/, + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // " | "->"> + namedSymbols: /<=|>=|\\lte|\\lt|<|\\gte|\\gt|>|&&|\\and|->|->|==|!=|\+=|-=|\*=|\/=|%=|\+\+|--|<=|&&|\|\||:|\.\.\.|\.\.\*|\.\.<|\.\.!|\?\?|=|<|\+|-|\*|\/|%|\||\.\.|\?|!|&|\.|,|;/, + arrows: ["->", "->"], + delimiters: [";", ":", ",", "."], + stringOperators: ["lte", "lt", "gte", "gt"], + noParseTags: ["noparse", "noParse", "comment"], + tokenizer: { + // Parser states + // Plain text + [s("default__id__")]: [ + { include: s("@directive_token__id__") }, + { include: s("@interpolation_and_text_token__id__") } + ], + // A FreeMarker expression inside a directive, e.g. <#if 2<3> + [s("fmExpression__id__.directive")]: [ + { include: s("@blank_and_expression_comment_token__id__") }, + { include: s("@directive_end_token__id__") }, + { include: s("@expression_token__id__") } + ], + // A FreeMarker expression inside an interpolation, e.g. ${2+3} + [s("fmExpression__id__.interpolation")]: [ + { include: s("@blank_and_expression_comment_token__id__") }, + { include: s("@expression_token__id__") }, + { include: s("@greater_operators_token__id__") } + ], + // In an expression and inside a not-yet closed parenthesis / bracket + [s("inParen__id__.plain")]: [ + { include: s("@blank_and_expression_comment_token__id__") }, + { include: s("@directive_end_token__id__") }, + { include: s("@expression_token__id__") } + ], + [s("inParen__id__.gt")]: [ + { include: s("@blank_and_expression_comment_token__id__") }, + { include: s("@expression_token__id__") }, + { include: s("@greater_operators_token__id__") } + ], + // Expression for the unified call, e.g. <@createMacro() ... > + [s("noSpaceExpression__id__")]: [ + { include: s("@no_space_expression_end_token__id__") }, + { include: s("@directive_end_token__id__") }, + { include: s("@expression_token__id__") } + ], + // For the function of a unified call. Special case for when the + // expression is a simple identifier. + // <@join [1,2] ","> + // <@null!join [1,2] ","> + [s("unifiedCall__id__")]: [{ include: s("@unified_call_token__id__") }], + // For singly and doubly quoted string (that may contain interpolations) + [s("singleString__id__")]: [{ include: s("@string_single_token__id__") }], + [s("doubleString__id__")]: [{ include: s("@string_double_token__id__") }], + // For singly and doubly quoted string (that may not contain interpolations) + [s("rawSingleString__id__")]: [{ include: s("@string_single_raw_token__id__") }], + [s("rawDoubleString__id__")]: [{ include: s("@string_double_raw_token__id__") }], + // For a comment in an expression + // ${ 1 + <#-- comment --> 2} + [s("expressionComment__id__")]: [{ include: s("@expression_comment_token__id__") }], + // For <#noparse> ... + // For <#noParse> ... + // For <#comment> ... + [s("noParse__id__")]: [{ include: s("@no_parse_token__id__") }], + // For <#-- ... --> + [s("terseComment__id__")]: [{ include: s("@terse_comment_token__id__") }], + // Common rules + [s("directive_token__id__")]: [ + // "attempt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "recover" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "sep" > + // "auto" ("e"|"E") "sc" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT); + // } + // "no" ("autoe"|"AutoE") "sc" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + // } + // "compress" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "default" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "no" ("e" | "E") "scape" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + // } + // + // "comment" > { + // handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); noparseTag = "comment"; + // } + // "no" ("p" | "P") "arse" > { + // int tagNamingConvention = getTagNamingConvention(matchedToken, 2); + // handleTagSyntaxAndSwitch(matchedToken, tagNamingConvention, NO_PARSE); + // noparseTag = tagNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION ? "noParse" : "noparse"; + // } + [ + r(/(?:@startTag__id__)(@directiveStartCloseTag1)(?:@closeTag1__id__)/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { + cases: { + "@noParseTags": { token: "tag", next: s("@noParse__id__.$3") }, + "@default": { token: "tag" } + } + }, + { token: "delimiter.directive" }, + { token: "@brackets.directive" } + ] + ], + // "else" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "break" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "continue" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "return" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "stop" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "flush" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "t" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "lt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "rt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "nt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "nested" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "recurse" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "fallback" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // " | "]")> { ftlHeader(matchedToken); } + [ + r(/(?:@startTag__id__)(@directiveStartCloseTag2)(?:@closeTag2__id__)/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { token: "tag" }, + { token: "delimiter.directive" }, + { token: "@brackets.directive" } + ] + ], + // "if" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "else" ("i" | "I") "f" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), FM_EXPRESSION); + // } + // "list" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "for" ("e" | "E") "ach" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), FM_EXPRESSION); + // } + // "switch" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "case" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "assign" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "global" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "local" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // <_INCLUDE : "include" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "import" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "function" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "macro" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "transform" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "visit" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "stop" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "return" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "call" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "setting" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "output" ("f"|"F") "ormat" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), FM_EXPRESSION); + // } + // "nested" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "recurse" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // "escape" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + // + // Note: FreeMarker grammar appears to treat the FTL header as a special case, + // in order to remove new lines after the header (?), but since we only need + // to tokenize for highlighting, we can include this directive here. + // > { ftlHeader(matchedToken); } + // + // Note: FreeMarker grammar appears to treat the items directive as a special case for + // the AST parsing process, but since we only need to tokenize, we can include this + // directive here. + // "items" ()+ > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); } + [ + r(/(?:@startTag__id__)(@directiveStartBlank)(@blank)/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { token: "tag" }, + { token: "", next: s("@fmExpression__id__.directive") } + ] + ], + // "if" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "list" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "sep" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "recover" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "attempt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "for" ("e" | "E") "ach" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), DEFAULT); + // } + // "local" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "global" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "assign" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "function" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "macro" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "output" ("f" | "F") "ormat" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), DEFAULT); + // } + // "auto" ("e" | "E") "sc" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT); + // } + // "no" ("autoe"|"AutoE") "sc" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + // } + // "compress" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "transform" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "switch" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "escape" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); } + // "no" ("e" | "E") "scape" > { + // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT); + // } + [ + r(/(?:@endTag__id__)(@directiveEndCloseTag1)(?:@closeTag1__id__)/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { token: "tag" }, + { token: "delimiter.directive" }, + { token: "@brackets.directive" } + ] + ], + // { unifiedCall(matchedToken); } + [ + r(/(@open__id__)(@)/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : [ + { token: "@brackets.directive" }, + { token: "delimiter.directive", next: s("@unifiedCall__id__") } + ] + ], + // ) (".")*)? > { unifiedCallEnd(matchedToken); } + [ + r(/(@open__id__)(\/@)((?:(?:@id)(?:\.(?:@id))*)?)(?:@closeTag1__id__)/), + [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { token: "tag" }, + { token: "delimiter.directive" }, + { token: "@brackets.directive" } + ] + ], + // { noparseTag = "-->"; handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); } + [ + r(/(@open__id__)#--/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : { token: "comment", next: s("@terseComment__id__") } + ], + // + [ + r(/(?:@startOrEndTag__id__)([a-zA-Z_]+)/), + ts.id === "auto" ? { + cases: { + "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` }, + "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` } + } + } : [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { token: "tag.invalid", next: s("@fmExpression__id__.directive") } + ] + ] + ], + // TOKEN : + [s("interpolation_and_text_token__id__")]: [ + // { startInterpolation(matchedToken); } + // // to handle a lone dollar sign or "<" or "# or <@ with whitespace after" + // + // + [/[\$#<\[\{]|(?:@blank)+|[^\$<#\[\{\n\r\t ]+/, { token: "source" }] + ], + // )* + // "\"" + // ) + // | + // ( + // "'" + // ((~["'", "\\"]) | )* + // "'" + // ) + // > + [s("string_single_token__id__")]: [ + [/[^'\\]/, { token: "string" }], + [/@escapedChar/, { token: "string.escape" }], + [/'/, { token: "string", next: "@pop" }] + ], + [s("string_double_token__id__")]: [ + [/[^"\\]/, { token: "string" }], + [/@escapedChar/, { token: "string.escape" }], + [/"/, { token: "string", next: "@pop" }] + ], + // + [s("string_single_raw_token__id__")]: [ + [/[^']+/, { token: "string.raw" }], + [/'/, { token: "string.raw", next: "@pop" }] + ], + [s("string_double_raw_token__id__")]: [ + [/[^"]+/, { token: "string.raw" }], + [/"/, { token: "string.raw", next: "@pop" }] + ], + // TOKEN : + [s("expression_token__id__")]: [ + // Strings + [ + /(r?)(['"])/, + { + cases: { + "r'": [ + { token: "keyword" }, + { token: "string.raw", next: s("@rawSingleString__id__") } + ], + 'r"': [ + { token: "keyword" }, + { token: "string.raw", next: s("@rawDoubleString__id__") } + ], + "'": [{ token: "source" }, { token: "string", next: s("@singleString__id__") }], + '"': [{ token: "source" }, { token: "string", next: s("@doubleString__id__") }] + } + } + ], + // Numbers + // + // "." > + [ + /(?:@integer)(?:\.(?:@integer))?/, + { + cases: { + "(?:@integer)": { token: "number" }, + "@default": { token: "number.float" } + } + } + ], + // Special hash keys that must not be treated as identifiers + // after a period, e.g. a.** is accessing the key "**" of a + [ + /(\.)(@blank*)(@specialHashKeys)/, + [{ token: "delimiter" }, { token: "" }, { token: "identifier" }] + ], + // Symbols / operators + [ + /(?:@namedSymbols)/, + { + cases: { + "@arrows": { token: "meta.arrow" }, + "@delimiters": { token: "delimiter" }, + "@default": { token: "operators" } + } + } + ], + // Identifiers + [ + /@id/, + { + cases: { + "@keywords": { token: "keyword.$0" }, + "@stringOperators": { token: "operators" }, + "@default": { token: "identifier" } + } + } + ], + // + // + // + // + // + // + [ + /[\[\]\(\)\{\}]/, + { + cases: { + "\\[": { + cases: { + "$S2==gt": { token: "@brackets", next: s("@inParen__id__.gt") }, + "@default": { token: "@brackets", next: s("@inParen__id__.plain") } + } + }, + "\\]": { + cases: { + ...is.id === "bracket" ? { + "$S2==interpolation": { token: "@brackets.interpolation", next: "@popall" } + } : {}, + // This cannot happen while in auto mode, since this applies only to an + // fmExpression inside a directive. But once we encounter the start of a + // directive, we can establish the tag syntax mode. + ...ts.id === "bracket" ? { + "$S2==directive": { token: "@brackets.directive", next: "@popall" } + } : {}, + // Ignore mismatched paren + [s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" }, + "@default": { token: "@brackets" } + } + }, + "\\(": { token: "@brackets", next: s("@inParen__id__.gt") }, + "\\)": { + cases: { + [s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" }, + "@default": { token: "@brackets" } + } + }, + "\\{": { + cases: { + "$S2==gt": { token: "@brackets", next: s("@inParen__id__.gt") }, + "@default": { token: "@brackets", next: s("@inParen__id__.plain") } + } + }, + "\\}": { + cases: { + ...is.id === "bracket" ? {} : { + "$S2==interpolation": { token: "@brackets.interpolation", next: "@popall" } + }, + // Ignore mismatched paren + [s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" }, + "@default": { token: "@brackets" } + } + } + } + } + ], + // SKIP : + [s("blank_and_expression_comment_token__id__")]: [ + // < ( " " | "\t" | "\n" | "\r" )+ > + [/(?:@blank)+/, { token: "" }], + // < ("<" | "[") ("#" | "!") "--"> : EXPRESSION_COMMENT + [/[<\[][#!]--/, { token: "comment", next: s("@expressionComment__id__") }] + ], + // TOKEN : + [s("directive_end_token__id__")]: [ + // "> + // { + // if (inFTLHeader) { + // eatNewline(); + // inFTLHeader = false; + // } + // if (squBracTagSyntax || postInterpolationLexState != -1 /* We are in an interpolation */) { + // matchedToken.kind = NATURAL_GT; + // } else { + // SwitchTo(DEFAULT); + // } + // } + // This cannot happen while in auto mode, since this applies only to an + // fmExpression inside a directive. But once we encounter the start of a + // directive, we can establish the tag syntax mode. + [ + />/, + ts.id === "bracket" ? { token: "operators" } : { token: "@brackets.directive", next: "@popall" } + ], + // " | "/]"> + // It is a syntax error to end a tag with the wrong close token + // Let's indicate that to the user by not closing the tag + [ + r(/(\/)(@close__id__)/), + [{ token: "delimiter.directive" }, { token: "@brackets.directive", next: "@popall" }] + ] + ], + // TOKEN : + [s("greater_operators_token__id__")]: [ + // "> + [/>/, { token: "operators" }], + // ="> + [/>=/, { token: "operators" }] + ], + // TOKEN : + [s("no_space_expression_end_token__id__")]: [ + // : FM_EXPRESSION + [/(?:@blank)+/, { token: "", switchTo: s("@fmExpression__id__.directive") }] + ], + [s("unified_call_token__id__")]: [ + // Special case for a call where the expression is just an ID + // + + [ + /(@id)((?:@blank)+)/, + [{ token: "tag" }, { token: "", next: s("@fmExpression__id__.directive") }] + ], + [ + r(/(@id)(\/?)(@close__id__)/), + [ + { token: "tag" }, + { token: "delimiter.directive" }, + { token: "@brackets.directive", next: "@popall" } + ] + ], + [/./, { token: "@rematch", next: s("@noSpaceExpression__id__") }] + ], + // TOKEN : + [s("no_parse_token__id__")]: [ + // " | "]") + // > + [ + r(/(@open__id__)(\/#?)([a-zA-Z]+)((?:@blank)*)(@close__id__)/), + { + cases: { + "$S2==$3": [ + { token: "@brackets.directive" }, + { token: "delimiter.directive" }, + { token: "tag" }, + { token: "" }, + { token: "@brackets.directive", next: "@popall" } + ], + "$S2==comment": [ + { token: "comment" }, + { token: "comment" }, + { token: "comment" }, + { token: "comment" }, + { token: "comment" } + ], + "@default": [ + { token: "source" }, + { token: "source" }, + { token: "source" }, + { token: "source" }, + { token: "source" } + ] + } + } + ], + // + // + [ + /[^<\[\-]+|[<\[\-]/, + { + cases: { + "$S2==comment": { token: "comment" }, + "@default": { token: "source" } + } + } + ] + ], + // SKIP: + [s("expression_comment_token__id__")]: [ + // < "-->" | "--]"> + [ + /--[>\]]/, + { + token: "comment", + next: "@pop" + } + ], + // < (~["-", ">", "]"])+ > + // < ">"> + // < "]"> + // < "-"> + [/[^\->\]]+|[>\]\-]/, { token: "comment" }] + ], + [s("terse_comment_token__id__")]: [ + // " | "--]"> + [r(/--(?:@close__id__)/), { token: "comment", next: "@popall" }], + // + // + [/[^<\[\-]+|[<\[\-]/, { token: "comment" }] + ] + } + }; +} +function createMonarchLanguageAuto(is) { + const angle = createMonarchLanguage(TagSyntaxAngle, is); + const bracket = createMonarchLanguage(TagSyntaxBracket, is); + const auto = createMonarchLanguage(TagSyntaxAuto, is); + return { + // Angle and bracket syntax mode + // We switch to one of these once we have determined the mode + ...angle, + ...bracket, + ...auto, + // Settings + unicode: true, + includeLF: false, + start: `default_auto_${is.id}`, + ignoreCase: false, + defaultToken: "invalid", + tokenPostfix: `.freemarker2`, + brackets: [ + { open: "{", close: "}", token: "delimiter.curly" }, + { open: "[", close: "]", token: "delimiter.square" }, + { open: "(", close: ")", token: "delimiter.parenthesis" }, + { open: "<", close: ">", token: "delimiter.angle" } + ], + tokenizer: { + ...angle.tokenizer, + ...bracket.tokenizer, + ...auto.tokenizer + } + }; +} +var TagAngleInterpolationDollar = { + conf: createLangConfiguration(TagSyntaxAngle), + language: createMonarchLanguage(TagSyntaxAngle, InterpolationSyntaxDollar) +}; +var TagBracketInterpolationDollar = { + conf: createLangConfiguration(TagSyntaxBracket), + language: createMonarchLanguage(TagSyntaxBracket, InterpolationSyntaxDollar) +}; +var TagAngleInterpolationBracket = { + conf: createLangConfiguration(TagSyntaxAngle), + language: createMonarchLanguage(TagSyntaxAngle, InterpolationSyntaxBracket) +}; +var TagBracketInterpolationBracket = { + conf: createLangConfiguration(TagSyntaxBracket), + language: createMonarchLanguage(TagSyntaxBracket, InterpolationSyntaxBracket) +}; +var TagAutoInterpolationDollar = { + conf: createLangConfigurationAuto(), + language: createMonarchLanguageAuto(InterpolationSyntaxDollar) +}; +var TagAutoInterpolationBracket = { + conf: createLangConfigurationAuto(), + language: createMonarchLanguageAuto(InterpolationSyntaxBracket) +}; +export { + TagAngleInterpolationBracket, + TagAngleInterpolationDollar, + TagAutoInterpolationBracket, + TagAutoInterpolationDollar, + TagBracketInterpolationBracket, + TagBracketInterpolationDollar +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..d894454546b17866dd7b1789df24c60e57ce71e6 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/fsharp/fsharp.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "fsharp", + extensions: [".fs", ".fsi", ".ml", ".mli", ".fsx", ".fsscript"], + aliases: ["F#", "FSharp", "fsharp"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/fsharp/fsharp"], resolve, reject); + }); + } else { + return import("./fsharp.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.js new file mode 100644 index 0000000000000000000000000000000000000000..7e749ca867fd4cba7dd81240b5b228cd20195faa --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.js @@ -0,0 +1,227 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/fsharp/fsharp.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["(*", "*)"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"), + end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)") + } + } +}; +var language = { + defaultToken: "", + tokenPostfix: ".fs", + keywords: [ + "abstract", + "and", + "atomic", + "as", + "assert", + "asr", + "base", + "begin", + "break", + "checked", + "component", + "const", + "constraint", + "constructor", + "continue", + "class", + "default", + "delegate", + "do", + "done", + "downcast", + "downto", + "elif", + "else", + "end", + "exception", + "eager", + "event", + "external", + "extern", + "false", + "finally", + "for", + "fun", + "function", + "fixed", + "functor", + "global", + "if", + "in", + "include", + "inherit", + "inline", + "interface", + "internal", + "land", + "lor", + "lsl", + "lsr", + "lxor", + "lazy", + "let", + "match", + "member", + "mod", + "module", + "mutable", + "namespace", + "method", + "mixin", + "new", + "not", + "null", + "of", + "open", + "or", + "object", + "override", + "private", + "parallel", + "process", + "protected", + "pure", + "public", + "rec", + "return", + "static", + "sealed", + "struct", + "sig", + "then", + "to", + "true", + "tailcall", + "trait", + "try", + "type", + "upcast", + "use", + "val", + "void", + "virtual", + "volatile", + "when", + "while", + "with", + "yield" + ], + // we include these common regular expressions + symbols: /[=>]. + [/\[<.*>\]/, "annotation"], + // Preprocessor directive + [/^#(if|else|endif)/, "keyword"], + // delimiters and operators + [/[{}()\[\]]/, "@brackets"], + [/[<>](?!@symbols)/, "@brackets"], + [/@symbols/, "delimiter"], + // numbers + [/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"], + [/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"], + [/0x[0-9a-fA-F]+LF/, "number.float"], + [/0x[0-9a-fA-F]+(@integersuffix)/, "number.hex"], + [/0b[0-1]+(@integersuffix)/, "number.bin"], + [/\d+(@integersuffix)/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"""/, "string", '@string."""'], + [/"/, "string", '@string."'], + // literal string + [/\@"/, { token: "string.quote", next: "@litstring" }], + // characters + [/'[^\\']'B?/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/\(\*(?!\))/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^*(]+/, "comment"], + [/\*\)/, "comment", "@pop"], + [/\*/, "comment"], + [/\(\*\)/, "comment"], + [/\(/, "comment"] + ], + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [ + /("""|"B?)/, + { + cases: { + "$#==$S2": { token: "string", next: "@pop" }, + "@default": "string" + } + } + ] + ], + litstring: [ + [/[^"]+/, "string"], + [/""/, "string.escape"], + [/"/, { token: "string.quote", next: "@pop" }] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..febba6102cf1216a37d04db24e68e4df2ca1c378 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.contribution.js @@ -0,0 +1,24 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/go/go.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "go", + extensions: [".go"], + aliases: ["Go"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/go/go"], resolve, reject); + }); + } else { + return import("./go.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.js new file mode 100644 index 0000000000000000000000000000000000000000..93cef08e37f90211dcf25b921099abd173f8cf19 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/go/go.js @@ -0,0 +1,228 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/go/go.ts +var conf = { + comments: { + lineComment: "//", + blockComment: ["/*", "*/"] + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "`", close: "`", notIn: ["string"] }, + { open: '"', close: '"', notIn: ["string"] }, + { open: "'", close: "'", notIn: ["string", "comment"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: "`", close: "`" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: ".go", + keywords: [ + "break", + "case", + "chan", + "const", + "continue", + "default", + "defer", + "else", + "fallthrough", + "for", + "func", + "go", + "goto", + "if", + "import", + "interface", + "map", + "package", + "range", + "return", + "select", + "struct", + "switch", + "type", + "var", + "bool", + "true", + "false", + "uint8", + "uint16", + "uint32", + "uint64", + "int8", + "int16", + "int32", + "int64", + "float32", + "float64", + "complex64", + "complex128", + "byte", + "rune", + "uint", + "int", + "uintptr", + "string", + "nil" + ], + operators: [ + "+", + "-", + "*", + "/", + "%", + "&", + "|", + "^", + "<<", + ">>", + "&^", + "+=", + "-=", + "*=", + "/=", + "%=", + "&=", + "|=", + "^=", + "<<=", + ">>=", + "&^=", + "&&", + "||", + "<-", + "++", + "--", + "==", + "<", + ">", + "=", + "!", + "!=", + "<=", + ">=", + ":=", + "...", + "(", + ")", + "", + "]", + "{", + "}", + ",", + ";", + ".", + ":" + ], + // we include these common regular expressions + symbols: /[=>](?!@symbols)/, "@brackets"], + [ + /@symbols/, + { + cases: { + "@operators": "delimiter", + "@default": "" + } + } + ], + // numbers + [/\d*\d+[eE]([\-+]?\d+)?/, "number.float"], + [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], + [/0[xX][0-9a-fA-F']*[0-9a-fA-F]/, "number.hex"], + [/0[0-7']*[0-7]/, "number.octal"], + [/0[bB][0-1']*[0-1]/, "number.binary"], + [/\d[\d']*/, "number"], + [/\d/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, "string", "@string"], + [/`/, "string", "@rawstring"], + // characters + [/'[^\\']'/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/\/\*\*(?!\/)/, "comment.doc", "@doccomment"], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"] + ], + comment: [ + [/[^\/*]+/, "comment"], + // [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-( + // [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/ + [/\*\//, "comment", "@pop"], + [/[\/*]/, "comment"] + ], + //Identical copy of comment above, except for the addition of .doc + doccomment: [ + [/[^\/*]+/, "comment.doc"], + // [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-( + [/\/\*/, "comment.doc.invalid"], + [/\*\//, "comment.doc", "@pop"], + [/[\/*]/, "comment.doc"] + ], + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, "string", "@pop"] + ], + rawstring: [ + [/[^\`]/, "string"], + [/`/, "string", "@pop"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..cf6c80a3e889422852112f85ad2898cb7ba9c4ad --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.js @@ -0,0 +1,25 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/graphql/graphql.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "graphql", + extensions: [".graphql", ".gql"], + aliases: ["GraphQL", "graphql", "gql"], + mimetypes: ["application/graphql"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/graphql/graphql"], resolve, reject); + }); + } else { + return import("./graphql.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.js new file mode 100644 index 0000000000000000000000000000000000000000..e45bae81e5c0762151727c02087737fc6ebc0c31 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/graphql/graphql.js @@ -0,0 +1,161 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/graphql/graphql.ts +var conf = { + comments: { + lineComment: "#" + }, + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"""', close: '"""', notIn: ["string", "comment"] }, + { open: '"', close: '"', notIn: ["string", "comment"] } + ], + surroundingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"""', close: '"""' }, + { open: '"', close: '"' } + ], + folding: { + offSide: true + } +}; +var language = { + // Set defaultToken to invalid to see what you do not tokenize yet + defaultToken: "invalid", + tokenPostfix: ".gql", + keywords: [ + "null", + "true", + "false", + "query", + "mutation", + "subscription", + "extend", + "schema", + "directive", + "scalar", + "type", + "interface", + "union", + "enum", + "input", + "implements", + "fragment", + "on" + ], + typeKeywords: ["Int", "Float", "String", "Boolean", "ID"], + directiveLocations: [ + "SCHEMA", + "SCALAR", + "OBJECT", + "FIELD_DEFINITION", + "ARGUMENT_DEFINITION", + "INTERFACE", + "UNION", + "ENUM", + "ENUM_VALUE", + "INPUT_OBJECT", + "INPUT_FIELD_DEFINITION", + "QUERY", + "MUTATION", + "SUBSCRIPTION", + "FIELD", + "FRAGMENT_DEFINITION", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT", + "VARIABLE_DEFINITION" + ], + operators: ["=", "!", "?", ":", "&", "|"], + // we include these common regular expressions + symbols: /[=!?:&|]+/, + // https://facebook.github.io/graphql/draft/#sec-String-Value + escapes: /\\(?:["\\\/bfnrt]|u[0-9A-Fa-f]{4})/, + // The main tokenizer for our languages + tokenizer: { + root: [ + // fields and argument names + [ + /[a-z_][\w$]*/, + { + cases: { + "@keywords": "keyword", + "@default": "key.identifier" + } + } + ], + // identify typed input variables + [ + /[$][\w$]*/, + { + cases: { + "@keywords": "keyword", + "@default": "argument.identifier" + } + } + ], + // to show class names nicely + [ + /[A-Z][\w\$]*/, + { + cases: { + "@typeKeywords": "keyword", + "@default": "type.identifier" + } + } + ], + // whitespace + { include: "@whitespace" }, + // delimiters and operators + [/[{}()\[\]]/, "@brackets"], + [/@symbols/, { cases: { "@operators": "operator", "@default": "" } }], + // @ annotations. + // As an example, we emit a debugging log message on these tokens. + // Note: message are supressed during the first load -- change some lines to see them. + [/@\s*[a-zA-Z_\$][\w\$]*/, { token: "annotation", log: "annotation token: $0" }], + // numbers + [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], + [/0[xX][0-9a-fA-F]+/, "number.hex"], + [/\d+/, "number"], + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + [/"""/, { token: "string", next: "@mlstring", nextEmbedded: "markdown" }], + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], + // non-teminated string + [/"/, { token: "string.quote", bracket: "@open", next: "@string" }] + ], + mlstring: [ + [/[^"]+/, "string"], + ['"""', { token: "string", next: "@pop", nextEmbedded: "@pop" }] + ], + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }] + ], + whitespace: [ + [/[ \t\r\n]+/, ""], + [/#.*$/, "comment"] + ] + } +}; +export { + conf, + language +}; diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.d.ts b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..336ce12bb9106afdf843063ee67c0c1970f70d37 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.d.ts @@ -0,0 +1 @@ +export {} diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.js new file mode 100644 index 0000000000000000000000000000000000000000..3bf3e831658033ea04d8968f0e6d9ae85c643fc9 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.contribution.js @@ -0,0 +1,25 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + + +// src/basic-languages/handlebars/handlebars.contribution.ts +import { registerLanguage } from "../_.contribution.js"; +registerLanguage({ + id: "handlebars", + extensions: [".handlebars", ".hbs"], + aliases: ["Handlebars", "handlebars", "hbs"], + mimetypes: ["text/x-handlebars-template"], + loader: () => { + if (false) { + return new Promise((resolve, reject) => { + __require(["vs/basic-languages/handlebars/handlebars"], resolve, reject); + }); + } else { + return import("./handlebars.js"); + } + } +}); diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.js new file mode 100644 index 0000000000000000000000000000000000000000..d8a85d71e9fad08f255d690867d80881bb7e3f28 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/basic-languages/handlebars/handlebars.js @@ -0,0 +1,440 @@ +/*!----------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt + *-----------------------------------------------------------------------------*/ + +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); + +// src/fillers/monaco-editor-core.ts +var monaco_editor_core_exports = {}; +__reExport(monaco_editor_core_exports, monaco_editor_core_star); +import * as monaco_editor_core_star from "../../editor/editor.api.js"; + +// src/basic-languages/handlebars/handlebars.ts +var EMPTY_ELEMENTS = [ + "area", + "base", + "br", + "col", + "embed", + "hr", + "img", + "input", + "keygen", + "link", + "menuitem", + "meta", + "param", + "source", + "track", + "wbr" +]; +var conf = { + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g, + comments: { + blockComment: ["{{!--", "--}}"] + }, + brackets: [ + [""], + ["<", ">"], + ["{{", "}}"], + ["{", "}"], + ["(", ")"] + ], + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + surroundingPairs: [ + { open: "<", close: ">" }, + { open: '"', close: '"' }, + { open: "'", close: "'" } + ], + onEnterRules: [ + { + beforeText: new RegExp( + `<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, + "i" + ), + afterText: /^<\/(\w[\w\d]*)\s*>$/i, + action: { + indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent + } + }, + { + beforeText: new RegExp( + `<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, + "i" + ), + action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent } + } + ] +}; +var language = { + defaultToken: "", + tokenPostfix: "", + // ignoreCase: true, + // The main tokenizer for our languages + tokenizer: { + root: [ + [/\{\{!--/, "comment.block.start.handlebars", "@commentBlock"], + [/\{\{!/, "comment.start.handlebars", "@comment"], + [/\{\{/, { token: "@rematch", switchTo: "@handlebarsInSimpleState.root" }], + [/)/, ["delimiter.html", "tag.html", "delimiter.html"]], + [/(<)(script)/, ["delimiter.html", { token: "tag.html", next: "@script" }]], + [/(<)(style)/, ["delimiter.html", { token: "tag.html", next: "@style" }]], + [/(<)([:\w]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]], + [/(<\/)(\w+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]], + [/]+/, "metatag.content.html"], + [/>/, "metatag.html", "@pop"] + ], + comment: [ + [/\}\}/, "comment.end.handlebars", "@pop"], + [/./, "comment.content.handlebars"] + ], + commentBlock: [ + [/--\}\}/, "comment.block.end.handlebars", "@pop"], + [/./, "comment.content.handlebars"] + ], + commentHtml: [ + [ + /\{\{/, + { + token: "@rematch", + switchTo: "@handlebarsInSimpleState.comment" + } + ], + [/-->/, "comment.html", "@pop"], + [/[^-]+/, "comment.content.html"], + [/./, "comment.content.html"] + ], + otherTag: [ + [ + /\{\{/, + { + token: "@rematch", + switchTo: "@handlebarsInSimpleState.otherTag" + } + ], + [/\/?>/, "delimiter.html", "@pop"], + [/"([^"]*)"/, "attribute.value"], + [/'([^']*)'/, "attribute.value"], + [/[\w\-]+/, "attribute.name"], + [/=/, "delimiter"], + [/[ \t\r\n]+/] + // whitespace + ], + // -- BEGIN