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AAWpM,EAAKO,IAAI6J,UAAS,GAAMiC,QAAQ,KAAM,OAAQP,EAAOG,GAChEK,eAAe,KAAKP,KAE7B,CAEI,OAAO,IAAI,MAAiBQ,WAAW,GAAGT,MAAUC,KAE5D,CA9C+BS,CAAgBxM,EAAM4H,GACtC4D,CACX,CACA,WAAAzL,CAAYC,EAAM+H,GACd7H,KAAKF,KAAOA,EACZE,KAAK6H,aAAeA,CACxB,CACA,QAAAe,CAAST,EAAgBT,GACrBS,EAAeoE,wBAAwBvM,KAAK6H,aAAcG,EAAeuD,YAAYvL,KAAKF,KAAM4H,GAAY,GAChH,CACA,UAAAmB,CAAWV,EAAgBT,GACvBS,EAAeoE,wBAAwBvM,KAAK6H,aAAcG,EAAeuD,YAAYvL,KAAKF,KAAM4H,GAAY,GAChH,EAmCJ,MAAM8E,UAAuB,KACzB,WAAA3M,GACIsF,MAAM,CACFwF,GAAI,yBACJiB,MAAO3B,EAAA,GAAa,QAAS,aAC7BwC,MAAO,YACPC,kBAAcC,GAEtB,CACA,GAAAC,CAAI7J,EAAU6B,GACV,MAAMiI,EAAelI,EAAavB,IAAIwB,GACtC,IAAKiI,EACD,OAEJ,IAAKjI,EAAOkC,WACR,OAEJ,MAAMgG,EAAalI,EAAOmI,gBAC1B,IAAK,MAAMC,KAAOF,EAAY,CAC1B,MAAMhN,EAAO+M,EAAanE,kBAAkBsE,EAAIC,kBAC5CnN,GACA+M,EAAa/D,mBAAmBhJ,GAAM,EAE9C,CACJ,GAEJ,QAA2B6E,EAAaG,GAAIH,EAAc,IAC1D,QAAqB6H,E","sources":["file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/monaco-editor@0.50.0/node_modules/monaco-editor/esm/vs/editor/contrib/links/browser/getLinks.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/monaco-editor@0.50.0/node_modules/monaco-editor/esm/vs/editor/contrib/links/browser/links.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\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 *--------------------------------------------------------------------------------------------*/\nimport { coalesce } from '../../../../base/common/arrays.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { DisposableStore, isDisposable } from '../../../../base/common/lifecycle.js';\nimport { assertType } from '../../../../base/common/types.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { Range } from '../../../common/core/range.js';\nimport { IModelService } from '../../../common/services/model.js';\nimport { CommandsRegistry } from '../../../../platform/commands/common/commands.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nexport class Link {\n constructor(link, provider) {\n this._link = link;\n this._provider = provider;\n }\n toJSON() {\n return {\n range: this.range,\n url: this.url,\n tooltip: this.tooltip\n };\n }\n get range() {\n return this._link.range;\n }\n get url() {\n return this._link.url;\n }\n get tooltip() {\n return this._link.tooltip;\n }\n async resolve(token) {\n if (this._link.url) {\n return this._link.url;\n }\n if (typeof this._provider.resolveLink === 'function') {\n return Promise.resolve(this._provider.resolveLink(this._link, token)).then(value => {\n this._link = value || this._link;\n if (this._link.url) {\n // recurse\n return this.resolve(token);\n }\n return Promise.reject(new Error('missing'));\n });\n }\n return Promise.reject(new Error('missing'));\n }\n}\nexport class LinksList {\n constructor(tuples) {\n this._disposables = new DisposableStore();\n let links = [];\n for (const [list, provider] of tuples) {\n // merge all links\n const newLinks = list.links.map(link => new Link(link, provider));\n links = LinksList._union(links, newLinks);\n // register disposables\n if (isDisposable(list)) {\n this._disposables.add(list);\n }\n }\n this.links = links;\n }\n dispose() {\n this._disposables.dispose();\n this.links.length = 0;\n }\n static _union(oldLinks, newLinks) {\n // reunite oldLinks with newLinks and remove duplicates\n const result = [];\n let oldIndex;\n let oldLen;\n let newIndex;\n let newLen;\n for (oldIndex = 0, newIndex = 0, oldLen = oldLinks.length, newLen = newLinks.length; oldIndex < oldLen && newIndex < newLen;) {\n const oldLink = oldLinks[oldIndex];\n const newLink = newLinks[newIndex];\n if (Range.areIntersectingOrTouching(oldLink.range, newLink.range)) {\n // Remove the oldLink\n oldIndex++;\n continue;\n }\n const comparisonResult = Range.compareRangesUsingStarts(oldLink.range, newLink.range);\n if (comparisonResult < 0) {\n // oldLink is before\n result.push(oldLink);\n oldIndex++;\n }\n else {\n // newLink is before\n result.push(newLink);\n newIndex++;\n }\n }\n for (; oldIndex < oldLen; oldIndex++) {\n result.push(oldLinks[oldIndex]);\n }\n for (; newIndex < newLen; newIndex++) {\n result.push(newLinks[newIndex]);\n }\n return result;\n }\n}\nexport function getLinks(providers, model, token) {\n const lists = [];\n // ask all providers for links in parallel\n const promises = providers.ordered(model).reverse().map((provider, i) => {\n return Promise.resolve(provider.provideLinks(model, token)).then(result => {\n if (result) {\n lists[i] = [result, provider];\n }\n }, onUnexpectedExternalError);\n });\n return Promise.all(promises).then(() => {\n const result = new LinksList(coalesce(lists));\n if (!token.isCancellationRequested) {\n return result;\n }\n result.dispose();\n return new LinksList([]);\n });\n}\nCommandsRegistry.registerCommand('_executeLinkProvider', async (accessor, ...args) => {\n let [uri, resolveCount] = args;\n assertType(uri instanceof URI);\n if (typeof resolveCount !== 'number') {\n resolveCount = 0;\n }\n const { linkProvider } = accessor.get(ILanguageFeaturesService);\n const model = accessor.get(IModelService).getModel(uri);\n if (!model) {\n return [];\n }\n const list = await getLinks(linkProvider, model, CancellationToken.None);\n if (!list) {\n return [];\n }\n // resolve links\n for (let i = 0; i < Math.min(resolveCount, list.links.length); i++) {\n await list.links[i].resolve(CancellationToken.None);\n }\n const result = list.links.slice(0);\n list.dispose();\n return result;\n});\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 *--------------------------------------------------------------------------------------------*/\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar LinkDetector_1;\nimport { createCancelablePromise, RunOnceScheduler } from '../../../../base/common/async.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport { MarkdownString } from '../../../../base/common/htmlContent.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport * as resources from '../../../../base/common/resources.js';\nimport { StopWatch } from '../../../../base/common/stopwatch.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport './links.css';\nimport { EditorAction, registerEditorAction, registerEditorContribution } from '../../../browser/editorExtensions.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { ILanguageFeatureDebounceService } from '../../../common/services/languageFeatureDebounce.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { ClickLinkGesture } from '../../gotoSymbol/browser/link/clickLinkGesture.js';\nimport { getLinks } from './getLinks.js';\nimport * as nls from '../../../../nls.js';\nimport { INotificationService } from '../../../../platform/notification/common/notification.js';\nimport { IOpenerService } from '../../../../platform/opener/common/opener.js';\nlet LinkDetector = LinkDetector_1 = class LinkDetector extends Disposable {\n static get(editor) {\n return editor.getContribution(LinkDetector_1.ID);\n }\n constructor(editor, openerService, notificationService, languageFeaturesService, languageFeatureDebounceService) {\n super();\n this.editor = editor;\n this.openerService = openerService;\n this.notificationService = notificationService;\n this.languageFeaturesService = languageFeaturesService;\n this.providers = this.languageFeaturesService.linkProvider;\n this.debounceInformation = languageFeatureDebounceService.for(this.providers, 'Links', { min: 1000, max: 4000 });\n this.computeLinks = this._register(new RunOnceScheduler(() => this.computeLinksNow(), 1000));\n this.computePromise = null;\n this.activeLinksList = null;\n this.currentOccurrences = {};\n this.activeLinkDecorationId = null;\n const clickLinkGesture = this._register(new ClickLinkGesture(editor));\n this._register(clickLinkGesture.onMouseMoveOrRelevantKeyDown(([mouseEvent, keyboardEvent]) => {\n this._onEditorMouseMove(mouseEvent, keyboardEvent);\n }));\n this._register(clickLinkGesture.onExecute((e) => {\n this.onEditorMouseUp(e);\n }));\n this._register(clickLinkGesture.onCancel((e) => {\n this.cleanUpActiveLinkDecoration();\n }));\n this._register(editor.onDidChangeConfiguration((e) => {\n if (!e.hasChanged(71 /* EditorOption.links */)) {\n return;\n }\n // Remove any links (for the getting disabled case)\n this.updateDecorations([]);\n // Stop any computation (for the getting disabled case)\n this.stop();\n // Start computing (for the getting enabled case)\n this.computeLinks.schedule(0);\n }));\n this._register(editor.onDidChangeModelContent((e) => {\n if (!this.editor.hasModel()) {\n return;\n }\n this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()));\n }));\n this._register(editor.onDidChangeModel((e) => {\n this.currentOccurrences = {};\n this.activeLinkDecorationId = null;\n this.stop();\n this.computeLinks.schedule(0);\n }));\n this._register(editor.onDidChangeModelLanguage((e) => {\n this.stop();\n this.computeLinks.schedule(0);\n }));\n this._register(this.providers.onDidChange((e) => {\n this.stop();\n this.computeLinks.schedule(0);\n }));\n this.computeLinks.schedule(0);\n }\n async computeLinksNow() {\n if (!this.editor.hasModel() || !this.editor.getOption(71 /* EditorOption.links */)) {\n return;\n }\n const model = this.editor.getModel();\n if (model.isTooLargeForSyncing()) {\n return;\n }\n if (!this.providers.has(model)) {\n return;\n }\n if (this.activeLinksList) {\n this.activeLinksList.dispose();\n this.activeLinksList = null;\n }\n this.computePromise = createCancelablePromise(token => getLinks(this.providers, model, token));\n try {\n const sw = new StopWatch(false);\n this.activeLinksList = await this.computePromise;\n this.debounceInformation.update(model, sw.elapsed());\n if (model.isDisposed()) {\n return;\n }\n this.updateDecorations(this.activeLinksList.links);\n }\n catch (err) {\n onUnexpectedError(err);\n }\n finally {\n this.computePromise = null;\n }\n }\n updateDecorations(links) {\n const useMetaKey = (this.editor.getOption(78 /* EditorOption.multiCursorModifier */) === 'altKey');\n const oldDecorations = [];\n const keys = Object.keys(this.currentOccurrences);\n for (const decorationId of keys) {\n const occurence = this.currentOccurrences[decorationId];\n oldDecorations.push(occurence.decorationId);\n }\n const newDecorations = [];\n if (links) {\n // Not sure why this is sometimes null\n for (const link of links) {\n newDecorations.push(LinkOccurrence.decoration(link, useMetaKey));\n }\n }\n this.editor.changeDecorations((changeAccessor) => {\n const decorations = changeAccessor.deltaDecorations(oldDecorations, newDecorations);\n this.currentOccurrences = {};\n this.activeLinkDecorationId = null;\n for (let i = 0, len = decorations.length; i < len; i++) {\n const occurence = new LinkOccurrence(links[i], decorations[i]);\n this.currentOccurrences[occurence.decorationId] = occurence;\n }\n });\n }\n _onEditorMouseMove(mouseEvent, withKey) {\n const useMetaKey = (this.editor.getOption(78 /* EditorOption.multiCursorModifier */) === 'altKey');\n if (this.isEnabled(mouseEvent, withKey)) {\n this.cleanUpActiveLinkDecoration(); // always remove previous link decoration as their can only be one\n const occurrence = this.getLinkOccurrence(mouseEvent.target.position);\n if (occurrence) {\n this.editor.changeDecorations((changeAccessor) => {\n occurrence.activate(changeAccessor, useMetaKey);\n this.activeLinkDecorationId = occurrence.decorationId;\n });\n }\n }\n else {\n this.cleanUpActiveLinkDecoration();\n }\n }\n cleanUpActiveLinkDecoration() {\n const useMetaKey = (this.editor.getOption(78 /* EditorOption.multiCursorModifier */) === 'altKey');\n if (this.activeLinkDecorationId) {\n const occurrence = this.currentOccurrences[this.activeLinkDecorationId];\n if (occurrence) {\n this.editor.changeDecorations((changeAccessor) => {\n occurrence.deactivate(changeAccessor, useMetaKey);\n });\n }\n this.activeLinkDecorationId = null;\n }\n }\n onEditorMouseUp(mouseEvent) {\n if (!this.isEnabled(mouseEvent)) {\n return;\n }\n const occurrence = this.getLinkOccurrence(mouseEvent.target.position);\n if (!occurrence) {\n return;\n }\n this.openLinkOccurrence(occurrence, mouseEvent.hasSideBySideModifier, true /* from user gesture */);\n }\n openLinkOccurrence(occurrence, openToSide, fromUserGesture = false) {\n if (!this.openerService) {\n return;\n }\n const { link } = occurrence;\n link.resolve(CancellationToken.None).then(uri => {\n // Support for relative file URIs of the shape file://./relativeFile.txt or file:///./relativeFile.txt\n if (typeof uri === 'string' && this.editor.hasModel()) {\n const modelUri = this.editor.getModel().uri;\n if (modelUri.scheme === Schemas.file && uri.startsWith(`${Schemas.file}:`)) {\n const parsedUri = URI.parse(uri);\n if (parsedUri.scheme === Schemas.file) {\n const fsPath = resources.originalFSPath(parsedUri);\n let relativePath = null;\n if (fsPath.startsWith('/./') || fsPath.startsWith('\\\\.\\\\')) {\n relativePath = `.${fsPath.substr(1)}`;\n }\n else if (fsPath.startsWith('//./') || fsPath.startsWith('\\\\\\\\.\\\\')) {\n relativePath = `.${fsPath.substr(2)}`;\n }\n if (relativePath) {\n uri = resources.joinPath(modelUri, relativePath);\n }\n }\n }\n }\n return this.openerService.open(uri, { openToSide, fromUserGesture, allowContributedOpeners: true, allowCommands: true, fromWorkspace: true });\n }, err => {\n const messageOrError = err instanceof Error ? err.message : err;\n // different error cases\n if (messageOrError === 'invalid') {\n this.notificationService.warn(nls.localize('invalid.url', 'Failed to open this link because it is not well-formed: {0}', link.url.toString()));\n }\n else if (messageOrError === 'missing') {\n this.notificationService.warn(nls.localize('missing.url', 'Failed to open this link because its target is missing.'));\n }\n else {\n onUnexpectedError(err);\n }\n });\n }\n getLinkOccurrence(position) {\n if (!this.editor.hasModel() || !position) {\n return null;\n }\n const decorations = this.editor.getModel().getDecorationsInRange({\n startLineNumber: position.lineNumber,\n startColumn: position.column,\n endLineNumber: position.lineNumber,\n endColumn: position.column\n }, 0, true);\n for (const decoration of decorations) {\n const currentOccurrence = this.currentOccurrences[decoration.id];\n if (currentOccurrence) {\n return currentOccurrence;\n }\n }\n return null;\n }\n isEnabled(mouseEvent, withKey) {\n return Boolean((mouseEvent.target.type === 6 /* MouseTargetType.CONTENT_TEXT */)\n && (mouseEvent.hasTriggerModifier || (withKey && withKey.keyCodeIsTriggerKey)));\n }\n stop() {\n var _a;\n this.computeLinks.cancel();\n if (this.activeLinksList) {\n (_a = this.activeLinksList) === null || _a === void 0 ? void 0 : _a.dispose();\n this.activeLinksList = null;\n }\n if (this.computePromise) {\n this.computePromise.cancel();\n this.computePromise = null;\n }\n }\n dispose() {\n super.dispose();\n this.stop();\n }\n};\nLinkDetector.ID = 'editor.linkDetector';\nLinkDetector = LinkDetector_1 = __decorate([\n __param(1, IOpenerService),\n __param(2, INotificationService),\n __param(3, ILanguageFeaturesService),\n __param(4, ILanguageFeatureDebounceService)\n], LinkDetector);\nexport { LinkDetector };\nconst decoration = {\n general: ModelDecorationOptions.register({\n description: 'detected-link',\n stickiness: 1 /* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */,\n collapseOnReplaceEdit: true,\n inlineClassName: 'detected-link'\n }),\n active: ModelDecorationOptions.register({\n description: 'detected-link-active',\n stickiness: 1 /* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */,\n collapseOnReplaceEdit: true,\n inlineClassName: 'detected-link-active'\n })\n};\nclass LinkOccurrence {\n static decoration(link, useMetaKey) {\n return {\n range: link.range,\n options: LinkOccurrence._getOptions(link, useMetaKey, false)\n };\n }\n static _getOptions(link, useMetaKey, isActive) {\n const options = { ...(isActive ? decoration.active : decoration.general) };\n options.hoverMessage = getHoverMessage(link, useMetaKey);\n return options;\n }\n constructor(link, decorationId) {\n this.link = link;\n this.decorationId = decorationId;\n }\n activate(changeAccessor, useMetaKey) {\n changeAccessor.changeDecorationOptions(this.decorationId, LinkOccurrence._getOptions(this.link, useMetaKey, true));\n }\n deactivate(changeAccessor, useMetaKey) {\n changeAccessor.changeDecorationOptions(this.decorationId, LinkOccurrence._getOptions(this.link, useMetaKey, false));\n }\n}\nfunction getHoverMessage(link, useMetaKey) {\n const executeCmd = link.url && /^command:/i.test(link.url.toString());\n const label = link.tooltip\n ? link.tooltip\n : executeCmd\n ? nls.localize('links.navigate.executeCmd', 'Execute command')\n : nls.localize('links.navigate.follow', 'Follow link');\n const kb = useMetaKey\n ? platform.isMacintosh\n ? nls.localize('links.navigate.kb.meta.mac', \"cmd + click\")\n : nls.localize('links.navigate.kb.meta', \"ctrl + click\")\n : platform.isMacintosh\n ? nls.localize('links.navigate.kb.alt.mac', \"option + click\")\n : nls.localize('links.navigate.kb.alt', \"alt + click\");\n if (link.url) {\n let nativeLabel = '';\n if (/^command:/i.test(link.url.toString())) {\n // Don't show complete command arguments in the native tooltip\n const match = link.url.toString().match(/^command:([^?#]+)/);\n if (match) {\n const commandId = match[1];\n nativeLabel = nls.localize('tooltip.explanation', \"Execute command {0}\", commandId);\n }\n }\n const hoverMessage = new MarkdownString('', true)\n .appendLink(link.url.toString(true).replace(/ /g, '%20'), label, nativeLabel)\n .appendMarkdown(` (${kb})`);\n return hoverMessage;\n }\n else {\n return new MarkdownString().appendText(`${label} (${kb})`);\n }\n}\nclass OpenLinkAction extends EditorAction {\n constructor() {\n super({\n id: 'editor.action.openLink',\n label: nls.localize('label', \"Open Link\"),\n alias: 'Open Link',\n precondition: undefined\n });\n }\n run(accessor, editor) {\n const linkDetector = LinkDetector.get(editor);\n if (!linkDetector) {\n return;\n }\n if (!editor.hasModel()) {\n return;\n }\n const selections = editor.getSelections();\n for (const sel of selections) {\n const link = linkDetector.getLinkOccurrence(sel.getEndPosition());\n if (link) {\n linkDetector.openLinkOccurrence(link, false);\n }\n }\n }\n}\nregisterEditorContribution(LinkDetector.ID, LinkDetector, 1 /* EditorContributionInstantiation.AfterFirstRender */);\nregisterEditorAction(OpenLinkAction);\n"],"names":["Link","constructor","link","provider","this","_link","_provider","toJSON","range","url","tooltip","resolve","token","resolveLink","Promise","then","value","reject","Error","LinksList","tuples","_disposables","links","list","newLinks","map","_union","add","dispose","length","oldLinks","result","oldIndex","oldLen","newIndex","newLen","oldLink","newLink","push","getLinks","providers","model","lists","promises","ordered","reverse","i","provideLinks","all","isCancellationRequested","async","accessor","args","uri","resolveCount","linkProvider","get","getModel","Math","min","slice","LinkDetector_1","__decorate","decorators","target","key","desc","d","c","arguments","r","Object","getOwnPropertyDescriptor","Reflect","decorate","defineProperty","__param","paramIndex","decorator","LinkDetector","editor","getContribution","ID","openerService","notificationService","languageFeaturesService","languageFeatureDebounceService","super","debounceInformation","for","max","computeLinks","_register","computeLinksNow","computePromise","activeLinksList","currentOccurrences","activeLinkDecorationId","clickLinkGesture","onMouseMoveOrRelevantKeyDown","mouseEvent","keyboardEvent","_onEditorMouseMove","onExecute","e","onEditorMouseUp","onCancel","cleanUpActiveLinkDecoration","onDidChangeConfiguration","hasChanged","updateDecorations","stop","schedule","onDidChangeModelContent","hasModel","onDidChangeModel","onDidChangeModelLanguage","onDidChange","getOption","isTooLargeForSyncing","has","sw","update","elapsed","isDisposed","err","useMetaKey","oldDecorations","keys","decorationId","occurence","newDecorations","LinkOccurrence","decoration","changeDecorations","changeAccessor","decorations","deltaDecorations","len","withKey","isEnabled","occurrence","getLinkOccurrence","position","activate","deactivate","openLinkOccurrence","hasSideBySideModifier","openToSide","fromUserGesture","modelUri","scheme","startsWith","parsedUri","fsPath","resources","relativePath","substr","open","allowContributedOpeners","allowCommands","fromWorkspace","messageOrError","message","warn","nls","toString","getDecorationsInRange","startLineNumber","lineNumber","startColumn","column","endLineNumber","endColumn","currentOccurrence","id","Boolean","type","hasTriggerModifier","keyCodeIsTriggerKey","_a","cancel","description","stickiness","collapseOnReplaceEdit","inlineClassName","options","_getOptions","isActive","hoverMessage","executeCmd","test","label","kb","platform","nativeLabel","match","commandId","appendLink","replace","appendMarkdown","appendText","getHoverMessage","changeDecorationOptions","OpenLinkAction","alias","precondition","undefined","run","linkDetector","selections","getSelections","sel","getEndPosition"],"sourceRoot":""}