@opensumi/ide-components 3.1.4-next-1719541057.0 → 3.1.4-next-1721010662.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -985,7 +985,7 @@
985
985
  z-index: var(--stacking-level-popover-component, 1000);
986
986
  }
987
987
  .kt-popover-content img {
988
- max-width: 300px;
988
+ max-width: 20px;
989
989
  display: inline-block;
990
990
  }
991
991
  .kt-popover-hidden {
@@ -3227,7 +3227,7 @@
3227
3227
  z-index: var(--stacking-level-popover-component, 1000);
3228
3228
  }
3229
3229
  .kt-popover-content img {
3230
- max-width: 300px;
3230
+ max-width: 20px;
3231
3231
  display: inline-block;
3232
3232
  }
3233
3233
  .kt-popover-hidden {
@@ -3510,6 +3510,12 @@
3510
3510
  /*!*************************************************************************************************************************************************************************************!*\
3511
3511
  !*** css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!../../node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./src/scrollbars/styles.less ***!
3512
3512
  \*************************************************************************************************************************************************************************************/
3513
+ .design_left_slot .kt-scrollbar .scrollbar-thumb-vertical,
3514
+ .design_right_slot .kt-scrollbar .scrollbar-thumb-vertical,
3515
+ .design_left_slot .kt-scrollbar .scrollbar-thumb-horizontal,
3516
+ .design_right_slot .kt-scrollbar .scrollbar-thumb-horizontal {
3517
+ border-radius: 5px;
3518
+ }
3513
3519
  .kt-scrollbar .scrollbar-thumb-vertical,
3514
3520
  .kt-scrollbar .scrollbar-thumb-horizontal {
3515
3521
  opacity: 0;
package/dist/index.js CHANGED
@@ -5785,7 +5785,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\ncons
5785
5785
  /***/ ((__unused_webpack_module, exports) => {
5786
5786
 
5787
5787
  "use strict";
5788
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AIInlineChatContentWidgetId = void 0;\nexports.AIInlineChatContentWidgetId = 'AI-Inline-Chat-Content-Widget';\n//# sourceMappingURL=views.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../core-common/lib/ai-native/views.js?");
5788
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AIInlineInputChatContentWidgetId = exports.AIInlineHintLineContentWidgetId = exports.AIInlineChatContentWidgetId = void 0;\nexports.AIInlineChatContentWidgetId = 'AI-Inline-Chat-Content-Widget';\nexports.AIInlineHintLineContentWidgetId = 'AI-Inline-Hint-Line-Content-Widget';\nexports.AIInlineInputChatContentWidgetId = 'AI-Inline-Input-Chat-Content-Widget';\n//# sourceMappingURL=views.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../core-common/lib/ai-native/views.js?");
5789
5789
 
5790
5790
  /***/ }),
5791
5791
 
@@ -6731,7 +6731,7 @@ eval("\n/* ---------------------------------------------------------------------
6731
6731
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6732
6732
 
6733
6733
  "use strict";
6734
- eval("\n/* ---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n// Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/event.ts\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EventQueue = exports.Dispatcher = exports.ReadyEvent = exports.Relay = exports.EventBufferer = exports.EventMultiplexer = exports.AsyncEmitter = exports.WaitUntilEvent = exports.PauseableEmitter = exports.Emitter = exports.setGlobalLeakWarningThreshold = exports.Event = void 0;\nconst disposable_1 = __webpack_require__(/*! ./disposable */ \"../utils/lib/disposable.js\");\nconst errors_1 = __webpack_require__(/*! ./errors */ \"../utils/lib/errors.js\");\nconst functional_1 = __webpack_require__(/*! ./functional */ \"../utils/lib/functional.js\");\nconst linked_list_1 = __webpack_require__(/*! ./linked-list */ \"../utils/lib/linked-list.js\");\nconst uuid_1 = __webpack_require__(/*! ./uuid */ \"../utils/lib/uuid.js\");\nvar Event;\n(function (Event) {\n const _disposable = { dispose() { } };\n Event.None = function () {\n return _disposable;\n };\n /**\n * Given an event, returns another event which only fires once.\n */\n function once(event) {\n return (listener, thisArgs = null, disposables) => {\n // we need this, in case the event fires during the listener call\n let didFire = false;\n const result = event((e) => {\n if (didFire) {\n return;\n }\n else if (result) {\n result.dispose();\n }\n else {\n didFire = true;\n }\n return listener.call(thisArgs, e);\n }, null, disposables);\n if (didFire) {\n result.dispose();\n }\n return result;\n };\n }\n Event.once = once;\n /**\n * Given an event and a `map` function, returns another event which maps each element\n * throught the mapping function.\n */\n function map(event, map) {\n return snapshot((listener, thisArgs = null, disposables) => event((i) => listener.call(thisArgs, map(i)), null, disposables));\n }\n Event.map = map;\n /**\n * Given an event and an `each` function, returns another identical event and calls\n * the `each` function per each element.\n */\n function forEach(event, each) {\n return snapshot((listener, thisArgs = null, disposables) => event((i) => {\n each(i);\n listener.call(thisArgs, i);\n }, null, disposables));\n }\n Event.forEach = forEach;\n function filter(event, filter) {\n return snapshot((listener, thisArgs = null, disposables) => event((e) => filter(e) && listener.call(thisArgs, e), null, disposables));\n }\n Event.filter = filter;\n /**\n * Given an event, returns the same event but typed as `Event<void>`.\n */\n function signal(event) {\n return event;\n }\n Event.signal = signal;\n /**\n * Given a collection of events, returns a single event which emits\n * whenever any of the provided events emit.\n */\n function any(...events) {\n return (listener, thisArgs = null, disposables) => (0, disposable_1.combinedDisposable)(events.map((event) => event((e) => listener.call(thisArgs, e), null, disposables)));\n }\n Event.any = any;\n /**\n * Given an event and a `merge` function, returns another event which maps each element\n * and the cummulative result throught the `merge` function. Similar to `map`, but with memory.\n */\n function reduce(event, merge, initial) {\n let output = initial;\n return map(event, (e) => {\n output = merge(output, e);\n return output;\n });\n }\n Event.reduce = reduce;\n /**\n * Given a chain of event processing functions (filter, map, etc), each\n * function will be invoked per event & per listener. Snapshotting an event\n * chain allows each function to be invoked just once per event.\n */\n function snapshot(event) {\n let listener;\n const emitter = new Emitter({\n onFirstListenerAdd() {\n listener = event(emitter.fire, emitter);\n },\n onLastListenerRemove() {\n listener.dispose();\n },\n });\n return emitter.event;\n }\n Event.snapshot = snapshot;\n function debounce(event, merge, delay = 100, leading = false, leakWarningThreshold) {\n let subscription;\n let output;\n let handle;\n let numDebouncedCalls = 0;\n const emitter = new Emitter({\n leakWarningThreshold,\n onFirstListenerAdd() {\n subscription = event((cur) => {\n numDebouncedCalls++;\n output = merge(output, cur);\n if (leading && !handle) {\n emitter.fire(output);\n }\n clearTimeout(handle);\n handle = setTimeout(() => {\n const _output = output;\n output = undefined;\n handle = undefined;\n if (!leading || numDebouncedCalls > 1) {\n emitter.fire(_output);\n }\n numDebouncedCalls = 0;\n }, delay);\n });\n },\n onLastListenerRemove() {\n subscription.dispose();\n },\n });\n return emitter.event;\n }\n Event.debounce = debounce;\n /**\n * Given an event, it returns another event which fires only once and as soon as\n * the input event emits. The event data is the number of millis it took for the\n * event to fire.\n */\n function stopwatch(event) {\n const start = new Date().getTime();\n return map(once(event), (_) => new Date().getTime() - start);\n }\n Event.stopwatch = stopwatch;\n /**\n * Given an event, it returns another event which fires only when the event\n * element changes.\n */\n function latch(event) {\n let firstCall = true;\n let cache;\n return filter(event, (value) => {\n const shouldEmit = firstCall || value !== cache;\n firstCall = false;\n cache = value;\n return shouldEmit;\n });\n }\n Event.latch = latch;\n /**\n * Buffers the provided event until a first listener comes\n * along, at which point fire all the events at once and\n * pipe the event from then on.\n *\n * ```typescript\n * const emitter = new Emitter<number>();\n * const event = emitter.event;\n * const bufferedEvent = buffer(event);\n *\n * emitter.fire(1);\n * emitter.fire(2);\n * emitter.fire(3);\n * // nothing...\n *\n * const listener = bufferedEvent(num => console.log(num));\n * // 1, 2, 3\n *\n * emitter.fire(4);\n * // 4\n * ```\n */\n function buffer(event, nextTick = false, _buffer = []) {\n let buffer = _buffer.slice();\n let listener = event((e) => {\n if (buffer) {\n buffer.push(e);\n }\n else {\n emitter.fire(e);\n }\n });\n const flush = () => {\n if (buffer) {\n buffer.forEach((e) => emitter.fire(e));\n }\n buffer = null;\n };\n const emitter = new Emitter({\n onFirstListenerAdd() {\n if (!listener) {\n listener = event((e) => emitter.fire(e));\n }\n },\n onFirstListenerDidAdd() {\n if (buffer) {\n if (nextTick) {\n setTimeout(flush);\n }\n else {\n flush();\n }\n }\n },\n onLastListenerRemove() {\n if (listener) {\n listener.dispose();\n }\n listener = null;\n },\n });\n return emitter.event;\n }\n Event.buffer = buffer;\n class ChainableEvent {\n constructor(event) {\n this.event = event;\n }\n map(fn) {\n return new ChainableEvent(map(this.event, fn));\n }\n forEach(fn) {\n return new ChainableEvent(forEach(this.event, fn));\n }\n filter(fn) {\n return new ChainableEvent(filter(this.event, fn));\n }\n reduce(merge, initial) {\n return new ChainableEvent(reduce(this.event, merge, initial));\n }\n latch() {\n return new ChainableEvent(latch(this.event));\n }\n on(listener, thisArgs, disposables) {\n return this.event(listener, thisArgs, disposables);\n }\n once(listener, thisArgs, disposables) {\n return once(this.event)(listener, thisArgs, disposables);\n }\n }\n function chain(event) {\n return new ChainableEvent(event);\n }\n Event.chain = chain;\n function fromNodeEventEmitter(emitter, eventName, map = (id) => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n const result = new Emitter({ onFirstListenerAdd, onLastListenerRemove });\n return result.event;\n }\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\n function fromPromise(promise) {\n const emitter = new Emitter();\n let shouldEmit = false;\n promise\n .then(undefined, () => null)\n .then(() => {\n if (!shouldEmit) {\n setTimeout(() => emitter.fire(undefined), 0);\n }\n else {\n emitter.fire(undefined);\n }\n });\n shouldEmit = true;\n return emitter.event;\n }\n Event.fromPromise = fromPromise;\n function toPromise(event) {\n return new Promise((c) => once(event)(c));\n }\n Event.toPromise = toPromise;\n})(Event = exports.Event || (exports.Event = {}));\nlet _globalLeakWarningThreshold = -1;\nfunction setGlobalLeakWarningThreshold(n) {\n const oldValue = _globalLeakWarningThreshold;\n _globalLeakWarningThreshold = n;\n return {\n dispose() {\n _globalLeakWarningThreshold = oldValue;\n },\n };\n}\nexports.setGlobalLeakWarningThreshold = setGlobalLeakWarningThreshold;\nclass LeakageMonitor {\n constructor(customThreshold, name = (0, uuid_1.randomString)(3)) {\n this.customThreshold = customThreshold;\n this.name = name;\n this._warnCountdown = 0;\n }\n dispose() {\n if (this._stacks) {\n this._stacks.clear();\n }\n }\n check(listenerCount) {\n let threshold = _globalLeakWarningThreshold;\n if (typeof this.customThreshold === 'number') {\n threshold = this.customThreshold;\n }\n if (threshold <= 0 || listenerCount < threshold) {\n return undefined;\n }\n if (!this._stacks) {\n this._stacks = new Map();\n }\n const stack = new Error().stack.split('\\n').slice(3).join('\\n');\n const count = this._stacks.get(stack) || 0;\n this._stacks.set(stack, count + 1);\n this._warnCountdown -= 1;\n if (this._warnCountdown <= 0) {\n // only warn on first exceed and then every time the limit\n // is exceeded by 50% again\n this._warnCountdown = threshold * 0.5;\n // find most frequent listener and print warning\n let topStack = '';\n let topCount = 0;\n this._stacks.forEach((count, stack) => {\n if (!topStack || topCount < count) {\n topStack = stack;\n topCount = count;\n }\n });\n // eslint-disable-next-line no-console\n console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);\n // eslint-disable-next-line no-console\n console.warn(topStack);\n }\n return () => {\n const count = this._stacks.get(stack) || 0;\n this._stacks.set(stack, count - 1);\n };\n }\n}\nclass Emitter {\n constructor(options) {\n this._disposed = false;\n this._options = options;\n this._leakageMon =\n _globalLeakWarningThreshold > 0\n ? new LeakageMonitor(this._options && this._options.leakWarningThreshold)\n : undefined;\n }\n /**\n * For the public to allow to subscribe\n * to events from this Emitter\n */\n get event() {\n if (!this._event) {\n this._event = (listener, thisArgs, disposables) => {\n if (!this._listeners) {\n this._listeners = new linked_list_1.LinkedList();\n }\n const firstListener = this._listeners.isEmpty();\n if (firstListener && this._options && this._options.onFirstListenerAdd) {\n this._options.onFirstListenerAdd(this);\n }\n const remove = this._listeners.push(!thisArgs ? listener : [listener, thisArgs]);\n if (firstListener && this._options && this._options.onFirstListenerDidAdd) {\n this._options.onFirstListenerDidAdd(this);\n }\n if (this._options && this._options.onListenerDidAdd) {\n this._options.onListenerDidAdd(this, listener, thisArgs);\n }\n // check and record this emitter for potential leakage\n let removeMonitor;\n if (this._leakageMon) {\n removeMonitor = this._leakageMon.check(this._listeners.size);\n }\n let result;\n result = {\n dispose: () => {\n if (removeMonitor) {\n removeMonitor();\n }\n result.dispose = Emitter._noop;\n if (!this._disposed) {\n remove();\n if (this._options && this._options.onLastListenerRemove) {\n const hasListeners = this._listeners && !this._listeners.isEmpty();\n if (!hasListeners) {\n this._options.onLastListenerRemove(this);\n }\n }\n }\n },\n };\n if (disposables instanceof disposable_1.DisposableStore) {\n disposables.add(result);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(result);\n }\n return result;\n };\n }\n return this._event;\n }\n /**\n * To be kept private to fire an event to\n * subscribers\n */\n fire(event) {\n if (this._listeners) {\n // put all [listener,event]-pairs into delivery queue\n // then emit all event. an inner/nested event might be\n // the driver of this\n if (!this._deliveryQueue) {\n this._deliveryQueue = new linked_list_1.LinkedList();\n }\n for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {\n this._deliveryQueue.push([e.value, event]);\n }\n while (this._deliveryQueue.size > 0) {\n const [listener, event] = this._deliveryQueue.shift();\n try {\n if (typeof listener === 'function') {\n listener.call(undefined, event);\n }\n else {\n listener[0].call(listener[1], event);\n }\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n }\n }\n }\n }\n /**\n * 发送一个异步事件,等待所有监听器返回,并收集返回值\n * @param e\n * @param timeout\n */\n async fireAndAwait(event, timeout = 2000) {\n if (this._listeners) {\n if (!this._deliveryQueue) {\n this._deliveryQueue = new linked_list_1.LinkedList();\n }\n for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {\n this._deliveryQueue.push([e.value, event]);\n }\n const promises = [];\n const timeoutPromise = new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n err: new Error('timeout'),\n });\n }, timeout);\n });\n while (this._deliveryQueue.size > 0) {\n const [listener, event] = this._deliveryQueue.shift();\n try {\n const promise = (async () => {\n try {\n if (typeof listener === 'function') {\n return {\n result: (await listener.call(undefined, event)),\n };\n }\n else {\n return {\n result: (await listener[0].call(listener[1], event)),\n };\n }\n }\n catch (e) {\n return {\n err: e,\n };\n }\n })();\n promises.push(Promise.race([timeoutPromise, promise]));\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n }\n }\n return Promise.all(promises);\n }\n else {\n return [];\n }\n }\n get listenerSize() {\n return this._listeners ? this._listeners.size : 0;\n }\n dispose() {\n if (this._listeners) {\n this._listeners.clear();\n }\n if (this._deliveryQueue) {\n this._deliveryQueue.clear();\n }\n if (this._leakageMon) {\n this._leakageMon.dispose();\n }\n this._disposed = true;\n }\n}\nexports.Emitter = Emitter;\nEmitter._noop = function () { };\nclass PauseableEmitter extends Emitter {\n constructor(options) {\n super(options);\n this._isPaused = 0;\n this._eventQueue = new linked_list_1.LinkedList();\n this._mergeFn = options && options.merge;\n }\n pause() {\n this._isPaused++;\n }\n resume() {\n if (this._isPaused !== 0 && --this._isPaused === 0) {\n if (this._mergeFn) {\n // use the merge function to create a single composite\n // event. make a copy in case firing pauses this emitter\n const events = this._eventQueue.toArray();\n this._eventQueue.clear();\n super.fire(this._mergeFn(events));\n }\n else {\n // no merging, fire each event individually and test\n // that this emitter isn't paused halfway through\n while (!this._isPaused && this._eventQueue.size !== 0) {\n super.fire(this._eventQueue.shift());\n }\n }\n }\n }\n fire(event) {\n if (this._listeners) {\n if (this._isPaused !== 0) {\n this._eventQueue.push(event);\n }\n else {\n super.fire(event);\n }\n }\n }\n}\nexports.PauseableEmitter = PauseableEmitter;\nvar WaitUntilEvent;\n(function (WaitUntilEvent) {\n async function fire(emitter, event, timeout = undefined) {\n const waitables = [];\n const asyncEvent = Object.assign(event, {\n waitUntil: (thenable) => {\n if (Object.isFrozen(waitables)) {\n throw new Error('waitUntil cannot be called asynchronously.');\n }\n waitables.push(thenable);\n },\n });\n emitter.fire(asyncEvent);\n // Asynchronous calls to `waitUntil` should fail.\n Object.freeze(waitables);\n // ts 要求 delete 的属性是 optional\n delete asyncEvent.waitUntil;\n if (!waitables.length) {\n return;\n }\n if (timeout !== undefined) {\n await Promise.race([Promise.all(waitables), new Promise((resolve) => setTimeout(resolve, timeout))]);\n }\n else {\n await Promise.all(waitables);\n }\n }\n WaitUntilEvent.fire = fire;\n})(WaitUntilEvent = exports.WaitUntilEvent || (exports.WaitUntilEvent = {}));\nclass AsyncEmitter extends Emitter {\n async fireAsync(data, token, promiseJoin) {\n if (!this._listeners) {\n return;\n }\n if (!this._asyncDeliveryQueue) {\n this._asyncDeliveryQueue = new linked_list_1.LinkedList();\n }\n for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {\n this._asyncDeliveryQueue.push([e.value, data]);\n }\n while (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n const [listener, data] = this._asyncDeliveryQueue.shift();\n const thenables = [];\n const event = Object.assign(Object.assign({}, data), { waitUntil: (p) => {\n if (Object.isFrozen(thenables)) {\n throw new Error('waitUntil can NOT be called asynchronous');\n }\n if (promiseJoin) {\n p = promiseJoin(p, typeof listener === 'function' ? listener : listener[0]);\n }\n thenables.push(p);\n } });\n try {\n if (typeof listener === 'function') {\n listener.call(undefined, event);\n }\n else {\n listener[0].call(listener[1], event);\n }\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n continue;\n }\n // freeze thenables-collection to enforce sync-calls to\n // wait until and then wait for all thenables to resolve\n Object.freeze(thenables);\n await Promise.all(\n // Promise.allSettled 只有 core-js3 才支持,先手动加 catch 处理下\n thenables.map((thenable) => thenable.catch((e) => e))).catch((e) => (0, errors_1.onUnexpectedError)(e));\n }\n }\n}\nexports.AsyncEmitter = AsyncEmitter;\nclass EventMultiplexer {\n constructor() {\n this.hasListeners = false;\n this.events = [];\n this.emitter = new Emitter({\n onFirstListenerAdd: () => this.onFirstListenerAdd(),\n onLastListenerRemove: () => this.onLastListenerRemove(),\n });\n }\n get event() {\n return this.emitter.event;\n }\n add(event) {\n const e = { event, listener: null };\n this.events.push(e);\n if (this.hasListeners) {\n this.hook(e);\n }\n const dispose = () => {\n if (this.hasListeners) {\n this.unhook(e);\n }\n const idx = this.events.indexOf(e);\n this.events.splice(idx, 1);\n };\n return (0, disposable_1.toDisposable)((0, functional_1.once)(dispose));\n }\n onFirstListenerAdd() {\n this.hasListeners = true;\n this.events.forEach((e) => this.hook(e));\n }\n onLastListenerRemove() {\n this.hasListeners = false;\n this.events.forEach((e) => this.unhook(e));\n }\n hook(e) {\n e.listener = e.event((r) => this.emitter.fire(r));\n }\n unhook(e) {\n if (e.listener) {\n e.listener.dispose();\n }\n e.listener = null;\n }\n dispose() {\n this.emitter.dispose();\n }\n}\nexports.EventMultiplexer = EventMultiplexer;\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nclass EventBufferer {\n constructor() {\n this.buffers = [];\n }\n wrapEvent(event) {\n return (listener, thisArgs, disposables) => event((i) => {\n const buffer = this.buffers[this.buffers.length - 1];\n if (buffer) {\n buffer.push(() => listener.call(thisArgs, i));\n }\n else {\n listener.call(thisArgs, i);\n }\n }, undefined, disposables);\n }\n bufferEvents(fn) {\n const buffer = [];\n this.buffers.push(buffer);\n const r = fn();\n this.buffers.pop();\n buffer.forEach((flush) => flush());\n return r;\n }\n}\nexports.EventBufferer = EventBufferer;\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nclass Relay {\n constructor() {\n this.listening = false;\n this.inputEvent = Event.None;\n this.inputEventListener = disposable_1.Disposable.None;\n this.emitter = new Emitter({\n onFirstListenerDidAdd: () => {\n this.listening = true;\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n },\n onLastListenerRemove: () => {\n this.listening = false;\n this.inputEventListener.dispose();\n },\n });\n this.event = this.emitter.event;\n }\n set input(event) {\n this.inputEvent = event;\n if (this.listening) {\n this.inputEventListener.dispose();\n this.inputEventListener = event(this.emitter.fire, this.emitter);\n }\n }\n dispose() {\n this.inputEventListener.dispose();\n this.emitter.dispose();\n }\n}\nexports.Relay = Relay;\n/**\n * 同步执行的 Ready, 对 ready 的实时响应比 promise 快,多用在需要快速响应初始化回调的场景\n */\nclass ReadyEvent {\n constructor() {\n this._isReady = false;\n this._param = undefined;\n this._emitter = new Emitter();\n }\n onceReady(cb) {\n if (this._isReady) {\n try {\n return Promise.resolve(cb(this._param));\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n else {\n return new Promise((resolve, reject) => {\n this._emitter.event((param) => {\n try {\n resolve(cb(param));\n }\n catch (e) {\n reject(e);\n }\n });\n });\n }\n }\n ready(param) {\n if (!this._isReady) {\n this._isReady = true;\n this._param = param;\n }\n this._emitter.fire(param);\n this._emitter.dispose();\n this._emitter = null;\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n }\n }\n}\nexports.ReadyEvent = ReadyEvent;\nclass Dispatcher {\n constructor() {\n this._emitter = new Emitter();\n }\n on(type) {\n return Event.map(Event.filter(this._emitter.event, (e) => e.type === type), (v) => v.data);\n }\n dispatch(type, data) {\n this._emitter.fire({\n type,\n data,\n });\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n }\n }\n}\nexports.Dispatcher = Dispatcher;\nclass EventQueue {\n constructor() {\n this.emitter = new Emitter();\n this.queue = [];\n this.isOpened = false;\n }\n open() {\n this.isOpened = true;\n this.queue.forEach((data) => {\n this.emitter.fire(data);\n });\n this.queue = [];\n }\n push(data) {\n if (this.isOpened) {\n this.emitter.fire(data);\n }\n else {\n this.queue.push(data);\n }\n }\n on(cb) {\n const disposable = this.emitter.event(cb);\n if (!this.isOpened) {\n this.open();\n }\n return disposable;\n }\n dispose() {\n this.emitter.dispose();\n }\n}\nexports.EventQueue = EventQueue;\n//# sourceMappingURL=event.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/event.js?");
6734
+ eval("\n/* ---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n// Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/event.ts\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EventQueue = exports.Dispatcher = exports.ReadyEvent = exports.Relay = exports.EventBufferer = exports.EventMultiplexer = exports.AsyncEmitter = exports.WaitUntilEvent = exports.PauseableEmitter = exports.Emitter = exports.setGlobalLeakWarningThreshold = exports.Event = void 0;\nconst disposable_1 = __webpack_require__(/*! ./disposable */ \"../utils/lib/disposable.js\");\nconst errors_1 = __webpack_require__(/*! ./errors */ \"../utils/lib/errors.js\");\nconst functional_1 = __webpack_require__(/*! ./functional */ \"../utils/lib/functional.js\");\nconst linked_list_1 = __webpack_require__(/*! ./linked-list */ \"../utils/lib/linked-list.js\");\nconst uuid_1 = __webpack_require__(/*! ./uuid */ \"../utils/lib/uuid.js\");\nvar Event;\n(function (Event) {\n const _disposable = { dispose() { } };\n Event.None = function () {\n return _disposable;\n };\n /**\n * Given an event, returns another event which only fires once.\n */\n function once(event) {\n return (listener, thisArgs = null, disposables) => {\n // we need this, in case the event fires during the listener call\n let didFire = false;\n const result = event((e) => {\n if (didFire) {\n return;\n }\n else if (result) {\n result.dispose();\n }\n else {\n didFire = true;\n }\n return listener.call(thisArgs, e);\n }, null, disposables);\n if (didFire) {\n result.dispose();\n }\n return result;\n };\n }\n Event.once = once;\n /**\n * Given an event and a `map` function, returns another event which maps each element\n * throught the mapping function.\n */\n function map(event, map) {\n return snapshot((listener, thisArgs = null, disposables) => event((i) => listener.call(thisArgs, map(i)), null, disposables));\n }\n Event.map = map;\n /**\n * Given an event and an `each` function, returns another identical event and calls\n * the `each` function per each element.\n */\n function forEach(event, each) {\n return snapshot((listener, thisArgs = null, disposables) => event((i) => {\n each(i);\n listener.call(thisArgs, i);\n }, null, disposables));\n }\n Event.forEach = forEach;\n function filter(event, filter) {\n return snapshot((listener, thisArgs = null, disposables) => event((e) => filter(e) && listener.call(thisArgs, e), null, disposables));\n }\n Event.filter = filter;\n /**\n * Given an event, returns the same event but typed as `Event<void>`.\n */\n function signal(event) {\n return event;\n }\n Event.signal = signal;\n /**\n * Given a collection of events, returns a single event which emits\n * whenever any of the provided events emit.\n */\n function any(...events) {\n return (listener, thisArgs = null, disposables) => (0, disposable_1.combinedDisposable)(events.map((event) => event((e) => listener.call(thisArgs, e), null, disposables)));\n }\n Event.any = any;\n /**\n * Given an event and a `merge` function, returns another event which maps each element\n * and the cummulative result throught the `merge` function. Similar to `map`, but with memory.\n */\n function reduce(event, merge, initial) {\n let output = initial;\n return map(event, (e) => {\n output = merge(output, e);\n return output;\n });\n }\n Event.reduce = reduce;\n /**\n * Given a chain of event processing functions (filter, map, etc), each\n * function will be invoked per event & per listener. Snapshotting an event\n * chain allows each function to be invoked just once per event.\n */\n function snapshot(event) {\n let listener;\n const emitter = new Emitter({\n onFirstListenerAdd() {\n listener = event(emitter.fire, emitter);\n },\n onLastListenerRemove() {\n listener.dispose();\n },\n });\n return emitter.event;\n }\n Event.snapshot = snapshot;\n function debounce(event, merge, delay = 100, leading = false, leakWarningThreshold) {\n let subscription;\n let output;\n let handle;\n let numDebouncedCalls = 0;\n const emitter = new Emitter({\n leakWarningThreshold,\n onFirstListenerAdd() {\n subscription = event((cur) => {\n numDebouncedCalls++;\n output = merge(output, cur);\n if (leading && !handle) {\n emitter.fire(output);\n }\n clearTimeout(handle);\n handle = setTimeout(() => {\n const _output = output;\n output = undefined;\n handle = undefined;\n if (!leading || numDebouncedCalls > 1) {\n emitter.fire(_output);\n }\n numDebouncedCalls = 0;\n }, delay);\n });\n },\n onLastListenerRemove() {\n subscription.dispose();\n },\n });\n return emitter.event;\n }\n Event.debounce = debounce;\n /**\n * Given an event, it returns another event which fires only once and as soon as\n * the input event emits. The event data is the number of millis it took for the\n * event to fire.\n */\n function stopwatch(event) {\n const start = new Date().getTime();\n return map(once(event), (_) => new Date().getTime() - start);\n }\n Event.stopwatch = stopwatch;\n /**\n * Given an event, it returns another event which fires only when the event\n * element changes.\n */\n function latch(event) {\n let firstCall = true;\n let cache;\n return filter(event, (value) => {\n const shouldEmit = firstCall || value !== cache;\n firstCall = false;\n cache = value;\n return shouldEmit;\n });\n }\n Event.latch = latch;\n /**\n * Buffers the provided event until a first listener comes\n * along, at which point fire all the events at once and\n * pipe the event from then on.\n *\n * ```typescript\n * const emitter = new Emitter<number>();\n * const event = emitter.event;\n * const bufferedEvent = buffer(event);\n *\n * emitter.fire(1);\n * emitter.fire(2);\n * emitter.fire(3);\n * // nothing...\n *\n * const listener = bufferedEvent(num => console.log(num));\n * // 1, 2, 3\n *\n * emitter.fire(4);\n * // 4\n * ```\n */\n function buffer(event, nextTick = false, _buffer = []) {\n let buffer = _buffer.slice();\n let listener = event((e) => {\n if (buffer) {\n buffer.push(e);\n }\n else {\n emitter.fire(e);\n }\n });\n const flush = () => {\n if (buffer) {\n buffer.forEach((e) => emitter.fire(e));\n }\n buffer = null;\n };\n const emitter = new Emitter({\n onFirstListenerAdd() {\n if (!listener) {\n listener = event((e) => emitter.fire(e));\n }\n },\n onFirstListenerDidAdd() {\n if (buffer) {\n if (nextTick) {\n setTimeout(flush);\n }\n else {\n flush();\n }\n }\n },\n onLastListenerRemove() {\n if (listener) {\n listener.dispose();\n }\n listener = null;\n },\n });\n return emitter.event;\n }\n Event.buffer = buffer;\n class ChainableEvent {\n constructor(event) {\n this.event = event;\n }\n map(fn) {\n return new ChainableEvent(map(this.event, fn));\n }\n forEach(fn) {\n return new ChainableEvent(forEach(this.event, fn));\n }\n filter(fn) {\n return new ChainableEvent(filter(this.event, fn));\n }\n reduce(merge, initial) {\n return new ChainableEvent(reduce(this.event, merge, initial));\n }\n latch() {\n return new ChainableEvent(latch(this.event));\n }\n on(listener, thisArgs, disposables) {\n return this.event(listener, thisArgs, disposables);\n }\n once(listener, thisArgs, disposables) {\n return once(this.event)(listener, thisArgs, disposables);\n }\n }\n function chain(event) {\n return new ChainableEvent(event);\n }\n Event.chain = chain;\n function fromNodeEventEmitter(emitter, eventName, map = (id) => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n const result = new Emitter({ onFirstListenerAdd, onLastListenerRemove });\n return result.event;\n }\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\n function fromPromise(promise) {\n const emitter = new Emitter();\n let shouldEmit = false;\n promise\n .then(undefined, () => null)\n .then(() => {\n if (!shouldEmit) {\n setTimeout(() => emitter.fire(undefined), 0);\n }\n else {\n emitter.fire(undefined);\n }\n });\n shouldEmit = true;\n return emitter.event;\n }\n Event.fromPromise = fromPromise;\n function toPromise(event) {\n return new Promise((c) => once(event)(c));\n }\n Event.toPromise = toPromise;\n})(Event = exports.Event || (exports.Event = {}));\nlet _globalLeakWarningThreshold = -1;\nfunction setGlobalLeakWarningThreshold(n) {\n const oldValue = _globalLeakWarningThreshold;\n _globalLeakWarningThreshold = n;\n return {\n dispose() {\n _globalLeakWarningThreshold = oldValue;\n },\n };\n}\nexports.setGlobalLeakWarningThreshold = setGlobalLeakWarningThreshold;\nclass LeakageMonitor {\n constructor(customThreshold, name = (0, uuid_1.randomString)(3)) {\n this.customThreshold = customThreshold;\n this.name = name;\n this._warnCountdown = 0;\n }\n dispose() {\n if (this._stacks) {\n this._stacks.clear();\n }\n }\n check(listenerCount) {\n let threshold = _globalLeakWarningThreshold;\n if (typeof this.customThreshold === 'number') {\n threshold = this.customThreshold;\n }\n if (threshold <= 0 || listenerCount < threshold) {\n return undefined;\n }\n if (!this._stacks) {\n this._stacks = new Map();\n }\n const stack = new Error().stack.split('\\n').slice(3).join('\\n');\n const count = this._stacks.get(stack) || 0;\n this._stacks.set(stack, count + 1);\n this._warnCountdown -= 1;\n if (this._warnCountdown <= 0) {\n // only warn on first exceed and then every time the limit\n // is exceeded by 50% again\n this._warnCountdown = threshold * 0.5;\n // find most frequent listener and print warning\n let topStack = '';\n let topCount = 0;\n this._stacks.forEach((count, stack) => {\n if (!topStack || topCount < count) {\n topStack = stack;\n topCount = count;\n }\n });\n // eslint-disable-next-line no-console\n console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);\n // eslint-disable-next-line no-console\n console.warn(topStack);\n }\n return () => {\n const count = this._stacks.get(stack) || 0;\n this._stacks.set(stack, count - 1);\n };\n }\n}\nclass Emitter {\n constructor(options) {\n this._disposed = false;\n this._options = options;\n this._leakageMon =\n _globalLeakWarningThreshold > 0\n ? new LeakageMonitor(this._options && this._options.leakWarningThreshold)\n : undefined;\n }\n /**\n * For the public to allow to subscribe\n * to events from this Emitter\n */\n get event() {\n if (!this._event) {\n this._event = (listener, thisArgs, disposables) => {\n if (!this._listeners) {\n this._listeners = new linked_list_1.LinkedList();\n }\n const firstListener = this._listeners.isEmpty();\n if (firstListener && this._options && this._options.onFirstListenerAdd) {\n this._options.onFirstListenerAdd(this);\n }\n const remove = this._listeners.push(!thisArgs ? listener : [listener, thisArgs]);\n if (firstListener && this._options && this._options.onFirstListenerDidAdd) {\n this._options.onFirstListenerDidAdd(this);\n }\n if (this._options && this._options.onListenerDidAdd) {\n this._options.onListenerDidAdd(this, listener, thisArgs);\n }\n // check and record this emitter for potential leakage\n let removeMonitor;\n if (this._leakageMon) {\n removeMonitor = this._leakageMon.check(this._listeners.size);\n }\n let result;\n result = {\n dispose: () => {\n if (removeMonitor) {\n removeMonitor();\n }\n result.dispose = Emitter._noop;\n if (!this._disposed) {\n remove();\n if (this._options && this._options.onLastListenerRemove) {\n const hasListeners = this._listeners && !this._listeners.isEmpty();\n if (!hasListeners) {\n this._options.onLastListenerRemove(this);\n }\n }\n }\n },\n };\n if (disposables instanceof disposable_1.DisposableStore) {\n disposables.add(result);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(result);\n }\n return result;\n };\n }\n return this._event;\n }\n /**\n * To be kept private to fire an event to\n * subscribers\n */\n fire(event) {\n if (this._listeners) {\n // put all [listener,event]-pairs into delivery queue\n // then emit all event. an inner/nested event might be\n // the driver of this\n if (!this._deliveryQueue) {\n this._deliveryQueue = new linked_list_1.LinkedList();\n }\n for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {\n this._deliveryQueue.push([e.value, event]);\n }\n while (this._deliveryQueue.size > 0) {\n const [listener, event] = this._deliveryQueue.shift();\n try {\n if (typeof listener === 'function') {\n listener.call(undefined, event);\n }\n else {\n listener[0].call(listener[1], event);\n }\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n }\n }\n }\n }\n /**\n * 发送一个异步事件,等待所有监听器返回,并收集返回值\n * @param e\n * @param timeout\n */\n async fireAndAwait(event, timeout = 2000) {\n if (this._listeners) {\n if (!this._deliveryQueue) {\n this._deliveryQueue = new linked_list_1.LinkedList();\n }\n for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {\n this._deliveryQueue.push([e.value, event]);\n }\n const promises = [];\n const timeoutPromise = new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n err: new Error('timeout'),\n });\n }, timeout);\n });\n while (this._deliveryQueue.size > 0) {\n const [listener, event] = this._deliveryQueue.shift();\n try {\n const promise = (async () => {\n try {\n if (typeof listener === 'function') {\n return {\n result: (await listener.call(undefined, event)),\n };\n }\n else {\n return {\n result: (await listener[0].call(listener[1], event)),\n };\n }\n }\n catch (e) {\n return {\n err: e,\n };\n }\n })();\n promises.push(Promise.race([timeoutPromise, promise]));\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n }\n }\n return Promise.all(promises);\n }\n else {\n return [];\n }\n }\n get listenerSize() {\n return this._listeners ? this._listeners.size : 0;\n }\n dispose() {\n if (this._listeners) {\n this._listeners.clear();\n }\n if (this._deliveryQueue) {\n this._deliveryQueue.clear();\n }\n if (this._leakageMon) {\n this._leakageMon.dispose();\n }\n this._disposed = true;\n }\n}\nexports.Emitter = Emitter;\nEmitter._noop = function () { };\nclass PauseableEmitter extends Emitter {\n constructor(options) {\n super(options);\n this._isPaused = 0;\n this._eventQueue = new linked_list_1.LinkedList();\n this._mergeFn = options && options.merge;\n }\n pause() {\n this._isPaused++;\n }\n resume() {\n if (this._isPaused !== 0 && --this._isPaused === 0) {\n if (this._mergeFn) {\n // use the merge function to create a single composite\n // event. make a copy in case firing pauses this emitter\n const events = this._eventQueue.toArray();\n this._eventQueue.clear();\n super.fire(this._mergeFn(events));\n }\n else {\n // no merging, fire each event individually and test\n // that this emitter isn't paused halfway through\n while (!this._isPaused && this._eventQueue.size !== 0) {\n super.fire(this._eventQueue.shift());\n }\n }\n }\n }\n fire(event) {\n if (this._listeners) {\n if (this._isPaused !== 0) {\n this._eventQueue.push(event);\n }\n else {\n super.fire(event);\n }\n }\n }\n}\nexports.PauseableEmitter = PauseableEmitter;\nvar WaitUntilEvent;\n(function (WaitUntilEvent) {\n async function fire(emitter, event, timeout = undefined) {\n const waitables = [];\n const asyncEvent = Object.assign(event, {\n waitUntil: (thenable) => {\n if (Object.isFrozen(waitables)) {\n throw new Error('waitUntil cannot be called asynchronously.');\n }\n waitables.push(thenable);\n },\n });\n emitter.fire(asyncEvent);\n // Asynchronous calls to `waitUntil` should fail.\n Object.freeze(waitables);\n // ts 要求 delete 的属性是 optional\n delete asyncEvent.waitUntil;\n if (!waitables.length) {\n return;\n }\n if (timeout !== undefined) {\n await Promise.race([Promise.all(waitables), new Promise((resolve) => setTimeout(resolve, timeout))]);\n }\n else {\n await Promise.all(waitables);\n }\n }\n WaitUntilEvent.fire = fire;\n})(WaitUntilEvent = exports.WaitUntilEvent || (exports.WaitUntilEvent = {}));\nclass AsyncEmitter extends Emitter {\n async fireAsync(data, token, promiseJoin) {\n if (!this._listeners) {\n return;\n }\n if (!this._asyncDeliveryQueue) {\n this._asyncDeliveryQueue = new linked_list_1.LinkedList();\n }\n for (let iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {\n this._asyncDeliveryQueue.push([e.value, data]);\n }\n while (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n const [listener, data] = this._asyncDeliveryQueue.shift();\n const thenables = [];\n const event = Object.assign(Object.assign({}, data), { waitUntil: (p) => {\n if (Object.isFrozen(thenables)) {\n throw new Error('waitUntil can NOT be called asynchronous');\n }\n if (promiseJoin) {\n p = promiseJoin(p, typeof listener === 'function' ? listener : listener[0]);\n }\n thenables.push(p);\n } });\n try {\n if (typeof listener === 'function') {\n listener.call(undefined, event);\n }\n else {\n listener[0].call(listener[1], event);\n }\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n continue;\n }\n // freeze thenables-collection to enforce sync-calls to\n // wait until and then wait for all thenables to resolve\n Object.freeze(thenables);\n await Promise.all(\n // Promise.allSettled 只有 core-js3 才支持,先手动加 catch 处理下\n thenables.map((thenable) => thenable.catch((e) => e))).catch((e) => (0, errors_1.onUnexpectedError)(e));\n }\n }\n}\nexports.AsyncEmitter = AsyncEmitter;\nclass EventMultiplexer {\n constructor() {\n this.hasListeners = false;\n this.events = [];\n this.emitter = new Emitter({\n onFirstListenerAdd: () => this.onFirstListenerAdd(),\n onLastListenerRemove: () => this.onLastListenerRemove(),\n });\n }\n get event() {\n return this.emitter.event;\n }\n add(event) {\n const e = { event, listener: null };\n this.events.push(e);\n if (this.hasListeners) {\n this.hook(e);\n }\n const dispose = () => {\n if (this.hasListeners) {\n this.unhook(e);\n }\n const idx = this.events.indexOf(e);\n this.events.splice(idx, 1);\n };\n return (0, disposable_1.toDisposable)((0, functional_1.once)(dispose));\n }\n onFirstListenerAdd() {\n this.hasListeners = true;\n this.events.forEach((e) => this.hook(e));\n }\n onLastListenerRemove() {\n this.hasListeners = false;\n this.events.forEach((e) => this.unhook(e));\n }\n hook(e) {\n e.listener = e.event((r) => this.emitter.fire(r));\n }\n unhook(e) {\n if (e.listener) {\n e.listener.dispose();\n }\n e.listener = null;\n }\n dispose() {\n this.emitter.dispose();\n }\n}\nexports.EventMultiplexer = EventMultiplexer;\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nclass EventBufferer {\n constructor() {\n this.buffers = [];\n }\n wrapEvent(event) {\n return (listener, thisArgs, disposables) => event((i) => {\n const buffer = this.buffers[this.buffers.length - 1];\n if (buffer) {\n buffer.push(() => listener.call(thisArgs, i));\n }\n else {\n listener.call(thisArgs, i);\n }\n }, undefined, disposables);\n }\n bufferEvents(fn) {\n const buffer = [];\n this.buffers.push(buffer);\n const r = fn();\n this.buffers.pop();\n buffer.forEach((flush) => flush());\n return r;\n }\n}\nexports.EventBufferer = EventBufferer;\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nclass Relay {\n constructor() {\n this.listening = false;\n this.inputEvent = Event.None;\n this.inputEventListener = disposable_1.Disposable.None;\n this.emitter = new Emitter({\n onFirstListenerDidAdd: () => {\n this.listening = true;\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n },\n onLastListenerRemove: () => {\n this.listening = false;\n this.inputEventListener.dispose();\n },\n });\n this.event = this.emitter.event;\n }\n set input(event) {\n this.inputEvent = event;\n if (this.listening) {\n this.inputEventListener.dispose();\n this.inputEventListener = event(this.emitter.fire, this.emitter);\n }\n }\n dispose() {\n this.inputEventListener.dispose();\n this.emitter.dispose();\n }\n}\nexports.Relay = Relay;\n/**\n * 同步执行的 Ready, 对 ready 的实时响应比 promise 快,多用在需要快速响应初始化回调的场景\n */\nclass ReadyEvent {\n constructor() {\n this._isReady = false;\n this._param = undefined;\n this._emitter = new Emitter();\n }\n onceReady(cb) {\n if (this._isReady) {\n try {\n return Promise.resolve(cb(this._param));\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n else {\n return new Promise((resolve, reject) => {\n this._emitter.event((param) => {\n try {\n resolve(cb(param));\n }\n catch (e) {\n reject(e);\n }\n });\n });\n }\n }\n ready(param) {\n if (!this._isReady) {\n this._isReady = true;\n this._param = param;\n }\n this._emitter.fire(param);\n this._emitter.dispose();\n this._emitter = null;\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n }\n }\n}\nexports.ReadyEvent = ReadyEvent;\nclass Dispatcher {\n constructor() {\n this._emitter = new Emitter();\n }\n on(type) {\n return Event.map(Event.filter(this._emitter.event, (e) => e.type === type), (v) => v.data);\n }\n dispatch(type, data) {\n this._emitter.fire({\n type,\n data,\n });\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n }\n }\n}\nexports.Dispatcher = Dispatcher;\nclass EventQueue {\n constructor() {\n this._listeners = new linked_list_1.LinkedList();\n this.queue = [];\n this.isOpened = false;\n this.open = () => {\n this.isOpened = true;\n this.queue.forEach((data) => {\n this.fire(data);\n });\n this.queue = [];\n };\n this.close = () => {\n this.isOpened = false;\n };\n this.push = (data) => {\n if (this.isOpened) {\n this.fire(data);\n }\n else {\n this.queue.push(data);\n }\n };\n this.fire = (data) => {\n this._listeners.forEach((listener) => {\n listener(data);\n });\n };\n this.on = (cb) => {\n const toRemove = this._listeners.push(cb);\n if (!this.isOpened) {\n this.open();\n }\n return disposable_1.Disposable.create(() => {\n toRemove();\n if (this._listeners.size === 0) {\n this.close();\n }\n });\n };\n this.dispose = () => {\n this._listeners.clear();\n };\n }\n}\nexports.EventQueue = EventQueue;\n//# sourceMappingURL=event.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/event.js?");
6735
6735
 
6736
6736
  /***/ }),
6737
6737
 
@@ -6742,7 +6742,7 @@ eval("\n/* ---------------------------------------------------------------------
6742
6742
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6743
6743
 
6744
6744
  "use strict";
6745
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FileUri = void 0;\nconst platform_1 = __webpack_require__(/*! ./platform */ \"../utils/lib/platform.js\");\nconst uri_1 = __webpack_require__(/*! ./uri */ \"../utils/lib/uri.js\");\nvar FileUri;\n(function (FileUri) {\n const windowsDriveRegex = /^([^:/?#]+?):$/;\n /**\n * Creates a new file URI from the filesystem path argument.\n * @param fsPath the filesystem path.\n */\n function create(_fsPath) {\n return new uri_1.URI(uri_1.Uri.file(_fsPath));\n }\n FileUri.create = create;\n /**\n * Returns with the platform specific FS path that is represented by the URI argument.\n *\n * @param uri the file URI that has to be resolved to a platform specific FS path.\n */\n function fsPath(uri) {\n if (typeof uri === 'string') {\n return fsPath(new uri_1.URI(uri));\n }\n else {\n /*\n * A uri for the root of a Windows drive, eg file:\\\\\\c%3A, is converted to c:\n * by the Uri class. However file:\\\\\\c%3A is unambiguously a uri to the root of\n * the drive and c: is interpreted as the default directory for the c drive\n * (by, for example, the readdir function in the fs-extra module).\n * A backslash must be appended to the drive, eg c:\\, to ensure the correct path.\n */\n const fsPathFromVsCodeUri = uri.codeUri.fsPath;\n if (platform_1.isWindows) {\n const isWindowsDriveRoot = windowsDriveRegex.exec(fsPathFromVsCodeUri);\n if (isWindowsDriveRoot) {\n return fsPathFromVsCodeUri + '\\\\';\n }\n }\n return fsPathFromVsCodeUri;\n }\n }\n FileUri.fsPath = fsPath;\n})(FileUri = exports.FileUri || (exports.FileUri = {}));\n//# sourceMappingURL=file-uri.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/file-uri.js?");
6745
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FileUri = void 0;\nconst path_1 = __webpack_require__(/*! ./path */ \"../utils/lib/path.js\");\nconst platform_1 = __webpack_require__(/*! ./platform */ \"../utils/lib/platform.js\");\nconst uri_1 = __webpack_require__(/*! ./uri */ \"../utils/lib/uri.js\");\nvar FileUri;\n(function (FileUri) {\n const windowsDriveRegex = /^([^:/?#]+?):$/;\n /**\n * Creates a new file URI from the filesystem path argument.\n * @param fsPath the filesystem path.\n */\n function create(_fsPath) {\n return new uri_1.URI(uri_1.Uri.file(_fsPath));\n }\n FileUri.create = create;\n /**\n * Returns with the platform specific FS path that is represented by the URI argument.\n *\n * @param uri the file URI that has to be resolved to a platform specific FS path.\n */\n function fsPath(uri) {\n if (typeof uri === 'string') {\n return fsPath(new uri_1.URI(uri));\n }\n else {\n return uriToFsPath(uri.codeUri);\n }\n }\n FileUri.fsPath = fsPath;\n function uriToFsPath(uri) {\n /*\n * A uri for the root of a Windows drive, eg file:\\\\\\c%3A, is converted to c:\n * by the Uri class. However file:\\\\\\c%3A is unambiguously a uri to the root of\n * the drive and c: is interpreted as the default directory for the c drive\n * (by, for example, the readdir function in the fs-extra module).\n * A backslash must be appended to the drive, eg c:\\, to ensure the correct path.\n */\n const fsPathFromVsCodeUri = uri.fsPath;\n if (platform_1.isWindows) {\n const isWindowsDriveRoot = windowsDriveRegex.exec(fsPathFromVsCodeUri);\n if (isWindowsDriveRoot) {\n return fsPathFromVsCodeUri + '\\\\';\n }\n }\n return fsPathFromVsCodeUri;\n }\n FileUri.uriToFsPath = uriToFsPath;\n function isEqualOrParent(base, parentCandidate) {\n if (base.scheme !== parentCandidate.scheme || base.authority !== parentCandidate.authority) {\n return false;\n }\n const basePath = new path_1.Path(uriToFsPath(base));\n const parentCandidatePath = new path_1.Path(uriToFsPath(parentCandidate));\n return basePath.isEqualOrParent(parentCandidatePath);\n }\n FileUri.isEqualOrParent = isEqualOrParent;\n})(FileUri = exports.FileUri || (exports.FileUri = {}));\n//# sourceMappingURL=file-uri.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/file-uri.js?");
6746
6746
 
6747
6747
  /***/ }),
