@jupyterlite/xeus 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"coincident.worker.js","mappings":";qEAGAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAQE,qBAAkB,EAC1B,MAAMC,EAAc,EAAQ,KAiE5BH,EAAQE,gBA7DR,MAII,WAAAE,CAAYC,GACRC,KAAKC,QAAU,EACfD,KAAKE,UAAY,EACjBF,KAAKG,aAAc,EACnBH,KAAKI,iBAAmB,IAAIP,EAAYQ,OAAOL,MAC/CD,EAAQO,OAAOC,QAAQP,KAAKQ,eAAgBR,MAC5CA,KAAKE,SAAWH,EAAQU,SAAW,GACvC,CAIA,mBAAIC,GACA,OAAOV,KAAKI,gBAChB,CAIA,WAAIK,GACA,OAAOT,KAAKE,QAChB,CACA,WAAIO,CAAQd,GACRK,KAAKE,SAAWP,CACpB,CAOA,cAAIgB,GACA,OAAOX,KAAKG,WAChB,CAIA,OAAAS,GACQZ,KAAKG,cAGTH,KAAKG,aAAc,EACnBN,EAAYQ,OAAOQ,UAAUb,MACjC,CAIA,cAAAQ,CAAeM,EAAQC,GACnBC,aAAahB,KAAKC,QAClBD,KAAKiB,QAAUH,EACfd,KAAKkB,MAAQH,EACbf,KAAKC,OAASkB,YAAW,KACrBnB,KAAKI,iBAAiBgB,KAAK,CACvBN,OAAQd,KAAKiB,QACbF,KAAMf,KAAKkB,OACb,GACHlB,KAAKE,SACZ,qCC7DJ,IAAImB,EAAmBrB,MAAQA,KAAKqB,kBAAqB7B,OAAO8B,OAAS,SAAUC,EAAGC,EAAGC,EAAGC,QAC7EC,IAAPD,IAAkBA,EAAKD,GAC3B,IAAIG,EAAOpC,OAAOqC,yBAAyBL,EAAGC,GACzCG,KAAS,QAASA,GAAQJ,EAAEM,WAAaF,EAAKG,UAAYH,EAAKI,gBAClEJ,EAAO,CAAE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MF,GACRA,CAEd,CACAglB,EAAY,EAChB,CAKA,gBAAAqC,CAAiBhJ,GACb/kB,KAAKwsB,mBAAqBzH,CAC9B,ECpIJ,MAAMiJ,EAAY,EAAW1O,MAItB,MAAM2O,UAAgClF,EACzC,OAAAK,CAAQ/W,GACJ,OAAO2b,EAAUE,oBAAoB7b,EACzC,EAKJ,MAAM8b,UAAoBnD,EACtB,SAAAC,CAAUlrB,GACN,OAAO,IAAIkuB,EAAwBluB,EAAQipB,UAAWjpB,EAAQkpB,WAAYlpB,EAAQ8lB,GAAI9lB,EAAQinB,YAClG,EAEG,MAAMoH,UAA6B9B,EAItC,WAAMlB,CAAMpC,EAAWC,EAAY1gB,GAC/B,MAAM,GAAEsd,EAAE,KAAEgC,EAAI,YAAEb,GAAgB9F,WAAW4K,OAC7C,IAAKjG,EACD,OAEJ,MAAMwI,EAAQ,IAAIF,EAAY,CAC1BtI,KACAgC,OACAb,cACAze,UACAygB,YACAC,eAEJpD,EAAGyI,MAAMrF,GACTpD,EAAGuF,MAAMiD,EAAO,CAAC,EAAGpF,GACpBpD,EAAG6G,MAAMzD,EACb,EAEJ,MAAMsF,EAAS,IAAIH,EACnBJ,EAAUf,WAAasB,EAAOtB,WAAWuB,KAAKD,GAC9CP,EAAU5C,MAAQmD,EAAOnD,MAAMoD,KAAKD,GACpCP,EAAU3B,MAAQkC,EAAOlC,MAAMmC,KAAKD,GACpCP,EAAUvB,GAAK8B,EAAO9B,GAAG+B,KAAKD,GAC9BP,EAAU1C,MAAQiD,EAAOjD,MAAMkD,KAAKD,GACpCP,EAAUpB,eAAiB2B,EAAO3B,eAAe4B,KAAKD","sources":["webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/activitymonitor.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/index.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/interfaces.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/lru.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/markdowncodeblocks.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/pageconfig.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/path.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/signal.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/text.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/time.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/url.js","webpack://@jupyterlite/xeus/./node_modules/@lumino/coreutils/dist/index.js","webpack://@jupyterlite/xeus/./node_modules/@lumino/algorithm/dist/index.es6.js","webpack://@jupyterlite/xeus/./node_modules/@lumino/signaling/dist/index.es6.js","webpack://@jupyterlite/xeus/./node_modules/minimist/index.js","webpack://@jupyterlite/xeus/./node_modules/path-browserify/index.js","webpack://@jupyterlite/xeus/./node_modules/querystringify/index.js","webpack://@jupyterlite/xeus/./node_modules/requires-port/index.js","webpack://@jupyterlite/xeus/./node_modules/url-parse/index.js","webpack://@jupyterlite/xeus/webpack/bootstrap","webpack://@jupyterlite/xeus/webpack/runtime/define property getters","webpack://@jupyterlite/xeus/webpack/runtime/global","webpack://@jupyterlite/xeus/webpack/runtime/hasOwnProperty shorthand","webpack://@jupyterlite/xeus/webpack/runtime/make namespace object","webpack://@jupyterlite/xeus/./node_modules/proxy-target/esm/types.js","webpack://@jupyterlite/xeus/./node_modules/coincident/esm/channel.js","webpack://@jupyterlite/xeus/./node_modules/proxy-target/esm/traps.js","webpack://@jupyterlite/xeus/./node_modules/coincident/esm/bridge.js","webpack://@jupyterlite/xeus/./node_modules/coincident/esm/index.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlite/contents/lib/drivefs.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlite/contents/lib/emscripten.js","webpack://@jupyterlite/xeus/./lib/worker.js","webpack://@jupyterlite/xeus/./lib/coincident.worker.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ActivityMonitor = void 0;\nconst signaling_1 = require(\"@lumino/signaling\");\n/**\n * A class that monitors activity on a signal.\n */\nclass ActivityMonitor {\n /**\n * Construct a new activity monitor.\n */\n constructor(options) {\n this._timer = -1;\n this._timeout = -1;\n this._isDisposed = false;\n this._activityStopped = new signaling_1.Signal(this);\n options.signal.connect(this._onSignalFired, this);\n this._timeout = options.timeout || 1000;\n }\n /**\n * A signal emitted when activity has ceased.\n */\n get activityStopped() {\n return this._activityStopped;\n }\n /**\n * The timeout associated with the monitor, in milliseconds.\n */\n get timeout() {\n return this._timeout;\n }\n set timeout(value) {\n this._timeout = value;\n }\n /**\n * Test whether the monitor has been disposed.\n *\n * #### Notes\n * This is a read-only property.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources used by the activity monitor.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n signaling_1.Signal.clearData(this);\n }\n /**\n * A signal handler for the monitored signal.\n */\n _onSignalFired(sender, args) {\n clearTimeout(this._timer);\n this._sender = sender;\n this._args = args;\n this._timer = setTimeout(() => {\n this._activityStopped.emit({\n sender: this._sender,\n args: this._args\n });\n }, this._timeout);\n }\n}\nexports.ActivityMonitor = ActivityMonitor;\n//# sourceMappingURL=activitymonitor.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module coreutils\n */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./activitymonitor\"), exports);\n__exportStar(require(\"./interfaces\"), exports);\n__exportStar(require(\"./lru\"), exports);\n__exportStar(require(\"./markdowncodeblocks\"), exports);\n__exportStar(require(\"./pageconfig\"), exports);\n__exportStar(require(\"./path\"), exports);\n__exportStar(require(\"./signal\"), exports);\n__exportStar(require(\"./text\"), exports);\n__exportStar(require(\"./time\"), exports);\n__exportStar(require(\"./url\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=interfaces.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LruCache = void 0;\nconst DEFAULT_MAX_SIZE = 128;\n/** A least-recently-used cache. */\nclass LruCache {\n constructor(options = {}) {\n this._map = new Map();\n this._maxSize = (options === null || options === void 0 ? void 0 : options.maxSize) || DEFAULT_MAX_SIZE;\n }\n /**\n * Return the current size of the cache.\n */\n get size() {\n return this._map.size;\n }\n /**\n * Clear the values in the cache.\n */\n clear() {\n this._map.clear();\n }\n /**\n * Get a value (or null) from the cache, pushing the item to the front of the cache.\n */\n get(key) {\n const item = this._map.get(key) || null;\n if (item != null) {\n this._map.delete(key);\n this._map.set(key, item);\n }\n return item;\n }\n /**\n * Set a value in the cache, potentially evicting an old item.\n */\n set(key, value) {\n if (this._map.size >= this._maxSize) {\n this._map.delete(this._map.keys().next().value);\n }\n this._map.set(key, value);\n }\n}\nexports.LruCache = LruCache;\n//# sourceMappingURL=lru.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MarkdownCodeBlocks = void 0;\n/**\n * The namespace for code block functions which help\n * in extract code from markdown text\n */\nvar MarkdownCodeBlocks;\n(function (MarkdownCodeBlocks) {\n MarkdownCodeBlocks.CODE_BLOCK_MARKER = '```';\n const markdownExtensions = [\n '.markdown',\n '.mdown',\n '.mkdn',\n '.md',\n '.mkd',\n '.mdwn',\n '.mdtxt',\n '.mdtext',\n '.text',\n '.txt',\n '.Rmd'\n ];\n class MarkdownCodeBlock {\n constructor(startLine) {\n this.startLine = startLine;\n this.code = '';\n this.endLine = -1;\n }\n }\n MarkdownCodeBlocks.MarkdownCodeBlock = MarkdownCodeBlock;\n /**\n * Check whether the given file extension is a markdown extension\n * @param extension - A file extension\n *\n * @returns true/false depending on whether this is a supported markdown extension\n */\n function isMarkdown(extension) {\n return markdownExtensions.indexOf(extension) > -1;\n }\n MarkdownCodeBlocks.isMarkdown = isMarkdown;\n /**\n * Construct all code snippets from current text\n * (this could be potentially optimized if we can cache and detect differences)\n * @param text - A string to parse codeblocks from\n *\n * @returns An array of MarkdownCodeBlocks.\n */\n function findMarkdownCodeBlocks(text) {\n if (!text || text === '') {\n return [];\n }\n const lines = text.split('\\n');\n const codeBlocks = [];\n let currentBlock = null;\n for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {\n const line = lines[lineIndex];\n const lineContainsMarker = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER) === 0;\n const constructingBlock = currentBlock != null;\n // Skip this line if it is not part of any code block and doesn't contain a marker.\n if (!lineContainsMarker && !constructingBlock) {\n continue;\n }\n // Check if we are already constructing a code block.\n if (!constructingBlock) {\n // Start constructing a new code block.\n currentBlock = new MarkdownCodeBlock(lineIndex);\n // Check whether this is a single line code block of the form ```a = 10```.\n const firstIndex = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const lastIndex = line.lastIndexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const isSingleLine = firstIndex !== lastIndex;\n if (isSingleLine) {\n currentBlock.code = line.substring(firstIndex + MarkdownCodeBlocks.CODE_BLOCK_MARKER.length, lastIndex);\n currentBlock.endLine = lineIndex;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n }\n else if (currentBlock) {\n if (lineContainsMarker) {\n // End of block, finish it up.\n currentBlock.endLine = lineIndex - 1;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n else {\n // Append the current line.\n currentBlock.code += line + '\\n';\n }\n }\n }\n return codeBlocks;\n }\n MarkdownCodeBlocks.findMarkdownCodeBlocks = findMarkdownCodeBlocks;\n})(MarkdownCodeBlocks || (exports.MarkdownCodeBlocks = MarkdownCodeBlocks = {}));\n//# sourceMappingURL=markdowncodeblocks.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PageConfig = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\nconst minimist_1 = __importDefault(require(\"minimist\"));\nconst url_1 = require(\"./url\");\n/**\n * The namespace for `PageConfig` functions.\n */\nvar PageConfig;\n(function (PageConfig) {\n /**\n * Get global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n *\n * @returns The config value or an empty string if not found.\n *\n * #### Notes\n * All values are treated as strings.\n * For browser based applications, it is assumed that the page HTML\n * includes a script tag with the id `jupyter-config-data` containing the\n * configuration as valid JSON. In order to support the classic Notebook,\n * we fall back on checking for `body` data of the given `name`.\n *\n * For node applications, it is assumed that the process was launched\n * with a `--jupyter-config-data` option pointing to a JSON settings\n * file.\n */\n function getOption(name) {\n if (configData) {\n return configData[name] || getBodyData(name);\n }\n configData = Object.create(null);\n let found = false;\n // Use script tag if available.\n if (typeof document !== 'undefined' && document) {\n const el = document.getElementById('jupyter-config-data');\n if (el) {\n configData = JSON.parse(el.textContent || '');\n found = true;\n }\n }\n // Otherwise use CLI if given.\n if (!found && typeof process !== 'undefined' && process.argv) {\n try {\n const cli = (0, minimist_1.default)(process.argv.slice(2));\n const path = require('path');\n let fullPath = '';\n if ('jupyter-config-data' in cli) {\n fullPath = path.resolve(cli['jupyter-config-data']);\n }\n else if ('JUPYTER_CONFIG_DATA' in process.env) {\n fullPath = path.resolve(process.env['JUPYTER_CONFIG_DATA']);\n }\n if (fullPath) {\n // Force Webpack to ignore this require.\n // eslint-disable-next-line\n configData = eval('require')(fullPath);\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n if (!coreutils_1.JSONExt.isObject(configData)) {\n configData = Object.create(null);\n }\n else {\n for (const key in configData) {\n // PageConfig expects strings\n if (typeof configData[key] !== 'string') {\n configData[key] = JSON.stringify(configData[key]);\n }\n }\n }\n return configData[name] || getBodyData(name);\n }\n PageConfig.getOption = getOption;\n /**\n * Set global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n * @param value - The value to set the option to.\n *\n * @returns The last config value or an empty string if it doesn't exist.\n */\n function setOption(name, value) {\n const last = getOption(name);\n configData[name] = value;\n return last;\n }\n PageConfig.setOption = setOption;\n /**\n * Get the base url for a Jupyter application, or the base url of the page.\n */\n function getBaseUrl() {\n return url_1.URLExt.normalize(getOption('baseUrl') || '/');\n }\n PageConfig.getBaseUrl = getBaseUrl;\n /**\n * Get the tree url for a JupyterLab application.\n */\n function getTreeUrl() {\n return url_1.URLExt.join(getBaseUrl(), getOption('treeUrl'));\n }\n PageConfig.getTreeUrl = getTreeUrl;\n /**\n * Get the base url for sharing links (usually baseUrl)\n */\n function getShareUrl() {\n return url_1.URLExt.normalize(getOption('shareUrl') || getBaseUrl());\n }\n PageConfig.getShareUrl = getShareUrl;\n /**\n * Get the tree url for shareable links.\n * Usually the same as treeUrl,\n * but overrideable e.g. when sharing with JupyterHub.\n */\n function getTreeShareUrl() {\n return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(), getOption('treeUrl')));\n }\n PageConfig.getTreeShareUrl = getTreeShareUrl;\n /**\n * Create a new URL given an optional mode and tree path.\n *\n * This is used to create URLS when the mode or tree path change as the user\n * changes mode or the current document in the main area. If fields in\n * options are omitted, the value in PageConfig will be used.\n *\n * @param options - IGetUrlOptions for the new path.\n */\n function getUrl(options) {\n var _a, _b, _c, _d;\n let path = options.toShare ? getShareUrl() : getBaseUrl();\n const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : getOption('mode');\n const workspace = (_b = options.workspace) !== null && _b !== void 0 ? _b : getOption('workspace');\n const labOrDoc = mode === 'single-document' ? 'doc' : 'lab';\n path = url_1.URLExt.join(path, labOrDoc);\n if (workspace !== PageConfig.defaultWorkspace) {\n path = url_1.URLExt.join(path, 'workspaces', encodeURIComponent((_c = getOption('workspace')) !== null && _c !== void 0 ? _c : PageConfig.defaultWorkspace));\n }\n const treePath = (_d = options.treePath) !== null && _d !== void 0 ? _d : getOption('treePath');\n if (treePath) {\n path = url_1.URLExt.join(path, 'tree', url_1.URLExt.encodeParts(treePath));\n }\n return path;\n }\n PageConfig.getUrl = getUrl;\n PageConfig.defaultWorkspace = 'default';\n /**\n * Get the base websocket url for a Jupyter application, or an empty string.\n */\n function getWsUrl(baseUrl) {\n let wsUrl = getOption('wsUrl');\n if (!wsUrl) {\n baseUrl = baseUrl ? url_1.URLExt.normalize(baseUrl) : getBaseUrl();\n if (baseUrl.indexOf('http') !== 0) {\n return '';\n }\n wsUrl = 'ws' + baseUrl.slice(4);\n }\n return url_1.URLExt.normalize(wsUrl);\n }\n PageConfig.getWsUrl = getWsUrl;\n /**\n * Returns the URL converting this notebook to a certain\n * format with nbconvert.\n */\n function getNBConvertURL({ path, format, download }) {\n const notebookPath = url_1.URLExt.encodeParts(path);\n const url = url_1.URLExt.join(getBaseUrl(), 'nbconvert', format, notebookPath);\n if (download) {\n return url + '?download=true';\n }\n return url;\n }\n PageConfig.getNBConvertURL = getNBConvertURL;\n /**\n * Get the authorization token for a Jupyter application.\n */\n function getToken() {\n return getOption('token') || getBodyData('jupyterApiToken');\n }\n PageConfig.getToken = getToken;\n /**\n * Get the Notebook version info [major, minor, patch].\n */\n function getNotebookVersion() {\n const notebookVersion = getOption('notebookVersion');\n if (notebookVersion === '') {\n return [0, 0, 0];\n }\n return JSON.parse(notebookVersion);\n }\n PageConfig.getNotebookVersion = getNotebookVersion;\n /**\n * Private page config data for the Jupyter application.\n */\n let configData = null;\n /**\n * Get a url-encoded item from `body.data` and decode it\n * We should never have any encoded URLs anywhere else in code\n * until we are building an actual request.\n */\n function getBodyData(key) {\n if (typeof document === 'undefined' || !document.body) {\n return '';\n }\n const val = document.body.dataset[key];\n if (typeof val === 'undefined') {\n return '';\n }\n return decodeURIComponent(val);\n }\n /**\n * The namespace for page config `Extension` functions.\n */\n let Extension;\n (function (Extension) {\n /**\n * Populate an array from page config.\n *\n * @param key - The page config key (e.g., `deferredExtensions`).\n *\n * #### Notes\n * This is intended for `deferredExtensions` and `disabledExtensions`.\n */\n function populate(key) {\n try {\n const raw = getOption(key);\n if (raw) {\n return JSON.parse(raw);\n }\n }\n catch (error) {\n console.warn(`Unable to parse ${key}.`, error);\n }\n return [];\n }\n /**\n * The collection of deferred extensions in page config.\n */\n Extension.deferred = populate('deferredExtensions');\n /**\n * The collection of disabled extensions in page config.\n */\n Extension.disabled = populate('disabledExtensions');\n /**\n * Returns whether a plugin is deferred.\n *\n * @param id - The plugin ID.\n */\n function isDeferred(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.deferred.some(val => val === id || (extName && val === extName));\n }\n Extension.isDeferred = isDeferred;\n /**\n * Returns whether a plugin is disabled.\n *\n * @param id - The plugin ID.\n */\n function isDisabled(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.disabled.some(val => val === id || (extName && val === extName));\n }\n Extension.isDisabled = isDisabled;\n })(Extension = PageConfig.Extension || (PageConfig.Extension = {}));\n})(PageConfig || (exports.PageConfig = PageConfig = {}));\n//# sourceMappingURL=pageconfig.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PathExt = void 0;\nconst path_1 = require(\"path\");\n/**\n * The namespace for path-related functions.\n *\n * Note that Jupyter server paths do not start with a leading slash.\n */\nvar PathExt;\n(function (PathExt) {\n /**\n * Join all arguments together and normalize the resulting path.\n * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.\n *\n * @param paths - The string paths to join.\n */\n function join(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : removeSlash(path);\n }\n PathExt.join = join;\n /**\n * Join all arguments together and normalize the resulting path and preserve the leading slash.\n *\n * @param paths - The string paths to join.\n */\n function joinWithLeadingSlash(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : path;\n }\n PathExt.joinWithLeadingSlash = joinWithLeadingSlash;\n /**\n * Return the last portion of a path. Similar to the Unix basename command.\n * Often used to extract the file name from a fully qualified path.\n *\n * @param path - The path to evaluate.\n *\n * @param ext - An extension to remove from the result.\n */\n function basename(path, ext) {\n return path_1.posix.basename(path, ext);\n }\n PathExt.basename = basename;\n /**\n * Get the directory name of a path, similar to the Unix dirname command.\n * When an empty path is given, returns the root path.\n *\n * @param path - The file path.\n */\n function dirname(path) {\n const dir = removeSlash(path_1.posix.dirname(path));\n return dir === '.' ? '' : dir;\n }\n PathExt.dirname = dirname;\n /**\n * Get the extension of the path.\n *\n * @param path - The file path.\n *\n * @returns the extension of the file.\n *\n * #### Notes\n * The extension is the string from the last occurrence of the `.`\n * character to end of string in the last portion of the path, inclusive.\n * If there is no `.` in the last portion of the path, or if the first\n * character of the basename of path [[basename]] is `.`, then an\n * empty string is returned.\n */\n function extname(path) {\n return path_1.posix.extname(path);\n }\n PathExt.extname = extname;\n /**\n * Normalize a string path, reducing '..' and '.' parts.\n * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.\n * When an empty path is given, returns the root path.\n *\n * @param path - The string path to normalize.\n */\n function normalize(path) {\n if (path === '') {\n return '';\n }\n return removeSlash(path_1.posix.normalize(path));\n }\n PathExt.normalize = normalize;\n /**\n * Resolve a sequence of paths or path segments into an absolute path.\n * The root path in the application has no leading slash, so it is removed.\n *\n * @param parts - The paths to join.\n *\n * #### Notes\n * The right-most parameter is considered \\{to\\}. Other parameters are considered an array of \\{from\\}.\n *\n * Starting from leftmost \\{from\\} parameter, resolves \\{to\\} to an absolute path.\n *\n * If \\{to\\} isn't already absolute, \\{from\\} arguments are prepended in right to left order, until an absolute path is found. If after using all \\{from\\} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.\n */\n function resolve(...parts) {\n return removeSlash(path_1.posix.resolve(...parts));\n }\n PathExt.resolve = resolve;\n /**\n * Solve the relative path from \\{from\\} to \\{to\\}.\n *\n * @param from - The source path.\n *\n * @param to - The target path.\n *\n * #### Notes\n * If from and to each resolve to the same path (after calling\n * path.resolve() on each), a zero-length string is returned.\n * If a zero-length string is passed as from or to, `/`\n * will be used instead of the zero-length strings.\n */\n function relative(from, to) {\n return removeSlash(path_1.posix.relative(from, to));\n }\n PathExt.relative = relative;\n /**\n * Normalize a file extension to be of the type `'.foo'`.\n *\n * @param extension - the file extension.\n *\n * #### Notes\n * Adds a leading dot if not present and converts to lower case.\n */\n function normalizeExtension(extension) {\n if (extension.length > 0 && extension.indexOf('.') !== 0) {\n extension = `.${extension}`;\n }\n return extension;\n }\n PathExt.normalizeExtension = normalizeExtension;\n /**\n * Remove the leading slash from a path.\n *\n * @param path the path from which to remove a leading slash.\n */\n function removeSlash(path) {\n if (path.indexOf('/') === 0) {\n path = path.slice(1);\n }\n return path;\n }\n PathExt.removeSlash = removeSlash;\n})(PathExt || (exports.PathExt = PathExt = {}));\n//# sourceMappingURL=path.js.map","\"use strict\";\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signalToPromise = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\n/**\n * Convert a signal into a promise for the first emitted value.\n *\n * @param signal - The signal we are listening to.\n * @param timeout - Timeout to wait for signal in ms (not timeout if not defined or 0)\n *\n * @returns a Promise that resolves with a `(sender, args)` pair.\n */\nfunction signalToPromise(signal, timeout) {\n const waitForSignal = new coreutils_1.PromiseDelegate();\n function cleanup() {\n signal.disconnect(slot);\n }\n function slot(sender, args) {\n cleanup();\n waitForSignal.resolve([sender, args]);\n }\n signal.connect(slot);\n if ((timeout !== null && timeout !== void 0 ? timeout : 0) > 0) {\n setTimeout(() => {\n cleanup();\n waitForSignal.reject(`Signal not emitted within ${timeout} ms.`);\n }, timeout);\n }\n return waitForSignal.promise;\n}\nexports.signalToPromise = signalToPromise;\n//# sourceMappingURL=signal.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Text = void 0;\n/**\n * The namespace for text-related functions.\n */\nvar Text;\n(function (Text) {\n // javascript stores text as utf16 and string indices use \"code units\",\n // which stores high-codepoint characters as \"surrogate pairs\",\n // which occupy two indices in the javascript string.\n // We need to translate cursor_pos in the Jupyter protocol (in characters)\n // to js offset (with surrogate pairs taking two spots).\n const HAS_SURROGATES = '𝐚'.length > 1;\n /**\n * Convert a javascript string index into a unicode character offset\n *\n * @param jsIdx - The javascript string index (counting surrogate pairs)\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The unicode character offset\n */\n function jsIndexToCharIndex(jsIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return jsIdx;\n }\n let charIdx = jsIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n charIdx--;\n i++;\n }\n }\n }\n return charIdx;\n }\n Text.jsIndexToCharIndex = jsIndexToCharIndex;\n /**\n * Convert a unicode character offset to a javascript string index.\n *\n * @param charIdx - The index in unicode characters\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The js-native index\n */\n function charIndexToJsIndex(charIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return charIdx;\n }\n let jsIdx = charIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n jsIdx++;\n i++;\n }\n }\n }\n return jsIdx;\n }\n Text.charIndexToJsIndex = charIndexToJsIndex;\n /**\n * Given a 'snake-case', 'snake_case', 'snake:case', or\n * 'snake case' string, will return the camel case version: 'snakeCase'.\n *\n * @param str the snake-case input string.\n *\n * @param upper default = false. If true, the first letter of the\n * returned string will be capitalized.\n *\n * @returns the camel case version of the input string.\n */\n function camelCase(str, upper = false) {\n return str.replace(/^(\\w)|[\\s-_:]+(\\w)/g, function (match, p1, p2) {\n if (p2) {\n return p2.toUpperCase();\n }\n else {\n return upper ? p1.toUpperCase() : p1.toLowerCase();\n }\n });\n }\n Text.camelCase = camelCase;\n /**\n * Given a string, title case the words in the string.\n *\n * @param str the string to title case.\n *\n * @returns the same string, but with each word capitalized.\n */\n function titleCase(str) {\n return (str || '')\n .toLowerCase()\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n Text.titleCase = titleCase;\n})(Text || (exports.Text = Text = {}));\n//# sourceMappingURL=text.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Time = void 0;\n/**\n * A list of time units with their associated value in milliseconds.\n */\nconst UNITS = [\n { name: 'years', milliseconds: 365 * 24 * 60 * 60 * 1000 },\n { name: 'months', milliseconds: 30 * 24 * 60 * 60 * 1000 },\n { name: 'days', milliseconds: 24 * 60 * 60 * 1000 },\n { name: 'hours', milliseconds: 60 * 60 * 1000 },\n { name: 'minutes', milliseconds: 60 * 1000 },\n { name: 'seconds', milliseconds: 1000 }\n];\n/**\n * The namespace for date functions.\n */\nvar Time;\n(function (Time) {\n /**\n * Convert a timestring to a human readable string (e.g. 'two minutes ago').\n *\n * @param value - The date timestring or date object.\n *\n * @returns A formatted date.\n */\n function formatHuman(value, format = 'long') {\n const lang = document.documentElement.lang || 'en';\n const formatter = new Intl.RelativeTimeFormat(lang, {\n numeric: 'auto',\n style: format\n });\n const delta = new Date(value).getTime() - Date.now();\n for (let unit of UNITS) {\n const amount = Math.ceil(delta / unit.milliseconds);\n if (amount === 0) {\n continue;\n }\n return formatter.format(amount, unit.name);\n }\n return formatter.format(0, 'seconds');\n }\n Time.formatHuman = formatHuman;\n /**\n * Convenient helper to convert a timestring to a date format.\n *\n * @param value - The date timestring or date object.\n *\n * @returns A formatted date.\n */\n function format(value) {\n const lang = document.documentElement.lang || 'en';\n const formatter = new Intl.DateTimeFormat(lang, {\n dateStyle: 'short',\n timeStyle: 'short'\n });\n return formatter.format(new Date(value));\n }\n Time.format = format;\n})(Time || (exports.Time = Time = {}));\n//# sourceMappingURL=time.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.URLExt = void 0;\nconst path_1 = require(\"path\");\nconst url_parse_1 = __importDefault(require(\"url-parse\"));\n/**\n * The namespace for URL-related functions.\n */\nvar URLExt;\n(function (URLExt) {\n /**\n * Parse a url into a URL object.\n *\n * @param url - The URL string to parse.\n *\n * @returns A URL object.\n */\n function parse(url) {\n if (typeof document !== 'undefined' && document) {\n const a = document.createElement('a');\n a.href = url;\n return a;\n }\n return (0, url_parse_1.default)(url);\n }\n URLExt.parse = parse;\n /**\n * Parse URL and retrieve hostname\n *\n * @param url - The URL string to parse\n *\n * @returns a hostname string value\n */\n function getHostName(url) {\n return (0, url_parse_1.default)(url).hostname;\n }\n URLExt.getHostName = getHostName;\n function normalize(url) {\n return url && parse(url).toString();\n }\n URLExt.normalize = normalize;\n /**\n * Join a sequence of url components and normalizes as in node `path.join`.\n *\n * @param parts - The url components.\n *\n * @returns the joined url.\n */\n function join(...parts) {\n let u = (0, url_parse_1.default)(parts[0], {});\n // Schema-less URL can be only parsed as relative to a base URL\n // see https://github.com/unshiftio/url-parse/issues/219#issuecomment-1002219326\n const isSchemaLess = u.protocol === '' && u.slashes;\n if (isSchemaLess) {\n u = (0, url_parse_1.default)(parts[0], 'https:' + parts[0]);\n }\n const prefix = `${isSchemaLess ? '' : u.protocol}${u.slashes ? '//' : ''}${u.auth}${u.auth ? '@' : ''}${u.host}`;\n // If there was a prefix, then the first path must start at the root.\n const path = path_1.posix.join(`${!!prefix && u.pathname[0] !== '/' ? '/' : ''}${u.pathname}`, ...parts.slice(1));\n return `${prefix}${path === '.' ? '' : path}`;\n }\n URLExt.join = join;\n /**\n * Encode the components of a multi-segment url.\n *\n * @param url - The url to encode.\n *\n * @returns the encoded url.\n *\n * #### Notes\n * Preserves the `'/'` separators.\n * Should not include the base url, since all parts are escaped.\n */\n function encodeParts(url) {\n return join(...url.split('/').map(encodeURIComponent));\n }\n URLExt.encodeParts = encodeParts;\n /**\n * Return a serialized object string suitable for a query.\n *\n * @param value The source object.\n *\n * @returns an encoded url query.\n *\n * #### Notes\n * Modified version of [stackoverflow](http://stackoverflow.com/a/30707423).\n */\n function objectToQueryString(value) {\n const keys = Object.keys(value).filter(key => key.length > 0);\n if (!keys.length) {\n return '';\n }\n return ('?' +\n keys\n .map(key => {\n const content = encodeURIComponent(String(value[key]));\n return key + (content ? '=' + content : '');\n })\n .join('&'));\n }\n URLExt.objectToQueryString = objectToQueryString;\n /**\n * Return a parsed object that represents the values in a query string.\n */\n function queryStringToObject(value) {\n return value\n .replace(/^\\?/, '')\n .split('&')\n .reduce((acc, val) => {\n const [key, value] = val.split('=');\n if (key.length > 0) {\n acc[key] = decodeURIComponent(value || '');\n }\n return acc;\n }, {});\n }\n URLExt.queryStringToObject = queryStringToObject;\n /**\n * Test whether the url is a local url.\n *\n * @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted.\n *\n * #### Notes\n * This function returns `false` for any fully qualified url, including\n * `data:`, `file:`, and `//` protocol URLs.\n */\n function isLocal(url, allowRoot = false) {\n const { protocol } = parse(url);\n return ((!protocol || url.toLowerCase().indexOf(protocol) !== 0) &&\n (allowRoot ? url.indexOf('//') !== 0 : url.indexOf('/') !== 0));\n }\n URLExt.isLocal = isLocal;\n})(URLExt || (exports.URLExt = URLExt = {}));\n//# sourceMappingURL=url.js.map","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_coreutils = {}));\n})(this, (function (exports) { 'use strict';\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for JSON-specific functions.\n */\n exports.JSONExt = void 0;\n (function (JSONExt) {\n /**\n * A shared frozen empty JSONObject\n */\n JSONExt.emptyObject = Object.freeze({});\n /**\n * A shared frozen empty JSONArray\n */\n JSONExt.emptyArray = Object.freeze([]);\n /**\n * Test whether a JSON value is a primitive.\n *\n * @param value - The JSON value of interest.\n *\n * @returns `true` if the value is a primitive,`false` otherwise.\n */\n function isPrimitive(value) {\n return (value === null ||\n typeof value === 'boolean' ||\n typeof value === 'number' ||\n typeof value === 'string');\n }\n JSONExt.isPrimitive = isPrimitive;\n function isArray(value) {\n return Array.isArray(value);\n }\n JSONExt.isArray = isArray;\n function isObject(value) {\n return !isPrimitive(value) && !isArray(value);\n }\n JSONExt.isObject = isObject;\n /**\n * Compare two JSON values for deep equality.\n *\n * @param first - The first JSON value of interest.\n *\n * @param second - The second JSON value of interest.\n *\n * @returns `true` if the values are equivalent, `false` otherwise.\n */\n function deepEqual(first, second) {\n // Check referential and primitive equality first.\n if (first === second) {\n return true;\n }\n // If one is a primitive, the `===` check ruled out the other.\n if (isPrimitive(first) || isPrimitive(second)) {\n return false;\n }\n // Test whether they are arrays.\n let a1 = isArray(first);\n let a2 = isArray(second);\n // Bail if the types are different.\n if (a1 !== a2) {\n return false;\n }\n // If they are both arrays, compare them.\n if (a1 && a2) {\n return deepArrayEqual(first, second);\n }\n // At this point, they must both be objects.\n return deepObjectEqual(first, second);\n }\n JSONExt.deepEqual = deepEqual;\n /**\n * Create a deep copy of a JSON value.\n *\n * @param value - The JSON value to copy.\n *\n * @returns A deep copy of the given JSON value.\n */\n function deepCopy(value) {\n // Do nothing for primitive values.\n if (isPrimitive(value)) {\n return value;\n }\n // Deep copy an array.\n if (isArray(value)) {\n return deepArrayCopy(value);\n }\n // Deep copy an object.\n return deepObjectCopy(value);\n }\n JSONExt.deepCopy = deepCopy;\n /**\n * Compare two JSON arrays for deep equality.\n */\n function deepArrayEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Test the arrays for equal length.\n if (first.length !== second.length) {\n return false;\n }\n // Compare the values for equality.\n for (let i = 0, n = first.length; i < n; ++i) {\n if (!deepEqual(first[i], second[i])) {\n return false;\n }\n }\n // At this point, the arrays are equal.\n return true;\n }\n /**\n * Compare two JSON objects for deep equality.\n */\n function deepObjectEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Check for the first object's keys in the second object.\n for (let key in first) {\n if (first[key] !== undefined && !(key in second)) {\n return false;\n }\n }\n // Check for the second object's keys in the first object.\n for (let key in second) {\n if (second[key] !== undefined && !(key in first)) {\n return false;\n }\n }\n // Compare the values for equality.\n for (let key in first) {\n // Get the values.\n let firstValue = first[key];\n let secondValue = second[key];\n // If both are undefined, ignore the key.\n if (firstValue === undefined && secondValue === undefined) {\n continue;\n }\n // If only one value is undefined, the objects are not equal.\n if (firstValue === undefined || secondValue === undefined) {\n return false;\n }\n // Compare the values.\n if (!deepEqual(firstValue, secondValue)) {\n return false;\n }\n }\n // At this point, the objects are equal.\n return true;\n }\n /**\n * Create a deep copy of a JSON array.\n */\n function deepArrayCopy(value) {\n let result = new Array(value.length);\n for (let i = 0, n = value.length; i < n; ++i) {\n result[i] = deepCopy(value[i]);\n }\n return result;\n }\n /**\n * Create a deep copy of a JSON object.\n */\n function deepObjectCopy(value) {\n let result = {};\n for (let key in value) {\n // Ignore undefined values.\n let subvalue = value[key];\n if (subvalue === undefined) {\n continue;\n }\n result[key] = deepCopy(subvalue);\n }\n return result;\n }\n })(exports.JSONExt || (exports.JSONExt = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * An object which stores MIME data for general application use.\n *\n * #### Notes\n * This class does not attempt to enforce \"correctness\" of MIME types\n * and their associated data. Since this class is designed to transfer\n * arbitrary data and objects within the same application, it assumes\n * that the user provides correct and accurate data.\n */\n class MimeData {\n constructor() {\n this._types = [];\n this._values = [];\n }\n /**\n * Get an array of the MIME types contained within the dataset.\n *\n * @returns A new array of the MIME types, in order of insertion.\n */\n types() {\n return this._types.slice();\n }\n /**\n * Test whether the dataset has an entry for the given type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns `true` if the dataset contains a value for the given\n * MIME type, `false` otherwise.\n */\n hasData(mime) {\n return this._types.indexOf(mime) !== -1;\n }\n /**\n * Get the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns The value for the given MIME type, or `undefined` if\n * the dataset does not contain a value for the type.\n */\n getData(mime) {\n let i = this._types.indexOf(mime);\n return i !== -1 ? this._values[i] : undefined;\n }\n /**\n * Set the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @param data - The data value for the given MIME type.\n *\n * #### Notes\n * This will overwrite any previous entry for the MIME type.\n */\n setData(mime, data) {\n this.clearData(mime);\n this._types.push(mime);\n this._values.push(data);\n }\n /**\n * Remove the data entry for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * #### Notes\n * This is a no-op if there is no entry for the given MIME type.\n */\n clearData(mime) {\n let i = this._types.indexOf(mime);\n if (i !== -1) {\n this._types.splice(i, 1);\n this._values.splice(i, 1);\n }\n }\n /**\n * Remove all data entries from the dataset.\n */\n clear() {\n this._types.length = 0;\n this._values.length = 0;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A class which wraps a promise into a delegate object.\n *\n * #### Notes\n * This class is useful when the logic to resolve or reject a promise\n * cannot be defined at the point where the promise is created.\n */\n class PromiseDelegate {\n /**\n * Construct a new promise delegate.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n /**\n * Resolve the wrapped promise with the given value.\n *\n * @param value - The value to use for resolving the promise.\n */\n resolve(value) {\n let resolve = this._resolve;\n resolve(value);\n }\n /**\n * Reject the wrapped promise with the given value.\n *\n * @reason - The reason for rejecting the promise.\n */\n reject(reason) {\n let reject = this._reject;\n reject(reason);\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A runtime object which captures compile-time type information.\n *\n * #### Notes\n * A token captures the compile-time type of an interface or class in\n * an object which can be used at runtime in a type-safe fashion.\n */\n class Token {\n /**\n * Construct a new token.\n *\n * @param name - A human readable name for the token.\n * @param description - Token purpose description for documentation.\n */\n constructor(name, description) {\n this.name = name;\n this.description = description !== null && description !== void 0 ? description : '';\n this._tokenStructuralPropertyT = null;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n // Fallback\n function fallbackRandomValues(buffer) {\n let value = 0;\n for (let i = 0, n = buffer.length; i < n; ++i) {\n if (i % 4 === 0) {\n value = (Math.random() * 0xffffffff) >>> 0;\n }\n buffer[i] = value & 0xff;\n value >>>= 8;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for random number related functionality.\n */\n exports.Random = void 0;\n (function (Random) {\n /**\n * A function which generates random bytes.\n *\n * @param buffer - The `Uint8Array` to fill with random bytes.\n *\n * #### Notes\n * A cryptographically strong random number generator will be used if\n * available. Otherwise, `Math.random` will be used as a fallback for\n * randomness.\n *\n * The following RNGs are supported, listed in order of precedence:\n * - `window.crypto.getRandomValues`\n * - `window.msCrypto.getRandomValues`\n * - `require('crypto').randomFillSync\n * - `require('crypto').randomBytes\n * - `Math.random`\n */\n Random.getRandomValues = (() => {\n // Look up the crypto module if available.\n const crypto = (typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||\n null;\n // Modern browsers and IE 11\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return function getRandomValues(buffer) {\n return crypto.getRandomValues(buffer);\n };\n }\n // Fallback\n return fallbackRandomValues;\n })();\n })(exports.Random || (exports.Random = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A function which creates a function that generates UUID v4 identifiers.\n *\n * @returns A new function that creates a UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n function uuid4Factory(getRandomValues) {\n // Create a 16 byte array to hold the random values.\n const bytes = new Uint8Array(16);\n // Create a look up table from bytes to hex strings.\n const lut = new Array(256);\n // Pad the single character hex digits with a leading zero.\n for (let i = 0; i < 16; ++i) {\n lut[i] = '0' + i.toString(16);\n }\n // Populate the rest of the hex digits.\n for (let i = 16; i < 256; ++i) {\n lut[i] = i.toString(16);\n }\n // Return a function which generates the UUID.\n return function uuid4() {\n // Get a new batch of random values.\n getRandomValues(bytes);\n // Set the UUID version number to 4.\n bytes[6] = 0x40 | (bytes[6] & 0x0f);\n // Set the clock sequence bit to the RFC spec.\n bytes[8] = 0x80 | (bytes[8] & 0x3f);\n // Assemble the UUID string.\n return (lut[bytes[0]] +\n lut[bytes[1]] +\n lut[bytes[2]] +\n lut[bytes[3]] +\n '-' +\n lut[bytes[4]] +\n lut[bytes[5]] +\n '-' +\n lut[bytes[6]] +\n lut[bytes[7]] +\n '-' +\n lut[bytes[8]] +\n lut[bytes[9]] +\n '-' +\n lut[bytes[10]] +\n lut[bytes[11]] +\n lut[bytes[12]] +\n lut[bytes[13]] +\n lut[bytes[14]] +\n lut[bytes[15]]);\n };\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for UUID related functionality.\n */\n exports.UUID = void 0;\n (function (UUID) {\n /**\n * A function which generates UUID v4 identifiers.\n *\n * @returns A new UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n UUID.uuid4 = uuid4Factory(exports.Random.getRandomValues);\n })(exports.UUID || (exports.UUID = {}));\n\n exports.MimeData = MimeData;\n exports.PromiseDelegate = PromiseDelegate;\n exports.Token = Token;\n\n}));\n//# sourceMappingURL=index.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty<number>();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","import { find, ArrayExt } from '@lumino/algorithm';\nimport { PromiseDelegate } from '@lumino/coreutils';\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module signaling\n */\n/**\n * A concrete implementation of `ISignal`.\n *\n * #### Example\n * ```typescript\n * import { ISignal, Signal } from '@lumino/signaling';\n *\n * class SomeClass {\n *\n * constructor(name: string) {\n * this.name = name;\n * }\n *\n * readonly name: string;\n *\n * get valueChanged: ISignal<this, number> {\n * return this._valueChanged;\n * }\n *\n * get value(): number {\n * return this._value;\n * }\n *\n * set value(value: number) {\n * if (value === this._value) {\n * return;\n * }\n * this._value = value;\n * this._valueChanged.emit(value);\n * }\n *\n * private _value = 0;\n * private _valueChanged = new Signal<this, number>(this);\n * }\n *\n * function logger(sender: SomeClass, value: number): void {\n * console.log(sender.name, value);\n * }\n *\n * let m1 = new SomeClass('foo');\n * let m2 = new SomeClass('bar');\n *\n * m1.valueChanged.connect(logger);\n * m2.valueChanged.connect(logger);\n *\n * m1.value = 42; // logs: foo 42\n * m2.value = 17; // logs: bar 17\n * ```\n */\nclass Signal {\n /**\n * Construct a new signal.\n *\n * @param sender - The sender which owns the signal.\n */\n constructor(sender) {\n this.sender = sender;\n }\n /**\n * Connect a slot to the signal.\n *\n * @param slot - The slot to invoke when the signal is emitted.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection succeeds, `false` otherwise.\n */\n connect(slot, thisArg) {\n return Private.connect(this, slot, thisArg);\n }\n /**\n * Disconnect a slot from the signal.\n *\n * @param slot - The slot to disconnect from the signal.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection is removed, `false` otherwise.\n */\n disconnect(slot, thisArg) {\n return Private.disconnect(this, slot, thisArg);\n }\n /**\n * Emit the signal and invoke the connected slots.\n *\n * @param args - The args to pass to the connected slots.\n *\n * #### Notes\n * Slots are invoked synchronously in connection order.\n *\n * Exceptions thrown by connected slots will be caught and logged.\n */\n emit(args) {\n Private.emit(this, args);\n }\n}\n/**\n * The namespace for the `Signal` class statics.\n */\n(function (Signal) {\n /**\n * Remove all connections between a sender and receiver.\n *\n * @param sender - The sender object of interest.\n *\n * @param receiver - The receiver object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectBetween(sender, receiver) {\n Private.disconnectBetween(sender, receiver);\n }\n Signal.disconnectBetween = disconnectBetween;\n /**\n * Remove all connections where the given object is the sender.\n *\n * @param sender - The sender object of interest.\n */\n function disconnectSender(sender) {\n Private.disconnectSender(sender);\n }\n Signal.disconnectSender = disconnectSender;\n /**\n * Remove all connections where the given object is the receiver.\n *\n * @param receiver - The receiver object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectReceiver(receiver) {\n Private.disconnectReceiver(receiver);\n }\n Signal.disconnectReceiver = disconnectReceiver;\n /**\n * Remove all connections where an object is the sender or receiver.\n *\n * @param object - The object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectAll(object) {\n Private.disconnectAll(object);\n }\n Signal.disconnectAll = disconnectAll;\n /**\n * Clear all signal data associated with the given object.\n *\n * @param object - The object for which the data should be cleared.\n *\n * #### Notes\n * This removes all signal connections and any other signal data\n * associated with the object.\n */\n function clearData(object) {\n Private.disconnectAll(object);\n }\n Signal.clearData = clearData;\n /**\n * Get the signal exception handler.\n *\n * @returns The current exception handler.\n *\n * #### Notes\n * The default exception handler is `console.error`.\n */\n function getExceptionHandler() {\n return Private.exceptionHandler;\n }\n Signal.getExceptionHandler = getExceptionHandler;\n /**\n * Set the signal exception handler.\n *\n * @param handler - The function to use as the exception handler.\n *\n * @returns The old exception handler.\n *\n * #### Notes\n * The exception handler is invoked when a slot throws an exception.\n */\n function setExceptionHandler(handler) {\n let old = Private.exceptionHandler;\n Private.exceptionHandler = handler;\n return old;\n }\n Signal.setExceptionHandler = setExceptionHandler;\n})(Signal || (Signal = {}));\n/**\n * A concrete implementation of `IStream`.\n *\n * #### Example\n * ```typescript\n * import { IStream, Stream } from '@lumino/signaling';\n *\n * class SomeClass {\n *\n * constructor(name: string) {\n * this.name = name;\n * }\n *\n * readonly name: string;\n *\n * get pings(): IStream<this, string> {\n * return this._pings;\n * }\n *\n * ping(value: string) {\n * this._pings.emit(value);\n * }\n *\n * private _pings = new Stream<this, string>(this);\n * }\n *\n * let m1 = new SomeClass('foo');\n *\n * m1.pings.connect((_, value: string) => {\n * console.log('connect', value);\n * });\n *\n * void (async () => {\n * for await (const ping of m1.pings) {\n * console.log('iterator', ping);\n * }\n * })();\n *\n * m1.ping('alpha'); // logs: connect alpha\n * // logs: iterator alpha\n * m1.ping('beta'); // logs: connect beta\n * // logs: iterator beta\n * ```\n */\nclass Stream extends Signal {\n constructor() {\n super(...arguments);\n this._pending = new PromiseDelegate();\n }\n /**\n * Return an async iterator that yields every emission.\n */\n async *[Symbol.asyncIterator]() {\n let pending = this._pending;\n while (true) {\n try {\n const { args, next } = await pending.promise;\n pending = next;\n yield args;\n }\n catch (_) {\n return; // Any promise rejection stops the iterator.\n }\n }\n }\n /**\n * Emit the signal, invoke the connected slots, and yield the emission.\n *\n * @param args - The args to pass to the connected slots.\n */\n emit(args) {\n const pending = this._pending;\n const next = (this._pending = new PromiseDelegate());\n pending.resolve({ args, next });\n super.emit(args);\n }\n /**\n * Stop the stream's async iteration.\n */\n stop() {\n this._pending.promise.catch(() => undefined);\n this._pending.reject('stop');\n this._pending = new PromiseDelegate();\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The signal exception handler function.\n */\n Private.exceptionHandler = (err) => {\n console.error(err);\n };\n /**\n * Connect a slot to a signal.\n *\n * @param signal - The signal of interest.\n *\n * @param slot - The slot to invoke when the signal is emitted.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection succeeds, `false` otherwise.\n */\n function connect(signal, slot, thisArg) {\n // Coerce a `null` `thisArg` to `undefined`.\n thisArg = thisArg || undefined;\n // Ensure the sender's array of receivers is created.\n let receivers = receiversForSender.get(signal.sender);\n if (!receivers) {\n receivers = [];\n receiversForSender.set(signal.sender, receivers);\n }\n // Bail if a matching connection already exists.\n if (findConnection(receivers, signal, slot, thisArg)) {\n return false;\n }\n // Choose the best object for the receiver.\n let receiver = thisArg || slot;\n // Ensure the receiver's array of senders is created.\n let senders = sendersForReceiver.get(receiver);\n if (!senders) {\n senders = [];\n sendersForReceiver.set(receiver, senders);\n }\n // Create a new connection and add it to the end of each array.\n let connection = { signal, slot, thisArg };\n receivers.push(connection);\n senders.push(connection);\n // Indicate a successful connection.\n return true;\n }\n Private.connect = connect;\n /**\n * Disconnect a slot from a signal.\n *\n * @param signal - The signal of interest.\n *\n * @param slot - The slot to disconnect from the signal.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection is removed, `false` otherwise.\n */\n function disconnect(signal, slot, thisArg) {\n // Coerce a `null` `thisArg` to `undefined`.\n thisArg = thisArg || undefined;\n // Lookup the list of receivers, and bail if none exist.\n let receivers = receiversForSender.get(signal.sender);\n if (!receivers || receivers.length === 0) {\n return false;\n }\n // Bail if no matching connection exits.\n let connection = findConnection(receivers, signal, slot, thisArg);\n if (!connection) {\n return false;\n }\n // Choose the best object for the receiver.\n let receiver = thisArg || slot;\n // Lookup the array of senders, which is now known to exist.\n let senders = sendersForReceiver.get(receiver);\n // Clear the connection and schedule cleanup of the arrays.\n connection.signal = null;\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n // Indicate a successful disconnection.\n return true;\n }\n Private.disconnect = disconnect;\n /**\n * Remove all connections between a sender and receiver.\n *\n * @param sender - The sender object of interest.\n *\n * @param receiver - The receiver object of interest.\n */\n function disconnectBetween(sender, receiver) {\n // If there are no receivers, there is nothing to do.\n let receivers = receiversForSender.get(sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // If there are no senders, there is nothing to do.\n let senders = sendersForReceiver.get(receiver);\n if (!senders || senders.length === 0) {\n return;\n }\n // Clear each connection between the sender and receiver.\n for (const connection of senders) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n continue;\n }\n // Clear the connection if it matches the sender.\n if (connection.signal.sender === sender) {\n connection.signal = null;\n }\n }\n // Schedule a cleanup of the senders and receivers.\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n }\n Private.disconnectBetween = disconnectBetween;\n /**\n * Remove all connections where the given object is the sender.\n *\n * @param sender - The sender object of interest.\n */\n function disconnectSender(sender) {\n // If there are no receivers, there is nothing to do.\n let receivers = receiversForSender.get(sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // Clear each receiver connection.\n for (const connection of receivers) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n continue;\n }\n // Choose the best object for the receiver.\n let receiver = connection.thisArg || connection.slot;\n // Clear the connection.\n connection.signal = null;\n // Cleanup the array of senders, which is now known to exist.\n scheduleCleanup(sendersForReceiver.get(receiver));\n }\n // Schedule a cleanup of the receivers.\n scheduleCleanup(receivers);\n }\n Private.disconnectSender = disconnectSender;\n /**\n * Remove all connections where the given object is the receiver.\n *\n * @param receiver - The receiver object of interest.\n */\n function disconnectReceiver(receiver) {\n // If there are no senders, there is nothing to do.\n let senders = sendersForReceiver.get(receiver);\n if (!senders || senders.length === 0) {\n return;\n }\n // Clear each sender connection.\n for (const connection of senders) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n continue;\n }\n // Lookup the sender for the connection.\n let sender = connection.signal.sender;\n // Clear the connection.\n connection.signal = null;\n // Cleanup the array of receivers, which is now known to exist.\n scheduleCleanup(receiversForSender.get(sender));\n }\n // Schedule a cleanup of the list of senders.\n scheduleCleanup(senders);\n }\n Private.disconnectReceiver = disconnectReceiver;\n /**\n * Remove all connections where an object is the sender or receiver.\n *\n * @param object - The object of interest.\n */\n function disconnectAll(object) {\n // Remove all connections where the given object is the sender.\n disconnectSender(object);\n // Remove all connections where the given object is the receiver.\n disconnectReceiver(object);\n }\n Private.disconnectAll = disconnectAll;\n /**\n * Emit a signal and invoke its connected slots.\n *\n * @param signal - The signal of interest.\n *\n * @param args - The args to pass to the connected slots.\n *\n * #### Notes\n * Slots are invoked synchronously in connection order.\n *\n * Exceptions thrown by connected slots will be caught and logged.\n */\n function emit(signal, args) {\n // If there are no receivers, there is nothing to do.\n let receivers = receiversForSender.get(signal.sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // Invoke the slots for connections with a matching signal.\n // Any connections added during emission are not invoked.\n for (let i = 0, n = receivers.length; i < n; ++i) {\n let connection = receivers[i];\n if (connection.signal === signal) {\n invokeSlot(connection, args);\n }\n }\n }\n Private.emit = emit;\n /**\n * A weak mapping of sender to array of receiver connections.\n */\n const receiversForSender = new WeakMap();\n /**\n * A weak mapping of receiver to array of sender connections.\n */\n const sendersForReceiver = new WeakMap();\n /**\n * A set of connection arrays which are pending cleanup.\n */\n const dirtySet = new Set();\n /**\n * A function to schedule an event loop callback.\n */\n const schedule = (() => {\n let ok = typeof requestAnimationFrame === 'function';\n return ok ? requestAnimationFrame : setImmediate;\n })();\n /**\n * Find a connection which matches the given parameters.\n */\n function findConnection(connections, signal, slot, thisArg) {\n return find(connections, connection => connection.signal === signal &&\n connection.slot === slot &&\n connection.thisArg === thisArg);\n }\n /**\n * Invoke a slot with the given parameters.\n *\n * The connection is assumed to be valid.\n *\n * Exceptions in the slot will be caught and logged.\n */\n function invokeSlot(connection, args) {\n let { signal, slot, thisArg } = connection;\n try {\n slot.call(thisArg, signal.sender, args);\n }\n catch (err) {\n Private.exceptionHandler(err);\n }\n }\n /**\n * Schedule a cleanup of a connection array.\n *\n * This will add the array to the dirty set and schedule a deferred\n * cleanup of the array contents. On cleanup, any connection with a\n * `null` signal will be removed from the array.\n */\n function scheduleCleanup(array) {\n if (dirtySet.size === 0) {\n schedule(cleanupDirtySet);\n }\n dirtySet.add(array);\n }\n /**\n * Cleanup the connection lists in the dirty set.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupDirtySet() {\n dirtySet.forEach(cleanupConnections);\n dirtySet.clear();\n }\n /**\n * Cleanup the dirty connections in a connections array.\n *\n * This will remove any connection with a `null` signal.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupConnections(connections) {\n ArrayExt.removeAllWhere(connections, isDeadConnection);\n }\n /**\n * Test whether a connection is dead.\n *\n * A dead connection has a `null` signal.\n */\n function isDeadConnection(connection) {\n return connection.signal === null;\n }\n})(Private || (Private = {}));\n\nexport { Signal, Stream };\n//# sourceMappingURL=index.es6.js.map\n","'use strict';\n\nfunction hasKey(obj, keys) {\n\tvar o = obj;\n\tkeys.slice(0, -1).forEach(function (key) {\n\t\to = o[key] || {};\n\t});\n\n\tvar key = keys[keys.length - 1];\n\treturn key in o;\n}\n\nfunction isNumber(x) {\n\tif (typeof x === 'number') { return true; }\n\tif ((/^0x[0-9a-f]+$/i).test(x)) { return true; }\n\treturn (/^[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(e[-+]?\\d+)?$/).test(x);\n}\n\nfunction isConstructorOrProto(obj, key) {\n\treturn (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';\n}\n\nmodule.exports = function (args, opts) {\n\tif (!opts) { opts = {}; }\n\n\tvar flags = {\n\t\tbools: {},\n\t\tstrings: {},\n\t\tunknownFn: null,\n\t};\n\n\tif (typeof opts.unknown === 'function') {\n\t\tflags.unknownFn = opts.unknown;\n\t}\n\n\tif (typeof opts.boolean === 'boolean' && opts.boolean) {\n\t\tflags.allBools = true;\n\t} else {\n\t\t[].concat(opts.boolean).filter(Boolean).forEach(function (key) {\n\t\t\tflags.bools[key] = true;\n\t\t});\n\t}\n\n\tvar aliases = {};\n\n\tfunction aliasIsBoolean(key) {\n\t\treturn aliases[key].some(function (x) {\n\t\t\treturn flags.bools[x];\n\t\t});\n\t}\n\n\tObject.keys(opts.alias || {}).forEach(function (key) {\n\t\taliases[key] = [].concat(opts.alias[key]);\n\t\taliases[key].forEach(function (x) {\n\t\t\taliases[x] = [key].concat(aliases[key].filter(function (y) {\n\t\t\t\treturn x !== y;\n\t\t\t}));\n\t\t});\n\t});\n\n\t[].concat(opts.string).filter(Boolean).forEach(function (key) {\n\t\tflags.strings[key] = true;\n\t\tif (aliases[key]) {\n\t\t\t[].concat(aliases[key]).forEach(function (k) {\n\t\t\t\tflags.strings[k] = true;\n\t\t\t});\n\t\t}\n\t});\n\n\tvar defaults = opts.default || {};\n\n\tvar argv = { _: [] };\n\n\tfunction argDefined(key, arg) {\n\t\treturn (flags.allBools && (/^--[^=]+$/).test(arg))\n\t\t\t|| flags.strings[key]\n\t\t\t|| flags.bools[key]\n\t\t\t|| aliases[key];\n\t}\n\n\tfunction setKey(obj, keys, value) {\n\t\tvar o = obj;\n\t\tfor (var i = 0; i < keys.length - 1; i++) {\n\t\t\tvar key = keys[i];\n\t\t\tif (isConstructorOrProto(o, key)) { return; }\n\t\t\tif (o[key] === undefined) { o[key] = {}; }\n\t\t\tif (\n\t\t\t\to[key] === Object.prototype\n\t\t\t\t|| o[key] === Number.prototype\n\t\t\t\t|| o[key] === String.prototype\n\t\t\t) {\n\t\t\t\to[key] = {};\n\t\t\t}\n\t\t\tif (o[key] === Array.prototype) { o[key] = []; }\n\t\t\to = o[key];\n\t\t}\n\n\t\tvar lastKey = keys[keys.length - 1];\n\t\tif (isConstructorOrProto(o, lastKey)) { return; }\n\t\tif (\n\t\t\to === Object.prototype\n\t\t\t|| o === Number.prototype\n\t\t\t|| o === String.prototype\n\t\t) {\n\t\t\to = {};\n\t\t}\n\t\tif (o === Array.prototype) { o = []; }\n\t\tif (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {\n\t\t\to[lastKey] = value;\n\t\t} else if (Array.isArray(o[lastKey])) {\n\t\t\to[lastKey].push(value);\n\t\t} else {\n\t\t\to[lastKey] = [o[lastKey], value];\n\t\t}\n\t}\n\n\tfunction setArg(key, val, arg) {\n\t\tif (arg && flags.unknownFn && !argDefined(key, arg)) {\n\t\t\tif (flags.unknownFn(arg) === false) { return; }\n\t\t}\n\n\t\tvar value = !flags.strings[key] && isNumber(val)\n\t\t\t? Number(val)\n\t\t\t: val;\n\t\tsetKey(argv, key.split('.'), value);\n\n\t\t(aliases[key] || []).forEach(function (x) {\n\t\t\tsetKey(argv, x.split('.'), value);\n\t\t});\n\t}\n\n\tObject.keys(flags.bools).forEach(function (key) {\n\t\tsetArg(key, defaults[key] === undefined ? false : defaults[key]);\n\t});\n\n\tvar notFlags = [];\n\n\tif (args.indexOf('--') !== -1) {\n\t\tnotFlags = args.slice(args.indexOf('--') + 1);\n\t\targs = args.slice(0, args.indexOf('--'));\n\t}\n\n\tfor (var i = 0; i < args.length; i++) {\n\t\tvar arg = args[i];\n\t\tvar key;\n\t\tvar next;\n\n\t\tif ((/^--.+=/).test(arg)) {\n\t\t\t// Using [\\s\\S] instead of . because js doesn't support the\n\t\t\t// 'dotall' regex modifier. See:\n\t\t\t// http://stackoverflow.com/a/1068308/13216\n\t\t\tvar m = arg.match(/^--([^=]+)=([\\s\\S]*)$/);\n\t\t\tkey = m[1];\n\t\t\tvar value = m[2];\n\t\t\tif (flags.bools[key]) {\n\t\t\t\tvalue = value !== 'false';\n\t\t\t}\n\t\t\tsetArg(key, value, arg);\n\t\t} else if ((/^--no-.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--no-(.+)/)[1];\n\t\t\tsetArg(key, false, arg);\n\t\t} else if ((/^--.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--(.+)/)[1];\n\t\t\tnext = args[i + 1];\n\t\t\tif (\n\t\t\t\tnext !== undefined\n\t\t\t\t&& !(/^(-|--)[^-]/).test(next)\n\t\t\t\t&& !flags.bools[key]\n\t\t\t\t&& !flags.allBools\n\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t) {\n\t\t\t\tsetArg(key, next, arg);\n\t\t\t\ti += 1;\n\t\t\t} else if ((/^(true|false)$/).test(next)) {\n\t\t\t\tsetArg(key, next === 'true', arg);\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t}\n\t\t} else if ((/^-[^-]+/).test(arg)) {\n\t\t\tvar letters = arg.slice(1, -1).split('');\n\n\t\t\tvar broken = false;\n\t\t\tfor (var j = 0; j < letters.length; j++) {\n\t\t\t\tnext = arg.slice(j + 2);\n\n\t\t\t\tif (next === '-') {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {\n\t\t\t\t\tsetArg(letters[j], next.slice(1), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(/[A-Za-z]/).test(letters[j])\n\t\t\t\t\t&& (/-?\\d+(\\.\\d*)?(e-?\\d+)?$/).test(next)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (letters[j + 1] && letters[j + 1].match(/\\W/)) {\n\t\t\t\t\tsetArg(letters[j], arg.slice(j + 2), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkey = arg.slice(-1)[0];\n\t\t\tif (!broken && key !== '-') {\n\t\t\t\tif (\n\t\t\t\t\targs[i + 1]\n\t\t\t\t\t&& !(/^(-|--)[^-]/).test(args[i + 1])\n\t\t\t\t\t&& !flags.bools[key]\n\t\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(key, args[i + 1], arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {\n\t\t\t\t\tsetArg(key, args[i + 1] === 'true', arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (!flags.unknownFn || flags.unknownFn(arg) !== false) {\n\t\t\t\targv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));\n\t\t\t}\n\t\t\tif (opts.stopEarly) {\n\t\t\t\targv._.push.apply(argv._, args.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tObject.keys(defaults).forEach(function (k) {\n\t\tif (!hasKey(argv, k.split('.'))) {\n\t\t\tsetKey(argv, k.split('.'), defaults[k]);\n\n\t\t\t(aliases[k] || []).forEach(function (x) {\n\t\t\t\tsetKey(argv, x.split('.'), defaults[k]);\n\t\t\t});\n\t\t}\n\t});\n\n\tif (opts['--']) {\n\t\targv['--'] = notFlags.slice();\n\t} else {\n\t\tnotFlags.forEach(function (k) {\n\t\t\targv._.push(k);\n\t\t});\n\t}\n\n\treturn argv;\n};\n","// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , undef;\n\n/**\n * Decode a URI encoded string.\n *\n * @param {String} input The URI encoded string.\n * @returns {String|Null} The decoded string.\n * @api private\n */\nfunction decode(input) {\n try {\n return decodeURIComponent(input.replace(/\\+/g, ' '));\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Attempts to encode a given input.\n *\n * @param {String} input The string that needs to be encoded.\n * @returns {String|Null} The encoded string.\n * @api private\n */\nfunction encode(input) {\n try {\n return encodeURIComponent(input);\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Simple query string parser.\n *\n * @param {String} query The query string that needs to be parsed.\n * @returns {Object}\n * @api public\n */\nfunction querystring(query) {\n var parser = /([^=?#&]+)=?([^&]*)/g\n , result = {}\n , part;\n\n while (part = parser.exec(query)) {\n var key = decode(part[1])\n , value = decode(part[2]);\n\n //\n // Prevent overriding of existing properties. This ensures that build-in\n // methods like `toString` or __proto__ are not overriden by malicious\n // querystrings.\n //\n // In the case if failed decoding, we want to omit the key/value pairs\n // from the result.\n //\n if (key === null || value === null || key in result) continue;\n result[key] = value;\n }\n\n return result;\n}\n\n/**\n * Transform a query string to an object.\n *\n * @param {Object} obj Object that should be transformed.\n * @param {String} prefix Optional prefix.\n * @returns {String}\n * @api public\n */\nfunction querystringify(obj, prefix) {\n prefix = prefix || '';\n\n var pairs = []\n , value\n , key;\n\n //\n // Optionally prefix with a '?' if needed\n //\n if ('string' !== typeof prefix) prefix = '?';\n\n for (key in obj) {\n if (has.call(obj, key)) {\n value = obj[key];\n\n //\n // Edge cases where we actually want to encode the value to an empty\n // string instead of the stringified value.\n //\n if (!value && (value === null || value === undef || isNaN(value))) {\n value = '';\n }\n\n key = encode(key);\n value = encode(value);\n\n //\n // If we failed to encode the strings, we should bail out as we don't\n // want to add invalid strings to the query.\n //\n if (key === null || value === null) continue;\n pairs.push(key +'='+ value);\n }\n }\n\n return pairs.length ? prefix + pairs.join('&') : '';\n}\n\n//\n// Expose the module.\n//\nexports.stringify = querystringify;\nexports.parse = querystring;\n","'use strict';\n\n/**\n * Check if we're required to add a port number.\n *\n * @see https://url.spec.whatwg.org/#default-port\n * @param {Number|String} port Port number we need to check\n * @param {String} protocol Protocol we need to check against.\n * @returns {Boolean} Is it a default port for the given protocol\n * @api private\n */\nmodule.exports = function required(port, protocol) {\n protocol = protocol.split(':')[0];\n port = +port;\n\n if (!port) return false;\n\n switch (protocol) {\n case 'http':\n case 'ws':\n return port !== 80;\n\n case 'https':\n case 'wss':\n return port !== 443;\n\n case 'ftp':\n return port !== 21;\n\n case 'gopher':\n return port !== 70;\n\n case 'file':\n return false;\n }\n\n return port !== 0;\n};\n","'use strict';\n\nvar required = require('requires-port')\n , qs = require('querystringify')\n , controlOrWhitespace = /^[\\x00-\\x20\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/\n , CRHTLF = /[\\n\\r\\t]/g\n , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//\n , port = /:\\d+$/\n , protocolre = /^([a-z][a-z0-9.+-]*:)?(\\/\\/)?([\\\\/]+)?([\\S\\s]*)/i\n , windowsDriveLetter = /^[a-zA-Z]:/;\n\n/**\n * Remove control characters and whitespace from the beginning of a string.\n *\n * @param {Object|String} str String to trim.\n * @returns {String} A new string representing `str` stripped of control\n * characters and whitespace from its beginning.\n * @public\n */\nfunction trimLeft(str) {\n return (str ? str : '').toString().replace(controlOrWhitespace, '');\n}\n\n/**\n * These are the parse rules for the URL parser, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar rules = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n function sanitize(address, url) { // Sanitize what is left of the address\n return isSpecial(url.protocol) ? address.replace(/\\\\/g, '/') : address;\n },\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/:(\\d*)$/, 'port', undefined, 1], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n/**\n * These properties should not be copied or inherited from. This is only needed\n * for all non blob URL's as a blob URL does not include a hash, only the\n * origin.\n *\n * @type {Object}\n * @private\n */\nvar ignore = { hash: 1, query: 1 };\n\n/**\n * The location object differs when your code is loaded through a normal page,\n * Worker or through a worker using a blob. And with the blobble begins the\n * trouble as the location object will contain the URL of the blob, not the\n * location of the page where our code is loaded in. The actual origin is\n * encoded in the `pathname` so we can thankfully generate a good \"default\"\n * location from it so we can generate proper relative URL's again.\n *\n * @param {Object|String} loc Optional default location object.\n * @returns {Object} lolcation object.\n * @public\n */\nfunction lolcation(loc) {\n var globalVar;\n\n if (typeof window !== 'undefined') globalVar = window;\n else if (typeof global !== 'undefined') globalVar = global;\n else if (typeof self !== 'undefined') globalVar = self;\n else globalVar = {};\n\n var location = globalVar.location || {};\n loc = loc || location;\n\n var finaldestination = {}\n , type = typeof loc\n , key;\n\n if ('blob:' === loc.protocol) {\n finaldestination = new Url(unescape(loc.pathname), {});\n } else if ('string' === type) {\n finaldestination = new Url(loc, {});\n for (key in ignore) delete finaldestination[key];\n } else if ('object' === type) {\n for (key in loc) {\n if (key in ignore) continue;\n finaldestination[key] = loc[key];\n }\n\n if (finaldestination.slashes === undefined) {\n finaldestination.slashes = slashes.test(loc.href);\n }\n }\n\n return finaldestination;\n}\n\n/**\n * Check whether a protocol scheme is special.\n *\n * @param {String} The protocol scheme of the URL\n * @return {Boolean} `true` if the protocol scheme is special, else `false`\n * @private\n */\nfunction isSpecial(scheme) {\n return (\n scheme === 'file:' ||\n scheme === 'ftp:' ||\n scheme === 'http:' ||\n scheme === 'https:' ||\n scheme === 'ws:' ||\n scheme === 'wss:'\n );\n}\n\n/**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase.\n * @property {Boolean} slashes `true` if protocol is followed by \"//\", else `false`.\n * @property {String} rest Rest of the URL that is not part of the protocol.\n */\n\n/**\n * Extract protocol information from a URL with/without double slash (\"//\").\n *\n * @param {String} address URL we want to extract from.\n * @param {Object} location\n * @return {ProtocolExtract} Extracted information.\n * @private\n */\nfunction extractProtocol(address, location) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n location = location || {};\n\n var match = protocolre.exec(address);\n var protocol = match[1] ? match[1].toLowerCase() : '';\n var forwardSlashes = !!match[2];\n var otherSlashes = !!match[3];\n var slashesCount = 0;\n var rest;\n\n if (forwardSlashes) {\n if (otherSlashes) {\n rest = match[2] + match[3] + match[4];\n slashesCount = match[2].length + match[3].length;\n } else {\n rest = match[2] + match[4];\n slashesCount = match[2].length;\n }\n } else {\n if (otherSlashes) {\n rest = match[3] + match[4];\n slashesCount = match[3].length;\n } else {\n rest = match[4]\n }\n }\n\n if (protocol === 'file:') {\n if (slashesCount >= 2) {\n rest = rest.slice(2);\n }\n } else if (isSpecial(protocol)) {\n rest = match[4];\n } else if (protocol) {\n if (forwardSlashes) {\n rest = rest.slice(2);\n }\n } else if (slashesCount >= 2 && isSpecial(location.protocol)) {\n rest = match[4];\n }\n\n return {\n protocol: protocol,\n slashes: forwardSlashes || isSpecial(protocol),\n slashesCount: slashesCount,\n rest: rest\n };\n}\n\n/**\n * Resolve a relative URL pathname against a base URL pathname.\n *\n * @param {String} relative Pathname of the relative URL.\n * @param {String} base Pathname of the base URL.\n * @return {String} Resolved pathname.\n * @private\n */\nfunction resolve(relative, base) {\n if (relative === '') return base;\n\n var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))\n , i = path.length\n , last = path[i - 1]\n , unshift = false\n , up = 0;\n\n while (i--) {\n if (path[i] === '.') {\n path.splice(i, 1);\n } else if (path[i] === '..') {\n path.splice(i, 1);\n up++;\n } else if (up) {\n if (i === 0) unshift = true;\n path.splice(i, 1);\n up--;\n }\n }\n\n if (unshift) path.unshift('');\n if (last === '.' || last === '..') path.push('');\n\n return path.join('/');\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my OCD.\n *\n * It is worth noting that we should not use `URL` as class name to prevent\n * clashes with the global URL instance that got introduced in browsers.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} [location] Location defaults for relative paths.\n * @param {Boolean|Function} [parser] Parser for the query string.\n * @private\n */\nfunction Url(address, location, parser) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n\n if (!(this instanceof Url)) {\n return new Url(address, location, parser);\n }\n\n var relative, extracted, parse, instruction, index, key\n , instructions = rules.slice()\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) parser = qs.parse;\n\n location = lolcation(location);\n\n //\n // Extract protocol information before running the instructions.\n //\n extracted = extractProtocol(address || '', location);\n relative = !extracted.protocol && !extracted.slashes;\n url.slashes = extracted.slashes || relative && location.slashes;\n url.protocol = extracted.protocol || location.protocol || '';\n address = extracted.rest;\n\n //\n // When the authority component is absent the URL starts with a path\n // component.\n //\n if (\n extracted.protocol === 'file:' && (\n extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||\n (!extracted.slashes &&\n (extracted.protocol ||\n extracted.slashesCount < 2 ||\n !isSpecial(url.protocol)))\n ) {\n instructions[3] = [/(.*)/, 'pathname'];\n }\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n\n if (typeof instruction === 'function') {\n address = instruction(address, url);\n continue;\n }\n\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n index = parse === '@'\n ? address.lastIndexOf(parse)\n : address.indexOf(parse);\n\n if (~index) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if ((index = parse.exec(address))) {\n url[key] = index[1];\n address = address.slice(0, index.index);\n }\n\n url[key] = url[key] || (\n relative && instruction[3] ? location[key] || '' : ''\n );\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) url[key] = url[key].toLowerCase();\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // If the URL is relative, resolve the pathname against the base URL.\n //\n if (\n relative\n && location.slashes\n && url.pathname.charAt(0) !== '/'\n && (url.pathname !== '' || location.pathname !== '')\n ) {\n url.pathname = resolve(url.pathname, location.pathname);\n }\n\n //\n // Default to a / for pathname if none exists. This normalizes the URL\n // to always have a /\n //\n if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {\n url.pathname = '/' + url.pathname;\n }\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n\n if (url.auth) {\n index = url.auth.indexOf(':');\n\n if (~index) {\n url.username = url.auth.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = url.auth.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password))\n } else {\n url.username = encodeURIComponent(decodeURIComponent(url.auth));\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n }\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} part Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function\n * used to parse the query.\n * When setting the protocol, double slash will be\n * removed from the final url if it is true.\n * @returns {URL} URL instance for chaining.\n * @public\n */\nfunction set(part, value, fn) {\n var url = this;\n\n switch (part) {\n case 'query':\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n break;\n\n case 'port':\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n\n break;\n\n case 'hostname':\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n break;\n\n case 'host':\n url[part] = value;\n\n if (port.test(value)) {\n value = value.split(':');\n url.port = value.pop();\n url.hostname = value.join(':');\n } else {\n url.hostname = value;\n url.port = '';\n }\n\n break;\n\n case 'protocol':\n url.protocol = value.toLowerCase();\n url.slashes = !fn;\n break;\n\n case 'pathname':\n case 'hash':\n if (value) {\n var char = part === 'pathname' ? '/' : '#';\n url[part] = value.charAt(0) !== char ? char + value : value;\n } else {\n url[part] = value;\n }\n break;\n\n case 'username':\n case 'password':\n url[part] = encodeURIComponent(value);\n break;\n\n case 'auth':\n var index = value.indexOf(':');\n\n if (~index) {\n url.username = value.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = value.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password));\n } else {\n url.username = encodeURIComponent(decodeURIComponent(value));\n }\n }\n\n for (var i = 0; i < rules.length; i++) {\n var ins = rules[i];\n\n if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n url.href = url.toString();\n\n return url;\n}\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String} Compiled version of the URL.\n * @public\n */\nfunction toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , host = url.host\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result =\n protocol +\n ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n } else if (url.password) {\n result += ':'+ url.password;\n result += '@';\n } else if (\n url.protocol !== 'file:' &&\n isSpecial(url.protocol) &&\n !host &&\n url.pathname !== '/'\n ) {\n //\n // Add back the empty userinfo, otherwise the original invalid URL\n // might be transformed into a valid one with `url.pathname` as host.\n //\n result += '@';\n }\n\n //\n // Trailing colon is removed from `url.host` when it is parsed. If it still\n // ends with a colon, then add back the trailing colon that was removed. This\n // prevents an invalid URL from being transformed into a valid one.\n //\n if (host[host.length - 1] === ':' || (port.test(url.hostname) && !url.port)) {\n host += ':';\n }\n\n result += host + url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n}\n\nUrl.prototype = { set: set, toString: toString };\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others or testing.\n//\nUrl.extractProtocol = extractProtocol;\nUrl.location = lolcation;\nUrl.trimLeft = trimLeft;\nUrl.qs = qs;\n\nmodule.exports = Url;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const ARRAY = 'array';\nexport const BIGINT = 'bigint';\nexport const BOOLEAN = 'boolean';\nexport const FUNCTION = 'function';\nexport const NULL = 'null';\nexport const NUMBER = 'number';\nexport const OBJECT = 'object';\nexport const STRING = 'string';\nexport const SYMBOL = 'symbol';\nexport const UNDEFINED = 'undefined';\n","// ⚠️ AUTOMATICALLY GENERATED - DO NOT CHANGE\nexport const CHANNEL = '64e10b34-2bf7-4616-9668-f99de5aa046e';\n\nexport const MAIN = 'M' + CHANNEL;\nexport const THREAD = 'T' + CHANNEL;\n","export const APPLY = 'apply';\nexport const CONSTRUCT = 'construct';\nexport const DEFINE_PROPERTY = 'defineProperty';\nexport const DELETE_PROPERTY = 'deleteProperty';\nexport const GET = 'get';\nexport const GET_OWN_PROPERTY_DESCRIPTOR = 'getOwnPropertyDescriptor';\nexport const GET_PROTOTYPE_OF = 'getPrototypeOf';\nexport const HAS = 'has';\nexport const IS_EXTENSIBLE = 'isExtensible';\nexport const OWN_KEYS = 'ownKeys';\nexport const PREVENT_EXTENSION = 'preventExtensions';\nexport const SET = 'set';\nexport const SET_PROTOTYPE_OF = 'setPrototypeOf';\n","// The goal of this file is to normalize SAB\n// at least in main -> worker() use cases.\n// This still cannot possibly solve the sync\n// worker -> main() use case if SharedArrayBuffer\n// is not available or usable.\n\nimport {CHANNEL} from './channel.js';\n\nconst {isArray} = Array;\n\nlet {SharedArrayBuffer, window} = globalThis;\nlet {notify, wait, waitAsync} = Atomics;\nlet postPatched = null;\n\n// This is needed for some version of Firefox\nif (!waitAsync) {\n waitAsync = buffer => ({\n value: new Promise(onmessage => {\n // encodeURIComponent('onmessage=({data:b})=>(Atomics.wait(b,0),postMessage(0))')\n let w = new Worker('data:application/javascript,onmessage%3D(%7Bdata%3Ab%7D)%3D%3E(Atomics.wait(b%2C0)%2CpostMessage(0))');\n w.onmessage = onmessage;\n w.postMessage(buffer);\n })\n });\n}\n\n// Monkey-patch SharedArrayBuffer if needed\ntry {\n new SharedArrayBuffer(4);\n}\ncatch (_) {\n SharedArrayBuffer = ArrayBuffer;\n\n const ids = new WeakMap;\n // patch only main -> worker():async use case\n if (window) {\n const resolvers = new Map;\n const {prototype: {postMessage}} = Worker;\n\n const listener = event => {\n const details = event.data?.[CHANNEL];\n if (!isArray(details)) {\n event.stopImmediatePropagation();\n const { id, sb } = details;\n resolvers.get(id)(sb);\n }\n };\n\n postPatched = function (data, ...rest) {\n const details = data?.[CHANNEL];\n if (isArray(details)) {\n const [id, sb] = details;\n ids.set(sb, id);\n this.addEventListener('message', listener);\n }\n return postMessage.call(this, data, ...rest);\n };\n\n waitAsync = sb => ({\n value: new Promise(resolve => {\n resolvers.set(ids.get(sb), resolve);\n }).then(buff => {\n resolvers.delete(ids.get(sb));\n ids.delete(sb);\n for (let i = 0; i < buff.length; i++) sb[i] = buff[i];\n return 'ok';\n })\n });\n }\n else {\n const as = (id, sb) => ({[CHANNEL]: { id, sb }});\n\n notify = sb => {\n postMessage(as(ids.get(sb), sb));\n };\n\n addEventListener('message', event => {\n const details = event.data?.[CHANNEL];\n if (isArray(details)) {\n const [id, sb] = details;\n ids.set(sb, id);\n }\n });\n }\n}\n\nexport {SharedArrayBuffer, isArray, notify, postPatched, wait, waitAsync};\n","/*! (c) Andrea Giammarchi - ISC */\n\nimport {FUNCTION} from 'proxy-target/types';\n\nimport {CHANNEL} from './channel.js';\nimport {GET, HAS, SET} from './shared/traps.js';\n\nimport {SharedArrayBuffer, isArray, notify, postPatched, wait, waitAsync} from './bridge.js';\n\n// just minifier friendly for Blob Workers' cases\nconst {Int32Array, Map, Uint16Array} = globalThis;\n\n// common constants / utilities for repeated operations\nconst {BYTES_PER_ELEMENT: I32_BYTES} = Int32Array;\nconst {BYTES_PER_ELEMENT: UI16_BYTES} = Uint16Array;\n\nconst waitInterrupt = (sb, delay, handler) => {\n while (wait(sb, 0, 0, delay) === 'timed-out')\n handler();\n};\n\n// retain buffers to transfer\nconst buffers = new WeakSet;\n\n// retain either main threads or workers global context\nconst context = new WeakMap;\n\nconst syncResult = {value: {then: fn => fn()}};\n\n// used to generate a unique `id` per each worker `postMessage` \"transaction\"\nlet uid = 0;\n\n/**\n * @typedef {Object} Interrupt used to sanity-check interrupts while waiting synchronously.\n * @prop {function} [handler] a callback invoked every `delay` milliseconds.\n * @prop {number} [delay=42] define `handler` invokes in terms of milliseconds.\n */\n\n/**\n * Create once a `Proxy` able to orchestrate synchronous `postMessage` out of the box.\n * @param {globalThis | Worker} self the context in which code should run\n * @param {{parse: (serialized: string) => any, stringify: (serializable: any) => string, transform?: (value:any) => any, interrupt?: () => void | Interrupt}} [JSON] an optional `JSON` like interface to `parse` or `stringify` content with extra `transform` ability.\n * @returns {ProxyHandler<globalThis> | ProxyHandler<Worker>}\n */\nconst coincident = (self, {parse = JSON.parse, stringify = JSON.stringify, transform, interrupt} = JSON) => {\n // create a Proxy once for the given context (globalThis or Worker instance)\n if (!context.has(self)) {\n // ensure no SAB gets a chance to pass through this call\n const sendMessage = postPatched || self.postMessage;\n // ensure the CHANNEL and data are posted correctly\n const post = (transfer, ...args) => sendMessage.call(self, {[CHANNEL]: args}, {transfer});\n\n const handler = typeof interrupt === FUNCTION ? interrupt : interrupt?.handler;\n const delay = interrupt?.delay || 42;\n const decoder = new TextDecoder('utf-16');\n\n // automatically uses sync wait (worker -> main)\n // or fallback to async wait (main -> worker)\n const waitFor = (isAsync, sb) => isAsync ?\n waitAsync(sb, 0) :\n ((handler ? waitInterrupt(sb, delay, handler) : wait(sb, 0)), syncResult);\n\n // prevent Harakiri https://github.com/WebReflection/coincident/issues/18\n let seppuku = false;\n\n context.set(self, new Proxy(new Map, {\n // there is very little point in checking prop in proxy for this very specific case\n // and I don't want to orchestrate a whole roundtrip neither, as stuff would fail\n // regardless if from Worker we access non existent Main callback, and vice-versa.\n // This is here mostly to guarantee that if such check is performed, at least the\n // get trap goes through and then it's up to developers guarantee they are accessing\n // stuff that actually exists elsewhere.\n [HAS]: (_, action) => typeof action === 'string' && !action.startsWith('_'),\n\n // worker related: get any utility that should be available on the main thread\n [GET]: (_, action) => action === 'then' ? null : ((...args) => {\n // transaction id\n const id = uid++;\n\n // first contact: just ask for how big the buffer should be\n // the value would be stored at index [1] while [0] is just control\n let sb = new Int32Array(new SharedArrayBuffer(I32_BYTES * 2));\n\n // if a transfer list has been passed, drop it from args\n let transfer = [];\n if (buffers.has(args.at(-1) || transfer))\n buffers.delete(transfer = args.pop());\n\n // ask for invoke with arguments and wait for it\n post(transfer, id, sb, action, transform ? args.map(transform) : args);\n\n // helps deciding how to wait for results\n const isAsync = self !== globalThis;\n\n // warn users about possible deadlock still allowing them\n // to explicitly `proxy.invoke().then(...)` without blocking\n let deadlock = 0;\n if (seppuku && isAsync)\n deadlock = setTimeout(console.warn, 1000, `💀🔒 - Possible deadlock if proxy.${action}(...args) is awaited`);\n\n return waitFor(isAsync, sb).value.then(() => {\n clearTimeout(deadlock);\n\n // commit transaction using the returned / needed buffer length\n const length = sb[1];\n\n // filter undefined results\n if (!length) return;\n\n // calculate the needed ui16 bytes length to store the result string\n const bytes = UI16_BYTES * length;\n\n // round up to the next amount of bytes divided by 4 to allow i32 operations\n sb = new Int32Array(new SharedArrayBuffer(bytes + (bytes % I32_BYTES)));\n\n // ask for results and wait for it\n post([], id, sb);\n return waitFor(isAsync, sb).value.then(() => parse(\n decoder.decode(new Uint16Array(sb.buffer).slice(0, length)))\n );\n });\n }),\n\n // main thread related: react to any utility a worker is asking for\n [SET](actions, action, callback) {\n const type = typeof callback;\n if (type !== FUNCTION)\n throw new Error(`Unable to assign ${action} as ${type}`);\n // lazy event listener and logic handling, triggered once by setters actions\n if (!actions.size) {\n // maps results by `id` as they are asked for\n const results = new Map;\n // add the event listener once (first defined setter, all others work the same)\n self.addEventListener('message', async (event) => {\n // grub the very same library CHANNEL; ignore otherwise\n const details = event.data?.[CHANNEL];\n if (isArray(details)) {\n // if early enough, avoid leaking data to other listeners\n event.stopImmediatePropagation();\n const [id, sb, ...rest] = details;\n let error;\n // action available: it must be defined/known on the main thread\n if (rest.length) {\n const [action, args] = rest;\n if (actions.has(action)) {\n seppuku = true;\n try {\n // await for result either sync or async and serialize it\n const result = await actions.get(action)(...args);\n if (result !== void 0) {\n const serialized = stringify(transform ? transform(result) : result);\n // store the result for \"the very next\" event listener call\n results.set(id, serialized);\n // communicate the required SharedArrayBuffer length out of the\n // resulting serialized string\n sb[1] = serialized.length;\n }\n }\n catch (_) {\n error = _;\n }\n finally {\n seppuku = false;\n }\n }\n // unknown action should be notified as missing on the main thread\n else {\n error = new Error(`Unsupported action: ${action}`);\n }\n // unlock the wait lock later on\n sb[0] = 1;\n }\n // no action means: get results out of the well known `id`\n // wait lock automatically unlocked here as no `0` value would\n // possibly ever land at index `0`\n else {\n const result = results.get(id);\n results.delete(id);\n // populate the SharedArrayBuffer with utf-16 chars code\n for (let ui16a = new Uint16Array(sb.buffer), i = 0; i < result.length; i++)\n ui16a[i] = result.charCodeAt(i);\n }\n // release te worker waiting either the length or the result\n notify(sb, 0);\n if (error) throw error;\n }\n });\n }\n // store this action callback allowing the setter in the process\n return !!actions.set(action, callback);\n }\n }));\n }\n return context.get(self);\n};\n\ncoincident.transfer = (...args) => (buffers.add(args), args);\n\nexport default coincident;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DIR_MODE, SEEK_CUR, SEEK_END, instanceOfStream, } from './emscripten';\nexport const DRIVE_SEPARATOR = ':';\nexport const DRIVE_API_PATH = '/api/drive.v1';\nexport const BLOCK_SIZE = 4096;\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder('utf-8');\n// Mapping flag -> do we need to overwrite the file upon closing it\nconst flagNeedsWrite = {\n 0 /*O_RDONLY*/: false,\n 1 /*O_WRONLY*/: true,\n 2 /*O_RDWR*/: true,\n 64 /*O_CREAT*/: true,\n 65 /*O_WRONLY|O_CREAT*/: true,\n 66 /*O_RDWR|O_CREAT*/: true,\n 129 /*O_WRONLY|O_EXCL*/: true,\n 193 /*O_WRONLY|O_CREAT|O_EXCL*/: true,\n 514 /*O_RDWR|O_TRUNC*/: true,\n 577 /*O_WRONLY|O_CREAT|O_TRUNC*/: true,\n 578 /*O_CREAT|O_RDWR|O_TRUNC*/: true,\n 705 /*O_WRONLY|O_CREAT|O_EXCL|O_TRUNC*/: true,\n 706 /*O_RDWR|O_CREAT|O_EXCL|O_TRUNC*/: true,\n 1024 /*O_APPEND*/: true,\n 1025 /*O_WRONLY|O_APPEND*/: true,\n 1026 /*O_RDWR|O_APPEND*/: true,\n 1089 /*O_WRONLY|O_CREAT|O_APPEND*/: true,\n 1090 /*O_RDWR|O_CREAT|O_APPEND*/: true,\n 1153 /*O_WRONLY|O_EXCL|O_APPEND*/: true,\n 1154 /*O_RDWR|O_EXCL|O_APPEND*/: true,\n 1217 /*O_WRONLY|O_CREAT|O_EXCL|O_APPEND*/: true,\n 1218 /*O_RDWR|O_CREAT|O_EXCL|O_APPEND*/: true,\n 4096 /*O_RDONLY|O_DSYNC*/: true,\n 4098 /*O_RDWR|O_DSYNC*/: true,\n};\nexport class DriveFSEmscriptenStreamOps {\n constructor(fs) {\n this.fs = fs;\n }\n open(stream) {\n const path = this.fs.realPath(stream.node);\n if (this.fs.FS.isFile(stream.node.mode)) {\n stream.file = this.fs.API.get(path);\n }\n }\n close(stream) {\n if (!this.fs.FS.isFile(stream.node.mode) || !stream.file) {\n return;\n }\n const path = this.fs.realPath(stream.node);\n const flags = stream.flags;\n let parsedFlags = typeof flags === 'string' ? parseInt(flags, 10) : flags;\n parsedFlags &= 0x1fff;\n let needsWrite = true;\n if (parsedFlags in flagNeedsWrite) {\n needsWrite = flagNeedsWrite[parsedFlags];\n }\n if (needsWrite) {\n this.fs.API.put(path, stream.file);\n }\n stream.file = undefined;\n }\n read(stream, buffer, offset, length, position) {\n if (length <= 0 ||\n stream.file === undefined ||\n position >= (stream.file.data.length || 0)) {\n return 0;\n }\n const size = Math.min(stream.file.data.length - position, length);\n buffer.set(stream.file.data.subarray(position, position + size), offset);\n return size;\n }\n write(stream, buffer, offset, length, position) {\n var _a;\n if (length <= 0 || stream.file === undefined) {\n return 0;\n }\n stream.node.timestamp = Date.now();\n if (position + length > (((_a = stream.file) === null || _a === void 0 ? void 0 : _a.data.length) || 0)) {\n const oldData = stream.file.data ? stream.file.data : new Uint8Array();\n stream.file.data = new Uint8Array(position + length);\n stream.file.data.set(oldData);\n }\n stream.file.data.set(buffer.subarray(offset, offset + length), position);\n return length;\n }\n llseek(stream, offset, whence) {\n let position = offset;\n if (whence === SEEK_CUR) {\n position += stream.position;\n }\n else if (whence === SEEK_END) {\n if (this.fs.FS.isFile(stream.node.mode)) {\n if (stream.file !== undefined) {\n position += stream.file.data.length;\n }\n else {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);\n }\n }\n }\n if (position < 0) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);\n }\n return position;\n }\n}\nexport class DriveFSEmscriptenNodeOps {\n constructor(fs) {\n this.fs = fs;\n }\n node(nodeOrStream) {\n if (instanceOfStream(nodeOrStream)) {\n return nodeOrStream.node;\n }\n return nodeOrStream;\n }\n getattr(value) {\n const node = this.node(value);\n return {\n ...this.fs.API.getattr(this.fs.realPath(node)),\n mode: node.mode,\n ino: node.id,\n };\n }\n setattr(value, attr) {\n const node = this.node(value);\n for (const [key, value] of Object.entries(attr)) {\n switch (key) {\n case 'mode':\n node.mode = value;\n break;\n case 'timestamp':\n node.timestamp = value;\n break;\n default:\n console.warn('setattr', key, 'of', value, 'on', node, 'not yet implemented');\n break;\n }\n }\n }\n lookup(parent, name) {\n const node = this.node(parent);\n const path = this.fs.PATH.join2(this.fs.realPath(node), name);\n const result = this.fs.API.lookup(path);\n if (!result.ok) {\n throw this.fs.FS.genericErrors[this.fs.ERRNO_CODES['ENOENT']];\n }\n return this.fs.createNode(node, name, result.mode, 0);\n }\n mknod(parent, name, mode, dev) {\n const node = this.node(parent);\n const path = this.fs.PATH.join2(this.fs.realPath(node), name);\n this.fs.API.mknod(path, mode);\n return this.fs.createNode(node, name, mode, dev);\n }\n rename(value, newDir, newName) {\n const oldNode = this.node(value);\n const newDirNode = this.node(newDir);\n this.fs.API.rename(oldNode.parent\n ? this.fs.PATH.join2(this.fs.realPath(oldNode.parent), oldNode.name)\n : oldNode.name, this.fs.PATH.join2(this.fs.realPath(newDirNode), newName));\n // Updating the in-memory node\n oldNode.name = newName;\n oldNode.parent = newDirNode;\n }\n unlink(parent, name) {\n this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(parent)), name));\n }\n rmdir(parent, name) {\n this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(parent)), name));\n }\n readdir(value) {\n return this.fs.API.readdir(this.fs.realPath(this.node(value)));\n }\n symlink(parent, newName, oldPath) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES['EPERM']);\n }\n readlink(node) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES['EPERM']);\n }\n}\n/**\n * ContentsAPI base class\n */\nexport class ContentsAPI {\n constructor(driveName, mountpoint, FS, ERRNO_CODES) {\n this._driveName = driveName;\n this._mountpoint = mountpoint;\n this.FS = FS;\n this.ERRNO_CODES = ERRNO_CODES;\n }\n lookup(path) {\n return this.request({ method: 'lookup', path: this.normalizePath(path) });\n }\n getmode(path) {\n return this.request({ method: 'getmode', path: this.normalizePath(path) });\n }\n mknod(path, mode) {\n return this.request({\n method: 'mknod',\n path: this.normalizePath(path),\n data: { mode },\n });\n }\n rename(oldPath, newPath) {\n return this.request({\n method: 'rename',\n path: this.normalizePath(oldPath),\n data: { newPath: this.normalizePath(newPath) },\n });\n }\n readdir(path) {\n const dirlist = this.request({\n method: 'readdir',\n path: this.normalizePath(path),\n });\n dirlist.push('.');\n dirlist.push('..');\n return dirlist;\n }\n rmdir(path) {\n return this.request({ method: 'rmdir', path: this.normalizePath(path) });\n }\n get(path) {\n const response = this.request({\n method: 'get',\n path: this.normalizePath(path),\n });\n if (!response) {\n throw new this.FS.ErrnoError(this.ERRNO_CODES['ENOENT']);\n }\n const serializedContent = response.content;\n const format = response.format;\n switch (format) {\n case 'json':\n case 'text':\n return {\n data: encoder.encode(serializedContent),\n format,\n };\n case 'base64': {\n const binString = atob(serializedContent);\n const len = binString.length;\n const data = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n data[i] = binString.charCodeAt(i);\n }\n return {\n data,\n format,\n };\n }\n default:\n throw new this.FS.ErrnoError(this.ERRNO_CODES['ENOENT']);\n }\n }\n put(path, value) {\n switch (value.format) {\n case 'json':\n case 'text':\n return this.request({\n method: 'put',\n path: this.normalizePath(path),\n data: {\n format: value.format,\n data: decoder.decode(value.data),\n },\n });\n case 'base64': {\n let binary = '';\n for (let i = 0; i < value.data.byteLength; i++) {\n binary += String.fromCharCode(value.data[i]);\n }\n return this.request({\n method: 'put',\n path: this.normalizePath(path),\n data: {\n format: value.format,\n data: btoa(binary),\n },\n });\n }\n }\n }\n getattr(path) {\n const stats = this.request({\n method: 'getattr',\n path: this.normalizePath(path),\n });\n // Turn datetimes into proper objects\n if (stats.atime) {\n stats.atime = new Date(stats.atime);\n }\n if (stats.mtime) {\n stats.mtime = new Date(stats.mtime);\n }\n if (stats.ctime) {\n stats.ctime = new Date(stats.ctime);\n }\n // ensure a non-undefined size (0 isn't great, though)\n stats.size = stats.size || 0;\n return stats;\n }\n /**\n * Normalize a Path by making it compliant for the content manager\n *\n * @param path: the path relatively to the Emscripten drive\n */\n normalizePath(path) {\n // Remove mountpoint prefix\n if (path.startsWith(this._mountpoint)) {\n path = path.slice(this._mountpoint.length);\n }\n // Add JupyterLab drive name\n if (this._driveName) {\n path = `${this._driveName}${DRIVE_SEPARATOR}${path}`;\n }\n return path;\n }\n}\n/**\n * An Emscripten-compatible synchronous Contents API using the service worker.\n */\nexport class ServiceWorkerContentsAPI extends ContentsAPI {\n constructor(baseUrl, driveName, mountpoint, FS, ERRNO_CODES) {\n super(driveName, mountpoint, FS, ERRNO_CODES);\n this._baseUrl = baseUrl;\n }\n request(data) {\n const xhr = new XMLHttpRequest();\n xhr.open('POST', encodeURI(this.endpoint), false);\n try {\n xhr.send(JSON.stringify(data));\n }\n catch (e) {\n console.error(e);\n }\n if (xhr.status >= 400) {\n throw new this.FS.ErrnoError(this.ERRNO_CODES['EINVAL']);\n }\n return JSON.parse(xhr.responseText);\n }\n /**\n * Get the api/drive endpoint\n */\n get endpoint() {\n return `${this._baseUrl}api/drive`;\n }\n}\nexport class DriveFS {\n constructor(options) {\n this.FS = options.FS;\n this.PATH = options.PATH;\n this.ERRNO_CODES = options.ERRNO_CODES;\n this.API = this.createAPI(options);\n this.driveName = options.driveName;\n this.node_ops = new DriveFSEmscriptenNodeOps(this);\n this.stream_ops = new DriveFSEmscriptenStreamOps(this);\n }\n /**\n * Create the ContentsAPI.\n *\n * This is supposed to be overwritten if needed.\n */\n createAPI(options) {\n return new ServiceWorkerContentsAPI(options.baseUrl, options.driveName, options.mountpoint, options.FS, options.ERRNO_CODES);\n }\n mount(mount) {\n return this.createNode(null, mount.mountpoint, DIR_MODE | 511, 0);\n }\n createNode(parent, name, mode, dev) {\n const FS = this.FS;\n if (!FS.isDir(mode) && !FS.isFile(mode)) {\n throw new FS.ErrnoError(this.ERRNO_CODES['EINVAL']);\n }\n const node = FS.createNode(parent, name, mode, dev);\n node.node_ops = this.node_ops;\n node.stream_ops = this.stream_ops;\n return node;\n }\n getMode(path) {\n return this.API.getmode(path);\n }\n realPath(node) {\n const parts = [];\n let currentNode = node;\n parts.push(currentNode.name);\n while (currentNode.parent !== currentNode) {\n currentNode = currentNode.parent;\n parts.push(currentNode.name);\n }\n parts.reverse();\n return this.PATH.join.apply(null, parts);\n }\n}\n//# sourceMappingURL=drivefs.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/// <reference path=\"../../../node_modules/@types/emscripten/index.d.ts\" />\nexport const DIR_MODE = 16895; // 040777\nexport const FILE_MODE = 33206; // 100666\nexport const SEEK_CUR = 1;\nexport const SEEK_END = 2;\nexport function instanceOfStream(nodeOrStream) {\n return 'node' in nodeOrStream;\n}\n//# sourceMappingURL=emscripten.js.map","// Copyright (c) Thorsten Beier\n// Copyright (c) JupyterLite Contributors\n// Distributed under the terms of the Modified BSD License.\nimport { URLExt } from '@jupyterlab/coreutils';\nglobalThis.Module = {};\n// when a toplevel cell uses an await, the cell is implicitly\n// wrapped in a async function. Since the webloop - eventloop\n// implementation does not support `eventloop.run_until_complete(f)`\n// we need to convert the toplevel future in a javascript Promise\n// this `toplevel` promise is then awaited before we\n// execute the next cell. After the promise is awaited we need\n// to do some cleanup and delete the python proxy\n// (ie a js-wrapped python object) to avoid memory leaks\nglobalThis.toplevel_promise = null;\nglobalThis.toplevel_promise_py_proxy = null;\nlet resolveInputReply;\nlet kernelReady;\nlet rawXKernel;\nlet rawXServer;\nasync function get_stdin() {\n const replyPromise = new Promise(resolve => {\n resolveInputReply = resolve;\n });\n return replyPromise;\n}\nself.get_stdin = get_stdin;\nasync function waitRunDependency() {\n const promise = new Promise(resolve => {\n globalThis.Module.monitorRunDependencies = (n) => {\n if (n === 0) {\n resolve();\n }\n };\n });\n // If there are no pending dependencies left, monitorRunDependencies will\n // never be called. Since we can't check the number of dependencies,\n // manually trigger a call.\n globalThis.Module.addRunDependency('dummy');\n globalThis.Module.removeRunDependency('dummy');\n return promise;\n}\nglobalThis.ready = new Promise(resolve => {\n kernelReady = resolve;\n});\nexport class XeusRemoteKernel {\n constructor(options = {}) {\n this._driveName = '';\n this._driveFS = null;\n this._sendWorkerMessage = () => { };\n }\n async ready() {\n return await globalThis.ready;\n }\n async cd(path) {\n if (!path || !globalThis.Module.FS) {\n return;\n }\n globalThis.Module.FS.chdir(path);\n }\n async isDir(path) {\n try {\n const lookup = globalThis.Module.FS.lookupPath(path);\n return globalThis.Module.FS.isDir(lookup.node.mode);\n }\n catch (e) {\n return false;\n }\n }\n async processMessage(event) {\n const msg_type = event.msg.header.msg_type;\n await globalThis.ready;\n if (globalThis.toplevel_promise !== null &&\n globalThis.toplevel_promise_py_proxy !== null) {\n await globalThis.toplevel_promise;\n globalThis.toplevel_promise_py_proxy.delete();\n globalThis.toplevel_promise_py_proxy = null;\n globalThis.toplevel_promise = null;\n }\n if (msg_type === 'input_reply') {\n resolveInputReply(event.msg);\n }\n else {\n rawXServer.notify_listener(event.msg);\n }\n }\n async initialize(options) {\n const { baseUrl, kernelSpec } = options;\n // location of the kernel binary on the server\n const binary_js = URLExt.join(baseUrl, kernelSpec.argv[0]);\n const binary_wasm = binary_js.replace('.js', '.wasm');\n importScripts(binary_js);\n globalThis.Module = await createXeusModule({\n locateFile: (file) => {\n if (file.endsWith('.wasm')) {\n return binary_wasm;\n }\n return file;\n }\n });\n try {\n await waitRunDependency();\n // each kernel can have a `async_init` function\n // which can do kernel specific **async** initialization\n // This function is usually implemented in the pre/post.js\n // in the emscripten build of that kernel\n if (globalThis.Module['async_init'] !== undefined) {\n const kernel_root_url = URLExt.join(baseUrl, `xeus/kernels/${kernelSpec.dir}`);\n const pkg_root_url = URLExt.join(baseUrl, 'xeus/kernel_packages');\n const verbose = true;\n await globalThis.Module['async_init'](kernel_root_url, pkg_root_url, verbose);\n }\n await waitRunDependency();\n rawXKernel = new globalThis.Module.xkernel();\n rawXServer = rawXKernel.get_server();\n if (!rawXServer) {\n console.error('Failed to start kernel!');\n }\n rawXKernel.start();\n }\n catch (e) {\n if (typeof e === 'number') {\n const msg = globalThis.Module.get_exception_message(e);\n console.error(msg);\n throw new Error(msg);\n }\n else {\n console.error(e);\n throw e;\n }\n }\n kernelReady(1);\n }\n /**\n * Register the callback function to send messages from the worker back to the main thread.\n * @param callback the callback to register\n */\n registerCallback(callback) {\n this._sendWorkerMessage = callback;\n }\n}\n","// Copyright (c) Thorsten Beier\n// Copyright (c) JupyterLite Contributors\n// Distributed under the terms of the Modified BSD License.\nimport coincident from 'coincident';\nimport { ContentsAPI, DriveFS } from '@jupyterlite/contents';\nimport { XeusRemoteKernel } from './worker';\nconst workerAPI = coincident(self);\n/**\n * An Emscripten-compatible synchronous Contents API using shared array buffers.\n */\nexport class SharedBufferContentsAPI extends ContentsAPI {\n request(data) {\n return workerAPI.processDriveRequest(data);\n }\n}\n/**\n * A custom drive implementation which uses shared array buffers (via coincident) if available\n */\nclass XeusDriveFS extends DriveFS {\n createAPI(options) {\n return new SharedBufferContentsAPI(options.driveName, options.mountpoint, options.FS, options.ERRNO_CODES);\n }\n}\nexport class XeusCoincidentKernel extends XeusRemoteKernel {\n /**\n * Setup custom Emscripten FileSystem\n */\n async mount(driveName, mountpoint, baseUrl) {\n const { FS, PATH, ERRNO_CODES } = globalThis.Module;\n if (!FS) {\n return;\n }\n const drive = new XeusDriveFS({\n FS,\n PATH,\n ERRNO_CODES,\n baseUrl,\n driveName,\n mountpoint\n });\n FS.mkdir(mountpoint);\n FS.mount(drive, {}, mountpoint);\n FS.chdir(mountpoint);\n }\n}\nconst worker = new XeusCoincidentKernel();\nworkerAPI.initialize = worker.initialize.bind(worker);\nworkerAPI.mount = worker.mount.bind(worker);\nworkerAPI.ready = worker.ready.bind(worker);\nworkerAPI.cd = worker.cd.bind(worker);\nworkerAPI.isDir = worker.isDir.bind(worker);\nworkerAPI.processMessage = worker.processMessage.bind(worker);\n"],"names":["Object","defineProperty","exports","value","ActivityMonitor","signaling_1","constructor","options","this","_timer","_timeout","_isDisposed","_activityStopped","Signal","signal","connect","_onSignalFired","timeout","activityStopped","isDisposed","dispose","clearData","sender","args","clearTimeout","_sender","_args","setTimeout","emit","__createBinding","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","__exportStar","p","prototype","hasOwnProperty","call","LruCache","_map","Map","_maxSize","maxSize","size","clear","key","item","delete","set","keys","next","MarkdownCodeBlocks","CODE_BLOCK_MARKER","markdownExtensions","MarkdownCodeBlock","startLine","code","endLine","isMarkdown","extension","indexOf","findMarkdownCodeBlocks","text","lines","split","codeBlocks","currentBlock","lineIndex","length","line","lineContainsMarker","constructingBlock","push","firstIndex","lastIndex","lastIndexOf","substring","__importDefault","mod","PageConfig","coreutils_1","minimist_1","url_1","getOption","name","configData","getBodyData","found","document","el","getElementById","JSON","parse","textContent","process","argv","cli","default","slice","path","fullPath","resolve","env","eval","e","console","error","JSONExt","isObject","stringify","setOption","last","getBaseUrl","URLExt","normalize","getTreeUrl","join","getShareUrl","getTreeShareUrl","getUrl","_a","_b","_c","_d","toShare","mode","workspace","labOrDoc","defaultWorkspace","encodeURIComponent","treePath","encodeParts","getWsUrl","baseUrl","wsUrl","getNBConvertURL","format","download","notebookPath","url","getToken","getNotebookVersion","notebookVersion","Extension","body","val","dataset","decodeURIComponent","populate","raw","warn","deferred","disabled","isDeferred","id","separatorIndex","extName","some","isDisabled","PathExt","path_1","removeSlash","paths","posix","joinWithLeadingSlash","basename","ext","dirname","dir","extname","parts","relative","from","to","normalizeExtension","signalToPromise","waitForSignal","PromiseDelegate","cleanup","disconnect","slot","reject","promise","Text","jsIndexToCharIndex","jsIdx","charIndexToJsIndex","charIdx","camelCase","str","upper","replace","match","p1","p2","toUpperCase","toLowerCase","titleCase","map","word","charAt","Time","UNITS","milliseconds","formatHuman","lang","documentElement","formatter","Intl","RelativeTimeFormat","numeric","style","delta","Date","getTime","now","unit","amount","Math","ceil","DateTimeFormat","dateStyle","timeStyle","url_parse_1","a","createElement","href","u","isSchemaLess","protocol","slashes","prefix","auth","host","pathname","getHostName","hostname","toString","objectToQueryString","filter","content","String","queryStringToObject","reduce","acc","isLocal","allowRoot","isPrimitive","isArray","Array","deepEqual","first","second","a1","a2","i","n","deepArrayEqual","firstValue","secondValue","deepObjectEqual","deepCopy","result","deepArrayCopy","subvalue","deepObjectCopy","emptyObject","freeze","emptyArray","fallbackRandomValues","buffer","random","Random","getRandomValues","crypto","window","msCrypto","UUID","uuid4","bytes","Uint8Array","lut","uuid4Factory","MimeData","_types","_values","types","hasData","mime","getData","setData","data","splice","Promise","_resolve","_reject","reason","Token","description","_tokenStructuralPropertyT","factory","ArrayExt","Private","StringExt","firstIndexOf","array","start","stop","span","max","min","j","findFirstIndex","fn","findLastIndex","d","reverse","b","removeAt","index","findFirstValue","findLastValue","lowerBound","begin","half","middle","upperBound","shallowEqual","step","Error","floor","move","fromIndex","toIndex","rotate","pivot","fill","insert","removeFirstOf","removeLastOf","removeAllOf","count","removeFirstWhere","removeLastWhere","removeAllWhere","rangeLength","Infinity","findIndices","source","query","indices","matchSumOfSquares","score","matchSumOfDeltas","highlight","cmp","thisArg","disconnectBetween","receiver","disconnectSender","disconnectReceiver","disconnectAll","object","getExceptionHandler","exceptionHandler","setExceptionHandler","handler","old","Stream","super","arguments","_pending","Symbol","asyncIterator","pending","_","catch","receivers","receiversForSender","connection","scheduleCleanup","sendersForReceiver","senders","err","findConnection","invokeSlot","WeakMap","dirtySet","Set","schedule","requestAnimationFrame","setImmediate","connections","find","cleanupDirtySet","add","forEach","cleanupConnections","isDeadConnection","isNumber","x","test","isConstructorOrProto","obj","module","opts","flags","bools","strings","unknownFn","unknown","boolean","allBools","concat","Boolean","aliases","aliasIsBoolean","alias","y","string","defaults","setKey","Number","lastKey","setArg","arg","argDefined","notFlags","letters","broken","stopEarly","apply","assertPath","TypeError","normalizeStringPosix","allowAboveRoot","res","lastSegmentLength","lastSlash","dots","charCodeAt","lastSlashIndex","cwd","resolvedPath","resolvedAbsolute","isAbsolute","trailingSeparator","joined","fromStart","fromEnd","fromLen","toStart","toLen","lastCommonSep","fromCode","out","_makeLong","hasRoot","end","matchedSlash","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","pathObject","sep","root","base","_format","ret","delimiter","win32","has","decode","input","encode","pairs","isNaN","part","parser","exec","port","required","qs","controlOrWhitespace","CRHTLF","protocolre","windowsDriveLetter","trimLeft","rules","address","isSpecial","NaN","ignore","hash","lolcation","loc","location","g","self","finaldestination","type","Url","unescape","scheme","extractProtocol","rest","forwardSlashes","otherSlashes","slashesCount","extracted","instruction","instructions","unshift","up","username","password","origin","pop","char","ins","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","definition","globalThis","Function","prop","r","toStringTag","FUNCTION","CHANNEL","GET","HAS","SET","SharedArrayBuffer","notify","wait","waitAsync","Atomics","postPatched","onmessage","w","Worker","postMessage","ArrayBuffer","ids","resolvers","listener","event","details","stopImmediatePropagation","sb","addEventListener","then","buff","as","Int32Array","BYTES_PER_ELEMENT","I32_BYTES","UI16_BYTES","Uint16Array","buffers","WeakSet","context","syncResult","uid","coincident","transform","interrupt","sendMessage","post","transfer","delay","decoder","TextDecoder","waitFor","isAsync","waitInterrupt","seppuku","Proxy","action","startsWith","at","deadlock","actions","callback","results","async","serialized","ui16a","encoder","TextEncoder","flagNeedsWrite","DriveFSEmscriptenStreamOps","fs","open","stream","realPath","node","FS","isFile","file","API","close","parsedFlags","parseInt","needsWrite","put","read","offset","position","subarray","write","timestamp","oldData","llseek","whence","ErrnoError","ERRNO_CODES","EPERM","EINVAL","DriveFSEmscriptenNodeOps","nodeOrStream","instanceOfStream","getattr","ino","setattr","attr","entries","lookup","parent","PATH","join2","ok","genericErrors","createNode","mknod","dev","rename","newDir","newName","oldNode","newDirNode","unlink","rmdir","readdir","symlink","oldPath","readlink","ContentsAPI","driveName","mountpoint","_driveName","_mountpoint","request","method","normalizePath","getmode","newPath","dirlist","response","serializedContent","binString","atob","len","binary","byteLength","fromCharCode","btoa","stats","atime","mtime","ctime","ServiceWorkerContentsAPI","_baseUrl","xhr","XMLHttpRequest","encodeURI","endpoint","send","status","responseText","DriveFS","createAPI","node_ops","stream_ops","mount","DIR_MODE","isDir","getMode","currentNode","resolveInputReply","kernelReady","rawXKernel","rawXServer","waitRunDependency","Module","monitorRunDependencies","addRunDependency","removeRunDependency","toplevel_promise","toplevel_promise_py_proxy","get_stdin","ready","XeusRemoteKernel","_driveFS","_sendWorkerMessage","cd","chdir","lookupPath","processMessage","msg_type","msg","header","notify_listener","initialize","kernelSpec","binary_js","binary_wasm","importScripts","createXeusModule","locateFile","endsWith","kernel_root_url","pkg_root_url","verbose","xkernel","get_server","get_exception_message","registerCallback","workerAPI","SharedBufferContentsAPI","processDriveRequest","XeusDriveFS","XeusCoincidentKernel","drive","mkdir","worker","bind"],"sourceRoot":""}
1
+ {"version":3,"file":"coincident.worker.js","mappings":";qEAGAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAQE,qBAAkB,EAC1B,MAAMC,EAAc,EAAQ,KAiE5BH,EAAQE,gBA7DR,MAII,WAAAE,CAAYC,GACRC,KAAKC,QAAU,EACfD,KAAKE,UAAY,EACjBF,KAAKG,aAAc,EACnBH,KAAKI,iBAAmB,IAAIP,EAAYQ,OAAOL,MAC/CD,EAAQO,OAAOC,QAAQP,KAAKQ,eAA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Y1gB,GAC/B,MAAM,GAAEsd,EAAE,KAAEgC,EAAI,YAAEb,GAAgB9F,WAAW4K,OAC7C,IAAKjG,EACD,OAEJ,MAAMyI,EAAQ,IAAIF,EAAY,CAC1BvI,KACAgC,OACAb,cACAze,UACAygB,YACAC,eAEJpD,EAAG0I,MAAMtF,GACTpD,EAAGuF,MAAMkD,EAAO,CAAC,EAAGrF,GACpBpD,EAAG6G,MAAMzD,EACb,EAEJ,MAAMuF,EAAS,IAAIH,EACnBJ,EAAUhB,WAAauB,EAAOvB,WAAWwB,KAAKD,GAC9CP,EAAU7C,MAAQoD,EAAOpD,MAAMqD,KAAKD,GACpCP,EAAU5B,MAAQmC,EAAOnC,MAAMoC,KAAKD,GACpCP,EAAUxB,GAAK+B,EAAO/B,GAAGgC,KAAKD,GAC9BP,EAAU3C,MAAQkD,EAAOlD,MAAMmD,KAAKD,GACpCP,EAAUrB,eAAiB4B,EAAO5B,eAAe6B,KAAKD","sources":["webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/activitymonitor.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/index.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/interfaces.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/lru.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/markdowncodeblocks.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/pageconfig.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/path.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/signal.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/text.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/time.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlab/coreutils/lib/url.js","webpack://@jupyterlite/xeus/./node_modules/@lumino/coreutils/dist/index.js","webpack://@jupyterlite/xeus/./node_modules/@lumino/algorithm/dist/index.es6.js","webpack://@jupyterlite/xeus/./node_modules/@lumino/signaling/dist/index.es6.js","webpack://@jupyterlite/xeus/./node_modules/minimist/index.js","webpack://@jupyterlite/xeus/./node_modules/path-browserify/index.js","webpack://@jupyterlite/xeus/./node_modules/querystringify/index.js","webpack://@jupyterlite/xeus/./node_modules/requires-port/index.js","webpack://@jupyterlite/xeus/./node_modules/url-parse/index.js","webpack://@jupyterlite/xeus/webpack/bootstrap","webpack://@jupyterlite/xeus/webpack/runtime/define property getters","webpack://@jupyterlite/xeus/webpack/runtime/global","webpack://@jupyterlite/xeus/webpack/runtime/hasOwnProperty shorthand","webpack://@jupyterlite/xeus/webpack/runtime/make namespace object","webpack://@jupyterlite/xeus/./node_modules/proxy-target/esm/types.js","webpack://@jupyterlite/xeus/./node_modules/coincident/esm/channel.js","webpack://@jupyterlite/xeus/./node_modules/proxy-target/esm/traps.js","webpack://@jupyterlite/xeus/./node_modules/coincident/esm/bridge.js","webpack://@jupyterlite/xeus/./node_modules/coincident/esm/index.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlite/contents/lib/drivefs.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlite/contents/lib/emscripten.js","webpack://@jupyterlite/xeus/./lib/worker.js","webpack://@jupyterlite/xeus/./lib/coincident.worker.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ActivityMonitor = void 0;\nconst signaling_1 = require(\"@lumino/signaling\");\n/**\n * A class that monitors activity on a signal.\n */\nclass ActivityMonitor {\n /**\n * Construct a new activity monitor.\n */\n constructor(options) {\n this._timer = -1;\n this._timeout = -1;\n this._isDisposed = false;\n this._activityStopped = new signaling_1.Signal(this);\n options.signal.connect(this._onSignalFired, this);\n this._timeout = options.timeout || 1000;\n }\n /**\n * A signal emitted when activity has ceased.\n */\n get activityStopped() {\n return this._activityStopped;\n }\n /**\n * The timeout associated with the monitor, in milliseconds.\n */\n get timeout() {\n return this._timeout;\n }\n set timeout(value) {\n this._timeout = value;\n }\n /**\n * Test whether the monitor has been disposed.\n *\n * #### Notes\n * This is a read-only property.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources used by the activity monitor.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n signaling_1.Signal.clearData(this);\n }\n /**\n * A signal handler for the monitored signal.\n */\n _onSignalFired(sender, args) {\n clearTimeout(this._timer);\n this._sender = sender;\n this._args = args;\n this._timer = setTimeout(() => {\n this._activityStopped.emit({\n sender: this._sender,\n args: this._args\n });\n }, this._timeout);\n }\n}\nexports.ActivityMonitor = ActivityMonitor;\n//# sourceMappingURL=activitymonitor.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module coreutils\n */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./activitymonitor\"), exports);\n__exportStar(require(\"./interfaces\"), exports);\n__exportStar(require(\"./lru\"), exports);\n__exportStar(require(\"./markdowncodeblocks\"), exports);\n__exportStar(require(\"./pageconfig\"), exports);\n__exportStar(require(\"./path\"), exports);\n__exportStar(require(\"./signal\"), exports);\n__exportStar(require(\"./text\"), exports);\n__exportStar(require(\"./time\"), exports);\n__exportStar(require(\"./url\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=interfaces.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LruCache = void 0;\nconst DEFAULT_MAX_SIZE = 128;\n/** A least-recently-used cache. */\nclass LruCache {\n constructor(options = {}) {\n this._map = new Map();\n this._maxSize = (options === null || options === void 0 ? void 0 : options.maxSize) || DEFAULT_MAX_SIZE;\n }\n /**\n * Return the current size of the cache.\n */\n get size() {\n return this._map.size;\n }\n /**\n * Clear the values in the cache.\n */\n clear() {\n this._map.clear();\n }\n /**\n * Get a value (or null) from the cache, pushing the item to the front of the cache.\n */\n get(key) {\n const item = this._map.get(key) || null;\n if (item != null) {\n this._map.delete(key);\n this._map.set(key, item);\n }\n return item;\n }\n /**\n * Set a value in the cache, potentially evicting an old item.\n */\n set(key, value) {\n if (this._map.size >= this._maxSize) {\n this._map.delete(this._map.keys().next().value);\n }\n this._map.set(key, value);\n }\n}\nexports.LruCache = LruCache;\n//# sourceMappingURL=lru.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MarkdownCodeBlocks = void 0;\n/**\n * The namespace for code block functions which help\n * in extract code from markdown text\n */\nvar MarkdownCodeBlocks;\n(function (MarkdownCodeBlocks) {\n MarkdownCodeBlocks.CODE_BLOCK_MARKER = '```';\n const markdownExtensions = [\n '.markdown',\n '.mdown',\n '.mkdn',\n '.md',\n '.mkd',\n '.mdwn',\n '.mdtxt',\n '.mdtext',\n '.text',\n '.txt',\n '.Rmd'\n ];\n class MarkdownCodeBlock {\n constructor(startLine) {\n this.startLine = startLine;\n this.code = '';\n this.endLine = -1;\n }\n }\n MarkdownCodeBlocks.MarkdownCodeBlock = MarkdownCodeBlock;\n /**\n * Check whether the given file extension is a markdown extension\n * @param extension - A file extension\n *\n * @returns true/false depending on whether this is a supported markdown extension\n */\n function isMarkdown(extension) {\n return markdownExtensions.indexOf(extension) > -1;\n }\n MarkdownCodeBlocks.isMarkdown = isMarkdown;\n /**\n * Construct all code snippets from current text\n * (this could be potentially optimized if we can cache and detect differences)\n * @param text - A string to parse codeblocks from\n *\n * @returns An array of MarkdownCodeBlocks.\n */\n function findMarkdownCodeBlocks(text) {\n if (!text || text === '') {\n return [];\n }\n const lines = text.split('\\n');\n const codeBlocks = [];\n let currentBlock = null;\n for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {\n const line = lines[lineIndex];\n const lineContainsMarker = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER) === 0;\n const constructingBlock = currentBlock != null;\n // Skip this line if it is not part of any code block and doesn't contain a marker.\n if (!lineContainsMarker && !constructingBlock) {\n continue;\n }\n // Check if we are already constructing a code block.\n if (!constructingBlock) {\n // Start constructing a new code block.\n currentBlock = new MarkdownCodeBlock(lineIndex);\n // Check whether this is a single line code block of the form ```a = 10```.\n const firstIndex = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const lastIndex = line.lastIndexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const isSingleLine = firstIndex !== lastIndex;\n if (isSingleLine) {\n currentBlock.code = line.substring(firstIndex + MarkdownCodeBlocks.CODE_BLOCK_MARKER.length, lastIndex);\n currentBlock.endLine = lineIndex;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n }\n else if (currentBlock) {\n if (lineContainsMarker) {\n // End of block, finish it up.\n currentBlock.endLine = lineIndex - 1;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n else {\n // Append the current line.\n currentBlock.code += line + '\\n';\n }\n }\n }\n return codeBlocks;\n }\n MarkdownCodeBlocks.findMarkdownCodeBlocks = findMarkdownCodeBlocks;\n})(MarkdownCodeBlocks || (exports.MarkdownCodeBlocks = MarkdownCodeBlocks = {}));\n//# sourceMappingURL=markdowncodeblocks.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PageConfig = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\nconst minimist_1 = __importDefault(require(\"minimist\"));\nconst url_1 = require(\"./url\");\n/**\n * The namespace for `PageConfig` functions.\n */\nvar PageConfig;\n(function (PageConfig) {\n /**\n * Get global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n *\n * @returns The config value or an empty string if not found.\n *\n * #### Notes\n * All values are treated as strings.\n * For browser based applications, it is assumed that the page HTML\n * includes a script tag with the id `jupyter-config-data` containing the\n * configuration as valid JSON. In order to support the classic Notebook,\n * we fall back on checking for `body` data of the given `name`.\n *\n * For node applications, it is assumed that the process was launched\n * with a `--jupyter-config-data` option pointing to a JSON settings\n * file.\n */\n function getOption(name) {\n if (configData) {\n return configData[name] || getBodyData(name);\n }\n configData = Object.create(null);\n let found = false;\n // Use script tag if available.\n if (typeof document !== 'undefined' && document) {\n const el = document.getElementById('jupyter-config-data');\n if (el) {\n configData = JSON.parse(el.textContent || '');\n found = true;\n }\n }\n // Otherwise use CLI if given.\n if (!found && typeof process !== 'undefined' && process.argv) {\n try {\n const cli = (0, minimist_1.default)(process.argv.slice(2));\n const path = require('path');\n let fullPath = '';\n if ('jupyter-config-data' in cli) {\n fullPath = path.resolve(cli['jupyter-config-data']);\n }\n else if ('JUPYTER_CONFIG_DATA' in process.env) {\n fullPath = path.resolve(process.env['JUPYTER_CONFIG_DATA']);\n }\n if (fullPath) {\n // Force Webpack to ignore this require.\n // eslint-disable-next-line\n configData = eval('require')(fullPath);\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n if (!coreutils_1.JSONExt.isObject(configData)) {\n configData = Object.create(null);\n }\n else {\n for (const key in configData) {\n // PageConfig expects strings\n if (typeof configData[key] !== 'string') {\n configData[key] = JSON.stringify(configData[key]);\n }\n }\n }\n return configData[name] || getBodyData(name);\n }\n PageConfig.getOption = getOption;\n /**\n * Set global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n * @param value - The value to set the option to.\n *\n * @returns The last config value or an empty string if it doesn't exist.\n */\n function setOption(name, value) {\n const last = getOption(name);\n configData[name] = value;\n return last;\n }\n PageConfig.setOption = setOption;\n /**\n * Get the base url for a Jupyter application, or the base url of the page.\n */\n function getBaseUrl() {\n return url_1.URLExt.normalize(getOption('baseUrl') || '/');\n }\n PageConfig.getBaseUrl = getBaseUrl;\n /**\n * Get the tree url for a JupyterLab application.\n */\n function getTreeUrl() {\n return url_1.URLExt.join(getBaseUrl(), getOption('treeUrl'));\n }\n PageConfig.getTreeUrl = getTreeUrl;\n /**\n * Get the base url for sharing links (usually baseUrl)\n */\n function getShareUrl() {\n return url_1.URLExt.normalize(getOption('shareUrl') || getBaseUrl());\n }\n PageConfig.getShareUrl = getShareUrl;\n /**\n * Get the tree url for shareable links.\n * Usually the same as treeUrl,\n * but overrideable e.g. when sharing with JupyterHub.\n */\n function getTreeShareUrl() {\n return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(), getOption('treeUrl')));\n }\n PageConfig.getTreeShareUrl = getTreeShareUrl;\n /**\n * Create a new URL given an optional mode and tree path.\n *\n * This is used to create URLS when the mode or tree path change as the user\n * changes mode or the current document in the main area. If fields in\n * options are omitted, the value in PageConfig will be used.\n *\n * @param options - IGetUrlOptions for the new path.\n */\n function getUrl(options) {\n var _a, _b, _c, _d;\n let path = options.toShare ? getShareUrl() : getBaseUrl();\n const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : getOption('mode');\n const workspace = (_b = options.workspace) !== null && _b !== void 0 ? _b : getOption('workspace');\n const labOrDoc = mode === 'single-document' ? 'doc' : 'lab';\n path = url_1.URLExt.join(path, labOrDoc);\n if (workspace !== PageConfig.defaultWorkspace) {\n path = url_1.URLExt.join(path, 'workspaces', encodeURIComponent((_c = getOption('workspace')) !== null && _c !== void 0 ? _c : PageConfig.defaultWorkspace));\n }\n const treePath = (_d = options.treePath) !== null && _d !== void 0 ? _d : getOption('treePath');\n if (treePath) {\n path = url_1.URLExt.join(path, 'tree', url_1.URLExt.encodeParts(treePath));\n }\n return path;\n }\n PageConfig.getUrl = getUrl;\n PageConfig.defaultWorkspace = 'default';\n /**\n * Get the base websocket url for a Jupyter application, or an empty string.\n */\n function getWsUrl(baseUrl) {\n let wsUrl = getOption('wsUrl');\n if (!wsUrl) {\n baseUrl = baseUrl ? url_1.URLExt.normalize(baseUrl) : getBaseUrl();\n if (baseUrl.indexOf('http') !== 0) {\n return '';\n }\n wsUrl = 'ws' + baseUrl.slice(4);\n }\n return url_1.URLExt.normalize(wsUrl);\n }\n PageConfig.getWsUrl = getWsUrl;\n /**\n * Returns the URL converting this notebook to a certain\n * format with nbconvert.\n */\n function getNBConvertURL({ path, format, download }) {\n const notebookPath = url_1.URLExt.encodeParts(path);\n const url = url_1.URLExt.join(getBaseUrl(), 'nbconvert', format, notebookPath);\n if (download) {\n return url + '?download=true';\n }\n return url;\n }\n PageConfig.getNBConvertURL = getNBConvertURL;\n /**\n * Get the authorization token for a Jupyter application.\n */\n function getToken() {\n return getOption('token') || getBodyData('jupyterApiToken');\n }\n PageConfig.getToken = getToken;\n /**\n * Get the Notebook version info [major, minor, patch].\n */\n function getNotebookVersion() {\n const notebookVersion = getOption('notebookVersion');\n if (notebookVersion === '') {\n return [0, 0, 0];\n }\n return JSON.parse(notebookVersion);\n }\n PageConfig.getNotebookVersion = getNotebookVersion;\n /**\n * Private page config data for the Jupyter application.\n */\n let configData = null;\n /**\n * Get a url-encoded item from `body.data` and decode it\n * We should never have any encoded URLs anywhere else in code\n * until we are building an actual request.\n */\n function getBodyData(key) {\n if (typeof document === 'undefined' || !document.body) {\n return '';\n }\n const val = document.body.dataset[key];\n if (typeof val === 'undefined') {\n return '';\n }\n return decodeURIComponent(val);\n }\n /**\n * The namespace for page config `Extension` functions.\n */\n let Extension;\n (function (Extension) {\n /**\n * Populate an array from page config.\n *\n * @param key - The page config key (e.g., `deferredExtensions`).\n *\n * #### Notes\n * This is intended for `deferredExtensions` and `disabledExtensions`.\n */\n function populate(key) {\n try {\n const raw = getOption(key);\n if (raw) {\n return JSON.parse(raw);\n }\n }\n catch (error) {\n console.warn(`Unable to parse ${key}.`, error);\n }\n return [];\n }\n /**\n * The collection of deferred extensions in page config.\n */\n Extension.deferred = populate('deferredExtensions');\n /**\n * The collection of disabled extensions in page config.\n */\n Extension.disabled = populate('disabledExtensions');\n /**\n * Returns whether a plugin is deferred.\n *\n * @param id - The plugin ID.\n */\n function isDeferred(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.deferred.some(val => val === id || (extName && val === extName));\n }\n Extension.isDeferred = isDeferred;\n /**\n * Returns whether a plugin is disabled.\n *\n * @param id - The plugin ID.\n */\n function isDisabled(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.disabled.some(val => val === id || (extName && val === extName));\n }\n Extension.isDisabled = isDisabled;\n })(Extension = PageConfig.Extension || (PageConfig.Extension = {}));\n})(PageConfig || (exports.PageConfig = PageConfig = {}));\n//# sourceMappingURL=pageconfig.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PathExt = void 0;\nconst path_1 = require(\"path\");\n/**\n * The namespace for path-related functions.\n *\n * Note that Jupyter server paths do not start with a leading slash.\n */\nvar PathExt;\n(function (PathExt) {\n /**\n * Join all arguments together and normalize the resulting path.\n * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.\n *\n * @param paths - The string paths to join.\n */\n function join(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : removeSlash(path);\n }\n PathExt.join = join;\n /**\n * Join all arguments together and normalize the resulting path and preserve the leading slash.\n *\n * @param paths - The string paths to join.\n */\n function joinWithLeadingSlash(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : path;\n }\n PathExt.joinWithLeadingSlash = joinWithLeadingSlash;\n /**\n * Return the last portion of a path. Similar to the Unix basename command.\n * Often used to extract the file name from a fully qualified path.\n *\n * @param path - The path to evaluate.\n *\n * @param ext - An extension to remove from the result.\n */\n function basename(path, ext) {\n return path_1.posix.basename(path, ext);\n }\n PathExt.basename = basename;\n /**\n * Get the directory name of a path, similar to the Unix dirname command.\n * When an empty path is given, returns the root path.\n *\n * @param path - The file path.\n */\n function dirname(path) {\n const dir = removeSlash(path_1.posix.dirname(path));\n return dir === '.' ? '' : dir;\n }\n PathExt.dirname = dirname;\n /**\n * Get the extension of the path.\n *\n * @param path - The file path.\n *\n * @returns the extension of the file.\n *\n * #### Notes\n * The extension is the string from the last occurrence of the `.`\n * character to end of string in the last portion of the path, inclusive.\n * If there is no `.` in the last portion of the path, or if the first\n * character of the basename of path [[basename]] is `.`, then an\n * empty string is returned.\n */\n function extname(path) {\n return path_1.posix.extname(path);\n }\n PathExt.extname = extname;\n /**\n * Normalize a string path, reducing '..' and '.' parts.\n * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.\n * When an empty path is given, returns the root path.\n *\n * @param path - The string path to normalize.\n */\n function normalize(path) {\n if (path === '') {\n return '';\n }\n return removeSlash(path_1.posix.normalize(path));\n }\n PathExt.normalize = normalize;\n /**\n * Resolve a sequence of paths or path segments into an absolute path.\n * The root path in the application has no leading slash, so it is removed.\n *\n * @param parts - The paths to join.\n *\n * #### Notes\n * The right-most parameter is considered \\{to\\}. Other parameters are considered an array of \\{from\\}.\n *\n * Starting from leftmost \\{from\\} parameter, resolves \\{to\\} to an absolute path.\n *\n * If \\{to\\} isn't already absolute, \\{from\\} arguments are prepended in right to left order, until an absolute path is found. If after using all \\{from\\} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.\n */\n function resolve(...parts) {\n return removeSlash(path_1.posix.resolve(...parts));\n }\n PathExt.resolve = resolve;\n /**\n * Solve the relative path from \\{from\\} to \\{to\\}.\n *\n * @param from - The source path.\n *\n * @param to - The target path.\n *\n * #### Notes\n * If from and to each resolve to the same path (after calling\n * path.resolve() on each), a zero-length string is returned.\n * If a zero-length string is passed as from or to, `/`\n * will be used instead of the zero-length strings.\n */\n function relative(from, to) {\n return removeSlash(path_1.posix.relative(from, to));\n }\n PathExt.relative = relative;\n /**\n * Normalize a file extension to be of the type `'.foo'`.\n *\n * @param extension - the file extension.\n *\n * #### Notes\n * Adds a leading dot if not present and converts to lower case.\n */\n function normalizeExtension(extension) {\n if (extension.length > 0 && extension.indexOf('.') !== 0) {\n extension = `.${extension}`;\n }\n return extension;\n }\n PathExt.normalizeExtension = normalizeExtension;\n /**\n * Remove the leading slash from a path.\n *\n * @param path the path from which to remove a leading slash.\n */\n function removeSlash(path) {\n if (path.indexOf('/') === 0) {\n path = path.slice(1);\n }\n return path;\n }\n PathExt.removeSlash = removeSlash;\n})(PathExt || (exports.PathExt = PathExt = {}));\n//# sourceMappingURL=path.js.map","\"use strict\";\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signalToPromise = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\n/**\n * Convert a signal into a promise for the first emitted value.\n *\n * @param signal - The signal we are listening to.\n * @param timeout - Timeout to wait for signal in ms (not timeout if not defined or 0)\n *\n * @returns a Promise that resolves with a `(sender, args)` pair.\n */\nfunction signalToPromise(signal, timeout) {\n const waitForSignal = new coreutils_1.PromiseDelegate();\n function cleanup() {\n signal.disconnect(slot);\n }\n function slot(sender, args) {\n cleanup();\n waitForSignal.resolve([sender, args]);\n }\n signal.connect(slot);\n if ((timeout !== null && timeout !== void 0 ? timeout : 0) > 0) {\n setTimeout(() => {\n cleanup();\n waitForSignal.reject(`Signal not emitted within ${timeout} ms.`);\n }, timeout);\n }\n return waitForSignal.promise;\n}\nexports.signalToPromise = signalToPromise;\n//# sourceMappingURL=signal.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Text = void 0;\n/**\n * The namespace for text-related functions.\n */\nvar Text;\n(function (Text) {\n // javascript stores text as utf16 and string indices use \"code units\",\n // which stores high-codepoint characters as \"surrogate pairs\",\n // which occupy two indices in the javascript string.\n // We need to translate cursor_pos in the Jupyter protocol (in characters)\n // to js offset (with surrogate pairs taking two spots).\n const HAS_SURROGATES = '𝐚'.length > 1;\n /**\n * Convert a javascript string index into a unicode character offset\n *\n * @param jsIdx - The javascript string index (counting surrogate pairs)\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The unicode character offset\n */\n function jsIndexToCharIndex(jsIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return jsIdx;\n }\n let charIdx = jsIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n charIdx--;\n i++;\n }\n }\n }\n return charIdx;\n }\n Text.jsIndexToCharIndex = jsIndexToCharIndex;\n /**\n * Convert a unicode character offset to a javascript string index.\n *\n * @param charIdx - The index in unicode characters\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The js-native index\n */\n function charIndexToJsIndex(charIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return charIdx;\n }\n let jsIdx = charIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n jsIdx++;\n i++;\n }\n }\n }\n return jsIdx;\n }\n Text.charIndexToJsIndex = charIndexToJsIndex;\n /**\n * Given a 'snake-case', 'snake_case', 'snake:case', or\n * 'snake case' string, will return the camel case version: 'snakeCase'.\n *\n * @param str the snake-case input string.\n *\n * @param upper default = false. If true, the first letter of the\n * returned string will be capitalized.\n *\n * @returns the camel case version of the input string.\n */\n function camelCase(str, upper = false) {\n return str.replace(/^(\\w)|[\\s-_:]+(\\w)/g, function (match, p1, p2) {\n if (p2) {\n return p2.toUpperCase();\n }\n else {\n return upper ? p1.toUpperCase() : p1.toLowerCase();\n }\n });\n }\n Text.camelCase = camelCase;\n /**\n * Given a string, title case the words in the string.\n *\n * @param str the string to title case.\n *\n * @returns the same string, but with each word capitalized.\n */\n function titleCase(str) {\n return (str || '')\n .toLowerCase()\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n Text.titleCase = titleCase;\n})(Text || (exports.Text = Text = {}));\n//# sourceMappingURL=text.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Time = void 0;\n/**\n * A list of time units with their associated value in milliseconds.\n */\nconst UNITS = [\n { name: 'years', milliseconds: 365 * 24 * 60 * 60 * 1000 },\n { name: 'months', milliseconds: 30 * 24 * 60 * 60 * 1000 },\n { name: 'days', milliseconds: 24 * 60 * 60 * 1000 },\n { name: 'hours', milliseconds: 60 * 60 * 1000 },\n { name: 'minutes', milliseconds: 60 * 1000 },\n { name: 'seconds', milliseconds: 1000 }\n];\n/**\n * The namespace for date functions.\n */\nvar Time;\n(function (Time) {\n /**\n * Convert a timestring to a human readable string (e.g. 'two minutes ago').\n *\n * @param value - The date timestring or date object.\n *\n * @returns A formatted date.\n */\n function formatHuman(value, format = 'long') {\n const lang = document.documentElement.lang || 'en';\n const formatter = new Intl.RelativeTimeFormat(lang, {\n numeric: 'auto',\n style: format\n });\n const delta = new Date(value).getTime() - Date.now();\n for (let unit of UNITS) {\n const amount = Math.ceil(delta / unit.milliseconds);\n if (amount === 0) {\n continue;\n }\n return formatter.format(amount, unit.name);\n }\n return formatter.format(0, 'seconds');\n }\n Time.formatHuman = formatHuman;\n /**\n * Convenient helper to convert a timestring to a date format.\n *\n * @param value - The date timestring or date object.\n *\n * @returns A formatted date.\n */\n function format(value) {\n const lang = document.documentElement.lang || 'en';\n const formatter = new Intl.DateTimeFormat(lang, {\n dateStyle: 'short',\n timeStyle: 'short'\n });\n return formatter.format(new Date(value));\n }\n Time.format = format;\n})(Time || (exports.Time = Time = {}));\n//# sourceMappingURL=time.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.URLExt = void 0;\nconst path_1 = require(\"path\");\nconst url_parse_1 = __importDefault(require(\"url-parse\"));\n/**\n * The namespace for URL-related functions.\n */\nvar URLExt;\n(function (URLExt) {\n /**\n * Parse a url into a URL object.\n *\n * @param url - The URL string to parse.\n *\n * @returns A URL object.\n */\n function parse(url) {\n if (typeof document !== 'undefined' && document) {\n const a = document.createElement('a');\n a.href = url;\n return a;\n }\n return (0, url_parse_1.default)(url);\n }\n URLExt.parse = parse;\n /**\n * Parse URL and retrieve hostname\n *\n * @param url - The URL string to parse\n *\n * @returns a hostname string value\n */\n function getHostName(url) {\n return (0, url_parse_1.default)(url).hostname;\n }\n URLExt.getHostName = getHostName;\n function normalize(url) {\n return url && parse(url).toString();\n }\n URLExt.normalize = normalize;\n /**\n * Join a sequence of url components and normalizes as in node `path.join`.\n *\n * @param parts - The url components.\n *\n * @returns the joined url.\n */\n function join(...parts) {\n let u = (0, url_parse_1.default)(parts[0], {});\n // Schema-less URL can be only parsed as relative to a base URL\n // see https://github.com/unshiftio/url-parse/issues/219#issuecomment-1002219326\n const isSchemaLess = u.protocol === '' && u.slashes;\n if (isSchemaLess) {\n u = (0, url_parse_1.default)(parts[0], 'https:' + parts[0]);\n }\n const prefix = `${isSchemaLess ? '' : u.protocol}${u.slashes ? '//' : ''}${u.auth}${u.auth ? '@' : ''}${u.host}`;\n // If there was a prefix, then the first path must start at the root.\n const path = path_1.posix.join(`${!!prefix && u.pathname[0] !== '/' ? '/' : ''}${u.pathname}`, ...parts.slice(1));\n return `${prefix}${path === '.' ? '' : path}`;\n }\n URLExt.join = join;\n /**\n * Encode the components of a multi-segment url.\n *\n * @param url - The url to encode.\n *\n * @returns the encoded url.\n *\n * #### Notes\n * Preserves the `'/'` separators.\n * Should not include the base url, since all parts are escaped.\n */\n function encodeParts(url) {\n return join(...url.split('/').map(encodeURIComponent));\n }\n URLExt.encodeParts = encodeParts;\n /**\n * Return a serialized object string suitable for a query.\n *\n * @param value The source object.\n *\n * @returns an encoded url query.\n *\n * #### Notes\n * Modified version of [stackoverflow](http://stackoverflow.com/a/30707423).\n */\n function objectToQueryString(value) {\n const keys = Object.keys(value).filter(key => key.length > 0);\n if (!keys.length) {\n return '';\n }\n return ('?' +\n keys\n .map(key => {\n const content = encodeURIComponent(String(value[key]));\n return key + (content ? '=' + content : '');\n })\n .join('&'));\n }\n URLExt.objectToQueryString = objectToQueryString;\n /**\n * Return a parsed object that represents the values in a query string.\n */\n function queryStringToObject(value) {\n return value\n .replace(/^\\?/, '')\n .split('&')\n .reduce((acc, val) => {\n const [key, value] = val.split('=');\n if (key.length > 0) {\n acc[key] = decodeURIComponent(value || '');\n }\n return acc;\n }, {});\n }\n URLExt.queryStringToObject = queryStringToObject;\n /**\n * Test whether the url is a local url.\n *\n * @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted.\n *\n * #### Notes\n * This function returns `false` for any fully qualified url, including\n * `data:`, `file:`, and `//` protocol URLs.\n */\n function isLocal(url, allowRoot = false) {\n const { protocol } = parse(url);\n return ((!protocol || url.toLowerCase().indexOf(protocol) !== 0) &&\n (allowRoot ? url.indexOf('//') !== 0 : url.indexOf('/') !== 0));\n }\n URLExt.isLocal = isLocal;\n})(URLExt || (exports.URLExt = URLExt = {}));\n//# sourceMappingURL=url.js.map","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_coreutils = {}));\n})(this, (function (exports) { 'use strict';\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for JSON-specific functions.\n */\n exports.JSONExt = void 0;\n (function (JSONExt) {\n /**\n * A shared frozen empty JSONObject\n */\n JSONExt.emptyObject = Object.freeze({});\n /**\n * A shared frozen empty JSONArray\n */\n JSONExt.emptyArray = Object.freeze([]);\n /**\n * Test whether a JSON value is a primitive.\n *\n * @param value - The JSON value of interest.\n *\n * @returns `true` if the value is a primitive,`false` otherwise.\n */\n function isPrimitive(value) {\n return (value === null ||\n typeof value === 'boolean' ||\n typeof value === 'number' ||\n typeof value === 'string');\n }\n JSONExt.isPrimitive = isPrimitive;\n function isArray(value) {\n return Array.isArray(value);\n }\n JSONExt.isArray = isArray;\n function isObject(value) {\n return !isPrimitive(value) && !isArray(value);\n }\n JSONExt.isObject = isObject;\n /**\n * Compare two JSON values for deep equality.\n *\n * @param first - The first JSON value of interest.\n *\n * @param second - The second JSON value of interest.\n *\n * @returns `true` if the values are equivalent, `false` otherwise.\n */\n function deepEqual(first, second) {\n // Check referential and primitive equality first.\n if (first === second) {\n return true;\n }\n // If one is a primitive, the `===` check ruled out the other.\n if (isPrimitive(first) || isPrimitive(second)) {\n return false;\n }\n // Test whether they are arrays.\n let a1 = isArray(first);\n let a2 = isArray(second);\n // Bail if the types are different.\n if (a1 !== a2) {\n return false;\n }\n // If they are both arrays, compare them.\n if (a1 && a2) {\n return deepArrayEqual(first, second);\n }\n // At this point, they must both be objects.\n return deepObjectEqual(first, second);\n }\n JSONExt.deepEqual = deepEqual;\n /**\n * Create a deep copy of a JSON value.\n *\n * @param value - The JSON value to copy.\n *\n * @returns A deep copy of the given JSON value.\n */\n function deepCopy(value) {\n // Do nothing for primitive values.\n if (isPrimitive(value)) {\n return value;\n }\n // Deep copy an array.\n if (isArray(value)) {\n return deepArrayCopy(value);\n }\n // Deep copy an object.\n return deepObjectCopy(value);\n }\n JSONExt.deepCopy = deepCopy;\n /**\n * Compare two JSON arrays for deep equality.\n */\n function deepArrayEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Test the arrays for equal length.\n if (first.length !== second.length) {\n return false;\n }\n // Compare the values for equality.\n for (let i = 0, n = first.length; i < n; ++i) {\n if (!deepEqual(first[i], second[i])) {\n return false;\n }\n }\n // At this point, the arrays are equal.\n return true;\n }\n /**\n * Compare two JSON objects for deep equality.\n */\n function deepObjectEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Check for the first object's keys in the second object.\n for (let key in first) {\n if (first[key] !== undefined && !(key in second)) {\n return false;\n }\n }\n // Check for the second object's keys in the first object.\n for (let key in second) {\n if (second[key] !== undefined && !(key in first)) {\n return false;\n }\n }\n // Compare the values for equality.\n for (let key in first) {\n // Get the values.\n let firstValue = first[key];\n let secondValue = second[key];\n // If both are undefined, ignore the key.\n if (firstValue === undefined && secondValue === undefined) {\n continue;\n }\n // If only one value is undefined, the objects are not equal.\n if (firstValue === undefined || secondValue === undefined) {\n return false;\n }\n // Compare the values.\n if (!deepEqual(firstValue, secondValue)) {\n return false;\n }\n }\n // At this point, the objects are equal.\n return true;\n }\n /**\n * Create a deep copy of a JSON array.\n */\n function deepArrayCopy(value) {\n let result = new Array(value.length);\n for (let i = 0, n = value.length; i < n; ++i) {\n result[i] = deepCopy(value[i]);\n }\n return result;\n }\n /**\n * Create a deep copy of a JSON object.\n */\n function deepObjectCopy(value) {\n let result = {};\n for (let key in value) {\n // Ignore undefined values.\n let subvalue = value[key];\n if (subvalue === undefined) {\n continue;\n }\n result[key] = deepCopy(subvalue);\n }\n return result;\n }\n })(exports.JSONExt || (exports.JSONExt = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * An object which stores MIME data for general application use.\n *\n * #### Notes\n * This class does not attempt to enforce \"correctness\" of MIME types\n * and their associated data. Since this class is designed to transfer\n * arbitrary data and objects within the same application, it assumes\n * that the user provides correct and accurate data.\n */\n class MimeData {\n constructor() {\n this._types = [];\n this._values = [];\n }\n /**\n * Get an array of the MIME types contained within the dataset.\n *\n * @returns A new array of the MIME types, in order of insertion.\n */\n types() {\n return this._types.slice();\n }\n /**\n * Test whether the dataset has an entry for the given type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns `true` if the dataset contains a value for the given\n * MIME type, `false` otherwise.\n */\n hasData(mime) {\n return this._types.indexOf(mime) !== -1;\n }\n /**\n * Get the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns The value for the given MIME type, or `undefined` if\n * the dataset does not contain a value for the type.\n */\n getData(mime) {\n let i = this._types.indexOf(mime);\n return i !== -1 ? this._values[i] : undefined;\n }\n /**\n * Set the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @param data - The data value for the given MIME type.\n *\n * #### Notes\n * This will overwrite any previous entry for the MIME type.\n */\n setData(mime, data) {\n this.clearData(mime);\n this._types.push(mime);\n this._values.push(data);\n }\n /**\n * Remove the data entry for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * #### Notes\n * This is a no-op if there is no entry for the given MIME type.\n */\n clearData(mime) {\n let i = this._types.indexOf(mime);\n if (i !== -1) {\n this._types.splice(i, 1);\n this._values.splice(i, 1);\n }\n }\n /**\n * Remove all data entries from the dataset.\n */\n clear() {\n this._types.length = 0;\n this._values.length = 0;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A class which wraps a promise into a delegate object.\n *\n * #### Notes\n * This class is useful when the logic to resolve or reject a promise\n * cannot be defined at the point where the promise is created.\n */\n class PromiseDelegate {\n /**\n * Construct a new promise delegate.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n /**\n * Resolve the wrapped promise with the given value.\n *\n * @param value - The value to use for resolving the promise.\n */\n resolve(value) {\n let resolve = this._resolve;\n resolve(value);\n }\n /**\n * Reject the wrapped promise with the given value.\n *\n * @reason - The reason for rejecting the promise.\n */\n reject(reason) {\n let reject = this._reject;\n reject(reason);\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A runtime object which captures compile-time type information.\n *\n * #### Notes\n * A token captures the compile-time type of an interface or class in\n * an object which can be used at runtime in a type-safe fashion.\n */\n class Token {\n /**\n * Construct a new token.\n *\n * @param name - A human readable name for the token.\n * @param description - Token purpose description for documentation.\n */\n constructor(name, description) {\n this.name = name;\n this.description = description !== null && description !== void 0 ? description : '';\n this._tokenStructuralPropertyT = null;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n // Fallback\n function fallbackRandomValues(buffer) {\n let value = 0;\n for (let i = 0, n = buffer.length; i < n; ++i) {\n if (i % 4 === 0) {\n value = (Math.random() * 0xffffffff) >>> 0;\n }\n buffer[i] = value & 0xff;\n value >>>= 8;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for random number related functionality.\n */\n exports.Random = void 0;\n (function (Random) {\n /**\n * A function which generates random bytes.\n *\n * @param buffer - The `Uint8Array` to fill with random bytes.\n *\n * #### Notes\n * A cryptographically strong random number generator will be used if\n * available. Otherwise, `Math.random` will be used as a fallback for\n * randomness.\n *\n * The following RNGs are supported, listed in order of precedence:\n * - `window.crypto.getRandomValues`\n * - `window.msCrypto.getRandomValues`\n * - `require('crypto').randomFillSync\n * - `require('crypto').randomBytes\n * - `Math.random`\n */\n Random.getRandomValues = (() => {\n // Look up the crypto module if available.\n const crypto = (typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||\n null;\n // Modern browsers and IE 11\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return function getRandomValues(buffer) {\n return crypto.getRandomValues(buffer);\n };\n }\n // Fallback\n return fallbackRandomValues;\n })();\n })(exports.Random || (exports.Random = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A function which creates a function that generates UUID v4 identifiers.\n *\n * @returns A new function that creates a UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n function uuid4Factory(getRandomValues) {\n // Create a 16 byte array to hold the random values.\n const bytes = new Uint8Array(16);\n // Create a look up table from bytes to hex strings.\n const lut = new Array(256);\n // Pad the single character hex digits with a leading zero.\n for (let i = 0; i < 16; ++i) {\n lut[i] = '0' + i.toString(16);\n }\n // Populate the rest of the hex digits.\n for (let i = 16; i < 256; ++i) {\n lut[i] = i.toString(16);\n }\n // Return a function which generates the UUID.\n return function uuid4() {\n // Get a new batch of random values.\n getRandomValues(bytes);\n // Set the UUID version number to 4.\n bytes[6] = 0x40 | (bytes[6] & 0x0f);\n // Set the clock sequence bit to the RFC spec.\n bytes[8] = 0x80 | (bytes[8] & 0x3f);\n // Assemble the UUID string.\n return (lut[bytes[0]] +\n lut[bytes[1]] +\n lut[bytes[2]] +\n lut[bytes[3]] +\n '-' +\n lut[bytes[4]] +\n lut[bytes[5]] +\n '-' +\n lut[bytes[6]] +\n lut[bytes[7]] +\n '-' +\n lut[bytes[8]] +\n lut[bytes[9]] +\n '-' +\n lut[bytes[10]] +\n lut[bytes[11]] +\n lut[bytes[12]] +\n lut[bytes[13]] +\n lut[bytes[14]] +\n lut[bytes[15]]);\n };\n }\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for UUID related functionality.\n */\n exports.UUID = void 0;\n (function (UUID) {\n /**\n * A function which generates UUID v4 identifiers.\n *\n * @returns A new UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n UUID.uuid4 = uuid4Factory(exports.Random.getRandomValues);\n })(exports.UUID || (exports.UUID = {}));\n\n exports.MimeData = MimeData;\n exports.PromiseDelegate = PromiseDelegate;\n exports.Token = Token;\n\n}));\n//# sourceMappingURL=index.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty<number>();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","import { find, ArrayExt } from '@lumino/algorithm';\nimport { PromiseDelegate } from '@lumino/coreutils';\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module signaling\n */\n/**\n * A concrete implementation of `ISignal`.\n *\n * #### Example\n * ```typescript\n * import { ISignal, Signal } from '@lumino/signaling';\n *\n * class SomeClass {\n *\n * constructor(name: string) {\n * this.name = name;\n * }\n *\n * readonly name: string;\n *\n * get valueChanged: ISignal<this, number> {\n * return this._valueChanged;\n * }\n *\n * get value(): number {\n * return this._value;\n * }\n *\n * set value(value: number) {\n * if (value === this._value) {\n * return;\n * }\n * this._value = value;\n * this._valueChanged.emit(value);\n * }\n *\n * private _value = 0;\n * private _valueChanged = new Signal<this, number>(this);\n * }\n *\n * function logger(sender: SomeClass, value: number): void {\n * console.log(sender.name, value);\n * }\n *\n * let m1 = new SomeClass('foo');\n * let m2 = new SomeClass('bar');\n *\n * m1.valueChanged.connect(logger);\n * m2.valueChanged.connect(logger);\n *\n * m1.value = 42; // logs: foo 42\n * m2.value = 17; // logs: bar 17\n * ```\n */\nclass Signal {\n /**\n * Construct a new signal.\n *\n * @param sender - The sender which owns the signal.\n */\n constructor(sender) {\n this.sender = sender;\n }\n /**\n * Connect a slot to the signal.\n *\n * @param slot - The slot to invoke when the signal is emitted.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection succeeds, `false` otherwise.\n */\n connect(slot, thisArg) {\n return Private.connect(this, slot, thisArg);\n }\n /**\n * Disconnect a slot from the signal.\n *\n * @param slot - The slot to disconnect from the signal.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection is removed, `false` otherwise.\n */\n disconnect(slot, thisArg) {\n return Private.disconnect(this, slot, thisArg);\n }\n /**\n * Emit the signal and invoke the connected slots.\n *\n * @param args - The args to pass to the connected slots.\n *\n * #### Notes\n * Slots are invoked synchronously in connection order.\n *\n * Exceptions thrown by connected slots will be caught and logged.\n */\n emit(args) {\n Private.emit(this, args);\n }\n}\n/**\n * The namespace for the `Signal` class statics.\n */\n(function (Signal) {\n /**\n * Remove all connections between a sender and receiver.\n *\n * @param sender - The sender object of interest.\n *\n * @param receiver - The receiver object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectBetween(sender, receiver) {\n Private.disconnectBetween(sender, receiver);\n }\n Signal.disconnectBetween = disconnectBetween;\n /**\n * Remove all connections where the given object is the sender.\n *\n * @param sender - The sender object of interest.\n */\n function disconnectSender(sender) {\n Private.disconnectSender(sender);\n }\n Signal.disconnectSender = disconnectSender;\n /**\n * Remove all connections where the given object is the receiver.\n *\n * @param receiver - The receiver object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectReceiver(receiver) {\n Private.disconnectReceiver(receiver);\n }\n Signal.disconnectReceiver = disconnectReceiver;\n /**\n * Remove all connections where an object is the sender or receiver.\n *\n * @param object - The object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectAll(object) {\n Private.disconnectAll(object);\n }\n Signal.disconnectAll = disconnectAll;\n /**\n * Clear all signal data associated with the given object.\n *\n * @param object - The object for which the data should be cleared.\n *\n * #### Notes\n * This removes all signal connections and any other signal data\n * associated with the object.\n */\n function clearData(object) {\n Private.disconnectAll(object);\n }\n Signal.clearData = clearData;\n /**\n * Get the signal exception handler.\n *\n * @returns The current exception handler.\n *\n * #### Notes\n * The default exception handler is `console.error`.\n */\n function getExceptionHandler() {\n return Private.exceptionHandler;\n }\n Signal.getExceptionHandler = getExceptionHandler;\n /**\n * Set the signal exception handler.\n *\n * @param handler - The function to use as the exception handler.\n *\n * @returns The old exception handler.\n *\n * #### Notes\n * The exception handler is invoked when a slot throws an exception.\n */\n function setExceptionHandler(handler) {\n let old = Private.exceptionHandler;\n Private.exceptionHandler = handler;\n return old;\n }\n Signal.setExceptionHandler = setExceptionHandler;\n})(Signal || (Signal = {}));\n/**\n * A concrete implementation of `IStream`.\n *\n * #### Example\n * ```typescript\n * import { IStream, Stream } from '@lumino/signaling';\n *\n * class SomeClass {\n *\n * constructor(name: string) {\n * this.name = name;\n * }\n *\n * readonly name: string;\n *\n * get pings(): IStream<this, string> {\n * return this._pings;\n * }\n *\n * ping(value: string) {\n * this._pings.emit(value);\n * }\n *\n * private _pings = new Stream<this, string>(this);\n * }\n *\n * let m1 = new SomeClass('foo');\n *\n * m1.pings.connect((_, value: string) => {\n * console.log('connect', value);\n * });\n *\n * void (async () => {\n * for await (const ping of m1.pings) {\n * console.log('iterator', ping);\n * }\n * })();\n *\n * m1.ping('alpha'); // logs: connect alpha\n * // logs: iterator alpha\n * m1.ping('beta'); // logs: connect beta\n * // logs: iterator beta\n * ```\n */\nclass Stream extends Signal {\n constructor() {\n super(...arguments);\n this._pending = new PromiseDelegate();\n }\n /**\n * Return an async iterator that yields every emission.\n */\n async *[Symbol.asyncIterator]() {\n let pending = this._pending;\n while (true) {\n try {\n const { args, next } = await pending.promise;\n pending = next;\n yield args;\n }\n catch (_) {\n return; // Any promise rejection stops the iterator.\n }\n }\n }\n /**\n * Emit the signal, invoke the connected slots, and yield the emission.\n *\n * @param args - The args to pass to the connected slots.\n */\n emit(args) {\n const pending = this._pending;\n const next = (this._pending = new PromiseDelegate());\n pending.resolve({ args, next });\n super.emit(args);\n }\n /**\n * Stop the stream's async iteration.\n */\n stop() {\n this._pending.promise.catch(() => undefined);\n this._pending.reject('stop');\n this._pending = new PromiseDelegate();\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The signal exception handler function.\n */\n Private.exceptionHandler = (err) => {\n console.error(err);\n };\n /**\n * Connect a slot to a signal.\n *\n * @param signal - The signal of interest.\n *\n * @param slot - The slot to invoke when the signal is emitted.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection succeeds, `false` otherwise.\n */\n function connect(signal, slot, thisArg) {\n // Coerce a `null` `thisArg` to `undefined`.\n thisArg = thisArg || undefined;\n // Ensure the sender's array of receivers is created.\n let receivers = receiversForSender.get(signal.sender);\n if (!receivers) {\n receivers = [];\n receiversForSender.set(signal.sender, receivers);\n }\n // Bail if a matching connection already exists.\n if (findConnection(receivers, signal, slot, thisArg)) {\n return false;\n }\n // Choose the best object for the receiver.\n let receiver = thisArg || slot;\n // Ensure the receiver's array of senders is created.\n let senders = sendersForReceiver.get(receiver);\n if (!senders) {\n senders = [];\n sendersForReceiver.set(receiver, senders);\n }\n // Create a new connection and add it to the end of each array.\n let connection = { signal, slot, thisArg };\n receivers.push(connection);\n senders.push(connection);\n // Indicate a successful connection.\n return true;\n }\n Private.connect = connect;\n /**\n * Disconnect a slot from a signal.\n *\n * @param signal - The signal of interest.\n *\n * @param slot - The slot to disconnect from the signal.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection is removed, `false` otherwise.\n */\n function disconnect(signal, slot, thisArg) {\n // Coerce a `null` `thisArg` to `undefined`.\n thisArg = thisArg || undefined;\n // Lookup the list of receivers, and bail if none exist.\n let receivers = receiversForSender.get(signal.sender);\n if (!receivers || receivers.length === 0) {\n return false;\n }\n // Bail if no matching connection exits.\n let connection = findConnection(receivers, signal, slot, thisArg);\n if (!connection) {\n return false;\n }\n // Choose the best object for the receiver.\n let receiver = thisArg || slot;\n // Lookup the array of senders, which is now known to exist.\n let senders = sendersForReceiver.get(receiver);\n // Clear the connection and schedule cleanup of the arrays.\n connection.signal = null;\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n // Indicate a successful disconnection.\n return true;\n }\n Private.disconnect = disconnect;\n /**\n * Remove all connections between a sender and receiver.\n *\n * @param sender - The sender object of interest.\n *\n * @param receiver - The receiver object of interest.\n */\n function disconnectBetween(sender, receiver) {\n // If there are no receivers, there is nothing to do.\n let receivers = receiversForSender.get(sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // If there are no senders, there is nothing to do.\n let senders = sendersForReceiver.get(receiver);\n if (!senders || senders.length === 0) {\n return;\n }\n // Clear each connection between the sender and receiver.\n for (const connection of senders) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n continue;\n }\n // Clear the connection if it matches the sender.\n if (connection.signal.sender === sender) {\n connection.signal = null;\n }\n }\n // Schedule a cleanup of the senders and receivers.\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n }\n Private.disconnectBetween = disconnectBetween;\n /**\n * Remove all connections where the given object is the sender.\n *\n * @param sender - The sender object of interest.\n */\n function disconnectSender(sender) {\n // If there are no receivers, there is nothing to do.\n let receivers = receiversForSender.get(sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // Clear each receiver connection.\n for (const connection of receivers) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n continue;\n }\n // Choose the best object for the receiver.\n let receiver = connection.thisArg || connection.slot;\n // Clear the connection.\n connection.signal = null;\n // Cleanup the array of senders, which is now known to exist.\n scheduleCleanup(sendersForReceiver.get(receiver));\n }\n // Schedule a cleanup of the receivers.\n scheduleCleanup(receivers);\n }\n Private.disconnectSender = disconnectSender;\n /**\n * Remove all connections where the given object is the receiver.\n *\n * @param receiver - The receiver object of interest.\n */\n function disconnectReceiver(receiver) {\n // If there are no senders, there is nothing to do.\n let senders = sendersForReceiver.get(receiver);\n if (!senders || senders.length === 0) {\n return;\n }\n // Clear each sender connection.\n for (const connection of senders) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n continue;\n }\n // Lookup the sender for the connection.\n let sender = connection.signal.sender;\n // Clear the connection.\n connection.signal = null;\n // Cleanup the array of receivers, which is now known to exist.\n scheduleCleanup(receiversForSender.get(sender));\n }\n // Schedule a cleanup of the list of senders.\n scheduleCleanup(senders);\n }\n Private.disconnectReceiver = disconnectReceiver;\n /**\n * Remove all connections where an object is the sender or receiver.\n *\n * @param object - The object of interest.\n */\n function disconnectAll(object) {\n // Remove all connections where the given object is the sender.\n disconnectSender(object);\n // Remove all connections where the given object is the receiver.\n disconnectReceiver(object);\n }\n Private.disconnectAll = disconnectAll;\n /**\n * Emit a signal and invoke its connected slots.\n *\n * @param signal - The signal of interest.\n *\n * @param args - The args to pass to the connected slots.\n *\n * #### Notes\n * Slots are invoked synchronously in connection order.\n *\n * Exceptions thrown by connected slots will be caught and logged.\n */\n function emit(signal, args) {\n // If there are no receivers, there is nothing to do.\n let receivers = receiversForSender.get(signal.sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // Invoke the slots for connections with a matching signal.\n // Any connections added during emission are not invoked.\n for (let i = 0, n = receivers.length; i < n; ++i) {\n let connection = receivers[i];\n if (connection.signal === signal) {\n invokeSlot(connection, args);\n }\n }\n }\n Private.emit = emit;\n /**\n * A weak mapping of sender to array of receiver connections.\n */\n const receiversForSender = new WeakMap();\n /**\n * A weak mapping of receiver to array of sender connections.\n */\n const sendersForReceiver = new WeakMap();\n /**\n * A set of connection arrays which are pending cleanup.\n */\n const dirtySet = new Set();\n /**\n * A function to schedule an event loop callback.\n */\n const schedule = (() => {\n let ok = typeof requestAnimationFrame === 'function';\n return ok ? requestAnimationFrame : setImmediate;\n })();\n /**\n * Find a connection which matches the given parameters.\n */\n function findConnection(connections, signal, slot, thisArg) {\n return find(connections, connection => connection.signal === signal &&\n connection.slot === slot &&\n connection.thisArg === thisArg);\n }\n /**\n * Invoke a slot with the given parameters.\n *\n * The connection is assumed to be valid.\n *\n * Exceptions in the slot will be caught and logged.\n */\n function invokeSlot(connection, args) {\n let { signal, slot, thisArg } = connection;\n try {\n slot.call(thisArg, signal.sender, args);\n }\n catch (err) {\n Private.exceptionHandler(err);\n }\n }\n /**\n * Schedule a cleanup of a connection array.\n *\n * This will add the array to the dirty set and schedule a deferred\n * cleanup of the array contents. On cleanup, any connection with a\n * `null` signal will be removed from the array.\n */\n function scheduleCleanup(array) {\n if (dirtySet.size === 0) {\n schedule(cleanupDirtySet);\n }\n dirtySet.add(array);\n }\n /**\n * Cleanup the connection lists in the dirty set.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupDirtySet() {\n dirtySet.forEach(cleanupConnections);\n dirtySet.clear();\n }\n /**\n * Cleanup the dirty connections in a connections array.\n *\n * This will remove any connection with a `null` signal.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupConnections(connections) {\n ArrayExt.removeAllWhere(connections, isDeadConnection);\n }\n /**\n * Test whether a connection is dead.\n *\n * A dead connection has a `null` signal.\n */\n function isDeadConnection(connection) {\n return connection.signal === null;\n }\n})(Private || (Private = {}));\n\nexport { Signal, Stream };\n//# sourceMappingURL=index.es6.js.map\n","'use strict';\n\nfunction hasKey(obj, keys) {\n\tvar o = obj;\n\tkeys.slice(0, -1).forEach(function (key) {\n\t\to = o[key] || {};\n\t});\n\n\tvar key = keys[keys.length - 1];\n\treturn key in o;\n}\n\nfunction isNumber(x) {\n\tif (typeof x === 'number') { return true; }\n\tif ((/^0x[0-9a-f]+$/i).test(x)) { return true; }\n\treturn (/^[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(e[-+]?\\d+)?$/).test(x);\n}\n\nfunction isConstructorOrProto(obj, key) {\n\treturn (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';\n}\n\nmodule.exports = function (args, opts) {\n\tif (!opts) { opts = {}; }\n\n\tvar flags = {\n\t\tbools: {},\n\t\tstrings: {},\n\t\tunknownFn: null,\n\t};\n\n\tif (typeof opts.unknown === 'function') {\n\t\tflags.unknownFn = opts.unknown;\n\t}\n\n\tif (typeof opts.boolean === 'boolean' && opts.boolean) {\n\t\tflags.allBools = true;\n\t} else {\n\t\t[].concat(opts.boolean).filter(Boolean).forEach(function (key) {\n\t\t\tflags.bools[key] = true;\n\t\t});\n\t}\n\n\tvar aliases = {};\n\n\tfunction aliasIsBoolean(key) {\n\t\treturn aliases[key].some(function (x) {\n\t\t\treturn flags.bools[x];\n\t\t});\n\t}\n\n\tObject.keys(opts.alias || {}).forEach(function (key) {\n\t\taliases[key] = [].concat(opts.alias[key]);\n\t\taliases[key].forEach(function (x) {\n\t\t\taliases[x] = [key].concat(aliases[key].filter(function (y) {\n\t\t\t\treturn x !== y;\n\t\t\t}));\n\t\t});\n\t});\n\n\t[].concat(opts.string).filter(Boolean).forEach(function (key) {\n\t\tflags.strings[key] = true;\n\t\tif (aliases[key]) {\n\t\t\t[].concat(aliases[key]).forEach(function (k) {\n\t\t\t\tflags.strings[k] = true;\n\t\t\t});\n\t\t}\n\t});\n\n\tvar defaults = opts.default || {};\n\n\tvar argv = { _: [] };\n\n\tfunction argDefined(key, arg) {\n\t\treturn (flags.allBools && (/^--[^=]+$/).test(arg))\n\t\t\t|| flags.strings[key]\n\t\t\t|| flags.bools[key]\n\t\t\t|| aliases[key];\n\t}\n\n\tfunction setKey(obj, keys, value) {\n\t\tvar o = obj;\n\t\tfor (var i = 0; i < keys.length - 1; i++) {\n\t\t\tvar key = keys[i];\n\t\t\tif (isConstructorOrProto(o, key)) { return; }\n\t\t\tif (o[key] === undefined) { o[key] = {}; }\n\t\t\tif (\n\t\t\t\to[key] === Object.prototype\n\t\t\t\t|| o[key] === Number.prototype\n\t\t\t\t|| o[key] === String.prototype\n\t\t\t) {\n\t\t\t\to[key] = {};\n\t\t\t}\n\t\t\tif (o[key] === Array.prototype) { o[key] = []; }\n\t\t\to = o[key];\n\t\t}\n\n\t\tvar lastKey = keys[keys.length - 1];\n\t\tif (isConstructorOrProto(o, lastKey)) { return; }\n\t\tif (\n\t\t\to === Object.prototype\n\t\t\t|| o === Number.prototype\n\t\t\t|| o === String.prototype\n\t\t) {\n\t\t\to = {};\n\t\t}\n\t\tif (o === Array.prototype) { o = []; }\n\t\tif (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {\n\t\t\to[lastKey] = value;\n\t\t} else if (Array.isArray(o[lastKey])) {\n\t\t\to[lastKey].push(value);\n\t\t} else {\n\t\t\to[lastKey] = [o[lastKey], value];\n\t\t}\n\t}\n\n\tfunction setArg(key, val, arg) {\n\t\tif (arg && flags.unknownFn && !argDefined(key, arg)) {\n\t\t\tif (flags.unknownFn(arg) === false) { return; }\n\t\t}\n\n\t\tvar value = !flags.strings[key] && isNumber(val)\n\t\t\t? Number(val)\n\t\t\t: val;\n\t\tsetKey(argv, key.split('.'), value);\n\n\t\t(aliases[key] || []).forEach(function (x) {\n\t\t\tsetKey(argv, x.split('.'), value);\n\t\t});\n\t}\n\n\tObject.keys(flags.bools).forEach(function (key) {\n\t\tsetArg(key, defaults[key] === undefined ? false : defaults[key]);\n\t});\n\n\tvar notFlags = [];\n\n\tif (args.indexOf('--') !== -1) {\n\t\tnotFlags = args.slice(args.indexOf('--') + 1);\n\t\targs = args.slice(0, args.indexOf('--'));\n\t}\n\n\tfor (var i = 0; i < args.length; i++) {\n\t\tvar arg = args[i];\n\t\tvar key;\n\t\tvar next;\n\n\t\tif ((/^--.+=/).test(arg)) {\n\t\t\t// Using [\\s\\S] instead of . because js doesn't support the\n\t\t\t// 'dotall' regex modifier. See:\n\t\t\t// http://stackoverflow.com/a/1068308/13216\n\t\t\tvar m = arg.match(/^--([^=]+)=([\\s\\S]*)$/);\n\t\t\tkey = m[1];\n\t\t\tvar value = m[2];\n\t\t\tif (flags.bools[key]) {\n\t\t\t\tvalue = value !== 'false';\n\t\t\t}\n\t\t\tsetArg(key, value, arg);\n\t\t} else if ((/^--no-.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--no-(.+)/)[1];\n\t\t\tsetArg(key, false, arg);\n\t\t} else if ((/^--.+/).test(arg)) {\n\t\t\tkey = arg.match(/^--(.+)/)[1];\n\t\t\tnext = args[i + 1];\n\t\t\tif (\n\t\t\t\tnext !== undefined\n\t\t\t\t&& !(/^(-|--)[^-]/).test(next)\n\t\t\t\t&& !flags.bools[key]\n\t\t\t\t&& !flags.allBools\n\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t) {\n\t\t\t\tsetArg(key, next, arg);\n\t\t\t\ti += 1;\n\t\t\t} else if ((/^(true|false)$/).test(next)) {\n\t\t\t\tsetArg(key, next === 'true', arg);\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t}\n\t\t} else if ((/^-[^-]+/).test(arg)) {\n\t\t\tvar letters = arg.slice(1, -1).split('');\n\n\t\t\tvar broken = false;\n\t\t\tfor (var j = 0; j < letters.length; j++) {\n\t\t\t\tnext = arg.slice(j + 2);\n\n\t\t\t\tif (next === '-') {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {\n\t\t\t\t\tsetArg(letters[j], next.slice(1), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(/[A-Za-z]/).test(letters[j])\n\t\t\t\t\t&& (/-?\\d+(\\.\\d*)?(e-?\\d+)?$/).test(next)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(letters[j], next, arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (letters[j + 1] && letters[j + 1].match(/\\W/)) {\n\t\t\t\t\tsetArg(letters[j], arg.slice(j + 2), arg);\n\t\t\t\t\tbroken = true;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkey = arg.slice(-1)[0];\n\t\t\tif (!broken && key !== '-') {\n\t\t\t\tif (\n\t\t\t\t\targs[i + 1]\n\t\t\t\t\t&& !(/^(-|--)[^-]/).test(args[i + 1])\n\t\t\t\t\t&& !flags.bools[key]\n\t\t\t\t\t&& (aliases[key] ? !aliasIsBoolean(key) : true)\n\t\t\t\t) {\n\t\t\t\t\tsetArg(key, args[i + 1], arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {\n\t\t\t\t\tsetArg(key, args[i + 1] === 'true', arg);\n\t\t\t\t\ti += 1;\n\t\t\t\t} else {\n\t\t\t\t\tsetArg(key, flags.strings[key] ? '' : true, arg);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (!flags.unknownFn || flags.unknownFn(arg) !== false) {\n\t\t\t\targv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));\n\t\t\t}\n\t\t\tif (opts.stopEarly) {\n\t\t\t\targv._.push.apply(argv._, args.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tObject.keys(defaults).forEach(function (k) {\n\t\tif (!hasKey(argv, k.split('.'))) {\n\t\t\tsetKey(argv, k.split('.'), defaults[k]);\n\n\t\t\t(aliases[k] || []).forEach(function (x) {\n\t\t\t\tsetKey(argv, x.split('.'), defaults[k]);\n\t\t\t});\n\t\t}\n\t});\n\n\tif (opts['--']) {\n\t\targv['--'] = notFlags.slice();\n\t} else {\n\t\tnotFlags.forEach(function (k) {\n\t\t\targv._.push(k);\n\t\t});\n\t}\n\n\treturn argv;\n};\n","// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , undef;\n\n/**\n * Decode a URI encoded string.\n *\n * @param {String} input The URI encoded string.\n * @returns {String|Null} The decoded string.\n * @api private\n */\nfunction decode(input) {\n try {\n return decodeURIComponent(input.replace(/\\+/g, ' '));\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Attempts to encode a given input.\n *\n * @param {String} input The string that needs to be encoded.\n * @returns {String|Null} The encoded string.\n * @api private\n */\nfunction encode(input) {\n try {\n return encodeURIComponent(input);\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Simple query string parser.\n *\n * @param {String} query The query string that needs to be parsed.\n * @returns {Object}\n * @api public\n */\nfunction querystring(query) {\n var parser = /([^=?#&]+)=?([^&]*)/g\n , result = {}\n , part;\n\n while (part = parser.exec(query)) {\n var key = decode(part[1])\n , value = decode(part[2]);\n\n //\n // Prevent overriding of existing properties. This ensures that build-in\n // methods like `toString` or __proto__ are not overriden by malicious\n // querystrings.\n //\n // In the case if failed decoding, we want to omit the key/value pairs\n // from the result.\n //\n if (key === null || value === null || key in result) continue;\n result[key] = value;\n }\n\n return result;\n}\n\n/**\n * Transform a query string to an object.\n *\n * @param {Object} obj Object that should be transformed.\n * @param {String} prefix Optional prefix.\n * @returns {String}\n * @api public\n */\nfunction querystringify(obj, prefix) {\n prefix = prefix || '';\n\n var pairs = []\n , value\n , key;\n\n //\n // Optionally prefix with a '?' if needed\n //\n if ('string' !== typeof prefix) prefix = '?';\n\n for (key in obj) {\n if (has.call(obj, key)) {\n value = obj[key];\n\n //\n // Edge cases where we actually want to encode the value to an empty\n // string instead of the stringified value.\n //\n if (!value && (value === null || value === undef || isNaN(value))) {\n value = '';\n }\n\n key = encode(key);\n value = encode(value);\n\n //\n // If we failed to encode the strings, we should bail out as we don't\n // want to add invalid strings to the query.\n //\n if (key === null || value === null) continue;\n pairs.push(key +'='+ value);\n }\n }\n\n return pairs.length ? prefix + pairs.join('&') : '';\n}\n\n//\n// Expose the module.\n//\nexports.stringify = querystringify;\nexports.parse = querystring;\n","'use strict';\n\n/**\n * Check if we're required to add a port number.\n *\n * @see https://url.spec.whatwg.org/#default-port\n * @param {Number|String} port Port number we need to check\n * @param {String} protocol Protocol we need to check against.\n * @returns {Boolean} Is it a default port for the given protocol\n * @api private\n */\nmodule.exports = function required(port, protocol) {\n protocol = protocol.split(':')[0];\n port = +port;\n\n if (!port) return false;\n\n switch (protocol) {\n case 'http':\n case 'ws':\n return port !== 80;\n\n case 'https':\n case 'wss':\n return port !== 443;\n\n case 'ftp':\n return port !== 21;\n\n case 'gopher':\n return port !== 70;\n\n case 'file':\n return false;\n }\n\n return port !== 0;\n};\n","'use strict';\n\nvar required = require('requires-port')\n , qs = require('querystringify')\n , controlOrWhitespace = /^[\\x00-\\x20\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/\n , CRHTLF = /[\\n\\r\\t]/g\n , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//\n , port = /:\\d+$/\n , protocolre = /^([a-z][a-z0-9.+-]*:)?(\\/\\/)?([\\\\/]+)?([\\S\\s]*)/i\n , windowsDriveLetter = /^[a-zA-Z]:/;\n\n/**\n * Remove control characters and whitespace from the beginning of a string.\n *\n * @param {Object|String} str String to trim.\n * @returns {String} A new string representing `str` stripped of control\n * characters and whitespace from its beginning.\n * @public\n */\nfunction trimLeft(str) {\n return (str ? str : '').toString().replace(controlOrWhitespace, '');\n}\n\n/**\n * These are the parse rules for the URL parser, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar rules = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n function sanitize(address, url) { // Sanitize what is left of the address\n return isSpecial(url.protocol) ? address.replace(/\\\\/g, '/') : address;\n },\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/:(\\d*)$/, 'port', undefined, 1], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n/**\n * These properties should not be copied or inherited from. This is only needed\n * for all non blob URL's as a blob URL does not include a hash, only the\n * origin.\n *\n * @type {Object}\n * @private\n */\nvar ignore = { hash: 1, query: 1 };\n\n/**\n * The location object differs when your code is loaded through a normal page,\n * Worker or through a worker using a blob. And with the blobble begins the\n * trouble as the location object will contain the URL of the blob, not the\n * location of the page where our code is loaded in. The actual origin is\n * encoded in the `pathname` so we can thankfully generate a good \"default\"\n * location from it so we can generate proper relative URL's again.\n *\n * @param {Object|String} loc Optional default location object.\n * @returns {Object} lolcation object.\n * @public\n */\nfunction lolcation(loc) {\n var globalVar;\n\n if (typeof window !== 'undefined') globalVar = window;\n else if (typeof global !== 'undefined') globalVar = global;\n else if (typeof self !== 'undefined') globalVar = self;\n else globalVar = {};\n\n var location = globalVar.location || {};\n loc = loc || location;\n\n var finaldestination = {}\n , type = typeof loc\n , key;\n\n if ('blob:' === loc.protocol) {\n finaldestination = new Url(unescape(loc.pathname), {});\n } else if ('string' === type) {\n finaldestination = new Url(loc, {});\n for (key in ignore) delete finaldestination[key];\n } else if ('object' === type) {\n for (key in loc) {\n if (key in ignore) continue;\n finaldestination[key] = loc[key];\n }\n\n if (finaldestination.slashes === undefined) {\n finaldestination.slashes = slashes.test(loc.href);\n }\n }\n\n return finaldestination;\n}\n\n/**\n * Check whether a protocol scheme is special.\n *\n * @param {String} The protocol scheme of the URL\n * @return {Boolean} `true` if the protocol scheme is special, else `false`\n * @private\n */\nfunction isSpecial(scheme) {\n return (\n scheme === 'file:' ||\n scheme === 'ftp:' ||\n scheme === 'http:' ||\n scheme === 'https:' ||\n scheme === 'ws:' ||\n scheme === 'wss:'\n );\n}\n\n/**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase.\n * @property {Boolean} slashes `true` if protocol is followed by \"//\", else `false`.\n * @property {String} rest Rest of the URL that is not part of the protocol.\n */\n\n/**\n * Extract protocol information from a URL with/without double slash (\"//\").\n *\n * @param {String} address URL we want to extract from.\n * @param {Object} location\n * @return {ProtocolExtract} Extracted information.\n * @private\n */\nfunction extractProtocol(address, location) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n location = location || {};\n\n var match = protocolre.exec(address);\n var protocol = match[1] ? match[1].toLowerCase() : '';\n var forwardSlashes = !!match[2];\n var otherSlashes = !!match[3];\n var slashesCount = 0;\n var rest;\n\n if (forwardSlashes) {\n if (otherSlashes) {\n rest = match[2] + match[3] + match[4];\n slashesCount = match[2].length + match[3].length;\n } else {\n rest = match[2] + match[4];\n slashesCount = match[2].length;\n }\n } else {\n if (otherSlashes) {\n rest = match[3] + match[4];\n slashesCount = match[3].length;\n } else {\n rest = match[4]\n }\n }\n\n if (protocol === 'file:') {\n if (slashesCount >= 2) {\n rest = rest.slice(2);\n }\n } else if (isSpecial(protocol)) {\n rest = match[4];\n } else if (protocol) {\n if (forwardSlashes) {\n rest = rest.slice(2);\n }\n } else if (slashesCount >= 2 && isSpecial(location.protocol)) {\n rest = match[4];\n }\n\n return {\n protocol: protocol,\n slashes: forwardSlashes || isSpecial(protocol),\n slashesCount: slashesCount,\n rest: rest\n };\n}\n\n/**\n * Resolve a relative URL pathname against a base URL pathname.\n *\n * @param {String} relative Pathname of the relative URL.\n * @param {String} base Pathname of the base URL.\n * @return {String} Resolved pathname.\n * @private\n */\nfunction resolve(relative, base) {\n if (relative === '') return base;\n\n var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))\n , i = path.length\n , last = path[i - 1]\n , unshift = false\n , up = 0;\n\n while (i--) {\n if (path[i] === '.') {\n path.splice(i, 1);\n } else if (path[i] === '..') {\n path.splice(i, 1);\n up++;\n } else if (up) {\n if (i === 0) unshift = true;\n path.splice(i, 1);\n up--;\n }\n }\n\n if (unshift) path.unshift('');\n if (last === '.' || last === '..') path.push('');\n\n return path.join('/');\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my OCD.\n *\n * It is worth noting that we should not use `URL` as class name to prevent\n * clashes with the global URL instance that got introduced in browsers.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} [location] Location defaults for relative paths.\n * @param {Boolean|Function} [parser] Parser for the query string.\n * @private\n */\nfunction Url(address, location, parser) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n\n if (!(this instanceof Url)) {\n return new Url(address, location, parser);\n }\n\n var relative, extracted, parse, instruction, index, key\n , instructions = rules.slice()\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) parser = qs.parse;\n\n location = lolcation(location);\n\n //\n // Extract protocol information before running the instructions.\n //\n extracted = extractProtocol(address || '', location);\n relative = !extracted.protocol && !extracted.slashes;\n url.slashes = extracted.slashes || relative && location.slashes;\n url.protocol = extracted.protocol || location.protocol || '';\n address = extracted.rest;\n\n //\n // When the authority component is absent the URL starts with a path\n // component.\n //\n if (\n extracted.protocol === 'file:' && (\n extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||\n (!extracted.slashes &&\n (extracted.protocol ||\n extracted.slashesCount < 2 ||\n !isSpecial(url.protocol)))\n ) {\n instructions[3] = [/(.*)/, 'pathname'];\n }\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n\n if (typeof instruction === 'function') {\n address = instruction(address, url);\n continue;\n }\n\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n index = parse === '@'\n ? address.lastIndexOf(parse)\n : address.indexOf(parse);\n\n if (~index) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if ((index = parse.exec(address))) {\n url[key] = index[1];\n address = address.slice(0, index.index);\n }\n\n url[key] = url[key] || (\n relative && instruction[3] ? location[key] || '' : ''\n );\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) url[key] = url[key].toLowerCase();\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // If the URL is relative, resolve the pathname against the base URL.\n //\n if (\n relative\n && location.slashes\n && url.pathname.charAt(0) !== '/'\n && (url.pathname !== '' || location.pathname !== '')\n ) {\n url.pathname = resolve(url.pathname, location.pathname);\n }\n\n //\n // Default to a / for pathname if none exists. This normalizes the URL\n // to always have a /\n //\n if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {\n url.pathname = '/' + url.pathname;\n }\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n\n if (url.auth) {\n index = url.auth.indexOf(':');\n\n if (~index) {\n url.username = url.auth.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = url.auth.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password))\n } else {\n url.username = encodeURIComponent(decodeURIComponent(url.auth));\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n }\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} part Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function\n * used to parse the query.\n * When setting the protocol, double slash will be\n * removed from the final url if it is true.\n * @returns {URL} URL instance for chaining.\n * @public\n */\nfunction set(part, value, fn) {\n var url = this;\n\n switch (part) {\n case 'query':\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n break;\n\n case 'port':\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n\n break;\n\n case 'hostname':\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n break;\n\n case 'host':\n url[part] = value;\n\n if (port.test(value)) {\n value = value.split(':');\n url.port = value.pop();\n url.hostname = value.join(':');\n } else {\n url.hostname = value;\n url.port = '';\n }\n\n break;\n\n case 'protocol':\n url.protocol = value.toLowerCase();\n url.slashes = !fn;\n break;\n\n case 'pathname':\n case 'hash':\n if (value) {\n var char = part === 'pathname' ? '/' : '#';\n url[part] = value.charAt(0) !== char ? char + value : value;\n } else {\n url[part] = value;\n }\n break;\n\n case 'username':\n case 'password':\n url[part] = encodeURIComponent(value);\n break;\n\n case 'auth':\n var index = value.indexOf(':');\n\n if (~index) {\n url.username = value.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = value.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password));\n } else {\n url.username = encodeURIComponent(decodeURIComponent(value));\n }\n }\n\n for (var i = 0; i < rules.length; i++) {\n var ins = rules[i];\n\n if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n url.href = url.toString();\n\n return url;\n}\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String} Compiled version of the URL.\n * @public\n */\nfunction toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , host = url.host\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result =\n protocol +\n ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n } else if (url.password) {\n result += ':'+ url.password;\n result += '@';\n } else if (\n url.protocol !== 'file:' &&\n isSpecial(url.protocol) &&\n !host &&\n url.pathname !== '/'\n ) {\n //\n // Add back the empty userinfo, otherwise the original invalid URL\n // might be transformed into a valid one with `url.pathname` as host.\n //\n result += '@';\n }\n\n //\n // Trailing colon is removed from `url.host` when it is parsed. If it still\n // ends with a colon, then add back the trailing colon that was removed. This\n // prevents an invalid URL from being transformed into a valid one.\n //\n if (host[host.length - 1] === ':' || (port.test(url.hostname) && !url.port)) {\n host += ':';\n }\n\n result += host + url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n}\n\nUrl.prototype = { set: set, toString: toString };\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others or testing.\n//\nUrl.extractProtocol = extractProtocol;\nUrl.location = lolcation;\nUrl.trimLeft = trimLeft;\nUrl.qs = qs;\n\nmodule.exports = Url;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const ARRAY = 'array';\nexport const BIGINT = 'bigint';\nexport const BOOLEAN = 'boolean';\nexport const FUNCTION = 'function';\nexport const NULL = 'null';\nexport const NUMBER = 'number';\nexport const OBJECT = 'object';\nexport const STRING = 'string';\nexport const SYMBOL = 'symbol';\nexport const UNDEFINED = 'undefined';\n","// ⚠️ AUTOMATICALLY GENERATED - DO NOT CHANGE\nexport const CHANNEL = '64e10b34-2bf7-4616-9668-f99de5aa046e';\n\nexport const MAIN = 'M' + CHANNEL;\nexport const THREAD = 'T' + CHANNEL;\n","export const APPLY = 'apply';\nexport const CONSTRUCT = 'construct';\nexport const DEFINE_PROPERTY = 'defineProperty';\nexport const DELETE_PROPERTY = 'deleteProperty';\nexport const GET = 'get';\nexport const GET_OWN_PROPERTY_DESCRIPTOR = 'getOwnPropertyDescriptor';\nexport const GET_PROTOTYPE_OF = 'getPrototypeOf';\nexport const HAS = 'has';\nexport const IS_EXTENSIBLE = 'isExtensible';\nexport const OWN_KEYS = 'ownKeys';\nexport const PREVENT_EXTENSION = 'preventExtensions';\nexport const SET = 'set';\nexport const SET_PROTOTYPE_OF = 'setPrototypeOf';\n","// The goal of this file is to normalize SAB\n// at least in main -> worker() use cases.\n// This still cannot possibly solve the sync\n// worker -> main() use case if SharedArrayBuffer\n// is not available or usable.\n\nimport {CHANNEL} from './channel.js';\n\nconst {isArray} = Array;\n\nlet {SharedArrayBuffer, window} = globalThis;\nlet {notify, wait, waitAsync} = Atomics;\nlet postPatched = null;\n\n// This is needed for some version of Firefox\nif (!waitAsync) {\n waitAsync = buffer => ({\n value: new Promise(onmessage => {\n // encodeURIComponent('onmessage=({data:b})=>(Atomics.wait(b,0),postMessage(0))')\n let w = new Worker('data:application/javascript,onmessage%3D(%7Bdata%3Ab%7D)%3D%3E(Atomics.wait(b%2C0)%2CpostMessage(0))');\n w.onmessage = onmessage;\n w.postMessage(buffer);\n })\n });\n}\n\n// Monkey-patch SharedArrayBuffer if needed\ntry {\n new SharedArrayBuffer(4);\n}\ncatch (_) {\n SharedArrayBuffer = ArrayBuffer;\n\n const ids = new WeakMap;\n // patch only main -> worker():async use case\n if (window) {\n const resolvers = new Map;\n const {prototype: {postMessage}} = Worker;\n\n const listener = event => {\n const details = event.data?.[CHANNEL];\n if (!isArray(details)) {\n event.stopImmediatePropagation();\n const { id, sb } = details;\n resolvers.get(id)(sb);\n }\n };\n\n postPatched = function (data, ...rest) {\n const details = data?.[CHANNEL];\n if (isArray(details)) {\n const [id, sb] = details;\n ids.set(sb, id);\n this.addEventListener('message', listener);\n }\n return postMessage.call(this, data, ...rest);\n };\n\n waitAsync = sb => ({\n value: new Promise(resolve => {\n resolvers.set(ids.get(sb), resolve);\n }).then(buff => {\n resolvers.delete(ids.get(sb));\n ids.delete(sb);\n for (let i = 0; i < buff.length; i++) sb[i] = buff[i];\n return 'ok';\n })\n });\n }\n else {\n const as = (id, sb) => ({[CHANNEL]: { id, sb }});\n\n notify = sb => {\n postMessage(as(ids.get(sb), sb));\n };\n\n addEventListener('message', event => {\n const details = event.data?.[CHANNEL];\n if (isArray(details)) {\n const [id, sb] = details;\n ids.set(sb, id);\n }\n });\n }\n}\n\nexport {SharedArrayBuffer, isArray, notify, postPatched, wait, waitAsync};\n","/*! (c) Andrea Giammarchi - ISC */\n\nimport {FUNCTION} from 'proxy-target/types';\n\nimport {CHANNEL} from './channel.js';\nimport {GET, HAS, SET} from './shared/traps.js';\n\nimport {SharedArrayBuffer, isArray, notify, postPatched, wait, waitAsync} from './bridge.js';\n\n// just minifier friendly for Blob Workers' cases\nconst {Int32Array, Map, Uint16Array} = globalThis;\n\n// common constants / utilities for repeated operations\nconst {BYTES_PER_ELEMENT: I32_BYTES} = Int32Array;\nconst {BYTES_PER_ELEMENT: UI16_BYTES} = Uint16Array;\n\nconst waitInterrupt = (sb, delay, handler) => {\n while (wait(sb, 0, 0, delay) === 'timed-out')\n handler();\n};\n\n// retain buffers to transfer\nconst buffers = new WeakSet;\n\n// retain either main threads or workers global context\nconst context = new WeakMap;\n\nconst syncResult = {value: {then: fn => fn()}};\n\n// used to generate a unique `id` per each worker `postMessage` \"transaction\"\nlet uid = 0;\n\n/**\n * @typedef {Object} Interrupt used to sanity-check interrupts while waiting synchronously.\n * @prop {function} [handler] a callback invoked every `delay` milliseconds.\n * @prop {number} [delay=42] define `handler` invokes in terms of milliseconds.\n */\n\n/**\n * Create once a `Proxy` able to orchestrate synchronous `postMessage` out of the box.\n * @param {globalThis | Worker} self the context in which code should run\n * @param {{parse: (serialized: string) => any, stringify: (serializable: any) => string, transform?: (value:any) => any, interrupt?: () => void | Interrupt}} [JSON] an optional `JSON` like interface to `parse` or `stringify` content with extra `transform` ability.\n * @returns {ProxyHandler<globalThis> | ProxyHandler<Worker>}\n */\nconst coincident = (self, {parse = JSON.parse, stringify = JSON.stringify, transform, interrupt} = JSON) => {\n // create a Proxy once for the given context (globalThis or Worker instance)\n if (!context.has(self)) {\n // ensure no SAB gets a chance to pass through this call\n const sendMessage = postPatched || self.postMessage;\n // ensure the CHANNEL and data are posted correctly\n const post = (transfer, ...args) => sendMessage.call(self, {[CHANNEL]: args}, {transfer});\n\n const handler = typeof interrupt === FUNCTION ? interrupt : interrupt?.handler;\n const delay = interrupt?.delay || 42;\n const decoder = new TextDecoder('utf-16');\n\n // automatically uses sync wait (worker -> main)\n // or fallback to async wait (main -> worker)\n const waitFor = (isAsync, sb) => isAsync ?\n waitAsync(sb, 0) :\n ((handler ? waitInterrupt(sb, delay, handler) : wait(sb, 0)), syncResult);\n\n // prevent Harakiri https://github.com/WebReflection/coincident/issues/18\n let seppuku = false;\n\n context.set(self, new Proxy(new Map, {\n // there is very little point in checking prop in proxy for this very specific case\n // and I don't want to orchestrate a whole roundtrip neither, as stuff would fail\n // regardless if from Worker we access non existent Main callback, and vice-versa.\n // This is here mostly to guarantee that if such check is performed, at least the\n // get trap goes through and then it's up to developers guarantee they are accessing\n // stuff that actually exists elsewhere.\n [HAS]: (_, action) => typeof action === 'string' && !action.startsWith('_'),\n\n // worker related: get any utility that should be available on the main thread\n [GET]: (_, action) => action === 'then' ? null : ((...args) => {\n // transaction id\n const id = uid++;\n\n // first contact: just ask for how big the buffer should be\n // the value would be stored at index [1] while [0] is just control\n let sb = new Int32Array(new SharedArrayBuffer(I32_BYTES * 2));\n\n // if a transfer list has been passed, drop it from args\n let transfer = [];\n if (buffers.has(args.at(-1) || transfer))\n buffers.delete(transfer = args.pop());\n\n // ask for invoke with arguments and wait for it\n post(transfer, id, sb, action, transform ? args.map(transform) : args);\n\n // helps deciding how to wait for results\n const isAsync = self !== globalThis;\n\n // warn users about possible deadlock still allowing them\n // to explicitly `proxy.invoke().then(...)` without blocking\n let deadlock = 0;\n if (seppuku && isAsync)\n deadlock = setTimeout(console.warn, 1000, `💀🔒 - Possible deadlock if proxy.${action}(...args) is awaited`);\n\n return waitFor(isAsync, sb).value.then(() => {\n clearTimeout(deadlock);\n\n // commit transaction using the returned / needed buffer length\n const length = sb[1];\n\n // filter undefined results\n if (!length) return;\n\n // calculate the needed ui16 bytes length to store the result string\n const bytes = UI16_BYTES * length;\n\n // round up to the next amount of bytes divided by 4 to allow i32 operations\n sb = new Int32Array(new SharedArrayBuffer(bytes + (bytes % I32_BYTES)));\n\n // ask for results and wait for it\n post([], id, sb);\n return waitFor(isAsync, sb).value.then(() => parse(\n decoder.decode(new Uint16Array(sb.buffer).slice(0, length)))\n );\n });\n }),\n\n // main thread related: react to any utility a worker is asking for\n [SET](actions, action, callback) {\n const type = typeof callback;\n if (type !== FUNCTION)\n throw new Error(`Unable to assign ${action} as ${type}`);\n // lazy event listener and logic handling, triggered once by setters actions\n if (!actions.size) {\n // maps results by `id` as they are asked for\n const results = new Map;\n // add the event listener once (first defined setter, all others work the same)\n self.addEventListener('message', async (event) => {\n // grub the very same library CHANNEL; ignore otherwise\n const details = event.data?.[CHANNEL];\n if (isArray(details)) {\n // if early enough, avoid leaking data to other listeners\n event.stopImmediatePropagation();\n const [id, sb, ...rest] = details;\n let error;\n // action available: it must be defined/known on the main thread\n if (rest.length) {\n const [action, args] = rest;\n if (actions.has(action)) {\n seppuku = true;\n try {\n // await for result either sync or async and serialize it\n const result = await actions.get(action)(...args);\n if (result !== void 0) {\n const serialized = stringify(transform ? transform(result) : result);\n // store the result for \"the very next\" event listener call\n results.set(id, serialized);\n // communicate the required SharedArrayBuffer length out of the\n // resulting serialized string\n sb[1] = serialized.length;\n }\n }\n catch (_) {\n error = _;\n }\n finally {\n seppuku = false;\n }\n }\n // unknown action should be notified as missing on the main thread\n else {\n error = new Error(`Unsupported action: ${action}`);\n }\n // unlock the wait lock later on\n sb[0] = 1;\n }\n // no action means: get results out of the well known `id`\n // wait lock automatically unlocked here as no `0` value would\n // possibly ever land at index `0`\n else {\n const result = results.get(id);\n results.delete(id);\n // populate the SharedArrayBuffer with utf-16 chars code\n for (let ui16a = new Uint16Array(sb.buffer), i = 0; i < result.length; i++)\n ui16a[i] = result.charCodeAt(i);\n }\n // release te worker waiting either the length or the result\n notify(sb, 0);\n if (error) throw error;\n }\n });\n }\n // store this action callback allowing the setter in the process\n return !!actions.set(action, callback);\n }\n }));\n }\n return context.get(self);\n};\n\ncoincident.transfer = (...args) => (buffers.add(args), args);\n\nexport default coincident;\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { DIR_MODE, SEEK_CUR, SEEK_END, instanceOfStream, } from './emscripten';\nexport const DRIVE_SEPARATOR = ':';\nexport const DRIVE_API_PATH = '/api/drive.v1';\nexport const BLOCK_SIZE = 4096;\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder('utf-8');\n// Mapping flag -> do we need to overwrite the file upon closing it\nconst flagNeedsWrite = {\n 0 /*O_RDONLY*/: false,\n 1 /*O_WRONLY*/: true,\n 2 /*O_RDWR*/: true,\n 64 /*O_CREAT*/: true,\n 65 /*O_WRONLY|O_CREAT*/: true,\n 66 /*O_RDWR|O_CREAT*/: true,\n 129 /*O_WRONLY|O_EXCL*/: true,\n 193 /*O_WRONLY|O_CREAT|O_EXCL*/: true,\n 514 /*O_RDWR|O_TRUNC*/: true,\n 577 /*O_WRONLY|O_CREAT|O_TRUNC*/: true,\n 578 /*O_CREAT|O_RDWR|O_TRUNC*/: true,\n 705 /*O_WRONLY|O_CREAT|O_EXCL|O_TRUNC*/: true,\n 706 /*O_RDWR|O_CREAT|O_EXCL|O_TRUNC*/: true,\n 1024 /*O_APPEND*/: true,\n 1025 /*O_WRONLY|O_APPEND*/: true,\n 1026 /*O_RDWR|O_APPEND*/: true,\n 1089 /*O_WRONLY|O_CREAT|O_APPEND*/: true,\n 1090 /*O_RDWR|O_CREAT|O_APPEND*/: true,\n 1153 /*O_WRONLY|O_EXCL|O_APPEND*/: true,\n 1154 /*O_RDWR|O_EXCL|O_APPEND*/: true,\n 1217 /*O_WRONLY|O_CREAT|O_EXCL|O_APPEND*/: true,\n 1218 /*O_RDWR|O_CREAT|O_EXCL|O_APPEND*/: true,\n 4096 /*O_RDONLY|O_DSYNC*/: true,\n 4098 /*O_RDWR|O_DSYNC*/: true,\n};\nexport class DriveFSEmscriptenStreamOps {\n constructor(fs) {\n this.fs = fs;\n }\n open(stream) {\n const path = this.fs.realPath(stream.node);\n if (this.fs.FS.isFile(stream.node.mode)) {\n stream.file = this.fs.API.get(path);\n }\n }\n close(stream) {\n if (!this.fs.FS.isFile(stream.node.mode) || !stream.file) {\n return;\n }\n const path = this.fs.realPath(stream.node);\n const flags = stream.flags;\n let parsedFlags = typeof flags === 'string' ? parseInt(flags, 10) : flags;\n parsedFlags &= 0x1fff;\n let needsWrite = true;\n if (parsedFlags in flagNeedsWrite) {\n needsWrite = flagNeedsWrite[parsedFlags];\n }\n if (needsWrite) {\n this.fs.API.put(path, stream.file);\n }\n stream.file = undefined;\n }\n read(stream, buffer, offset, length, position) {\n if (length <= 0 ||\n stream.file === undefined ||\n position >= (stream.file.data.length || 0)) {\n return 0;\n }\n const size = Math.min(stream.file.data.length - position, length);\n buffer.set(stream.file.data.subarray(position, position + size), offset);\n return size;\n }\n write(stream, buffer, offset, length, position) {\n var _a;\n if (length <= 0 || stream.file === undefined) {\n return 0;\n }\n stream.node.timestamp = Date.now();\n if (position + length > (((_a = stream.file) === null || _a === void 0 ? void 0 : _a.data.length) || 0)) {\n const oldData = stream.file.data ? stream.file.data : new Uint8Array();\n stream.file.data = new Uint8Array(position + length);\n stream.file.data.set(oldData);\n }\n stream.file.data.set(buffer.subarray(offset, offset + length), position);\n return length;\n }\n llseek(stream, offset, whence) {\n let position = offset;\n if (whence === SEEK_CUR) {\n position += stream.position;\n }\n else if (whence === SEEK_END) {\n if (this.fs.FS.isFile(stream.node.mode)) {\n if (stream.file !== undefined) {\n position += stream.file.data.length;\n }\n else {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);\n }\n }\n }\n if (position < 0) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);\n }\n return position;\n }\n}\nexport class DriveFSEmscriptenNodeOps {\n constructor(fs) {\n this.fs = fs;\n }\n node(nodeOrStream) {\n if (instanceOfStream(nodeOrStream)) {\n return nodeOrStream.node;\n }\n return nodeOrStream;\n }\n getattr(value) {\n const node = this.node(value);\n return {\n ...this.fs.API.getattr(this.fs.realPath(node)),\n mode: node.mode,\n ino: node.id,\n };\n }\n setattr(value, attr) {\n const node = this.node(value);\n for (const [key, value] of Object.entries(attr)) {\n switch (key) {\n case 'mode':\n node.mode = value;\n break;\n case 'timestamp':\n node.timestamp = value;\n break;\n default:\n console.warn('setattr', key, 'of', value, 'on', node, 'not yet implemented');\n break;\n }\n }\n }\n lookup(parent, name) {\n const node = this.node(parent);\n const path = this.fs.PATH.join2(this.fs.realPath(node), name);\n const result = this.fs.API.lookup(path);\n if (!result.ok) {\n throw this.fs.FS.genericErrors[this.fs.ERRNO_CODES['ENOENT']];\n }\n return this.fs.createNode(node, name, result.mode, 0);\n }\n mknod(parent, name, mode, dev) {\n const node = this.node(parent);\n const path = this.fs.PATH.join2(this.fs.realPath(node), name);\n this.fs.API.mknod(path, mode);\n return this.fs.createNode(node, name, mode, dev);\n }\n rename(value, newDir, newName) {\n const oldNode = this.node(value);\n const newDirNode = this.node(newDir);\n this.fs.API.rename(oldNode.parent\n ? this.fs.PATH.join2(this.fs.realPath(oldNode.parent), oldNode.name)\n : oldNode.name, this.fs.PATH.join2(this.fs.realPath(newDirNode), newName));\n // Updating the in-memory node\n oldNode.name = newName;\n oldNode.parent = newDirNode;\n }\n unlink(parent, name) {\n this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(parent)), name));\n }\n rmdir(parent, name) {\n this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(parent)), name));\n }\n readdir(value) {\n return this.fs.API.readdir(this.fs.realPath(this.node(value)));\n }\n symlink(parent, newName, oldPath) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES['EPERM']);\n }\n readlink(node) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES['EPERM']);\n }\n}\n/**\n * ContentsAPI base class\n */\nexport class ContentsAPI {\n constructor(driveName, mountpoint, FS, ERRNO_CODES) {\n this._driveName = driveName;\n this._mountpoint = mountpoint;\n this.FS = FS;\n this.ERRNO_CODES = ERRNO_CODES;\n }\n lookup(path) {\n return this.request({ method: 'lookup', path: this.normalizePath(path) });\n }\n getmode(path) {\n return this.request({ method: 'getmode', path: this.normalizePath(path) });\n }\n mknod(path, mode) {\n return this.request({\n method: 'mknod',\n path: this.normalizePath(path),\n data: { mode },\n });\n }\n rename(oldPath, newPath) {\n return this.request({\n method: 'rename',\n path: this.normalizePath(oldPath),\n data: { newPath: this.normalizePath(newPath) },\n });\n }\n readdir(path) {\n const dirlist = this.request({\n method: 'readdir',\n path: this.normalizePath(path),\n });\n dirlist.push('.');\n dirlist.push('..');\n return dirlist;\n }\n rmdir(path) {\n return this.request({ method: 'rmdir', path: this.normalizePath(path) });\n }\n get(path) {\n const response = this.request({\n method: 'get',\n path: this.normalizePath(path),\n });\n if (!response) {\n throw new this.FS.ErrnoError(this.ERRNO_CODES['ENOENT']);\n }\n const serializedContent = response.content;\n const format = response.format;\n switch (format) {\n case 'json':\n case 'text':\n return {\n data: encoder.encode(serializedContent),\n format,\n };\n case 'base64': {\n const binString = atob(serializedContent);\n const len = binString.length;\n const data = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n data[i] = binString.charCodeAt(i);\n }\n return {\n data,\n format,\n };\n }\n default:\n throw new this.FS.ErrnoError(this.ERRNO_CODES['ENOENT']);\n }\n }\n put(path, value) {\n switch (value.format) {\n case 'json':\n case 'text':\n return this.request({\n method: 'put',\n path: this.normalizePath(path),\n data: {\n format: value.format,\n data: decoder.decode(value.data),\n },\n });\n case 'base64': {\n let binary = '';\n for (let i = 0; i < value.data.byteLength; i++) {\n binary += String.fromCharCode(value.data[i]);\n }\n return this.request({\n method: 'put',\n path: this.normalizePath(path),\n data: {\n format: value.format,\n data: btoa(binary),\n },\n });\n }\n }\n }\n getattr(path) {\n const stats = this.request({\n method: 'getattr',\n path: this.normalizePath(path),\n });\n // Turn datetimes into proper objects\n if (stats.atime) {\n stats.atime = new Date(stats.atime);\n }\n if (stats.mtime) {\n stats.mtime = new Date(stats.mtime);\n }\n if (stats.ctime) {\n stats.ctime = new Date(stats.ctime);\n }\n // ensure a non-undefined size (0 isn't great, though)\n stats.size = stats.size || 0;\n return stats;\n }\n /**\n * Normalize a Path by making it compliant for the content manager\n *\n * @param path: the path relatively to the Emscripten drive\n */\n normalizePath(path) {\n // Remove mountpoint prefix\n if (path.startsWith(this._mountpoint)) {\n path = path.slice(this._mountpoint.length);\n }\n // Add JupyterLab drive name\n if (this._driveName) {\n path = `${this._driveName}${DRIVE_SEPARATOR}${path}`;\n }\n return path;\n }\n}\n/**\n * An Emscripten-compatible synchronous Contents API using the service worker.\n */\nexport class ServiceWorkerContentsAPI extends ContentsAPI {\n constructor(baseUrl, driveName, mountpoint, FS, ERRNO_CODES) {\n super(driveName, mountpoint, FS, ERRNO_CODES);\n this._baseUrl = baseUrl;\n }\n request(data) {\n const xhr = new XMLHttpRequest();\n xhr.open('POST', encodeURI(this.endpoint), false);\n try {\n xhr.send(JSON.stringify(data));\n }\n catch (e) {\n console.error(e);\n }\n if (xhr.status >= 400) {\n throw new this.FS.ErrnoError(this.ERRNO_CODES['EINVAL']);\n }\n return JSON.parse(xhr.responseText);\n }\n /**\n * Get the api/drive endpoint\n */\n get endpoint() {\n return `${this._baseUrl}api/drive`;\n }\n}\nexport class DriveFS {\n constructor(options) {\n this.FS = options.FS;\n this.PATH = options.PATH;\n this.ERRNO_CODES = options.ERRNO_CODES;\n this.API = this.createAPI(options);\n this.driveName = options.driveName;\n this.node_ops = new DriveFSEmscriptenNodeOps(this);\n this.stream_ops = new DriveFSEmscriptenStreamOps(this);\n }\n /**\n * Create the ContentsAPI.\n *\n * This is supposed to be overwritten if needed.\n */\n createAPI(options) {\n return new ServiceWorkerContentsAPI(options.baseUrl, options.driveName, options.mountpoint, options.FS, options.ERRNO_CODES);\n }\n mount(mount) {\n return this.createNode(null, mount.mountpoint, DIR_MODE | 511, 0);\n }\n createNode(parent, name, mode, dev) {\n const FS = this.FS;\n if (!FS.isDir(mode) && !FS.isFile(mode)) {\n throw new FS.ErrnoError(this.ERRNO_CODES['EINVAL']);\n }\n const node = FS.createNode(parent, name, mode, dev);\n node.node_ops = this.node_ops;\n node.stream_ops = this.stream_ops;\n return node;\n }\n getMode(path) {\n return this.API.getmode(path);\n }\n realPath(node) {\n const parts = [];\n let currentNode = node;\n parts.push(currentNode.name);\n while (currentNode.parent !== currentNode) {\n currentNode = currentNode.parent;\n parts.push(currentNode.name);\n }\n parts.reverse();\n return this.PATH.join.apply(null, parts);\n }\n}\n//# sourceMappingURL=drivefs.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/// <reference path=\"../../../node_modules/@types/emscripten/index.d.ts\" />\nexport const DIR_MODE = 16895; // 040777\nexport const FILE_MODE = 33206; // 100666\nexport const SEEK_CUR = 1;\nexport const SEEK_END = 2;\nexport function instanceOfStream(nodeOrStream) {\n return 'node' in nodeOrStream;\n}\n//# sourceMappingURL=emscripten.js.map","// Copyright (c) Thorsten Beier\n// Copyright (c) JupyterLite Contributors\n// Distributed under the terms of the Modified BSD License.\nimport { URLExt } from '@jupyterlab/coreutils';\nglobalThis.Module = {};\n// when a toplevel cell uses an await, the cell is implicitly\n// wrapped in a async function. Since the webloop - eventloop\n// implementation does not support `eventloop.run_until_complete(f)`\n// we need to convert the toplevel future in a javascript Promise\n// this `toplevel` promise is then awaited before we\n// execute the next cell. After the promise is awaited we need\n// to do some cleanup and delete the python proxy\n// (ie a js-wrapped python object) to avoid memory leaks\nglobalThis.toplevel_promise = null;\nglobalThis.toplevel_promise_py_proxy = null;\nlet resolveInputReply;\nlet kernelReady;\nlet rawXKernel;\nlet rawXServer;\nasync function get_stdin() {\n const replyPromise = new Promise(resolve => {\n resolveInputReply = resolve;\n });\n return replyPromise;\n}\nself.get_stdin = get_stdin;\nasync function waitRunDependency() {\n const promise = new Promise(resolve => {\n globalThis.Module.monitorRunDependencies = (n) => {\n if (n === 0) {\n resolve();\n }\n };\n });\n // If there are no pending dependencies left, monitorRunDependencies will\n // never be called. Since we can't check the number of dependencies,\n // manually trigger a call.\n globalThis.Module.addRunDependency('dummy');\n globalThis.Module.removeRunDependency('dummy');\n return promise;\n}\nglobalThis.ready = new Promise(resolve => {\n kernelReady = resolve;\n});\nexport class XeusRemoteKernel {\n constructor(options = {}) {\n this._driveName = '';\n this._driveFS = null;\n this._sendWorkerMessage = () => { };\n }\n async ready() {\n return await globalThis.ready;\n }\n async cd(path) {\n if (!path || !globalThis.Module.FS) {\n return;\n }\n globalThis.Module.FS.chdir(path);\n }\n async isDir(path) {\n try {\n const lookup = globalThis.Module.FS.lookupPath(path);\n return globalThis.Module.FS.isDir(lookup.node.mode);\n }\n catch (e) {\n return false;\n }\n }\n async processMessage(event) {\n const msg_type = event.msg.header.msg_type;\n await globalThis.ready;\n if (globalThis.toplevel_promise !== null &&\n globalThis.toplevel_promise_py_proxy !== null) {\n await globalThis.toplevel_promise;\n globalThis.toplevel_promise_py_proxy.delete();\n globalThis.toplevel_promise_py_proxy = null;\n globalThis.toplevel_promise = null;\n }\n if (msg_type === 'input_reply') {\n resolveInputReply(event.msg);\n }\n else {\n rawXServer.notify_listener(event.msg);\n }\n }\n async initialize(options) {\n const { baseUrl, kernelSpec, empackEnvMetaLink } = options;\n // location of the kernel binary on the server\n const binary_js = URLExt.join(baseUrl, kernelSpec.argv[0]);\n const binary_wasm = binary_js.replace('.js', '.wasm');\n importScripts(binary_js);\n globalThis.Module = await createXeusModule({\n locateFile: (file) => {\n if (file.endsWith('.wasm')) {\n return binary_wasm;\n }\n return file;\n }\n });\n try {\n await waitRunDependency();\n // each kernel can have a `async_init` function\n // which can do kernel specific **async** initialization\n // This function is usually implemented in the pre/post.js\n // in the emscripten build of that kernel\n if (globalThis.Module['async_init'] !== undefined) {\n const kernel_root_url = empackEnvMetaLink\n ? empackEnvMetaLink\n : URLExt.join(baseUrl, `xeus/kernels/${kernelSpec.dir}`);\n const pkg_root_url = URLExt.join(baseUrl, 'xeus/kernel_packages');\n const verbose = true;\n await globalThis.Module['async_init'](kernel_root_url, pkg_root_url, verbose);\n }\n await waitRunDependency();\n rawXKernel = new globalThis.Module.xkernel();\n rawXServer = rawXKernel.get_server();\n if (!rawXServer) {\n console.error('Failed to start kernel!');\n }\n rawXKernel.start();\n }\n catch (e) {\n if (typeof e === 'number') {\n const msg = globalThis.Module.get_exception_message(e);\n console.error(msg);\n throw new Error(msg);\n }\n else {\n console.error(e);\n throw e;\n }\n }\n kernelReady(1);\n }\n /**\n * Register the callback function to send messages from the worker back to the main thread.\n * @param callback the callback to register\n */\n registerCallback(callback) {\n this._sendWorkerMessage = callback;\n }\n}\n","// Copyright (c) Thorsten Beier\n// Copyright (c) JupyterLite Contributors\n// Distributed under the terms of the Modified BSD License.\nimport coincident from 'coincident';\nimport { ContentsAPI, DriveFS } from '@jupyterlite/contents';\nimport { XeusRemoteKernel } from './worker';\nconst workerAPI = coincident(self);\n/**\n * An Emscripten-compatible synchronous Contents API using shared array buffers.\n */\nexport class SharedBufferContentsAPI extends ContentsAPI {\n request(data) {\n return workerAPI.processDriveRequest(data);\n }\n}\n/**\n * A custom drive implementation which uses shared array buffers (via coincident) if available\n */\nclass XeusDriveFS extends DriveFS {\n createAPI(options) {\n return new SharedBufferContentsAPI(options.driveName, options.mountpoint, options.FS, options.ERRNO_CODES);\n }\n}\nexport class XeusCoincidentKernel extends XeusRemoteKernel {\n /**\n * Setup custom Emscripten FileSystem\n */\n async mount(driveName, mountpoint, baseUrl) {\n const { FS, PATH, ERRNO_CODES } = globalThis.Module;\n if (!FS) {\n return;\n }\n const drive = new XeusDriveFS({\n FS,\n PATH,\n ERRNO_CODES,\n baseUrl,\n driveName,\n mountpoint\n });\n FS.mkdir(mountpoint);\n FS.mount(drive, {}, mountpoint);\n FS.chdir(mountpoint);\n }\n}\nconst worker = new XeusCoincidentKernel();\nworkerAPI.initialize = worker.initialize.bind(worker);\nworkerAPI.mount = worker.mount.bind(worker);\nworkerAPI.ready = worker.ready.bind(worker);\nworkerAPI.cd = worker.cd.bind(worker);\nworkerAPI.isDir = worker.isDir.bind(worker);\nworkerAPI.processMessage = worker.processMessage.bind(worker);\n"],"names":["Object","defineProperty","exports","value","ActivityMonitor","signaling_1","constructor","options","this","_timer","_timeout","_isDisposed","_activityStopped","Signal","signal","connect","_onSignalFired","timeout","activityStopped","isDisposed","dispose","clearData","sender","args","clearTimeout","_sender","_args","setTimeout","emit","__createBinding","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","__exportStar","p","prototype","hasOwnProperty","call","LruCache","_map","Map","_maxSize","maxSize","size","clear","key","item","delete","set","keys","next","MarkdownCodeBlocks","CODE_BLOCK_MARKER","markdownExtensions","MarkdownCodeBlock","startLine","code","endLine","isMarkdown","extension","indexOf","findMarkdownCodeBlocks","text","lines","split","codeBlocks","currentBlock","lineIndex","length","line","lineContainsMarker","constructingBlock","push","firstIndex","lastIndex","lastIndexOf","substring","__importDefault","mod","PageConfig","coreutils_1","minimist_1","url_1","getOption","name","configData","getBodyData","found","document","el","getElementById","JSON","parse","textContent","process","argv","cli","default","slice","path","fullPath","resolve","env","eval","e","console","error","JSONExt","isObject","stringify","setOption","last","getBaseUrl","URLExt","normalize","getTreeUrl","join","getShareUrl","getTreeShareUrl","getUrl","_a","_b","_c","_d","toShare","mode","workspace","labOrDoc","defaultWorkspace","encodeURIComponent","treePath","encodeParts","getWsUrl","baseUrl","wsUrl","getNBConvertURL","format","download","notebookPath","url","getToken","getNotebookVersion","notebookVersion","Extension","body","val","dataset","decodeURIComponent","populate","raw","warn","deferred","disabled","isDeferred","id","separatorIndex","extName","some","isDisabled","PathExt","path_1","removeSlash","paths","posix","joinWithLeadingSlash","basename","ext","dirname","dir","extname","parts","relative","from","to","normalizeExtension","signalToPromise","waitForSignal","PromiseDelegate","cleanup","disconnect","slot","reject","promise","Text","jsIndexToCharIndex","jsIdx","charIndexToJsIndex","charIdx","camelCase","str","upper","replace","match","p1","p2","toUpperCase","toLowerCase","titleCase","map","word","charAt","Time","UNITS","milliseconds","formatHuman","lang","documentElement","formatter","Intl","RelativeTimeFormat","numeric","style","delta","Date","getTime","now","unit","amount","Math","ceil","DateTimeFormat","dateStyle","timeStyle","url_parse_1","a","createElement","href","u","isSchemaLess","protocol","slashes","prefix","auth","host","pathname","getHostName","hostname","toString","objectToQueryString","filter","content","String","queryStringToObject","reduce","acc","isLocal","allowRoot","isPrimitive","isArray","Array","deepEqual","first","second","a1","a2","i","n","deepArrayEqual","firstValue","secondValue","deepObjectEqual","deepCopy","result","deepArrayCopy","subvalue","deepObjectCopy","emptyObject","freeze","emptyArray","fallbackRandomValues","buffer","random","Random","getRandomValues","crypto","window","msCrypto","UUID","uuid4","bytes","Uint8Array","lut","uuid4Factory","MimeData","_types","_values","types","hasData","mime","getData","setData","data","splice","Promise","_resolve","_reject","reason","Token","description","_tokenStructuralPropertyT","factory","ArrayExt","Private","StringExt","firstIndexOf","array","start","stop","span","max","min","j","findFirstIndex","fn","findLastIndex","d","reverse","b","removeAt","index","findFirstValue","findLastValue","lowerBound","begin","half","middle","upperBound","shallowEqual","step","Error","floor","move","fromIndex","toIndex","rotate","pivot","fill","insert","removeFirstOf","removeLastOf","removeAllOf","count","removeFirstWhere","removeLastWhere","removeAllWhere","rangeLength","Infinity","findIndices","source","query","indices","matchSumOfSquares","score","matchSumOfDeltas","highlight","cmp","thisArg","disconnectBetween","receiver","disconnectSender","disconnectReceiver","disconnectAll","object","getExceptionHandler","exceptionHandler","setExceptionHandler","handler","old","Stream","super","arguments","_pending","Symbol","asyncIterator","pending","_","catch","receivers","receiversForSender","connection","scheduleCleanup","sendersForReceiver","senders","err","findConnection","invokeSlot","WeakMap","dirtySet","Set","schedule","requestAnimationFrame","setImmediate","connections","find","cleanupDirtySet","add","forEach","cleanupConnections","isDeadConnection","isNumber","x","test","isConstructorOrProto","obj","module","opts","flags","bools","strings","unknownFn","unknown","boolean","allBools","concat","Boolean","aliases","aliasIsBoolean","alias","y","string","defaults","setKey","Number","lastKey","setArg","arg","argDefined","notFlags","letters","broken","stopEarly","apply","assertPath","TypeError","normalizeStringPosix","allowAboveRoot","res","lastSegmentLength","lastSlash","dots","charCodeAt","lastSlashIndex","cwd","resolvedPath","resolvedAbsolute","isAbsolute","trailingSeparator","joined","fromStart","fromEnd","fromLen","toStart","toLen","lastCommonSep","fromCode","out","_makeLong","hasRoot","end","matchedSlash","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","pathObject","sep","root","base","_format","ret","delimiter","win32","has","decode","input","encode","pairs","isNaN","part","parser","exec","port","required","qs","controlOrWhitespace","CRHTLF","protocolre","windowsDriveLetter","trimLeft","rules","address","isSpecial","NaN","ignore","hash","lolcation","loc","location","g","self","finaldestination","type","Url","unescape","scheme","extractProtocol","rest","forwardSlashes","otherSlashes","slashesCount","extracted","instruction","instructions","unshift","up","username","password","origin","pop","char","ins","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","definition","globalThis","Function","prop","r","toStringTag","FUNCTION","CHANNEL","GET","HAS","SET","SharedArrayBuffer","notify","wait","waitAsync","Atomics","postPatched","onmessage","w","Worker","postMessage","ArrayBuffer","ids","resolvers","listener","event","details","stopImmediatePropagation","sb","addEventListener","then","buff","as","Int32Array","BYTES_PER_ELEMENT","I32_BYTES","UI16_BYTES","Uint16Array","buffers","WeakSet","context","syncResult","uid","coincident","transform","interrupt","sendMessage","post","transfer","delay","decoder","TextDecoder","waitFor","isAsync","waitInterrupt","seppuku","Proxy","action","startsWith","at","deadlock","actions","callback","results","async","serialized","ui16a","encoder","TextEncoder","flagNeedsWrite","DriveFSEmscriptenStreamOps","fs","open","stream","realPath","node","FS","isFile","file","API","close","parsedFlags","parseInt","needsWrite","put","read","offset","position","subarray","write","timestamp","oldData","llseek","whence","ErrnoError","ERRNO_CODES","EPERM","EINVAL","DriveFSEmscriptenNodeOps","nodeOrStream","instanceOfStream","getattr","ino","setattr","attr","entries","lookup","parent","PATH","join2","ok","genericErrors","createNode","mknod","dev","rename","newDir","newName","oldNode","newDirNode","unlink","rmdir","readdir","symlink","oldPath","readlink","ContentsAPI","driveName","mountpoint","_driveName","_mountpoint","request","method","normalizePath","getmode","newPath","dirlist","response","serializedContent","binString","atob","len","binary","byteLength","fromCharCode","btoa","stats","atime","mtime","ctime","ServiceWorkerContentsAPI","_baseUrl","xhr","XMLHttpRequest","encodeURI","endpoint","send","status","responseText","DriveFS","createAPI","node_ops","stream_ops","mount","DIR_MODE","isDir","getMode","currentNode","resolveInputReply","kernelReady","rawXKernel","rawXServer","waitRunDependency","Module","monitorRunDependencies","addRunDependency","removeRunDependency","toplevel_promise","toplevel_promise_py_proxy","get_stdin","ready","XeusRemoteKernel","_driveFS","_sendWorkerMessage","cd","chdir","lookupPath","processMessage","msg_type","msg","header","notify_listener","initialize","kernelSpec","empackEnvMetaLink","binary_js","binary_wasm","importScripts","createXeusModule","locateFile","endsWith","kernel_root_url","pkg_root_url","verbose","xkernel","get_server","get_exception_message","registerCallback","workerAPI","SharedBufferContentsAPI","processDriveRequest","XeusDriveFS","XeusCoincidentKernel","drive","mkdir","worker","bind"],"sourceRoot":""}