diff --git a/.gitattributes b/.gitattributes index 8812643f86513d68db5b69ee582418eefb1a81bb..c722c3c8aa605ed89435d4dd91c9f10d280e6801 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3522,3 +3522,7 @@ novas/novacore-zephyr/claude-code-router/ui/node_modules/@tailwindcss/oxide-linu novas/novacore-zephyr/claude-code-router/ui/node_modules/@tailwindcss/oxide-linux-x64-musl/tailwindcss-oxide.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text novas/novacore-zephyr/claude-code-router/ui/node_modules/@esbuild/linux-x64/bin/esbuild filter=lfs diff=lfs merge=lfs -text novas/novacore-zephyr/claude-code-router/ui/node_modules/esbuild/bin/esbuild filter=lfs diff=lfs merge=lfs -text +novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/esm/vs/language/typescript/ts.worker.js filter=lfs diff=lfs merge=lfs -text +novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/vs/editor/editor.main.js.map filter=lfs diff=lfs merge=lfs -text +novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/vs/language/typescript/tsWorker.js filter=lfs diff=lfs merge=lfs -text +novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/min-maps/vs/editor/editor.main.js.map filter=lfs diff=lfs merge=lfs -text diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/vs/base/browser/ui/codicons/codicon/codicon.ttf b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/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/dev/vs/base/browser/ui/codicons/codicon/codicon.ttf differ diff --git a/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/vs/base/worker/workerMain.js b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/vs/base/worker/workerMain.js new file mode 100644 index 0000000000000000000000000000000000000000..fd469db1daaec95fe464c95b9f8b9351430ea7e3 --- /dev/null +++ b/novas/novacore-zephyr/claude-code-router/ui/node_modules/monaco-editor/dev/vs/base/worker/workerMain.js @@ -0,0 +1,21642 @@ +/*!----------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) + * Released under the MIT license + * https://github.com/microsoft/vscode/blob/main/LICENSE.txt + *-----------------------------------------------------------*/ + +(function() { +var __m = ["require","exports","vs/editor/common/core/range","vs/base/common/errors","vs/editor/common/core/position","vs/editor/common/core/offsetRange","vs/base/common/strings","vs/base/common/arrays","vs/base/common/lifecycle","vs/base/common/event","vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm","vs/base/common/platform","vs/base/common/assert","vs/editor/common/core/lineRange","vs/base/common/uri","vs/base/common/arraysFind","vs/editor/common/diff/defaultLinesDiffComputer/utils","vs/editor/common/diff/rangeMapping","vs/base/common/functional","vs/base/common/iterator","vs/base/common/linkedList","vs/base/common/map","vs/base/common/stopwatch","vs/base/common/cancellation","vs/base/common/diff/diff","vs/base/common/types","vs/base/common/codiconsUtil","vs/base/common/objects","vs/base/common/uint","vs/editor/common/core/characterClassifier","vs/editor/common/core/textLength","vs/editor/common/core/wordHelper","vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm","vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence","vs/editor/common/diff/linesDiffComputer","vs/nls.messages","vs/nls","vs/base/common/path","vs/base/common/network","vs/base/common/cache","vs/base/common/color","vs/base/common/diff/diffChange","vs/base/common/keyCodes","vs/base/common/lazy","vs/base/common/hash","vs/base/common/symbols","vs/base/common/codiconsLibrary","vs/base/common/codicons","vs/editor/common/core/selection","vs/editor/common/core/positionToOffset","vs/editor/common/core/textEdit","vs/editor/common/core/wordCharacterClassifier","vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations","vs/editor/common/diff/defaultLinesDiffComputer/lineSequence","vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing","vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines","vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer","vs/editor/common/diff/legacyLinesDiffComputer","vs/editor/common/diff/linesDiffComputers","vs/editor/common/languages/defaultDocumentColorsComputer","vs/editor/common/languages/linkComputer","vs/editor/common/languages/supports/inplaceReplaceSupport","vs/editor/common/model","vs/editor/common/model/prefixSumComputer","vs/editor/common/model/mirrorTextModel","vs/editor/common/model/textModelSearch","vs/editor/common/services/editorWorkerHost","vs/editor/common/services/findSectionHeaders","vs/editor/common/services/unicodeTextModelHighlighter","vs/editor/common/standalone/standaloneEnums","vs/editor/common/tokenizationRegistry","vs/base/common/async","vs/base/common/process","vs/editor/common/languages","vs/editor/common/services/editorBaseApi","vs/editor/common/services/textModelSync/textModelSync.impl","vs/base/common/worker/simpleWorker","vs/editor/common/services/editorSimpleWorker"]; +var __M = function(deps) { + var result = []; + for (var i = 0, len = deps.length; i < len; i++) { + result[i] = __m[deps[i]]; + } + return result; +}; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + * Please make sure to make edits in the .ts file at https://github.com/microsoft/vscode-loader/ + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------*/ +const _amdLoaderGlobal = this; +const _commonjsGlobal = typeof global === 'object' ? global : {}; +var AMDLoader; +(function (AMDLoader) { + AMDLoader.global = _amdLoaderGlobal; + class Environment { + get isWindows() { + this._detect(); + return this._isWindows; + } + get isNode() { + this._detect(); + return this._isNode; + } + get isElectronRenderer() { + this._detect(); + return this._isElectronRenderer; + } + get isWebWorker() { + this._detect(); + return this._isWebWorker; + } + get isElectronNodeIntegrationWebWorker() { + this._detect(); + return this._isElectronNodeIntegrationWebWorker; + } + constructor() { + this._detected = false; + this._isWindows = false; + this._isNode = false; + this._isElectronRenderer = false; + this._isWebWorker = false; + this._isElectronNodeIntegrationWebWorker = false; + } + _detect() { + if (this._detected) { + return; + } + this._detected = true; + this._isWindows = Environment._isWindows(); + this._isNode = (typeof module !== 'undefined' && !!module.exports); + this._isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer'); + this._isWebWorker = (typeof AMDLoader.global.importScripts === 'function'); + this._isElectronNodeIntegrationWebWorker = this._isWebWorker && (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'worker'); + } + static _isWindows() { + if (typeof navigator !== 'undefined') { + if (navigator.userAgent && navigator.userAgent.indexOf('Windows') >= 0) { + return true; + } + } + if (typeof process !== 'undefined') { + return (process.platform === 'win32'); + } + return false; + } + } + AMDLoader.Environment = Environment; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + class LoaderEvent { + constructor(type, detail, timestamp) { + this.type = type; + this.detail = detail; + this.timestamp = timestamp; + } + } + AMDLoader.LoaderEvent = LoaderEvent; + class LoaderEventRecorder { + constructor(loaderAvailableTimestamp) { + this._events = [new LoaderEvent(1 /* LoaderEventType.LoaderAvailable */, '', loaderAvailableTimestamp)]; + } + record(type, detail) { + this._events.push(new LoaderEvent(type, detail, AMDLoader.Utilities.getHighPerformanceTimestamp())); + } + getEvents() { + return this._events; + } + } + AMDLoader.LoaderEventRecorder = LoaderEventRecorder; + class NullLoaderEventRecorder { + record(type, detail) { + // Nothing to do + } + getEvents() { + return []; + } + } + NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder(); + AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + class Utilities { + /** + * This method does not take care of / vs \ + */ + static fileUriToFilePath(isWindows, uri) { + uri = decodeURI(uri).replace(/%23/g, '#'); + if (isWindows) { + if (/^file:\/\/\//.test(uri)) { + // This is a URI without a hostname => return only the path segment + return uri.substr(8); + } + if (/^file:\/\//.test(uri)) { + return uri.substr(5); + } + } + else { + if (/^file:\/\//.test(uri)) { + return uri.substr(7); + } + } + // Not sure... + return uri; + } + static startsWith(haystack, needle) { + return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle; + } + static endsWith(haystack, needle) { + return haystack.length >= needle.length && haystack.substr(haystack.length - needle.length) === needle; + } + // only check for "?" before "#" to ensure that there is a real Query-String + static containsQueryString(url) { + return /^[^\#]*\?/gi.test(url); + } + /** + * Does `url` start with http:// or https:// or file:// or / ? + */ + static isAbsolutePath(url) { + return /^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(url); + } + static forEachProperty(obj, callback) { + if (obj) { + let key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + callback(key, obj[key]); + } + } + } + } + static isEmpty(obj) { + let isEmpty = true; + Utilities.forEachProperty(obj, () => { + isEmpty = false; + }); + return isEmpty; + } + static recursiveClone(obj) { + if (!obj || typeof obj !== 'object' || obj instanceof RegExp) { + return obj; + } + if (!Array.isArray(obj) && Object.getPrototypeOf(obj) !== Object.prototype) { + // only clone "simple" objects + return obj; + } + let result = Array.isArray(obj) ? [] : {}; + Utilities.forEachProperty(obj, (key, value) => { + if (value && typeof value === 'object') { + result[key] = Utilities.recursiveClone(value); + } + else { + result[key] = value; + } + }); + return result; + } + static generateAnonymousModule() { + return '===anonymous' + (Utilities.NEXT_ANONYMOUS_ID++) + '==='; + } + static isAnonymousModule(id) { + return Utilities.startsWith(id, '===anonymous'); + } + static getHighPerformanceTimestamp() { + if (!this.PERFORMANCE_NOW_PROBED) { + this.PERFORMANCE_NOW_PROBED = true; + this.HAS_PERFORMANCE_NOW = (AMDLoader.global.performance && typeof AMDLoader.global.performance.now === 'function'); + } + return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now()); + } + } + Utilities.NEXT_ANONYMOUS_ID = 1; + Utilities.PERFORMANCE_NOW_PROBED = false; + Utilities.HAS_PERFORMANCE_NOW = false; + AMDLoader.Utilities = Utilities; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + function ensureError(err) { + if (err instanceof Error) { + return err; + } + const result = new Error(err.message || String(err) || 'Unknown Error'); + if (err.stack) { + result.stack = err.stack; + } + return result; + } + AMDLoader.ensureError = ensureError; + ; + class ConfigurationOptionsUtil { + /** + * Ensure configuration options make sense + */ + static validateConfigurationOptions(options) { + function defaultOnError(err) { + if (err.phase === 'loading') { + console.error('Loading "' + err.moduleId + '" failed'); + console.error(err); + console.error('Here are the modules that depend on it:'); + console.error(err.neededBy); + return; + } + if (err.phase === 'factory') { + console.error('The factory function of "' + err.moduleId + '" has thrown an exception'); + console.error(err); + console.error('Here are the modules that depend on it:'); + console.error(err.neededBy); + return; + } + } + options = options || {}; + if (typeof options.baseUrl !== 'string') { + options.baseUrl = ''; + } + if (typeof options.isBuild !== 'boolean') { + options.isBuild = false; + } + if (typeof options.paths !== 'object') { + options.paths = {}; + } + if (typeof options.config !== 'object') { + options.config = {}; + } + if (typeof options.catchError === 'undefined') { + options.catchError = false; + } + if (typeof options.recordStats === 'undefined') { + options.recordStats = false; + } + if (typeof options.urlArgs !== 'string') { + options.urlArgs = ''; + } + if (typeof options.onError !== 'function') { + options.onError = defaultOnError; + } + if (!Array.isArray(options.ignoreDuplicateModules)) { + options.ignoreDuplicateModules = []; + } + if (options.baseUrl.length > 0) { + if (!AMDLoader.Utilities.endsWith(options.baseUrl, '/')) { + options.baseUrl += '/'; + } + } + if (typeof options.cspNonce !== 'string') { + options.cspNonce = ''; + } + if (typeof options.preferScriptTags === 'undefined') { + options.preferScriptTags = false; + } + if (options.nodeCachedData && typeof options.nodeCachedData === 'object') { + if (typeof options.nodeCachedData.seed !== 'string') { + options.nodeCachedData.seed = 'seed'; + } + if (typeof options.nodeCachedData.writeDelay !== 'number' || options.nodeCachedData.writeDelay < 0) { + options.nodeCachedData.writeDelay = 1000 * 7; + } + if (!options.nodeCachedData.path || typeof options.nodeCachedData.path !== 'string') { + const err = ensureError(new Error('INVALID cached data configuration, \'path\' MUST be set')); + err.phase = 'configuration'; + options.onError(err); + options.nodeCachedData = undefined; + } + } + return options; + } + static mergeConfigurationOptions(overwrite = null, base = null) { + let result = AMDLoader.Utilities.recursiveClone(base || {}); + // Merge known properties and overwrite the unknown ones + AMDLoader.Utilities.forEachProperty(overwrite, (key, value) => { + if (key === 'ignoreDuplicateModules' && typeof result.ignoreDuplicateModules !== 'undefined') { + result.ignoreDuplicateModules = result.ignoreDuplicateModules.concat(value); + } + else if (key === 'paths' && typeof result.paths !== 'undefined') { + AMDLoader.Utilities.forEachProperty(value, (key2, value2) => result.paths[key2] = value2); + } + else if (key === 'config' && typeof result.config !== 'undefined') { + AMDLoader.Utilities.forEachProperty(value, (key2, value2) => result.config[key2] = value2); + } + else { + result[key] = AMDLoader.Utilities.recursiveClone(value); + } + }); + return ConfigurationOptionsUtil.validateConfigurationOptions(result); + } + } + AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil; + class Configuration { + constructor(env, options) { + this._env = env; + this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options); + this._createIgnoreDuplicateModulesMap(); + this._createSortedPathsRules(); + if (this.options.baseUrl === '') { + if (this.options.nodeRequire && this.options.nodeRequire.main && this.options.nodeRequire.main.filename && this._env.isNode) { + let nodeMain = this.options.nodeRequire.main.filename; + let dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\')); + this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1); + } + } + } + _createIgnoreDuplicateModulesMap() { + // Build a map out of the ignoreDuplicateModules array + this.ignoreDuplicateModulesMap = {}; + for (let i = 0; i < this.options.ignoreDuplicateModules.length; i++) { + this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[i]] = true; + } + } + _createSortedPathsRules() { + // Create an array our of the paths rules, sorted descending by length to + // result in a more specific -> less specific order + this.sortedPathsRules = []; + AMDLoader.Utilities.forEachProperty(this.options.paths, (from, to) => { + if (!Array.isArray(to)) { + this.sortedPathsRules.push({ + from: from, + to: [to] + }); + } + else { + this.sortedPathsRules.push({ + from: from, + to: to + }); + } + }); + this.sortedPathsRules.sort((a, b) => { + return b.from.length - a.from.length; + }); + } + /** + * Clone current configuration and overwrite options selectively. + * @param options The selective options to overwrite with. + * @result A new configuration + */ + cloneAndMerge(options) { + return new Configuration(this._env, ConfigurationOptionsUtil.mergeConfigurationOptions(options, this.options)); + } + /** + * Get current options bag. Useful for passing it forward to plugins. + */ + getOptionsLiteral() { + return this.options; + } + _applyPaths(moduleId) { + let pathRule; + for (let i = 0, len = this.sortedPathsRules.length; i < len; i++) { + pathRule = this.sortedPathsRules[i]; + if (AMDLoader.Utilities.startsWith(moduleId, pathRule.from)) { + let result = []; + for (let j = 0, lenJ = pathRule.to.length; j < lenJ; j++) { + result.push(pathRule.to[j] + moduleId.substr(pathRule.from.length)); + } + return result; + } + } + return [moduleId]; + } + _addUrlArgsToUrl(url) { + if (AMDLoader.Utilities.containsQueryString(url)) { + return url + '&' + this.options.urlArgs; + } + else { + return url + '?' + this.options.urlArgs; + } + } + _addUrlArgsIfNecessaryToUrl(url) { + if (this.options.urlArgs) { + return this._addUrlArgsToUrl(url); + } + return url; + } + _addUrlArgsIfNecessaryToUrls(urls) { + if (this.options.urlArgs) { + for (let i = 0, len = urls.length; i < len; i++) { + urls[i] = this._addUrlArgsToUrl(urls[i]); + } + } + return urls; + } + /** + * Transform a module id to a location. Appends .js to module ids + */ + moduleIdToPaths(moduleId) { + if (this._env.isNode) { + const isNodeModule = (this.options.amdModulesPattern instanceof RegExp + && !this.options.amdModulesPattern.test(moduleId)); + if (isNodeModule) { + // This is a node module... + if (this.isBuild()) { + // ...and we are at build time, drop it + return ['empty:']; + } + else { + // ...and at runtime we create a `shortcut`-path + return ['node|' + moduleId]; + } + } + } + let result = moduleId; + let results; + if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.isAbsolutePath(result)) { + results = this._applyPaths(result); + for (let i = 0, len = results.length; i < len; i++) { + if (this.isBuild() && results[i] === 'empty:') { + continue; + } + if (!AMDLoader.Utilities.isAbsolutePath(results[i])) { + results[i] = this.options.baseUrl + results[i]; + } + if (!AMDLoader.Utilities.endsWith(results[i], '.js') && !AMDLoader.Utilities.containsQueryString(results[i])) { + results[i] = results[i] + '.js'; + } + } + } + else { + if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.containsQueryString(result)) { + result = result + '.js'; + } + results = [result]; + } + return this._addUrlArgsIfNecessaryToUrls(results); + } + /** + * Transform a module id or url to a location. + */ + requireToUrl(url) { + let result = url; + if (!AMDLoader.Utilities.isAbsolutePath(result)) { + result = this._applyPaths(result)[0]; + if (!AMDLoader.Utilities.isAbsolutePath(result)) { + result = this.options.baseUrl + result; + } + } + return this._addUrlArgsIfNecessaryToUrl(result); + } + /** + * Flag to indicate if current execution is as part of a build. + */ + isBuild() { + return this.options.isBuild; + } + shouldInvokeFactory(strModuleId) { + if (!this.options.isBuild) { + // outside of a build, all factories should be invoked + return true; + } + // during a build, only explicitly marked or anonymous modules get their factories invoked + if (AMDLoader.Utilities.isAnonymousModule(strModuleId)) { + return true; + } + if (this.options.buildForceInvokeFactory && this.options.buildForceInvokeFactory[strModuleId]) { + return true; + } + return false; + } + /** + * Test if module `moduleId` is expected to be defined multiple times + */ + isDuplicateMessageIgnoredFor(moduleId) { + return this.ignoreDuplicateModulesMap.hasOwnProperty(moduleId); + } + /** + * Get the configuration settings for the provided module id + */ + getConfigForModule(moduleId) { + if (this.options.config) { + return this.options.config[moduleId]; + } + } + /** + * Should errors be caught when executing module factories? + */ + shouldCatchError() { + return this.options.catchError; + } + /** + * Should statistics be recorded? + */ + shouldRecordStats() { + return this.options.recordStats; + } + /** + * Forward an error to the error handler. + */ + onError(err) { + this.options.onError(err); + } + } + AMDLoader.Configuration = Configuration; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + /** + * Load `scriptSrc` only once (avoid multiple ` + ) + ); +} +function escapeScript(script) { + return script.replace(/ + * + * @name UNSAFE_useScrollRestoration + * @category Hooks + * @mode framework + * @mode data + * @param options Options + * @param options.getKey A function that returns a key to use for scroll restoration. + * This is useful for custom scroll restoration logic, such as using only the pathname + * so that subsequent navigations to prior paths will restore the scroll. Defaults + * to `location.key`. + * @param options.storageKey The key to use for storing scroll positions in + * `sessionStorage`. Defaults to `"react-router-scroll-positions"`. + * @returns {void} + */ +declare function useScrollRestoration({ getKey, storageKey, }?: { + getKey?: GetScrollRestorationKeyFunction; + storageKey?: string; +}): void; +/** + * Set up a callback to be fired on [Window's `beforeunload` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event). + * + * @public + * @category Hooks + * @param callback The callback to be called when the [`beforeunload` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) + * is fired. + * @param options Options + * @param options.capture If `true`, the event will be captured during the capture + * phase. Defaults to `false`. + * @returns {void} + */ +declare function useBeforeUnload(callback: (event: BeforeUnloadEvent) => any, options?: { + capture?: boolean; +}): void; +/** + * Wrapper around {@link useBlocker} to show a [`window.confirm`](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm) + * prompt to users instead of building a custom UI with {@link useBlocker}. + * + * The `unstable_` flag will not be removed because this technique has a lot of + * rough edges and behaves very differently (and incorrectly sometimes) across + * browsers if users click addition back/forward navigations while the + * confirmation is open. Use at your own risk. + * + * @example + * function ImportantForm() { + * let [value, setValue] = React.useState(""); + * + * // Block navigating elsewhere when data has been entered into the input + * unstable_usePrompt({ + * message: "Are you sure?", + * when: ({ currentLocation, nextLocation }) => + * value !== "" && + * currentLocation.pathname !== nextLocation.pathname, + * }); + * + * return ( + *
+ * + * + *
+ * ); + * } + * + * @name unstable_usePrompt + * @public + * @category Hooks + * @mode framework + * @mode data + * @param options Options + * @param options.message The message to show in the confirmation dialog. + * @param options.when A boolean or a function that returns a boolean indicating + * whether to block the navigation. If a function is provided, it will receive an + * object with `currentLocation` and `nextLocation` properties. + * @returns {void} + */ +declare function usePrompt({ when, message, }: { + when: boolean | BlockerFunction; + message: string; +}): void; +/** + * This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) + * to the specified location. This can be used to apply finer-grained styles to + * elements to further customize the view transition. This requires that view + * transitions have been enabled for the given navigation via {@link LinkProps.viewTransition} + * (or the `Form`, `submit`, or `navigate` call) + * + * @public + * @category Hooks + * @mode framework + * @mode data + * @param to The {@link To} location to check for an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API). + * @param options Options + * @param options.relative The relative routing type to use when resolving the + * `to` location, defaults to `"route"`. See {@link RelativeRoutingType} for more details. + * @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) + * to the specified {@link Location}, otherwise `false`. + */ +declare function useViewTransitionState(to: To, { relative }?: { + relative?: RelativeRoutingType; +}): boolean; + +interface StaticRouterProps { + basename?: string; + children?: React.ReactNode; + location: Partial | string; +} +/** + * A `` that may not navigate to any other location. This is useful + * on the server where there is no stateful UI. + * + * @public + * @category Declarative Routers + * @mode declarative + * @param props Props + * @param props.basename The base URL for the static router (default: `/`) + * @param props.children The child elements to render inside the static router + * @param props.location The location to render the static router at (default: `/`) + * @returns A React element that renders the static router + */ +declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element; +interface StaticRouterProviderProps { + context: StaticHandlerContext; + router: Router$1; + hydrate?: boolean; + nonce?: string; +} +/** + * A Data Router that may not navigate to any other location. This is useful + * on the server where there is no stateful UI. + * + * @example + * export async function handleRequest(request: Request) { + * let { query, dataRoutes } = createStaticHandler(routes); + * let context = await query(request)); + * + * if (context instanceof Response) { + * return context; + * } + * + * let router = createStaticRouter(dataRoutes, context); + * return new Response( + * ReactDOMServer.renderToString(), + * { headers: { "Content-Type": "text/html" } } + * ); + * } + * + * @public + * @category Data Routers + * @mode data + * @param props Props + * @param props.context The {@link StaticHandlerContext} returned from `staticHandler.query()` + * @param props.router The static data router from {@link createStaticRouter} + * @param props.hydrate Whether to hydrate the router on the client (default `true`) + * @param props.nonce The [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce) + * to use for the hydration `` + ) + ); +} +function escapeScript(script) { + return script.replace(/ + * + * @name UNSAFE_useScrollRestoration + * @category Hooks + * @mode framework + * @mode data + * @param options Options + * @param options.getKey A function that returns a key to use for scroll restoration. + * This is useful for custom scroll restoration logic, such as using only the pathname + * so that subsequent navigations to prior paths will restore the scroll. Defaults + * to `location.key`. + * @param options.storageKey The key to use for storing scroll positions in + * `sessionStorage`. Defaults to `"react-router-scroll-positions"`. + * @returns {void} + */ +declare function useScrollRestoration({ getKey, storageKey, }?: { + getKey?: GetScrollRestorationKeyFunction; + storageKey?: string; +}): void; +/** + * Set up a callback to be fired on [Window's `beforeunload` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event). + * + * @public + * @category Hooks + * @param callback The callback to be called when the [`beforeunload` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) + * is fired. + * @param options Options + * @param options.capture If `true`, the event will be captured during the capture + * phase. Defaults to `false`. + * @returns {void} + */ +declare function useBeforeUnload(callback: (event: BeforeUnloadEvent) => any, options?: { + capture?: boolean; +}): void; +/** + * Wrapper around {@link useBlocker} to show a [`window.confirm`](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm) + * prompt to users instead of building a custom UI with {@link useBlocker}. + * + * The `unstable_` flag will not be removed because this technique has a lot of + * rough edges and behaves very differently (and incorrectly sometimes) across + * browsers if users click addition back/forward navigations while the + * confirmation is open. Use at your own risk. + * + * @example + * function ImportantForm() { + * let [value, setValue] = React.useState(""); + * + * // Block navigating elsewhere when data has been entered into the input + * unstable_usePrompt({ + * message: "Are you sure?", + * when: ({ currentLocation, nextLocation }) => + * value !== "" && + * currentLocation.pathname !== nextLocation.pathname, + * }); + * + * return ( + *
+ * + * + *
+ * ); + * } + * + * @name unstable_usePrompt + * @public + * @category Hooks + * @mode framework + * @mode data + * @param options Options + * @param options.message The message to show in the confirmation dialog. + * @param options.when A boolean or a function that returns a boolean indicating + * whether to block the navigation. If a function is provided, it will receive an + * object with `currentLocation` and `nextLocation` properties. + * @returns {void} + */ +declare function usePrompt({ when, message, }: { + when: boolean | BlockerFunction; + message: string; +}): void; +/** + * This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) + * to the specified location. This can be used to apply finer-grained styles to + * elements to further customize the view transition. This requires that view + * transitions have been enabled for the given navigation via {@link LinkProps.viewTransition} + * (or the `Form`, `submit`, or `navigate` call) + * + * @public + * @category Hooks + * @mode framework + * @mode data + * @param to The {@link To} location to check for an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API). + * @param options Options + * @param options.relative The relative routing type to use when resolving the + * `to` location, defaults to `"route"`. See {@link RelativeRoutingType} for more details. + * @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) + * to the specified {@link Location}, otherwise `false`. + */ +declare function useViewTransitionState(to: To, { relative }?: { + relative?: RelativeRoutingType; +}): boolean; + +interface StaticRouterProps { + basename?: string; + children?: React.ReactNode; + location: Partial | string; +} +/** + * A `` that may not navigate to any other location. This is useful + * on the server where there is no stateful UI. + * + * @public + * @category Declarative Routers + * @mode declarative + * @param props Props + * @param props.basename The base URL for the static router (default: `/`) + * @param props.children The child elements to render inside the static router + * @param props.location The location to render the static router at (default: `/`) + * @returns A React element that renders the static router + */ +declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element; +interface StaticRouterProviderProps { + context: StaticHandlerContext; + router: Router$1; + hydrate?: boolean; + nonce?: string; +} +/** + * A Data Router that may not navigate to any other location. This is useful + * on the server where there is no stateful UI. + * + * @example + * export async function handleRequest(request: Request) { + * let { query, dataRoutes } = createStaticHandler(routes); + * let context = await query(request)); + * + * if (context instanceof Response) { + * return context; + * } + * + * let router = createStaticRouter(dataRoutes, context); + * return new Response( + * ReactDOMServer.renderToString(), + * { headers: { "Content-Type": "text/html" } } + * ); + * } + * + * @public + * @category Data Routers + * @mode data + * @param props Props + * @param props.context The {@link StaticHandlerContext} returned from `staticHandler.query()` + * @param props.router The static data router from {@link createStaticRouter} + * @param props.hydrate Whether to hydrate the router on the client (default `true`) + * @param props.nonce The [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce) + * to use for the hydration `` + ) + ); +} +function escapeScript(script) { + return script.replace(/