6748
6748
 
@@ -6830,7 +6830,7 @@ eval("\n/* ---------------------------------------------------------------------
6830
6830
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6831
6831
 
6832
6832
  "use strict";
6833
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.LinkedList = void 0;\nconst iterator_1 = __webpack_require__(/*! ./iterator */ \"../utils/lib/iterator.js\");\nclass Node {\n constructor(element) {\n this.element = element;\n this.next = Node.Undefined;\n this.prev = Node.Undefined;\n }\n}\nNode.Undefined = new Node(undefined);\nclass LinkedList {\n constructor() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n get size() {\n return this._size;\n }\n isEmpty() {\n return this._first === Node.Undefined;\n }\n clear() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n unshift(element) {\n return this._insert(element, false);\n }\n push(element) {\n return this._insert(element, true);\n }\n _insert(element, atTheEnd) {\n const newNode = new Node(element);\n if (this._first === Node.Undefined) {\n this._first = newNode;\n this._last = newNode;\n }\n else if (atTheEnd) {\n // push\n const oldLast = this._last;\n this._last = newNode;\n newNode.prev = oldLast;\n oldLast.next = newNode;\n }\n else {\n // unshift\n const oldFirst = this._first;\n this._first = newNode;\n newNode.next = oldFirst;\n oldFirst.prev = newNode;\n }\n this._size += 1;\n let didRemove = false;\n return () => {\n if (!didRemove) {\n didRemove = true;\n this._remove(newNode);\n }\n };\n }\n shift() {\n if (this._first === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._first.element;\n this._remove(this._first);\n return res;\n }\n }\n pop() {\n if (this._last === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._last.element;\n this._remove(this._last);\n return res;\n }\n }\n _remove(node) {\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n // middle\n const anchor = node.prev;\n anchor.next = node.next;\n node.next.prev = anchor;\n }\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n // only node\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n }\n else if (node.next === Node.Undefined) {\n // last\n this._last = this._last.prev;\n this._last.next = Node.Undefined;\n }\n else if (node.prev === Node.Undefined) {\n // first\n this._first = this._first.next;\n this._first.prev = Node.Undefined;\n }\n // done\n this._size -= 1;\n }\n iterator() {\n let element;\n let node = this._first;\n return {\n next() {\n if (node === Node.Undefined) {\n return iterator_1.FIN;\n }\n if (!element) {\n element = { done: false, value: node.element };\n }\n else {\n element.value = node.element;\n }\n node = node.next;\n return element;\n },\n };\n }\n toArray() {\n const result = [];\n for (let node = this._first; node !== Node.Undefined; node = node.next) {\n result.push(node.element);\n }\n return result;\n }\n}\nexports.LinkedList = LinkedList;\n//# sourceMappingURL=linked-list.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/linked-list.js?");
6833
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.LinkedList = void 0;\nconst errors_1 = __webpack_require__(/*! ./errors */ \"../utils/lib/errors.js\");\nconst iterator_1 = __webpack_require__(/*! ./iterator */ \"../utils/lib/iterator.js\");\nclass Node {\n constructor(element) {\n this.element = element;\n this.next = Node.Undefined;\n this.prev = Node.Undefined;\n }\n}\nNode.Undefined = new Node(undefined);\nclass LinkedList {\n constructor() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n get size() {\n return this._size;\n }\n isEmpty() {\n return this._first === Node.Undefined;\n }\n clear() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n unshift(element) {\n return this._insert(element, false);\n }\n push(element) {\n return this._insert(element, true);\n }\n _insert(element, atTheEnd) {\n const newNode = new Node(element);\n if (this._first === Node.Undefined) {\n this._first = newNode;\n this._last = newNode;\n }\n else if (atTheEnd) {\n // push\n const oldLast = this._last;\n this._last = newNode;\n newNode.prev = oldLast;\n oldLast.next = newNode;\n }\n else {\n // unshift\n const oldFirst = this._first;\n this._first = newNode;\n newNode.next = oldFirst;\n oldFirst.prev = newNode;\n }\n this._size += 1;\n let didRemove = false;\n return () => {\n if (!didRemove) {\n didRemove = true;\n this._remove(newNode);\n }\n };\n }\n shift() {\n if (this._first === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._first.element;\n this._remove(this._first);\n return res;\n }\n }\n pop() {\n if (this._last === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._last.element;\n this._remove(this._last);\n return res;\n }\n }\n _remove(node) {\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n // middle\n const anchor = node.prev;\n anchor.next = node.next;\n node.next.prev = anchor;\n }\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n // only node\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n }\n else if (node.next === Node.Undefined) {\n // last\n this._last = this._last.prev;\n this._last.next = Node.Undefined;\n }\n else if (node.prev === Node.Undefined) {\n // first\n this._first = this._first.next;\n this._first.prev = Node.Undefined;\n }\n // done\n this._size -= 1;\n }\n iterator() {\n let element;\n let node = this._first;\n return {\n next() {\n if (node === Node.Undefined) {\n return iterator_1.FIN;\n }\n if (!element) {\n element = { done: false, value: node.element };\n }\n else {\n element.value = node.element;\n }\n node = node.next;\n return element;\n },\n };\n }\n forEach(callback) {\n for (let node = this._first; node !== Node.Undefined; node = node.next) {\n try {\n callback(node.element);\n }\n catch (error) {\n (0, errors_1.onUnexpectedError)(error);\n }\n }\n }\n toArray() {\n const result = [];\n for (let node = this._first; node !== Node.Undefined; node = node.next) {\n result.push(node.element);\n }\n return result;\n }\n}\nexports.LinkedList = LinkedList;\n//# sourceMappingURL=linked-list.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/linked-list.js?");
6834
6834
 
6835
6835
  /***/ }),
6836
6836
 
@@ -6973,7 +6973,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
6973
6973
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6974
6974
 
6975
6975
  "use strict";
6976
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.containsUppercaseCharacter = exports.fuzzyContains = exports.repeat = exports.safeBtoa = exports.stripUTF8BOM = exports.startsWithUTF8BOM = exports.UTF8_BOM_CHARACTER = exports.removeAccents = exports.removeAnsiEscapeCodes = exports.lcut = exports.isFullWidthCharacter = exports.containsFullWidthCharacter = exports.isBasicASCII = exports.containsEmoji = exports.containsRTL = exports.isLowSurrogate = exports.isHighSurrogate = exports.overlap = exports.commonSuffixLength = exports.commonPrefixLength = exports.startsWithIgnoreCase = exports.equalsIgnoreCase = exports.isUpperAsciiLetter = exports.isLowerAsciiLetter = exports.compareIgnoreCase = exports.compare = exports.lastNonWhitespaceIndex = exports.getLeadingWhitespace = exports.firstNonWhitespaceIndex = exports.regExpFlags = exports.regExpContainsBackreference = exports.regExpLeadsToEndlessLoop = exports.createRegExp = exports.endsWith = exports.startsWith = exports.stripWildcards = exports.convertSimple2RegExpPattern = exports.rtrim = exports.multiRightTrim = exports.ltrim = exports.trim = exports.count = exports.escapeRegExpCharacters = exports.escape = exports.mnemonicButtonLabel = exports.format = exports.pad = exports.isFalsyOrWhitespace = exports.stringUtils = exports.empty = void 0;\nexports.format2 = exports.template = exports.decodeUTF8 = exports.encodeUTF8 = exports.getNextCodePoint = exports.computeCodePoint = exports.getNLines = exports.uppercaseFirstLetter = void 0;\nconst platform_1 = __webpack_require__(/*! ./platform */ \"../utils/lib/platform.js\");\n/**\n * The empty string.\n */\nexports.empty = '';\nconst hasTextEncoder = typeof TextEncoder !== 'undefined';\nconst hasTextDecoder = typeof TextDecoder !== 'undefined';\n/**\n * 浏览器全局可以直接使用 TextEncoder/TextDecoder\n * Node.js 11+ 才可以全局使用,以下需要 require('util')\n */\nvar stringUtils;\n(function (stringUtils) {\n stringUtils.StringTextEncoder = hasTextEncoder ? TextEncoder : (__webpack_require__(/*! util */ \"../../node_modules/util/util.js\").TextEncoder);\n stringUtils.StringTextDecoder = hasTextDecoder ? TextDecoder : (__webpack_require__(/*! util */ \"../../node_modules/util/util.js\").TextDecoder);\n})(stringUtils = exports.stringUtils || (exports.stringUtils = {}));\nfunction isFalsyOrWhitespace(str) {\n if (!str || typeof str !== 'string') {\n return true;\n }\n return str.trim().length === 0;\n}\nexports.isFalsyOrWhitespace = isFalsyOrWhitespace;\n/**\n * @returns the provided number with the given number of preceding zeros.\n */\nfunction pad(n, l, char = '0') {\n const str = '' + n;\n const r = [str];\n for (let i = str.length; i < l; i++) {\n r.push(char);\n }\n return r.reverse().join('');\n}\nexports.pad = pad;\nconst _formatRegexp = /{(\\d+)}/g;\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nfunction format(value, ...args) {\n if (args.length === 0) {\n return value;\n }\n return value.replace(_formatRegexp, function (match, group) {\n const idx = parseInt(group, 10);\n return isNaN(idx) || idx < 0 || idx >= args.length ? match : args[idx];\n });\n}\nexports.format = format;\n/**\n * Handles mnemonics for buttons. Depending on OS:\n * - Windows: Supported via & character (replace && with & and & with && for escaping)\n * - Linux: Supported via _ character (replace && with _)\n * - macOS: Unsupported (replace && with empty string)\n */\nfunction mnemonicButtonLabel(label, forceDisableMnemonics) {\n if (platform_1.isMacintosh || forceDisableMnemonics) {\n return label.replace(/\\(&&\\w\\)|&&/g, '');\n }\n if (platform_1.isWindows) {\n return label.replace(/&&|&/g, (m) => (m === '&' ? '&&' : '&'));\n }\n return label.replace(/&&/g, '_');\n}\nexports.mnemonicButtonLabel = mnemonicButtonLabel;\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nfunction escape(html) {\n return html.replace(/[<>&]/g, function (match) {\n switch (match) {\n case '<':\n return '&lt;';\n case '>':\n return '&gt;';\n case '&':\n return '&amp;';\n default:\n return match;\n }\n });\n}\nexports.escape = escape;\n/**\n * Escapes regular expression characters in a given string\n */\nfunction escapeRegExpCharacters(value) {\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\nexports.escapeRegExpCharacters = escapeRegExpCharacters;\n/**\n * Counts how often `character` occurs inside `value`.\n */\nfunction count(value, character) {\n let result = 0;\n const ch = character.charCodeAt(0);\n for (let i = value.length - 1; i >= 0; i--) {\n if (value.charCodeAt(i) === ch) {\n result++;\n }\n }\n return result;\n}\nexports.count = count;\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nfunction trim(haystack, needle = ' ') {\n const trimmed = ltrim(haystack, needle);\n return rtrim(trimmed, needle);\n}\nexports.trim = trim;\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nfunction ltrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n if (needleLen === 0 || haystack.length === 0) {\n return haystack;\n }\n let offset = 0;\n while (haystack.indexOf(needle, offset) === offset) {\n offset = offset + needleLen;\n }\n return haystack.substring(offset);\n}\nexports.ltrim = ltrim;\n/**\n * Removes all occurrences of needles from the end of haystack.\n * @param source\n * @param needles\n * @example\n * ```ts\n * let source = '/path/to/file.ts,;';\n * const res = multiRightTrim(source, [`,`, ';']);\n * // res === '/path/to/file.ts';\n * ```\n */\nfunction multiRightTrim(source, needles) {\n let result = decodeURIComponent(source);\n for (const needle of needles) {\n result = rtrim(result, needle);\n }\n return result;\n}\nexports.multiRightTrim = multiRightTrim;\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nfunction rtrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n const haystackLen = haystack.length;\n if (needleLen === 0 || haystackLen === 0) {\n return haystack;\n }\n let offset = haystackLen;\n let idx = -1;\n while (true) {\n idx = haystack.lastIndexOf(needle, offset - 1);\n if (idx === -1 || idx + needleLen !== offset) {\n break;\n }\n if (idx === 0) {\n return '';\n }\n offset = idx;\n }\n return haystack.substring(0, offset);\n}\nexports.rtrim = rtrim;\nfunction convertSimple2RegExpPattern(pattern) {\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\nexports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;\nfunction stripWildcards(pattern) {\n return pattern.replace(/\\*/g, '');\n}\nexports.stripWildcards = stripWildcards;\n/**\n * Determines if haystack starts with needle.\n */\nfunction startsWith(haystack, needle) {\n if (haystack.length < needle.length) {\n return false;\n }\n if (haystack === needle) {\n return true;\n }\n for (let i = 0; i < needle.length; i++) {\n if (haystack[i] !== needle[i]) {\n return false;\n }\n }\n return true;\n}\nexports.startsWith = startsWith;\n/**\n * Determines if haystack ends with needle.\n */\nfunction endsWith(haystack, needle) {\n const diff = haystack.length - needle.length;\n if (diff > 0) {\n return haystack.indexOf(needle, diff) === diff;\n }\n else if (diff === 0) {\n return haystack === needle;\n }\n else {\n return false;\n }\n}\nexports.endsWith = endsWith;\nfunction createRegExp(searchString, isRegex, options = {}) {\n if (!searchString) {\n throw new Error('Cannot create regex from empty string');\n }\n if (!isRegex) {\n searchString = escapeRegExpCharacters(searchString);\n }\n if (options.wholeWord) {\n if (!/\\B/.test(searchString.charAt(0))) {\n searchString = '\\\\b' + searchString;\n }\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n searchString = searchString + '\\\\b';\n }\n }\n let modifiers = '';\n if (options.global) {\n modifiers += 'g';\n }\n if (!options.matchCase) {\n modifiers += 'i';\n }\n if (options.multiline) {\n modifiers += 'm';\n }\n if (options.unicode) {\n modifiers += 'u';\n }\n return new RegExp(searchString, modifiers);\n}\nexports.createRegExp = createRegExp;\nfunction regExpLeadsToEndlessLoop(regexp) {\n // Exit early if it's one of these special cases which are meant to match\n // against an empty string\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n return false;\n }\n // We check against an empty string. If the regular expression doesn't advance\n // (e.g. ends in an endless loop) it will match an empty string.\n const match = regexp.exec('');\n return !!(match && regexp.lastIndex === 0);\n}\nexports.regExpLeadsToEndlessLoop = regExpLeadsToEndlessLoop;\nfunction regExpContainsBackreference(regexpValue) {\n return !!regexpValue.match(/([^\\\\]|^)(\\\\\\\\)*\\\\\\d+/);\n}\nexports.regExpContainsBackreference = regExpContainsBackreference;\nfunction regExpFlags(regexp) {\n return ((regexp.global ? 'g' : '') +\n (regexp.ignoreCase ? 'i' : '') +\n (regexp.multiline ? 'm' : '') +\n (regexp.unicode ? 'u' : ''));\n}\nexports.regExpFlags = regExpFlags;\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nfunction firstNonWhitespaceIndex(str) {\n for (let i = 0, len = str.length; i < len; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\nexports.firstNonWhitespaceIndex = firstNonWhitespaceIndex;\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nfunction getLeadingWhitespace(str, start = 0, end = str.length) {\n for (let i = start; i < end; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return str.substring(start, i);\n }\n }\n return str.substring(start, end);\n}\nexports.getLeadingWhitespace = getLeadingWhitespace;\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nfunction lastNonWhitespaceIndex(str, startIndex = str.length - 1) {\n for (let i = startIndex; i >= 0; i--) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\nexports.lastNonWhitespaceIndex = lastNonWhitespaceIndex;\nfunction compare(a, b) {\n if (a < b) {\n return -1;\n }\n else if (a > b) {\n return 1;\n }\n else {\n return 0;\n }\n}\nexports.compare = compare;\nfunction compareIgnoreCase(a, b) {\n const len = Math.min(a.length, b.length);\n for (let i = 0; i < len; i++) {\n let codeA = a.charCodeAt(i);\n let codeB = b.charCodeAt(i);\n if (codeA === codeB) {\n // equal\n continue;\n }\n if (isUpperAsciiLetter(codeA)) {\n codeA += 32;\n }\n if (isUpperAsciiLetter(codeB)) {\n codeB += 32;\n }\n const diff = codeA - codeB;\n if (diff === 0) {\n // equal -> ignoreCase\n continue;\n }\n else if (isLowerAsciiLetter(codeA) && isLowerAsciiLetter(codeB)) {\n //\n return diff;\n }\n else {\n return compare(a.toLowerCase(), b.toLowerCase());\n }\n }\n if (a.length < b.length) {\n return -1;\n }\n else if (a.length > b.length) {\n return 1;\n }\n else {\n return 0;\n }\n}\nexports.compareIgnoreCase = compareIgnoreCase;\nfunction isLowerAsciiLetter(code) {\n return code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */;\n}\nexports.isLowerAsciiLetter = isLowerAsciiLetter;\nfunction isUpperAsciiLetter(code) {\n return code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */;\n}\nexports.isUpperAsciiLetter = isUpperAsciiLetter;\nfunction isAsciiLetter(code) {\n return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);\n}\nfunction equalsIgnoreCase(a, b) {\n const len1 = a ? a.length : 0;\n const len2 = b ? b.length : 0;\n if (len1 !== len2) {\n return false;\n }\n return doEqualsIgnoreCase(a, b);\n}\nexports.equalsIgnoreCase = equalsIgnoreCase;\nfunction doEqualsIgnoreCase(a, b, stopAt = a.length) {\n if (typeof a !== 'string' || typeof b !== 'string') {\n return false;\n }\n for (let i = 0; i < stopAt; i++) {\n const codeA = a.charCodeAt(i);\n const codeB = b.charCodeAt(i);\n if (codeA === codeB) {\n continue;\n }\n // a-z A-Z\n if (isAsciiLetter(codeA) && isAsciiLetter(codeB)) {\n const diff = Math.abs(codeA - codeB);\n if (diff !== 0 && diff !== 32) {\n return false;\n }\n }\n else {\n // Any other charcode\n if (String.fromCharCode(codeA).toLowerCase() !== String.fromCharCode(codeB).toLowerCase()) {\n return false;\n }\n }\n }\n return true;\n}\nfunction startsWithIgnoreCase(str, candidate) {\n const candidateLength = candidate.length;\n if (candidate.length > str.length) {\n return false;\n }\n return doEqualsIgnoreCase(str, candidate, candidateLength);\n}\nexports.startsWithIgnoreCase = startsWithIgnoreCase;\n/**\n * @returns the length of the common prefix of the two strings.\n */\nfunction commonPrefixLength(a, b) {\n let i;\n const len = Math.min(a.length, b.length);\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\n return i;\n }\n }\n return len;\n}\nexports.commonPrefixLength = commonPrefixLength;\n/**\n * @returns the length of the common suffix of the two strings.\n */\nfunction commonSuffixLength(a, b) {\n let i;\n const len = Math.min(a.length, b.length);\n const aLastIndex = a.length - 1;\n const bLastIndex = b.length - 1;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n return i;\n }\n }\n return len;\n}\nexports.commonSuffixLength = commonSuffixLength;\nfunction substrEquals(a, aStart, aEnd, b, bStart, bEnd) {\n while (aStart < aEnd && bStart < bEnd) {\n if (a[aStart] !== b[bStart]) {\n return false;\n }\n aStart += 1;\n bStart += 1;\n }\n return true;\n}\n/**\n * Return the overlap between the suffix of `a` and the prefix of `b`.\n * For instance `overlap(\"foobar\", \"arr, I'm a pirate\") === 2`.\n */\nfunction overlap(a, b) {\n const aEnd = a.length;\n let bEnd = b.length;\n let aStart = aEnd - bEnd;\n if (aStart === 0) {\n return a === b ? aEnd : 0;\n }\n else if (aStart < 0) {\n bEnd += aStart;\n aStart = 0;\n }\n while (aStart < aEnd && bEnd > 0) {\n if (substrEquals(a, aStart, aEnd, b, 0, bEnd)) {\n return bEnd;\n }\n bEnd -= 1;\n aStart += 1;\n }\n return 0;\n}\nexports.overlap = overlap;\n// --- unicode\n// http://en.wikipedia.org/wiki/Surrogate_pair\n// Returns the code point starting at a specified index in a string\n// Code points U+0000 to U+D7FF and U+E000 to U+FFFF are represented on a single character\n// Code points U+10000 to U+10FFFF are represented on two consecutive characters\n// export function getUnicodePoint(str:string, index:number, len:number):number {\n//\tconst chrCode = str.charCodeAt(index);\n//\tif (0xD800 <= chrCode && chrCode <= 0xDBFF && index + 1 < len) {\n//\t\tconst nextChrCode = str.charCodeAt(index + 1);\n//\t\tif (0xDC00 <= nextChrCode && nextChrCode <= 0xDFFF) {\n//\t\t\treturn (chrCode - 0xD800) << 10 + (nextChrCode - 0xDC00) + 0x10000;\n//\t\t}\n//\t}\n//\treturn chrCode;\n// }\nfunction isHighSurrogate(charCode) {\n return 0xd800 <= charCode && charCode <= 0xdbff;\n}\nexports.isHighSurrogate = isHighSurrogate;\nfunction isLowSurrogate(charCode) {\n return 0xdc00 <= charCode && charCode <= 0xdfff;\n}\nexports.isLowSurrogate = isLowSurrogate;\n/**\n * Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-rtl-test.js\n */\nconst CONTAINS_RTL = /(?:[\\u05BE\\u05C0\\u05C3\\u05C6\\u05D0-\\u05F4\\u0608\\u060B\\u060D\\u061B-\\u064A\\u066D-\\u066F\\u0671-\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1-\\u07EA\\u07F4\\u07F5\\u07FA-\\u0815\\u081A\\u0824\\u0828\\u0830-\\u0858\\u085E-\\u08BD\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFD3D\\uFD50-\\uFDFC\\uFE70-\\uFEFC]|\\uD802[\\uDC00-\\uDD1B\\uDD20-\\uDE00\\uDE10-\\uDE33\\uDE40-\\uDEE4\\uDEEB-\\uDF35\\uDF40-\\uDFFF]|\\uD803[\\uDC00-\\uDCFF]|\\uD83A[\\uDC00-\\uDCCF\\uDD00-\\uDD43\\uDD50-\\uDFFF]|\\uD83B[\\uDC00-\\uDEBB])/;\n/**\n * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\n */\nfunction containsRTL(str) {\n return CONTAINS_RTL.test(str);\n}\nexports.containsRTL = containsRTL;\n/**\n * Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js\n */\nconst CONTAINS_EMOJI = /(?:[\\u231A\\u231B\\u23F0\\u23F3\\u2600-\\u27BF\\u2B50\\u2B55]|\\uD83C[\\uDDE6-\\uDDFF\\uDF00-\\uDFFF]|\\uD83D[\\uDC00-\\uDE4F\\uDE80-\\uDEF8]|\\uD83E[\\uDD00-\\uDDE6])/;\nfunction containsEmoji(str) {\n return CONTAINS_EMOJI.test(str);\n}\nexports.containsEmoji = containsEmoji;\nconst IS_BASIC_ASCII = /^[\\t\\n\\r\\x20-\\x7E]*$/;\n/**\n * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \\n, \\r, \\t\n */\nfunction isBasicASCII(str) {\n return IS_BASIC_ASCII.test(str);\n}\nexports.isBasicASCII = isBasicASCII;\nfunction containsFullWidthCharacter(str) {\n for (let i = 0, len = str.length; i < len; i++) {\n if (isFullWidthCharacter(str.charCodeAt(i))) {\n return true;\n }\n }\n return false;\n}\nexports.containsFullWidthCharacter = containsFullWidthCharacter;\nfunction isFullWidthCharacter(charCode) {\n // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\n // http://jrgraphix.net/research/unicode_blocks.php\n // 2E80 — 2EFF CJK Radicals Supplement\n // 2F00 — 2FDF Kangxi Radicals\n // 2FF0 — 2FFF Ideographic Description Characters\n // 3000 — 303F CJK Symbols and Punctuation\n // 3040 — 309F Hiragana\n // 30A0 — 30FF Katakana\n // 3100 — 312F Bopomofo\n // 3130 — 318F Hangul Compatibility Jamo\n // 3190 — 319F Kanbun\n // 31A0 — 31BF Bopomofo Extended\n // 31F0 — 31FF Katakana Phonetic Extensions\n // 3200 — 32FF Enclosed CJK Letters and Months\n // 3300 — 33FF CJK Compatibility\n // 3400 — 4DBF CJK Unified Ideographs Extension A\n // 4DC0 — 4DFF Yijing Hexagram Symbols\n // 4E00 — 9FFF CJK Unified Ideographs\n // A000 — A48F Yi Syllables\n // A490 — A4CF Yi Radicals\n // AC00 — D7AF Hangul Syllables\n // [IGNORE] D800 — DB7F High Surrogates\n // [IGNORE] DB80 — DBFF High Private Use Surrogates\n // [IGNORE] DC00 — DFFF Low Surrogates\n // [IGNORE] E000 — F8FF Private Use Area\n // F900 — FAFF CJK Compatibility Ideographs\n // [IGNORE] FB00 — FB4F Alphabetic Presentation Forms\n // [IGNORE] FB50 — FDFF Arabic Presentation Forms-A\n // [IGNORE] FE00 — FE0F Variation Selectors\n // [IGNORE] FE20 — FE2F Combining Half Marks\n // [IGNORE] FE30 — FE4F CJK Compatibility Forms\n // [IGNORE] FE50 — FE6F Small Form Variants\n // [IGNORE] FE70 — FEFF Arabic Presentation Forms-B\n // FF00 — FFEF Halfwidth and Fullwidth Forms\n // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\n // of which FF01 - FF5E fullwidth ASCII of 21 to 7E\n // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul\n // [IGNORE] FFF0 — FFFF Specials\n charCode = +charCode; // @perf\n return ((charCode >= 0x2e80 && charCode <= 0xd7af) ||\n (charCode >= 0xf900 && charCode <= 0xfaff) ||\n (charCode >= 0xff01 && charCode <= 0xff5e));\n}\nexports.isFullWidthCharacter = isFullWidthCharacter;\n/**\n * Given a string and a max length returns a shorted version. Shorting\n * happens at favorable positions - such as whitespace or punctuation characters.\n */\nfunction lcut(text, n) {\n if (text.length < n) {\n return text;\n }\n const re = /\\b/g;\n let i = 0;\n while (re.test(text)) {\n if (text.length - re.lastIndex < n) {\n break;\n }\n i = re.lastIndex;\n re.lastIndex += 1;\n }\n return text.substring(i).replace(/^\\s/, exports.empty);\n}\nexports.lcut = lcut;\n// Escape codes\n// http://en.wikipedia.org/wiki/ANSI_escape_code\nconst EL = /\\x1B\\x5B[12]?K/g; // Erase in line\nconst COLOR_START = /\\x1b\\[\\d+m/g; // Color\nconst COLOR_END = /\\x1b\\[0?m/g; // Color\nfunction removeAnsiEscapeCodes(str) {\n if (str) {\n str = str.replace(EL, '');\n str = str.replace(COLOR_START, '');\n str = str.replace(COLOR_END, '');\n }\n return str;\n}\nexports.removeAnsiEscapeCodes = removeAnsiEscapeCodes;\nexports.removeAccents = (function () {\n if (typeof String.prototype.normalize !== 'function') {\n // ☹️ no ES6 features...\n return function (str) {\n return str;\n };\n }\n else {\n // transform into NFD form and remove accents\n // see: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463\n const regex = /[\\u0300-\\u036f]/g;\n return function (str) {\n return str.normalize('NFD').replace(regex, exports.empty);\n };\n }\n})();\n// -- UTF-8 BOM\nexports.UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* CharCode.UTF8_BOM */);\nfunction startsWithUTF8BOM(str) {\n return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* CharCode.UTF8_BOM */);\n}\nexports.startsWithUTF8BOM = startsWithUTF8BOM;\nfunction stripUTF8BOM(str) {\n return startsWithUTF8BOM(str) ? str.substr(1) : str;\n}\nexports.stripUTF8BOM = stripUTF8BOM;\nfunction safeBtoa(str) {\n return btoa(encodeURIComponent(str)); // we use encodeURIComponent because btoa fails for non Latin 1 values\n}\nexports.safeBtoa = safeBtoa;\nfunction repeat(s, count) {\n let result = '';\n for (let i = 0; i < count; i++) {\n result += s;\n }\n return result;\n}\nexports.repeat = repeat;\n/**\n * Checks if the characters of the provided query string are included in the\n * target string. The characters do not have to be contiguous within the string.\n */\nfunction fuzzyContains(target, query) {\n if (!target || !query) {\n return false; // return early if target or query are undefined\n }\n if (target.length < query.length) {\n return false; // impossible for query to be contained in target\n }\n const queryLen = query.length;\n const targetLower = target.toLowerCase();\n let index = 0;\n let lastIndexOf = -1;\n while (index < queryLen) {\n const indexOf = targetLower.indexOf(query[index], lastIndexOf + 1);\n if (indexOf < 0) {\n return false;\n }\n lastIndexOf = indexOf;\n index++;\n }\n return true;\n}\nexports.fuzzyContains = fuzzyContains;\nfunction containsUppercaseCharacter(target, ignoreEscapedChars = false) {\n if (!target) {\n return false;\n }\n if (ignoreEscapedChars) {\n target = target.replace(/\\\\./g, '');\n }\n return target.toLowerCase() !== target;\n}\nexports.containsUppercaseCharacter = containsUppercaseCharacter;\nfunction uppercaseFirstLetter(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\nexports.uppercaseFirstLetter = uppercaseFirstLetter;\nfunction getNLines(str, n = 1) {\n if (n === 0) {\n return '';\n }\n let idx = -1;\n do {\n idx = str.indexOf('\\n', idx + 1);\n n--;\n } while (n > 0 && idx >= 0);\n return idx >= 0 ? str.substr(0, idx) : str;\n}\nexports.getNLines = getNLines;\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nfunction computeCodePoint(highSurrogate, lowSurrogate) {\n return ((highSurrogate - 0xd800) << 10) + (lowSurrogate - 0xdc00) + 0x10000;\n}\nexports.computeCodePoint = computeCodePoint;\n/**\n * get the code point that begins at offset `offset`\n */\nfunction getNextCodePoint(str, len, offset) {\n const charCode = str.charCodeAt(offset);\n if (isHighSurrogate(charCode) && offset + 1 < len) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (isLowSurrogate(nextCharCode)) {\n return computeCodePoint(charCode, nextCharCode);\n }\n }\n return charCode;\n}\nexports.getNextCodePoint = getNextCodePoint;\n/**\n * A manual encoding of `str` to UTF8.\n * Use only in environments which do not offer native conversion methods!\n */\nfunction encodeUTF8(str) {\n const strLen = str.length;\n // See https://en.wikipedia.org/wiki/UTF-8\n // first loop to establish needed buffer size\n let neededSize = 0;\n let strOffset = 0;\n while (strOffset < strLen) {\n const codePoint = getNextCodePoint(str, strLen, strOffset);\n strOffset += codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1;\n if (codePoint < 0x0080) {\n neededSize += 1;\n }\n else if (codePoint < 0x0800) {\n neededSize += 2;\n }\n else if (codePoint < 0x10000) {\n neededSize += 3;\n }\n else {\n neededSize += 4;\n }\n }\n // second loop to actually encode\n const arr = new Uint8Array(neededSize);\n strOffset = 0;\n let arrOffset = 0;\n while (strOffset < strLen) {\n const codePoint = getNextCodePoint(str, strLen, strOffset);\n strOffset += codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1;\n if (codePoint < 0x0080) {\n arr[arrOffset++] = codePoint;\n }\n else if (codePoint < 0x0800) {\n arr[arrOffset++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else if (codePoint < 0x10000) {\n arr[arrOffset++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else {\n arr[arrOffset++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n }\n return arr;\n}\nexports.encodeUTF8 = encodeUTF8;\n/**\n * A manual decoding of a UTF8 string.\n * Use only in environments which do not offer native conversion methods!\n */\nfunction decodeUTF8(buffer) {\n // https://en.wikipedia.org/wiki/UTF-8\n const len = buffer.byteLength;\n const result = [];\n let offset = 0;\n while (offset < len) {\n const v0 = buffer[offset];\n let codePoint;\n if (v0 >= 0b11110000 && offset + 3 < len) {\n // 4 bytes\n codePoint =\n (((buffer[offset++] & 0b00000111) << 18) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 12) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 6) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 0) >>> 0);\n }\n else if (v0 >= 0b11100000 && offset + 2 < len) {\n // 3 bytes\n codePoint =\n (((buffer[offset++] & 0b00001111) << 12) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 6) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 0) >>> 0);\n }\n else if (v0 >= 0b11000000 && offset + 1 < len) {\n // 2 bytes\n codePoint = (((buffer[offset++] & 0b00011111) << 6) >>> 0) | (((buffer[offset++] & 0b00111111) << 0) >>> 0);\n }\n else {\n // 1 byte\n codePoint = buffer[offset++];\n }\n if ((codePoint >= 0 && codePoint <= 0xd7ff) || (codePoint >= 0xe000 && codePoint <= 0xffff)) {\n // Basic Multilingual Plane\n result.push(String.fromCharCode(codePoint));\n }\n else if (codePoint >= 0x010000 && codePoint <= 0x10ffff) {\n // Supplementary Planes\n const uPrime = codePoint - 0x10000;\n const w1 = 0xd800 + ((uPrime & 0b11111111110000000000) >>> 10);\n const w2 = 0xdc00 + ((uPrime & 0b00000000001111111111) >>> 0);\n result.push(String.fromCharCode(w1));\n result.push(String.fromCharCode(w2));\n }\n else {\n // illegal code point\n result.push(String.fromCharCode(0xfffd));\n }\n }\n return result.join('');\n}\nexports.decodeUTF8 = decodeUTF8;\n/**\n * 插值表达式的标记使用的是 ${}\n * 该函数会对 options 中的 separator 会有特殊处理,\n */\nfunction template(tpl, variables, options) {\n const result = [];\n let placeHolderStack = [];\n for (let idx = 0; idx < tpl.length; idx++) {\n const char = tpl[idx];\n const nextChar = tpl[idx + 1];\n // 往后多看一位\n if (char === '$' && nextChar === '{') {\n // 往后的可能是占位符了,注入进栈标志位(即 $)\n // 如果 placeHolder 栈已经有值了,现在不支持嵌套 ${},直接吐出所有值放到 result 中即可\n if (placeHolderStack.length > 0) {\n result.push(...placeHolderStack);\n placeHolderStack = [];\n }\n placeHolderStack.push(char);\n placeHolderStack.push(nextChar);\n idx++;\n continue;\n }\n // 如果当前 placeHolder 栈有字符,一直将字符入栈,直到匹配到 }\n if (placeHolderStack.length > 0) {\n if (char === '}') {\n // 占位符匹配结束\n // 拿出占位符进行值替换\n const placeholder = placeHolderStack.slice(2).join('');\n let v;\n if (placeholder === 'separator') {\n if (result[result.length - 1] === options.separator) {\n // 不需要重复 separator\n placeHolderStack = [];\n continue;\n }\n // 分隔符有单独的优化\n v = options.separator;\n }\n else {\n v = variables[placeholder];\n }\n const toPush = v !== null && v !== void 0 ? v : options.defaultValue;\n if (toPush) {\n result.push(toPush);\n }\n placeHolderStack = [];\n }\n else {\n placeHolderStack.push(char);\n }\n continue;\n }\n result.push(tpl[idx]);\n }\n // 去除前面和后面的 sep\n // 这些 sep 也是不需要的\n while (result[result.length - 1] === options.separator) {\n result.pop();\n }\n while (result[0] === options.separator) {\n result.shift();\n }\n return result.join('');\n}\nexports.template = template;\nconst _format2Regexp = /{([^}]+)}/g;\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nfunction format2(template, values) {\n return template.replace(_format2Regexp, (match, group) => { var _a; return ((_a = values[group]) !== null && _a !== void 0 ? _a : match); });\n}\nexports.format2 = format2;\n//# sourceMappingURL=strings.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/strings.js?");
6976
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.containsUppercaseCharacter = exports.fuzzyContains = exports.repeat = exports.safeBtoa = exports.stripUTF8BOM = exports.startsWithUTF8BOM = exports.UTF8_BOM_CHARACTER = exports.removeAccents = exports.removeAnsiEscapeCodes = exports.lcut = exports.isFullWidthCharacter = exports.containsFullWidthCharacter = exports.isBasicASCII = exports.containsEmoji = exports.containsRTL = exports.isLowSurrogate = exports.isHighSurrogate = exports.overlap = exports.commonSuffixLength = exports.commonPrefixLength = exports.startsWithIgnoreCase = exports.equalsIgnoreCase = exports.isUpperAsciiLetter = exports.isLowerAsciiLetter = exports.compareIgnoreCase = exports.compare = exports.lastNonWhitespaceIndex = exports.getLeadingWhitespace = exports.firstNonWhitespaceIndex = exports.regExpFlags = exports.regExpContainsBackreference = exports.regExpLeadsToEndlessLoop = exports.createRegExp = exports.endsWith = exports.startsWith = exports.stripWildcards = exports.convertSimple2RegExpPattern = exports.rtrim = exports.multiRightTrim = exports.ltrim = exports.trim = exports.count = exports.escapeRegExpCharacters = exports.escape = exports.mnemonicButtonLabel = exports.format = exports.pad = exports.isFalsyOrWhitespace = exports.stringUtils = exports.empty = void 0;\nexports.getChunks = exports.format2 = exports.template = exports.decodeUTF8 = exports.encodeUTF8 = exports.getNextCodePoint = exports.computeCodePoint = exports.getNLines = exports.uppercaseFirstLetter = void 0;\nconst platform_1 = __webpack_require__(/*! ./platform */ \"../utils/lib/platform.js\");\n/**\n * The empty string.\n */\nexports.empty = '';\nconst hasTextEncoder = typeof TextEncoder !== 'undefined';\nconst hasTextDecoder = typeof TextDecoder !== 'undefined';\n/**\n * 浏览器全局可以直接使用 TextEncoder/TextDecoder\n * Node.js 11+ 才可以全局使用,以下需要 require('util')\n */\nvar stringUtils;\n(function (stringUtils) {\n stringUtils.StringTextEncoder = hasTextEncoder ? TextEncoder : (__webpack_require__(/*! util */ \"../../node_modules/util/util.js\").TextEncoder);\n stringUtils.StringTextDecoder = hasTextDecoder ? TextDecoder : (__webpack_require__(/*! util */ \"../../node_modules/util/util.js\").TextDecoder);\n})(stringUtils = exports.stringUtils || (exports.stringUtils = {}));\nfunction isFalsyOrWhitespace(str) {\n if (!str || typeof str !== 'string') {\n return true;\n }\n return str.trim().length === 0;\n}\nexports.isFalsyOrWhitespace = isFalsyOrWhitespace;\n/**\n * @returns the provided number with the given number of preceding zeros.\n */\nfunction pad(n, l, char = '0') {\n const str = '' + n;\n const r = [str];\n for (let i = str.length; i < l; i++) {\n r.push(char);\n }\n return r.reverse().join('');\n}\nexports.pad = pad;\nconst _formatRegexp = /{(\\d+)}/g;\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nfunction format(value, ...args) {\n if (args.length === 0) {\n return value;\n }\n return value.replace(_formatRegexp, function (match, group) {\n const idx = parseInt(group, 10);\n return isNaN(idx) || idx < 0 || idx >= args.length ? match : args[idx];\n });\n}\nexports.format = format;\n/**\n * Handles mnemonics for buttons. Depending on OS:\n * - Windows: Supported via & character (replace && with & and & with && for escaping)\n * - Linux: Supported via _ character (replace && with _)\n * - macOS: Unsupported (replace && with empty string)\n */\nfunction mnemonicButtonLabel(label, forceDisableMnemonics) {\n if (platform_1.isMacintosh || forceDisableMnemonics) {\n return label.replace(/\\(&&\\w\\)|&&/g, '');\n }\n if (platform_1.isWindows) {\n return label.replace(/&&|&/g, (m) => (m === '&' ? '&&' : '&'));\n }\n return label.replace(/&&/g, '_');\n}\nexports.mnemonicButtonLabel = mnemonicButtonLabel;\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nfunction escape(html) {\n return html.replace(/[<>&]/g, function (match) {\n switch (match) {\n case '<':\n return '&lt;';\n case '>':\n return '&gt;';\n case '&':\n return '&amp;';\n default:\n return match;\n }\n });\n}\nexports.escape = escape;\n/**\n * Escapes regular expression characters in a given string\n */\nfunction escapeRegExpCharacters(value) {\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\nexports.escapeRegExpCharacters = escapeRegExpCharacters;\n/**\n * Counts how often `character` occurs inside `value`.\n */\nfunction count(value, character) {\n let result = 0;\n const ch = character.charCodeAt(0);\n for (let i = value.length - 1; i >= 0; i--) {\n if (value.charCodeAt(i) === ch) {\n result++;\n }\n }\n return result;\n}\nexports.count = count;\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nfunction trim(haystack, needle = ' ') {\n const trimmed = ltrim(haystack, needle);\n return rtrim(trimmed, needle);\n}\nexports.trim = trim;\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nfunction ltrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n if (needleLen === 0 || haystack.length === 0) {\n return haystack;\n }\n let offset = 0;\n while (haystack.indexOf(needle, offset) === offset) {\n offset = offset + needleLen;\n }\n return haystack.substring(offset);\n}\nexports.ltrim = ltrim;\n/**\n * Removes all occurrences of needles from the end of haystack.\n * @param source\n * @param needles\n * @example\n * ```ts\n * let source = '/path/to/file.ts,;';\n * const res = multiRightTrim(source, [`,`, ';']);\n * // res === '/path/to/file.ts';\n * ```\n */\nfunction multiRightTrim(source, needles) {\n let result = decodeURIComponent(source);\n for (const needle of needles) {\n result = rtrim(result, needle);\n }\n return result;\n}\nexports.multiRightTrim = multiRightTrim;\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nfunction rtrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n const haystackLen = haystack.length;\n if (needleLen === 0 || haystackLen === 0) {\n return haystack;\n }\n let offset = haystackLen;\n let idx = -1;\n while (true) {\n idx = haystack.lastIndexOf(needle, offset - 1);\n if (idx === -1 || idx + needleLen !== offset) {\n break;\n }\n if (idx === 0) {\n return '';\n }\n offset = idx;\n }\n return haystack.substring(0, offset);\n}\nexports.rtrim = rtrim;\nfunction convertSimple2RegExpPattern(pattern) {\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\nexports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;\nfunction stripWildcards(pattern) {\n return pattern.replace(/\\*/g, '');\n}\nexports.stripWildcards = stripWildcards;\n/**\n * Determines if haystack starts with needle.\n */\nfunction startsWith(haystack, needle) {\n if (haystack.length < needle.length) {\n return false;\n }\n if (haystack === needle) {\n return true;\n }\n for (let i = 0; i < needle.length; i++) {\n if (haystack[i] !== needle[i]) {\n return false;\n }\n }\n return true;\n}\nexports.startsWith = startsWith;\n/**\n * Determines if haystack ends with needle.\n */\nfunction endsWith(haystack, needle) {\n const diff = haystack.length - needle.length;\n if (diff > 0) {\n return haystack.indexOf(needle, diff) === diff;\n }\n else if (diff === 0) {\n return haystack === needle;\n }\n else {\n return false;\n }\n}\nexports.endsWith = endsWith;\nfunction createRegExp(searchString, isRegex, options = {}) {\n if (!searchString) {\n throw new Error('Cannot create regex from empty string');\n }\n if (!isRegex) {\n searchString = escapeRegExpCharacters(searchString);\n }\n if (options.wholeWord) {\n if (!/\\B/.test(searchString.charAt(0))) {\n searchString = '\\\\b' + searchString;\n }\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n searchString = searchString + '\\\\b';\n }\n }\n let modifiers = '';\n if (options.global) {\n modifiers += 'g';\n }\n if (!options.matchCase) {\n modifiers += 'i';\n }\n if (options.multiline) {\n modifiers += 'm';\n }\n if (options.unicode) {\n modifiers += 'u';\n }\n return new RegExp(searchString, modifiers);\n}\nexports.createRegExp = createRegExp;\nfunction regExpLeadsToEndlessLoop(regexp) {\n // Exit early if it's one of these special cases which are meant to match\n // against an empty string\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n return false;\n }\n // We check against an empty string. If the regular expression doesn't advance\n // (e.g. ends in an endless loop) it will match an empty string.\n const match = regexp.exec('');\n return !!(match && regexp.lastIndex === 0);\n}\nexports.regExpLeadsToEndlessLoop = regExpLeadsToEndlessLoop;\nfunction regExpContainsBackreference(regexpValue) {\n return !!regexpValue.match(/([^\\\\]|^)(\\\\\\\\)*\\\\\\d+/);\n}\nexports.regExpContainsBackreference = regExpContainsBackreference;\nfunction regExpFlags(regexp) {\n return ((regexp.global ? 'g' : '') +\n (regexp.ignoreCase ? 'i' : '') +\n (regexp.multiline ? 'm' : '') +\n (regexp.unicode ? 'u' : ''));\n}\nexports.regExpFlags = regExpFlags;\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nfunction firstNonWhitespaceIndex(str) {\n for (let i = 0, len = str.length; i < len; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\nexports.firstNonWhitespaceIndex = firstNonWhitespaceIndex;\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nfunction getLeadingWhitespace(str, start = 0, end = str.length) {\n for (let i = start; i < end; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return str.substring(start, i);\n }\n }\n return str.substring(start, end);\n}\nexports.getLeadingWhitespace = getLeadingWhitespace;\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nfunction lastNonWhitespaceIndex(str, startIndex = str.length - 1) {\n for (let i = startIndex; i >= 0; i--) {\n const chCode = str.charCodeAt(i);\n if (chCode !== 32 /* CharCode.Space */ && chCode !== 9 /* CharCode.Tab */) {\n return i;\n }\n }\n return -1;\n}\nexports.lastNonWhitespaceIndex = lastNonWhitespaceIndex;\nfunction compare(a, b) {\n if (a < b) {\n return -1;\n }\n else if (a > b) {\n return 1;\n }\n else {\n return 0;\n }\n}\nexports.compare = compare;\nfunction compareIgnoreCase(a, b) {\n const len = Math.min(a.length, b.length);\n for (let i = 0; i < len; i++) {\n let codeA = a.charCodeAt(i);\n let codeB = b.charCodeAt(i);\n if (codeA === codeB) {\n // equal\n continue;\n }\n if (isUpperAsciiLetter(codeA)) {\n codeA += 32;\n }\n if (isUpperAsciiLetter(codeB)) {\n codeB += 32;\n }\n const diff = codeA - codeB;\n if (diff === 0) {\n // equal -> ignoreCase\n continue;\n }\n else if (isLowerAsciiLetter(codeA) && isLowerAsciiLetter(codeB)) {\n //\n return diff;\n }\n else {\n return compare(a.toLowerCase(), b.toLowerCase());\n }\n }\n if (a.length < b.length) {\n return -1;\n }\n else if (a.length > b.length) {\n return 1;\n }\n else {\n return 0;\n }\n}\nexports.compareIgnoreCase = compareIgnoreCase;\nfunction isLowerAsciiLetter(code) {\n return code >= 97 /* CharCode.a */ && code <= 122 /* CharCode.z */;\n}\nexports.isLowerAsciiLetter = isLowerAsciiLetter;\nfunction isUpperAsciiLetter(code) {\n return code >= 65 /* CharCode.A */ && code <= 90 /* CharCode.Z */;\n}\nexports.isUpperAsciiLetter = isUpperAsciiLetter;\nfunction isAsciiLetter(code) {\n return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);\n}\nfunction equalsIgnoreCase(a, b) {\n const len1 = a ? a.length : 0;\n const len2 = b ? b.length : 0;\n if (len1 !== len2) {\n return false;\n }\n return doEqualsIgnoreCase(a, b);\n}\nexports.equalsIgnoreCase = equalsIgnoreCase;\nfunction doEqualsIgnoreCase(a, b, stopAt = a.length) {\n if (typeof a !== 'string' || typeof b !== 'string') {\n return false;\n }\n for (let i = 0; i < stopAt; i++) {\n const codeA = a.charCodeAt(i);\n const codeB = b.charCodeAt(i);\n if (codeA === codeB) {\n continue;\n }\n // a-z A-Z\n if (isAsciiLetter(codeA) && isAsciiLetter(codeB)) {\n const diff = Math.abs(codeA - codeB);\n if (diff !== 0 && diff !== 32) {\n return false;\n }\n }\n else {\n // Any other charcode\n if (String.fromCharCode(codeA).toLowerCase() !== String.fromCharCode(codeB).toLowerCase()) {\n return false;\n }\n }\n }\n return true;\n}\nfunction startsWithIgnoreCase(str, candidate) {\n const candidateLength = candidate.length;\n if (candidate.length > str.length) {\n return false;\n }\n return doEqualsIgnoreCase(str, candidate, candidateLength);\n}\nexports.startsWithIgnoreCase = startsWithIgnoreCase;\n/**\n * @returns the length of the common prefix of the two strings.\n */\nfunction commonPrefixLength(a, b) {\n let i;\n const len = Math.min(a.length, b.length);\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\n return i;\n }\n }\n return len;\n}\nexports.commonPrefixLength = commonPrefixLength;\n/**\n * @returns the length of the common suffix of the two strings.\n */\nfunction commonSuffixLength(a, b) {\n let i;\n const len = Math.min(a.length, b.length);\n const aLastIndex = a.length - 1;\n const bLastIndex = b.length - 1;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n return i;\n }\n }\n return len;\n}\nexports.commonSuffixLength = commonSuffixLength;\nfunction substrEquals(a, aStart, aEnd, b, bStart, bEnd) {\n while (aStart < aEnd && bStart < bEnd) {\n if (a[aStart] !== b[bStart]) {\n return false;\n }\n aStart += 1;\n bStart += 1;\n }\n return true;\n}\n/**\n * Return the overlap between the suffix of `a` and the prefix of `b`.\n * For instance `overlap(\"foobar\", \"arr, I'm a pirate\") === 2`.\n */\nfunction overlap(a, b) {\n const aEnd = a.length;\n let bEnd = b.length;\n let aStart = aEnd - bEnd;\n if (aStart === 0) {\n return a === b ? aEnd : 0;\n }\n else if (aStart < 0) {\n bEnd += aStart;\n aStart = 0;\n }\n while (aStart < aEnd && bEnd > 0) {\n if (substrEquals(a, aStart, aEnd, b, 0, bEnd)) {\n return bEnd;\n }\n bEnd -= 1;\n aStart += 1;\n }\n return 0;\n}\nexports.overlap = overlap;\n// --- unicode\n// http://en.wikipedia.org/wiki/Surrogate_pair\n// Returns the code point starting at a specified index in a string\n// Code points U+0000 to U+D7FF and U+E000 to U+FFFF are represented on a single character\n// Code points U+10000 to U+10FFFF are represented on two consecutive characters\n// export function getUnicodePoint(str:string, index:number, len:number):number {\n//\tconst chrCode = str.charCodeAt(index);\n//\tif (0xD800 <= chrCode && chrCode <= 0xDBFF && index + 1 < len) {\n//\t\tconst nextChrCode = str.charCodeAt(index + 1);\n//\t\tif (0xDC00 <= nextChrCode && nextChrCode <= 0xDFFF) {\n//\t\t\treturn (chrCode - 0xD800) << 10 + (nextChrCode - 0xDC00) + 0x10000;\n//\t\t}\n//\t}\n//\treturn chrCode;\n// }\nfunction isHighSurrogate(charCode) {\n return 0xd800 <= charCode && charCode <= 0xdbff;\n}\nexports.isHighSurrogate = isHighSurrogate;\nfunction isLowSurrogate(charCode) {\n return 0xdc00 <= charCode && charCode <= 0xdfff;\n}\nexports.isLowSurrogate = isLowSurrogate;\n/**\n * Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-rtl-test.js\n */\nconst CONTAINS_RTL = /(?:[\\u05BE\\u05C0\\u05C3\\u05C6\\u05D0-\\u05F4\\u0608\\u060B\\u060D\\u061B-\\u064A\\u066D-\\u066F\\u0671-\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1-\\u07EA\\u07F4\\u07F5\\u07FA-\\u0815\\u081A\\u0824\\u0828\\u0830-\\u0858\\u085E-\\u08BD\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFD3D\\uFD50-\\uFDFC\\uFE70-\\uFEFC]|\\uD802[\\uDC00-\\uDD1B\\uDD20-\\uDE00\\uDE10-\\uDE33\\uDE40-\\uDEE4\\uDEEB-\\uDF35\\uDF40-\\uDFFF]|\\uD803[\\uDC00-\\uDCFF]|\\uD83A[\\uDC00-\\uDCCF\\uDD00-\\uDD43\\uDD50-\\uDFFF]|\\uD83B[\\uDC00-\\uDEBB])/;\n/**\n * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\n */\nfunction containsRTL(str) {\n return CONTAINS_RTL.test(str);\n}\nexports.containsRTL = containsRTL;\n/**\n * Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js\n */\nconst CONTAINS_EMOJI = /(?:[\\u231A\\u231B\\u23F0\\u23F3\\u2600-\\u27BF\\u2B50\\u2B55]|\\uD83C[\\uDDE6-\\uDDFF\\uDF00-\\uDFFF]|\\uD83D[\\uDC00-\\uDE4F\\uDE80-\\uDEF8]|\\uD83E[\\uDD00-\\uDDE6])/;\nfunction containsEmoji(str) {\n return CONTAINS_EMOJI.test(str);\n}\nexports.containsEmoji = containsEmoji;\nconst IS_BASIC_ASCII = /^[\\t\\n\\r\\x20-\\x7E]*$/;\n/**\n * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \\n, \\r, \\t\n */\nfunction isBasicASCII(str) {\n return IS_BASIC_ASCII.test(str);\n}\nexports.isBasicASCII = isBasicASCII;\nfunction containsFullWidthCharacter(str) {\n for (let i = 0, len = str.length; i < len; i++) {\n if (isFullWidthCharacter(str.charCodeAt(i))) {\n return true;\n }\n }\n return false;\n}\nexports.containsFullWidthCharacter = containsFullWidthCharacter;\nfunction isFullWidthCharacter(charCode) {\n // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\n // http://jrgraphix.net/research/unicode_blocks.php\n // 2E80 — 2EFF CJK Radicals Supplement\n // 2F00 — 2FDF Kangxi Radicals\n // 2FF0 — 2FFF Ideographic Description Characters\n // 3000 — 303F CJK Symbols and Punctuation\n // 3040 — 309F Hiragana\n // 30A0 — 30FF Katakana\n // 3100 — 312F Bopomofo\n // 3130 — 318F Hangul Compatibility Jamo\n // 3190 — 319F Kanbun\n // 31A0 — 31BF Bopomofo Extended\n // 31F0 — 31FF Katakana Phonetic Extensions\n // 3200 — 32FF Enclosed CJK Letters and Months\n // 3300 — 33FF CJK Compatibility\n // 3400 — 4DBF CJK Unified Ideographs Extension A\n // 4DC0 — 4DFF Yijing Hexagram Symbols\n // 4E00 — 9FFF CJK Unified Ideographs\n // A000 — A48F Yi Syllables\n // A490 — A4CF Yi Radicals\n // AC00 — D7AF Hangul Syllables\n // [IGNORE] D800 — DB7F High Surrogates\n // [IGNORE] DB80 — DBFF High Private Use Surrogates\n // [IGNORE] DC00 — DFFF Low Surrogates\n // [IGNORE] E000 — F8FF Private Use Area\n // F900 — FAFF CJK Compatibility Ideographs\n // [IGNORE] FB00 — FB4F Alphabetic Presentation Forms\n // [IGNORE] FB50 — FDFF Arabic Presentation Forms-A\n // [IGNORE] FE00 — FE0F Variation Selectors\n // [IGNORE] FE20 — FE2F Combining Half Marks\n // [IGNORE] FE30 — FE4F CJK Compatibility Forms\n // [IGNORE] FE50 — FE6F Small Form Variants\n // [IGNORE] FE70 — FEFF Arabic Presentation Forms-B\n // FF00 — FFEF Halfwidth and Fullwidth Forms\n // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\n // of which FF01 - FF5E fullwidth ASCII of 21 to 7E\n // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul\n // [IGNORE] FFF0 — FFFF Specials\n charCode = +charCode; // @perf\n return ((charCode >= 0x2e80 && charCode <= 0xd7af) ||\n (charCode >= 0xf900 && charCode <= 0xfaff) ||\n (charCode >= 0xff01 && charCode <= 0xff5e));\n}\nexports.isFullWidthCharacter = isFullWidthCharacter;\n/**\n * Given a string and a max length returns a shorted version. Shorting\n * happens at favorable positions - such as whitespace or punctuation characters.\n */\nfunction lcut(text, n) {\n if (text.length < n) {\n return text;\n }\n const re = /\\b/g;\n let i = 0;\n while (re.test(text)) {\n if (text.length - re.lastIndex < n) {\n break;\n }\n i = re.lastIndex;\n re.lastIndex += 1;\n }\n return text.substring(i).replace(/^\\s/, exports.empty);\n}\nexports.lcut = lcut;\n// Escape codes\n// http://en.wikipedia.org/wiki/ANSI_escape_code\nconst EL = /\\x1B\\x5B[12]?K/g; // Erase in line\nconst COLOR_START = /\\x1b\\[\\d+m/g; // Color\nconst COLOR_END = /\\x1b\\[0?m/g; // Color\nfunction removeAnsiEscapeCodes(str) {\n if (str) {\n str = str.replace(EL, '');\n str = str.replace(COLOR_START, '');\n str = str.replace(COLOR_END, '');\n }\n return str;\n}\nexports.removeAnsiEscapeCodes = removeAnsiEscapeCodes;\nexports.removeAccents = (function () {\n if (typeof String.prototype.normalize !== 'function') {\n // ☹️ no ES6 features...\n return function (str) {\n return str;\n };\n }\n else {\n // transform into NFD form and remove accents\n // see: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463\n const regex = /[\\u0300-\\u036f]/g;\n return function (str) {\n return str.normalize('NFD').replace(regex, exports.empty);\n };\n }\n})();\n// -- UTF-8 BOM\nexports.UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* CharCode.UTF8_BOM */);\nfunction startsWithUTF8BOM(str) {\n return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* CharCode.UTF8_BOM */);\n}\nexports.startsWithUTF8BOM = startsWithUTF8BOM;\nfunction stripUTF8BOM(str) {\n return startsWithUTF8BOM(str) ? str.substr(1) : str;\n}\nexports.stripUTF8BOM = stripUTF8BOM;\nfunction safeBtoa(str) {\n return btoa(encodeURIComponent(str)); // we use encodeURIComponent because btoa fails for non Latin 1 values\n}\nexports.safeBtoa = safeBtoa;\nfunction repeat(s, count) {\n let result = '';\n for (let i = 0; i < count; i++) {\n result += s;\n }\n return result;\n}\nexports.repeat = repeat;\n/**\n * Checks if the characters of the provided query string are included in the\n * target string. The characters do not have to be contiguous within the string.\n */\nfunction fuzzyContains(target, query) {\n if (!target || !query) {\n return false; // return early if target or query are undefined\n }\n if (target.length < query.length) {\n return false; // impossible for query to be contained in target\n }\n const queryLen = query.length;\n const targetLower = target.toLowerCase();\n let index = 0;\n let lastIndexOf = -1;\n while (index < queryLen) {\n const indexOf = targetLower.indexOf(query[index], lastIndexOf + 1);\n if (indexOf < 0) {\n return false;\n }\n lastIndexOf = indexOf;\n index++;\n }\n return true;\n}\nexports.fuzzyContains = fuzzyContains;\nfunction containsUppercaseCharacter(target, ignoreEscapedChars = false) {\n if (!target) {\n return false;\n }\n if (ignoreEscapedChars) {\n target = target.replace(/\\\\./g, '');\n }\n return target.toLowerCase() !== target;\n}\nexports.containsUppercaseCharacter = containsUppercaseCharacter;\nfunction uppercaseFirstLetter(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\nexports.uppercaseFirstLetter = uppercaseFirstLetter;\nfunction getNLines(str, n = 1) {\n if (n === 0) {\n return '';\n }\n let idx = -1;\n do {\n idx = str.indexOf('\\n', idx + 1);\n n--;\n } while (n > 0 && idx >= 0);\n return idx >= 0 ? str.substr(0, idx) : str;\n}\nexports.getNLines = getNLines;\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nfunction computeCodePoint(highSurrogate, lowSurrogate) {\n return ((highSurrogate - 0xd800) << 10) + (lowSurrogate - 0xdc00) + 0x10000;\n}\nexports.computeCodePoint = computeCodePoint;\n/**\n * get the code point that begins at offset `offset`\n */\nfunction getNextCodePoint(str, len, offset) {\n const charCode = str.charCodeAt(offset);\n if (isHighSurrogate(charCode) && offset + 1 < len) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (isLowSurrogate(nextCharCode)) {\n return computeCodePoint(charCode, nextCharCode);\n }\n }\n return charCode;\n}\nexports.getNextCodePoint = getNextCodePoint;\n/**\n * A manual encoding of `str` to UTF8.\n * Use only in environments which do not offer native conversion methods!\n */\nfunction encodeUTF8(str) {\n const strLen = str.length;\n // See https://en.wikipedia.org/wiki/UTF-8\n // first loop to establish needed buffer size\n let neededSize = 0;\n let strOffset = 0;\n while (strOffset < strLen) {\n const codePoint = getNextCodePoint(str, strLen, strOffset);\n strOffset += codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1;\n if (codePoint < 0x0080) {\n neededSize += 1;\n }\n else if (codePoint < 0x0800) {\n neededSize += 2;\n }\n else if (codePoint < 0x10000) {\n neededSize += 3;\n }\n else {\n neededSize += 4;\n }\n }\n // second loop to actually encode\n const arr = new Uint8Array(neededSize);\n strOffset = 0;\n let arrOffset = 0;\n while (strOffset < strLen) {\n const codePoint = getNextCodePoint(str, strLen, strOffset);\n strOffset += codePoint >= 65536 /* Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1;\n if (codePoint < 0x0080) {\n arr[arrOffset++] = codePoint;\n }\n else if (codePoint < 0x0800) {\n arr[arrOffset++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else if (codePoint < 0x10000) {\n arr[arrOffset++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else {\n arr[arrOffset++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n arr[arrOffset++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n }\n return arr;\n}\nexports.encodeUTF8 = encodeUTF8;\n/**\n * A manual decoding of a UTF8 string.\n * Use only in environments which do not offer native conversion methods!\n */\nfunction decodeUTF8(buffer) {\n // https://en.wikipedia.org/wiki/UTF-8\n const len = buffer.byteLength;\n const result = [];\n let offset = 0;\n while (offset < len) {\n const v0 = buffer[offset];\n let codePoint;\n if (v0 >= 0b11110000 && offset + 3 < len) {\n // 4 bytes\n codePoint =\n (((buffer[offset++] & 0b00000111) << 18) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 12) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 6) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 0) >>> 0);\n }\n else if (v0 >= 0b11100000 && offset + 2 < len) {\n // 3 bytes\n codePoint =\n (((buffer[offset++] & 0b00001111) << 12) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 6) >>> 0) |\n (((buffer[offset++] & 0b00111111) << 0) >>> 0);\n }\n else if (v0 >= 0b11000000 && offset + 1 < len) {\n // 2 bytes\n codePoint = (((buffer[offset++] & 0b00011111) << 6) >>> 0) | (((buffer[offset++] & 0b00111111) << 0) >>> 0);\n }\n else {\n // 1 byte\n codePoint = buffer[offset++];\n }\n if ((codePoint >= 0 && codePoint <= 0xd7ff) || (codePoint >= 0xe000 && codePoint <= 0xffff)) {\n // Basic Multilingual Plane\n result.push(String.fromCharCode(codePoint));\n }\n else if (codePoint >= 0x010000 && codePoint <= 0x10ffff) {\n // Supplementary Planes\n const uPrime = codePoint - 0x10000;\n const w1 = 0xd800 + ((uPrime & 0b11111111110000000000) >>> 10);\n const w2 = 0xdc00 + ((uPrime & 0b00000000001111111111) >>> 0);\n result.push(String.fromCharCode(w1));\n result.push(String.fromCharCode(w2));\n }\n else {\n // illegal code point\n result.push(String.fromCharCode(0xfffd));\n }\n }\n return result.join('');\n}\nexports.decodeUTF8 = decodeUTF8;\n/**\n * 插值表达式的标记使用的是 ${}\n * 该函数会对 options 中的 separator 会有特殊处理,\n */\nfunction template(tpl, variables, options) {\n const result = [];\n let placeHolderStack = [];\n for (let idx = 0; idx < tpl.length; idx++) {\n const char = tpl[idx];\n const nextChar = tpl[idx + 1];\n // 往后多看一位\n if (char === '$' && nextChar === '{') {\n // 往后的可能是占位符了,注入进栈标志位(即 $)\n // 如果 placeHolder 栈已经有值了,现在不支持嵌套 ${},直接吐出所有值放到 result 中即可\n if (placeHolderStack.length > 0) {\n result.push(...placeHolderStack);\n placeHolderStack = [];\n }\n placeHolderStack.push(char);\n placeHolderStack.push(nextChar);\n idx++;\n continue;\n }\n // 如果当前 placeHolder 栈有字符,一直将字符入栈,直到匹配到 }\n if (placeHolderStack.length > 0) {\n if (char === '}') {\n // 占位符匹配结束\n // 拿出占位符进行值替换\n const placeholder = placeHolderStack.slice(2).join('');\n let v;\n if (placeholder === 'separator') {\n if (result[result.length - 1] === options.separator) {\n // 不需要重复 separator\n placeHolderStack = [];\n continue;\n }\n // 分隔符有单独的优化\n v = options.separator;\n }\n else {\n v = variables[placeholder];\n }\n const toPush = v !== null && v !== void 0 ? v : options.defaultValue;\n if (toPush) {\n result.push(toPush);\n }\n placeHolderStack = [];\n }\n else {\n placeHolderStack.push(char);\n }\n continue;\n }\n result.push(tpl[idx]);\n }\n // 去除前面和后面的 sep\n // 这些 sep 也是不需要的\n while (result[result.length - 1] === options.separator) {\n result.pop();\n }\n while (result[0] === options.separator) {\n result.shift();\n }\n return result.join('');\n}\nexports.template = template;\nconst _format2Regexp = /{([^}]+)}/g;\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nfunction format2(template, values) {\n return template.replace(_format2Regexp, (match, group) => { var _a; return ((_a = values[group]) !== null && _a !== void 0 ? _a : match); });\n}\nexports.format2 = format2;\nfunction getChunks(str, size) {\n const strLength = str.length;\n const numChunks = Math.ceil(strLength / size);\n const chunks = new Array(numChunks);\n let i = 0;\n let o = 0;\n for (; i < numChunks; ++i, o += size) {\n chunks[i] = str.substr(o, size);\n }\n return chunks;\n}\nexports.getChunks = getChunks;\n//# sourceMappingURL=strings.js.map\n\n//# sourceURL=webpack://@opensumi/ide-components/../utils/lib/strings.js?");
6977
6977
 
6978
6978
  /***/ }),
6979
6979
 
@@ -12,3 +12,15 @@
12
12
  margin-bottom: 0.5em;
13
13
  }
14
14
  }
15
+
16
+ .@{prefix}-popover {
17
+ .@{prefix}-md-renderer-wrap {
18
+ color: inherit;
19
+ hr {
20
+ border-color: inherit;
21
+ }
22
+ .kt-icon {
23
+ color: inherit;
24
+ }
25
+ }
26
+ }
@@ -33,7 +33,7 @@
33
33
  padding: 6px 10px;
34
34
  z-index: var(--stacking-level-popover-component, 1000);
35
35
  img {
36
- max-width: 300px;
36
+ max-width: 20px;
37
37
  display: inline-block;
38
38
  }
39
39
  }
@@ -1,5 +1,15 @@
1
1
  @import '../style/variable.less';
2
2
 
3
+ .design_left_slot,
4
+ .design_right_slot {
5
+ .@{prefix}-scrollbar {
6
+ .scrollbar-thumb-vertical,
7
+ .scrollbar-thumb-horizontal {
8
+ border-radius: 5px;
9
+ }
10
+ }
11
+ }
12
+
3
13
  .@{prefix}-scrollbar {
4
14
  .scrollbar-thumb-vertical,
5
15
  .scrollbar-thumb-horizontal {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-components",
3
- "version": "3.1.4-next-1719541057.0",
3
+ "version": "3.1.4-next-1721010662.0",
4
4
  "description": "@opensumi/ide-components",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@ant-design/icons": "^4.6.4",
19
- "@opensumi/ide-utils": "3.1.4-next-1719541057.0",
19
+ "@opensumi/ide-utils": "3.1.4-next-1721010662.0",
20
20
  "fuzzy": "^0.1.3",
21
21
  "lodash": "^4.17.21",
22
22
  "marked": "4.0.10",
@@ -36,10 +36,10 @@
36
36
  "react-window": "^1.8.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@opensumi/ide-dev-tool": "3.1.4-next-1719541057.0",
39
+ "@opensumi/ide-dev-tool": "3.1.4-next-1721010662.0",
40
40
  "@types/marked": "^4.0.7",
41
41
  "@types/react-window": "^1.8.5",
42
42
  "prop-types": "^15.8.1"
43
43
  },
44
- "gitHead": "429bf86d870b5d35a78dbec7f85f30af10778987"
44
+ "gitHead": "79d7fab21f6bdd95c768637f2b5c59cdb98ff28c"
45
45
  }