-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditor.worker.js.map
1 lines (1 loc) · 577 KB
/
editor.worker.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/monaco-editor/esm/vs/base/common/platform.js","webpack:///./node_modules/node-libs-browser/mock/process.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/process.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/path-browserify/index.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/errors.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/iterator.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/types.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/strings.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/hash.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/diff/diff.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/path.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/uri.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/core/position.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/core/range.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/diff/diffComputer.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/uint.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/viewModel/prefixSumComputer.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/model/wordHelper.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/modes/linkComputer.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/inplaceReplaceSupport.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/linkedList.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/stopwatch.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/event.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/cancellation.js","webpack:///./node_modules/monaco-editor/esm/vs/base/common/keyCodes.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneEnums.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/core/selection.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/core/token.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneBase.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js","webpack:///./node_modules/monaco-editor/esm/vs/editor/editor.worker.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","_a","LANGUAGE_DEFAULT","_isWindows","_isMacintosh","_isLinux","_isLinuxSnap","_isNative","_isWeb","_isIOS","_locale","undefined","_language","_translationsConfigFile","_userAgent","globals","self","global","nodeProcess","vscode","process","isElectronRenderer","versions","electron","type","isElectronSandboxed","sandboxed","env","navigator","platform","rawNlsConfig","nlsConfig","JSON","parse","resolved","availableLanguages","locale","e","console","error","userAgent","indexOf","maxTouchPoints","language","_platform","isWindows","isMacintosh","isWeb","setImmediate","postMessage","importScripts","pending","addEventListener","data","vscodeSetImmediateId","len","length","candidate","id","splice","callback","lastId","myId","push","nextTick","_promise","Promise","resolve","then","fn","args","Array","slice","arguments","shift","setTimeout","apply","arch","execPath","title","pid","browser","argv","binding","Error","path","cwd","chdir","dir","exit","kill","umask","dlopen","uptime","memoryUsage","uvCounters","features","safeProcess","sandboxProcess","g","this","Function","window","normalizeArray","parts","allowAboveRoot","up","last","unshift","basename","start","end","matchedSlash","charCodeAt","filter","xs","f","res","resolvedPath","resolvedAbsolute","TypeError","charAt","split","join","normalize","isAbsolute","trailingSlash","substr","paths","index","relative","from","to","trim","arr","fromParts","toParts","Math","min","samePartsLength","outputParts","concat","sep","delimiter","dirname","code","hasRoot","ext","extname","startDot","startPart","preDotState","str","ErrorHandler","listeners","unexpectedErrorHandler","stack","message","forEach","listener","emit","errorHandler","onUnexpectedError","isPromiseCanceledError","transformErrorForSerialization","stacktrace","$isError","canceledName","Iterable","is","thing","iterator","_empty","freeze","empty","single","element","iterable","isEmpty","next","done","first","some","predicate","find","map","iterables","concatNested","reduce","reducer","initialValue","consume","atMost","Number","POSITIVE_INFINITY","consumed","equals","a","b","comparator","at","bt","ai","bi","an","bn","TRACK_DISPOSABLES","disposableTracker","__is_disposable_tracked__","x","log","Disposable","None","markTracked","trackDisposable","MultiDisposeError","errors","super","dispose","arg","isArray","combinedDisposable","disposables","toDisposable","DisposableStore","_toDispose","Set","_isDisposed","clear","values","DISABLE_DISPOSED_WARNING","warn","add","_store","getAllPropertyNames","obj","proto","getPrototypeOf","getOwnPropertyNames","getAllMethodNames","methods","prop","createProxyObject","methodNames","invoke","createProxyMethod","method","result","methodName","INITIALIZE","handler","_workerId","_handler","_lastSentReq","_pendingReplies","workerId","req","String","reject","_send","vsWorker","_handleMessage","msg","seq","replyMessage","reply","err","requestMessage","handleMessage","detail","transfer","ArrayBuffer","sendMessage","requestHandlerFactory","_requestHandlerFactory","_requestHandler","_protocol","initialize","loaderConfig","hostMethods","setWorkerId","proxyMethodRequest","hostProxy","baseUrl","vs","trustedTypesPolicy","catchError","require","config","DiffChange","originalStart","originalLength","modifiedStart","modifiedLength","splitLines","firstNonWhitespaceIndex","chCode","lastNonWhitespaceIndex","startIndex","isHighSurrogate","charCode","isLowSurrogate","computeCodePoint","highSurrogate","lowSurrogate","fromCharCode","GraphemeBreakTree","_data","getGraphemeBreakRawData","_INSTANCE","codePoint","nodeCount","nodeIndex","numberHash","val","initialHashVal","stringHash","hashVal","leftRotate","bits","totalBits","delta","mask","fill","dest","count","byteLength","leftPad","char","toHexString","bufferOrValue","bitsize","Uint8Array","toString","padStart","_h0","_h1","_h2","_h3","_h4","_buff","_buffDV","DataView","buffer","_buffLen","_totalLen","_leftoverHighSurrogate","_finished","strLen","buff","offset","buffLen","leftoverHighSurrogate","nextCharCode","_push","_step","_wrapUp","ml","setUint32","floor","bigBlock32","_bigBlock32","j","getUint32","k","temp","StringDiffSequence","source","characters","Int32Array","stringDiff","original","modified","pretty","ComputeDiff","changes","Debug","condition","MyArray","sourceArray","sourceIndex","destinationArray","destinationIndex","m_changes","m_originalStart","m_modifiedStart","m_originalCount","m_modifiedCount","originalIndex","modifiedIndex","MarkNextChange","reverse","originalSequence","modifiedSequence","continueProcessingPredicate","ContinueProcessingPredicate","originalStringElements","originalElementsOrHash","originalHasStrings","_getElements","modifiedStringElements","modifiedElementsOrHash","modifiedHasStrings","_hasStrings","_originalStringElements","_originalElementsOrHash","_modifiedStringElements","_modifiedElementsOrHash","m_forwardHistory","m_reverseHistory","sequence","elements","getElements","_isStringArray","hashes","newIndex","index1","index2","_ComputeDiff","originalEnd","modifiedEnd","quitEarlyArr","ComputeDiffRecursive","PrettifyChanges","quitEarly","ElementsAreEqual","Assert","midOriginalArr","midModifiedArr","ComputeRecursionPoint","midOriginal","midModified","leftChanges","rightChanges","ConcatenateChanges","diagonalForwardBase","diagonalForwardStart","diagonalForwardEnd","diagonalForwardOffset","diagonalReverseBase","diagonalReverseStart","diagonalReverseEnd","diagonalReverseOffset","forwardPoints","reversePoints","deltaIsEven","forwardChanges","reverseChanges","changeHelper","diagonalMin","diagonalMax","diagonalRelative","lastOriginalIndex","historyIndex","diagonal","AddModifiedElement","AddOriginalElement","getReverseChanges","originalStartPoint","modifiedStartPoint","lastForwardChange","max","getOriginalEnd","getModifiedEnd","getChanges","maxDifferences","numDiagonals","numDifferences","furthestOriginalIndex","furthestModifiedIndex","ClipDiagonalBound","tempOriginalIndex","abs","WALKTRACE","matchLengthOfLongest","Copy2","change","originalStop","modifiedStop","checkOriginal","checkModified","OriginalElementsAreEqual","ModifiedElementsAreEqual","mergedChangeArr","ChangesOverlap","prevChange","bestDelta","bestScore","_boundaryScore","touchingPreviousChange","score","aChange","bChange","matchedLength","aOriginalStart","bOriginalEnd","abOriginalLength","aModifiedStart","bModifiedEnd","abModifiedLength","_findBetterContiguousSequence","originalMatchStart","modifiedMatchStart","desiredLength","originalMax","modifiedMax","bestOriginalStart","bestModifiedStart","_contiguousSequenceScore","test","_OriginalIsBoundary","_ModifiedIsBoundary","originalScore","_OriginalRegionIsBoundary","modifiedScore","_ModifiedRegionIsBoundary","left","right","Copy","diagonalBaseIndex","diagonalsBelow","diagonalsAbove","diffEven","lowerBoundEven","upperBoundEven","CHAR_UPPERCASE_A","CHAR_LOWERCASE_A","CHAR_UPPERCASE_Z","CHAR_LOWERCASE_Z","CHAR_DOT","CHAR_FORWARD_SLASH","CHAR_BACKWARD_SLASH","CHAR_COLON","CHAR_QUESTION_MARK","ErrorInvalidArgType","expected","actual","determiner","replace","validateString","isPathSeparator","isPosixPathSeparator","isWindowsDeviceRoot","normalizeString","separator","lastSegmentLength","lastSlash","dots","lastSlashIndex","lastIndexOf","_format","pathObject","root","base","win32","pathSegments","resolvedDevice","resolvedTail","toLowerCase","rootEnd","device","firstPart","tail","joined","needsReplace","slashCount","firstLen","fromOrig","toOrig","fromStart","fromEnd","fromLen","toStart","toEnd","toLen","lastCommonSep","fromCode","out","extIdx","firstNonSlashEnd","format","ret","posix","trailingSeparator","_schemePattern","_singleSlashStart","_doubleSlashStart","_validateUri","_strict","scheme","authority","query","fragment","_schemeFix","_referenceResolution","_slash","_regexp","schemeOrData","fsPath","with","uriToFsPath","Uri","match","exec","percentDecode","idx","substring","components","uri","pathFragment","newPath","file","skipEncoding","_asFormatted","_formatted","external","_fsPath","_sep","_pathSepMarker","$mid","encodeTable","encodeURIComponentFast","uriComponent","allowSlash","nativeEncodePos","pos","encodeURIComponent","escaped","encodeURIComponentMinimal","keepDriveLetterCasing","encoder","userinfo","decodeURIComponentGraceful","decodeURIComponent","_rEncodedAsHex","Position","lineNumber","column","newLineNumber","newColumn","deltaLineNumber","deltaColumn","other","isBefore","isBeforeOrEqual","aLineNumber","bLineNumber","aColumn","bColumn","startLineNumber","startColumn","endLineNumber","endColumn","range","position","containsPosition","containsRange","otherRange","strictContainsRange","plusRange","intersectRanges","resultStartLineNumber","resultStartColumn","resultEndLineNumber","resultEndColumn","otherStartLineNumber","otherStartColumn","otherEndLineNumber","otherEndColumn","equalsRange","getEndPosition","getStartPosition","collapseToStart","aStartLineNumber","bStartLineNumber","aStartColumn","bStartColumn","aEndLineNumber","bEndLineNumber","aEndColumn","bEndColumn","aExists","bExists","MINIMUM_MATCHING_CHARACTER_LENGTH","computeDiff","diffAlgo","LineSequence","lines","startColumns","endColumns","getFirstNonBlankColumn","getLastNonBlankColumn","_startColumns","_endColumns","shouldIgnoreTrimWhitespace","endIndex","charCodes","lineNumbers","columns","lineContent","col","CharSequence","_charCodes","_lineNumbers","_columns","CharChange","originalStartLineNumber","originalStartColumn","originalEndLineNumber","originalEndColumn","modifiedStartLineNumber","modifiedStartColumn","modifiedEndLineNumber","modifiedEndColumn","diffChange","originalCharSequence","modifiedCharSequence","getStartLineNumber","getStartColumn","getEndLineNumber","getEndColumn","postProcessCharChanges","rawChanges","currChange","originalMatchingLength","modifiedMatchingLength","matchingLength","LineChange","charChanges","originalLineSequence","modifiedLineSequence","continueCharDiff","shouldComputeCharChanges","shouldPostProcessCharChanges","createCharSequence","createFromDiffChange","DiffComputer","originalLines","modifiedLines","opts","shouldMakePrettyDiff","continueLineDiff","createContinueProcessingPredicate","maxComputationTime","diffResult","lineChanges","createFromDiffResult","originalLineIndex","modifiedLineIndex","nextChange","originalLine","modifiedLine","originalChar","modifiedChar","_pushTrimWhitespaceCharChange","originalMaxColumn","modifiedMaxColumn","originalLineNumber","modifiedLineNumber","_mergeTrimWhitespaceCharChange","txt","defaultValue","maximumRuntime","startTime","Date","now","toUint8","v","toUint32","PrefixSumIndexOfResult","remainder","prefixSum","Uint32Array","prefixSumValidIndex","insertIndex","insertValues","oldValues","oldPrefixSum","insertValuesLen","set","subarray","cnt","maxCnt","_getAccumulatedValue","accumulatedValue","getTotalValue","low","high","mid","midStop","midStart","eol","versionId","_uri","_lines","_eol","_versionId","_lineStarts","_cachedTextValue","_acceptDeleteRange","_acceptInsertText","text","eolLength","linesLength","lineStartValues","lineIndex","newValue","changeValue","_setLineText","removeValues","insertText","insertLines","newLengths","USUAL_WORD_SEPARATORS","createWordRegExp","allowInWords","RegExp","DEFAULT_WORD_REGEXP","ensureValidWordDefinition","wordDefinition","flags","ignoreCase","multiline","unicode","lastIndex","_defaultConfig","maxLen","windowSize","timeBudget","getWordAtText","textOffset","t1","prevRegexIndex","regexIndex","thisMatch","_findRegexMatchEnclosingPosition","word","stopPos","matchIndex","_defaultValue","_asciiMap","_createAsciiMap","_map","Map","asciiMap","_value","Uint8Matrix","rows","cols","row","StateMachine","edges","maxCharCode","maxState","states","_states","_maxCharCode","currentState","_stateMachine","getStateMachine","_classifier","getClassifier","FORCE_TERMINATION_CHARACTERS","CANNOT_END_WITH_CHARACTERS","LinkComputer","classifier","line","linkBeginIndex","linkEndIndex","lastIncludedCharIndex","chClass","charCodeBeforeLink","lastCharCodeInLink","url","model","stateMachine","lineCount","getLineCount","getLineContent","linkBeginChCode","state","hasOpenParens","hasOpenSquareBracket","inSquareBrackets","hasOpenCurlyBracket","resetStateMachine","_createLink","nextState","computeLinks","BasicInplaceReplace","_defaultValueSet","range1","text1","range2","text2","doNavigateValueSet","numberResult","numberReplace","textReplace","precision","pow","n1","n2","parseFloat","isNaN","valueSetsReplace","valueSets","valueSetReplace","valueSet","INSTANCE","Node","Undefined","prev","LinkedList","_first","_last","_size","node","_insert","atTheEnd","newNode","oldLast","oldFirst","didRemove","_remove","anchor","hasPerformanceNow","performance","highResolution","_highResolution","_startTime","_now","_stopTime","Event","once","event","thisArgs","didFire","snapshot","each","signal","any","events","merge","initial","output","emitter","fire","debounce","delay","leading","leakWarningThreshold","subscription","handle","numDebouncedCalls","cur","clearTimeout","_output","stopwatch","getTime","_","latch","cache","firstCall","shouldEmit","isT","_buffer","flush","ChainableEvent","chain","fromNodeEventEmitter","eventName","onFirstListenerAdd","on","onLastListenerRemove","removeListener","fromDOMEventEmitter","removeEventListener","fromPromise","promise","toPromise","_listenerCount","_invocationCount","_elapsedOverall","_name","_idPool","listenerCount","_stopWatch","elapsed","info","toFixed","_globalLeakWarningThreshold","LeakageMonitor","customThreshold","random","_warnCountdown","_stacks","threshold","topStack","topCount","options","_disposed","_options","_leakageMon","_perfMon","_profName","_event","_listeners","firstListener","remove","onFirstListenerDidAdd","onListenerDidAdd","removeMonitor","check","size","_noop","hasListeners","_b","_deliveryQueue","stop","_c","_d","_e","shortcutEvent","context","CancellationToken","isCancellationToken","Cancelled","isCancellationRequested","onCancellationRequested","_isCancelled","_emitter","CancellationTokenSource","parent","_token","_parentListener","cancel","KeyCodeStrMap","_keyCodeToStr","_strToKeyCode","keyCode","uiMap","userSettingsUSMap","userSettingsGeneralMap","KeyCodeUtils","AccessibilitySupport","CompletionItemInsertTextRule","CompletionItemKind","CompletionItemTag","CompletionTriggerKind","ContentWidgetPositionPreference","CursorChangeReason","DefaultEndOfLine","DocumentHighlightKind","EditorAutoIndentStrategy","EditorOption","EndOfLinePreference","EndOfLineSequence","IndentAction","InlayHintKind","InlineCompletionTriggerKind","KeyCode","MarkerSeverity","MarkerTag","MinimapPosition","MouseTargetType","OverlayWidgetPositionPreference","OverviewRulerLane","RenderLineNumbersType","RenderMinimap","ScrollType","ScrollbarVisibility","SelectionDirection","SignatureHelpTriggerKind","SymbolKind","SymbolTag","TextEditorCursorBlinkingStyle","TextEditorCursorStyle","TrackedRangeStickiness","WrappingIndent","KeyChord","secondPart","chordPart","define","uiLabel","usUserSettingsLabel","generalUserSettingsLabel","keyCodeToStr","fromString","strToKeyCode","toUserSettingsUS","toUserSettingsGeneral","fromUserSettings","selectionStartLineNumber","selectionStartColumn","positionLineNumber","positionColumn","selectionsEqual","getDirection","sel","direction","Token","createMonacoBaseAPI","editor","languages","Emitter","KeyMod","Range","Selection","CtrlCmd","Shift","Alt","WinCtrl","__awaiter","thisArg","_arguments","P","generator","adopt","fulfilled","step","rejected","getText","wordAtText","wordenize","_wordenize","lineText","wordRangesIdx","wordRanges","content","ranges","words","_validateRange","lineEnding","startLineIndex","endLineIndex","resultLines","_validatePosition","_ensureLineStarts","getAccumulatedValue","getIndexOf","lineLength","isIPosition","hasChanged","maxCharacter","host","foreignModuleFactory","_host","_models","_foreignModuleFactory","_foreignModule","all","keys","EOL","strURL","onEvents","originalUrl","modifiedUrl","ignoreTrimWhitespace","_getModel","getLinesContent","diffComputer","identical","_modelsAreIdentical","originalLineCount","modifiedLineCount","modelUrl","edits","lastEol","sort","compareRangesUsingStarts","aRng","bRng","getValueInRange","_diffLimit","editOffset","offsetAt","lift","positionAt","newEdit","modelUrls","leadingWord","wordDef","wordDefFlags","sw","wordDefRegExp","seen","outer","_suggestionsLimit","duration","getLineWords","array","selectionText","wordRange","getWordAtPosition","navigateValueSet","createData","foreignHostMethods","fhr","foreignHost","ctx","getMirrorModels","_getModels","monaco","initialized","foreignModule","simpleWorker","onmessage"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAA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GpB,OAAI9kC,KAAKyhC,uBACLzhC,KAAK0hC,eAAiB1hC,KAAKyhC,sBAAsBmD,EAAKJ,GAE/C1mC,QAAQC,QAAQ,EAAwBiC,KAAK0hC,kBAajD5jC,QAAQgM,OAAO,IAAI9K,MAAM,qBAIpC,IAAIkK,EAAQhL,GACR,IAAK8B,KAAK0hC,gBAAyD,oBAAhC1hC,KAAK0hC,eAAex4B,GACnD,OAAOpL,QAAQgM,OAAO,IAAI9K,MAAM,qCAAuCkK,IAE3E,IACI,OAAOpL,QAAQC,QAAQiC,KAAK0hC,eAAex4B,GAAQ1K,MAAMwB,KAAK0hC,eAAgBxjC,IAElF,MAAOjC,GACH,OAAO6B,QAAQgM,OAAO7N,KAMlC,GAAmBinC,WAAa,IAEhC,GAAmBc,kBAAoB,IAQV,oBAAlBlnC,gBAEP,OAAQioC,OAASrG,MCzdrB,IAAIsG,IAAc,EACX,SAAS/5B,GAAWg6B,GACvB,GAAID,GACA,OAEJA,IAAc,EACd,MAAME,EAAe,IAAI,EAAoBh7B,IACzCtP,KAAKiC,YAAYqN,IACjBm3B,GAAS,IAAI,GAAmBA,EAAM4D,IAC1CrqC,KAAKuqC,UAAalpC,IACdipC,EAAaC,UAAUlpC,EAAEgB,OAGjCrC,KAAKuqC,UAAalpC,IAET+oC,IACD/5B,GAAW","file":"editor.worker.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"e500\");\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar _a;\r\nconst LANGUAGE_DEFAULT = 'en';\r\nlet _isWindows = false;\r\nlet _isMacintosh = false;\r\nlet _isLinux = false;\r\nlet _isLinuxSnap = false;\r\nlet _isNative = false;\r\nlet _isWeb = false;\r\nlet _isIOS = false;\r\nlet _locale = undefined;\r\nlet _language = LANGUAGE_DEFAULT;\r\nlet _translationsConfigFile = undefined;\r\nlet _userAgent = undefined;\r\nexport const globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});\r\nlet nodeProcess = undefined;\r\nif (typeof globals.vscode !== 'undefined' && typeof globals.vscode.process !== 'undefined') {\r\n // Native environment (sandboxed)\r\n nodeProcess = globals.vscode.process;\r\n}\r\nelse if (typeof process !== 'undefined') {\r\n // Native environment (non-sandboxed)\r\n nodeProcess = process;\r\n}\r\nconst isElectronRenderer = typeof ((_a = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.versions) === null || _a === void 0 ? void 0 : _a.electron) === 'string' && nodeProcess.type === 'renderer';\r\nexport const isElectronSandboxed = isElectronRenderer && (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.sandboxed);\r\nexport const browserCodeLoadingCacheStrategy = (() => {\r\n // Always enabled when sandbox is enabled\r\n if (isElectronSandboxed) {\r\n return 'bypassHeatCheck';\r\n }\r\n // Otherwise, only enabled conditionally\r\n const env = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.env['VSCODE_BROWSER_CODE_LOADING'];\r\n if (typeof env === 'string') {\r\n if (env === 'none' || env === 'code' || env === 'bypassHeatCheck' || env === 'bypassHeatCheckAndEagerCompile') {\r\n return env;\r\n }\r\n return 'bypassHeatCheck';\r\n }\r\n return undefined;\r\n})();\r\nexport const isPreferringBrowserCodeLoad = typeof browserCodeLoadingCacheStrategy === 'string';\r\n// Web environment\r\nif (typeof navigator === 'object' && !isElectronRenderer) {\r\n _userAgent = navigator.userAgent;\r\n _isWindows = _userAgent.indexOf('Windows') >= 0;\r\n _isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\r\n _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\r\n _isLinux = _userAgent.indexOf('Linux') >= 0;\r\n _isWeb = true;\r\n _locale = navigator.language;\r\n _language = _locale;\r\n}\r\n// Native environment\r\nelse if (typeof nodeProcess === 'object') {\r\n _isWindows = (nodeProcess.platform === 'win32');\r\n _isMacintosh = (nodeProcess.platform === 'darwin');\r\n _isLinux = (nodeProcess.platform === 'linux');\r\n _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\r\n _locale = LANGUAGE_DEFAULT;\r\n _language = LANGUAGE_DEFAULT;\r\n const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\r\n if (rawNlsConfig) {\r\n try {\r\n const nlsConfig = JSON.parse(rawNlsConfig);\r\n const resolved = nlsConfig.availableLanguages['*'];\r\n _locale = nlsConfig.locale;\r\n // VSCode's default language is 'en'\r\n _language = resolved ? resolved : LANGUAGE_DEFAULT;\r\n _translationsConfigFile = nlsConfig._translationsConfigFile;\r\n }\r\n catch (e) {\r\n }\r\n }\r\n _isNative = true;\r\n}\r\n// Unknown environment\r\nelse {\r\n console.error('Unable to resolve platform.');\r\n}\r\nlet _platform = 0 /* Web */;\r\nif (_isMacintosh) {\r\n _platform = 1 /* Mac */;\r\n}\r\nelse if (_isWindows) {\r\n _platform = 3 /* Windows */;\r\n}\r\nelse if (_isLinux) {\r\n _platform = 2 /* Linux */;\r\n}\r\nexport const isWindows = _isWindows;\r\nexport const isMacintosh = _isMacintosh;\r\nexport const isLinux = _isLinux;\r\nexport const isNative = _isNative;\r\nexport const isWeb = _isWeb;\r\nexport const isIOS = _isIOS;\r\nexport const userAgent = _userAgent;\r\nexport const setImmediate = (function defineSetImmediate() {\r\n if (globals.setImmediate) {\r\n return globals.setImmediate.bind(globals);\r\n }\r\n if (typeof globals.postMessage === 'function' && !globals.importScripts) {\r\n let pending = [];\r\n globals.addEventListener('message', (e) => {\r\n if (e.data && e.data.vscodeSetImmediateId) {\r\n for (let i = 0, len = pending.length; i < len; i++) {\r\n const candidate = pending[i];\r\n if (candidate.id === e.data.vscodeSetImmediateId) {\r\n pending.splice(i, 1);\r\n candidate.callback();\r\n return;\r\n }\r\n }\r\n }\r\n });\r\n let lastId = 0;\r\n return (callback) => {\r\n const myId = ++lastId;\r\n pending.push({\r\n id: myId,\r\n callback: callback\r\n });\r\n globals.postMessage({ vscodeSetImmediateId: myId }, '*');\r\n };\r\n }\r\n if (typeof (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.nextTick) === 'function') {\r\n return nodeProcess.nextTick.bind(nodeProcess);\r\n }\r\n const _promise = Promise.resolve();\r\n return (callback) => _promise.then(callback);\r\n})();\r\nexport const OS = (_isMacintosh || _isIOS ? 2 /* Macintosh */ : (_isWindows ? 1 /* Windows */ : 3 /* Linux */));\r\nlet _isLittleEndian = true;\r\nlet _isLittleEndianComputed = false;\r\nexport function isLittleEndian() {\r\n if (!_isLittleEndianComputed) {\r\n _isLittleEndianComputed = true;\r\n const test = new Uint8Array(2);\r\n test[0] = 1;\r\n test[1] = 2;\r\n const view = new Uint16Array(test.buffer);\r\n _isLittleEndian = (view[0] === (2 << 8) + 1);\r\n }\r\n return _isLittleEndian;\r\n}\r\n","exports.nextTick = function nextTick(fn) {\n var args = Array.prototype.slice.call(arguments);\n args.shift();\n setTimeout(function () {\n fn.apply(null, args);\n }, 0);\n};\n\nexports.platform = exports.arch = \nexports.execPath = exports.title = 'browser';\nexports.pid = 1;\nexports.browser = true;\nexports.env = {};\nexports.argv = [];\n\nexports.binding = function (name) {\n\tthrow new Error('No such module. (Possibly not yet loaded)')\n};\n\n(function () {\n var cwd = '/';\n var path;\n exports.cwd = function () { return cwd };\n exports.chdir = function (dir) {\n if (!path) path = require('path');\n cwd = path.resolve(dir, cwd);\n };\n})();\n\nexports.exit = exports.kill = \nexports.umask = exports.dlopen = \nexports.uptime = exports.memoryUsage = \nexports.uvCounters = function() {};\nexports.features = {};\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isWindows, isMacintosh, setImmediate, globals } from './platform.js';\r\nlet safeProcess;\r\n// Native sandbox environment\r\nif (typeof globals.vscode !== 'undefined' && typeof globals.vscode.process !== 'undefined') {\r\n const sandboxProcess = globals.vscode.process;\r\n safeProcess = {\r\n get platform() { return sandboxProcess.platform; },\r\n get env() { return sandboxProcess.env; },\r\n cwd() { return sandboxProcess.cwd(); },\r\n nextTick(callback) { return setImmediate(callback); }\r\n };\r\n}\r\n// Native node.js environment\r\nelse if (typeof process !== 'undefined') {\r\n safeProcess = {\r\n get platform() { return process.platform; },\r\n get env() { return process.env; },\r\n cwd() { return process.env['VSCODE_CWD'] || process.cwd(); },\r\n nextTick(callback) { return process.nextTick(callback); }\r\n };\r\n}\r\n// Web environment\r\nelse {\r\n safeProcess = {\r\n // Supported\r\n get platform() { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; },\r\n nextTick(callback) { return setImmediate(callback); },\r\n // Unsupported\r\n get env() { return {}; },\r\n cwd() { return '/'; }\r\n };\r\n}\r\n/**\r\n * Provides safe access to the `cwd` property in node.js, sandboxed or web\r\n * environments.\r\n *\r\n * Note: in web, this property is hardcoded to be `/`.\r\n */\r\nexport const cwd = safeProcess.cwd;\r\n/**\r\n * Provides safe access to the `env` property in node.js, sandboxed or web\r\n * environments.\r\n *\r\n * Note: in web, this property is hardcoded to be `{}`.\r\n */\r\nexport const env = safeProcess.env;\r\n/**\r\n * Provides safe access to the `platform` property in node.js, sandboxed or web\r\n * environments.\r\n */\r\nexport const platform = safeProcess.platform;\r\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function (path) {\n if (typeof path !== 'string') path = path + '';\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) {\n // return '//';\n // Backwards-compat fix:\n return '/';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== 'string') path = path + '';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== 'string') path = path + '';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\r\nexport class ErrorHandler {\r\n constructor() {\r\n this.listeners = [];\r\n this.unexpectedErrorHandler = function (e) {\r\n setTimeout(() => {\r\n if (e.stack) {\r\n throw new Error(e.message + '\\n\\n' + e.stack);\r\n }\r\n throw e;\r\n }, 0);\r\n };\r\n }\r\n emit(e) {\r\n this.listeners.forEach((listener) => {\r\n listener(e);\r\n });\r\n }\r\n onUnexpectedError(e) {\r\n this.unexpectedErrorHandler(e);\r\n this.emit(e);\r\n }\r\n // For external errors, we don't want the listeners to be called\r\n onUnexpectedExternalError(e) {\r\n this.unexpectedErrorHandler(e);\r\n }\r\n}\r\nexport const errorHandler = new ErrorHandler();\r\nexport function onUnexpectedError(e) {\r\n // ignore errors from cancelled promises\r\n if (!isPromiseCanceledError(e)) {\r\n errorHandler.onUnexpectedError(e);\r\n }\r\n return undefined;\r\n}\r\nexport function onUnexpectedExternalError(e) {\r\n // ignore errors from cancelled promises\r\n if (!isPromiseCanceledError(e)) {\r\n errorHandler.onUnexpectedExternalError(e);\r\n }\r\n return undefined;\r\n}\r\nexport function transformErrorForSerialization(error) {\r\n if (error instanceof Error) {\r\n let { name, message } = error;\r\n const stack = error.stacktrace || error.stack;\r\n return {\r\n $isError: true,\r\n name,\r\n message,\r\n stack\r\n };\r\n }\r\n // return as is\r\n return error;\r\n}\r\nconst canceledName = 'Canceled';\r\n/**\r\n * Checks if the given error is a promise in canceled state\r\n */\r\nexport function isPromiseCanceledError(error) {\r\n return error instanceof Error && error.name === canceledName && error.message === canceledName;\r\n}\r\n/**\r\n * Returns an error that signals cancellation.\r\n */\r\nexport function canceled() {\r\n const error = new Error(canceledName);\r\n error.name = error.message;\r\n return error;\r\n}\r\nexport function illegalArgument(name) {\r\n if (name) {\r\n return new Error(`Illegal argument: ${name}`);\r\n }\r\n else {\r\n return new Error('Illegal argument');\r\n }\r\n}\r\nexport function illegalState(name) {\r\n if (name) {\r\n return new Error(`Illegal state: ${name}`);\r\n }\r\n else {\r\n return new Error('Illegal state');\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport var Iterable;\r\n(function (Iterable) {\r\n function is(thing) {\r\n return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\r\n }\r\n Iterable.is = is;\r\n const _empty = Object.freeze([]);\r\n function empty() {\r\n return _empty;\r\n }\r\n Iterable.empty = empty;\r\n function* single(element) {\r\n yield element;\r\n }\r\n Iterable.single = single;\r\n function from(iterable) {\r\n return iterable || _empty;\r\n }\r\n Iterable.from = from;\r\n function isEmpty(iterable) {\r\n return !iterable || iterable[Symbol.iterator]().next().done === true;\r\n }\r\n Iterable.isEmpty = isEmpty;\r\n function first(iterable) {\r\n return iterable[Symbol.iterator]().next().value;\r\n }\r\n Iterable.first = first;\r\n function some(iterable, predicate) {\r\n for (const element of iterable) {\r\n if (predicate(element)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n Iterable.some = some;\r\n function find(iterable, predicate) {\r\n for (const element of iterable) {\r\n if (predicate(element)) {\r\n return element;\r\n }\r\n }\r\n return undefined;\r\n }\r\n Iterable.find = find;\r\n function* filter(iterable, predicate) {\r\n for (const element of iterable) {\r\n if (predicate(element)) {\r\n yield element;\r\n }\r\n }\r\n }\r\n Iterable.filter = filter;\r\n function* map(iterable, fn) {\r\n let index = 0;\r\n for (const element of iterable) {\r\n yield fn(element, index++);\r\n }\r\n }\r\n Iterable.map = map;\r\n function* concat(...iterables) {\r\n for (const iterable of iterables) {\r\n for (const element of iterable) {\r\n yield element;\r\n }\r\n }\r\n }\r\n Iterable.concat = concat;\r\n function* concatNested(iterables) {\r\n for (const iterable of iterables) {\r\n for (const element of iterable) {\r\n yield element;\r\n }\r\n }\r\n }\r\n Iterable.concatNested = concatNested;\r\n function reduce(iterable, reducer, initialValue) {\r\n let value = initialValue;\r\n for (const element of iterable) {\r\n value = reducer(value, element);\r\n }\r\n return value;\r\n }\r\n Iterable.reduce = reduce;\r\n /**\r\n * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\r\n */\r\n function* slice(arr, from, to = arr.length) {\r\n if (from < 0) {\r\n from += arr.length;\r\n }\r\n if (to < 0) {\r\n to += arr.length;\r\n }\r\n else if (to > arr.length) {\r\n to = arr.length;\r\n }\r\n for (; from < to; from++) {\r\n yield arr[from];\r\n }\r\n }\r\n Iterable.slice = slice;\r\n /**\r\n * Consumes `atMost` elements from iterable and returns the consumed elements,\r\n * and an iterable for the rest of the elements.\r\n */\r\n function consume(iterable, atMost = Number.POSITIVE_INFINITY) {\r\n const consumed = [];\r\n if (atMost === 0) {\r\n return [consumed, iterable];\r\n }\r\n const iterator = iterable[Symbol.iterator]();\r\n for (let i = 0; i < atMost; i++) {\r\n const next = iterator.next();\r\n if (next.done) {\r\n return [consumed, Iterable.empty()];\r\n }\r\n consumed.push(next.value);\r\n }\r\n return [consumed, { [Symbol.iterator]() { return iterator; } }];\r\n }\r\n Iterable.consume = consume;\r\n /**\r\n * Returns whether the iterables are the same length and all items are\r\n * equal using the comparator function.\r\n */\r\n function equals(a, b, comparator = (at, bt) => at === bt) {\r\n const ai = a[Symbol.iterator]();\r\n const bi = b[Symbol.iterator]();\r\n while (true) {\r\n const an = ai.next();\r\n const bn = bi.next();\r\n if (an.done !== bn.done) {\r\n return false;\r\n }\r\n else if (an.done) {\r\n return true;\r\n }\r\n else if (!comparator(an.value, bn.value)) {\r\n return false;\r\n }\r\n }\r\n }\r\n Iterable.equals = equals;\r\n})(Iterable || (Iterable = {}));\r\n","import { Iterable } from './iterator.js';\r\n/**\r\n * Enables logging of potentially leaked disposables.\r\n *\r\n * A disposable is considered leaked if it is not disposed or not registered as the child of\r\n * another disposable. This tracking is very simple an only works for classes that either\r\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\r\n */\r\nconst TRACK_DISPOSABLES = false;\r\nlet disposableTracker = null;\r\nif (TRACK_DISPOSABLES) {\r\n const __is_disposable_tracked__ = '__is_disposable_tracked__';\r\n disposableTracker = new class {\r\n trackDisposable(x) {\r\n const stack = new Error('Potentially leaked disposable').stack;\r\n setTimeout(() => {\r\n if (!x[__is_disposable_tracked__]) {\r\n console.log(stack);\r\n }\r\n }, 3000);\r\n }\r\n markTracked(x) {\r\n if (x && x !== Disposable.None) {\r\n try {\r\n x[__is_disposable_tracked__] = true;\r\n }\r\n catch (_a) {\r\n // noop\r\n }\r\n }\r\n }\r\n };\r\n}\r\nfunction markTracked(x) {\r\n if (!disposableTracker) {\r\n return;\r\n }\r\n disposableTracker.markTracked(x);\r\n}\r\nexport function trackDisposable(x) {\r\n if (!disposableTracker) {\r\n return x;\r\n }\r\n disposableTracker.trackDisposable(x);\r\n return x;\r\n}\r\nexport class MultiDisposeError extends Error {\r\n constructor(errors) {\r\n super(`Encountered errors while disposing of store. Errors: [${errors.join(', ')}]`);\r\n this.errors = errors;\r\n }\r\n}\r\nexport function isDisposable(thing) {\r\n return typeof thing.dispose === 'function' && thing.dispose.length === 0;\r\n}\r\nexport function dispose(arg) {\r\n if (Iterable.is(arg)) {\r\n let errors = [];\r\n for (const d of arg) {\r\n if (d) {\r\n markTracked(d);\r\n try {\r\n d.dispose();\r\n }\r\n catch (e) {\r\n errors.push(e);\r\n }\r\n }\r\n }\r\n if (errors.length === 1) {\r\n throw errors[0];\r\n }\r\n else if (errors.length > 1) {\r\n throw new MultiDisposeError(errors);\r\n }\r\n return Array.isArray(arg) ? [] : arg;\r\n }\r\n else if (arg) {\r\n markTracked(arg);\r\n arg.dispose();\r\n return arg;\r\n }\r\n}\r\nexport function combinedDisposable(...disposables) {\r\n disposables.forEach(markTracked);\r\n return toDisposable(() => dispose(disposables));\r\n}\r\nexport function toDisposable(fn) {\r\n const self = trackDisposable({\r\n dispose: () => {\r\n markTracked(self);\r\n fn();\r\n }\r\n });\r\n return self;\r\n}\r\nexport class DisposableStore {\r\n constructor() {\r\n this._toDispose = new Set();\r\n this._isDisposed = false;\r\n }\r\n /**\r\n * Dispose of all registered disposables and mark this object as disposed.\r\n *\r\n * Any future disposables added to this object will be disposed of on `add`.\r\n */\r\n dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n markTracked(this);\r\n this._isDisposed = true;\r\n this.clear();\r\n }\r\n /**\r\n * Dispose of all registered disposables but do not mark this object as disposed.\r\n */\r\n clear() {\r\n try {\r\n dispose(this._toDispose.values());\r\n }\r\n finally {\r\n this._toDispose.clear();\r\n }\r\n }\r\n add(t) {\r\n if (!t) {\r\n return t;\r\n }\r\n if (t === this) {\r\n throw new Error('Cannot register a disposable on itself!');\r\n }\r\n markTracked(t);\r\n if (this._isDisposed) {\r\n if (!DisposableStore.DISABLE_DISPOSED_WARNING) {\r\n console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\r\n }\r\n }\r\n else {\r\n this._toDispose.add(t);\r\n }\r\n return t;\r\n }\r\n}\r\nDisposableStore.DISABLE_DISPOSED_WARNING = false;\r\nexport class Disposable {\r\n constructor() {\r\n this._store = new DisposableStore();\r\n trackDisposable(this);\r\n }\r\n dispose() {\r\n markTracked(this);\r\n this._store.dispose();\r\n }\r\n _register(t) {\r\n if (t === this) {\r\n throw new Error('Cannot register a disposable on itself!');\r\n }\r\n return this._store.add(t);\r\n }\r\n}\r\nDisposable.None = Object.freeze({ dispose() { } });\r\n/**\r\n * Manages the lifecycle of a disposable value that may be changed.\r\n *\r\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\r\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\r\n */\r\nexport class MutableDisposable {\r\n constructor() {\r\n this._isDisposed = false;\r\n trackDisposable(this);\r\n }\r\n get value() {\r\n return this._isDisposed ? undefined : this._value;\r\n }\r\n set value(value) {\r\n var _a;\r\n if (this._isDisposed || value === this._value) {\r\n return;\r\n }\r\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\r\n if (value) {\r\n markTracked(value);\r\n }\r\n this._value = value;\r\n }\r\n clear() {\r\n this.value = undefined;\r\n }\r\n dispose() {\r\n var _a;\r\n this._isDisposed = true;\r\n markTracked(this);\r\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\r\n this._value = undefined;\r\n }\r\n}\r\nexport class ImmortalReference {\r\n constructor(object) {\r\n this.object = object;\r\n }\r\n dispose() { }\r\n}\r\n","/**\r\n * @returns whether the provided parameter is a JavaScript Array or not.\r\n */\r\nexport function isArray(array) {\r\n return Array.isArray(array);\r\n}\r\n/**\r\n * @returns whether the provided parameter is a JavaScript String or not.\r\n */\r\nexport function isString(str) {\r\n return (typeof str === 'string');\r\n}\r\n/**\r\n *\r\n * @returns whether the provided parameter is of type `object` but **not**\r\n *\t`null`, an `array`, a `regexp`, nor a `date`.\r\n */\r\nexport function isObject(obj) {\r\n // The method can't do a type cast since there are type (like strings) which\r\n // are subclasses of any put not positvely matched by the function. Hence type\r\n // narrowing results in wrong results.\r\n return typeof obj === 'object'\r\n && obj !== null\r\n && !Array.isArray(obj)\r\n && !(obj instanceof RegExp)\r\n && !(obj instanceof Date);\r\n}\r\n/**\r\n * In **contrast** to just checking `typeof` this will return `false` for `NaN`.\r\n * @returns whether the provided parameter is a JavaScript Number or not.\r\n */\r\nexport function isNumber(obj) {\r\n return (typeof obj === 'number' && !isNaN(obj));\r\n}\r\n/**\r\n * @returns whether the provided parameter is a JavaScript Boolean or not.\r\n */\r\nexport function isBoolean(obj) {\r\n return (obj === true || obj === false);\r\n}\r\n/**\r\n * @returns whether the provided parameter is undefined.\r\n */\r\nexport function isUndefined(obj) {\r\n return (typeof obj === 'undefined');\r\n}\r\n/**\r\n * @returns whether the provided parameter is undefined or null.\r\n */\r\nexport function isUndefinedOrNull(obj) {\r\n return (isUndefined(obj) || obj === null);\r\n}\r\nexport function assertType(condition, type) {\r\n if (!condition) {\r\n throw new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type');\r\n }\r\n}\r\n/**\r\n * Asserts that the argument passed in is neither undefined nor null.\r\n */\r\nexport function assertIsDefined(arg) {\r\n if (isUndefinedOrNull(arg)) {\r\n throw new Error('Assertion Failed: argument is undefined or null');\r\n }\r\n return arg;\r\n}\r\n/**\r\n * @returns whether the provided parameter is a JavaScript Function or not.\r\n */\r\nexport function isFunction(obj) {\r\n return (typeof obj === 'function');\r\n}\r\nexport function validateConstraints(args, constraints) {\r\n const len = Math.min(args.length, constraints.length);\r\n for (let i = 0; i < len; i++) {\r\n validateConstraint(args[i], constraints[i]);\r\n }\r\n}\r\nexport function validateConstraint(arg, constraint) {\r\n if (isString(constraint)) {\r\n if (typeof arg !== constraint) {\r\n throw new Error(`argument does not match constraint: typeof ${constraint}`);\r\n }\r\n }\r\n else if (isFunction(constraint)) {\r\n try {\r\n if (arg instanceof constraint) {\r\n return;\r\n }\r\n }\r\n catch (_a) {\r\n // ignore\r\n }\r\n if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {\r\n return;\r\n }\r\n if (constraint.length === 1 && constraint.call(undefined, arg) === true) {\r\n return;\r\n }\r\n throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);\r\n }\r\n}\r\nexport function getAllPropertyNames(obj) {\r\n let res = [];\r\n let proto = Object.getPrototypeOf(obj);\r\n while (Object.prototype !== proto) {\r\n res = res.concat(Object.getOwnPropertyNames(proto));\r\n proto = Object.getPrototypeOf(proto);\r\n }\r\n return res;\r\n}\r\nexport function getAllMethodNames(obj) {\r\n const methods = [];\r\n for (const prop of getAllPropertyNames(obj)) {\r\n if (typeof obj[prop] === 'function') {\r\n methods.push(prop);\r\n }\r\n }\r\n return methods;\r\n}\r\nexport function createProxyObject(methodNames, invoke) {\r\n const createProxyMethod = (method) => {\r\n return function () {\r\n const args = Array.prototype.slice.call(arguments, 0);\r\n return invoke(method, args);\r\n };\r\n };\r\n let result = {};\r\n for (const methodName of methodNames) {\r\n result[methodName] = createProxyMethod(methodName);\r\n }\r\n return result;\r\n}\r\n/**\r\n * Converts null to undefined, passes all other values through.\r\n */\r\nexport function withNullAsUndefined(x) {\r\n return x === null ? undefined : x;\r\n}\r\nexport function assertNever(value) {\r\n throw new Error('Unreachable');\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { transformErrorForSerialization } from '../errors.js';\r\nimport { Disposable } from '../lifecycle.js';\r\nimport { isWeb } from '../platform.js';\r\nimport * as types from '../types.js';\r\nconst INITIALIZE = '$initialize';\r\nlet webWorkerWarningLogged = false;\r\nexport function logOnceWebWorkerWarning(err) {\r\n if (!isWeb) {\r\n // running tests\r\n return;\r\n }\r\n if (!webWorkerWarningLogged) {\r\n webWorkerWarningLogged = true;\r\n console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq');\r\n }\r\n console.warn(err.message);\r\n}\r\nclass SimpleWorkerProtocol {\r\n constructor(handler) {\r\n this._workerId = -1;\r\n this._handler = handler;\r\n this._lastSentReq = 0;\r\n this._pendingReplies = Object.create(null);\r\n }\r\n setWorkerId(workerId) {\r\n this._workerId = workerId;\r\n }\r\n sendMessage(method, args) {\r\n let req = String(++this._lastSentReq);\r\n return new Promise((resolve, reject) => {\r\n this._pendingReplies[req] = {\r\n resolve: resolve,\r\n reject: reject\r\n };\r\n this._send({\r\n vsWorker: this._workerId,\r\n req: req,\r\n method: method,\r\n args: args\r\n });\r\n });\r\n }\r\n handleMessage(message) {\r\n if (!message || !message.vsWorker) {\r\n return;\r\n }\r\n if (this._workerId !== -1 && message.vsWorker !== this._workerId) {\r\n return;\r\n }\r\n this._handleMessage(message);\r\n }\r\n _handleMessage(msg) {\r\n if (msg.seq) {\r\n let replyMessage = msg;\r\n if (!this._pendingReplies[replyMessage.seq]) {\r\n console.warn('Got reply to unknown seq');\r\n return;\r\n }\r\n let reply = this._pendingReplies[replyMessage.seq];\r\n delete this._pendingReplies[replyMessage.seq];\r\n if (replyMessage.err) {\r\n let err = replyMessage.err;\r\n if (replyMessage.err.$isError) {\r\n err = new Error();\r\n err.name = replyMessage.err.name;\r\n err.message = replyMessage.err.message;\r\n err.stack = replyMessage.err.stack;\r\n }\r\n reply.reject(err);\r\n return;\r\n }\r\n reply.resolve(replyMessage.res);\r\n return;\r\n }\r\n let requestMessage = msg;\r\n let req = requestMessage.req;\r\n let result = this._handler.handleMessage(requestMessage.method, requestMessage.args);\r\n result.then((r) => {\r\n this._send({\r\n vsWorker: this._workerId,\r\n seq: req,\r\n res: r,\r\n err: undefined\r\n });\r\n }, (e) => {\r\n if (e.detail instanceof Error) {\r\n // Loading errors have a detail property that points to the actual error\r\n e.detail = transformErrorForSerialization(e.detail);\r\n }\r\n this._send({\r\n vsWorker: this._workerId,\r\n seq: req,\r\n res: undefined,\r\n err: transformErrorForSerialization(e)\r\n });\r\n });\r\n }\r\n _send(msg) {\r\n let transfer = [];\r\n if (msg.req) {\r\n const m = msg;\r\n for (let i = 0; i < m.args.length; i++) {\r\n if (m.args[i] instanceof ArrayBuffer) {\r\n transfer.push(m.args[i]);\r\n }\r\n }\r\n }\r\n else {\r\n const m = msg;\r\n if (m.res instanceof ArrayBuffer) {\r\n transfer.push(m.res);\r\n }\r\n }\r\n this._handler.sendMessage(msg, transfer);\r\n }\r\n}\r\n/**\r\n * Main thread side\r\n */\r\nexport class SimpleWorkerClient extends Disposable {\r\n constructor(workerFactory, moduleId, host) {\r\n super();\r\n let lazyProxyReject = null;\r\n this._worker = this._register(workerFactory.create('vs/base/common/worker/simpleWorker', (msg) => {\r\n this._protocol.handleMessage(msg);\r\n }, (err) => {\r\n // in Firefox, web workers fail lazily :(\r\n // we will reject the proxy\r\n if (lazyProxyReject) {\r\n lazyProxyReject(err);\r\n }\r\n }));\r\n this._protocol = new SimpleWorkerProtocol({\r\n sendMessage: (msg, transfer) => {\r\n this._worker.postMessage(msg, transfer);\r\n },\r\n handleMessage: (method, args) => {\r\n if (typeof host[method] !== 'function') {\r\n return Promise.reject(new Error('Missing method ' + method + ' on main thread host.'));\r\n }\r\n try {\r\n return Promise.resolve(host[method].apply(host, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n });\r\n this._protocol.setWorkerId(this._worker.getId());\r\n // Gather loader configuration\r\n let loaderConfiguration = null;\r\n if (typeof self.require !== 'undefined' && typeof self.require.getConfig === 'function') {\r\n // Get the configuration from the Monaco AMD Loader\r\n loaderConfiguration = self.require.getConfig();\r\n }\r\n else if (typeof self.requirejs !== 'undefined') {\r\n // Get the configuration from requirejs\r\n loaderConfiguration = self.requirejs.s.contexts._.config;\r\n }\r\n const hostMethods = types.getAllMethodNames(host);\r\n // Send initialize message\r\n this._onModuleLoaded = this._protocol.sendMessage(INITIALIZE, [\r\n this._worker.getId(),\r\n JSON.parse(JSON.stringify(loaderConfiguration)),\r\n moduleId,\r\n hostMethods,\r\n ]);\r\n // Create proxy to loaded code\r\n const proxyMethodRequest = (method, args) => {\r\n return this._request(method, args);\r\n };\r\n this._lazyProxy = new Promise((resolve, reject) => {\r\n lazyProxyReject = reject;\r\n this._onModuleLoaded.then((availableMethods) => {\r\n resolve(types.createProxyObject(availableMethods, proxyMethodRequest));\r\n }, (e) => {\r\n reject(e);\r\n this._onError('Worker failed to load ' + moduleId, e);\r\n });\r\n });\r\n }\r\n getProxyObject() {\r\n return this._lazyProxy;\r\n }\r\n _request(method, args) {\r\n return new Promise((resolve, reject) => {\r\n this._onModuleLoaded.then(() => {\r\n this._protocol.sendMessage(method, args).then(resolve, reject);\r\n }, reject);\r\n });\r\n }\r\n _onError(message, error) {\r\n console.error(message);\r\n console.info(error);\r\n }\r\n}\r\n/**\r\n * Worker side\r\n */\r\nexport class SimpleWorkerServer {\r\n constructor(postMessage, requestHandlerFactory) {\r\n this._requestHandlerFactory = requestHandlerFactory;\r\n this._requestHandler = null;\r\n this._protocol = new SimpleWorkerProtocol({\r\n sendMessage: (msg, transfer) => {\r\n postMessage(msg, transfer);\r\n },\r\n handleMessage: (method, args) => this._handleMessage(method, args)\r\n });\r\n }\r\n onmessage(msg) {\r\n this._protocol.handleMessage(msg);\r\n }\r\n _handleMessage(method, args) {\r\n if (method === INITIALIZE) {\r\n return this.initialize(args[0], args[1], args[2], args[3]);\r\n }\r\n if (!this._requestHandler || typeof this._requestHandler[method] !== 'function') {\r\n return Promise.reject(new Error('Missing requestHandler or method: ' + method));\r\n }\r\n try {\r\n return Promise.resolve(this._requestHandler[method].apply(this._requestHandler, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n initialize(workerId, loaderConfig, moduleId, hostMethods) {\r\n this._protocol.setWorkerId(workerId);\r\n const proxyMethodRequest = (method, args) => {\r\n return this._protocol.sendMessage(method, args);\r\n };\r\n const hostProxy = types.createProxyObject(hostMethods, proxyMethodRequest);\r\n if (this._requestHandlerFactory) {\r\n // static request handler\r\n this._requestHandler = this._requestHandlerFactory(hostProxy);\r\n return Promise.resolve(types.getAllMethodNames(this._requestHandler));\r\n }\r\n if (loaderConfig) {\r\n // Remove 'baseUrl', handling it is beyond scope for now\r\n if (typeof loaderConfig.baseUrl !== 'undefined') {\r\n delete loaderConfig['baseUrl'];\r\n }\r\n if (typeof loaderConfig.paths !== 'undefined') {\r\n if (typeof loaderConfig.paths.vs !== 'undefined') {\r\n delete loaderConfig.paths['vs'];\r\n }\r\n }\r\n if (typeof loaderConfig.trustedTypesPolicy !== undefined) {\r\n // don't use, it has been destroyed during serialize\r\n delete loaderConfig['trustedTypesPolicy'];\r\n }\r\n // Since this is in a web worker, enable catching errors\r\n loaderConfig.catchError = true;\r\n self.require.config(loaderConfig);\r\n }\r\n return new Promise((resolve, reject) => {\r\n // Use the global require to be sure to get the global config\r\n self.require([moduleId], (module) => {\r\n this._requestHandler = module.create(hostProxy);\r\n if (!this._requestHandler) {\r\n reject(new Error(`No RequestHandler!`));\r\n return;\r\n }\r\n resolve(types.getAllMethodNames(this._requestHandler));\r\n }, reject);\r\n });\r\n }\r\n}\r\n/**\r\n * Called on the worker side\r\n */\r\nexport function create(postMessage) {\r\n return new SimpleWorkerServer(postMessage, null);\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * Represents information about a specific difference between two sequences.\r\n */\r\nexport class DiffChange {\r\n /**\r\n * Constructs a new DiffChange with the given sequence information\r\n * and content.\r\n */\r\n constructor(originalStart, originalLength, modifiedStart, modifiedLength) {\r\n //Debug.Assert(originalLength > 0 || modifiedLength > 0, \"originalLength and modifiedLength cannot both be <= 0\");\r\n this.originalStart = originalStart;\r\n this.originalLength = originalLength;\r\n this.modifiedStart = modifiedStart;\r\n this.modifiedLength = modifiedLength;\r\n }\r\n /**\r\n * The end point (exclusive) of the change in the original sequence.\r\n */\r\n getOriginalEnd() {\r\n return this.originalStart + this.originalLength;\r\n }\r\n /**\r\n * The end point (exclusive) of the change in the modified sequence.\r\n */\r\n getModifiedEnd() {\r\n return this.modifiedStart + this.modifiedLength;\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function isFalsyOrWhitespace(str) {\r\n if (!str || typeof str !== 'string') {\r\n return true;\r\n }\r\n return str.trim().length === 0;\r\n}\r\nconst _formatRegexp = /{(\\d+)}/g;\r\n/**\r\n * Helper to produce a string with a variable number of arguments. Insert variable segments\r\n * into the string using the {n} notation where N is the index of the argument following the string.\r\n * @param value string to which formatting is applied\r\n * @param args replacements for {n}-entries\r\n */\r\nexport function format(value, ...args) {\r\n if (args.length === 0) {\r\n return value;\r\n }\r\n return value.replace(_formatRegexp, function (match, group) {\r\n const idx = parseInt(group, 10);\r\n return isNaN(idx) || idx < 0 || idx >= args.length ?\r\n match :\r\n args[idx];\r\n });\r\n}\r\n/**\r\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\r\n * being used e.g. in HTMLElement.innerHTML.\r\n */\r\nexport function escape(html) {\r\n return html.replace(/[<>&]/g, function (match) {\r\n switch (match) {\r\n case '<': return '<';\r\n case '>': return '>';\r\n case '&': return '&';\r\n default: return match;\r\n }\r\n });\r\n}\r\n/**\r\n * Escapes regular expression characters in a given string\r\n */\r\nexport function escapeRegExpCharacters(value) {\r\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\r\n}\r\n/**\r\n * Removes all occurrences of needle from the beginning and end of haystack.\r\n * @param haystack string to trim\r\n * @param needle the thing to trim (default is a blank)\r\n */\r\nexport function trim(haystack, needle = ' ') {\r\n const trimmed = ltrim(haystack, needle);\r\n return rtrim(trimmed, needle);\r\n}\r\n/**\r\n * Removes all occurrences of needle from the beginning of haystack.\r\n * @param haystack string to trim\r\n * @param needle the thing to trim\r\n */\r\nexport function ltrim(haystack, needle) {\r\n if (!haystack || !needle) {\r\n return haystack;\r\n }\r\n const needleLen = needle.length;\r\n if (needleLen === 0 || haystack.length === 0) {\r\n return haystack;\r\n }\r\n let offset = 0;\r\n while (haystack.indexOf(needle, offset) === offset) {\r\n offset = offset + needleLen;\r\n }\r\n return haystack.substring(offset);\r\n}\r\n/**\r\n * Removes all occurrences of needle from the end of haystack.\r\n * @param haystack string to trim\r\n * @param needle the thing to trim\r\n */\r\nexport function rtrim(haystack, needle) {\r\n if (!haystack || !needle) {\r\n return haystack;\r\n }\r\n const needleLen = needle.length, haystackLen = haystack.length;\r\n if (needleLen === 0 || haystackLen === 0) {\r\n return haystack;\r\n }\r\n let offset = haystackLen, idx = -1;\r\n while (true) {\r\n idx = haystack.lastIndexOf(needle, offset - 1);\r\n if (idx === -1 || idx + needleLen !== offset) {\r\n break;\r\n }\r\n if (idx === 0) {\r\n return '';\r\n }\r\n offset = idx;\r\n }\r\n return haystack.substring(0, offset);\r\n}\r\nexport function convertSimple2RegExpPattern(pattern) {\r\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\r\n}\r\nexport function stripWildcards(pattern) {\r\n return pattern.replace(/\\*/g, '');\r\n}\r\nexport function createRegExp(searchString, isRegex, options = {}) {\r\n if (!searchString) {\r\n throw new Error('Cannot create regex from empty string');\r\n }\r\n if (!isRegex) {\r\n searchString = escapeRegExpCharacters(searchString);\r\n }\r\n if (options.wholeWord) {\r\n if (!/\\B/.test(searchString.charAt(0))) {\r\n searchString = '\\\\b' + searchString;\r\n }\r\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\r\n searchString = searchString + '\\\\b';\r\n }\r\n }\r\n let modifiers = '';\r\n if (options.global) {\r\n modifiers += 'g';\r\n }\r\n if (!options.matchCase) {\r\n modifiers += 'i';\r\n }\r\n if (options.multiline) {\r\n modifiers += 'm';\r\n }\r\n if (options.unicode) {\r\n modifiers += 'u';\r\n }\r\n return new RegExp(searchString, modifiers);\r\n}\r\nexport function regExpLeadsToEndlessLoop(regexp) {\r\n // Exit early if it's one of these special cases which are meant to match\r\n // against an empty string\r\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\r\n return false;\r\n }\r\n // We check against an empty string. If the regular expression doesn't advance\r\n // (e.g. ends in an endless loop) it will match an empty string.\r\n const match = regexp.exec('');\r\n return !!(match && regexp.lastIndex === 0);\r\n}\r\nexport function regExpFlags(regexp) {\r\n return (regexp.global ? 'g' : '')\r\n + (regexp.ignoreCase ? 'i' : '')\r\n + (regexp.multiline ? 'm' : '')\r\n + (regexp /* standalone editor compilation */.unicode ? 'u' : '');\r\n}\r\nexport function splitLines(str) {\r\n return str.split(/\\r\\n|\\r|\\n/);\r\n}\r\n/**\r\n * Returns first index of the string that is not whitespace.\r\n * If string is empty or contains only whitespaces, returns -1\r\n */\r\nexport function firstNonWhitespaceIndex(str) {\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n const chCode = str.charCodeAt(i);\r\n if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Returns the leading whitespace of the string.\r\n * If the string contains only whitespaces, returns entire string\r\n */\r\nexport function getLeadingWhitespace(str, start = 0, end = str.length) {\r\n for (let i = start; i < end; i++) {\r\n const chCode = str.charCodeAt(i);\r\n if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {\r\n return str.substring(start, i);\r\n }\r\n }\r\n return str.substring(start, end);\r\n}\r\n/**\r\n * Returns last index of the string that is not whitespace.\r\n * If string is empty or contains only whitespaces, returns -1\r\n */\r\nexport function lastNonWhitespaceIndex(str, startIndex = str.length - 1) {\r\n for (let i = startIndex; i >= 0; i--) {\r\n const chCode = str.charCodeAt(i);\r\n if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\nexport function compare(a, b) {\r\n if (a < b) {\r\n return -1;\r\n }\r\n else if (a > b) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n}\r\nexport function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\r\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\r\n let codeA = a.charCodeAt(aStart);\r\n let codeB = b.charCodeAt(bStart);\r\n if (codeA < codeB) {\r\n return -1;\r\n }\r\n else if (codeA > codeB) {\r\n return 1;\r\n }\r\n }\r\n const aLen = aEnd - aStart;\r\n const bLen = bEnd - bStart;\r\n if (aLen < bLen) {\r\n return -1;\r\n }\r\n else if (aLen > bLen) {\r\n return 1;\r\n }\r\n return 0;\r\n}\r\nexport function compareIgnoreCase(a, b) {\r\n return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\r\n}\r\nexport function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\r\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\r\n let codeA = a.charCodeAt(aStart);\r\n let codeB = b.charCodeAt(bStart);\r\n if (codeA === codeB) {\r\n // equal\r\n continue;\r\n }\r\n const diff = codeA - codeB;\r\n if (diff === 32 && isUpperAsciiLetter(codeB)) { //codeB =[65-90] && codeA =[97-122]\r\n continue;\r\n }\r\n else if (diff === -32 && isUpperAsciiLetter(codeA)) { //codeB =[97-122] && codeA =[65-90]\r\n continue;\r\n }\r\n if (isLowerAsciiLetter(codeA) && isLowerAsciiLetter(codeB)) {\r\n //\r\n return diff;\r\n }\r\n else {\r\n return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\r\n }\r\n }\r\n const aLen = aEnd - aStart;\r\n const bLen = bEnd - bStart;\r\n if (aLen < bLen) {\r\n return -1;\r\n }\r\n else if (aLen > bLen) {\r\n return 1;\r\n }\r\n return 0;\r\n}\r\nexport function isLowerAsciiLetter(code) {\r\n return code >= 97 /* a */ && code <= 122 /* z */;\r\n}\r\nexport function isUpperAsciiLetter(code) {\r\n return code >= 65 /* A */ && code <= 90 /* Z */;\r\n}\r\nfunction isAsciiLetter(code) {\r\n return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);\r\n}\r\nexport function equalsIgnoreCase(a, b) {\r\n return a.length === b.length && doEqualsIgnoreCase(a, b);\r\n}\r\nfunction doEqualsIgnoreCase(a, b, stopAt = a.length) {\r\n for (let i = 0; i < stopAt; i++) {\r\n const codeA = a.charCodeAt(i);\r\n const codeB = b.charCodeAt(i);\r\n if (codeA === codeB) {\r\n continue;\r\n }\r\n // a-z A-Z\r\n if (isAsciiLetter(codeA) && isAsciiLetter(codeB)) {\r\n const diff = Math.abs(codeA - codeB);\r\n if (diff !== 0 && diff !== 32) {\r\n return false;\r\n }\r\n }\r\n // Any other charcode\r\n else {\r\n if (String.fromCharCode(codeA).toLowerCase() !== String.fromCharCode(codeB).toLowerCase()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\r\nexport function startsWithIgnoreCase(str, candidate) {\r\n const candidateLength = candidate.length;\r\n if (candidate.length > str.length) {\r\n return false;\r\n }\r\n return doEqualsIgnoreCase(str, candidate, candidateLength);\r\n}\r\n/**\r\n * @returns the length of the common prefix of the two strings.\r\n */\r\nexport function commonPrefixLength(a, b) {\r\n let i, len = Math.min(a.length, b.length);\r\n for (i = 0; i < len; i++) {\r\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\r\n return i;\r\n }\r\n }\r\n return len;\r\n}\r\n/**\r\n * @returns the length of the common suffix of the two strings.\r\n */\r\nexport function commonSuffixLength(a, b) {\r\n let i, len = Math.min(a.length, b.length);\r\n const aLastIndex = a.length - 1;\r\n const bLastIndex = b.length - 1;\r\n for (i = 0; i < len; i++) {\r\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\r\n return i;\r\n }\r\n }\r\n return len;\r\n}\r\n/**\r\n * See http://en.wikipedia.org/wiki/Surrogate_pair\r\n */\r\nexport function isHighSurrogate(charCode) {\r\n return (0xD800 <= charCode && charCode <= 0xDBFF);\r\n}\r\n/**\r\n * See http://en.wikipedia.org/wiki/Surrogate_pair\r\n */\r\nexport function isLowSurrogate(charCode) {\r\n return (0xDC00 <= charCode && charCode <= 0xDFFF);\r\n}\r\n/**\r\n * See http://en.wikipedia.org/wiki/Surrogate_pair\r\n */\r\nexport function computeCodePoint(highSurrogate, lowSurrogate) {\r\n return ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\r\n}\r\n/**\r\n * get the code point that begins at offset `offset`\r\n */\r\nexport function getNextCodePoint(str, len, offset) {\r\n const charCode = str.charCodeAt(offset);\r\n if (isHighSurrogate(charCode) && offset + 1 < len) {\r\n const nextCharCode = str.charCodeAt(offset + 1);\r\n if (isLowSurrogate(nextCharCode)) {\r\n return computeCodePoint(charCode, nextCharCode);\r\n }\r\n }\r\n return charCode;\r\n}\r\n/**\r\n * get the code point that ends right before offset `offset`\r\n */\r\nfunction getPrevCodePoint(str, offset) {\r\n const charCode = str.charCodeAt(offset - 1);\r\n if (isLowSurrogate(charCode) && offset > 1) {\r\n const prevCharCode = str.charCodeAt(offset - 2);\r\n if (isHighSurrogate(prevCharCode)) {\r\n return computeCodePoint(prevCharCode, charCode);\r\n }\r\n }\r\n return charCode;\r\n}\r\nexport function nextCharLength(str, offset) {\r\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\r\n const initialOffset = offset;\r\n const len = str.length;\r\n const initialCodePoint = getNextCodePoint(str, len, offset);\r\n offset += (initialCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);\r\n while (offset < len) {\r\n const nextCodePoint = getNextCodePoint(str, len, offset);\r\n const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint);\r\n if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\r\n break;\r\n }\r\n offset += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n graphemeBreakType = nextGraphemeBreakType;\r\n }\r\n return (offset - initialOffset);\r\n}\r\nexport function prevCharLength(str, offset) {\r\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\r\n const initialOffset = offset;\r\n const initialCodePoint = getPrevCodePoint(str, offset);\r\n offset -= (initialCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);\r\n while (offset > 0) {\r\n const prevCodePoint = getPrevCodePoint(str, offset);\r\n const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint);\r\n if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {\r\n break;\r\n }\r\n offset -= (prevCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n graphemeBreakType = prevGraphemeBreakType;\r\n }\r\n return (initialOffset - offset);\r\n}\r\n/**\r\n * A manual decoding of a UTF8 string.\r\n * Use only in environments which do not offer native conversion methods!\r\n */\r\nexport function decodeUTF8(buffer) {\r\n // https://en.wikipedia.org/wiki/UTF-8\r\n const len = buffer.byteLength;\r\n const result = [];\r\n let offset = 0;\r\n while (offset < len) {\r\n const v0 = buffer[offset];\r\n let codePoint;\r\n if (v0 >= 0b11110000 && offset + 3 < len) {\r\n // 4 bytes\r\n codePoint = ((((buffer[offset++] & 0b00000111) << 18) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 12) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 6) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 0) >>> 0));\r\n }\r\n else if (v0 >= 0b11100000 && offset + 2 < len) {\r\n // 3 bytes\r\n codePoint = ((((buffer[offset++] & 0b00001111) << 12) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 6) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 0) >>> 0));\r\n }\r\n else if (v0 >= 0b11000000 && offset + 1 < len) {\r\n // 2 bytes\r\n codePoint = ((((buffer[offset++] & 0b00011111) << 6) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 0) >>> 0));\r\n }\r\n else {\r\n // 1 byte\r\n codePoint = buffer[offset++];\r\n }\r\n if ((codePoint >= 0 && codePoint <= 0xD7FF) || (codePoint >= 0xE000 && codePoint <= 0xFFFF)) {\r\n // Basic Multilingual Plane\r\n result.push(String.fromCharCode(codePoint));\r\n }\r\n else if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\r\n // Supplementary Planes\r\n const uPrime = codePoint - 0x10000;\r\n const w1 = 0xD800 + ((uPrime & 0b11111111110000000000) >>> 10);\r\n const w2 = 0xDC00 + ((uPrime & 0b00000000001111111111) >>> 0);\r\n result.push(String.fromCharCode(w1));\r\n result.push(String.fromCharCode(w2));\r\n }\r\n else {\r\n // illegal code point\r\n result.push(String.fromCharCode(0xFFFD));\r\n }\r\n }\r\n return result.join('');\r\n}\r\n/**\r\n * Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-rtl-test.js\r\n */\r\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])/;\r\n/**\r\n * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\r\n */\r\nexport function containsRTL(str) {\r\n return CONTAINS_RTL.test(str);\r\n}\r\n/**\r\n * Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-emoji-test.js\r\n */\r\nconst CONTAINS_EMOJI = /(?:[\\u231A\\u231B\\u23F0\\u23F3\\u2600-\\u27BF\\u2B50\\u2B55]|\\uD83C[\\uDDE6-\\uDDFF\\uDF00-\\uDFFF]|\\uD83D[\\uDC00-\\uDE4F\\uDE80-\\uDEFC\\uDFE0-\\uDFEB]|\\uD83E[\\uDD00-\\uDDFF\\uDE70-\\uDED6])/;\r\nexport function containsEmoji(str) {\r\n return CONTAINS_EMOJI.test(str);\r\n}\r\nconst IS_BASIC_ASCII = /^[\\t\\n\\r\\x20-\\x7E]*$/;\r\n/**\r\n * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \\n, \\r, \\t\r\n */\r\nexport function isBasicASCII(str) {\r\n return IS_BASIC_ASCII.test(str);\r\n}\r\nexport const UNUSUAL_LINE_TERMINATORS = /[\\u2028\\u2029]/; // LINE SEPARATOR (LS) or PARAGRAPH SEPARATOR (PS)\r\n/**\r\n * Returns true if `str` contains unusual line terminators, like LS or PS\r\n */\r\nexport function containsUnusualLineTerminators(str) {\r\n return UNUSUAL_LINE_TERMINATORS.test(str);\r\n}\r\nexport function containsFullWidthCharacter(str) {\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n if (isFullWidthCharacter(str.charCodeAt(i))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isFullWidthCharacter(charCode) {\r\n // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\r\n // http://jrgraphix.net/research/unicode_blocks.php\r\n // 2E80 — 2EFF CJK Radicals Supplement\r\n // 2F00 — 2FDF Kangxi Radicals\r\n // 2FF0 — 2FFF Ideographic Description Characters\r\n // 3000 — 303F CJK Symbols and Punctuation\r\n // 3040 — 309F Hiragana\r\n // 30A0 — 30FF Katakana\r\n // 3100 — 312F Bopomofo\r\n // 3130 — 318F Hangul Compatibility Jamo\r\n // 3190 — 319F Kanbun\r\n // 31A0 — 31BF Bopomofo Extended\r\n // 31F0 — 31FF Katakana Phonetic Extensions\r\n // 3200 — 32FF Enclosed CJK Letters and Months\r\n // 3300 — 33FF CJK Compatibility\r\n // 3400 — 4DBF CJK Unified Ideographs Extension A\r\n // 4DC0 — 4DFF Yijing Hexagram Symbols\r\n // 4E00 — 9FFF CJK Unified Ideographs\r\n // A000 — A48F Yi Syllables\r\n // A490 — A4CF Yi Radicals\r\n // AC00 — D7AF Hangul Syllables\r\n // [IGNORE] D800 — DB7F High Surrogates\r\n // [IGNORE] DB80 — DBFF High Private Use Surrogates\r\n // [IGNORE] DC00 — DFFF Low Surrogates\r\n // [IGNORE] E000 — F8FF Private Use Area\r\n // F900 — FAFF CJK Compatibility Ideographs\r\n // [IGNORE] FB00 — FB4F Alphabetic Presentation Forms\r\n // [IGNORE] FB50 — FDFF Arabic Presentation Forms-A\r\n // [IGNORE] FE00 — FE0F Variation Selectors\r\n // [IGNORE] FE20 — FE2F Combining Half Marks\r\n // [IGNORE] FE30 — FE4F CJK Compatibility Forms\r\n // [IGNORE] FE50 — FE6F Small Form Variants\r\n // [IGNORE] FE70 — FEFF Arabic Presentation Forms-B\r\n // FF00 — FFEF Halfwidth and Fullwidth Forms\r\n // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\r\n // of which FF01 - FF5E fullwidth ASCII of 21 to 7E\r\n // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul\r\n // [IGNORE] FFF0 — FFFF Specials\r\n charCode = +charCode; // @perf\r\n return ((charCode >= 0x2E80 && charCode <= 0xD7AF)\r\n || (charCode >= 0xF900 && charCode <= 0xFAFF)\r\n || (charCode >= 0xFF01 && charCode <= 0xFF5E));\r\n}\r\n/**\r\n * A fast function (therefore imprecise) to check if code points are emojis.\r\n * Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-emoji-test.js\r\n */\r\nexport function isEmojiImprecise(x) {\r\n return ((x >= 0x1F1E6 && x <= 0x1F1FF) || (x === 8986) || (x === 8987) || (x === 9200)\r\n || (x === 9203) || (x >= 9728 && x <= 10175) || (x === 11088) || (x === 11093)\r\n || (x >= 127744 && x <= 128591) || (x >= 128640 && x <= 128764)\r\n || (x >= 128992 && x <= 129003) || (x >= 129280 && x <= 129535)\r\n || (x >= 129648 && x <= 129750));\r\n}\r\n// -- UTF-8 BOM\r\nexport const UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* UTF8_BOM */);\r\nexport function startsWithUTF8BOM(str) {\r\n return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* UTF8_BOM */);\r\n}\r\nexport function containsUppercaseCharacter(target, ignoreEscapedChars = false) {\r\n if (!target) {\r\n return false;\r\n }\r\n if (ignoreEscapedChars) {\r\n target = target.replace(/\\\\./g, '');\r\n }\r\n return target.toLowerCase() !== target;\r\n}\r\n/**\r\n * Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.\r\n */\r\nexport function singleLetterHash(n) {\r\n const LETTERS_CNT = (90 /* Z */ - 65 /* A */ + 1);\r\n n = n % (2 * LETTERS_CNT);\r\n if (n < LETTERS_CNT) {\r\n return String.fromCharCode(97 /* a */ + n);\r\n }\r\n return String.fromCharCode(65 /* A */ + n - LETTERS_CNT);\r\n}\r\n//#region Unicode Grapheme Break\r\nexport function getGraphemeBreakType(codePoint) {\r\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\r\n return graphemeBreakTree.getGraphemeBreakType(codePoint);\r\n}\r\nexport function breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {\r\n // http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules\r\n // !!! Let's make the common case a bit faster\r\n if (breakTypeA === 0 /* Other */) {\r\n // see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table\r\n return (breakTypeB !== 5 /* Extend */ && breakTypeB !== 7 /* SpacingMark */);\r\n }\r\n // Do not break between a CR and LF. Otherwise, break before and after controls.\r\n // GB3 CR × LF\r\n // GB4 (Control | CR | LF) ÷\r\n // GB5 ÷ (Control | CR | LF)\r\n if (breakTypeA === 2 /* CR */) {\r\n if (breakTypeB === 3 /* LF */) {\r\n return false; // GB3\r\n }\r\n }\r\n if (breakTypeA === 4 /* Control */ || breakTypeA === 2 /* CR */ || breakTypeA === 3 /* LF */) {\r\n return true; // GB4\r\n }\r\n if (breakTypeB === 4 /* Control */ || breakTypeB === 2 /* CR */ || breakTypeB === 3 /* LF */) {\r\n return true; // GB5\r\n }\r\n // Do not break Hangul syllable sequences.\r\n // GB6 L × (L | V | LV | LVT)\r\n // GB7 (LV | V) × (V | T)\r\n // GB8 (LVT | T) × T\r\n if (breakTypeA === 8 /* L */) {\r\n if (breakTypeB === 8 /* L */ || breakTypeB === 9 /* V */ || breakTypeB === 11 /* LV */ || breakTypeB === 12 /* LVT */) {\r\n return false; // GB6\r\n }\r\n }\r\n if (breakTypeA === 11 /* LV */ || breakTypeA === 9 /* V */) {\r\n if (breakTypeB === 9 /* V */ || breakTypeB === 10 /* T */) {\r\n return false; // GB7\r\n }\r\n }\r\n if (breakTypeA === 12 /* LVT */ || breakTypeA === 10 /* T */) {\r\n if (breakTypeB === 10 /* T */) {\r\n return false; // GB8\r\n }\r\n }\r\n // Do not break before extending characters or ZWJ.\r\n // GB9 × (Extend | ZWJ)\r\n if (breakTypeB === 5 /* Extend */ || breakTypeB === 13 /* ZWJ */) {\r\n return false; // GB9\r\n }\r\n // The GB9a and GB9b rules only apply to extended grapheme clusters:\r\n // Do not break before SpacingMarks, or after Prepend characters.\r\n // GB9a × SpacingMark\r\n // GB9b Prepend ×\r\n if (breakTypeB === 7 /* SpacingMark */) {\r\n return false; // GB9a\r\n }\r\n if (breakTypeA === 1 /* Prepend */) {\r\n return false; // GB9b\r\n }\r\n // Do not break within emoji modifier sequences or emoji zwj sequences.\r\n // GB11 \\p{Extended_Pictographic} Extend* ZWJ × \\p{Extended_Pictographic}\r\n if (breakTypeA === 13 /* ZWJ */ && breakTypeB === 14 /* Extended_Pictographic */) {\r\n // Note: we are not implementing the rule entirely here to avoid introducing states\r\n return false; // GB11\r\n }\r\n // GB12 sot (RI RI)* RI × RI\r\n // GB13 [^RI] (RI RI)* RI × RI\r\n if (breakTypeA === 6 /* Regional_Indicator */ && breakTypeB === 6 /* Regional_Indicator */) {\r\n // Note: we are not implementing the rule entirely here to avoid introducing states\r\n return false; // GB12 & GB13\r\n }\r\n // GB999 Any ÷ Any\r\n return true;\r\n}\r\nclass GraphemeBreakTree {\r\n constructor() {\r\n this._data = getGraphemeBreakRawData();\r\n }\r\n static getInstance() {\r\n if (!GraphemeBreakTree._INSTANCE) {\r\n GraphemeBreakTree._INSTANCE = new GraphemeBreakTree();\r\n }\r\n return GraphemeBreakTree._INSTANCE;\r\n }\r\n getGraphemeBreakType(codePoint) {\r\n // !!! Let's make 7bit ASCII a bit faster: 0..31\r\n if (codePoint < 32) {\r\n if (codePoint === 10 /* LineFeed */) {\r\n return 3 /* LF */;\r\n }\r\n if (codePoint === 13 /* CarriageReturn */) {\r\n return 2 /* CR */;\r\n }\r\n return 4 /* Control */;\r\n }\r\n // !!! Let's make 7bit ASCII a bit faster: 32..126\r\n if (codePoint < 127) {\r\n return 0 /* Other */;\r\n }\r\n const data = this._data;\r\n const nodeCount = data.length / 3;\r\n let nodeIndex = 1;\r\n while (nodeIndex <= nodeCount) {\r\n if (codePoint < data[3 * nodeIndex]) {\r\n // go left\r\n nodeIndex = 2 * nodeIndex;\r\n }\r\n else if (codePoint > data[3 * nodeIndex + 1]) {\r\n // go right\r\n nodeIndex = 2 * nodeIndex + 1;\r\n }\r\n else {\r\n // hit\r\n return data[3 * nodeIndex + 2];\r\n }\r\n }\r\n return 0 /* Other */;\r\n }\r\n}\r\nGraphemeBreakTree._INSTANCE = null;\r\nfunction getGraphemeBreakRawData() {\r\n // generated using https://github.com/alexdima/unicode-utils/blob/master/generate-grapheme-break.js\r\n return JSON.parse('[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]');\r\n}\r\n//#endregion\r\n/**\r\n * Computes the offset after performing a left delete on the given string,\r\n * while considering unicode grapheme/emoji rules.\r\n*/\r\nexport function getLeftDeleteOffset(offset, str) {\r\n if (offset === 0) {\r\n return 0;\r\n }\r\n // Try to delete emoji part.\r\n const emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str);\r\n if (emojiOffset !== undefined) {\r\n return emojiOffset;\r\n }\r\n // Otherwise, just skip a single code point.\r\n const codePoint = getPrevCodePoint(str, offset);\r\n offset -= getUTF16Length(codePoint);\r\n return offset;\r\n}\r\nfunction getOffsetBeforeLastEmojiComponent(offset, str) {\r\n // See https://www.unicode.org/reports/tr51/tr51-14.html#EBNF_and_Regex for the\r\n // structure of emojis.\r\n let codePoint = getPrevCodePoint(str, offset);\r\n offset -= getUTF16Length(codePoint);\r\n // Skip modifiers\r\n while ((isEmojiModifier(codePoint) || codePoint === 65039 /* emojiVariantSelector */ || codePoint === 8419 /* enclosingKeyCap */)) {\r\n if (offset === 0) {\r\n // Cannot skip modifier, no preceding emoji base.\r\n return undefined;\r\n }\r\n codePoint = getPrevCodePoint(str, offset);\r\n offset -= getUTF16Length(codePoint);\r\n }\r\n // Expect base emoji\r\n if (!isEmojiImprecise(codePoint)) {\r\n // Unexpected code point, not a valid emoji.\r\n return undefined;\r\n }\r\n if (offset >= 0) {\r\n // Skip optional ZWJ code points that combine multiple emojis.\r\n // In theory, we should check if that ZWJ actually combines multiple emojis\r\n // to prevent deleting ZWJs in situations we didn't account for.\r\n const optionalZwjCodePoint = getPrevCodePoint(str, offset);\r\n if (optionalZwjCodePoint === 8205 /* zwj */) {\r\n offset -= getUTF16Length(optionalZwjCodePoint);\r\n }\r\n }\r\n return offset;\r\n}\r\nfunction getUTF16Length(codePoint) {\r\n return codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1;\r\n}\r\nfunction isEmojiModifier(codePoint) {\r\n return 0x1F3FB <= codePoint && codePoint <= 0x1F3FF;\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from './strings.js';\r\n/**\r\n * Return a hash value for an object.\r\n */\r\nexport function hash(obj) {\r\n return doHash(obj, 0);\r\n}\r\nexport function doHash(obj, hashVal) {\r\n switch (typeof obj) {\r\n case 'object':\r\n if (obj === null) {\r\n return numberHash(349, hashVal);\r\n }\r\n else if (Array.isArray(obj)) {\r\n return arrayHash(obj, hashVal);\r\n }\r\n return objectHash(obj, hashVal);\r\n case 'string':\r\n return stringHash(obj, hashVal);\r\n case 'boolean':\r\n return booleanHash(obj, hashVal);\r\n case 'number':\r\n return numberHash(obj, hashVal);\r\n case 'undefined':\r\n return numberHash(937, hashVal);\r\n default:\r\n return numberHash(617, hashVal);\r\n }\r\n}\r\nfunction numberHash(val, initialHashVal) {\r\n return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\r\n}\r\nfunction booleanHash(b, initialHashVal) {\r\n return numberHash(b ? 433 : 863, initialHashVal);\r\n}\r\nexport function stringHash(s, hashVal) {\r\n hashVal = numberHash(149417, hashVal);\r\n for (let i = 0, length = s.length; i < length; i++) {\r\n hashVal = numberHash(s.charCodeAt(i), hashVal);\r\n }\r\n return hashVal;\r\n}\r\nfunction arrayHash(arr, initialHashVal) {\r\n initialHashVal = numberHash(104579, initialHashVal);\r\n return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\r\n}\r\nfunction objectHash(obj, initialHashVal) {\r\n initialHashVal = numberHash(181387, initialHashVal);\r\n return Object.keys(obj).sort().reduce((hashVal, key) => {\r\n hashVal = stringHash(key, hashVal);\r\n return doHash(obj[key], hashVal);\r\n }, initialHashVal);\r\n}\r\nfunction leftRotate(value, bits, totalBits = 32) {\r\n // delta + bits = totalBits\r\n const delta = totalBits - bits;\r\n // All ones, expect `delta` zeros aligned to the right\r\n const mask = ~((1 << delta) - 1);\r\n // Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\r\n return ((value << bits) | ((mask & value) >>> delta)) >>> 0;\r\n}\r\nfunction fill(dest, index = 0, count = dest.byteLength, value = 0) {\r\n for (let i = 0; i < count; i++) {\r\n dest[index + i] = value;\r\n }\r\n}\r\nfunction leftPad(value, length, char = '0') {\r\n while (value.length < length) {\r\n value = char + value;\r\n }\r\n return value;\r\n}\r\nexport function toHexString(bufferOrValue, bitsize = 32) {\r\n if (bufferOrValue instanceof ArrayBuffer) {\r\n return Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\r\n }\r\n return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\r\n}\r\n/**\r\n * A SHA1 implementation that works with strings and does not allocate.\r\n */\r\nexport class StringSHA1 {\r\n constructor() {\r\n this._h0 = 0x67452301;\r\n this._h1 = 0xEFCDAB89;\r\n this._h2 = 0x98BADCFE;\r\n this._h3 = 0x10325476;\r\n this._h4 = 0xC3D2E1F0;\r\n this._buff = new Uint8Array(64 /* BLOCK_SIZE */ + 3 /* to fit any utf-8 */);\r\n this._buffDV = new DataView(this._buff.buffer);\r\n this._buffLen = 0;\r\n this._totalLen = 0;\r\n this._leftoverHighSurrogate = 0;\r\n this._finished = false;\r\n }\r\n update(str) {\r\n const strLen = str.length;\r\n if (strLen === 0) {\r\n return;\r\n }\r\n const buff = this._buff;\r\n let buffLen = this._buffLen;\r\n let leftoverHighSurrogate = this._leftoverHighSurrogate;\r\n let charCode;\r\n let offset;\r\n if (leftoverHighSurrogate !== 0) {\r\n charCode = leftoverHighSurrogate;\r\n offset = -1;\r\n leftoverHighSurrogate = 0;\r\n }\r\n else {\r\n charCode = str.charCodeAt(0);\r\n offset = 0;\r\n }\r\n while (true) {\r\n let codePoint = charCode;\r\n if (strings.isHighSurrogate(charCode)) {\r\n if (offset + 1 < strLen) {\r\n const nextCharCode = str.charCodeAt(offset + 1);\r\n if (strings.isLowSurrogate(nextCharCode)) {\r\n offset++;\r\n codePoint = strings.computeCodePoint(charCode, nextCharCode);\r\n }\r\n else {\r\n // illegal => unicode replacement character\r\n codePoint = 65533 /* UNICODE_REPLACEMENT */;\r\n }\r\n }\r\n else {\r\n // last character is a surrogate pair\r\n leftoverHighSurrogate = charCode;\r\n break;\r\n }\r\n }\r\n else if (strings.isLowSurrogate(charCode)) {\r\n // illegal => unicode replacement character\r\n codePoint = 65533 /* UNICODE_REPLACEMENT */;\r\n }\r\n buffLen = this._push(buff, buffLen, codePoint);\r\n offset++;\r\n if (offset < strLen) {\r\n charCode = str.charCodeAt(offset);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n this._buffLen = buffLen;\r\n this._leftoverHighSurrogate = leftoverHighSurrogate;\r\n }\r\n _push(buff, buffLen, codePoint) {\r\n if (codePoint < 0x0080) {\r\n buff[buffLen++] = codePoint;\r\n }\r\n else if (codePoint < 0x0800) {\r\n buff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\r\n }\r\n else if (codePoint < 0x10000) {\r\n buff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\r\n }\r\n else {\r\n buff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\r\n }\r\n if (buffLen >= 64 /* BLOCK_SIZE */) {\r\n this._step();\r\n buffLen -= 64 /* BLOCK_SIZE */;\r\n this._totalLen += 64 /* BLOCK_SIZE */;\r\n // take last 3 in case of UTF8 overflow\r\n buff[0] = buff[64 /* BLOCK_SIZE */ + 0];\r\n buff[1] = buff[64 /* BLOCK_SIZE */ + 1];\r\n buff[2] = buff[64 /* BLOCK_SIZE */ + 2];\r\n }\r\n return buffLen;\r\n }\r\n digest() {\r\n if (!this._finished) {\r\n this._finished = true;\r\n if (this._leftoverHighSurrogate) {\r\n // illegal => unicode replacement character\r\n this._leftoverHighSurrogate = 0;\r\n this._buffLen = this._push(this._buff, this._buffLen, 65533 /* UNICODE_REPLACEMENT */);\r\n }\r\n this._totalLen += this._buffLen;\r\n this._wrapUp();\r\n }\r\n return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\r\n }\r\n _wrapUp() {\r\n this._buff[this._buffLen++] = 0x80;\r\n fill(this._buff, this._buffLen);\r\n if (this._buffLen > 56) {\r\n this._step();\r\n fill(this._buff);\r\n }\r\n // this will fit because the mantissa can cover up to 52 bits\r\n const ml = 8 * this._totalLen;\r\n this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\r\n this._buffDV.setUint32(60, ml % 4294967296, false);\r\n this._step();\r\n }\r\n _step() {\r\n const bigBlock32 = StringSHA1._bigBlock32;\r\n const data = this._buffDV;\r\n for (let j = 0; j < 64 /* 16*4 */; j += 4) {\r\n bigBlock32.setUint32(j, data.getUint32(j, false), false);\r\n }\r\n for (let j = 64; j < 320 /* 80*4 */; j += 4) {\r\n bigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\r\n }\r\n let a = this._h0;\r\n let b = this._h1;\r\n let c = this._h2;\r\n let d = this._h3;\r\n let e = this._h4;\r\n let f, k;\r\n let temp;\r\n for (let j = 0; j < 80; j++) {\r\n if (j < 20) {\r\n f = (b & c) | ((~b) & d);\r\n k = 0x5A827999;\r\n }\r\n else if (j < 40) {\r\n f = b ^ c ^ d;\r\n k = 0x6ED9EBA1;\r\n }\r\n else if (j < 60) {\r\n f = (b & c) | (b & d) | (c & d);\r\n k = 0x8F1BBCDC;\r\n }\r\n else {\r\n f = b ^ c ^ d;\r\n k = 0xCA62C1D6;\r\n }\r\n temp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\r\n e = d;\r\n d = c;\r\n c = leftRotate(b, 30);\r\n b = a;\r\n a = temp;\r\n }\r\n this._h0 = (this._h0 + a) & 0xffffffff;\r\n this._h1 = (this._h1 + b) & 0xffffffff;\r\n this._h2 = (this._h2 + c) & 0xffffffff;\r\n this._h3 = (this._h3 + d) & 0xffffffff;\r\n this._h4 = (this._h4 + e) & 0xffffffff;\r\n }\r\n}\r\nStringSHA1._bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { DiffChange } from './diffChange.js';\r\nimport { stringHash } from '../hash.js';\r\nexport class StringDiffSequence {\r\n constructor(source) {\r\n this.source = source;\r\n }\r\n getElements() {\r\n const source = this.source;\r\n const characters = new Int32Array(source.length);\r\n for (let i = 0, len = source.length; i < len; i++) {\r\n characters[i] = source.charCodeAt(i);\r\n }\r\n return characters;\r\n }\r\n}\r\nexport function stringDiff(original, modified, pretty) {\r\n return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty).changes;\r\n}\r\n//\r\n// The code below has been ported from a C# implementation in VS\r\n//\r\nexport class Debug {\r\n static Assert(condition, message) {\r\n if (!condition) {\r\n throw new Error(message);\r\n }\r\n }\r\n}\r\nexport class MyArray {\r\n /**\r\n * Copies a range of elements from an Array starting at the specified source index and pastes\r\n * them to another Array starting at the specified destination index. The length and the indexes\r\n * are specified as 64-bit integers.\r\n * sourceArray:\r\n *\t\tThe Array that contains the data to copy.\r\n * sourceIndex:\r\n *\t\tA 64-bit integer that represents the index in the sourceArray at which copying begins.\r\n * destinationArray:\r\n *\t\tThe Array that receives the data.\r\n * destinationIndex:\r\n *\t\tA 64-bit integer that represents the index in the destinationArray at which storing begins.\r\n * length:\r\n *\t\tA 64-bit integer that represents the number of elements to copy.\r\n */\r\n static Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {\r\n for (let i = 0; i < length; i++) {\r\n destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];\r\n }\r\n }\r\n static Copy2(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {\r\n for (let i = 0; i < length; i++) {\r\n destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];\r\n }\r\n }\r\n}\r\n/**\r\n * A utility class which helps to create the set of DiffChanges from\r\n * a difference operation. This class accepts original DiffElements and\r\n * modified DiffElements that are involved in a particular change. The\r\n * MarktNextChange() method can be called to mark the separation between\r\n * distinct changes. At the end, the Changes property can be called to retrieve\r\n * the constructed changes.\r\n */\r\nclass DiffChangeHelper {\r\n /**\r\n * Constructs a new DiffChangeHelper for the given DiffSequences.\r\n */\r\n constructor() {\r\n this.m_changes = [];\r\n this.m_originalStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n this.m_modifiedStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n this.m_originalCount = 0;\r\n this.m_modifiedCount = 0;\r\n }\r\n /**\r\n * Marks the beginning of the next change in the set of differences.\r\n */\r\n MarkNextChange() {\r\n // Only add to the list if there is something to add\r\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\r\n // Add the new change to our list\r\n this.m_changes.push(new DiffChange(this.m_originalStart, this.m_originalCount, this.m_modifiedStart, this.m_modifiedCount));\r\n }\r\n // Reset for the next change\r\n this.m_originalCount = 0;\r\n this.m_modifiedCount = 0;\r\n this.m_originalStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n this.m_modifiedStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n }\r\n /**\r\n * Adds the original element at the given position to the elements\r\n * affected by the current change. The modified index gives context\r\n * to the change position with respect to the original sequence.\r\n * @param originalIndex The index of the original element to add.\r\n * @param modifiedIndex The index of the modified element that provides corresponding position in the modified sequence.\r\n */\r\n AddOriginalElement(originalIndex, modifiedIndex) {\r\n // The 'true' start index is the smallest of the ones we've seen\r\n this.m_originalStart = Math.min(this.m_originalStart, originalIndex);\r\n this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);\r\n this.m_originalCount++;\r\n }\r\n /**\r\n * Adds the modified element at the given position to the elements\r\n * affected by the current change. The original index gives context\r\n * to the change position with respect to the modified sequence.\r\n * @param originalIndex The index of the original element that provides corresponding position in the original sequence.\r\n * @param modifiedIndex The index of the modified element to add.\r\n */\r\n AddModifiedElement(originalIndex, modifiedIndex) {\r\n // The 'true' start index is the smallest of the ones we've seen\r\n this.m_originalStart = Math.min(this.m_originalStart, originalIndex);\r\n this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);\r\n this.m_modifiedCount++;\r\n }\r\n /**\r\n * Retrieves all of the changes marked by the class.\r\n */\r\n getChanges() {\r\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\r\n // Finish up on whatever is left\r\n this.MarkNextChange();\r\n }\r\n return this.m_changes;\r\n }\r\n /**\r\n * Retrieves all of the changes marked by the class in the reverse order\r\n */\r\n getReverseChanges() {\r\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\r\n // Finish up on whatever is left\r\n this.MarkNextChange();\r\n }\r\n this.m_changes.reverse();\r\n return this.m_changes;\r\n }\r\n}\r\n/**\r\n * An implementation of the difference algorithm described in\r\n * \"An O(ND) Difference Algorithm and its variations\" by Eugene W. Myers\r\n */\r\nexport class LcsDiff {\r\n /**\r\n * Constructs the DiffFinder\r\n */\r\n constructor(originalSequence, modifiedSequence, continueProcessingPredicate = null) {\r\n this.ContinueProcessingPredicate = continueProcessingPredicate;\r\n const [originalStringElements, originalElementsOrHash, originalHasStrings] = LcsDiff._getElements(originalSequence);\r\n const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = LcsDiff._getElements(modifiedSequence);\r\n this._hasStrings = (originalHasStrings && modifiedHasStrings);\r\n this._originalStringElements = originalStringElements;\r\n this._originalElementsOrHash = originalElementsOrHash;\r\n this._modifiedStringElements = modifiedStringElements;\r\n this._modifiedElementsOrHash = modifiedElementsOrHash;\r\n this.m_forwardHistory = [];\r\n this.m_reverseHistory = [];\r\n }\r\n static _isStringArray(arr) {\r\n return (arr.length > 0 && typeof arr[0] === 'string');\r\n }\r\n static _getElements(sequence) {\r\n const elements = sequence.getElements();\r\n if (LcsDiff._isStringArray(elements)) {\r\n const hashes = new Int32Array(elements.length);\r\n for (let i = 0, len = elements.length; i < len; i++) {\r\n hashes[i] = stringHash(elements[i], 0);\r\n }\r\n return [elements, hashes, true];\r\n }\r\n if (elements instanceof Int32Array) {\r\n return [[], elements, false];\r\n }\r\n return [[], new Int32Array(elements), false];\r\n }\r\n ElementsAreEqual(originalIndex, newIndex) {\r\n if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) {\r\n return false;\r\n }\r\n return (this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true);\r\n }\r\n OriginalElementsAreEqual(index1, index2) {\r\n if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) {\r\n return false;\r\n }\r\n return (this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true);\r\n }\r\n ModifiedElementsAreEqual(index1, index2) {\r\n if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) {\r\n return false;\r\n }\r\n return (this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true);\r\n }\r\n ComputeDiff(pretty) {\r\n return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty);\r\n }\r\n /**\r\n * Computes the differences between the original and modified input\r\n * sequences on the bounded range.\r\n * @returns An array of the differences between the two input sequences.\r\n */\r\n _ComputeDiff(originalStart, originalEnd, modifiedStart, modifiedEnd, pretty) {\r\n const quitEarlyArr = [false];\r\n let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);\r\n if (pretty) {\r\n // We have to clean up the computed diff to be more intuitive\r\n // but it turns out this cannot be done correctly until the entire set\r\n // of diffs have been computed\r\n changes = this.PrettifyChanges(changes);\r\n }\r\n return {\r\n quitEarly: quitEarlyArr[0],\r\n changes: changes\r\n };\r\n }\r\n /**\r\n * Private helper method which computes the differences on the bounded range\r\n * recursively.\r\n * @returns An array of the differences between the two input sequences.\r\n */\r\n ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr) {\r\n quitEarlyArr[0] = false;\r\n // Find the start of the differences\r\n while (originalStart <= originalEnd && modifiedStart <= modifiedEnd && this.ElementsAreEqual(originalStart, modifiedStart)) {\r\n originalStart++;\r\n modifiedStart++;\r\n }\r\n // Find the end of the differences\r\n while (originalEnd >= originalStart && modifiedEnd >= modifiedStart && this.ElementsAreEqual(originalEnd, modifiedEnd)) {\r\n originalEnd--;\r\n modifiedEnd--;\r\n }\r\n // In the special case where we either have all insertions or all deletions or the sequences are identical\r\n if (originalStart > originalEnd || modifiedStart > modifiedEnd) {\r\n let changes;\r\n if (modifiedStart <= modifiedEnd) {\r\n Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd');\r\n // All insertions\r\n changes = [\r\n new DiffChange(originalStart, 0, modifiedStart, modifiedEnd - modifiedStart + 1)\r\n ];\r\n }\r\n else if (originalStart <= originalEnd) {\r\n Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd');\r\n // All deletions\r\n changes = [\r\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, 0)\r\n ];\r\n }\r\n else {\r\n Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd');\r\n Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd');\r\n // Identical sequences - No differences\r\n changes = [];\r\n }\r\n return changes;\r\n }\r\n // This problem can be solved using the Divide-And-Conquer technique.\r\n const midOriginalArr = [0];\r\n const midModifiedArr = [0];\r\n const result = this.ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr);\r\n const midOriginal = midOriginalArr[0];\r\n const midModified = midModifiedArr[0];\r\n if (result !== null) {\r\n // Result is not-null when there was enough memory to compute the changes while\r\n // searching for the recursion point\r\n return result;\r\n }\r\n else if (!quitEarlyArr[0]) {\r\n // We can break the problem down recursively by finding the changes in the\r\n // First Half: (originalStart, modifiedStart) to (midOriginal, midModified)\r\n // Second Half: (midOriginal + 1, minModified + 1) to (originalEnd, modifiedEnd)\r\n // NOTE: ComputeDiff() is inclusive, therefore the second range starts on the next point\r\n const leftChanges = this.ComputeDiffRecursive(originalStart, midOriginal, modifiedStart, midModified, quitEarlyArr);\r\n let rightChanges = [];\r\n if (!quitEarlyArr[0]) {\r\n rightChanges = this.ComputeDiffRecursive(midOriginal + 1, originalEnd, midModified + 1, modifiedEnd, quitEarlyArr);\r\n }\r\n else {\r\n // We did't have time to finish the first half, so we don't have time to compute this half.\r\n // Consider the entire rest of the sequence different.\r\n rightChanges = [\r\n new DiffChange(midOriginal + 1, originalEnd - (midOriginal + 1) + 1, midModified + 1, modifiedEnd - (midModified + 1) + 1)\r\n ];\r\n }\r\n return this.ConcatenateChanges(leftChanges, rightChanges);\r\n }\r\n // If we hit here, we quit early, and so can't return anything meaningful\r\n return [\r\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)\r\n ];\r\n }\r\n WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr) {\r\n let forwardChanges = null;\r\n let reverseChanges = null;\r\n // First, walk backward through the forward diagonals history\r\n let changeHelper = new DiffChangeHelper();\r\n let diagonalMin = diagonalForwardStart;\r\n let diagonalMax = diagonalForwardEnd;\r\n let diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalForwardOffset;\r\n let lastOriginalIndex = -1073741824 /* MIN_SAFE_SMALL_INTEGER */;\r\n let historyIndex = this.m_forwardHistory.length - 1;\r\n do {\r\n // Get the diagonal index from the relative diagonal number\r\n const diagonal = diagonalRelative + diagonalForwardBase;\r\n // Figure out where we came from\r\n if (diagonal === diagonalMin || (diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {\r\n // Vertical line (the element is an insert)\r\n originalIndex = forwardPoints[diagonal + 1];\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;\r\n if (originalIndex < lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex;\r\n changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex);\r\n diagonalRelative = (diagonal + 1) - diagonalForwardBase; //Setup for the next iteration\r\n }\r\n else {\r\n // Horizontal line (the element is a deletion)\r\n originalIndex = forwardPoints[diagonal - 1] + 1;\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;\r\n if (originalIndex < lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex - 1;\r\n changeHelper.AddOriginalElement(originalIndex, modifiedIndex + 1);\r\n diagonalRelative = (diagonal - 1) - diagonalForwardBase; //Setup for the next iteration\r\n }\r\n if (historyIndex >= 0) {\r\n forwardPoints = this.m_forwardHistory[historyIndex];\r\n diagonalForwardBase = forwardPoints[0]; //We stored this in the first spot\r\n diagonalMin = 1;\r\n diagonalMax = forwardPoints.length - 1;\r\n }\r\n } while (--historyIndex >= -1);\r\n // Ironically, we get the forward changes as the reverse of the\r\n // order we added them since we technically added them backwards\r\n forwardChanges = changeHelper.getReverseChanges();\r\n if (quitEarlyArr[0]) {\r\n // TODO: Calculate a partial from the reverse diagonals.\r\n // For now, just assume everything after the midOriginal/midModified point is a diff\r\n let originalStartPoint = midOriginalArr[0] + 1;\r\n let modifiedStartPoint = midModifiedArr[0] + 1;\r\n if (forwardChanges !== null && forwardChanges.length > 0) {\r\n const lastForwardChange = forwardChanges[forwardChanges.length - 1];\r\n originalStartPoint = Math.max(originalStartPoint, lastForwardChange.getOriginalEnd());\r\n modifiedStartPoint = Math.max(modifiedStartPoint, lastForwardChange.getModifiedEnd());\r\n }\r\n reverseChanges = [\r\n new DiffChange(originalStartPoint, originalEnd - originalStartPoint + 1, modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1)\r\n ];\r\n }\r\n else {\r\n // Now walk backward through the reverse diagonals history\r\n changeHelper = new DiffChangeHelper();\r\n diagonalMin = diagonalReverseStart;\r\n diagonalMax = diagonalReverseEnd;\r\n diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalReverseOffset;\r\n lastOriginalIndex = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n historyIndex = (deltaIsEven) ? this.m_reverseHistory.length - 1 : this.m_reverseHistory.length - 2;\r\n do {\r\n // Get the diagonal index from the relative diagonal number\r\n const diagonal = diagonalRelative + diagonalReverseBase;\r\n // Figure out where we came from\r\n if (diagonal === diagonalMin || (diagonal < diagonalMax && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) {\r\n // Horizontal line (the element is a deletion))\r\n originalIndex = reversePoints[diagonal + 1] - 1;\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;\r\n if (originalIndex > lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex + 1;\r\n changeHelper.AddOriginalElement(originalIndex + 1, modifiedIndex + 1);\r\n diagonalRelative = (diagonal + 1) - diagonalReverseBase; //Setup for the next iteration\r\n }\r\n else {\r\n // Vertical line (the element is an insertion)\r\n originalIndex = reversePoints[diagonal - 1];\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;\r\n if (originalIndex > lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex;\r\n changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex + 1);\r\n diagonalRelative = (diagonal - 1) - diagonalReverseBase; //Setup for the next iteration\r\n }\r\n if (historyIndex >= 0) {\r\n reversePoints = this.m_reverseHistory[historyIndex];\r\n diagonalReverseBase = reversePoints[0]; //We stored this in the first spot\r\n diagonalMin = 1;\r\n diagonalMax = reversePoints.length - 1;\r\n }\r\n } while (--historyIndex >= -1);\r\n // There are cases where the reverse history will find diffs that\r\n // are correct, but not intuitive, so we need shift them.\r\n reverseChanges = changeHelper.getChanges();\r\n }\r\n return this.ConcatenateChanges(forwardChanges, reverseChanges);\r\n }\r\n /**\r\n * Given the range to compute the diff on, this method finds the point:\r\n * (midOriginal, midModified)\r\n * that exists in the middle of the LCS of the two sequences and\r\n * is the point at which the LCS problem may be broken down recursively.\r\n * This method will try to keep the LCS trace in memory. If the LCS recursion\r\n * point is calculated and the full trace is available in memory, then this method\r\n * will return the change list.\r\n * @param originalStart The start bound of the original sequence range\r\n * @param originalEnd The end bound of the original sequence range\r\n * @param modifiedStart The start bound of the modified sequence range\r\n * @param modifiedEnd The end bound of the modified sequence range\r\n * @param midOriginal The middle point of the original sequence range\r\n * @param midModified The middle point of the modified sequence range\r\n * @returns The diff changes, if available, otherwise null\r\n */\r\n ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr) {\r\n let originalIndex = 0, modifiedIndex = 0;\r\n let diagonalForwardStart = 0, diagonalForwardEnd = 0;\r\n let diagonalReverseStart = 0, diagonalReverseEnd = 0;\r\n // To traverse the edit graph and produce the proper LCS, our actual\r\n // start position is just outside the given boundary\r\n originalStart--;\r\n modifiedStart--;\r\n // We set these up to make the compiler happy, but they will\r\n // be replaced before we return with the actual recursion point\r\n midOriginalArr[0] = 0;\r\n midModifiedArr[0] = 0;\r\n // Clear out the history\r\n this.m_forwardHistory = [];\r\n this.m_reverseHistory = [];\r\n // Each cell in the two arrays corresponds to a diagonal in the edit graph.\r\n // The integer value in the cell represents the originalIndex of the furthest\r\n // reaching point found so far that ends in that diagonal.\r\n // The modifiedIndex can be computed mathematically from the originalIndex and the diagonal number.\r\n const maxDifferences = (originalEnd - originalStart) + (modifiedEnd - modifiedStart);\r\n const numDiagonals = maxDifferences + 1;\r\n const forwardPoints = new Int32Array(numDiagonals);\r\n const reversePoints = new Int32Array(numDiagonals);\r\n // diagonalForwardBase: Index into forwardPoints of the diagonal which passes through (originalStart, modifiedStart)\r\n // diagonalReverseBase: Index into reversePoints of the diagonal which passes through (originalEnd, modifiedEnd)\r\n const diagonalForwardBase = (modifiedEnd - modifiedStart);\r\n const diagonalReverseBase = (originalEnd - originalStart);\r\n // diagonalForwardOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the\r\n // diagonal number (relative to diagonalForwardBase)\r\n // diagonalReverseOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the\r\n // diagonal number (relative to diagonalReverseBase)\r\n const diagonalForwardOffset = (originalStart - modifiedStart);\r\n const diagonalReverseOffset = (originalEnd - modifiedEnd);\r\n // delta: The difference between the end diagonal and the start diagonal. This is used to relate diagonal numbers\r\n // relative to the start diagonal with diagonal numbers relative to the end diagonal.\r\n // The Even/Oddn-ness of this delta is important for determining when we should check for overlap\r\n const delta = diagonalReverseBase - diagonalForwardBase;\r\n const deltaIsEven = (delta % 2 === 0);\r\n // Here we set up the start and end points as the furthest points found so far\r\n // in both the forward and reverse directions, respectively\r\n forwardPoints[diagonalForwardBase] = originalStart;\r\n reversePoints[diagonalReverseBase] = originalEnd;\r\n // Remember if we quit early, and thus need to do a best-effort result instead of a real result.\r\n quitEarlyArr[0] = false;\r\n // A couple of points:\r\n // --With this method, we iterate on the number of differences between the two sequences.\r\n // The more differences there actually are, the longer this will take.\r\n // --Also, as the number of differences increases, we have to search on diagonals further\r\n // away from the reference diagonal (which is diagonalForwardBase for forward, diagonalReverseBase for reverse).\r\n // --We extend on even diagonals (relative to the reference diagonal) only when numDifferences\r\n // is even and odd diagonals only when numDifferences is odd.\r\n for (let numDifferences = 1; numDifferences <= (maxDifferences / 2) + 1; numDifferences++) {\r\n let furthestOriginalIndex = 0;\r\n let furthestModifiedIndex = 0;\r\n // Run the algorithm in the forward direction\r\n diagonalForwardStart = this.ClipDiagonalBound(diagonalForwardBase - numDifferences, numDifferences, diagonalForwardBase, numDiagonals);\r\n diagonalForwardEnd = this.ClipDiagonalBound(diagonalForwardBase + numDifferences, numDifferences, diagonalForwardBase, numDiagonals);\r\n for (let diagonal = diagonalForwardStart; diagonal <= diagonalForwardEnd; diagonal += 2) {\r\n // STEP 1: We extend the furthest reaching point in the present diagonal\r\n // by looking at the diagonals above and below and picking the one whose point\r\n // is further away from the start point (originalStart, modifiedStart)\r\n if (diagonal === diagonalForwardStart || (diagonal < diagonalForwardEnd && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {\r\n originalIndex = forwardPoints[diagonal + 1];\r\n }\r\n else {\r\n originalIndex = forwardPoints[diagonal - 1] + 1;\r\n }\r\n modifiedIndex = originalIndex - (diagonal - diagonalForwardBase) - diagonalForwardOffset;\r\n // Save the current originalIndex so we can test for false overlap in step 3\r\n const tempOriginalIndex = originalIndex;\r\n // STEP 2: We can continue to extend the furthest reaching point in the present diagonal\r\n // so long as the elements are equal.\r\n while (originalIndex < originalEnd && modifiedIndex < modifiedEnd && this.ElementsAreEqual(originalIndex + 1, modifiedIndex + 1)) {\r\n originalIndex++;\r\n modifiedIndex++;\r\n }\r\n forwardPoints[diagonal] = originalIndex;\r\n if (originalIndex + modifiedIndex > furthestOriginalIndex + furthestModifiedIndex) {\r\n furthestOriginalIndex = originalIndex;\r\n furthestModifiedIndex = modifiedIndex;\r\n }\r\n // STEP 3: If delta is odd (overlap first happens on forward when delta is odd)\r\n // and diagonal is in the range of reverse diagonals computed for numDifferences-1\r\n // (the previous iteration; we haven't computed reverse diagonals for numDifferences yet)\r\n // then check for overlap.\r\n if (!deltaIsEven && Math.abs(diagonal - diagonalReverseBase) <= (numDifferences - 1)) {\r\n if (originalIndex >= reversePoints[diagonal]) {\r\n midOriginalArr[0] = originalIndex;\r\n midModifiedArr[0] = modifiedIndex;\r\n if (tempOriginalIndex <= reversePoints[diagonal] && 1447 /* MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* MaxDifferencesHistory */ + 1)) {\r\n // BINGO! We overlapped, and we have the full trace in memory!\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n else {\r\n // Either false overlap, or we didn't have enough memory for the full trace\r\n // Just return the recursion point\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n // Check to see if we should be quitting early, before moving on to the next iteration.\r\n const matchLengthOfLongest = ((furthestOriginalIndex - originalStart) + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2;\r\n if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) {\r\n // We can't finish, so skip ahead to generating a result from what we have.\r\n quitEarlyArr[0] = true;\r\n // Use the furthest distance we got in the forward direction.\r\n midOriginalArr[0] = furthestOriginalIndex;\r\n midModifiedArr[0] = furthestModifiedIndex;\r\n if (matchLengthOfLongest > 0 && 1447 /* MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* MaxDifferencesHistory */ + 1)) {\r\n // Enough of the history is in memory to walk it backwards\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n else {\r\n // We didn't actually remember enough of the history.\r\n //Since we are quiting the diff early, we need to shift back the originalStart and modified start\r\n //back into the boundary limits since we decremented their value above beyond the boundary limit.\r\n originalStart++;\r\n modifiedStart++;\r\n return [\r\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)\r\n ];\r\n }\r\n }\r\n // Run the algorithm in the reverse direction\r\n diagonalReverseStart = this.ClipDiagonalBound(diagonalReverseBase - numDifferences, numDifferences, diagonalReverseBase, numDiagonals);\r\n diagonalReverseEnd = this.ClipDiagonalBound(diagonalReverseBase + numDifferences, numDifferences, diagonalReverseBase, numDiagonals);\r\n for (let diagonal = diagonalReverseStart; diagonal <= diagonalReverseEnd; diagonal += 2) {\r\n // STEP 1: We extend the furthest reaching point in the present diagonal\r\n // by looking at the diagonals above and below and picking the one whose point\r\n // is further away from the start point (originalEnd, modifiedEnd)\r\n if (diagonal === diagonalReverseStart || (diagonal < diagonalReverseEnd && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) {\r\n originalIndex = reversePoints[diagonal + 1] - 1;\r\n }\r\n else {\r\n originalIndex = reversePoints[diagonal - 1];\r\n }\r\n modifiedIndex = originalIndex - (diagonal - diagonalReverseBase) - diagonalReverseOffset;\r\n // Save the current originalIndex so we can test for false overlap\r\n const tempOriginalIndex = originalIndex;\r\n // STEP 2: We can continue to extend the furthest reaching point in the present diagonal\r\n // as long as the elements are equal.\r\n while (originalIndex > originalStart && modifiedIndex > modifiedStart && this.ElementsAreEqual(originalIndex, modifiedIndex)) {\r\n originalIndex--;\r\n modifiedIndex--;\r\n }\r\n reversePoints[diagonal] = originalIndex;\r\n // STEP 4: If delta is even (overlap first happens on reverse when delta is even)\r\n // and diagonal is in the range of forward diagonals computed for numDifferences\r\n // then check for overlap.\r\n if (deltaIsEven && Math.abs(diagonal - diagonalForwardBase) <= numDifferences) {\r\n if (originalIndex <= forwardPoints[diagonal]) {\r\n midOriginalArr[0] = originalIndex;\r\n midModifiedArr[0] = modifiedIndex;\r\n if (tempOriginalIndex >= forwardPoints[diagonal] && 1447 /* MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* MaxDifferencesHistory */ + 1)) {\r\n // BINGO! We overlapped, and we have the full trace in memory!\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n else {\r\n // Either false overlap, or we didn't have enough memory for the full trace\r\n // Just return the recursion point\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n // Save current vectors to history before the next iteration\r\n if (numDifferences <= 1447 /* MaxDifferencesHistory */) {\r\n // We are allocating space for one extra int, which we fill with\r\n // the index of the diagonal base index\r\n let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2);\r\n temp[0] = diagonalForwardBase - diagonalForwardStart + 1;\r\n MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);\r\n this.m_forwardHistory.push(temp);\r\n temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2);\r\n temp[0] = diagonalReverseBase - diagonalReverseStart + 1;\r\n MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);\r\n this.m_reverseHistory.push(temp);\r\n }\r\n }\r\n // If we got here, then we have the full trace in history. We just have to convert it to a change list\r\n // NOTE: This part is a bit messy\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n /**\r\n * Shifts the given changes to provide a more intuitive diff.\r\n * While the first element in a diff matches the first element after the diff,\r\n * we shift the diff down.\r\n *\r\n * @param changes The list of changes to shift\r\n * @returns The shifted changes\r\n */\r\n PrettifyChanges(changes) {\r\n // Shift all the changes down first\r\n for (let i = 0; i < changes.length; i++) {\r\n const change = changes[i];\r\n const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this._originalElementsOrHash.length;\r\n const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length;\r\n const checkOriginal = change.originalLength > 0;\r\n const checkModified = change.modifiedLength > 0;\r\n while (change.originalStart + change.originalLength < originalStop &&\r\n change.modifiedStart + change.modifiedLength < modifiedStop &&\r\n (!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength)) &&\r\n (!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) {\r\n change.originalStart++;\r\n change.modifiedStart++;\r\n }\r\n let mergedChangeArr = [null];\r\n if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) {\r\n changes[i] = mergedChangeArr[0];\r\n changes.splice(i + 1, 1);\r\n i--;\r\n continue;\r\n }\r\n }\r\n // Shift changes back up until we hit empty or whitespace-only lines\r\n for (let i = changes.length - 1; i >= 0; i--) {\r\n const change = changes[i];\r\n let originalStop = 0;\r\n let modifiedStop = 0;\r\n if (i > 0) {\r\n const prevChange = changes[i - 1];\r\n originalStop = prevChange.originalStart + prevChange.originalLength;\r\n modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength;\r\n }\r\n const checkOriginal = change.originalLength > 0;\r\n const checkModified = change.modifiedLength > 0;\r\n let bestDelta = 0;\r\n let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength);\r\n for (let delta = 1;; delta++) {\r\n const originalStart = change.originalStart - delta;\r\n const modifiedStart = change.modifiedStart - delta;\r\n if (originalStart < originalStop || modifiedStart < modifiedStop) {\r\n break;\r\n }\r\n if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) {\r\n break;\r\n }\r\n if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) {\r\n break;\r\n }\r\n const touchingPreviousChange = (originalStart === originalStop && modifiedStart === modifiedStop);\r\n const score = ((touchingPreviousChange ? 5 : 0)\r\n + this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength));\r\n if (score > bestScore) {\r\n bestScore = score;\r\n bestDelta = delta;\r\n }\r\n }\r\n change.originalStart -= bestDelta;\r\n change.modifiedStart -= bestDelta;\r\n const mergedChangeArr = [null];\r\n if (i > 0 && this.ChangesOverlap(changes[i - 1], changes[i], mergedChangeArr)) {\r\n changes[i - 1] = mergedChangeArr[0];\r\n changes.splice(i, 1);\r\n i++;\r\n continue;\r\n }\r\n }\r\n // There could be multiple longest common substrings.\r\n // Give preference to the ones containing longer lines\r\n if (this._hasStrings) {\r\n for (let i = 1, len = changes.length; i < len; i++) {\r\n const aChange = changes[i - 1];\r\n const bChange = changes[i];\r\n const matchedLength = bChange.originalStart - aChange.originalStart - aChange.originalLength;\r\n const aOriginalStart = aChange.originalStart;\r\n const bOriginalEnd = bChange.originalStart + bChange.originalLength;\r\n const abOriginalLength = bOriginalEnd - aOriginalStart;\r\n const aModifiedStart = aChange.modifiedStart;\r\n const bModifiedEnd = bChange.modifiedStart + bChange.modifiedLength;\r\n const abModifiedLength = bModifiedEnd - aModifiedStart;\r\n // Avoid wasting a lot of time with these searches\r\n if (matchedLength < 5 && abOriginalLength < 20 && abModifiedLength < 20) {\r\n const t = this._findBetterContiguousSequence(aOriginalStart, abOriginalLength, aModifiedStart, abModifiedLength, matchedLength);\r\n if (t) {\r\n const [originalMatchStart, modifiedMatchStart] = t;\r\n if (originalMatchStart !== aChange.originalStart + aChange.originalLength || modifiedMatchStart !== aChange.modifiedStart + aChange.modifiedLength) {\r\n // switch to another sequence that has a better score\r\n aChange.originalLength = originalMatchStart - aChange.originalStart;\r\n aChange.modifiedLength = modifiedMatchStart - aChange.modifiedStart;\r\n bChange.originalStart = originalMatchStart + matchedLength;\r\n bChange.modifiedStart = modifiedMatchStart + matchedLength;\r\n bChange.originalLength = bOriginalEnd - bChange.originalStart;\r\n bChange.modifiedLength = bModifiedEnd - bChange.modifiedStart;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return changes;\r\n }\r\n _findBetterContiguousSequence(originalStart, originalLength, modifiedStart, modifiedLength, desiredLength) {\r\n if (originalLength < desiredLength || modifiedLength < desiredLength) {\r\n return null;\r\n }\r\n const originalMax = originalStart + originalLength - desiredLength + 1;\r\n const modifiedMax = modifiedStart + modifiedLength - desiredLength + 1;\r\n let bestScore = 0;\r\n let bestOriginalStart = 0;\r\n let bestModifiedStart = 0;\r\n for (let i = originalStart; i < originalMax; i++) {\r\n for (let j = modifiedStart; j < modifiedMax; j++) {\r\n const score = this._contiguousSequenceScore(i, j, desiredLength);\r\n if (score > 0 && score > bestScore) {\r\n bestScore = score;\r\n bestOriginalStart = i;\r\n bestModifiedStart = j;\r\n }\r\n }\r\n }\r\n if (bestScore > 0) {\r\n return [bestOriginalStart, bestModifiedStart];\r\n }\r\n return null;\r\n }\r\n _contiguousSequenceScore(originalStart, modifiedStart, length) {\r\n let score = 0;\r\n for (let l = 0; l < length; l++) {\r\n if (!this.ElementsAreEqual(originalStart + l, modifiedStart + l)) {\r\n return 0;\r\n }\r\n score += this._originalStringElements[originalStart + l].length;\r\n }\r\n return score;\r\n }\r\n _OriginalIsBoundary(index) {\r\n if (index <= 0 || index >= this._originalElementsOrHash.length - 1) {\r\n return true;\r\n }\r\n return (this._hasStrings && /^\\s*$/.test(this._originalStringElements[index]));\r\n }\r\n _OriginalRegionIsBoundary(originalStart, originalLength) {\r\n if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) {\r\n return true;\r\n }\r\n if (originalLength > 0) {\r\n const originalEnd = originalStart + originalLength;\r\n if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n _ModifiedIsBoundary(index) {\r\n if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) {\r\n return true;\r\n }\r\n return (this._hasStrings && /^\\s*$/.test(this._modifiedStringElements[index]));\r\n }\r\n _ModifiedRegionIsBoundary(modifiedStart, modifiedLength) {\r\n if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) {\r\n return true;\r\n }\r\n if (modifiedLength > 0) {\r\n const modifiedEnd = modifiedStart + modifiedLength;\r\n if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n _boundaryScore(originalStart, originalLength, modifiedStart, modifiedLength) {\r\n const originalScore = (this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0);\r\n const modifiedScore = (this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0);\r\n return (originalScore + modifiedScore);\r\n }\r\n /**\r\n * Concatenates the two input DiffChange lists and returns the resulting\r\n * list.\r\n * @param The left changes\r\n * @param The right changes\r\n * @returns The concatenated list\r\n */\r\n ConcatenateChanges(left, right) {\r\n let mergedChangeArr = [];\r\n if (left.length === 0 || right.length === 0) {\r\n return (right.length > 0) ? right : left;\r\n }\r\n else if (this.ChangesOverlap(left[left.length - 1], right[0], mergedChangeArr)) {\r\n // Since we break the problem down recursively, it is possible that we\r\n // might recurse in the middle of a change thereby splitting it into\r\n // two changes. Here in the combining stage, we detect and fuse those\r\n // changes back together\r\n const result = new Array(left.length + right.length - 1);\r\n MyArray.Copy(left, 0, result, 0, left.length - 1);\r\n result[left.length - 1] = mergedChangeArr[0];\r\n MyArray.Copy(right, 1, result, left.length, right.length - 1);\r\n return result;\r\n }\r\n else {\r\n const result = new Array(left.length + right.length);\r\n MyArray.Copy(left, 0, result, 0, left.length);\r\n MyArray.Copy(right, 0, result, left.length, right.length);\r\n return result;\r\n }\r\n }\r\n /**\r\n * Returns true if the two changes overlap and can be merged into a single\r\n * change\r\n * @param left The left change\r\n * @param right The right change\r\n * @param mergedChange The merged change if the two overlap, null otherwise\r\n * @returns True if the two changes overlap\r\n */\r\n ChangesOverlap(left, right, mergedChangeArr) {\r\n Debug.Assert(left.originalStart <= right.originalStart, 'Left change is not less than or equal to right change');\r\n Debug.Assert(left.modifiedStart <= right.modifiedStart, 'Left change is not less than or equal to right change');\r\n if (left.originalStart + left.originalLength >= right.originalStart || left.modifiedStart + left.modifiedLength >= right.modifiedStart) {\r\n const originalStart = left.originalStart;\r\n let originalLength = left.originalLength;\r\n const modifiedStart = left.modifiedStart;\r\n let modifiedLength = left.modifiedLength;\r\n if (left.originalStart + left.originalLength >= right.originalStart) {\r\n originalLength = right.originalStart + right.originalLength - left.originalStart;\r\n }\r\n if (left.modifiedStart + left.modifiedLength >= right.modifiedStart) {\r\n modifiedLength = right.modifiedStart + right.modifiedLength - left.modifiedStart;\r\n }\r\n mergedChangeArr[0] = new DiffChange(originalStart, originalLength, modifiedStart, modifiedLength);\r\n return true;\r\n }\r\n else {\r\n mergedChangeArr[0] = null;\r\n return false;\r\n }\r\n }\r\n /**\r\n * Helper method used to clip a diagonal index to the range of valid\r\n * diagonals. This also decides whether or not the diagonal index,\r\n * if it exceeds the boundary, should be clipped to the boundary or clipped\r\n * one inside the boundary depending on the Even/Odd status of the boundary\r\n * and numDifferences.\r\n * @param diagonal The index of the diagonal to clip.\r\n * @param numDifferences The current number of differences being iterated upon.\r\n * @param diagonalBaseIndex The base reference diagonal.\r\n * @param numDiagonals The total number of diagonals.\r\n * @returns The clipped diagonal index.\r\n */\r\n ClipDiagonalBound(diagonal, numDifferences, diagonalBaseIndex, numDiagonals) {\r\n if (diagonal >= 0 && diagonal < numDiagonals) {\r\n // Nothing to clip, its in range\r\n return diagonal;\r\n }\r\n // diagonalsBelow: The number of diagonals below the reference diagonal\r\n // diagonalsAbove: The number of diagonals above the reference diagonal\r\n const diagonalsBelow = diagonalBaseIndex;\r\n const diagonalsAbove = numDiagonals - diagonalBaseIndex - 1;\r\n const diffEven = (numDifferences % 2 === 0);\r\n if (diagonal < 0) {\r\n const lowerBoundEven = (diagonalsBelow % 2 === 0);\r\n return (diffEven === lowerBoundEven) ? 0 : 1;\r\n }\r\n else {\r\n const upperBoundEven = (diagonalsAbove % 2 === 0);\r\n return (diffEven === upperBoundEven) ? numDiagonals - 1 : numDiagonals - 2;\r\n }\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n// NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace\r\n// Copied from: https://github.com/nodejs/node/blob/v12.8.1/lib/path.js\r\n/**\r\n * Copyright Joyent, Inc. and other Node contributors.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the\r\n * \"Software\"), to deal in the Software without restriction, including\r\n * without limitation the rights to use, copy, modify, merge, publish,\r\n * distribute, sublicense, and/or sell copies of the Software, and to permit\r\n * persons to whom the Software is furnished to do so, subject to the\r\n * following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included\r\n * in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\r\n * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\r\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\r\n * USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nimport * as process from './process.js';\r\nconst CHAR_UPPERCASE_A = 65; /* A */\r\nconst CHAR_LOWERCASE_A = 97; /* a */\r\nconst CHAR_UPPERCASE_Z = 90; /* Z */\r\nconst CHAR_LOWERCASE_Z = 122; /* z */\r\nconst CHAR_DOT = 46; /* . */\r\nconst CHAR_FORWARD_SLASH = 47; /* / */\r\nconst CHAR_BACKWARD_SLASH = 92; /* \\ */\r\nconst CHAR_COLON = 58; /* : */\r\nconst CHAR_QUESTION_MARK = 63; /* ? */\r\nclass ErrorInvalidArgType extends Error {\r\n constructor(name, expected, actual) {\r\n // determiner: 'must be' or 'must not be'\r\n let determiner;\r\n if (typeof expected === 'string' && expected.indexOf('not ') === 0) {\r\n determiner = 'must not be';\r\n expected = expected.replace(/^not /, '');\r\n }\r\n else {\r\n determiner = 'must be';\r\n }\r\n const type = name.indexOf('.') !== -1 ? 'property' : 'argument';\r\n let msg = `The \"${name}\" ${type} ${determiner} of type ${expected}`;\r\n msg += `. Received type ${typeof actual}`;\r\n super(msg);\r\n this.code = 'ERR_INVALID_ARG_TYPE';\r\n }\r\n}\r\nfunction validateString(value, name) {\r\n if (typeof value !== 'string') {\r\n throw new ErrorInvalidArgType(name, 'string', value);\r\n }\r\n}\r\nfunction isPathSeparator(code) {\r\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\r\n}\r\nfunction isPosixPathSeparator(code) {\r\n return code === CHAR_FORWARD_SLASH;\r\n}\r\nfunction isWindowsDeviceRoot(code) {\r\n return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z ||\r\n code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;\r\n}\r\n// Resolves . and .. elements in a path with directory names\r\nfunction normalizeString(path, allowAboveRoot, separator, isPathSeparator) {\r\n let res = '';\r\n let lastSegmentLength = 0;\r\n let lastSlash = -1;\r\n let dots = 0;\r\n let code = 0;\r\n for (let i = 0; i <= path.length; ++i) {\r\n if (i < path.length) {\r\n code = path.charCodeAt(i);\r\n }\r\n else if (isPathSeparator(code)) {\r\n break;\r\n }\r\n else {\r\n code = CHAR_FORWARD_SLASH;\r\n }\r\n if (isPathSeparator(code)) {\r\n if (lastSlash === i - 1 || dots === 1) {\r\n // NOOP\r\n }\r\n else if (dots === 2) {\r\n if (res.length < 2 || lastSegmentLength !== 2 ||\r\n res.charCodeAt(res.length - 1) !== CHAR_DOT ||\r\n res.charCodeAt(res.length - 2) !== CHAR_DOT) {\r\n if (res.length > 2) {\r\n const lastSlashIndex = res.lastIndexOf(separator);\r\n if (lastSlashIndex === -1) {\r\n res = '';\r\n lastSegmentLength = 0;\r\n }\r\n else {\r\n res = res.slice(0, lastSlashIndex);\r\n lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);\r\n }\r\n lastSlash = i;\r\n dots = 0;\r\n continue;\r\n }\r\n else if (res.length !== 0) {\r\n res = '';\r\n lastSegmentLength = 0;\r\n lastSlash = i;\r\n dots = 0;\r\n continue;\r\n }\r\n }\r\n if (allowAboveRoot) {\r\n res += res.length > 0 ? `${separator}..` : '..';\r\n lastSegmentLength = 2;\r\n }\r\n }\r\n else {\r\n if (res.length > 0) {\r\n res += `${separator}${path.slice(lastSlash + 1, i)}`;\r\n }\r\n else {\r\n res = path.slice(lastSlash + 1, i);\r\n }\r\n lastSegmentLength = i - lastSlash - 1;\r\n }\r\n lastSlash = i;\r\n dots = 0;\r\n }\r\n else if (code === CHAR_DOT && dots !== -1) {\r\n ++dots;\r\n }\r\n else {\r\n dots = -1;\r\n }\r\n }\r\n return res;\r\n}\r\nfunction _format(sep, pathObject) {\r\n if (pathObject === null || typeof pathObject !== 'object') {\r\n throw new ErrorInvalidArgType('pathObject', 'Object', pathObject);\r\n }\r\n const dir = pathObject.dir || pathObject.root;\r\n const base = pathObject.base ||\r\n `${pathObject.name || ''}${pathObject.ext || ''}`;\r\n if (!dir) {\r\n return base;\r\n }\r\n return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep}${base}`;\r\n}\r\nexport const win32 = {\r\n // path.resolve([from ...], to)\r\n resolve(...pathSegments) {\r\n let resolvedDevice = '';\r\n let resolvedTail = '';\r\n let resolvedAbsolute = false;\r\n for (let i = pathSegments.length - 1; i >= -1; i--) {\r\n let path;\r\n if (i >= 0) {\r\n path = pathSegments[i];\r\n validateString(path, 'path');\r\n // Skip empty entries\r\n if (path.length === 0) {\r\n continue;\r\n }\r\n }\r\n else if (resolvedDevice.length === 0) {\r\n path = process.cwd();\r\n }\r\n else {\r\n // Windows has the concept of drive-specific current working\r\n // directories. If we've resolved a drive letter but not yet an\r\n // absolute path, get cwd for that drive, or the process cwd if\r\n // the drive cwd is not available. We're sure the device is not\r\n // a UNC path at this points, because UNC paths are always absolute.\r\n path = process.env[`=${resolvedDevice}`] || process.cwd();\r\n // Verify that a cwd was found and that it actually points\r\n // to our drive. If not, default to the drive's root.\r\n if (path === undefined ||\r\n path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() &&\r\n path.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\r\n path = `${resolvedDevice}\\\\`;\r\n }\r\n }\r\n const len = path.length;\r\n let rootEnd = 0;\r\n let device = '';\r\n let isAbsolute = false;\r\n const code = path.charCodeAt(0);\r\n // Try to match a root\r\n if (len === 1) {\r\n if (isPathSeparator(code)) {\r\n // `path` contains just a path separator\r\n rootEnd = 1;\r\n isAbsolute = true;\r\n }\r\n }\r\n else if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n // If we started with a separator, we know we at least have an\r\n // absolute path of some kind (UNC or otherwise)\r\n isAbsolute = true;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n const firstPart = path.slice(last, j);\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len || j !== last) {\r\n // We matched a UNC root\r\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\r\n rootEnd = j;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n rootEnd = 1;\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(code) &&\r\n path.charCodeAt(1) === CHAR_COLON) {\r\n // Possible device root\r\n device = path.slice(0, 2);\r\n rootEnd = 2;\r\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\r\n // Treat separator following drive name as an absolute path\r\n // indicator\r\n isAbsolute = true;\r\n rootEnd = 3;\r\n }\r\n }\r\n if (device.length > 0) {\r\n if (resolvedDevice.length > 0) {\r\n if (device.toLowerCase() !== resolvedDevice.toLowerCase()) {\r\n // This path points to another device so it is not applicable\r\n continue;\r\n }\r\n }\r\n else {\r\n resolvedDevice = device;\r\n }\r\n }\r\n if (resolvedAbsolute) {\r\n if (resolvedDevice.length > 0) {\r\n break;\r\n }\r\n }\r\n else {\r\n resolvedTail = `${path.slice(rootEnd)}\\\\${resolvedTail}`;\r\n resolvedAbsolute = isAbsolute;\r\n if (isAbsolute && resolvedDevice.length > 0) {\r\n break;\r\n }\r\n }\r\n }\r\n // At this point the path should be resolved to a full absolute path,\r\n // but handle relative paths to be safe (might happen when process.cwd()\r\n // fails)\r\n // Normalize the tail path\r\n resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\\\', isPathSeparator);\r\n return resolvedAbsolute ?\r\n `${resolvedDevice}\\\\${resolvedTail}` :\r\n `${resolvedDevice}${resolvedTail}` || '.';\r\n },\r\n normalize(path) {\r\n validateString(path, 'path');\r\n const len = path.length;\r\n if (len === 0) {\r\n return '.';\r\n }\r\n let rootEnd = 0;\r\n let device;\r\n let isAbsolute = false;\r\n const code = path.charCodeAt(0);\r\n // Try to match a root\r\n if (len === 1) {\r\n // `path` contains just a single char, exit early to avoid\r\n // unnecessary work\r\n return isPosixPathSeparator(code) ? '\\\\' : path;\r\n }\r\n if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n // If we started with a separator, we know we at least have an absolute\r\n // path of some kind (UNC or otherwise)\r\n isAbsolute = true;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n const firstPart = path.slice(last, j);\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len) {\r\n // We matched a UNC root only\r\n // Return the normalized version of the UNC root since there\r\n // is nothing left to process\r\n return `\\\\\\\\${firstPart}\\\\${path.slice(last)}\\\\`;\r\n }\r\n if (j !== last) {\r\n // We matched a UNC root with leftovers\r\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\r\n rootEnd = j;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n rootEnd = 1;\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\r\n // Possible device root\r\n device = path.slice(0, 2);\r\n rootEnd = 2;\r\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\r\n // Treat separator following drive name as an absolute path\r\n // indicator\r\n isAbsolute = true;\r\n rootEnd = 3;\r\n }\r\n }\r\n let tail = rootEnd < len ?\r\n normalizeString(path.slice(rootEnd), !isAbsolute, '\\\\', isPathSeparator) :\r\n '';\r\n if (tail.length === 0 && !isAbsolute) {\r\n tail = '.';\r\n }\r\n if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {\r\n tail += '\\\\';\r\n }\r\n if (device === undefined) {\r\n return isAbsolute ? `\\\\${tail}` : tail;\r\n }\r\n return isAbsolute ? `${device}\\\\${tail}` : `${device}${tail}`;\r\n },\r\n isAbsolute(path) {\r\n validateString(path, 'path');\r\n const len = path.length;\r\n if (len === 0) {\r\n return false;\r\n }\r\n const code = path.charCodeAt(0);\r\n return isPathSeparator(code) ||\r\n // Possible device root\r\n len > 2 &&\r\n isWindowsDeviceRoot(code) &&\r\n path.charCodeAt(1) === CHAR_COLON &&\r\n isPathSeparator(path.charCodeAt(2));\r\n },\r\n join(...paths) {\r\n if (paths.length === 0) {\r\n return '.';\r\n }\r\n let joined;\r\n let firstPart;\r\n for (let i = 0; i < paths.length; ++i) {\r\n const arg = paths[i];\r\n validateString(arg, 'path');\r\n if (arg.length > 0) {\r\n if (joined === undefined) {\r\n joined = firstPart = arg;\r\n }\r\n else {\r\n joined += `\\\\${arg}`;\r\n }\r\n }\r\n }\r\n if (joined === undefined) {\r\n return '.';\r\n }\r\n // Make sure that the joined path doesn't start with two slashes, because\r\n // normalize() will mistake it for an UNC path then.\r\n //\r\n // This step is skipped when it is very clear that the user actually\r\n // intended to point at an UNC path. This is assumed when the first\r\n // non-empty string arguments starts with exactly two slashes followed by\r\n // at least one more non-slash character.\r\n //\r\n // Note that for normalize() to treat a path as an UNC path it needs to\r\n // have at least 2 components, so we don't filter for that here.\r\n // This means that the user can use join to construct UNC paths from\r\n // a server name and a share name; for example:\r\n // path.join('//server', 'share') -> '\\\\\\\\server\\\\share\\\\')\r\n let needsReplace = true;\r\n let slashCount = 0;\r\n if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {\r\n ++slashCount;\r\n const firstLen = firstPart.length;\r\n if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {\r\n ++slashCount;\r\n if (firstLen > 2) {\r\n if (isPathSeparator(firstPart.charCodeAt(2))) {\r\n ++slashCount;\r\n }\r\n else {\r\n // We matched a UNC path in the first part\r\n needsReplace = false;\r\n }\r\n }\r\n }\r\n }\r\n if (needsReplace) {\r\n // Find any more consecutive slashes we need to replace\r\n while (slashCount < joined.length &&\r\n isPathSeparator(joined.charCodeAt(slashCount))) {\r\n slashCount++;\r\n }\r\n // Replace the slashes if needed\r\n if (slashCount >= 2) {\r\n joined = `\\\\${joined.slice(slashCount)}`;\r\n }\r\n }\r\n return win32.normalize(joined);\r\n },\r\n // It will solve the relative path from `from` to `to`, for instance:\r\n // from = 'C:\\\\orandea\\\\test\\\\aaa'\r\n // to = 'C:\\\\orandea\\\\impl\\\\bbb'\r\n // The output of the function should be: '..\\\\..\\\\impl\\\\bbb'\r\n relative(from, to) {\r\n validateString(from, 'from');\r\n validateString(to, 'to');\r\n if (from === to) {\r\n return '';\r\n }\r\n const fromOrig = win32.resolve(from);\r\n const toOrig = win32.resolve(to);\r\n if (fromOrig === toOrig) {\r\n return '';\r\n }\r\n from = fromOrig.toLowerCase();\r\n to = toOrig.toLowerCase();\r\n if (from === to) {\r\n return '';\r\n }\r\n // Trim any leading backslashes\r\n let fromStart = 0;\r\n while (fromStart < from.length &&\r\n from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {\r\n fromStart++;\r\n }\r\n // Trim trailing backslashes (applicable to UNC paths only)\r\n let fromEnd = from.length;\r\n while (fromEnd - 1 > fromStart &&\r\n from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {\r\n fromEnd--;\r\n }\r\n const fromLen = fromEnd - fromStart;\r\n // Trim any leading backslashes\r\n let toStart = 0;\r\n while (toStart < to.length &&\r\n to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\r\n toStart++;\r\n }\r\n // Trim trailing backslashes (applicable to UNC paths only)\r\n let toEnd = to.length;\r\n while (toEnd - 1 > toStart &&\r\n to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {\r\n toEnd--;\r\n }\r\n const toLen = toEnd - toStart;\r\n // Compare paths to find the longest common path from root\r\n const length = fromLen < toLen ? fromLen : toLen;\r\n let lastCommonSep = -1;\r\n let i = 0;\r\n for (; i < length; i++) {\r\n const fromCode = from.charCodeAt(fromStart + i);\r\n if (fromCode !== to.charCodeAt(toStart + i)) {\r\n break;\r\n }\r\n else if (fromCode === CHAR_BACKWARD_SLASH) {\r\n lastCommonSep = i;\r\n }\r\n }\r\n // We found a mismatch before the first common path separator was seen, so\r\n // return the original `to`.\r\n if (i !== length) {\r\n if (lastCommonSep === -1) {\r\n return toOrig;\r\n }\r\n }\r\n else {\r\n if (toLen > length) {\r\n if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {\r\n // We get here if `from` is the exact base path for `to`.\r\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo\\\\bar\\\\baz'\r\n return toOrig.slice(toStart + i + 1);\r\n }\r\n if (i === 2) {\r\n // We get here if `from` is the device root.\r\n // For example: from='C:\\\\'; to='C:\\\\foo'\r\n return toOrig.slice(toStart + i);\r\n }\r\n }\r\n if (fromLen > length) {\r\n if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {\r\n // We get here if `to` is the exact base path for `from`.\r\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo'\r\n lastCommonSep = i;\r\n }\r\n else if (i === 2) {\r\n // We get here if `to` is the device root.\r\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\'\r\n lastCommonSep = 3;\r\n }\r\n }\r\n if (lastCommonSep === -1) {\r\n lastCommonSep = 0;\r\n }\r\n }\r\n let out = '';\r\n // Generate the relative path based on the path difference between `to` and\r\n // `from`\r\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\r\n if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {\r\n out += out.length === 0 ? '..' : '\\\\..';\r\n }\r\n }\r\n toStart += lastCommonSep;\r\n // Lastly, append the rest of the destination (`to`) path that comes after\r\n // the common path parts\r\n if (out.length > 0) {\r\n return `${out}${toOrig.slice(toStart, toEnd)}`;\r\n }\r\n if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\r\n ++toStart;\r\n }\r\n return toOrig.slice(toStart, toEnd);\r\n },\r\n toNamespacedPath(path) {\r\n // Note: this will *probably* throw somewhere.\r\n if (typeof path !== 'string') {\r\n return path;\r\n }\r\n if (path.length === 0) {\r\n return '';\r\n }\r\n const resolvedPath = win32.resolve(path);\r\n if (resolvedPath.length <= 2) {\r\n return path;\r\n }\r\n if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {\r\n // Possible UNC root\r\n if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {\r\n const code = resolvedPath.charCodeAt(2);\r\n if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {\r\n // Matched non-long UNC root, convert the path to a long UNC path\r\n return `\\\\\\\\?\\\\UNC\\\\${resolvedPath.slice(2)}`;\r\n }\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) &&\r\n resolvedPath.charCodeAt(1) === CHAR_COLON &&\r\n resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\r\n // Matched device root, convert the path to a long UNC path\r\n return `\\\\\\\\?\\\\${resolvedPath}`;\r\n }\r\n return path;\r\n },\r\n dirname(path) {\r\n validateString(path, 'path');\r\n const len = path.length;\r\n if (len === 0) {\r\n return '.';\r\n }\r\n let rootEnd = -1;\r\n let offset = 0;\r\n const code = path.charCodeAt(0);\r\n if (len === 1) {\r\n // `path` contains just a path separator, exit early to avoid\r\n // unnecessary work or a dot.\r\n return isPathSeparator(code) ? path : '.';\r\n }\r\n // Try to match a root\r\n if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n rootEnd = offset = 1;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len) {\r\n // We matched a UNC root only\r\n return path;\r\n }\r\n if (j !== last) {\r\n // We matched a UNC root with leftovers\r\n // Offset by 1 to include the separator after the UNC root to\r\n // treat it as a \"normal root\" on top of a (UNC) root\r\n rootEnd = offset = j + 1;\r\n }\r\n }\r\n }\r\n }\r\n // Possible device root\r\n }\r\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\r\n rootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2;\r\n offset = rootEnd;\r\n }\r\n let end = -1;\r\n let matchedSlash = true;\r\n for (let i = len - 1; i >= offset; --i) {\r\n if (isPathSeparator(path.charCodeAt(i))) {\r\n if (!matchedSlash) {\r\n end = i;\r\n break;\r\n }\r\n }\r\n else {\r\n // We saw the first non-path separator\r\n matchedSlash = false;\r\n }\r\n }\r\n if (end === -1) {\r\n if (rootEnd === -1) {\r\n return '.';\r\n }\r\n end = rootEnd;\r\n }\r\n return path.slice(0, end);\r\n },\r\n basename(path, ext) {\r\n if (ext !== undefined) {\r\n validateString(ext, 'ext');\r\n }\r\n validateString(path, 'path');\r\n let start = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i;\r\n // Check for a drive letter prefix so as not to mistake the following\r\n // path separator as an extra separator at the end of the path that can be\r\n // disregarded\r\n if (path.length >= 2 &&\r\n isWindowsDeviceRoot(path.charCodeAt(0)) &&\r\n path.charCodeAt(1) === CHAR_COLON) {\r\n start = 2;\r\n }\r\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\r\n if (ext === path) {\r\n return '';\r\n }\r\n let extIdx = ext.length - 1;\r\n let firstNonSlashEnd = -1;\r\n for (i = path.length - 1; i >= start; --i) {\r\n const code = path.charCodeAt(i);\r\n if (isPathSeparator(code)) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else {\r\n if (firstNonSlashEnd === -1) {\r\n // We saw the first non-path separator, remember this index in case\r\n // we need it if the extension ends up not matching\r\n matchedSlash = false;\r\n firstNonSlashEnd = i + 1;\r\n }\r\n if (extIdx >= 0) {\r\n // Try to match the explicit extension\r\n if (code === ext.charCodeAt(extIdx)) {\r\n if (--extIdx === -1) {\r\n // We matched the extension, so mark this as the end of our path\r\n // component\r\n end = i;\r\n }\r\n }\r\n else {\r\n // Extension does not match, so our result is the entire path\r\n // component\r\n extIdx = -1;\r\n end = firstNonSlashEnd;\r\n }\r\n }\r\n }\r\n }\r\n if (start === end) {\r\n end = firstNonSlashEnd;\r\n }\r\n else if (end === -1) {\r\n end = path.length;\r\n }\r\n return path.slice(start, end);\r\n }\r\n for (i = path.length - 1; i >= start; --i) {\r\n if (isPathSeparator(path.charCodeAt(i))) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // path component\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n }\r\n if (end === -1) {\r\n return '';\r\n }\r\n return path.slice(start, end);\r\n },\r\n extname(path) {\r\n validateString(path, 'path');\r\n let start = 0;\r\n let startDot = -1;\r\n let startPart = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n // Check for a drive letter prefix so as not to mistake the following\r\n // path separator as an extra separator at the end of the path that can be\r\n // disregarded\r\n if (path.length >= 2 &&\r\n path.charCodeAt(1) === CHAR_COLON &&\r\n isWindowsDeviceRoot(path.charCodeAt(0))) {\r\n start = startPart = 2;\r\n }\r\n for (let i = path.length - 1; i >= start; --i) {\r\n const code = path.charCodeAt(i);\r\n if (isPathSeparator(code)) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (startDot === -1 ||\r\n end === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n return '';\r\n }\r\n return path.slice(startDot, end);\r\n },\r\n format: _format.bind(null, '\\\\'),\r\n parse(path) {\r\n validateString(path, 'path');\r\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\r\n if (path.length === 0) {\r\n return ret;\r\n }\r\n const len = path.length;\r\n let rootEnd = 0;\r\n let code = path.charCodeAt(0);\r\n if (len === 1) {\r\n if (isPathSeparator(code)) {\r\n // `path` contains just a path separator, exit early to avoid\r\n // unnecessary work\r\n ret.root = ret.dir = path;\r\n return ret;\r\n }\r\n ret.base = ret.name = path;\r\n return ret;\r\n }\r\n // Try to match a root\r\n if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n rootEnd = 1;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len) {\r\n // We matched a UNC root only\r\n rootEnd = j;\r\n }\r\n else if (j !== last) {\r\n // We matched a UNC root with leftovers\r\n rootEnd = j + 1;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\r\n // Possible device root\r\n if (len <= 2) {\r\n // `path` contains just a drive root, exit early to avoid\r\n // unnecessary work\r\n ret.root = ret.dir = path;\r\n return ret;\r\n }\r\n rootEnd = 2;\r\n if (isPathSeparator(path.charCodeAt(2))) {\r\n if (len === 3) {\r\n // `path` contains just a drive root, exit early to avoid\r\n // unnecessary work\r\n ret.root = ret.dir = path;\r\n return ret;\r\n }\r\n rootEnd = 3;\r\n }\r\n }\r\n if (rootEnd > 0) {\r\n ret.root = path.slice(0, rootEnd);\r\n }\r\n let startDot = -1;\r\n let startPart = rootEnd;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i = path.length - 1;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n // Get non-dir info\r\n for (; i >= rootEnd; --i) {\r\n code = path.charCodeAt(i);\r\n if (isPathSeparator(code)) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (end !== -1) {\r\n if (startDot === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n ret.base = ret.name = path.slice(startPart, end);\r\n }\r\n else {\r\n ret.name = path.slice(startPart, startDot);\r\n ret.base = path.slice(startPart, end);\r\n ret.ext = path.slice(startDot, end);\r\n }\r\n }\r\n // If the directory is the root, use the entire root as the `dir` including\r\n // the trailing slash if any (`C:\\abc` -> `C:\\`). Otherwise, strip out the\r\n // trailing slash (`C:\\abc\\def` -> `C:\\abc`).\r\n if (startPart > 0 && startPart !== rootEnd) {\r\n ret.dir = path.slice(0, startPart - 1);\r\n }\r\n else {\r\n ret.dir = ret.root;\r\n }\r\n return ret;\r\n },\r\n sep: '\\\\',\r\n delimiter: ';',\r\n win32: null,\r\n posix: null\r\n};\r\nexport const posix = {\r\n // path.resolve([from ...], to)\r\n resolve(...pathSegments) {\r\n let resolvedPath = '';\r\n let resolvedAbsolute = false;\r\n for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\r\n const path = i >= 0 ? pathSegments[i] : process.cwd();\r\n validateString(path, 'path');\r\n // Skip empty entries\r\n if (path.length === 0) {\r\n continue;\r\n }\r\n resolvedPath = `${path}/${resolvedPath}`;\r\n resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n }\r\n // At this point the path should be resolved to a full absolute path, but\r\n // handle relative paths to be safe (might happen when process.cwd() fails)\r\n // Normalize the path\r\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/', isPosixPathSeparator);\r\n if (resolvedAbsolute) {\r\n return `/${resolvedPath}`;\r\n }\r\n return resolvedPath.length > 0 ? resolvedPath : '.';\r\n },\r\n normalize(path) {\r\n validateString(path, 'path');\r\n if (path.length === 0) {\r\n return '.';\r\n }\r\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;\r\n // Normalize the path\r\n path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);\r\n if (path.length === 0) {\r\n if (isAbsolute) {\r\n return '/';\r\n }\r\n return trailingSeparator ? './' : '.';\r\n }\r\n if (trailingSeparator) {\r\n path += '/';\r\n }\r\n return isAbsolute ? `/${path}` : path;\r\n },\r\n isAbsolute(path) {\r\n validateString(path, 'path');\r\n return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n },\r\n join(...paths) {\r\n if (paths.length === 0) {\r\n return '.';\r\n }\r\n let joined;\r\n for (let i = 0; i < paths.length; ++i) {\r\n const arg = paths[i];\r\n validateString(arg, 'path');\r\n if (arg.length > 0) {\r\n if (joined === undefined) {\r\n joined = arg;\r\n }\r\n else {\r\n joined += `/${arg}`;\r\n }\r\n }\r\n }\r\n if (joined === undefined) {\r\n return '.';\r\n }\r\n return posix.normalize(joined);\r\n },\r\n relative(from, to) {\r\n validateString(from, 'from');\r\n validateString(to, 'to');\r\n if (from === to) {\r\n return '';\r\n }\r\n // Trim leading forward slashes.\r\n from = posix.resolve(from);\r\n to = posix.resolve(to);\r\n if (from === to) {\r\n return '';\r\n }\r\n const fromStart = 1;\r\n const fromEnd = from.length;\r\n const fromLen = fromEnd - fromStart;\r\n const toStart = 1;\r\n const toLen = to.length - toStart;\r\n // Compare paths to find the longest common path from root\r\n const length = (fromLen < toLen ? fromLen : toLen);\r\n let lastCommonSep = -1;\r\n let i = 0;\r\n for (; i < length; i++) {\r\n const fromCode = from.charCodeAt(fromStart + i);\r\n if (fromCode !== to.charCodeAt(toStart + i)) {\r\n break;\r\n }\r\n else if (fromCode === CHAR_FORWARD_SLASH) {\r\n lastCommonSep = i;\r\n }\r\n }\r\n if (i === length) {\r\n if (toLen > length) {\r\n if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {\r\n // We get here if `from` is the exact base path for `to`.\r\n // For example: from='/foo/bar'; to='/foo/bar/baz'\r\n return to.slice(toStart + i + 1);\r\n }\r\n if (i === 0) {\r\n // We get here if `from` is the root\r\n // For example: from='/'; to='/foo'\r\n return to.slice(toStart + i);\r\n }\r\n }\r\n else if (fromLen > length) {\r\n if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {\r\n // We get here if `to` is the exact base path for `from`.\r\n // For example: from='/foo/bar/baz'; to='/foo/bar'\r\n lastCommonSep = i;\r\n }\r\n else if (i === 0) {\r\n // We get here if `to` is the root.\r\n // For example: from='/foo/bar'; to='/'\r\n lastCommonSep = 0;\r\n }\r\n }\r\n }\r\n let out = '';\r\n // Generate the relative path based on the path difference between `to`\r\n // and `from`.\r\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\r\n if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {\r\n out += out.length === 0 ? '..' : '/..';\r\n }\r\n }\r\n // Lastly, append the rest of the destination (`to`) path that comes after\r\n // the common path parts.\r\n return `${out}${to.slice(toStart + lastCommonSep)}`;\r\n },\r\n toNamespacedPath(path) {\r\n // Non-op on posix systems\r\n return path;\r\n },\r\n dirname(path) {\r\n validateString(path, 'path');\r\n if (path.length === 0) {\r\n return '.';\r\n }\r\n const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n let end = -1;\r\n let matchedSlash = true;\r\n for (let i = path.length - 1; i >= 1; --i) {\r\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\r\n if (!matchedSlash) {\r\n end = i;\r\n break;\r\n }\r\n }\r\n else {\r\n // We saw the first non-path separator\r\n matchedSlash = false;\r\n }\r\n }\r\n if (end === -1) {\r\n return hasRoot ? '/' : '.';\r\n }\r\n if (hasRoot && end === 1) {\r\n return '//';\r\n }\r\n return path.slice(0, end);\r\n },\r\n basename(path, ext) {\r\n if (ext !== undefined) {\r\n validateString(ext, 'ext');\r\n }\r\n validateString(path, 'path');\r\n let start = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i;\r\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\r\n if (ext === path) {\r\n return '';\r\n }\r\n let extIdx = ext.length - 1;\r\n let firstNonSlashEnd = -1;\r\n for (i = path.length - 1; i >= 0; --i) {\r\n const code = path.charCodeAt(i);\r\n if (code === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else {\r\n if (firstNonSlashEnd === -1) {\r\n // We saw the first non-path separator, remember this index in case\r\n // we need it if the extension ends up not matching\r\n matchedSlash = false;\r\n firstNonSlashEnd = i + 1;\r\n }\r\n if (extIdx >= 0) {\r\n // Try to match the explicit extension\r\n if (code === ext.charCodeAt(extIdx)) {\r\n if (--extIdx === -1) {\r\n // We matched the extension, so mark this as the end of our path\r\n // component\r\n end = i;\r\n }\r\n }\r\n else {\r\n // Extension does not match, so our result is the entire path\r\n // component\r\n extIdx = -1;\r\n end = firstNonSlashEnd;\r\n }\r\n }\r\n }\r\n }\r\n if (start === end) {\r\n end = firstNonSlashEnd;\r\n }\r\n else if (end === -1) {\r\n end = path.length;\r\n }\r\n return path.slice(start, end);\r\n }\r\n for (i = path.length - 1; i >= 0; --i) {\r\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // path component\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n }\r\n if (end === -1) {\r\n return '';\r\n }\r\n return path.slice(start, end);\r\n },\r\n extname(path) {\r\n validateString(path, 'path');\r\n let startDot = -1;\r\n let startPart = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n for (let i = path.length - 1; i >= 0; --i) {\r\n const code = path.charCodeAt(i);\r\n if (code === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (startDot === -1 ||\r\n end === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n return '';\r\n }\r\n return path.slice(startDot, end);\r\n },\r\n format: _format.bind(null, '/'),\r\n parse(path) {\r\n validateString(path, 'path');\r\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\r\n if (path.length === 0) {\r\n return ret;\r\n }\r\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n let start;\r\n if (isAbsolute) {\r\n ret.root = '/';\r\n start = 1;\r\n }\r\n else {\r\n start = 0;\r\n }\r\n let startDot = -1;\r\n let startPart = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i = path.length - 1;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n // Get non-dir info\r\n for (; i >= start; --i) {\r\n const code = path.charCodeAt(i);\r\n if (code === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (end !== -1) {\r\n const start = startPart === 0 && isAbsolute ? 1 : startPart;\r\n if (startDot === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n ret.base = ret.name = path.slice(start, end);\r\n }\r\n else {\r\n ret.name = path.slice(start, startDot);\r\n ret.base = path.slice(start, end);\r\n ret.ext = path.slice(startDot, end);\r\n }\r\n }\r\n if (startPart > 0) {\r\n ret.dir = path.slice(0, startPart - 1);\r\n }\r\n else if (isAbsolute) {\r\n ret.dir = '/';\r\n }\r\n return ret;\r\n },\r\n sep: '/',\r\n delimiter: ':',\r\n win32: null,\r\n posix: null\r\n};\r\nposix.win32 = win32.win32 = win32;\r\nposix.posix = win32.posix = posix;\r\nexport const normalize = (process.platform === 'win32' ? win32.normalize : posix.normalize);\r\nexport const resolve = (process.platform === 'win32' ? win32.resolve : posix.resolve);\r\nexport const relative = (process.platform === 'win32' ? win32.relative : posix.relative);\r\nexport const dirname = (process.platform === 'win32' ? win32.dirname : posix.dirname);\r\nexport const basename = (process.platform === 'win32' ? win32.basename : posix.basename);\r\nexport const extname = (process.platform === 'win32' ? win32.extname : posix.extname);\r\nexport const sep = (process.platform === 'win32' ? win32.sep : posix.sep);\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isWindows } from './platform.js';\r\nimport * as paths from './path.js';\r\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\r\nconst _singleSlashStart = /^\\//;\r\nconst _doubleSlashStart = /^\\/\\//;\r\nfunction _validateUri(ret, _strict) {\r\n // scheme, must be set\r\n if (!ret.scheme && _strict) {\r\n throw new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\r\n }\r\n // scheme, https://tools.ietf.org/html/rfc3986#section-3.1\r\n // ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\r\n if (ret.scheme && !_schemePattern.test(ret.scheme)) {\r\n throw new Error('[UriError]: Scheme contains illegal characters.');\r\n }\r\n // path, http://tools.ietf.org/html/rfc3986#section-3.3\r\n // If a URI contains an authority component, then the path component\r\n // must either be empty or begin with a slash (\"/\") character. If a URI\r\n // does not contain an authority component, then the path cannot begin\r\n // with two slash characters (\"//\").\r\n if (ret.path) {\r\n if (ret.authority) {\r\n if (!_singleSlashStart.test(ret.path)) {\r\n throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\r\n }\r\n }\r\n else {\r\n if (_doubleSlashStart.test(ret.path)) {\r\n throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\r\n }\r\n }\r\n }\r\n}\r\n// for a while we allowed uris *without* schemes and this is the migration\r\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\r\n// back to the file-scheme. that should cause the least carnage and still be a\r\n// clear warning\r\nfunction _schemeFix(scheme, _strict) {\r\n if (!scheme && !_strict) {\r\n return 'file';\r\n }\r\n return scheme;\r\n}\r\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\r\nfunction _referenceResolution(scheme, path) {\r\n // the slash-character is our 'default base' as we don't\r\n // support constructing URIs relative to other URIs. This\r\n // also means that we alter and potentially break paths.\r\n // see https://tools.ietf.org/html/rfc3986#section-5.1.4\r\n switch (scheme) {\r\n case 'https':\r\n case 'http':\r\n case 'file':\r\n if (!path) {\r\n path = _slash;\r\n }\r\n else if (path[0] !== _slash) {\r\n path = _slash + path;\r\n }\r\n break;\r\n }\r\n return path;\r\n}\r\nconst _empty = '';\r\nconst _slash = '/';\r\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\r\n/**\r\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\r\n * This class is a simple parser which creates the basic component parts\r\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\r\n * and encoding.\r\n *\r\n * ```txt\r\n * foo://example.com:8042/over/there?name=ferret#nose\r\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\r\n * | | | | |\r\n * scheme authority path query fragment\r\n * | _____________________|__\r\n * / \\ / \\\r\n * urn:example:animal:ferret:nose\r\n * ```\r\n */\r\nexport class URI {\r\n /**\r\n * @internal\r\n */\r\n constructor(schemeOrData, authority, path, query, fragment, _strict = false) {\r\n if (typeof schemeOrData === 'object') {\r\n this.scheme = schemeOrData.scheme || _empty;\r\n this.authority = schemeOrData.authority || _empty;\r\n this.path = schemeOrData.path || _empty;\r\n this.query = schemeOrData.query || _empty;\r\n this.fragment = schemeOrData.fragment || _empty;\r\n // no validation because it's this URI\r\n // that creates uri components.\r\n // _validateUri(this);\r\n }\r\n else {\r\n this.scheme = _schemeFix(schemeOrData, _strict);\r\n this.authority = authority || _empty;\r\n this.path = _referenceResolution(this.scheme, path || _empty);\r\n this.query = query || _empty;\r\n this.fragment = fragment || _empty;\r\n _validateUri(this, _strict);\r\n }\r\n }\r\n static isUri(thing) {\r\n if (thing instanceof URI) {\r\n return true;\r\n }\r\n if (!thing) {\r\n return false;\r\n }\r\n return typeof thing.authority === 'string'\r\n && typeof thing.fragment === 'string'\r\n && typeof thing.path === 'string'\r\n && typeof thing.query === 'string'\r\n && typeof thing.scheme === 'string'\r\n && typeof thing.fsPath === 'string'\r\n && typeof thing.with === 'function'\r\n && typeof thing.toString === 'function';\r\n }\r\n // ---- filesystem path -----------------------\r\n /**\r\n * Returns a string representing the corresponding file system path of this URI.\r\n * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\r\n * platform specific path separator.\r\n *\r\n * * Will *not* validate the path for invalid characters and semantics.\r\n * * Will *not* look at the scheme of this URI.\r\n * * The result shall *not* be used for display purposes but for accessing a file on disk.\r\n *\r\n *\r\n * The *difference* to `URI#path` is the use of the platform specific separator and the handling\r\n * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\r\n *\r\n * ```ts\r\n const u = URI.parse('file://server/c$/folder/file.txt')\r\n u.authority === 'server'\r\n u.path === '/shares/c$/file.txt'\r\n u.fsPath === '\\\\server\\c$\\folder\\file.txt'\r\n ```\r\n *\r\n * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\r\n * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\r\n * with URIs that represent files on disk (`file` scheme).\r\n */\r\n get fsPath() {\r\n // if (this.scheme !== 'file') {\r\n // \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\r\n // }\r\n return uriToFsPath(this, false);\r\n }\r\n // ---- modify to new -------------------------\r\n with(change) {\r\n if (!change) {\r\n return this;\r\n }\r\n let { scheme, authority, path, query, fragment } = change;\r\n if (scheme === undefined) {\r\n scheme = this.scheme;\r\n }\r\n else if (scheme === null) {\r\n scheme = _empty;\r\n }\r\n if (authority === undefined) {\r\n authority = this.authority;\r\n }\r\n else if (authority === null) {\r\n authority = _empty;\r\n }\r\n if (path === undefined) {\r\n path = this.path;\r\n }\r\n else if (path === null) {\r\n path = _empty;\r\n }\r\n if (query === undefined) {\r\n query = this.query;\r\n }\r\n else if (query === null) {\r\n query = _empty;\r\n }\r\n if (fragment === undefined) {\r\n fragment = this.fragment;\r\n }\r\n else if (fragment === null) {\r\n fragment = _empty;\r\n }\r\n if (scheme === this.scheme\r\n && authority === this.authority\r\n && path === this.path\r\n && query === this.query\r\n && fragment === this.fragment) {\r\n return this;\r\n }\r\n return new Uri(scheme, authority, path, query, fragment);\r\n }\r\n // ---- parse & validate ------------------------\r\n /**\r\n * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`,\r\n * `file:///usr/home`, or `scheme:with/path`.\r\n *\r\n * @param value A string which represents an URI (see `URI#toString`).\r\n */\r\n static parse(value, _strict = false) {\r\n const match = _regexp.exec(value);\r\n if (!match) {\r\n return new Uri(_empty, _empty, _empty, _empty, _empty);\r\n }\r\n return new Uri(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict);\r\n }\r\n /**\r\n * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\r\n * `/usr/home`, or `\\\\server\\share\\some\\path`.\r\n *\r\n * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\r\n * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\r\n * `URI.parse('file://' + path)` because the path might contain characters that are\r\n * interpreted (# and ?). See the following sample:\r\n * ```ts\r\n const good = URI.file('/coding/c#/project1');\r\n good.scheme === 'file';\r\n good.path === '/coding/c#/project1';\r\n good.fragment === '';\r\n const bad = URI.parse('file://' + '/coding/c#/project1');\r\n bad.scheme === 'file';\r\n bad.path === '/coding/c'; // path is now broken\r\n bad.fragment === '/project1';\r\n ```\r\n *\r\n * @param path A file system path (see `URI#fsPath`)\r\n */\r\n static file(path) {\r\n let authority = _empty;\r\n // normalize to fwd-slashes on windows,\r\n // on other systems bwd-slashes are valid\r\n // filename character, eg /f\\oo/ba\\r.txt\r\n if (isWindows) {\r\n path = path.replace(/\\\\/g, _slash);\r\n }\r\n // check for authority as used in UNC shares\r\n // or use the path as given\r\n if (path[0] === _slash && path[1] === _slash) {\r\n const idx = path.indexOf(_slash, 2);\r\n if (idx === -1) {\r\n authority = path.substring(2);\r\n path = _slash;\r\n }\r\n else {\r\n authority = path.substring(2, idx);\r\n path = path.substring(idx) || _slash;\r\n }\r\n }\r\n return new Uri('file', authority, path, _empty, _empty);\r\n }\r\n static from(components) {\r\n const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment);\r\n _validateUri(result, true);\r\n return result;\r\n }\r\n /**\r\n * Join a URI path with path fragments and normalizes the resulting path.\r\n *\r\n * @param uri The input URI.\r\n * @param pathFragment The path fragment to add to the URI path.\r\n * @returns The resulting URI.\r\n */\r\n static joinPath(uri, ...pathFragment) {\r\n if (!uri.path) {\r\n throw new Error(`[UriError]: cannot call joinPath on URI without path`);\r\n }\r\n let newPath;\r\n if (isWindows && uri.scheme === 'file') {\r\n newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path;\r\n }\r\n else {\r\n newPath = paths.posix.join(uri.path, ...pathFragment);\r\n }\r\n return uri.with({ path: newPath });\r\n }\r\n // ---- printing/externalize ---------------------------\r\n /**\r\n * Creates a string representation for this URI. It's guaranteed that calling\r\n * `URI.parse` with the result of this function creates an URI which is equal\r\n * to this URI.\r\n *\r\n * * The result shall *not* be used for display purposes but for externalization or transport.\r\n * * The result will be encoded using the percentage encoding and encoding happens mostly\r\n * ignore the scheme-specific encoding rules.\r\n *\r\n * @param skipEncoding Do not encode the result, default is `false`\r\n */\r\n toString(skipEncoding = false) {\r\n return _asFormatted(this, skipEncoding);\r\n }\r\n toJSON() {\r\n return this;\r\n }\r\n static revive(data) {\r\n if (!data) {\r\n return data;\r\n }\r\n else if (data instanceof URI) {\r\n return data;\r\n }\r\n else {\r\n const result = new Uri(data);\r\n result._formatted = data.external;\r\n result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null;\r\n return result;\r\n }\r\n }\r\n}\r\nconst _pathSepMarker = isWindows ? 1 : undefined;\r\n// This class exists so that URI is compatibile with vscode.Uri (API).\r\nclass Uri extends URI {\r\n constructor() {\r\n super(...arguments);\r\n this._formatted = null;\r\n this._fsPath = null;\r\n }\r\n get fsPath() {\r\n if (!this._fsPath) {\r\n this._fsPath = uriToFsPath(this, false);\r\n }\r\n return this._fsPath;\r\n }\r\n toString(skipEncoding = false) {\r\n if (!skipEncoding) {\r\n if (!this._formatted) {\r\n this._formatted = _asFormatted(this, false);\r\n }\r\n return this._formatted;\r\n }\r\n else {\r\n // we don't cache that\r\n return _asFormatted(this, true);\r\n }\r\n }\r\n toJSON() {\r\n const res = {\r\n $mid: 1\r\n };\r\n // cached state\r\n if (this._fsPath) {\r\n res.fsPath = this._fsPath;\r\n res._sep = _pathSepMarker;\r\n }\r\n if (this._formatted) {\r\n res.external = this._formatted;\r\n }\r\n // uri components\r\n if (this.path) {\r\n res.path = this.path;\r\n }\r\n if (this.scheme) {\r\n res.scheme = this.scheme;\r\n }\r\n if (this.authority) {\r\n res.authority = this.authority;\r\n }\r\n if (this.query) {\r\n res.query = this.query;\r\n }\r\n if (this.fragment) {\r\n res.fragment = this.fragment;\r\n }\r\n return res;\r\n }\r\n}\r\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\r\nconst encodeTable = {\r\n [58 /* Colon */]: '%3A',\r\n [47 /* Slash */]: '%2F',\r\n [63 /* QuestionMark */]: '%3F',\r\n [35 /* Hash */]: '%23',\r\n [91 /* OpenSquareBracket */]: '%5B',\r\n [93 /* CloseSquareBracket */]: '%5D',\r\n [64 /* AtSign */]: '%40',\r\n [33 /* ExclamationMark */]: '%21',\r\n [36 /* DollarSign */]: '%24',\r\n [38 /* Ampersand */]: '%26',\r\n [39 /* SingleQuote */]: '%27',\r\n [40 /* OpenParen */]: '%28',\r\n [41 /* CloseParen */]: '%29',\r\n [42 /* Asterisk */]: '%2A',\r\n [43 /* Plus */]: '%2B',\r\n [44 /* Comma */]: '%2C',\r\n [59 /* Semicolon */]: '%3B',\r\n [61 /* Equals */]: '%3D',\r\n [32 /* Space */]: '%20',\r\n};\r\nfunction encodeURIComponentFast(uriComponent, allowSlash) {\r\n let res = undefined;\r\n let nativeEncodePos = -1;\r\n for (let pos = 0; pos < uriComponent.length; pos++) {\r\n const code = uriComponent.charCodeAt(pos);\r\n // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\r\n if ((code >= 97 /* a */ && code <= 122 /* z */)\r\n || (code >= 65 /* A */ && code <= 90 /* Z */)\r\n || (code >= 48 /* Digit0 */ && code <= 57 /* Digit9 */)\r\n || code === 45 /* Dash */\r\n || code === 46 /* Period */\r\n || code === 95 /* Underline */\r\n || code === 126 /* Tilde */\r\n || (allowSlash && code === 47 /* Slash */)) {\r\n // check if we are delaying native encode\r\n if (nativeEncodePos !== -1) {\r\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\r\n nativeEncodePos = -1;\r\n }\r\n // check if we write into a new string (by default we try to return the param)\r\n if (res !== undefined) {\r\n res += uriComponent.charAt(pos);\r\n }\r\n }\r\n else {\r\n // encoding needed, we need to allocate a new string\r\n if (res === undefined) {\r\n res = uriComponent.substr(0, pos);\r\n }\r\n // check with default table first\r\n const escaped = encodeTable[code];\r\n if (escaped !== undefined) {\r\n // check if we are delaying native encode\r\n if (nativeEncodePos !== -1) {\r\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\r\n nativeEncodePos = -1;\r\n }\r\n // append escaped variant to result\r\n res += escaped;\r\n }\r\n else if (nativeEncodePos === -1) {\r\n // use native encode only when needed\r\n nativeEncodePos = pos;\r\n }\r\n }\r\n }\r\n if (nativeEncodePos !== -1) {\r\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos));\r\n }\r\n return res !== undefined ? res : uriComponent;\r\n}\r\nfunction encodeURIComponentMinimal(path) {\r\n let res = undefined;\r\n for (let pos = 0; pos < path.length; pos++) {\r\n const code = path.charCodeAt(pos);\r\n if (code === 35 /* Hash */ || code === 63 /* QuestionMark */) {\r\n if (res === undefined) {\r\n res = path.substr(0, pos);\r\n }\r\n res += encodeTable[code];\r\n }\r\n else {\r\n if (res !== undefined) {\r\n res += path[pos];\r\n }\r\n }\r\n }\r\n return res !== undefined ? res : path;\r\n}\r\n/**\r\n * Compute `fsPath` for the given uri\r\n */\r\nexport function uriToFsPath(uri, keepDriveLetterCasing) {\r\n let value;\r\n if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\r\n // unc path: file://shares/c$/far/boo\r\n value = `//${uri.authority}${uri.path}`;\r\n }\r\n else if (uri.path.charCodeAt(0) === 47 /* Slash */\r\n && (uri.path.charCodeAt(1) >= 65 /* A */ && uri.path.charCodeAt(1) <= 90 /* Z */ || uri.path.charCodeAt(1) >= 97 /* a */ && uri.path.charCodeAt(1) <= 122 /* z */)\r\n && uri.path.charCodeAt(2) === 58 /* Colon */) {\r\n if (!keepDriveLetterCasing) {\r\n // windows drive letter: file:///c:/far/boo\r\n value = uri.path[1].toLowerCase() + uri.path.substr(2);\r\n }\r\n else {\r\n value = uri.path.substr(1);\r\n }\r\n }\r\n else {\r\n // other path\r\n value = uri.path;\r\n }\r\n if (isWindows) {\r\n value = value.replace(/\\//g, '\\\\');\r\n }\r\n return value;\r\n}\r\n/**\r\n * Create the external version of a uri\r\n */\r\nfunction _asFormatted(uri, skipEncoding) {\r\n const encoder = !skipEncoding\r\n ? encodeURIComponentFast\r\n : encodeURIComponentMinimal;\r\n let res = '';\r\n let { scheme, authority, path, query, fragment } = uri;\r\n if (scheme) {\r\n res += scheme;\r\n res += ':';\r\n }\r\n if (authority || scheme === 'file') {\r\n res += _slash;\r\n res += _slash;\r\n }\r\n if (authority) {\r\n let idx = authority.indexOf('@');\r\n if (idx !== -1) {\r\n // <user>@<auth>\r\n const userinfo = authority.substr(0, idx);\r\n authority = authority.substr(idx + 1);\r\n idx = userinfo.indexOf(':');\r\n if (idx === -1) {\r\n res += encoder(userinfo, false);\r\n }\r\n else {\r\n // <user>:<pass>@<auth>\r\n res += encoder(userinfo.substr(0, idx), false);\r\n res += ':';\r\n res += encoder(userinfo.substr(idx + 1), false);\r\n }\r\n res += '@';\r\n }\r\n authority = authority.toLowerCase();\r\n idx = authority.indexOf(':');\r\n if (idx === -1) {\r\n res += encoder(authority, false);\r\n }\r\n else {\r\n // <auth>:<port>\r\n res += encoder(authority.substr(0, idx), false);\r\n res += authority.substr(idx);\r\n }\r\n }\r\n if (path) {\r\n // lower-case windows drive letters in /C:/fff or C:/fff\r\n if (path.length >= 3 && path.charCodeAt(0) === 47 /* Slash */ && path.charCodeAt(2) === 58 /* Colon */) {\r\n const code = path.charCodeAt(1);\r\n if (code >= 65 /* A */ && code <= 90 /* Z */) {\r\n path = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\r\n }\r\n }\r\n else if (path.length >= 2 && path.charCodeAt(1) === 58 /* Colon */) {\r\n const code = path.charCodeAt(0);\r\n if (code >= 65 /* A */ && code <= 90 /* Z */) {\r\n path = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\r\n }\r\n }\r\n // encode the rest of the path\r\n res += encoder(path, true);\r\n }\r\n if (query) {\r\n res += '?';\r\n res += encoder(query, false);\r\n }\r\n if (fragment) {\r\n res += '#';\r\n res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;\r\n }\r\n return res;\r\n}\r\n// --- decode\r\nfunction decodeURIComponentGraceful(str) {\r\n try {\r\n return decodeURIComponent(str);\r\n }\r\n catch (_a) {\r\n if (str.length > 3) {\r\n return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\r\n }\r\n else {\r\n return str;\r\n }\r\n }\r\n}\r\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\r\nfunction percentDecode(str) {\r\n if (!str.match(_rEncodedAsHex)) {\r\n return str;\r\n }\r\n return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * A position in the editor.\r\n */\r\nexport class Position {\r\n constructor(lineNumber, column) {\r\n this.lineNumber = lineNumber;\r\n this.column = column;\r\n }\r\n /**\r\n * Create a new position from this position.\r\n *\r\n * @param newLineNumber new line number\r\n * @param newColumn new column\r\n */\r\n with(newLineNumber = this.lineNumber, newColumn = this.column) {\r\n if (newLineNumber === this.lineNumber && newColumn === this.column) {\r\n return this;\r\n }\r\n else {\r\n return new Position(newLineNumber, newColumn);\r\n }\r\n }\r\n /**\r\n * Derive a new position from this position.\r\n *\r\n * @param deltaLineNumber line number delta\r\n * @param deltaColumn column delta\r\n */\r\n delta(deltaLineNumber = 0, deltaColumn = 0) {\r\n return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);\r\n }\r\n /**\r\n * Test if this position equals other position\r\n */\r\n equals(other) {\r\n return Position.equals(this, other);\r\n }\r\n /**\r\n * Test if position `a` equals position `b`\r\n */\r\n static equals(a, b) {\r\n if (!a && !b) {\r\n return true;\r\n }\r\n return (!!a &&\r\n !!b &&\r\n a.lineNumber === b.lineNumber &&\r\n a.column === b.column);\r\n }\r\n /**\r\n * Test if this position is before other position.\r\n * If the two positions are equal, the result will be false.\r\n */\r\n isBefore(other) {\r\n return Position.isBefore(this, other);\r\n }\r\n /**\r\n * Test if position `a` is before position `b`.\r\n * If the two positions are equal, the result will be false.\r\n */\r\n static isBefore(a, b) {\r\n if (a.lineNumber < b.lineNumber) {\r\n return true;\r\n }\r\n if (b.lineNumber < a.lineNumber) {\r\n return false;\r\n }\r\n return a.column < b.column;\r\n }\r\n /**\r\n * Test if this position is before other position.\r\n * If the two positions are equal, the result will be true.\r\n */\r\n isBeforeOrEqual(other) {\r\n return Position.isBeforeOrEqual(this, other);\r\n }\r\n /**\r\n * Test if position `a` is before position `b`.\r\n * If the two positions are equal, the result will be true.\r\n */\r\n static isBeforeOrEqual(a, b) {\r\n if (a.lineNumber < b.lineNumber) {\r\n return true;\r\n }\r\n if (b.lineNumber < a.lineNumber) {\r\n return false;\r\n }\r\n return a.column <= b.column;\r\n }\r\n /**\r\n * A function that compares positions, useful for sorting\r\n */\r\n static compare(a, b) {\r\n let aLineNumber = a.lineNumber | 0;\r\n let bLineNumber = b.lineNumber | 0;\r\n if (aLineNumber === bLineNumber) {\r\n let aColumn = a.column | 0;\r\n let bColumn = b.column | 0;\r\n return aColumn - bColumn;\r\n }\r\n return aLineNumber - bLineNumber;\r\n }\r\n /**\r\n * Clone this position.\r\n */\r\n clone() {\r\n return new Position(this.lineNumber, this.column);\r\n }\r\n /**\r\n * Convert to a human-readable representation.\r\n */\r\n toString() {\r\n return '(' + this.lineNumber + ',' + this.column + ')';\r\n }\r\n // ---\r\n /**\r\n * Create a `Position` from an `IPosition`.\r\n */\r\n static lift(pos) {\r\n return new Position(pos.lineNumber, pos.column);\r\n }\r\n /**\r\n * Test if `obj` is an `IPosition`.\r\n */\r\n static isIPosition(obj) {\r\n return (obj\r\n && (typeof obj.lineNumber === 'number')\r\n && (typeof obj.column === 'number'));\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Position } from './position.js';\r\n/**\r\n * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)\r\n */\r\nexport class Range {\r\n constructor(startLineNumber, startColumn, endLineNumber, endColumn) {\r\n if ((startLineNumber > endLineNumber) || (startLineNumber === endLineNumber && startColumn > endColumn)) {\r\n this.startLineNumber = endLineNumber;\r\n this.startColumn = endColumn;\r\n this.endLineNumber = startLineNumber;\r\n this.endColumn = startColumn;\r\n }\r\n else {\r\n this.startLineNumber = startLineNumber;\r\n this.startColumn = startColumn;\r\n this.endLineNumber = endLineNumber;\r\n this.endColumn = endColumn;\r\n }\r\n }\r\n /**\r\n * Test if this range is empty.\r\n */\r\n isEmpty() {\r\n return Range.isEmpty(this);\r\n }\r\n /**\r\n * Test if `range` is empty.\r\n */\r\n static isEmpty(range) {\r\n return (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn);\r\n }\r\n /**\r\n * Test if position is in this range. If the position is at the edges, will return true.\r\n */\r\n containsPosition(position) {\r\n return Range.containsPosition(this, position);\r\n }\r\n /**\r\n * Test if `position` is in `range`. If the position is at the edges, will return true.\r\n */\r\n static containsPosition(range, position) {\r\n if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\r\n return false;\r\n }\r\n if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {\r\n return false;\r\n }\r\n if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if range is in this range. If the range is equal to this range, will return true.\r\n */\r\n containsRange(range) {\r\n return Range.containsRange(this, range);\r\n }\r\n /**\r\n * Test if `otherRange` is in `range`. If the ranges are equal, will return true.\r\n */\r\n static containsRange(range, otherRange) {\r\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {\r\n return false;\r\n }\r\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.\r\n */\r\n strictContainsRange(range) {\r\n return Range.strictContainsRange(this, range);\r\n }\r\n /**\r\n * Test if `otherRange` is strinctly in `range` (must start after, and end before). If the ranges are equal, will return false.\r\n */\r\n static strictContainsRange(range, otherRange) {\r\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {\r\n return false;\r\n }\r\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * A reunion of the two ranges.\r\n * The smallest position will be used as the start point, and the largest one as the end point.\r\n */\r\n plusRange(range) {\r\n return Range.plusRange(this, range);\r\n }\r\n /**\r\n * A reunion of the two ranges.\r\n * The smallest position will be used as the start point, and the largest one as the end point.\r\n */\r\n static plusRange(a, b) {\r\n let startLineNumber;\r\n let startColumn;\r\n let endLineNumber;\r\n let endColumn;\r\n if (b.startLineNumber < a.startLineNumber) {\r\n startLineNumber = b.startLineNumber;\r\n startColumn = b.startColumn;\r\n }\r\n else if (b.startLineNumber === a.startLineNumber) {\r\n startLineNumber = b.startLineNumber;\r\n startColumn = Math.min(b.startColumn, a.startColumn);\r\n }\r\n else {\r\n startLineNumber = a.startLineNumber;\r\n startColumn = a.startColumn;\r\n }\r\n if (b.endLineNumber > a.endLineNumber) {\r\n endLineNumber = b.endLineNumber;\r\n endColumn = b.endColumn;\r\n }\r\n else if (b.endLineNumber === a.endLineNumber) {\r\n endLineNumber = b.endLineNumber;\r\n endColumn = Math.max(b.endColumn, a.endColumn);\r\n }\r\n else {\r\n endLineNumber = a.endLineNumber;\r\n endColumn = a.endColumn;\r\n }\r\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n /**\r\n * A intersection of the two ranges.\r\n */\r\n intersectRanges(range) {\r\n return Range.intersectRanges(this, range);\r\n }\r\n /**\r\n * A intersection of the two ranges.\r\n */\r\n static intersectRanges(a, b) {\r\n let resultStartLineNumber = a.startLineNumber;\r\n let resultStartColumn = a.startColumn;\r\n let resultEndLineNumber = a.endLineNumber;\r\n let resultEndColumn = a.endColumn;\r\n let otherStartLineNumber = b.startLineNumber;\r\n let otherStartColumn = b.startColumn;\r\n let otherEndLineNumber = b.endLineNumber;\r\n let otherEndColumn = b.endColumn;\r\n if (resultStartLineNumber < otherStartLineNumber) {\r\n resultStartLineNumber = otherStartLineNumber;\r\n resultStartColumn = otherStartColumn;\r\n }\r\n else if (resultStartLineNumber === otherStartLineNumber) {\r\n resultStartColumn = Math.max(resultStartColumn, otherStartColumn);\r\n }\r\n if (resultEndLineNumber > otherEndLineNumber) {\r\n resultEndLineNumber = otherEndLineNumber;\r\n resultEndColumn = otherEndColumn;\r\n }\r\n else if (resultEndLineNumber === otherEndLineNumber) {\r\n resultEndColumn = Math.min(resultEndColumn, otherEndColumn);\r\n }\r\n // Check if selection is now empty\r\n if (resultStartLineNumber > resultEndLineNumber) {\r\n return null;\r\n }\r\n if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {\r\n return null;\r\n }\r\n return new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);\r\n }\r\n /**\r\n * Test if this range equals other.\r\n */\r\n equalsRange(other) {\r\n return Range.equalsRange(this, other);\r\n }\r\n /**\r\n * Test if range `a` equals `b`.\r\n */\r\n static equalsRange(a, b) {\r\n return (!!a &&\r\n !!b &&\r\n a.startLineNumber === b.startLineNumber &&\r\n a.startColumn === b.startColumn &&\r\n a.endLineNumber === b.endLineNumber &&\r\n a.endColumn === b.endColumn);\r\n }\r\n /**\r\n * Return the end position (which will be after or equal to the start position)\r\n */\r\n getEndPosition() {\r\n return Range.getEndPosition(this);\r\n }\r\n /**\r\n * Return the end position (which will be after or equal to the start position)\r\n */\r\n static getEndPosition(range) {\r\n return new Position(range.endLineNumber, range.endColumn);\r\n }\r\n /**\r\n * Return the start position (which will be before or equal to the end position)\r\n */\r\n getStartPosition() {\r\n return Range.getStartPosition(this);\r\n }\r\n /**\r\n * Return the start position (which will be before or equal to the end position)\r\n */\r\n static getStartPosition(range) {\r\n return new Position(range.startLineNumber, range.startColumn);\r\n }\r\n /**\r\n * Transform to a user presentable string representation.\r\n */\r\n toString() {\r\n return '[' + this.startLineNumber + ',' + this.startColumn + ' -> ' + this.endLineNumber + ',' + this.endColumn + ']';\r\n }\r\n /**\r\n * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.\r\n */\r\n setEndPosition(endLineNumber, endColumn) {\r\n return new Range(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\r\n }\r\n /**\r\n * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.\r\n */\r\n setStartPosition(startLineNumber, startColumn) {\r\n return new Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\r\n }\r\n /**\r\n * Create a new empty range using this range's start position.\r\n */\r\n collapseToStart() {\r\n return Range.collapseToStart(this);\r\n }\r\n /**\r\n * Create a new empty range using this range's start position.\r\n */\r\n static collapseToStart(range) {\r\n return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);\r\n }\r\n // ---\r\n static fromPositions(start, end = start) {\r\n return new Range(start.lineNumber, start.column, end.lineNumber, end.column);\r\n }\r\n static lift(range) {\r\n if (!range) {\r\n return null;\r\n }\r\n return new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\r\n }\r\n /**\r\n * Test if `obj` is an `IRange`.\r\n */\r\n static isIRange(obj) {\r\n return (obj\r\n && (typeof obj.startLineNumber === 'number')\r\n && (typeof obj.startColumn === 'number')\r\n && (typeof obj.endLineNumber === 'number')\r\n && (typeof obj.endColumn === 'number'));\r\n }\r\n /**\r\n * Test if the two ranges are touching in any way.\r\n */\r\n static areIntersectingOrTouching(a, b) {\r\n // Check if `a` is before `b`\r\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn)) {\r\n return false;\r\n }\r\n // Check if `b` is before `a`\r\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn)) {\r\n return false;\r\n }\r\n // These ranges must intersect\r\n return true;\r\n }\r\n /**\r\n * Test if the two ranges are intersecting. If the ranges are touching it returns true.\r\n */\r\n static areIntersecting(a, b) {\r\n // Check if `a` is before `b`\r\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn)) {\r\n return false;\r\n }\r\n // Check if `b` is before `a`\r\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn)) {\r\n return false;\r\n }\r\n // These ranges must intersect\r\n return true;\r\n }\r\n /**\r\n * A function that compares ranges, useful for sorting ranges\r\n * It will first compare ranges on the startPosition and then on the endPosition\r\n */\r\n static compareRangesUsingStarts(a, b) {\r\n if (a && b) {\r\n const aStartLineNumber = a.startLineNumber | 0;\r\n const bStartLineNumber = b.startLineNumber | 0;\r\n if (aStartLineNumber === bStartLineNumber) {\r\n const aStartColumn = a.startColumn | 0;\r\n const bStartColumn = b.startColumn | 0;\r\n if (aStartColumn === bStartColumn) {\r\n const aEndLineNumber = a.endLineNumber | 0;\r\n const bEndLineNumber = b.endLineNumber | 0;\r\n if (aEndLineNumber === bEndLineNumber) {\r\n const aEndColumn = a.endColumn | 0;\r\n const bEndColumn = b.endColumn | 0;\r\n return aEndColumn - bEndColumn;\r\n }\r\n return aEndLineNumber - bEndLineNumber;\r\n }\r\n return aStartColumn - bStartColumn;\r\n }\r\n return aStartLineNumber - bStartLineNumber;\r\n }\r\n const aExists = (a ? 1 : 0);\r\n const bExists = (b ? 1 : 0);\r\n return aExists - bExists;\r\n }\r\n /**\r\n * A function that compares ranges, useful for sorting ranges\r\n * It will first compare ranges on the endPosition and then on the startPosition\r\n */\r\n static compareRangesUsingEnds(a, b) {\r\n if (a.endLineNumber === b.endLineNumber) {\r\n if (a.endColumn === b.endColumn) {\r\n if (a.startLineNumber === b.startLineNumber) {\r\n return a.startColumn - b.startColumn;\r\n }\r\n return a.startLineNumber - b.startLineNumber;\r\n }\r\n return a.endColumn - b.endColumn;\r\n }\r\n return a.endLineNumber - b.endLineNumber;\r\n }\r\n /**\r\n * Test if the range spans multiple lines.\r\n */\r\n static spansMultipleLines(range) {\r\n return range.endLineNumber > range.startLineNumber;\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { LcsDiff } from '../../../base/common/diff/diff.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nconst MINIMUM_MATCHING_CHARACTER_LENGTH = 3;\r\nfunction computeDiff(originalSequence, modifiedSequence, continueProcessingPredicate, pretty) {\r\n const diffAlgo = new LcsDiff(originalSequence, modifiedSequence, continueProcessingPredicate);\r\n return diffAlgo.ComputeDiff(pretty);\r\n}\r\nclass LineSequence {\r\n constructor(lines) {\r\n const startColumns = [];\r\n const endColumns = [];\r\n for (let i = 0, length = lines.length; i < length; i++) {\r\n startColumns[i] = getFirstNonBlankColumn(lines[i], 1);\r\n endColumns[i] = getLastNonBlankColumn(lines[i], 1);\r\n }\r\n this.lines = lines;\r\n this._startColumns = startColumns;\r\n this._endColumns = endColumns;\r\n }\r\n getElements() {\r\n const elements = [];\r\n for (let i = 0, len = this.lines.length; i < len; i++) {\r\n elements[i] = this.lines[i].substring(this._startColumns[i] - 1, this._endColumns[i] - 1);\r\n }\r\n return elements;\r\n }\r\n getStartLineNumber(i) {\r\n return i + 1;\r\n }\r\n getEndLineNumber(i) {\r\n return i + 1;\r\n }\r\n createCharSequence(shouldIgnoreTrimWhitespace, startIndex, endIndex) {\r\n const charCodes = [];\r\n const lineNumbers = [];\r\n const columns = [];\r\n let len = 0;\r\n for (let index = startIndex; index <= endIndex; index++) {\r\n const lineContent = this.lines[index];\r\n const startColumn = (shouldIgnoreTrimWhitespace ? this._startColumns[index] : 1);\r\n const endColumn = (shouldIgnoreTrimWhitespace ? this._endColumns[index] : lineContent.length + 1);\r\n for (let col = startColumn; col < endColumn; col++) {\r\n charCodes[len] = lineContent.charCodeAt(col - 1);\r\n lineNumbers[len] = index + 1;\r\n columns[len] = col;\r\n len++;\r\n }\r\n }\r\n return new CharSequence(charCodes, lineNumbers, columns);\r\n }\r\n}\r\nclass CharSequence {\r\n constructor(charCodes, lineNumbers, columns) {\r\n this._charCodes = charCodes;\r\n this._lineNumbers = lineNumbers;\r\n this._columns = columns;\r\n }\r\n getElements() {\r\n return this._charCodes;\r\n }\r\n getStartLineNumber(i) {\r\n return this._lineNumbers[i];\r\n }\r\n getStartColumn(i) {\r\n return this._columns[i];\r\n }\r\n getEndLineNumber(i) {\r\n return this._lineNumbers[i];\r\n }\r\n getEndColumn(i) {\r\n return this._columns[i] + 1;\r\n }\r\n}\r\nclass CharChange {\r\n constructor(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn) {\r\n this.originalStartLineNumber = originalStartLineNumber;\r\n this.originalStartColumn = originalStartColumn;\r\n this.originalEndLineNumber = originalEndLineNumber;\r\n this.originalEndColumn = originalEndColumn;\r\n this.modifiedStartLineNumber = modifiedStartLineNumber;\r\n this.modifiedStartColumn = modifiedStartColumn;\r\n this.modifiedEndLineNumber = modifiedEndLineNumber;\r\n this.modifiedEndColumn = modifiedEndColumn;\r\n }\r\n static createFromDiffChange(diffChange, originalCharSequence, modifiedCharSequence) {\r\n let originalStartLineNumber;\r\n let originalStartColumn;\r\n let originalEndLineNumber;\r\n let originalEndColumn;\r\n let modifiedStartLineNumber;\r\n let modifiedStartColumn;\r\n let modifiedEndLineNumber;\r\n let modifiedEndColumn;\r\n if (diffChange.originalLength === 0) {\r\n originalStartLineNumber = 0;\r\n originalStartColumn = 0;\r\n originalEndLineNumber = 0;\r\n originalEndColumn = 0;\r\n }\r\n else {\r\n originalStartLineNumber = originalCharSequence.getStartLineNumber(diffChange.originalStart);\r\n originalStartColumn = originalCharSequence.getStartColumn(diffChange.originalStart);\r\n originalEndLineNumber = originalCharSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);\r\n originalEndColumn = originalCharSequence.getEndColumn(diffChange.originalStart + diffChange.originalLength - 1);\r\n }\r\n if (diffChange.modifiedLength === 0) {\r\n modifiedStartLineNumber = 0;\r\n modifiedStartColumn = 0;\r\n modifiedEndLineNumber = 0;\r\n modifiedEndColumn = 0;\r\n }\r\n else {\r\n modifiedStartLineNumber = modifiedCharSequence.getStartLineNumber(diffChange.modifiedStart);\r\n modifiedStartColumn = modifiedCharSequence.getStartColumn(diffChange.modifiedStart);\r\n modifiedEndLineNumber = modifiedCharSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n modifiedEndColumn = modifiedCharSequence.getEndColumn(diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n }\r\n return new CharChange(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn);\r\n }\r\n}\r\nfunction postProcessCharChanges(rawChanges) {\r\n if (rawChanges.length <= 1) {\r\n return rawChanges;\r\n }\r\n const result = [rawChanges[0]];\r\n let prevChange = result[0];\r\n for (let i = 1, len = rawChanges.length; i < len; i++) {\r\n const currChange = rawChanges[i];\r\n const originalMatchingLength = currChange.originalStart - (prevChange.originalStart + prevChange.originalLength);\r\n const modifiedMatchingLength = currChange.modifiedStart - (prevChange.modifiedStart + prevChange.modifiedLength);\r\n // Both of the above should be equal, but the continueProcessingPredicate may prevent this from being true\r\n const matchingLength = Math.min(originalMatchingLength, modifiedMatchingLength);\r\n if (matchingLength < MINIMUM_MATCHING_CHARACTER_LENGTH) {\r\n // Merge the current change into the previous one\r\n prevChange.originalLength = (currChange.originalStart + currChange.originalLength) - prevChange.originalStart;\r\n prevChange.modifiedLength = (currChange.modifiedStart + currChange.modifiedLength) - prevChange.modifiedStart;\r\n }\r\n else {\r\n // Add the current change\r\n result.push(currChange);\r\n prevChange = currChange;\r\n }\r\n }\r\n return result;\r\n}\r\nclass LineChange {\r\n constructor(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges) {\r\n this.originalStartLineNumber = originalStartLineNumber;\r\n this.originalEndLineNumber = originalEndLineNumber;\r\n this.modifiedStartLineNumber = modifiedStartLineNumber;\r\n this.modifiedEndLineNumber = modifiedEndLineNumber;\r\n this.charChanges = charChanges;\r\n }\r\n static createFromDiffResult(shouldIgnoreTrimWhitespace, diffChange, originalLineSequence, modifiedLineSequence, continueCharDiff, shouldComputeCharChanges, shouldPostProcessCharChanges) {\r\n let originalStartLineNumber;\r\n let originalEndLineNumber;\r\n let modifiedStartLineNumber;\r\n let modifiedEndLineNumber;\r\n let charChanges = undefined;\r\n if (diffChange.originalLength === 0) {\r\n originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart) - 1;\r\n originalEndLineNumber = 0;\r\n }\r\n else {\r\n originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart);\r\n originalEndLineNumber = originalLineSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);\r\n }\r\n if (diffChange.modifiedLength === 0) {\r\n modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart) - 1;\r\n modifiedEndLineNumber = 0;\r\n }\r\n else {\r\n modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart);\r\n modifiedEndLineNumber = modifiedLineSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n }\r\n if (shouldComputeCharChanges && diffChange.originalLength > 0 && diffChange.originalLength < 20 && diffChange.modifiedLength > 0 && diffChange.modifiedLength < 20 && continueCharDiff()) {\r\n // Compute character changes for diff chunks of at most 20 lines...\r\n const originalCharSequence = originalLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);\r\n const modifiedCharSequence = modifiedLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n let rawChanges = computeDiff(originalCharSequence, modifiedCharSequence, continueCharDiff, true).changes;\r\n if (shouldPostProcessCharChanges) {\r\n rawChanges = postProcessCharChanges(rawChanges);\r\n }\r\n charChanges = [];\r\n for (let i = 0, length = rawChanges.length; i < length; i++) {\r\n charChanges.push(CharChange.createFromDiffChange(rawChanges[i], originalCharSequence, modifiedCharSequence));\r\n }\r\n }\r\n return new LineChange(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges);\r\n }\r\n}\r\nexport class DiffComputer {\r\n constructor(originalLines, modifiedLines, opts) {\r\n this.shouldComputeCharChanges = opts.shouldComputeCharChanges;\r\n this.shouldPostProcessCharChanges = opts.shouldPostProcessCharChanges;\r\n this.shouldIgnoreTrimWhitespace = opts.shouldIgnoreTrimWhitespace;\r\n this.shouldMakePrettyDiff = opts.shouldMakePrettyDiff;\r\n this.originalLines = originalLines;\r\n this.modifiedLines = modifiedLines;\r\n this.original = new LineSequence(originalLines);\r\n this.modified = new LineSequence(modifiedLines);\r\n this.continueLineDiff = createContinueProcessingPredicate(opts.maxComputationTime);\r\n this.continueCharDiff = createContinueProcessingPredicate(opts.maxComputationTime === 0 ? 0 : Math.min(opts.maxComputationTime, 5000)); // never run after 5s for character changes...\r\n }\r\n computeDiff() {\r\n if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {\r\n // empty original => fast path\r\n if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {\r\n return {\r\n quitEarly: false,\r\n changes: []\r\n };\r\n }\r\n return {\r\n quitEarly: false,\r\n changes: [{\r\n originalStartLineNumber: 1,\r\n originalEndLineNumber: 1,\r\n modifiedStartLineNumber: 1,\r\n modifiedEndLineNumber: this.modified.lines.length,\r\n charChanges: [{\r\n modifiedEndColumn: 0,\r\n modifiedEndLineNumber: 0,\r\n modifiedStartColumn: 0,\r\n modifiedStartLineNumber: 0,\r\n originalEndColumn: 0,\r\n originalEndLineNumber: 0,\r\n originalStartColumn: 0,\r\n originalStartLineNumber: 0\r\n }]\r\n }]\r\n };\r\n }\r\n if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {\r\n // empty modified => fast path\r\n return {\r\n quitEarly: false,\r\n changes: [{\r\n originalStartLineNumber: 1,\r\n originalEndLineNumber: this.original.lines.length,\r\n modifiedStartLineNumber: 1,\r\n modifiedEndLineNumber: 1,\r\n charChanges: [{\r\n modifiedEndColumn: 0,\r\n modifiedEndLineNumber: 0,\r\n modifiedStartColumn: 0,\r\n modifiedStartLineNumber: 0,\r\n originalEndColumn: 0,\r\n originalEndLineNumber: 0,\r\n originalStartColumn: 0,\r\n originalStartLineNumber: 0\r\n }]\r\n }]\r\n };\r\n }\r\n const diffResult = computeDiff(this.original, this.modified, this.continueLineDiff, this.shouldMakePrettyDiff);\r\n const rawChanges = diffResult.changes;\r\n const quitEarly = diffResult.quitEarly;\r\n // The diff is always computed with ignoring trim whitespace\r\n // This ensures we get the prettiest diff\r\n if (this.shouldIgnoreTrimWhitespace) {\r\n const lineChanges = [];\r\n for (let i = 0, length = rawChanges.length; i < length; i++) {\r\n lineChanges.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, rawChanges[i], this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));\r\n }\r\n return {\r\n quitEarly: quitEarly,\r\n changes: lineChanges\r\n };\r\n }\r\n // Need to post-process and introduce changes where the trim whitespace is different\r\n // Note that we are looping starting at -1 to also cover the lines before the first change\r\n const result = [];\r\n let originalLineIndex = 0;\r\n let modifiedLineIndex = 0;\r\n for (let i = -1 /* !!!! */, len = rawChanges.length; i < len; i++) {\r\n const nextChange = (i + 1 < len ? rawChanges[i + 1] : null);\r\n const originalStop = (nextChange ? nextChange.originalStart : this.originalLines.length);\r\n const modifiedStop = (nextChange ? nextChange.modifiedStart : this.modifiedLines.length);\r\n while (originalLineIndex < originalStop && modifiedLineIndex < modifiedStop) {\r\n const originalLine = this.originalLines[originalLineIndex];\r\n const modifiedLine = this.modifiedLines[modifiedLineIndex];\r\n if (originalLine !== modifiedLine) {\r\n // These lines differ only in trim whitespace\r\n // Check the leading whitespace\r\n {\r\n let originalStartColumn = getFirstNonBlankColumn(originalLine, 1);\r\n let modifiedStartColumn = getFirstNonBlankColumn(modifiedLine, 1);\r\n while (originalStartColumn > 1 && modifiedStartColumn > 1) {\r\n const originalChar = originalLine.charCodeAt(originalStartColumn - 2);\r\n const modifiedChar = modifiedLine.charCodeAt(modifiedStartColumn - 2);\r\n if (originalChar !== modifiedChar) {\r\n break;\r\n }\r\n originalStartColumn--;\r\n modifiedStartColumn--;\r\n }\r\n if (originalStartColumn > 1 || modifiedStartColumn > 1) {\r\n this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, 1, originalStartColumn, modifiedLineIndex + 1, 1, modifiedStartColumn);\r\n }\r\n }\r\n // Check the trailing whitespace\r\n {\r\n let originalEndColumn = getLastNonBlankColumn(originalLine, 1);\r\n let modifiedEndColumn = getLastNonBlankColumn(modifiedLine, 1);\r\n const originalMaxColumn = originalLine.length + 1;\r\n const modifiedMaxColumn = modifiedLine.length + 1;\r\n while (originalEndColumn < originalMaxColumn && modifiedEndColumn < modifiedMaxColumn) {\r\n const originalChar = originalLine.charCodeAt(originalEndColumn - 1);\r\n const modifiedChar = originalLine.charCodeAt(modifiedEndColumn - 1);\r\n if (originalChar !== modifiedChar) {\r\n break;\r\n }\r\n originalEndColumn++;\r\n modifiedEndColumn++;\r\n }\r\n if (originalEndColumn < originalMaxColumn || modifiedEndColumn < modifiedMaxColumn) {\r\n this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, originalEndColumn, originalMaxColumn, modifiedLineIndex + 1, modifiedEndColumn, modifiedMaxColumn);\r\n }\r\n }\r\n }\r\n originalLineIndex++;\r\n modifiedLineIndex++;\r\n }\r\n if (nextChange) {\r\n // Emit the actual change\r\n result.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, nextChange, this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));\r\n originalLineIndex += nextChange.originalLength;\r\n modifiedLineIndex += nextChange.modifiedLength;\r\n }\r\n }\r\n return {\r\n quitEarly: quitEarly,\r\n changes: result\r\n };\r\n }\r\n _pushTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {\r\n if (this._mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn)) {\r\n // Merged into previous\r\n return;\r\n }\r\n let charChanges = undefined;\r\n if (this.shouldComputeCharChanges) {\r\n charChanges = [new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn)];\r\n }\r\n result.push(new LineChange(originalLineNumber, originalLineNumber, modifiedLineNumber, modifiedLineNumber, charChanges));\r\n }\r\n _mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {\r\n const len = result.length;\r\n if (len === 0) {\r\n return false;\r\n }\r\n const prevChange = result[len - 1];\r\n if (prevChange.originalEndLineNumber === 0 || prevChange.modifiedEndLineNumber === 0) {\r\n // Don't merge with inserts/deletes\r\n return false;\r\n }\r\n if (prevChange.originalEndLineNumber + 1 === originalLineNumber && prevChange.modifiedEndLineNumber + 1 === modifiedLineNumber) {\r\n prevChange.originalEndLineNumber = originalLineNumber;\r\n prevChange.modifiedEndLineNumber = modifiedLineNumber;\r\n if (this.shouldComputeCharChanges && prevChange.charChanges) {\r\n prevChange.charChanges.push(new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn));\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nfunction getFirstNonBlankColumn(txt, defaultValue) {\r\n const r = strings.firstNonWhitespaceIndex(txt);\r\n if (r === -1) {\r\n return defaultValue;\r\n }\r\n return r + 1;\r\n}\r\nfunction getLastNonBlankColumn(txt, defaultValue) {\r\n const r = strings.lastNonWhitespaceIndex(txt);\r\n if (r === -1) {\r\n return defaultValue;\r\n }\r\n return r + 2;\r\n}\r\nfunction createContinueProcessingPredicate(maximumRuntime) {\r\n if (maximumRuntime === 0) {\r\n return () => true;\r\n }\r\n const startTime = Date.now();\r\n return () => {\r\n return Date.now() - startTime < maximumRuntime;\r\n };\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function toUint8(v) {\r\n if (v < 0) {\r\n return 0;\r\n }\r\n if (v > 255 /* MAX_UINT_8 */) {\r\n return 255 /* MAX_UINT_8 */;\r\n }\r\n return v | 0;\r\n}\r\nexport function toUint32(v) {\r\n if (v < 0) {\r\n return 0;\r\n }\r\n if (v > 4294967295 /* MAX_UINT_32 */) {\r\n return 4294967295 /* MAX_UINT_32 */;\r\n }\r\n return v | 0;\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { toUint32 } from '../../../base/common/uint.js';\r\nexport class PrefixSumIndexOfResult {\r\n constructor(index, remainder) {\r\n this.index = index;\r\n this.remainder = remainder;\r\n }\r\n}\r\nexport class PrefixSumComputer {\r\n constructor(values) {\r\n this.values = values;\r\n this.prefixSum = new Uint32Array(values.length);\r\n this.prefixSumValidIndex = new Int32Array(1);\r\n this.prefixSumValidIndex[0] = -1;\r\n }\r\n insertValues(insertIndex, insertValues) {\r\n insertIndex = toUint32(insertIndex);\r\n const oldValues = this.values;\r\n const oldPrefixSum = this.prefixSum;\r\n const insertValuesLen = insertValues.length;\r\n if (insertValuesLen === 0) {\r\n return false;\r\n }\r\n this.values = new Uint32Array(oldValues.length + insertValuesLen);\r\n this.values.set(oldValues.subarray(0, insertIndex), 0);\r\n this.values.set(oldValues.subarray(insertIndex), insertIndex + insertValuesLen);\r\n this.values.set(insertValues, insertIndex);\r\n if (insertIndex - 1 < this.prefixSumValidIndex[0]) {\r\n this.prefixSumValidIndex[0] = insertIndex - 1;\r\n }\r\n this.prefixSum = new Uint32Array(this.values.length);\r\n if (this.prefixSumValidIndex[0] >= 0) {\r\n this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));\r\n }\r\n return true;\r\n }\r\n changeValue(index, value) {\r\n index = toUint32(index);\r\n value = toUint32(value);\r\n if (this.values[index] === value) {\r\n return false;\r\n }\r\n this.values[index] = value;\r\n if (index - 1 < this.prefixSumValidIndex[0]) {\r\n this.prefixSumValidIndex[0] = index - 1;\r\n }\r\n return true;\r\n }\r\n removeValues(startIndex, cnt) {\r\n startIndex = toUint32(startIndex);\r\n cnt = toUint32(cnt);\r\n const oldValues = this.values;\r\n const oldPrefixSum = this.prefixSum;\r\n if (startIndex >= oldValues.length) {\r\n return false;\r\n }\r\n let maxCnt = oldValues.length - startIndex;\r\n if (cnt >= maxCnt) {\r\n cnt = maxCnt;\r\n }\r\n if (cnt === 0) {\r\n return false;\r\n }\r\n this.values = new Uint32Array(oldValues.length - cnt);\r\n this.values.set(oldValues.subarray(0, startIndex), 0);\r\n this.values.set(oldValues.subarray(startIndex + cnt), startIndex);\r\n this.prefixSum = new Uint32Array(this.values.length);\r\n if (startIndex - 1 < this.prefixSumValidIndex[0]) {\r\n this.prefixSumValidIndex[0] = startIndex - 1;\r\n }\r\n if (this.prefixSumValidIndex[0] >= 0) {\r\n this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));\r\n }\r\n return true;\r\n }\r\n getTotalValue() {\r\n if (this.values.length === 0) {\r\n return 0;\r\n }\r\n return this._getAccumulatedValue(this.values.length - 1);\r\n }\r\n getAccumulatedValue(index) {\r\n if (index < 0) {\r\n return 0;\r\n }\r\n index = toUint32(index);\r\n return this._getAccumulatedValue(index);\r\n }\r\n _getAccumulatedValue(index) {\r\n if (index <= this.prefixSumValidIndex[0]) {\r\n return this.prefixSum[index];\r\n }\r\n let startIndex = this.prefixSumValidIndex[0] + 1;\r\n if (startIndex === 0) {\r\n this.prefixSum[0] = this.values[0];\r\n startIndex++;\r\n }\r\n if (index >= this.values.length) {\r\n index = this.values.length - 1;\r\n }\r\n for (let i = startIndex; i <= index; i++) {\r\n this.prefixSum[i] = this.prefixSum[i - 1] + this.values[i];\r\n }\r\n this.prefixSumValidIndex[0] = Math.max(this.prefixSumValidIndex[0], index);\r\n return this.prefixSum[index];\r\n }\r\n getIndexOf(accumulatedValue) {\r\n accumulatedValue = Math.floor(accumulatedValue); //@perf\r\n // Compute all sums (to get a fully valid prefixSum)\r\n this.getTotalValue();\r\n let low = 0;\r\n let high = this.values.length - 1;\r\n let mid = 0;\r\n let midStop = 0;\r\n let midStart = 0;\r\n while (low <= high) {\r\n mid = low + ((high - low) / 2) | 0;\r\n midStop = this.prefixSum[mid];\r\n midStart = midStop - this.values[mid];\r\n if (accumulatedValue < midStart) {\r\n high = mid - 1;\r\n }\r\n else if (accumulatedValue >= midStop) {\r\n low = mid + 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return new PrefixSumIndexOfResult(mid, accumulatedValue - midStart);\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { splitLines } from '../../../base/common/strings.js';\r\nimport { Position } from '../core/position.js';\r\nimport { PrefixSumComputer } from '../viewModel/prefixSumComputer.js';\r\nexport class MirrorTextModel {\r\n constructor(uri, lines, eol, versionId) {\r\n this._uri = uri;\r\n this._lines = lines;\r\n this._eol = eol;\r\n this._versionId = versionId;\r\n this._lineStarts = null;\r\n this._cachedTextValue = null;\r\n }\r\n dispose() {\r\n this._lines.length = 0;\r\n }\r\n get version() {\r\n return this._versionId;\r\n }\r\n getText() {\r\n if (this._cachedTextValue === null) {\r\n this._cachedTextValue = this._lines.join(this._eol);\r\n }\r\n return this._cachedTextValue;\r\n }\r\n onEvents(e) {\r\n if (e.eol && e.eol !== this._eol) {\r\n this._eol = e.eol;\r\n this._lineStarts = null;\r\n }\r\n // Update my lines\r\n const changes = e.changes;\r\n for (const change of changes) {\r\n this._acceptDeleteRange(change.range);\r\n this._acceptInsertText(new Position(change.range.startLineNumber, change.range.startColumn), change.text);\r\n }\r\n this._versionId = e.versionId;\r\n this._cachedTextValue = null;\r\n }\r\n _ensureLineStarts() {\r\n if (!this._lineStarts) {\r\n const eolLength = this._eol.length;\r\n const linesLength = this._lines.length;\r\n const lineStartValues = new Uint32Array(linesLength);\r\n for (let i = 0; i < linesLength; i++) {\r\n lineStartValues[i] = this._lines[i].length + eolLength;\r\n }\r\n this._lineStarts = new PrefixSumComputer(lineStartValues);\r\n }\r\n }\r\n /**\r\n * All changes to a line's text go through this method\r\n */\r\n _setLineText(lineIndex, newValue) {\r\n this._lines[lineIndex] = newValue;\r\n if (this._lineStarts) {\r\n // update prefix sum\r\n this._lineStarts.changeValue(lineIndex, this._lines[lineIndex].length + this._eol.length);\r\n }\r\n }\r\n _acceptDeleteRange(range) {\r\n if (range.startLineNumber === range.endLineNumber) {\r\n if (range.startColumn === range.endColumn) {\r\n // Nothing to delete\r\n return;\r\n }\r\n // Delete text on the affected line\r\n this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)\r\n + this._lines[range.startLineNumber - 1].substring(range.endColumn - 1));\r\n return;\r\n }\r\n // Take remaining text on last line and append it to remaining text on first line\r\n this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)\r\n + this._lines[range.endLineNumber - 1].substring(range.endColumn - 1));\r\n // Delete middle lines\r\n this._lines.splice(range.startLineNumber, range.endLineNumber - range.startLineNumber);\r\n if (this._lineStarts) {\r\n // update prefix sum\r\n this._lineStarts.removeValues(range.startLineNumber, range.endLineNumber - range.startLineNumber);\r\n }\r\n }\r\n _acceptInsertText(position, insertText) {\r\n if (insertText.length === 0) {\r\n // Nothing to insert\r\n return;\r\n }\r\n let insertLines = splitLines(insertText);\r\n if (insertLines.length === 1) {\r\n // Inserting text on one line\r\n this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)\r\n + insertLines[0]\r\n + this._lines[position.lineNumber - 1].substring(position.column - 1));\r\n return;\r\n }\r\n // Append overflowing text from first line to the end of text to insert\r\n insertLines[insertLines.length - 1] += this._lines[position.lineNumber - 1].substring(position.column - 1);\r\n // Delete overflowing text from first line and insert text on first line\r\n this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)\r\n + insertLines[0]);\r\n // Insert new lines & store lengths\r\n let newLengths = new Uint32Array(insertLines.length - 1);\r\n for (let i = 1; i < insertLines.length; i++) {\r\n this._lines.splice(position.lineNumber + i - 1, 0, insertLines[i]);\r\n newLengths[i - 1] = insertLines[i].length + this._eol.length;\r\n }\r\n if (this._lineStarts) {\r\n // update prefix sum\r\n this._lineStarts.insertValues(position.lineNumber, newLengths);\r\n }\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\\\|;:\\'\",.<>/?';\r\n/**\r\n * Create a word definition regular expression based on default word separators.\r\n * Optionally provide allowed separators that should be included in words.\r\n *\r\n * The default would look like this:\r\n * /(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)/g\r\n */\r\nfunction createWordRegExp(allowInWords = '') {\r\n let source = '(-?\\\\d*\\\\.\\\\d\\\\w*)|([^';\r\n for (const sep of USUAL_WORD_SEPARATORS) {\r\n if (allowInWords.indexOf(sep) >= 0) {\r\n continue;\r\n }\r\n source += '\\\\' + sep;\r\n }\r\n source += '\\\\s]+)';\r\n return new RegExp(source, 'g');\r\n}\r\n// catches numbers (including floating numbers) in the first group, and alphanum in the second\r\nexport const DEFAULT_WORD_REGEXP = createWordRegExp();\r\nexport function ensureValidWordDefinition(wordDefinition) {\r\n let result = DEFAULT_WORD_REGEXP;\r\n if (wordDefinition && (wordDefinition instanceof RegExp)) {\r\n if (!wordDefinition.global) {\r\n let flags = 'g';\r\n if (wordDefinition.ignoreCase) {\r\n flags += 'i';\r\n }\r\n if (wordDefinition.multiline) {\r\n flags += 'm';\r\n }\r\n if (wordDefinition.unicode) {\r\n flags += 'u';\r\n }\r\n result = new RegExp(wordDefinition.source, flags);\r\n }\r\n else {\r\n result = wordDefinition;\r\n }\r\n }\r\n result.lastIndex = 0;\r\n return result;\r\n}\r\nconst _defaultConfig = {\r\n maxLen: 1000,\r\n windowSize: 15,\r\n timeBudget: 150\r\n};\r\nexport function getWordAtText(column, wordDefinition, text, textOffset, config = _defaultConfig) {\r\n if (text.length > config.maxLen) {\r\n // don't throw strings that long at the regexp\r\n // but use a sub-string in which a word must occur\r\n let start = column - config.maxLen / 2;\r\n if (start < 0) {\r\n start = 0;\r\n }\r\n else {\r\n textOffset += start;\r\n }\r\n text = text.substring(start, column + config.maxLen / 2);\r\n return getWordAtText(column, wordDefinition, text, textOffset, config);\r\n }\r\n const t1 = Date.now();\r\n const pos = column - 1 - textOffset;\r\n let prevRegexIndex = -1;\r\n let match = null;\r\n for (let i = 1;; i++) {\r\n // check time budget\r\n if (Date.now() - t1 >= config.timeBudget) {\r\n break;\r\n }\r\n // reset the index at which the regexp should start matching, also know where it\r\n // should stop so that subsequent search don't repeat previous searches\r\n const regexIndex = pos - config.windowSize * i;\r\n wordDefinition.lastIndex = Math.max(0, regexIndex);\r\n const thisMatch = _findRegexMatchEnclosingPosition(wordDefinition, text, pos, prevRegexIndex);\r\n if (!thisMatch && match) {\r\n // stop: we have something\r\n break;\r\n }\r\n match = thisMatch;\r\n // stop: searched at start\r\n if (regexIndex <= 0) {\r\n break;\r\n }\r\n prevRegexIndex = regexIndex;\r\n }\r\n if (match) {\r\n let result = {\r\n word: match[0],\r\n startColumn: textOffset + 1 + match.index,\r\n endColumn: textOffset + 1 + match.index + match[0].length\r\n };\r\n wordDefinition.lastIndex = 0;\r\n return result;\r\n }\r\n return null;\r\n}\r\nfunction _findRegexMatchEnclosingPosition(wordDefinition, text, pos, stopPos) {\r\n let match;\r\n while (match = wordDefinition.exec(text)) {\r\n const matchIndex = match.index || 0;\r\n if (matchIndex <= pos && wordDefinition.lastIndex >= pos) {\r\n return match;\r\n }\r\n else if (stopPos > 0 && matchIndex > stopPos) {\r\n return null;\r\n }\r\n }\r\n return null;\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { toUint8 } from '../../../base/common/uint.js';\r\n/**\r\n * A fast character classifier that uses a compact array for ASCII values.\r\n */\r\nexport class CharacterClassifier {\r\n constructor(_defaultValue) {\r\n let defaultValue = toUint8(_defaultValue);\r\n this._defaultValue = defaultValue;\r\n this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);\r\n this._map = new Map();\r\n }\r\n static _createAsciiMap(defaultValue) {\r\n let asciiMap = new Uint8Array(256);\r\n for (let i = 0; i < 256; i++) {\r\n asciiMap[i] = defaultValue;\r\n }\r\n return asciiMap;\r\n }\r\n set(charCode, _value) {\r\n let value = toUint8(_value);\r\n if (charCode >= 0 && charCode < 256) {\r\n this._asciiMap[charCode] = value;\r\n }\r\n else {\r\n this._map.set(charCode, value);\r\n }\r\n }\r\n get(charCode) {\r\n if (charCode >= 0 && charCode < 256) {\r\n return this._asciiMap[charCode];\r\n }\r\n else {\r\n return (this._map.get(charCode) || this._defaultValue);\r\n }\r\n }\r\n}\r\nexport class CharacterSet {\r\n constructor() {\r\n this._actual = new CharacterClassifier(0 /* False */);\r\n }\r\n add(charCode) {\r\n this._actual.set(charCode, 1 /* True */);\r\n }\r\n has(charCode) {\r\n return (this._actual.get(charCode) === 1 /* True */);\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CharacterClassifier } from '../core/characterClassifier.js';\r\nexport class Uint8Matrix {\r\n constructor(rows, cols, defaultValue) {\r\n const data = new Uint8Array(rows * cols);\r\n for (let i = 0, len = rows * cols; i < len; i++) {\r\n data[i] = defaultValue;\r\n }\r\n this._data = data;\r\n this.rows = rows;\r\n this.cols = cols;\r\n }\r\n get(row, col) {\r\n return this._data[row * this.cols + col];\r\n }\r\n set(row, col, value) {\r\n this._data[row * this.cols + col] = value;\r\n }\r\n}\r\nexport class StateMachine {\r\n constructor(edges) {\r\n let maxCharCode = 0;\r\n let maxState = 0 /* Invalid */;\r\n for (let i = 0, len = edges.length; i < len; i++) {\r\n let [from, chCode, to] = edges[i];\r\n if (chCode > maxCharCode) {\r\n maxCharCode = chCode;\r\n }\r\n if (from > maxState) {\r\n maxState = from;\r\n }\r\n if (to > maxState) {\r\n maxState = to;\r\n }\r\n }\r\n maxCharCode++;\r\n maxState++;\r\n let states = new Uint8Matrix(maxState, maxCharCode, 0 /* Invalid */);\r\n for (let i = 0, len = edges.length; i < len; i++) {\r\n let [from, chCode, to] = edges[i];\r\n states.set(from, chCode, to);\r\n }\r\n this._states = states;\r\n this._maxCharCode = maxCharCode;\r\n }\r\n nextState(currentState, chCode) {\r\n if (chCode < 0 || chCode >= this._maxCharCode) {\r\n return 0 /* Invalid */;\r\n }\r\n return this._states.get(currentState, chCode);\r\n }\r\n}\r\n// State machine for http:// or https:// or file://\r\nlet _stateMachine = null;\r\nfunction getStateMachine() {\r\n if (_stateMachine === null) {\r\n _stateMachine = new StateMachine([\r\n [1 /* Start */, 104 /* h */, 2 /* H */],\r\n [1 /* Start */, 72 /* H */, 2 /* H */],\r\n [1 /* Start */, 102 /* f */, 6 /* F */],\r\n [1 /* Start */, 70 /* F */, 6 /* F */],\r\n [2 /* H */, 116 /* t */, 3 /* HT */],\r\n [2 /* H */, 84 /* T */, 3 /* HT */],\r\n [3 /* HT */, 116 /* t */, 4 /* HTT */],\r\n [3 /* HT */, 84 /* T */, 4 /* HTT */],\r\n [4 /* HTT */, 112 /* p */, 5 /* HTTP */],\r\n [4 /* HTT */, 80 /* P */, 5 /* HTTP */],\r\n [5 /* HTTP */, 115 /* s */, 9 /* BeforeColon */],\r\n [5 /* HTTP */, 83 /* S */, 9 /* BeforeColon */],\r\n [5 /* HTTP */, 58 /* Colon */, 10 /* AfterColon */],\r\n [6 /* F */, 105 /* i */, 7 /* FI */],\r\n [6 /* F */, 73 /* I */, 7 /* FI */],\r\n [7 /* FI */, 108 /* l */, 8 /* FIL */],\r\n [7 /* FI */, 76 /* L */, 8 /* FIL */],\r\n [8 /* FIL */, 101 /* e */, 9 /* BeforeColon */],\r\n [8 /* FIL */, 69 /* E */, 9 /* BeforeColon */],\r\n [9 /* BeforeColon */, 58 /* Colon */, 10 /* AfterColon */],\r\n [10 /* AfterColon */, 47 /* Slash */, 11 /* AlmostThere */],\r\n [11 /* AlmostThere */, 47 /* Slash */, 12 /* End */],\r\n ]);\r\n }\r\n return _stateMachine;\r\n}\r\nlet _classifier = null;\r\nfunction getClassifier() {\r\n if (_classifier === null) {\r\n _classifier = new CharacterClassifier(0 /* None */);\r\n const FORCE_TERMINATION_CHARACTERS = ' \\t<>\\'\\\"、。。、,.:;‘〈「『〔([{「」}])〕』」〉’`~…';\r\n for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {\r\n _classifier.set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), 1 /* ForceTermination */);\r\n }\r\n const CANNOT_END_WITH_CHARACTERS = '.,;';\r\n for (let i = 0; i < CANNOT_END_WITH_CHARACTERS.length; i++) {\r\n _classifier.set(CANNOT_END_WITH_CHARACTERS.charCodeAt(i), 2 /* CannotEndIn */);\r\n }\r\n }\r\n return _classifier;\r\n}\r\nexport class LinkComputer {\r\n static _createLink(classifier, line, lineNumber, linkBeginIndex, linkEndIndex) {\r\n // Do not allow to end link in certain characters...\r\n let lastIncludedCharIndex = linkEndIndex - 1;\r\n do {\r\n const chCode = line.charCodeAt(lastIncludedCharIndex);\r\n const chClass = classifier.get(chCode);\r\n if (chClass !== 2 /* CannotEndIn */) {\r\n break;\r\n }\r\n lastIncludedCharIndex--;\r\n } while (lastIncludedCharIndex > linkBeginIndex);\r\n // Handle links enclosed in parens, square brackets and curlys.\r\n if (linkBeginIndex > 0) {\r\n const charCodeBeforeLink = line.charCodeAt(linkBeginIndex - 1);\r\n const lastCharCodeInLink = line.charCodeAt(lastIncludedCharIndex);\r\n if ((charCodeBeforeLink === 40 /* OpenParen */ && lastCharCodeInLink === 41 /* CloseParen */)\r\n || (charCodeBeforeLink === 91 /* OpenSquareBracket */ && lastCharCodeInLink === 93 /* CloseSquareBracket */)\r\n || (charCodeBeforeLink === 123 /* OpenCurlyBrace */ && lastCharCodeInLink === 125 /* CloseCurlyBrace */)) {\r\n // Do not end in ) if ( is before the link start\r\n // Do not end in ] if [ is before the link start\r\n // Do not end in } if { is before the link start\r\n lastIncludedCharIndex--;\r\n }\r\n }\r\n return {\r\n range: {\r\n startLineNumber: lineNumber,\r\n startColumn: linkBeginIndex + 1,\r\n endLineNumber: lineNumber,\r\n endColumn: lastIncludedCharIndex + 2\r\n },\r\n url: line.substring(linkBeginIndex, lastIncludedCharIndex + 1)\r\n };\r\n }\r\n static computeLinks(model, stateMachine = getStateMachine()) {\r\n const classifier = getClassifier();\r\n let result = [];\r\n for (let i = 1, lineCount = model.getLineCount(); i <= lineCount; i++) {\r\n const line = model.getLineContent(i);\r\n const len = line.length;\r\n let j = 0;\r\n let linkBeginIndex = 0;\r\n let linkBeginChCode = 0;\r\n let state = 1 /* Start */;\r\n let hasOpenParens = false;\r\n let hasOpenSquareBracket = false;\r\n let inSquareBrackets = false;\r\n let hasOpenCurlyBracket = false;\r\n while (j < len) {\r\n let resetStateMachine = false;\r\n const chCode = line.charCodeAt(j);\r\n if (state === 13 /* Accept */) {\r\n let chClass;\r\n switch (chCode) {\r\n case 40 /* OpenParen */:\r\n hasOpenParens = true;\r\n chClass = 0 /* None */;\r\n break;\r\n case 41 /* CloseParen */:\r\n chClass = (hasOpenParens ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n case 91 /* OpenSquareBracket */:\r\n inSquareBrackets = true;\r\n hasOpenSquareBracket = true;\r\n chClass = 0 /* None */;\r\n break;\r\n case 93 /* CloseSquareBracket */:\r\n inSquareBrackets = false;\r\n chClass = (hasOpenSquareBracket ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n case 123 /* OpenCurlyBrace */:\r\n hasOpenCurlyBracket = true;\r\n chClass = 0 /* None */;\r\n break;\r\n case 125 /* CloseCurlyBrace */:\r\n chClass = (hasOpenCurlyBracket ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n /* The following three rules make it that ' or \" or ` are allowed inside links if the link began with a different one */\r\n case 39 /* SingleQuote */:\r\n chClass = (linkBeginChCode === 34 /* DoubleQuote */ || linkBeginChCode === 96 /* BackTick */) ? 0 /* None */ : 1 /* ForceTermination */;\r\n break;\r\n case 34 /* DoubleQuote */:\r\n chClass = (linkBeginChCode === 39 /* SingleQuote */ || linkBeginChCode === 96 /* BackTick */) ? 0 /* None */ : 1 /* ForceTermination */;\r\n break;\r\n case 96 /* BackTick */:\r\n chClass = (linkBeginChCode === 39 /* SingleQuote */ || linkBeginChCode === 34 /* DoubleQuote */) ? 0 /* None */ : 1 /* ForceTermination */;\r\n break;\r\n case 42 /* Asterisk */:\r\n // `*` terminates a link if the link began with `*`\r\n chClass = (linkBeginChCode === 42 /* Asterisk */) ? 1 /* ForceTermination */ : 0 /* None */;\r\n break;\r\n case 124 /* Pipe */:\r\n // `|` terminates a link if the link began with `|`\r\n chClass = (linkBeginChCode === 124 /* Pipe */) ? 1 /* ForceTermination */ : 0 /* None */;\r\n break;\r\n case 32 /* Space */:\r\n // ` ` allow space in between [ and ]\r\n chClass = (inSquareBrackets ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n default:\r\n chClass = classifier.get(chCode);\r\n }\r\n // Check if character terminates link\r\n if (chClass === 1 /* ForceTermination */) {\r\n result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));\r\n resetStateMachine = true;\r\n }\r\n }\r\n else if (state === 12 /* End */) {\r\n let chClass;\r\n if (chCode === 91 /* OpenSquareBracket */) {\r\n // Allow for the authority part to contain ipv6 addresses which contain [ and ]\r\n hasOpenSquareBracket = true;\r\n chClass = 0 /* None */;\r\n }\r\n else {\r\n chClass = classifier.get(chCode);\r\n }\r\n // Check if character terminates link\r\n if (chClass === 1 /* ForceTermination */) {\r\n resetStateMachine = true;\r\n }\r\n else {\r\n state = 13 /* Accept */;\r\n }\r\n }\r\n else {\r\n state = stateMachine.nextState(state, chCode);\r\n if (state === 0 /* Invalid */) {\r\n resetStateMachine = true;\r\n }\r\n }\r\n if (resetStateMachine) {\r\n state = 1 /* Start */;\r\n hasOpenParens = false;\r\n hasOpenSquareBracket = false;\r\n hasOpenCurlyBracket = false;\r\n // Record where the link started\r\n linkBeginIndex = j + 1;\r\n linkBeginChCode = chCode;\r\n }\r\n j++;\r\n }\r\n if (state === 13 /* Accept */) {\r\n result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, len));\r\n }\r\n }\r\n return result;\r\n }\r\n}\r\n/**\r\n * Returns an array of all links contains in the provided\r\n * document. *Note* that this operation is computational\r\n * expensive and should not run in the UI thread.\r\n */\r\nexport function computeLinks(model) {\r\n if (!model || typeof model.getLineCount !== 'function' || typeof model.getLineContent !== 'function') {\r\n // Unknown caller!\r\n return [];\r\n }\r\n return LinkComputer.computeLinks(model);\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class BasicInplaceReplace {\r\n constructor() {\r\n this._defaultValueSet = [\r\n ['true', 'false'],\r\n ['True', 'False'],\r\n ['Private', 'Public', 'Friend', 'ReadOnly', 'Partial', 'Protected', 'WriteOnly'],\r\n ['public', 'protected', 'private'],\r\n ];\r\n }\r\n navigateValueSet(range1, text1, range2, text2, up) {\r\n if (range1 && text1) {\r\n let result = this.doNavigateValueSet(text1, up);\r\n if (result) {\r\n return {\r\n range: range1,\r\n value: result\r\n };\r\n }\r\n }\r\n if (range2 && text2) {\r\n let result = this.doNavigateValueSet(text2, up);\r\n if (result) {\r\n return {\r\n range: range2,\r\n value: result\r\n };\r\n }\r\n }\r\n return null;\r\n }\r\n doNavigateValueSet(text, up) {\r\n let numberResult = this.numberReplace(text, up);\r\n if (numberResult !== null) {\r\n return numberResult;\r\n }\r\n return this.textReplace(text, up);\r\n }\r\n numberReplace(value, up) {\r\n let precision = Math.pow(10, value.length - (value.lastIndexOf('.') + 1));\r\n let n1 = Number(value);\r\n let n2 = parseFloat(value);\r\n if (!isNaN(n1) && !isNaN(n2) && n1 === n2) {\r\n if (n1 === 0 && !up) {\r\n return null; // don't do negative\r\n //\t\t\t} else if(n1 === 9 && up) {\r\n //\t\t\t\treturn null; // don't insert 10 into a number\r\n }\r\n else {\r\n n1 = Math.floor(n1 * precision);\r\n n1 += up ? precision : -precision;\r\n return String(n1 / precision);\r\n }\r\n }\r\n return null;\r\n }\r\n textReplace(value, up) {\r\n return this.valueSetsReplace(this._defaultValueSet, value, up);\r\n }\r\n valueSetsReplace(valueSets, value, up) {\r\n let result = null;\r\n for (let i = 0, len = valueSets.length; result === null && i < len; i++) {\r\n result = this.valueSetReplace(valueSets[i], value, up);\r\n }\r\n return result;\r\n }\r\n valueSetReplace(valueSet, value, up) {\r\n let idx = valueSet.indexOf(value);\r\n if (idx >= 0) {\r\n idx += up ? +1 : -1;\r\n if (idx < 0) {\r\n idx = valueSet.length - 1;\r\n }\r\n else {\r\n idx %= valueSet.length;\r\n }\r\n return valueSet[idx];\r\n }\r\n return null;\r\n }\r\n}\r\nBasicInplaceReplace.INSTANCE = new BasicInplaceReplace();\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nclass Node {\r\n constructor(element) {\r\n this.element = element;\r\n this.next = Node.Undefined;\r\n this.prev = Node.Undefined;\r\n }\r\n}\r\nNode.Undefined = new Node(undefined);\r\nexport class LinkedList {\r\n constructor() {\r\n this._first = Node.Undefined;\r\n this._last = Node.Undefined;\r\n this._size = 0;\r\n }\r\n get size() {\r\n return this._size;\r\n }\r\n isEmpty() {\r\n return this._first === Node.Undefined;\r\n }\r\n clear() {\r\n let node = this._first;\r\n while (node !== Node.Undefined) {\r\n const next = node.next;\r\n node.prev = Node.Undefined;\r\n node.next = Node.Undefined;\r\n node = next;\r\n }\r\n this._first = Node.Undefined;\r\n this._last = Node.Undefined;\r\n this._size = 0;\r\n }\r\n unshift(element) {\r\n return this._insert(element, false);\r\n }\r\n push(element) {\r\n return this._insert(element, true);\r\n }\r\n _insert(element, atTheEnd) {\r\n const newNode = new Node(element);\r\n if (this._first === Node.Undefined) {\r\n this._first = newNode;\r\n this._last = newNode;\r\n }\r\n else if (atTheEnd) {\r\n // push\r\n const oldLast = this._last;\r\n this._last = newNode;\r\n newNode.prev = oldLast;\r\n oldLast.next = newNode;\r\n }\r\n else {\r\n // unshift\r\n const oldFirst = this._first;\r\n this._first = newNode;\r\n newNode.next = oldFirst;\r\n oldFirst.prev = newNode;\r\n }\r\n this._size += 1;\r\n let didRemove = false;\r\n return () => {\r\n if (!didRemove) {\r\n didRemove = true;\r\n this._remove(newNode);\r\n }\r\n };\r\n }\r\n shift() {\r\n if (this._first === Node.Undefined) {\r\n return undefined;\r\n }\r\n else {\r\n const res = this._first.element;\r\n this._remove(this._first);\r\n return res;\r\n }\r\n }\r\n pop() {\r\n if (this._last === Node.Undefined) {\r\n return undefined;\r\n }\r\n else {\r\n const res = this._last.element;\r\n this._remove(this._last);\r\n return res;\r\n }\r\n }\r\n _remove(node) {\r\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\r\n // middle\r\n const anchor = node.prev;\r\n anchor.next = node.next;\r\n node.next.prev = anchor;\r\n }\r\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\r\n // only node\r\n this._first = Node.Undefined;\r\n this._last = Node.Undefined;\r\n }\r\n else if (node.next === Node.Undefined) {\r\n // last\r\n this._last = this._last.prev;\r\n this._last.next = Node.Undefined;\r\n }\r\n else if (node.prev === Node.Undefined) {\r\n // first\r\n this._first = this._first.next;\r\n this._first.prev = Node.Undefined;\r\n }\r\n // done\r\n this._size -= 1;\r\n }\r\n *[Symbol.iterator]() {\r\n let node = this._first;\r\n while (node !== Node.Undefined) {\r\n yield node.element;\r\n node = node.next;\r\n }\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { globals } from './platform.js';\r\nconst hasPerformanceNow = (globals.performance && typeof globals.performance.now === 'function');\r\nexport class StopWatch {\r\n constructor(highResolution) {\r\n this._highResolution = hasPerformanceNow && highResolution;\r\n this._startTime = this._now();\r\n this._stopTime = -1;\r\n }\r\n static create(highResolution = true) {\r\n return new StopWatch(highResolution);\r\n }\r\n stop() {\r\n this._stopTime = this._now();\r\n }\r\n elapsed() {\r\n if (this._stopTime !== -1) {\r\n return this._stopTime - this._startTime;\r\n }\r\n return this._now() - this._startTime;\r\n }\r\n _now() {\r\n return this._highResolution ? globals.performance.now() : Date.now();\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { onUnexpectedError } from './errors.js';\r\nimport { Disposable, combinedDisposable, DisposableStore } from './lifecycle.js';\r\nimport { LinkedList } from './linkedList.js';\r\nimport { StopWatch } from './stopwatch.js';\r\nexport var Event;\r\n(function (Event) {\r\n Event.None = () => Disposable.None;\r\n /**\r\n * Given an event, returns another event which only fires once.\r\n */\r\n function once(event) {\r\n return (listener, thisArgs = null, disposables) => {\r\n // we need this, in case the event fires during the listener call\r\n let didFire = false;\r\n let result;\r\n result = event(e => {\r\n if (didFire) {\r\n return;\r\n }\r\n else if (result) {\r\n result.dispose();\r\n }\r\n else {\r\n didFire = true;\r\n }\r\n return listener.call(thisArgs, e);\r\n }, null, disposables);\r\n if (didFire) {\r\n result.dispose();\r\n }\r\n return result;\r\n };\r\n }\r\n Event.once = once;\r\n /**\r\n * Given an event and a `map` function, returns another event which maps each element\r\n * through the mapping function.\r\n */\r\n function map(event, map) {\r\n return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables));\r\n }\r\n Event.map = map;\r\n /**\r\n * Given an event and an `each` function, returns another identical event and calls\r\n * the `each` function per each element.\r\n */\r\n function forEach(event, each) {\r\n return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables));\r\n }\r\n Event.forEach = forEach;\r\n function filter(event, filter) {\r\n return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables));\r\n }\r\n Event.filter = filter;\r\n /**\r\n * Given an event, returns the same event but typed as `Event<void>`.\r\n */\r\n function signal(event) {\r\n return event;\r\n }\r\n Event.signal = signal;\r\n function any(...events) {\r\n return (listener, thisArgs = null, disposables) => combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e), null, disposables)));\r\n }\r\n Event.any = any;\r\n /**\r\n * Given an event and a `merge` function, returns another event which maps each element\r\n * and the cumulative result through the `merge` function. Similar to `map`, but with memory.\r\n */\r\n function reduce(event, merge, initial) {\r\n let output = initial;\r\n return map(event, e => {\r\n output = merge(output, e);\r\n return output;\r\n });\r\n }\r\n Event.reduce = reduce;\r\n /**\r\n * Given a chain of event processing functions (filter, map, etc), each\r\n * function will be invoked per event & per listener. Snapshotting an event\r\n * chain allows each function to be invoked just once per event.\r\n */\r\n function snapshot(event) {\r\n let listener;\r\n const emitter = new Emitter({\r\n onFirstListenerAdd() {\r\n listener = event(emitter.fire, emitter);\r\n },\r\n onLastListenerRemove() {\r\n listener.dispose();\r\n }\r\n });\r\n return emitter.event;\r\n }\r\n Event.snapshot = snapshot;\r\n function debounce(event, merge, delay = 100, leading = false, leakWarningThreshold) {\r\n let subscription;\r\n let output = undefined;\r\n let handle = undefined;\r\n let numDebouncedCalls = 0;\r\n const emitter = new Emitter({\r\n leakWarningThreshold,\r\n onFirstListenerAdd() {\r\n subscription = event(cur => {\r\n numDebouncedCalls++;\r\n output = merge(output, cur);\r\n if (leading && !handle) {\r\n emitter.fire(output);\r\n output = undefined;\r\n }\r\n clearTimeout(handle);\r\n handle = setTimeout(() => {\r\n const _output = output;\r\n output = undefined;\r\n handle = undefined;\r\n if (!leading || numDebouncedCalls > 1) {\r\n emitter.fire(_output);\r\n }\r\n numDebouncedCalls = 0;\r\n }, delay);\r\n });\r\n },\r\n onLastListenerRemove() {\r\n subscription.dispose();\r\n }\r\n });\r\n return emitter.event;\r\n }\r\n Event.debounce = debounce;\r\n /**\r\n * Given an event, it returns another event which fires only once and as soon as\r\n * the input event emits. The event data is the number of millis it took for the\r\n * event to fire.\r\n */\r\n function stopwatch(event) {\r\n const start = new Date().getTime();\r\n return map(once(event), _ => new Date().getTime() - start);\r\n }\r\n Event.stopwatch = stopwatch;\r\n /**\r\n * Given an event, it returns another event which fires only when the event\r\n * element changes.\r\n */\r\n function latch(event, equals = (a, b) => a === b) {\r\n let firstCall = true;\r\n let cache;\r\n return filter(event, value => {\r\n const shouldEmit = firstCall || !equals(value, cache);\r\n firstCall = false;\r\n cache = value;\r\n return shouldEmit;\r\n });\r\n }\r\n Event.latch = latch;\r\n /**\r\n * Given an event, it returns another event which fires only when the event\r\n * element changes.\r\n */\r\n function split(event, isT) {\r\n return [\r\n Event.filter(event, isT),\r\n Event.filter(event, e => !isT(e)),\r\n ];\r\n }\r\n Event.split = split;\r\n /**\r\n * Buffers the provided event until a first listener comes\r\n * along, at which point fire all the events at once and\r\n * pipe the event from then on.\r\n *\r\n * ```typescript\r\n * const emitter = new Emitter<number>();\r\n * const event = emitter.event;\r\n * const bufferedEvent = buffer(event);\r\n *\r\n * emitter.fire(1);\r\n * emitter.fire(2);\r\n * emitter.fire(3);\r\n * // nothing...\r\n *\r\n * const listener = bufferedEvent(num => console.log(num));\r\n * // 1, 2, 3\r\n *\r\n * emitter.fire(4);\r\n * // 4\r\n * ```\r\n */\r\n function buffer(event, nextTick = false, _buffer = []) {\r\n let buffer = _buffer.slice();\r\n let listener = event(e => {\r\n if (buffer) {\r\n buffer.push(e);\r\n }\r\n else {\r\n emitter.fire(e);\r\n }\r\n });\r\n const flush = () => {\r\n if (buffer) {\r\n buffer.forEach(e => emitter.fire(e));\r\n }\r\n buffer = null;\r\n };\r\n const emitter = new Emitter({\r\n onFirstListenerAdd() {\r\n if (!listener) {\r\n listener = event(e => emitter.fire(e));\r\n }\r\n },\r\n onFirstListenerDidAdd() {\r\n if (buffer) {\r\n if (nextTick) {\r\n setTimeout(flush);\r\n }\r\n else {\r\n flush();\r\n }\r\n }\r\n },\r\n onLastListenerRemove() {\r\n if (listener) {\r\n listener.dispose();\r\n }\r\n listener = null;\r\n }\r\n });\r\n return emitter.event;\r\n }\r\n Event.buffer = buffer;\r\n class ChainableEvent {\r\n constructor(event) {\r\n this.event = event;\r\n }\r\n map(fn) {\r\n return new ChainableEvent(map(this.event, fn));\r\n }\r\n forEach(fn) {\r\n return new ChainableEvent(forEach(this.event, fn));\r\n }\r\n filter(fn) {\r\n return new ChainableEvent(filter(this.event, fn));\r\n }\r\n reduce(merge, initial) {\r\n return new ChainableEvent(reduce(this.event, merge, initial));\r\n }\r\n latch() {\r\n return new ChainableEvent(latch(this.event));\r\n }\r\n debounce(merge, delay = 100, leading = false, leakWarningThreshold) {\r\n return new ChainableEvent(debounce(this.event, merge, delay, leading, leakWarningThreshold));\r\n }\r\n on(listener, thisArgs, disposables) {\r\n return this.event(listener, thisArgs, disposables);\r\n }\r\n once(listener, thisArgs, disposables) {\r\n return once(this.event)(listener, thisArgs, disposables);\r\n }\r\n }\r\n function chain(event) {\r\n return new ChainableEvent(event);\r\n }\r\n Event.chain = chain;\r\n function fromNodeEventEmitter(emitter, eventName, map = id => id) {\r\n const fn = (...args) => result.fire(map(...args));\r\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\r\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\r\n const result = new Emitter({ onFirstListenerAdd, onLastListenerRemove });\r\n return result.event;\r\n }\r\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\r\n function fromDOMEventEmitter(emitter, eventName, map = id => id) {\r\n const fn = (...args) => result.fire(map(...args));\r\n const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\r\n const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\r\n const result = new Emitter({ onFirstListenerAdd, onLastListenerRemove });\r\n return result.event;\r\n }\r\n Event.fromDOMEventEmitter = fromDOMEventEmitter;\r\n function fromPromise(promise) {\r\n const emitter = new Emitter();\r\n let shouldEmit = false;\r\n promise\r\n .then(undefined, () => null)\r\n .then(() => {\r\n if (!shouldEmit) {\r\n setTimeout(() => emitter.fire(undefined), 0);\r\n }\r\n else {\r\n emitter.fire(undefined);\r\n }\r\n });\r\n shouldEmit = true;\r\n return emitter.event;\r\n }\r\n Event.fromPromise = fromPromise;\r\n function toPromise(event) {\r\n return new Promise(resolve => once(event)(resolve));\r\n }\r\n Event.toPromise = toPromise;\r\n})(Event || (Event = {}));\r\nclass EventProfiling {\r\n constructor(name) {\r\n this._listenerCount = 0;\r\n this._invocationCount = 0;\r\n this._elapsedOverall = 0;\r\n this._name = `${name}_${EventProfiling._idPool++}`;\r\n }\r\n start(listenerCount) {\r\n this._stopWatch = new StopWatch(true);\r\n this._listenerCount = listenerCount;\r\n }\r\n stop() {\r\n if (this._stopWatch) {\r\n const elapsed = this._stopWatch.elapsed();\r\n this._elapsedOverall += elapsed;\r\n this._invocationCount += 1;\r\n console.info(`did FIRE ${this._name}: elapsed_ms: ${elapsed.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`);\r\n this._stopWatch = undefined;\r\n }\r\n }\r\n}\r\nEventProfiling._idPool = 0;\r\nlet _globalLeakWarningThreshold = -1;\r\nclass LeakageMonitor {\r\n constructor(customThreshold, name = Math.random().toString(18).slice(2, 5)) {\r\n this.customThreshold = customThreshold;\r\n this.name = name;\r\n this._warnCountdown = 0;\r\n }\r\n dispose() {\r\n if (this._stacks) {\r\n this._stacks.clear();\r\n }\r\n }\r\n check(listenerCount) {\r\n let threshold = _globalLeakWarningThreshold;\r\n if (typeof this.customThreshold === 'number') {\r\n threshold = this.customThreshold;\r\n }\r\n if (threshold <= 0 || listenerCount < threshold) {\r\n return undefined;\r\n }\r\n if (!this._stacks) {\r\n this._stacks = new Map();\r\n }\r\n const stack = new Error().stack.split('\\n').slice(3).join('\\n');\r\n const count = (this._stacks.get(stack) || 0);\r\n this._stacks.set(stack, count + 1);\r\n this._warnCountdown -= 1;\r\n if (this._warnCountdown <= 0) {\r\n // only warn on first exceed and then every time the limit\r\n // is exceeded by 50% again\r\n this._warnCountdown = threshold * 0.5;\r\n // find most frequent listener and print warning\r\n let topStack;\r\n let topCount = 0;\r\n for (const [stack, count] of this._stacks) {\r\n if (!topStack || topCount < count) {\r\n topStack = stack;\r\n topCount = count;\r\n }\r\n }\r\n console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);\r\n console.warn(topStack);\r\n }\r\n return () => {\r\n const count = (this._stacks.get(stack) || 0);\r\n this._stacks.set(stack, count - 1);\r\n };\r\n }\r\n}\r\n/**\r\n * The Emitter can be used to expose an Event to the public\r\n * to fire it from the insides.\r\n * Sample:\r\n class Document {\r\n\r\n private readonly _onDidChange = new Emitter<(value:string)=>any>();\r\n\r\n public onDidChange = this._onDidChange.event;\r\n\r\n // getter-style\r\n // get onDidChange(): Event<(value:string)=>any> {\r\n // \treturn this._onDidChange.event;\r\n // }\r\n\r\n private _doIt() {\r\n //...\r\n this._onDidChange.fire(value);\r\n }\r\n }\r\n */\r\nexport class Emitter {\r\n constructor(options) {\r\n var _a;\r\n this._disposed = false;\r\n this._options = options;\r\n this._leakageMon = _globalLeakWarningThreshold > 0 ? new LeakageMonitor(this._options && this._options.leakWarningThreshold) : undefined;\r\n this._perfMon = ((_a = this._options) === null || _a === void 0 ? void 0 : _a._profName) ? new EventProfiling(this._options._profName) : undefined;\r\n }\r\n /**\r\n * For the public to allow to subscribe\r\n * to events from this Emitter\r\n */\r\n get event() {\r\n if (!this._event) {\r\n this._event = (listener, thisArgs, disposables) => {\r\n var _a;\r\n if (!this._listeners) {\r\n this._listeners = new LinkedList();\r\n }\r\n const firstListener = this._listeners.isEmpty();\r\n if (firstListener && this._options && this._options.onFirstListenerAdd) {\r\n this._options.onFirstListenerAdd(this);\r\n }\r\n const remove = this._listeners.push(!thisArgs ? listener : [listener, thisArgs]);\r\n if (firstListener && this._options && this._options.onFirstListenerDidAdd) {\r\n this._options.onFirstListenerDidAdd(this);\r\n }\r\n if (this._options && this._options.onListenerDidAdd) {\r\n this._options.onListenerDidAdd(this, listener, thisArgs);\r\n }\r\n // check and record this emitter for potential leakage\r\n const removeMonitor = (_a = this._leakageMon) === null || _a === void 0 ? void 0 : _a.check(this._listeners.size);\r\n let result;\r\n result = {\r\n dispose: () => {\r\n if (removeMonitor) {\r\n removeMonitor();\r\n }\r\n result.dispose = Emitter._noop;\r\n if (!this._disposed) {\r\n remove();\r\n if (this._options && this._options.onLastListenerRemove) {\r\n const hasListeners = (this._listeners && !this._listeners.isEmpty());\r\n if (!hasListeners) {\r\n this._options.onLastListenerRemove(this);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n if (disposables instanceof DisposableStore) {\r\n disposables.add(result);\r\n }\r\n else if (Array.isArray(disposables)) {\r\n disposables.push(result);\r\n }\r\n return result;\r\n };\r\n }\r\n return this._event;\r\n }\r\n /**\r\n * To be kept private to fire an event to\r\n * subscribers\r\n */\r\n fire(event) {\r\n var _a, _b;\r\n if (this._listeners) {\r\n // put all [listener,event]-pairs into delivery queue\r\n // then emit all event. an inner/nested event might be\r\n // the driver of this\r\n if (!this._deliveryQueue) {\r\n this._deliveryQueue = new LinkedList();\r\n }\r\n for (let listener of this._listeners) {\r\n this._deliveryQueue.push([listener, event]);\r\n }\r\n // start/stop performance insight collection\r\n (_a = this._perfMon) === null || _a === void 0 ? void 0 : _a.start(this._deliveryQueue.size);\r\n while (this._deliveryQueue.size > 0) {\r\n const [listener, event] = this._deliveryQueue.shift();\r\n try {\r\n if (typeof listener === 'function') {\r\n listener.call(undefined, event);\r\n }\r\n else {\r\n listener[0].call(listener[1], event);\r\n }\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n }\r\n }\r\n (_b = this._perfMon) === null || _b === void 0 ? void 0 : _b.stop();\r\n }\r\n }\r\n dispose() {\r\n var _a, _b, _c, _d, _e;\r\n if (!this._disposed) {\r\n this._disposed = true;\r\n (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.clear();\r\n (_b = this._deliveryQueue) === null || _b === void 0 ? void 0 : _b.clear();\r\n (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.onLastListenerRemove) === null || _d === void 0 ? void 0 : _d.call(_c);\r\n (_e = this._leakageMon) === null || _e === void 0 ? void 0 : _e.dispose();\r\n }\r\n }\r\n}\r\nEmitter._noop = function () { };\r\nexport class PauseableEmitter extends Emitter {\r\n constructor(options) {\r\n super(options);\r\n this._isPaused = 0;\r\n this._eventQueue = new LinkedList();\r\n this._mergeFn = options === null || options === void 0 ? void 0 : options.merge;\r\n }\r\n pause() {\r\n this._isPaused++;\r\n }\r\n resume() {\r\n if (this._isPaused !== 0 && --this._isPaused === 0) {\r\n if (this._mergeFn) {\r\n // use the merge function to create a single composite\r\n // event. make a copy in case firing pauses this emitter\r\n const events = Array.from(this._eventQueue);\r\n this._eventQueue.clear();\r\n super.fire(this._mergeFn(events));\r\n }\r\n else {\r\n // no merging, fire each event individually and test\r\n // that this emitter isn't paused halfway through\r\n while (!this._isPaused && this._eventQueue.size !== 0) {\r\n super.fire(this._eventQueue.shift());\r\n }\r\n }\r\n }\r\n }\r\n fire(event) {\r\n if (this._listeners) {\r\n if (this._isPaused !== 0) {\r\n this._eventQueue.push(event);\r\n }\r\n else {\r\n super.fire(event);\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * The EventBufferer is useful in situations in which you want\r\n * to delay firing your events during some code.\r\n * You can wrap that code and be sure that the event will not\r\n * be fired during that wrap.\r\n *\r\n * ```\r\n * const emitter: Emitter;\r\n * const delayer = new EventDelayer();\r\n * const delayedEvent = delayer.wrapEvent(emitter.event);\r\n *\r\n * delayedEvent(console.log);\r\n *\r\n * delayer.bufferEvents(() => {\r\n * emitter.fire(); // event will not be fired yet\r\n * });\r\n *\r\n * // event will only be fired at this point\r\n * ```\r\n */\r\nexport class EventBufferer {\r\n constructor() {\r\n this.buffers = [];\r\n }\r\n wrapEvent(event) {\r\n return (listener, thisArgs, disposables) => {\r\n return event(i => {\r\n const buffer = this.buffers[this.buffers.length - 1];\r\n if (buffer) {\r\n buffer.push(() => listener.call(thisArgs, i));\r\n }\r\n else {\r\n listener.call(thisArgs, i);\r\n }\r\n }, undefined, disposables);\r\n };\r\n }\r\n bufferEvents(fn) {\r\n const buffer = [];\r\n this.buffers.push(buffer);\r\n const r = fn();\r\n this.buffers.pop();\r\n buffer.forEach(flush => flush());\r\n return r;\r\n }\r\n}\r\n/**\r\n * A Relay is an event forwarder which functions as a replugabble event pipe.\r\n * Once created, you can connect an input event to it and it will simply forward\r\n * events from that input event through its own `event` property. The `input`\r\n * can be changed at any point in time.\r\n */\r\nexport class Relay {\r\n constructor() {\r\n this.listening = false;\r\n this.inputEvent = Event.None;\r\n this.inputEventListener = Disposable.None;\r\n this.emitter = new Emitter({\r\n onFirstListenerDidAdd: () => {\r\n this.listening = true;\r\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\r\n },\r\n onLastListenerRemove: () => {\r\n this.listening = false;\r\n this.inputEventListener.dispose();\r\n }\r\n });\r\n this.event = this.emitter.event;\r\n }\r\n set input(event) {\r\n this.inputEvent = event;\r\n if (this.listening) {\r\n this.inputEventListener.dispose();\r\n this.inputEventListener = event(this.emitter.fire, this.emitter);\r\n }\r\n }\r\n dispose() {\r\n this.inputEventListener.dispose();\r\n this.emitter.dispose();\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter, Event } from './event.js';\r\nconst shortcutEvent = Object.freeze(function (callback, context) {\r\n const handle = setTimeout(callback.bind(context), 0);\r\n return { dispose() { clearTimeout(handle); } };\r\n});\r\nexport var CancellationToken;\r\n(function (CancellationToken) {\r\n function isCancellationToken(thing) {\r\n if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\r\n return true;\r\n }\r\n if (thing instanceof MutableToken) {\r\n return true;\r\n }\r\n if (!thing || typeof thing !== 'object') {\r\n return false;\r\n }\r\n return typeof thing.isCancellationRequested === 'boolean'\r\n && typeof thing.onCancellationRequested === 'function';\r\n }\r\n CancellationToken.isCancellationToken = isCancellationToken;\r\n CancellationToken.None = Object.freeze({\r\n isCancellationRequested: false,\r\n onCancellationRequested: Event.None\r\n });\r\n CancellationToken.Cancelled = Object.freeze({\r\n isCancellationRequested: true,\r\n onCancellationRequested: shortcutEvent\r\n });\r\n})(CancellationToken || (CancellationToken = {}));\r\nclass MutableToken {\r\n constructor() {\r\n this._isCancelled = false;\r\n this._emitter = null;\r\n }\r\n cancel() {\r\n if (!this._isCancelled) {\r\n this._isCancelled = true;\r\n if (this._emitter) {\r\n this._emitter.fire(undefined);\r\n this.dispose();\r\n }\r\n }\r\n }\r\n get isCancellationRequested() {\r\n return this._isCancelled;\r\n }\r\n get onCancellationRequested() {\r\n if (this._isCancelled) {\r\n return shortcutEvent;\r\n }\r\n if (!this._emitter) {\r\n this._emitter = new Emitter();\r\n }\r\n return this._emitter.event;\r\n }\r\n dispose() {\r\n if (this._emitter) {\r\n this._emitter.dispose();\r\n this._emitter = null;\r\n }\r\n }\r\n}\r\nexport class CancellationTokenSource {\r\n constructor(parent) {\r\n this._token = undefined;\r\n this._parentListener = undefined;\r\n this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\r\n }\r\n get token() {\r\n if (!this._token) {\r\n // be lazy and create the token only when\r\n // actually needed\r\n this._token = new MutableToken();\r\n }\r\n return this._token;\r\n }\r\n cancel() {\r\n if (!this._token) {\r\n // save an object by returning the default\r\n // cancelled token when cancellation happens\r\n // before someone asks for the token\r\n this._token = CancellationToken.Cancelled;\r\n }\r\n else if (this._token instanceof MutableToken) {\r\n // actually cancel\r\n this._token.cancel();\r\n }\r\n }\r\n dispose(cancel = false) {\r\n if (cancel) {\r\n this.cancel();\r\n }\r\n if (this._parentListener) {\r\n this._parentListener.dispose();\r\n }\r\n if (!this._token) {\r\n // ensure to initialize with an empty token if we had none\r\n this._token = CancellationToken.None;\r\n }\r\n else if (this._token instanceof MutableToken) {\r\n // actually dispose\r\n this._token.dispose();\r\n }\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { illegalArgument } from './errors.js';\r\nclass KeyCodeStrMap {\r\n constructor() {\r\n this._keyCodeToStr = [];\r\n this._strToKeyCode = Object.create(null);\r\n }\r\n define(keyCode, str) {\r\n this._keyCodeToStr[keyCode] = str;\r\n this._strToKeyCode[str.toLowerCase()] = keyCode;\r\n }\r\n keyCodeToStr(keyCode) {\r\n return this._keyCodeToStr[keyCode];\r\n }\r\n strToKeyCode(str) {\r\n return this._strToKeyCode[str.toLowerCase()] || 0 /* Unknown */;\r\n }\r\n}\r\nconst uiMap = new KeyCodeStrMap();\r\nconst userSettingsUSMap = new KeyCodeStrMap();\r\nconst userSettingsGeneralMap = new KeyCodeStrMap();\r\n(function () {\r\n function define(keyCode, uiLabel, usUserSettingsLabel = uiLabel, generalUserSettingsLabel = usUserSettingsLabel) {\r\n uiMap.define(keyCode, uiLabel);\r\n userSettingsUSMap.define(keyCode, usUserSettingsLabel);\r\n userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel);\r\n }\r\n define(0 /* Unknown */, 'unknown');\r\n define(1 /* Backspace */, 'Backspace');\r\n define(2 /* Tab */, 'Tab');\r\n define(3 /* Enter */, 'Enter');\r\n define(4 /* Shift */, 'Shift');\r\n define(5 /* Ctrl */, 'Ctrl');\r\n define(6 /* Alt */, 'Alt');\r\n define(7 /* PauseBreak */, 'PauseBreak');\r\n define(8 /* CapsLock */, 'CapsLock');\r\n define(9 /* Escape */, 'Escape');\r\n define(10 /* Space */, 'Space');\r\n define(11 /* PageUp */, 'PageUp');\r\n define(12 /* PageDown */, 'PageDown');\r\n define(13 /* End */, 'End');\r\n define(14 /* Home */, 'Home');\r\n define(15 /* LeftArrow */, 'LeftArrow', 'Left');\r\n define(16 /* UpArrow */, 'UpArrow', 'Up');\r\n define(17 /* RightArrow */, 'RightArrow', 'Right');\r\n define(18 /* DownArrow */, 'DownArrow', 'Down');\r\n define(19 /* Insert */, 'Insert');\r\n define(20 /* Delete */, 'Delete');\r\n define(21 /* KEY_0 */, '0');\r\n define(22 /* KEY_1 */, '1');\r\n define(23 /* KEY_2 */, '2');\r\n define(24 /* KEY_3 */, '3');\r\n define(25 /* KEY_4 */, '4');\r\n define(26 /* KEY_5 */, '5');\r\n define(27 /* KEY_6 */, '6');\r\n define(28 /* KEY_7 */, '7');\r\n define(29 /* KEY_8 */, '8');\r\n define(30 /* KEY_9 */, '9');\r\n define(31 /* KEY_A */, 'A');\r\n define(32 /* KEY_B */, 'B');\r\n define(33 /* KEY_C */, 'C');\r\n define(34 /* KEY_D */, 'D');\r\n define(35 /* KEY_E */, 'E');\r\n define(36 /* KEY_F */, 'F');\r\n define(37 /* KEY_G */, 'G');\r\n define(38 /* KEY_H */, 'H');\r\n define(39 /* KEY_I */, 'I');\r\n define(40 /* KEY_J */, 'J');\r\n define(41 /* KEY_K */, 'K');\r\n define(42 /* KEY_L */, 'L');\r\n define(43 /* KEY_M */, 'M');\r\n define(44 /* KEY_N */, 'N');\r\n define(45 /* KEY_O */, 'O');\r\n define(46 /* KEY_P */, 'P');\r\n define(47 /* KEY_Q */, 'Q');\r\n define(48 /* KEY_R */, 'R');\r\n define(49 /* KEY_S */, 'S');\r\n define(50 /* KEY_T */, 'T');\r\n define(51 /* KEY_U */, 'U');\r\n define(52 /* KEY_V */, 'V');\r\n define(53 /* KEY_W */, 'W');\r\n define(54 /* KEY_X */, 'X');\r\n define(55 /* KEY_Y */, 'Y');\r\n define(56 /* KEY_Z */, 'Z');\r\n define(57 /* Meta */, 'Meta');\r\n define(58 /* ContextMenu */, 'ContextMenu');\r\n define(59 /* F1 */, 'F1');\r\n define(60 /* F2 */, 'F2');\r\n define(61 /* F3 */, 'F3');\r\n define(62 /* F4 */, 'F4');\r\n define(63 /* F5 */, 'F5');\r\n define(64 /* F6 */, 'F6');\r\n define(65 /* F7 */, 'F7');\r\n define(66 /* F8 */, 'F8');\r\n define(67 /* F9 */, 'F9');\r\n define(68 /* F10 */, 'F10');\r\n define(69 /* F11 */, 'F11');\r\n define(70 /* F12 */, 'F12');\r\n define(71 /* F13 */, 'F13');\r\n define(72 /* F14 */, 'F14');\r\n define(73 /* F15 */, 'F15');\r\n define(74 /* F16 */, 'F16');\r\n define(75 /* F17 */, 'F17');\r\n define(76 /* F18 */, 'F18');\r\n define(77 /* F19 */, 'F19');\r\n define(78 /* NumLock */, 'NumLock');\r\n define(79 /* ScrollLock */, 'ScrollLock');\r\n define(80 /* US_SEMICOLON */, ';', ';', 'OEM_1');\r\n define(81 /* US_EQUAL */, '=', '=', 'OEM_PLUS');\r\n define(82 /* US_COMMA */, ',', ',', 'OEM_COMMA');\r\n define(83 /* US_MINUS */, '-', '-', 'OEM_MINUS');\r\n define(84 /* US_DOT */, '.', '.', 'OEM_PERIOD');\r\n define(85 /* US_SLASH */, '/', '/', 'OEM_2');\r\n define(86 /* US_BACKTICK */, '`', '`', 'OEM_3');\r\n define(110 /* ABNT_C1 */, 'ABNT_C1');\r\n define(111 /* ABNT_C2 */, 'ABNT_C2');\r\n define(87 /* US_OPEN_SQUARE_BRACKET */, '[', '[', 'OEM_4');\r\n define(88 /* US_BACKSLASH */, '\\\\', '\\\\', 'OEM_5');\r\n define(89 /* US_CLOSE_SQUARE_BRACKET */, ']', ']', 'OEM_6');\r\n define(90 /* US_QUOTE */, '\\'', '\\'', 'OEM_7');\r\n define(91 /* OEM_8 */, 'OEM_8');\r\n define(92 /* OEM_102 */, 'OEM_102');\r\n define(93 /* NUMPAD_0 */, 'NumPad0');\r\n define(94 /* NUMPAD_1 */, 'NumPad1');\r\n define(95 /* NUMPAD_2 */, 'NumPad2');\r\n define(96 /* NUMPAD_3 */, 'NumPad3');\r\n define(97 /* NUMPAD_4 */, 'NumPad4');\r\n define(98 /* NUMPAD_5 */, 'NumPad5');\r\n define(99 /* NUMPAD_6 */, 'NumPad6');\r\n define(100 /* NUMPAD_7 */, 'NumPad7');\r\n define(101 /* NUMPAD_8 */, 'NumPad8');\r\n define(102 /* NUMPAD_9 */, 'NumPad9');\r\n define(103 /* NUMPAD_MULTIPLY */, 'NumPad_Multiply');\r\n define(104 /* NUMPAD_ADD */, 'NumPad_Add');\r\n define(105 /* NUMPAD_SEPARATOR */, 'NumPad_Separator');\r\n define(106 /* NUMPAD_SUBTRACT */, 'NumPad_Subtract');\r\n define(107 /* NUMPAD_DECIMAL */, 'NumPad_Decimal');\r\n define(108 /* NUMPAD_DIVIDE */, 'NumPad_Divide');\r\n})();\r\nexport var KeyCodeUtils;\r\n(function (KeyCodeUtils) {\r\n function toString(keyCode) {\r\n return uiMap.keyCodeToStr(keyCode);\r\n }\r\n KeyCodeUtils.toString = toString;\r\n function fromString(key) {\r\n return uiMap.strToKeyCode(key);\r\n }\r\n KeyCodeUtils.fromString = fromString;\r\n function toUserSettingsUS(keyCode) {\r\n return userSettingsUSMap.keyCodeToStr(keyCode);\r\n }\r\n KeyCodeUtils.toUserSettingsUS = toUserSettingsUS;\r\n function toUserSettingsGeneral(keyCode) {\r\n return userSettingsGeneralMap.keyCodeToStr(keyCode);\r\n }\r\n KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral;\r\n function fromUserSettings(key) {\r\n return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\r\n }\r\n KeyCodeUtils.fromUserSettings = fromUserSettings;\r\n})(KeyCodeUtils || (KeyCodeUtils = {}));\r\nexport function KeyChord(firstPart, secondPart) {\r\n const chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\r\n return (firstPart | chordPart) >>> 0;\r\n}\r\nexport function createKeybinding(keybinding, OS) {\r\n if (keybinding === 0) {\r\n return null;\r\n }\r\n const firstPart = (keybinding & 0x0000FFFF) >>> 0;\r\n const chordPart = (keybinding & 0xFFFF0000) >>> 16;\r\n if (chordPart !== 0) {\r\n return new ChordKeybinding([\r\n createSimpleKeybinding(firstPart, OS),\r\n createSimpleKeybinding(chordPart, OS)\r\n ]);\r\n }\r\n return new ChordKeybinding([createSimpleKeybinding(firstPart, OS)]);\r\n}\r\nexport function createSimpleKeybinding(keybinding, OS) {\r\n const ctrlCmd = (keybinding & 2048 /* CtrlCmd */ ? true : false);\r\n const winCtrl = (keybinding & 256 /* WinCtrl */ ? true : false);\r\n const ctrlKey = (OS === 2 /* Macintosh */ ? winCtrl : ctrlCmd);\r\n const shiftKey = (keybinding & 1024 /* Shift */ ? true : false);\r\n const altKey = (keybinding & 512 /* Alt */ ? true : false);\r\n const metaKey = (OS === 2 /* Macintosh */ ? ctrlCmd : winCtrl);\r\n const keyCode = (keybinding & 255 /* KeyCode */);\r\n return new SimpleKeybinding(ctrlKey, shiftKey, altKey, metaKey, keyCode);\r\n}\r\nexport class SimpleKeybinding {\r\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {\r\n this.ctrlKey = ctrlKey;\r\n this.shiftKey = shiftKey;\r\n this.altKey = altKey;\r\n this.metaKey = metaKey;\r\n this.keyCode = keyCode;\r\n }\r\n equals(other) {\r\n return (this.ctrlKey === other.ctrlKey\r\n && this.shiftKey === other.shiftKey\r\n && this.altKey === other.altKey\r\n && this.metaKey === other.metaKey\r\n && this.keyCode === other.keyCode);\r\n }\r\n isModifierKey() {\r\n return (this.keyCode === 0 /* Unknown */\r\n || this.keyCode === 5 /* Ctrl */\r\n || this.keyCode === 57 /* Meta */\r\n || this.keyCode === 6 /* Alt */\r\n || this.keyCode === 4 /* Shift */);\r\n }\r\n toChord() {\r\n return new ChordKeybinding([this]);\r\n }\r\n /**\r\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\r\n */\r\n isDuplicateModifierCase() {\r\n return ((this.ctrlKey && this.keyCode === 5 /* Ctrl */)\r\n || (this.shiftKey && this.keyCode === 4 /* Shift */)\r\n || (this.altKey && this.keyCode === 6 /* Alt */)\r\n || (this.metaKey && this.keyCode === 57 /* Meta */));\r\n }\r\n}\r\nexport class ChordKeybinding {\r\n constructor(parts) {\r\n if (parts.length === 0) {\r\n throw illegalArgument(`parts`);\r\n }\r\n this.parts = parts;\r\n }\r\n}\r\nexport class ResolvedKeybindingPart {\r\n constructor(ctrlKey, shiftKey, altKey, metaKey, kbLabel, kbAriaLabel) {\r\n this.ctrlKey = ctrlKey;\r\n this.shiftKey = shiftKey;\r\n this.altKey = altKey;\r\n this.metaKey = metaKey;\r\n this.keyLabel = kbLabel;\r\n this.keyAriaLabel = kbAriaLabel;\r\n }\r\n}\r\n/**\r\n * A resolved keybinding. Can be a simple keybinding or a chord keybinding.\r\n */\r\nexport class ResolvedKeybinding {\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.\r\nexport var AccessibilitySupport;\r\n(function (AccessibilitySupport) {\r\n /**\r\n * This should be the browser case where it is not known if a screen reader is attached or no.\r\n */\r\n AccessibilitySupport[AccessibilitySupport[\"Unknown\"] = 0] = \"Unknown\";\r\n AccessibilitySupport[AccessibilitySupport[\"Disabled\"] = 1] = \"Disabled\";\r\n AccessibilitySupport[AccessibilitySupport[\"Enabled\"] = 2] = \"Enabled\";\r\n})(AccessibilitySupport || (AccessibilitySupport = {}));\r\nexport var CompletionItemInsertTextRule;\r\n(function (CompletionItemInsertTextRule) {\r\n /**\r\n * Adjust whitespace/indentation of multiline insert texts to\r\n * match the current line indentation.\r\n */\r\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"KeepWhitespace\"] = 1] = \"KeepWhitespace\";\r\n /**\r\n * `insertText` is a snippet.\r\n */\r\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"InsertAsSnippet\"] = 4] = \"InsertAsSnippet\";\r\n})(CompletionItemInsertTextRule || (CompletionItemInsertTextRule = {}));\r\nexport var CompletionItemKind;\r\n(function (CompletionItemKind) {\r\n CompletionItemKind[CompletionItemKind[\"Method\"] = 0] = \"Method\";\r\n CompletionItemKind[CompletionItemKind[\"Function\"] = 1] = \"Function\";\r\n CompletionItemKind[CompletionItemKind[\"Constructor\"] = 2] = \"Constructor\";\r\n CompletionItemKind[CompletionItemKind[\"Field\"] = 3] = \"Field\";\r\n CompletionItemKind[CompletionItemKind[\"Variable\"] = 4] = \"Variable\";\r\n CompletionItemKind[CompletionItemKind[\"Class\"] = 5] = \"Class\";\r\n CompletionItemKind[CompletionItemKind[\"Struct\"] = 6] = \"Struct\";\r\n CompletionItemKind[CompletionItemKind[\"Interface\"] = 7] = \"Interface\";\r\n CompletionItemKind[CompletionItemKind[\"Module\"] = 8] = \"Module\";\r\n CompletionItemKind[CompletionItemKind[\"Property\"] = 9] = \"Property\";\r\n CompletionItemKind[CompletionItemKind[\"Event\"] = 10] = \"Event\";\r\n CompletionItemKind[CompletionItemKind[\"Operator\"] = 11] = \"Operator\";\r\n CompletionItemKind[CompletionItemKind[\"Unit\"] = 12] = \"Unit\";\r\n CompletionItemKind[CompletionItemKind[\"Value\"] = 13] = \"Value\";\r\n CompletionItemKind[CompletionItemKind[\"Constant\"] = 14] = \"Constant\";\r\n CompletionItemKind[CompletionItemKind[\"Enum\"] = 15] = \"Enum\";\r\n CompletionItemKind[CompletionItemKind[\"EnumMember\"] = 16] = \"EnumMember\";\r\n CompletionItemKind[CompletionItemKind[\"Keyword\"] = 17] = \"Keyword\";\r\n CompletionItemKind[CompletionItemKind[\"Text\"] = 18] = \"Text\";\r\n CompletionItemKind[CompletionItemKind[\"Color\"] = 19] = \"Color\";\r\n CompletionItemKind[CompletionItemKind[\"File\"] = 20] = \"File\";\r\n CompletionItemKind[CompletionItemKind[\"Reference\"] = 21] = \"Reference\";\r\n CompletionItemKind[CompletionItemKind[\"Customcolor\"] = 22] = \"Customcolor\";\r\n CompletionItemKind[CompletionItemKind[\"Folder\"] = 23] = \"Folder\";\r\n CompletionItemKind[CompletionItemKind[\"TypeParameter\"] = 24] = \"TypeParameter\";\r\n CompletionItemKind[CompletionItemKind[\"User\"] = 25] = \"User\";\r\n CompletionItemKind[CompletionItemKind[\"Issue\"] = 26] = \"Issue\";\r\n CompletionItemKind[CompletionItemKind[\"Snippet\"] = 27] = \"Snippet\";\r\n})(CompletionItemKind || (CompletionItemKind = {}));\r\nexport var CompletionItemTag;\r\n(function (CompletionItemTag) {\r\n CompletionItemTag[CompletionItemTag[\"Deprecated\"] = 1] = \"Deprecated\";\r\n})(CompletionItemTag || (CompletionItemTag = {}));\r\n/**\r\n * How a suggest provider was triggered.\r\n */\r\nexport var CompletionTriggerKind;\r\n(function (CompletionTriggerKind) {\r\n CompletionTriggerKind[CompletionTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\r\n CompletionTriggerKind[CompletionTriggerKind[\"TriggerCharacter\"] = 1] = \"TriggerCharacter\";\r\n CompletionTriggerKind[CompletionTriggerKind[\"TriggerForIncompleteCompletions\"] = 2] = \"TriggerForIncompleteCompletions\";\r\n})(CompletionTriggerKind || (CompletionTriggerKind = {}));\r\n/**\r\n * A positioning preference for rendering content widgets.\r\n */\r\nexport var ContentWidgetPositionPreference;\r\n(function (ContentWidgetPositionPreference) {\r\n /**\r\n * Place the content widget exactly at a position\r\n */\r\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"EXACT\"] = 0] = \"EXACT\";\r\n /**\r\n * Place the content widget above a position\r\n */\r\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"ABOVE\"] = 1] = \"ABOVE\";\r\n /**\r\n * Place the content widget below a position\r\n */\r\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"BELOW\"] = 2] = \"BELOW\";\r\n})(ContentWidgetPositionPreference || (ContentWidgetPositionPreference = {}));\r\n/**\r\n * Describes the reason the cursor has changed its position.\r\n */\r\nexport var CursorChangeReason;\r\n(function (CursorChangeReason) {\r\n /**\r\n * Unknown or not set.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"NotSet\"] = 0] = \"NotSet\";\r\n /**\r\n * A `model.setValue()` was called.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"ContentFlush\"] = 1] = \"ContentFlush\";\r\n /**\r\n * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"RecoverFromMarkers\"] = 2] = \"RecoverFromMarkers\";\r\n /**\r\n * There was an explicit user gesture.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Explicit\"] = 3] = \"Explicit\";\r\n /**\r\n * There was a Paste.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Paste\"] = 4] = \"Paste\";\r\n /**\r\n * There was an Undo.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Undo\"] = 5] = \"Undo\";\r\n /**\r\n * There was a Redo.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Redo\"] = 6] = \"Redo\";\r\n})(CursorChangeReason || (CursorChangeReason = {}));\r\n/**\r\n * The default end of line to use when instantiating models.\r\n */\r\nexport var DefaultEndOfLine;\r\n(function (DefaultEndOfLine) {\r\n /**\r\n * Use line feed (\\n) as the end of line character.\r\n */\r\n DefaultEndOfLine[DefaultEndOfLine[\"LF\"] = 1] = \"LF\";\r\n /**\r\n * Use carriage return and line feed (\\r\\n) as the end of line character.\r\n */\r\n DefaultEndOfLine[DefaultEndOfLine[\"CRLF\"] = 2] = \"CRLF\";\r\n})(DefaultEndOfLine || (DefaultEndOfLine = {}));\r\n/**\r\n * A document highlight kind.\r\n */\r\nexport var DocumentHighlightKind;\r\n(function (DocumentHighlightKind) {\r\n /**\r\n * A textual occurrence.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Text\"] = 0] = \"Text\";\r\n /**\r\n * Read-access of a symbol, like reading a variable.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Read\"] = 1] = \"Read\";\r\n /**\r\n * Write-access of a symbol, like writing to a variable.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Write\"] = 2] = \"Write\";\r\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\r\n/**\r\n * Configuration options for auto indentation in the editor\r\n */\r\nexport var EditorAutoIndentStrategy;\r\n(function (EditorAutoIndentStrategy) {\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"None\"] = 0] = \"None\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Keep\"] = 1] = \"Keep\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Brackets\"] = 2] = \"Brackets\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Advanced\"] = 3] = \"Advanced\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Full\"] = 4] = \"Full\";\r\n})(EditorAutoIndentStrategy || (EditorAutoIndentStrategy = {}));\r\nexport var EditorOption;\r\n(function (EditorOption) {\r\n EditorOption[EditorOption[\"acceptSuggestionOnCommitCharacter\"] = 0] = \"acceptSuggestionOnCommitCharacter\";\r\n EditorOption[EditorOption[\"acceptSuggestionOnEnter\"] = 1] = \"acceptSuggestionOnEnter\";\r\n EditorOption[EditorOption[\"accessibilitySupport\"] = 2] = \"accessibilitySupport\";\r\n EditorOption[EditorOption[\"accessibilityPageSize\"] = 3] = \"accessibilityPageSize\";\r\n EditorOption[EditorOption[\"ariaLabel\"] = 4] = \"ariaLabel\";\r\n EditorOption[EditorOption[\"autoClosingBrackets\"] = 5] = \"autoClosingBrackets\";\r\n EditorOption[EditorOption[\"autoClosingDelete\"] = 6] = \"autoClosingDelete\";\r\n EditorOption[EditorOption[\"autoClosingOvertype\"] = 7] = \"autoClosingOvertype\";\r\n EditorOption[EditorOption[\"autoClosingQuotes\"] = 8] = \"autoClosingQuotes\";\r\n EditorOption[EditorOption[\"autoIndent\"] = 9] = \"autoIndent\";\r\n EditorOption[EditorOption[\"automaticLayout\"] = 10] = \"automaticLayout\";\r\n EditorOption[EditorOption[\"autoSurround\"] = 11] = \"autoSurround\";\r\n EditorOption[EditorOption[\"codeLens\"] = 12] = \"codeLens\";\r\n EditorOption[EditorOption[\"codeLensFontFamily\"] = 13] = \"codeLensFontFamily\";\r\n EditorOption[EditorOption[\"codeLensFontSize\"] = 14] = \"codeLensFontSize\";\r\n EditorOption[EditorOption[\"colorDecorators\"] = 15] = \"colorDecorators\";\r\n EditorOption[EditorOption[\"columnSelection\"] = 16] = \"columnSelection\";\r\n EditorOption[EditorOption[\"comments\"] = 17] = \"comments\";\r\n EditorOption[EditorOption[\"contextmenu\"] = 18] = \"contextmenu\";\r\n EditorOption[EditorOption[\"copyWithSyntaxHighlighting\"] = 19] = \"copyWithSyntaxHighlighting\";\r\n EditorOption[EditorOption[\"cursorBlinking\"] = 20] = \"cursorBlinking\";\r\n EditorOption[EditorOption[\"cursorSmoothCaretAnimation\"] = 21] = \"cursorSmoothCaretAnimation\";\r\n EditorOption[EditorOption[\"cursorStyle\"] = 22] = \"cursorStyle\";\r\n EditorOption[EditorOption[\"cursorSurroundingLines\"] = 23] = \"cursorSurroundingLines\";\r\n EditorOption[EditorOption[\"cursorSurroundingLinesStyle\"] = 24] = \"cursorSurroundingLinesStyle\";\r\n EditorOption[EditorOption[\"cursorWidth\"] = 25] = \"cursorWidth\";\r\n EditorOption[EditorOption[\"disableLayerHinting\"] = 26] = \"disableLayerHinting\";\r\n EditorOption[EditorOption[\"disableMonospaceOptimizations\"] = 27] = \"disableMonospaceOptimizations\";\r\n EditorOption[EditorOption[\"domReadOnly\"] = 28] = \"domReadOnly\";\r\n EditorOption[EditorOption[\"dragAndDrop\"] = 29] = \"dragAndDrop\";\r\n EditorOption[EditorOption[\"emptySelectionClipboard\"] = 30] = \"emptySelectionClipboard\";\r\n EditorOption[EditorOption[\"extraEditorClassName\"] = 31] = \"extraEditorClassName\";\r\n EditorOption[EditorOption[\"fastScrollSensitivity\"] = 32] = \"fastScrollSensitivity\";\r\n EditorOption[EditorOption[\"find\"] = 33] = \"find\";\r\n EditorOption[EditorOption[\"fixedOverflowWidgets\"] = 34] = \"fixedOverflowWidgets\";\r\n EditorOption[EditorOption[\"folding\"] = 35] = \"folding\";\r\n EditorOption[EditorOption[\"foldingStrategy\"] = 36] = \"foldingStrategy\";\r\n EditorOption[EditorOption[\"foldingHighlight\"] = 37] = \"foldingHighlight\";\r\n EditorOption[EditorOption[\"unfoldOnClickAfterEndOfLine\"] = 38] = \"unfoldOnClickAfterEndOfLine\";\r\n EditorOption[EditorOption[\"fontFamily\"] = 39] = \"fontFamily\";\r\n EditorOption[EditorOption[\"fontInfo\"] = 40] = \"fontInfo\";\r\n EditorOption[EditorOption[\"fontLigatures\"] = 41] = \"fontLigatures\";\r\n EditorOption[EditorOption[\"fontSize\"] = 42] = \"fontSize\";\r\n EditorOption[EditorOption[\"fontWeight\"] = 43] = \"fontWeight\";\r\n EditorOption[EditorOption[\"formatOnPaste\"] = 44] = \"formatOnPaste\";\r\n EditorOption[EditorOption[\"formatOnType\"] = 45] = \"formatOnType\";\r\n EditorOption[EditorOption[\"glyphMargin\"] = 46] = \"glyphMargin\";\r\n EditorOption[EditorOption[\"gotoLocation\"] = 47] = \"gotoLocation\";\r\n EditorOption[EditorOption[\"hideCursorInOverviewRuler\"] = 48] = \"hideCursorInOverviewRuler\";\r\n EditorOption[EditorOption[\"highlightActiveIndentGuide\"] = 49] = \"highlightActiveIndentGuide\";\r\n EditorOption[EditorOption[\"hover\"] = 50] = \"hover\";\r\n EditorOption[EditorOption[\"inDiffEditor\"] = 51] = \"inDiffEditor\";\r\n EditorOption[EditorOption[\"inlineSuggest\"] = 52] = \"inlineSuggest\";\r\n EditorOption[EditorOption[\"letterSpacing\"] = 53] = \"letterSpacing\";\r\n EditorOption[EditorOption[\"lightbulb\"] = 54] = \"lightbulb\";\r\n EditorOption[EditorOption[\"lineDecorationsWidth\"] = 55] = \"lineDecorationsWidth\";\r\n EditorOption[EditorOption[\"lineHeight\"] = 56] = \"lineHeight\";\r\n EditorOption[EditorOption[\"lineNumbers\"] = 57] = \"lineNumbers\";\r\n EditorOption[EditorOption[\"lineNumbersMinChars\"] = 58] = \"lineNumbersMinChars\";\r\n EditorOption[EditorOption[\"linkedEditing\"] = 59] = \"linkedEditing\";\r\n EditorOption[EditorOption[\"links\"] = 60] = \"links\";\r\n EditorOption[EditorOption[\"matchBrackets\"] = 61] = \"matchBrackets\";\r\n EditorOption[EditorOption[\"minimap\"] = 62] = \"minimap\";\r\n EditorOption[EditorOption[\"mouseStyle\"] = 63] = \"mouseStyle\";\r\n EditorOption[EditorOption[\"mouseWheelScrollSensitivity\"] = 64] = \"mouseWheelScrollSensitivity\";\r\n EditorOption[EditorOption[\"mouseWheelZoom\"] = 65] = \"mouseWheelZoom\";\r\n EditorOption[EditorOption[\"multiCursorMergeOverlapping\"] = 66] = \"multiCursorMergeOverlapping\";\r\n EditorOption[EditorOption[\"multiCursorModifier\"] = 67] = \"multiCursorModifier\";\r\n EditorOption[EditorOption[\"multiCursorPaste\"] = 68] = \"multiCursorPaste\";\r\n EditorOption[EditorOption[\"occurrencesHighlight\"] = 69] = \"occurrencesHighlight\";\r\n EditorOption[EditorOption[\"overviewRulerBorder\"] = 70] = \"overviewRulerBorder\";\r\n EditorOption[EditorOption[\"overviewRulerLanes\"] = 71] = \"overviewRulerLanes\";\r\n EditorOption[EditorOption[\"padding\"] = 72] = \"padding\";\r\n EditorOption[EditorOption[\"parameterHints\"] = 73] = \"parameterHints\";\r\n EditorOption[EditorOption[\"peekWidgetDefaultFocus\"] = 74] = \"peekWidgetDefaultFocus\";\r\n EditorOption[EditorOption[\"definitionLinkOpensInPeek\"] = 75] = \"definitionLinkOpensInPeek\";\r\n EditorOption[EditorOption[\"quickSuggestions\"] = 76] = \"quickSuggestions\";\r\n EditorOption[EditorOption[\"quickSuggestionsDelay\"] = 77] = \"quickSuggestionsDelay\";\r\n EditorOption[EditorOption[\"readOnly\"] = 78] = \"readOnly\";\r\n EditorOption[EditorOption[\"renameOnType\"] = 79] = \"renameOnType\";\r\n EditorOption[EditorOption[\"renderControlCharacters\"] = 80] = \"renderControlCharacters\";\r\n EditorOption[EditorOption[\"renderIndentGuides\"] = 81] = \"renderIndentGuides\";\r\n EditorOption[EditorOption[\"renderFinalNewline\"] = 82] = \"renderFinalNewline\";\r\n EditorOption[EditorOption[\"renderLineHighlight\"] = 83] = \"renderLineHighlight\";\r\n EditorOption[EditorOption[\"renderLineHighlightOnlyWhenFocus\"] = 84] = \"renderLineHighlightOnlyWhenFocus\";\r\n EditorOption[EditorOption[\"renderValidationDecorations\"] = 85] = \"renderValidationDecorations\";\r\n EditorOption[EditorOption[\"renderWhitespace\"] = 86] = \"renderWhitespace\";\r\n EditorOption[EditorOption[\"revealHorizontalRightPadding\"] = 87] = \"revealHorizontalRightPadding\";\r\n EditorOption[EditorOption[\"roundedSelection\"] = 88] = \"roundedSelection\";\r\n EditorOption[EditorOption[\"rulers\"] = 89] = \"rulers\";\r\n EditorOption[EditorOption[\"scrollbar\"] = 90] = \"scrollbar\";\r\n EditorOption[EditorOption[\"scrollBeyondLastColumn\"] = 91] = \"scrollBeyondLastColumn\";\r\n EditorOption[EditorOption[\"scrollBeyondLastLine\"] = 92] = \"scrollBeyondLastLine\";\r\n EditorOption[EditorOption[\"scrollPredominantAxis\"] = 93] = \"scrollPredominantAxis\";\r\n EditorOption[EditorOption[\"selectionClipboard\"] = 94] = \"selectionClipboard\";\r\n EditorOption[EditorOption[\"selectionHighlight\"] = 95] = \"selectionHighlight\";\r\n EditorOption[EditorOption[\"selectOnLineNumbers\"] = 96] = \"selectOnLineNumbers\";\r\n EditorOption[EditorOption[\"showFoldingControls\"] = 97] = \"showFoldingControls\";\r\n EditorOption[EditorOption[\"showUnused\"] = 98] = \"showUnused\";\r\n EditorOption[EditorOption[\"snippetSuggestions\"] = 99] = \"snippetSuggestions\";\r\n EditorOption[EditorOption[\"smartSelect\"] = 100] = \"smartSelect\";\r\n EditorOption[EditorOption[\"smoothScrolling\"] = 101] = \"smoothScrolling\";\r\n EditorOption[EditorOption[\"stickyTabStops\"] = 102] = \"stickyTabStops\";\r\n EditorOption[EditorOption[\"stopRenderingLineAfter\"] = 103] = \"stopRenderingLineAfter\";\r\n EditorOption[EditorOption[\"suggest\"] = 104] = \"suggest\";\r\n EditorOption[EditorOption[\"suggestFontSize\"] = 105] = \"suggestFontSize\";\r\n EditorOption[EditorOption[\"suggestLineHeight\"] = 106] = \"suggestLineHeight\";\r\n EditorOption[EditorOption[\"suggestOnTriggerCharacters\"] = 107] = \"suggestOnTriggerCharacters\";\r\n EditorOption[EditorOption[\"suggestSelection\"] = 108] = \"suggestSelection\";\r\n EditorOption[EditorOption[\"tabCompletion\"] = 109] = \"tabCompletion\";\r\n EditorOption[EditorOption[\"tabIndex\"] = 110] = \"tabIndex\";\r\n EditorOption[EditorOption[\"unusualLineTerminators\"] = 111] = \"unusualLineTerminators\";\r\n EditorOption[EditorOption[\"useShadowDOM\"] = 112] = \"useShadowDOM\";\r\n EditorOption[EditorOption[\"useTabStops\"] = 113] = \"useTabStops\";\r\n EditorOption[EditorOption[\"wordSeparators\"] = 114] = \"wordSeparators\";\r\n EditorOption[EditorOption[\"wordWrap\"] = 115] = \"wordWrap\";\r\n EditorOption[EditorOption[\"wordWrapBreakAfterCharacters\"] = 116] = \"wordWrapBreakAfterCharacters\";\r\n EditorOption[EditorOption[\"wordWrapBreakBeforeCharacters\"] = 117] = \"wordWrapBreakBeforeCharacters\";\r\n EditorOption[EditorOption[\"wordWrapColumn\"] = 118] = \"wordWrapColumn\";\r\n EditorOption[EditorOption[\"wordWrapOverride1\"] = 119] = \"wordWrapOverride1\";\r\n EditorOption[EditorOption[\"wordWrapOverride2\"] = 120] = \"wordWrapOverride2\";\r\n EditorOption[EditorOption[\"wrappingIndent\"] = 121] = \"wrappingIndent\";\r\n EditorOption[EditorOption[\"wrappingStrategy\"] = 122] = \"wrappingStrategy\";\r\n EditorOption[EditorOption[\"showDeprecated\"] = 123] = \"showDeprecated\";\r\n EditorOption[EditorOption[\"inlayHints\"] = 124] = \"inlayHints\";\r\n EditorOption[EditorOption[\"editorClassName\"] = 125] = \"editorClassName\";\r\n EditorOption[EditorOption[\"pixelRatio\"] = 126] = \"pixelRatio\";\r\n EditorOption[EditorOption[\"tabFocusMode\"] = 127] = \"tabFocusMode\";\r\n EditorOption[EditorOption[\"layoutInfo\"] = 128] = \"layoutInfo\";\r\n EditorOption[EditorOption[\"wrappingInfo\"] = 129] = \"wrappingInfo\";\r\n})(EditorOption || (EditorOption = {}));\r\n/**\r\n * End of line character preference.\r\n */\r\nexport var EndOfLinePreference;\r\n(function (EndOfLinePreference) {\r\n /**\r\n * Use the end of line character identified in the text buffer.\r\n */\r\n EndOfLinePreference[EndOfLinePreference[\"TextDefined\"] = 0] = \"TextDefined\";\r\n /**\r\n * Use line feed (\\n) as the end of line character.\r\n */\r\n EndOfLinePreference[EndOfLinePreference[\"LF\"] = 1] = \"LF\";\r\n /**\r\n * Use carriage return and line feed (\\r\\n) as the end of line character.\r\n */\r\n EndOfLinePreference[EndOfLinePreference[\"CRLF\"] = 2] = \"CRLF\";\r\n})(EndOfLinePreference || (EndOfLinePreference = {}));\r\n/**\r\n * End of line character preference.\r\n */\r\nexport var EndOfLineSequence;\r\n(function (EndOfLineSequence) {\r\n /**\r\n * Use line feed (\\n) as the end of line character.\r\n */\r\n EndOfLineSequence[EndOfLineSequence[\"LF\"] = 0] = \"LF\";\r\n /**\r\n * Use carriage return and line feed (\\r\\n) as the end of line character.\r\n */\r\n EndOfLineSequence[EndOfLineSequence[\"CRLF\"] = 1] = \"CRLF\";\r\n})(EndOfLineSequence || (EndOfLineSequence = {}));\r\n/**\r\n * Describes what to do with the indentation when pressing Enter.\r\n */\r\nexport var IndentAction;\r\n(function (IndentAction) {\r\n /**\r\n * Insert new line and copy the previous line's indentation.\r\n */\r\n IndentAction[IndentAction[\"None\"] = 0] = \"None\";\r\n /**\r\n * Insert new line and indent once (relative to the previous line's indentation).\r\n */\r\n IndentAction[IndentAction[\"Indent\"] = 1] = \"Indent\";\r\n /**\r\n * Insert two new lines:\r\n * - the first one indented which will hold the cursor\r\n * - the second one at the same indentation level\r\n */\r\n IndentAction[IndentAction[\"IndentOutdent\"] = 2] = \"IndentOutdent\";\r\n /**\r\n * Insert new line and outdent once (relative to the previous line's indentation).\r\n */\r\n IndentAction[IndentAction[\"Outdent\"] = 3] = \"Outdent\";\r\n})(IndentAction || (IndentAction = {}));\r\nexport var InlayHintKind;\r\n(function (InlayHintKind) {\r\n InlayHintKind[InlayHintKind[\"Other\"] = 0] = \"Other\";\r\n InlayHintKind[InlayHintKind[\"Type\"] = 1] = \"Type\";\r\n InlayHintKind[InlayHintKind[\"Parameter\"] = 2] = \"Parameter\";\r\n})(InlayHintKind || (InlayHintKind = {}));\r\n/**\r\n * How an {@link InlineCompletionsProvider inline completion provider} was triggered.\r\n */\r\nexport var InlineCompletionTriggerKind;\r\n(function (InlineCompletionTriggerKind) {\r\n /**\r\n * Completion was triggered automatically while editing.\r\n * It is sufficient to return a single completion item in this case.\r\n */\r\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Automatic\"] = 0] = \"Automatic\";\r\n /**\r\n * Completion was triggered explicitly by a user gesture.\r\n * Return multiple completion items to enable cycling through them.\r\n */\r\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Explicit\"] = 1] = \"Explicit\";\r\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\r\n/**\r\n * Virtual Key Codes, the value does not hold any inherent meaning.\r\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\r\n * But these are \"more general\", as they should work across browsers & OS`s.\r\n */\r\nexport var KeyCode;\r\n(function (KeyCode) {\r\n KeyCode[KeyCode[\"DependsOnKbLayout\"] = -1] = \"DependsOnKbLayout\";\r\n /**\r\n * Placed first to cover the 0 value of the enum.\r\n */\r\n KeyCode[KeyCode[\"Unknown\"] = 0] = \"Unknown\";\r\n KeyCode[KeyCode[\"Backspace\"] = 1] = \"Backspace\";\r\n KeyCode[KeyCode[\"Tab\"] = 2] = \"Tab\";\r\n KeyCode[KeyCode[\"Enter\"] = 3] = \"Enter\";\r\n KeyCode[KeyCode[\"Shift\"] = 4] = \"Shift\";\r\n KeyCode[KeyCode[\"Ctrl\"] = 5] = \"Ctrl\";\r\n KeyCode[KeyCode[\"Alt\"] = 6] = \"Alt\";\r\n KeyCode[KeyCode[\"PauseBreak\"] = 7] = \"PauseBreak\";\r\n KeyCode[KeyCode[\"CapsLock\"] = 8] = \"CapsLock\";\r\n KeyCode[KeyCode[\"Escape\"] = 9] = \"Escape\";\r\n KeyCode[KeyCode[\"Space\"] = 10] = \"Space\";\r\n KeyCode[KeyCode[\"PageUp\"] = 11] = \"PageUp\";\r\n KeyCode[KeyCode[\"PageDown\"] = 12] = \"PageDown\";\r\n KeyCode[KeyCode[\"End\"] = 13] = \"End\";\r\n KeyCode[KeyCode[\"Home\"] = 14] = \"Home\";\r\n KeyCode[KeyCode[\"LeftArrow\"] = 15] = \"LeftArrow\";\r\n KeyCode[KeyCode[\"UpArrow\"] = 16] = \"UpArrow\";\r\n KeyCode[KeyCode[\"RightArrow\"] = 17] = \"RightArrow\";\r\n KeyCode[KeyCode[\"DownArrow\"] = 18] = \"DownArrow\";\r\n KeyCode[KeyCode[\"Insert\"] = 19] = \"Insert\";\r\n KeyCode[KeyCode[\"Delete\"] = 20] = \"Delete\";\r\n KeyCode[KeyCode[\"KEY_0\"] = 21] = \"KEY_0\";\r\n KeyCode[KeyCode[\"KEY_1\"] = 22] = \"KEY_1\";\r\n KeyCode[KeyCode[\"KEY_2\"] = 23] = \"KEY_2\";\r\n KeyCode[KeyCode[\"KEY_3\"] = 24] = \"KEY_3\";\r\n KeyCode[KeyCode[\"KEY_4\"] = 25] = \"KEY_4\";\r\n KeyCode[KeyCode[\"KEY_5\"] = 26] = \"KEY_5\";\r\n KeyCode[KeyCode[\"KEY_6\"] = 27] = \"KEY_6\";\r\n KeyCode[KeyCode[\"KEY_7\"] = 28] = \"KEY_7\";\r\n KeyCode[KeyCode[\"KEY_8\"] = 29] = \"KEY_8\";\r\n KeyCode[KeyCode[\"KEY_9\"] = 30] = \"KEY_9\";\r\n KeyCode[KeyCode[\"KEY_A\"] = 31] = \"KEY_A\";\r\n KeyCode[KeyCode[\"KEY_B\"] = 32] = \"KEY_B\";\r\n KeyCode[KeyCode[\"KEY_C\"] = 33] = \"KEY_C\";\r\n KeyCode[KeyCode[\"KEY_D\"] = 34] = \"KEY_D\";\r\n KeyCode[KeyCode[\"KEY_E\"] = 35] = \"KEY_E\";\r\n KeyCode[KeyCode[\"KEY_F\"] = 36] = \"KEY_F\";\r\n KeyCode[KeyCode[\"KEY_G\"] = 37] = \"KEY_G\";\r\n KeyCode[KeyCode[\"KEY_H\"] = 38] = \"KEY_H\";\r\n KeyCode[KeyCode[\"KEY_I\"] = 39] = \"KEY_I\";\r\n KeyCode[KeyCode[\"KEY_J\"] = 40] = \"KEY_J\";\r\n KeyCode[KeyCode[\"KEY_K\"] = 41] = \"KEY_K\";\r\n KeyCode[KeyCode[\"KEY_L\"] = 42] = \"KEY_L\";\r\n KeyCode[KeyCode[\"KEY_M\"] = 43] = \"KEY_M\";\r\n KeyCode[KeyCode[\"KEY_N\"] = 44] = \"KEY_N\";\r\n KeyCode[KeyCode[\"KEY_O\"] = 45] = \"KEY_O\";\r\n KeyCode[KeyCode[\"KEY_P\"] = 46] = \"KEY_P\";\r\n KeyCode[KeyCode[\"KEY_Q\"] = 47] = \"KEY_Q\";\r\n KeyCode[KeyCode[\"KEY_R\"] = 48] = \"KEY_R\";\r\n KeyCode[KeyCode[\"KEY_S\"] = 49] = \"KEY_S\";\r\n KeyCode[KeyCode[\"KEY_T\"] = 50] = \"KEY_T\";\r\n KeyCode[KeyCode[\"KEY_U\"] = 51] = \"KEY_U\";\r\n KeyCode[KeyCode[\"KEY_V\"] = 52] = \"KEY_V\";\r\n KeyCode[KeyCode[\"KEY_W\"] = 53] = \"KEY_W\";\r\n KeyCode[KeyCode[\"KEY_X\"] = 54] = \"KEY_X\";\r\n KeyCode[KeyCode[\"KEY_Y\"] = 55] = \"KEY_Y\";\r\n KeyCode[KeyCode[\"KEY_Z\"] = 56] = \"KEY_Z\";\r\n KeyCode[KeyCode[\"Meta\"] = 57] = \"Meta\";\r\n KeyCode[KeyCode[\"ContextMenu\"] = 58] = \"ContextMenu\";\r\n KeyCode[KeyCode[\"F1\"] = 59] = \"F1\";\r\n KeyCode[KeyCode[\"F2\"] = 60] = \"F2\";\r\n KeyCode[KeyCode[\"F3\"] = 61] = \"F3\";\r\n KeyCode[KeyCode[\"F4\"] = 62] = \"F4\";\r\n KeyCode[KeyCode[\"F5\"] = 63] = \"F5\";\r\n KeyCode[KeyCode[\"F6\"] = 64] = \"F6\";\r\n KeyCode[KeyCode[\"F7\"] = 65] = \"F7\";\r\n KeyCode[KeyCode[\"F8\"] = 66] = \"F8\";\r\n KeyCode[KeyCode[\"F9\"] = 67] = \"F9\";\r\n KeyCode[KeyCode[\"F10\"] = 68] = \"F10\";\r\n KeyCode[KeyCode[\"F11\"] = 69] = \"F11\";\r\n KeyCode[KeyCode[\"F12\"] = 70] = \"F12\";\r\n KeyCode[KeyCode[\"F13\"] = 71] = \"F13\";\r\n KeyCode[KeyCode[\"F14\"] = 72] = \"F14\";\r\n KeyCode[KeyCode[\"F15\"] = 73] = \"F15\";\r\n KeyCode[KeyCode[\"F16\"] = 74] = \"F16\";\r\n KeyCode[KeyCode[\"F17\"] = 75] = \"F17\";\r\n KeyCode[KeyCode[\"F18\"] = 76] = \"F18\";\r\n KeyCode[KeyCode[\"F19\"] = 77] = \"F19\";\r\n KeyCode[KeyCode[\"NumLock\"] = 78] = \"NumLock\";\r\n KeyCode[KeyCode[\"ScrollLock\"] = 79] = \"ScrollLock\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the ';:' key\r\n */\r\n KeyCode[KeyCode[\"US_SEMICOLON\"] = 80] = \"US_SEMICOLON\";\r\n /**\r\n * For any country/region, the '+' key\r\n * For the US standard keyboard, the '=+' key\r\n */\r\n KeyCode[KeyCode[\"US_EQUAL\"] = 81] = \"US_EQUAL\";\r\n /**\r\n * For any country/region, the ',' key\r\n * For the US standard keyboard, the ',<' key\r\n */\r\n KeyCode[KeyCode[\"US_COMMA\"] = 82] = \"US_COMMA\";\r\n /**\r\n * For any country/region, the '-' key\r\n * For the US standard keyboard, the '-_' key\r\n */\r\n KeyCode[KeyCode[\"US_MINUS\"] = 83] = \"US_MINUS\";\r\n /**\r\n * For any country/region, the '.' key\r\n * For the US standard keyboard, the '.>' key\r\n */\r\n KeyCode[KeyCode[\"US_DOT\"] = 84] = \"US_DOT\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '/?' key\r\n */\r\n KeyCode[KeyCode[\"US_SLASH\"] = 85] = \"US_SLASH\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '`~' key\r\n */\r\n KeyCode[KeyCode[\"US_BACKTICK\"] = 86] = \"US_BACKTICK\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '[{' key\r\n */\r\n KeyCode[KeyCode[\"US_OPEN_SQUARE_BRACKET\"] = 87] = \"US_OPEN_SQUARE_BRACKET\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '\\|' key\r\n */\r\n KeyCode[KeyCode[\"US_BACKSLASH\"] = 88] = \"US_BACKSLASH\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the ']}' key\r\n */\r\n KeyCode[KeyCode[\"US_CLOSE_SQUARE_BRACKET\"] = 89] = \"US_CLOSE_SQUARE_BRACKET\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the ''\"' key\r\n */\r\n KeyCode[KeyCode[\"US_QUOTE\"] = 90] = \"US_QUOTE\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n */\r\n KeyCode[KeyCode[\"OEM_8\"] = 91] = \"OEM_8\";\r\n /**\r\n * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\r\n */\r\n KeyCode[KeyCode[\"OEM_102\"] = 92] = \"OEM_102\";\r\n KeyCode[KeyCode[\"NUMPAD_0\"] = 93] = \"NUMPAD_0\";\r\n KeyCode[KeyCode[\"NUMPAD_1\"] = 94] = \"NUMPAD_1\";\r\n KeyCode[KeyCode[\"NUMPAD_2\"] = 95] = \"NUMPAD_2\";\r\n KeyCode[KeyCode[\"NUMPAD_3\"] = 96] = \"NUMPAD_3\";\r\n KeyCode[KeyCode[\"NUMPAD_4\"] = 97] = \"NUMPAD_4\";\r\n KeyCode[KeyCode[\"NUMPAD_5\"] = 98] = \"NUMPAD_5\";\r\n KeyCode[KeyCode[\"NUMPAD_6\"] = 99] = \"NUMPAD_6\";\r\n KeyCode[KeyCode[\"NUMPAD_7\"] = 100] = \"NUMPAD_7\";\r\n KeyCode[KeyCode[\"NUMPAD_8\"] = 101] = \"NUMPAD_8\";\r\n KeyCode[KeyCode[\"NUMPAD_9\"] = 102] = \"NUMPAD_9\";\r\n KeyCode[KeyCode[\"NUMPAD_MULTIPLY\"] = 103] = \"NUMPAD_MULTIPLY\";\r\n KeyCode[KeyCode[\"NUMPAD_ADD\"] = 104] = \"NUMPAD_ADD\";\r\n KeyCode[KeyCode[\"NUMPAD_SEPARATOR\"] = 105] = \"NUMPAD_SEPARATOR\";\r\n KeyCode[KeyCode[\"NUMPAD_SUBTRACT\"] = 106] = \"NUMPAD_SUBTRACT\";\r\n KeyCode[KeyCode[\"NUMPAD_DECIMAL\"] = 107] = \"NUMPAD_DECIMAL\";\r\n KeyCode[KeyCode[\"NUMPAD_DIVIDE\"] = 108] = \"NUMPAD_DIVIDE\";\r\n /**\r\n * Cover all key codes when IME is processing input.\r\n */\r\n KeyCode[KeyCode[\"KEY_IN_COMPOSITION\"] = 109] = \"KEY_IN_COMPOSITION\";\r\n KeyCode[KeyCode[\"ABNT_C1\"] = 110] = \"ABNT_C1\";\r\n KeyCode[KeyCode[\"ABNT_C2\"] = 111] = \"ABNT_C2\";\r\n /**\r\n * Placed last to cover the length of the enum.\r\n * Please do not depend on this value!\r\n */\r\n KeyCode[KeyCode[\"MAX_VALUE\"] = 112] = \"MAX_VALUE\";\r\n})(KeyCode || (KeyCode = {}));\r\nexport var MarkerSeverity;\r\n(function (MarkerSeverity) {\r\n MarkerSeverity[MarkerSeverity[\"Hint\"] = 1] = \"Hint\";\r\n MarkerSeverity[MarkerSeverity[\"Info\"] = 2] = \"Info\";\r\n MarkerSeverity[MarkerSeverity[\"Warning\"] = 4] = \"Warning\";\r\n MarkerSeverity[MarkerSeverity[\"Error\"] = 8] = \"Error\";\r\n})(MarkerSeverity || (MarkerSeverity = {}));\r\nexport var MarkerTag;\r\n(function (MarkerTag) {\r\n MarkerTag[MarkerTag[\"Unnecessary\"] = 1] = \"Unnecessary\";\r\n MarkerTag[MarkerTag[\"Deprecated\"] = 2] = \"Deprecated\";\r\n})(MarkerTag || (MarkerTag = {}));\r\n/**\r\n * Position in the minimap to render the decoration.\r\n */\r\nexport var MinimapPosition;\r\n(function (MinimapPosition) {\r\n MinimapPosition[MinimapPosition[\"Inline\"] = 1] = \"Inline\";\r\n MinimapPosition[MinimapPosition[\"Gutter\"] = 2] = \"Gutter\";\r\n})(MinimapPosition || (MinimapPosition = {}));\r\n/**\r\n * Type of hit element with the mouse in the editor.\r\n */\r\nexport var MouseTargetType;\r\n(function (MouseTargetType) {\r\n /**\r\n * Mouse is on top of an unknown element.\r\n */\r\n MouseTargetType[MouseTargetType[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\r\n /**\r\n * Mouse is on top of the textarea used for input.\r\n */\r\n MouseTargetType[MouseTargetType[\"TEXTAREA\"] = 1] = \"TEXTAREA\";\r\n /**\r\n * Mouse is on top of the glyph margin\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_GLYPH_MARGIN\"] = 2] = \"GUTTER_GLYPH_MARGIN\";\r\n /**\r\n * Mouse is on top of the line numbers\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_LINE_NUMBERS\"] = 3] = \"GUTTER_LINE_NUMBERS\";\r\n /**\r\n * Mouse is on top of the line decorations\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_LINE_DECORATIONS\"] = 4] = \"GUTTER_LINE_DECORATIONS\";\r\n /**\r\n * Mouse is on top of the whitespace left in the gutter by a view zone.\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_VIEW_ZONE\"] = 5] = \"GUTTER_VIEW_ZONE\";\r\n /**\r\n * Mouse is on top of text in the content.\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_TEXT\"] = 6] = \"CONTENT_TEXT\";\r\n /**\r\n * Mouse is on top of empty space in the content (e.g. after line text or below last line)\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_EMPTY\"] = 7] = \"CONTENT_EMPTY\";\r\n /**\r\n * Mouse is on top of a view zone in the content.\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_VIEW_ZONE\"] = 8] = \"CONTENT_VIEW_ZONE\";\r\n /**\r\n * Mouse is on top of a content widget.\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_WIDGET\"] = 9] = \"CONTENT_WIDGET\";\r\n /**\r\n * Mouse is on top of the decorations overview ruler.\r\n */\r\n MouseTargetType[MouseTargetType[\"OVERVIEW_RULER\"] = 10] = \"OVERVIEW_RULER\";\r\n /**\r\n * Mouse is on top of a scrollbar.\r\n */\r\n MouseTargetType[MouseTargetType[\"SCROLLBAR\"] = 11] = \"SCROLLBAR\";\r\n /**\r\n * Mouse is on top of an overlay widget.\r\n */\r\n MouseTargetType[MouseTargetType[\"OVERLAY_WIDGET\"] = 12] = \"OVERLAY_WIDGET\";\r\n /**\r\n * Mouse is outside of the editor.\r\n */\r\n MouseTargetType[MouseTargetType[\"OUTSIDE_EDITOR\"] = 13] = \"OUTSIDE_EDITOR\";\r\n})(MouseTargetType || (MouseTargetType = {}));\r\n/**\r\n * A positioning preference for rendering overlay widgets.\r\n */\r\nexport var OverlayWidgetPositionPreference;\r\n(function (OverlayWidgetPositionPreference) {\r\n /**\r\n * Position the overlay widget in the top right corner\r\n */\r\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"TOP_RIGHT_CORNER\"] = 0] = \"TOP_RIGHT_CORNER\";\r\n /**\r\n * Position the overlay widget in the bottom right corner\r\n */\r\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"BOTTOM_RIGHT_CORNER\"] = 1] = \"BOTTOM_RIGHT_CORNER\";\r\n /**\r\n * Position the overlay widget in the top center\r\n */\r\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"TOP_CENTER\"] = 2] = \"TOP_CENTER\";\r\n})(OverlayWidgetPositionPreference || (OverlayWidgetPositionPreference = {}));\r\n/**\r\n * Vertical Lane in the overview ruler of the editor.\r\n */\r\nexport var OverviewRulerLane;\r\n(function (OverviewRulerLane) {\r\n OverviewRulerLane[OverviewRulerLane[\"Left\"] = 1] = \"Left\";\r\n OverviewRulerLane[OverviewRulerLane[\"Center\"] = 2] = \"Center\";\r\n OverviewRulerLane[OverviewRulerLane[\"Right\"] = 4] = \"Right\";\r\n OverviewRulerLane[OverviewRulerLane[\"Full\"] = 7] = \"Full\";\r\n})(OverviewRulerLane || (OverviewRulerLane = {}));\r\nexport var RenderLineNumbersType;\r\n(function (RenderLineNumbersType) {\r\n RenderLineNumbersType[RenderLineNumbersType[\"Off\"] = 0] = \"Off\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"On\"] = 1] = \"On\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"Relative\"] = 2] = \"Relative\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"Interval\"] = 3] = \"Interval\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"Custom\"] = 4] = \"Custom\";\r\n})(RenderLineNumbersType || (RenderLineNumbersType = {}));\r\nexport var RenderMinimap;\r\n(function (RenderMinimap) {\r\n RenderMinimap[RenderMinimap[\"None\"] = 0] = \"None\";\r\n RenderMinimap[RenderMinimap[\"Text\"] = 1] = \"Text\";\r\n RenderMinimap[RenderMinimap[\"Blocks\"] = 2] = \"Blocks\";\r\n})(RenderMinimap || (RenderMinimap = {}));\r\nexport var ScrollType;\r\n(function (ScrollType) {\r\n ScrollType[ScrollType[\"Smooth\"] = 0] = \"Smooth\";\r\n ScrollType[ScrollType[\"Immediate\"] = 1] = \"Immediate\";\r\n})(ScrollType || (ScrollType = {}));\r\nexport var ScrollbarVisibility;\r\n(function (ScrollbarVisibility) {\r\n ScrollbarVisibility[ScrollbarVisibility[\"Auto\"] = 1] = \"Auto\";\r\n ScrollbarVisibility[ScrollbarVisibility[\"Hidden\"] = 2] = \"Hidden\";\r\n ScrollbarVisibility[ScrollbarVisibility[\"Visible\"] = 3] = \"Visible\";\r\n})(ScrollbarVisibility || (ScrollbarVisibility = {}));\r\n/**\r\n * The direction of a selection.\r\n */\r\nexport var SelectionDirection;\r\n(function (SelectionDirection) {\r\n /**\r\n * The selection starts above where it ends.\r\n */\r\n SelectionDirection[SelectionDirection[\"LTR\"] = 0] = \"LTR\";\r\n /**\r\n * The selection starts below where it ends.\r\n */\r\n SelectionDirection[SelectionDirection[\"RTL\"] = 1] = \"RTL\";\r\n})(SelectionDirection || (SelectionDirection = {}));\r\nexport var SignatureHelpTriggerKind;\r\n(function (SignatureHelpTriggerKind) {\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"Invoke\"] = 1] = \"Invoke\";\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"TriggerCharacter\"] = 2] = \"TriggerCharacter\";\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"ContentChange\"] = 3] = \"ContentChange\";\r\n})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));\r\n/**\r\n * A symbol kind.\r\n */\r\nexport var SymbolKind;\r\n(function (SymbolKind) {\r\n SymbolKind[SymbolKind[\"File\"] = 0] = \"File\";\r\n SymbolKind[SymbolKind[\"Module\"] = 1] = \"Module\";\r\n SymbolKind[SymbolKind[\"Namespace\"] = 2] = \"Namespace\";\r\n SymbolKind[SymbolKind[\"Package\"] = 3] = \"Package\";\r\n SymbolKind[SymbolKind[\"Class\"] = 4] = \"Class\";\r\n SymbolKind[SymbolKind[\"Method\"] = 5] = \"Method\";\r\n SymbolKind[SymbolKind[\"Property\"] = 6] = \"Property\";\r\n SymbolKind[SymbolKind[\"Field\"] = 7] = \"Field\";\r\n SymbolKind[SymbolKind[\"Constructor\"] = 8] = \"Constructor\";\r\n SymbolKind[SymbolKind[\"Enum\"] = 9] = \"Enum\";\r\n SymbolKind[SymbolKind[\"Interface\"] = 10] = \"Interface\";\r\n SymbolKind[SymbolKind[\"Function\"] = 11] = \"Function\";\r\n SymbolKind[SymbolKind[\"Variable\"] = 12] = \"Variable\";\r\n SymbolKind[SymbolKind[\"Constant\"] = 13] = \"Constant\";\r\n SymbolKind[SymbolKind[\"String\"] = 14] = \"String\";\r\n SymbolKind[SymbolKind[\"Number\"] = 15] = \"Number\";\r\n SymbolKind[SymbolKind[\"Boolean\"] = 16] = \"Boolean\";\r\n SymbolKind[SymbolKind[\"Array\"] = 17] = \"Array\";\r\n SymbolKind[SymbolKind[\"Object\"] = 18] = \"Object\";\r\n SymbolKind[SymbolKind[\"Key\"] = 19] = \"Key\";\r\n SymbolKind[SymbolKind[\"Null\"] = 20] = \"Null\";\r\n SymbolKind[SymbolKind[\"EnumMember\"] = 21] = \"EnumMember\";\r\n SymbolKind[SymbolKind[\"Struct\"] = 22] = \"Struct\";\r\n SymbolKind[SymbolKind[\"Event\"] = 23] = \"Event\";\r\n SymbolKind[SymbolKind[\"Operator\"] = 24] = \"Operator\";\r\n SymbolKind[SymbolKind[\"TypeParameter\"] = 25] = \"TypeParameter\";\r\n})(SymbolKind || (SymbolKind = {}));\r\nexport var SymbolTag;\r\n(function (SymbolTag) {\r\n SymbolTag[SymbolTag[\"Deprecated\"] = 1] = \"Deprecated\";\r\n})(SymbolTag || (SymbolTag = {}));\r\n/**\r\n * The kind of animation in which the editor's cursor should be rendered.\r\n */\r\nexport var TextEditorCursorBlinkingStyle;\r\n(function (TextEditorCursorBlinkingStyle) {\r\n /**\r\n * Hidden\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Hidden\"] = 0] = \"Hidden\";\r\n /**\r\n * Blinking\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Blink\"] = 1] = \"Blink\";\r\n /**\r\n * Blinking with smooth fading\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Smooth\"] = 2] = \"Smooth\";\r\n /**\r\n * Blinking with prolonged filled state and smooth fading\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Phase\"] = 3] = \"Phase\";\r\n /**\r\n * Expand collapse animation on the y axis\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Expand\"] = 4] = \"Expand\";\r\n /**\r\n * No-Blinking\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Solid\"] = 5] = \"Solid\";\r\n})(TextEditorCursorBlinkingStyle || (TextEditorCursorBlinkingStyle = {}));\r\n/**\r\n * The style in which the editor's cursor should be rendered.\r\n */\r\nexport var TextEditorCursorStyle;\r\n(function (TextEditorCursorStyle) {\r\n /**\r\n * As a vertical line (sitting between two characters).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Line\"] = 1] = \"Line\";\r\n /**\r\n * As a block (sitting on top of a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Block\"] = 2] = \"Block\";\r\n /**\r\n * As a horizontal line (sitting under a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Underline\"] = 3] = \"Underline\";\r\n /**\r\n * As a thin vertical line (sitting between two characters).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"LineThin\"] = 4] = \"LineThin\";\r\n /**\r\n * As an outlined block (sitting on top of a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"BlockOutline\"] = 5] = \"BlockOutline\";\r\n /**\r\n * As a thin horizontal line (sitting under a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"UnderlineThin\"] = 6] = \"UnderlineThin\";\r\n})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));\r\n/**\r\n * Describes the behavior of decorations when typing/editing near their edges.\r\n * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`\r\n */\r\nexport var TrackedRangeStickiness;\r\n(function (TrackedRangeStickiness) {\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"AlwaysGrowsWhenTypingAtEdges\"] = 0] = \"AlwaysGrowsWhenTypingAtEdges\";\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"NeverGrowsWhenTypingAtEdges\"] = 1] = \"NeverGrowsWhenTypingAtEdges\";\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"GrowsOnlyWhenTypingBefore\"] = 2] = \"GrowsOnlyWhenTypingBefore\";\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"GrowsOnlyWhenTypingAfter\"] = 3] = \"GrowsOnlyWhenTypingAfter\";\r\n})(TrackedRangeStickiness || (TrackedRangeStickiness = {}));\r\n/**\r\n * Describes how to indent wrapped lines.\r\n */\r\nexport var WrappingIndent;\r\n(function (WrappingIndent) {\r\n /**\r\n * No indentation => wrapped lines begin at column 1.\r\n */\r\n WrappingIndent[WrappingIndent[\"None\"] = 0] = \"None\";\r\n /**\r\n * Same => wrapped lines get the same indentation as the parent.\r\n */\r\n WrappingIndent[WrappingIndent[\"Same\"] = 1] = \"Same\";\r\n /**\r\n * Indent => wrapped lines get +1 indentation toward the parent.\r\n */\r\n WrappingIndent[WrappingIndent[\"Indent\"] = 2] = \"Indent\";\r\n /**\r\n * DeepIndent => wrapped lines get +2 indentation toward the parent.\r\n */\r\n WrappingIndent[WrappingIndent[\"DeepIndent\"] = 3] = \"DeepIndent\";\r\n})(WrappingIndent || (WrappingIndent = {}));\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Position } from './position.js';\r\nimport { Range } from './range.js';\r\n/**\r\n * A selection in the editor.\r\n * The selection is a range that has an orientation.\r\n */\r\nexport class Selection extends Range {\r\n constructor(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) {\r\n super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);\r\n this.selectionStartLineNumber = selectionStartLineNumber;\r\n this.selectionStartColumn = selectionStartColumn;\r\n this.positionLineNumber = positionLineNumber;\r\n this.positionColumn = positionColumn;\r\n }\r\n /**\r\n * Transform to a human-readable representation.\r\n */\r\n toString() {\r\n return '[' + this.selectionStartLineNumber + ',' + this.selectionStartColumn + ' -> ' + this.positionLineNumber + ',' + this.positionColumn + ']';\r\n }\r\n /**\r\n * Test if equals other selection.\r\n */\r\n equalsSelection(other) {\r\n return (Selection.selectionsEqual(this, other));\r\n }\r\n /**\r\n * Test if the two selections are equal.\r\n */\r\n static selectionsEqual(a, b) {\r\n return (a.selectionStartLineNumber === b.selectionStartLineNumber &&\r\n a.selectionStartColumn === b.selectionStartColumn &&\r\n a.positionLineNumber === b.positionLineNumber &&\r\n a.positionColumn === b.positionColumn);\r\n }\r\n /**\r\n * Get directions (LTR or RTL).\r\n */\r\n getDirection() {\r\n if (this.selectionStartLineNumber === this.startLineNumber && this.selectionStartColumn === this.startColumn) {\r\n return 0 /* LTR */;\r\n }\r\n return 1 /* RTL */;\r\n }\r\n /**\r\n * Create a new selection with a different `positionLineNumber` and `positionColumn`.\r\n */\r\n setEndPosition(endLineNumber, endColumn) {\r\n if (this.getDirection() === 0 /* LTR */) {\r\n return new Selection(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\r\n }\r\n return new Selection(endLineNumber, endColumn, this.startLineNumber, this.startColumn);\r\n }\r\n /**\r\n * Get the position at `positionLineNumber` and `positionColumn`.\r\n */\r\n getPosition() {\r\n return new Position(this.positionLineNumber, this.positionColumn);\r\n }\r\n /**\r\n * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.\r\n */\r\n setStartPosition(startLineNumber, startColumn) {\r\n if (this.getDirection() === 0 /* LTR */) {\r\n return new Selection(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\r\n }\r\n return new Selection(this.endLineNumber, this.endColumn, startLineNumber, startColumn);\r\n }\r\n // ----\r\n /**\r\n * Create a `Selection` from one or two positions\r\n */\r\n static fromPositions(start, end = start) {\r\n return new Selection(start.lineNumber, start.column, end.lineNumber, end.column);\r\n }\r\n /**\r\n * Create a `Selection` from an `ISelection`.\r\n */\r\n static liftSelection(sel) {\r\n return new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);\r\n }\r\n /**\r\n * `a` equals `b`.\r\n */\r\n static selectionsArrEqual(a, b) {\r\n if (a && !b || !a && b) {\r\n return false;\r\n }\r\n if (!a && !b) {\r\n return true;\r\n }\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = a.length; i < len; i++) {\r\n if (!this.selectionsEqual(a[i], b[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if `obj` is an `ISelection`.\r\n */\r\n static isISelection(obj) {\r\n return (obj\r\n && (typeof obj.selectionStartLineNumber === 'number')\r\n && (typeof obj.selectionStartColumn === 'number')\r\n && (typeof obj.positionLineNumber === 'number')\r\n && (typeof obj.positionColumn === 'number'));\r\n }\r\n /**\r\n * Create with a direction.\r\n */\r\n static createWithDirection(startLineNumber, startColumn, endLineNumber, endColumn, direction) {\r\n if (direction === 0 /* LTR */) {\r\n return new Selection(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n return new Selection(endLineNumber, endColumn, startLineNumber, startColumn);\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class Token {\r\n constructor(offset, type, language) {\r\n this.offset = offset | 0; // @perf\r\n this.type = type;\r\n this.language = language;\r\n }\r\n toString() {\r\n return '(' + this.offset + ', ' + this.type + ')';\r\n }\r\n}\r\nexport class TokenizationResult {\r\n constructor(tokens, endState) {\r\n this.tokens = tokens;\r\n this.endState = endState;\r\n }\r\n}\r\nexport class TokenizationResult2 {\r\n constructor(tokens, endState) {\r\n this.tokens = tokens;\r\n this.endState = endState;\r\n }\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CancellationTokenSource } from '../../../base/common/cancellation.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { KeyChord } from '../../../base/common/keyCodes.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport { Token } from '../core/token.js';\r\nimport * as standaloneEnums from './standaloneEnums.js';\r\nexport class KeyMod {\r\n static chord(firstPart, secondPart) {\r\n return KeyChord(firstPart, secondPart);\r\n }\r\n}\r\nKeyMod.CtrlCmd = 2048 /* CtrlCmd */;\r\nKeyMod.Shift = 1024 /* Shift */;\r\nKeyMod.Alt = 512 /* Alt */;\r\nKeyMod.WinCtrl = 256 /* WinCtrl */;\r\nexport function createMonacoBaseAPI() {\r\n return {\r\n editor: undefined,\r\n languages: undefined,\r\n CancellationTokenSource: CancellationTokenSource,\r\n Emitter: Emitter,\r\n KeyCode: standaloneEnums.KeyCode,\r\n KeyMod: KeyMod,\r\n Position: Position,\r\n Range: Range,\r\n Selection: Selection,\r\n SelectionDirection: standaloneEnums.SelectionDirection,\r\n MarkerSeverity: standaloneEnums.MarkerSeverity,\r\n MarkerTag: standaloneEnums.MarkerTag,\r\n Uri: URI,\r\n Token: Token\r\n };\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport { stringDiff } from '../../../base/common/diff/diff.js';\r\nimport { globals } from '../../../base/common/platform.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { DiffComputer } from '../diff/diffComputer.js';\r\nimport { MirrorTextModel as BaseMirrorModel } from '../model/mirrorTextModel.js';\r\nimport { ensureValidWordDefinition, getWordAtText } from '../model/wordHelper.js';\r\nimport { computeLinks } from '../modes/linkComputer.js';\r\nimport { BasicInplaceReplace } from '../modes/supports/inplaceReplaceSupport.js';\r\nimport { createMonacoBaseAPI } from '../standalone/standaloneBase.js';\r\nimport * as types from '../../../base/common/types.js';\r\nimport { StopWatch } from '../../../base/common/stopwatch.js';\r\n/**\r\n * @internal\r\n */\r\nclass MirrorModel extends BaseMirrorModel {\r\n get uri() {\r\n return this._uri;\r\n }\r\n get eol() {\r\n return this._eol;\r\n }\r\n getValue() {\r\n return this.getText();\r\n }\r\n getLinesContent() {\r\n return this._lines.slice(0);\r\n }\r\n getLineCount() {\r\n return this._lines.length;\r\n }\r\n getLineContent(lineNumber) {\r\n return this._lines[lineNumber - 1];\r\n }\r\n getWordAtPosition(position, wordDefinition) {\r\n let wordAtText = getWordAtText(position.column, ensureValidWordDefinition(wordDefinition), this._lines[position.lineNumber - 1], 0);\r\n if (wordAtText) {\r\n return new Range(position.lineNumber, wordAtText.startColumn, position.lineNumber, wordAtText.endColumn);\r\n }\r\n return null;\r\n }\r\n words(wordDefinition) {\r\n const lines = this._lines;\r\n const wordenize = this._wordenize.bind(this);\r\n let lineNumber = 0;\r\n let lineText = '';\r\n let wordRangesIdx = 0;\r\n let wordRanges = [];\r\n return {\r\n *[Symbol.iterator]() {\r\n while (true) {\r\n if (wordRangesIdx < wordRanges.length) {\r\n const value = lineText.substring(wordRanges[wordRangesIdx].start, wordRanges[wordRangesIdx].end);\r\n wordRangesIdx += 1;\r\n yield value;\r\n }\r\n else {\r\n if (lineNumber < lines.length) {\r\n lineText = lines[lineNumber];\r\n wordRanges = wordenize(lineText, wordDefinition);\r\n wordRangesIdx = 0;\r\n lineNumber += 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }\r\n getLineWords(lineNumber, wordDefinition) {\r\n let content = this._lines[lineNumber - 1];\r\n let ranges = this._wordenize(content, wordDefinition);\r\n let words = [];\r\n for (const range of ranges) {\r\n words.push({\r\n word: content.substring(range.start, range.end),\r\n startColumn: range.start + 1,\r\n endColumn: range.end + 1\r\n });\r\n }\r\n return words;\r\n }\r\n _wordenize(content, wordDefinition) {\r\n const result = [];\r\n let match;\r\n wordDefinition.lastIndex = 0; // reset lastIndex just to be sure\r\n while (match = wordDefinition.exec(content)) {\r\n if (match[0].length === 0) {\r\n // it did match the empty string\r\n break;\r\n }\r\n result.push({ start: match.index, end: match.index + match[0].length });\r\n }\r\n return result;\r\n }\r\n getValueInRange(range) {\r\n range = this._validateRange(range);\r\n if (range.startLineNumber === range.endLineNumber) {\r\n return this._lines[range.startLineNumber - 1].substring(range.startColumn - 1, range.endColumn - 1);\r\n }\r\n let lineEnding = this._eol;\r\n let startLineIndex = range.startLineNumber - 1;\r\n let endLineIndex = range.endLineNumber - 1;\r\n let resultLines = [];\r\n resultLines.push(this._lines[startLineIndex].substring(range.startColumn - 1));\r\n for (let i = startLineIndex + 1; i < endLineIndex; i++) {\r\n resultLines.push(this._lines[i]);\r\n }\r\n resultLines.push(this._lines[endLineIndex].substring(0, range.endColumn - 1));\r\n return resultLines.join(lineEnding);\r\n }\r\n offsetAt(position) {\r\n position = this._validatePosition(position);\r\n this._ensureLineStarts();\r\n return this._lineStarts.getAccumulatedValue(position.lineNumber - 2) + (position.column - 1);\r\n }\r\n positionAt(offset) {\r\n offset = Math.floor(offset);\r\n offset = Math.max(0, offset);\r\n this._ensureLineStarts();\r\n let out = this._lineStarts.getIndexOf(offset);\r\n let lineLength = this._lines[out.index].length;\r\n // Ensure we return a valid position\r\n return {\r\n lineNumber: 1 + out.index,\r\n column: 1 + Math.min(out.remainder, lineLength)\r\n };\r\n }\r\n _validateRange(range) {\r\n const start = this._validatePosition({ lineNumber: range.startLineNumber, column: range.startColumn });\r\n const end = this._validatePosition({ lineNumber: range.endLineNumber, column: range.endColumn });\r\n if (start.lineNumber !== range.startLineNumber\r\n || start.column !== range.startColumn\r\n || end.lineNumber !== range.endLineNumber\r\n || end.column !== range.endColumn) {\r\n return {\r\n startLineNumber: start.lineNumber,\r\n startColumn: start.column,\r\n endLineNumber: end.lineNumber,\r\n endColumn: end.column\r\n };\r\n }\r\n return range;\r\n }\r\n _validatePosition(position) {\r\n if (!Position.isIPosition(position)) {\r\n throw new Error('bad position');\r\n }\r\n let { lineNumber, column } = position;\r\n let hasChanged = false;\r\n if (lineNumber < 1) {\r\n lineNumber = 1;\r\n column = 1;\r\n hasChanged = true;\r\n }\r\n else if (lineNumber > this._lines.length) {\r\n lineNumber = this._lines.length;\r\n column = this._lines[lineNumber - 1].length + 1;\r\n hasChanged = true;\r\n }\r\n else {\r\n let maxCharacter = this._lines[lineNumber - 1].length + 1;\r\n if (column < 1) {\r\n column = 1;\r\n hasChanged = true;\r\n }\r\n else if (column > maxCharacter) {\r\n column = maxCharacter;\r\n hasChanged = true;\r\n }\r\n }\r\n if (!hasChanged) {\r\n return position;\r\n }\r\n else {\r\n return { lineNumber, column };\r\n }\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class EditorSimpleWorker {\r\n constructor(host, foreignModuleFactory) {\r\n this._host = host;\r\n this._models = Object.create(null);\r\n this._foreignModuleFactory = foreignModuleFactory;\r\n this._foreignModule = null;\r\n }\r\n dispose() {\r\n this._models = Object.create(null);\r\n }\r\n _getModel(uri) {\r\n return this._models[uri];\r\n }\r\n _getModels() {\r\n let all = [];\r\n Object.keys(this._models).forEach((key) => all.push(this._models[key]));\r\n return all;\r\n }\r\n acceptNewModel(data) {\r\n this._models[data.url] = new MirrorModel(URI.parse(data.url), data.lines, data.EOL, data.versionId);\r\n }\r\n acceptModelChanged(strURL, e) {\r\n if (!this._models[strURL]) {\r\n return;\r\n }\r\n let model = this._models[strURL];\r\n model.onEvents(e);\r\n }\r\n acceptRemovedModel(strURL) {\r\n if (!this._models[strURL]) {\r\n return;\r\n }\r\n delete this._models[strURL];\r\n }\r\n // ---- BEGIN diff --------------------------------------------------------------------------\r\n computeDiff(originalUrl, modifiedUrl, ignoreTrimWhitespace, maxComputationTime) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const original = this._getModel(originalUrl);\r\n const modified = this._getModel(modifiedUrl);\r\n if (!original || !modified) {\r\n return null;\r\n }\r\n const originalLines = original.getLinesContent();\r\n const modifiedLines = modified.getLinesContent();\r\n const diffComputer = new DiffComputer(originalLines, modifiedLines, {\r\n shouldComputeCharChanges: true,\r\n shouldPostProcessCharChanges: true,\r\n shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,\r\n shouldMakePrettyDiff: true,\r\n maxComputationTime: maxComputationTime\r\n });\r\n const diffResult = diffComputer.computeDiff();\r\n const identical = (diffResult.changes.length > 0 ? false : this._modelsAreIdentical(original, modified));\r\n return {\r\n quitEarly: diffResult.quitEarly,\r\n identical: identical,\r\n changes: diffResult.changes\r\n };\r\n });\r\n }\r\n _modelsAreIdentical(original, modified) {\r\n const originalLineCount = original.getLineCount();\r\n const modifiedLineCount = modified.getLineCount();\r\n if (originalLineCount !== modifiedLineCount) {\r\n return false;\r\n }\r\n for (let line = 1; line <= originalLineCount; line++) {\r\n const originalLine = original.getLineContent(line);\r\n const modifiedLine = modified.getLineContent(line);\r\n if (originalLine !== modifiedLine) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n computeMoreMinimalEdits(modelUrl, edits) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const model = this._getModel(modelUrl);\r\n if (!model) {\r\n return edits;\r\n }\r\n const result = [];\r\n let lastEol = undefined;\r\n edits = edits.slice(0).sort((a, b) => {\r\n if (a.range && b.range) {\r\n return Range.compareRangesUsingStarts(a.range, b.range);\r\n }\r\n // eol only changes should go to the end\r\n let aRng = a.range ? 0 : 1;\r\n let bRng = b.range ? 0 : 1;\r\n return aRng - bRng;\r\n });\r\n for (let { range, text, eol } of edits) {\r\n if (typeof eol === 'number') {\r\n lastEol = eol;\r\n }\r\n if (Range.isEmpty(range) && !text) {\r\n // empty change\r\n continue;\r\n }\r\n const original = model.getValueInRange(range);\r\n text = text.replace(/\\r\\n|\\n|\\r/g, model.eol);\r\n if (original === text) {\r\n // noop\r\n continue;\r\n }\r\n // make sure diff won't take too long\r\n if (Math.max(text.length, original.length) > EditorSimpleWorker._diffLimit) {\r\n result.push({ range, text });\r\n continue;\r\n }\r\n // compute diff between original and edit.text\r\n const changes = stringDiff(original, text, false);\r\n const editOffset = model.offsetAt(Range.lift(range).getStartPosition());\r\n for (const change of changes) {\r\n const start = model.positionAt(editOffset + change.originalStart);\r\n const end = model.positionAt(editOffset + change.originalStart + change.originalLength);\r\n const newEdit = {\r\n text: text.substr(change.modifiedStart, change.modifiedLength),\r\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column }\r\n };\r\n if (model.getValueInRange(newEdit.range) !== newEdit.text) {\r\n result.push(newEdit);\r\n }\r\n }\r\n }\r\n if (typeof lastEol === 'number') {\r\n result.push({ eol: lastEol, text: '', range: { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 } });\r\n }\r\n return result;\r\n });\r\n }\r\n // ---- END minimal edits ---------------------------------------------------------------\r\n computeLinks(modelUrl) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let model = this._getModel(modelUrl);\r\n if (!model) {\r\n return null;\r\n }\r\n return computeLinks(model);\r\n });\r\n }\r\n textualSuggest(modelUrls, leadingWord, wordDef, wordDefFlags) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const sw = new StopWatch(true);\r\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\r\n const seen = new Set();\r\n outer: for (let url of modelUrls) {\r\n const model = this._getModel(url);\r\n if (!model) {\r\n continue;\r\n }\r\n for (let word of model.words(wordDefRegExp)) {\r\n if (word === leadingWord || !isNaN(Number(word))) {\r\n continue;\r\n }\r\n seen.add(word);\r\n if (seen.size > EditorSimpleWorker._suggestionsLimit) {\r\n break outer;\r\n }\r\n }\r\n }\r\n return { words: Array.from(seen), duration: sw.elapsed() };\r\n });\r\n }\r\n // ---- END suggest --------------------------------------------------------------------------\r\n //#region -- word ranges --\r\n computeWordRanges(modelUrl, range, wordDef, wordDefFlags) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let model = this._getModel(modelUrl);\r\n if (!model) {\r\n return Object.create(null);\r\n }\r\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\r\n const result = Object.create(null);\r\n for (let line = range.startLineNumber; line < range.endLineNumber; line++) {\r\n let words = model.getLineWords(line, wordDefRegExp);\r\n for (const word of words) {\r\n if (!isNaN(Number(word.word))) {\r\n continue;\r\n }\r\n let array = result[word.word];\r\n if (!array) {\r\n array = [];\r\n result[word.word] = array;\r\n }\r\n array.push({\r\n startLineNumber: line,\r\n startColumn: word.startColumn,\r\n endLineNumber: line,\r\n endColumn: word.endColumn\r\n });\r\n }\r\n }\r\n return result;\r\n });\r\n }\r\n //#endregion\r\n navigateValueSet(modelUrl, range, up, wordDef, wordDefFlags) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let model = this._getModel(modelUrl);\r\n if (!model) {\r\n return null;\r\n }\r\n let wordDefRegExp = new RegExp(wordDef, wordDefFlags);\r\n if (range.startColumn === range.endColumn) {\r\n range = {\r\n startLineNumber: range.startLineNumber,\r\n startColumn: range.startColumn,\r\n endLineNumber: range.endLineNumber,\r\n endColumn: range.endColumn + 1\r\n };\r\n }\r\n let selectionText = model.getValueInRange(range);\r\n let wordRange = model.getWordAtPosition({ lineNumber: range.startLineNumber, column: range.startColumn }, wordDefRegExp);\r\n if (!wordRange) {\r\n return null;\r\n }\r\n let word = model.getValueInRange(wordRange);\r\n let result = BasicInplaceReplace.INSTANCE.navigateValueSet(range, selectionText, wordRange, word, up);\r\n return result;\r\n });\r\n }\r\n // ---- BEGIN foreign module support --------------------------------------------------------------------------\r\n loadForeignModule(moduleId, createData, foreignHostMethods) {\r\n const proxyMethodRequest = (method, args) => {\r\n return this._host.fhr(method, args);\r\n };\r\n const foreignHost = types.createProxyObject(foreignHostMethods, proxyMethodRequest);\r\n let ctx = {\r\n host: foreignHost,\r\n getMirrorModels: () => {\r\n return this._getModels();\r\n }\r\n };\r\n if (this._foreignModuleFactory) {\r\n this._foreignModule = this._foreignModuleFactory(ctx, createData);\r\n // static foreing module\r\n return Promise.resolve(types.getAllMethodNames(this._foreignModule));\r\n }\r\n // ESM-comment-begin\r\n // \t\treturn new Promise<any>((resolve, reject) => {\r\n // \t\t\trequire([moduleId], (foreignModule: { create: IForeignModuleFactory }) => {\r\n // \t\t\t\tthis._foreignModule = foreignModule.create(ctx, createData);\r\n // \r\n // \t\t\t\tresolve(types.getAllMethodNames(this._foreignModule));\r\n // \r\n // \t\t\t}, reject);\r\n // \t\t});\r\n // ESM-comment-end\r\n // ESM-uncomment-begin\r\n return Promise.reject(new Error(`Unexpected usage`));\r\n // ESM-uncomment-end\r\n }\r\n // foreign method request\r\n fmr(method, args) {\r\n if (!this._foreignModule || typeof this._foreignModule[method] !== 'function') {\r\n return Promise.reject(new Error('Missing requestHandler or method: ' + method));\r\n }\r\n try {\r\n return Promise.resolve(this._foreignModule[method].apply(this._foreignModule, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n}\r\n// ---- END diff --------------------------------------------------------------------------\r\n// ---- BEGIN minimal edits ---------------------------------------------------------------\r\nEditorSimpleWorker._diffLimit = 100000;\r\n// ---- BEGIN suggest --------------------------------------------------------------------------\r\nEditorSimpleWorker._suggestionsLimit = 10000;\r\n/**\r\n * Called on the worker side\r\n * @internal\r\n */\r\nexport function create(host) {\r\n return new EditorSimpleWorker(host, null);\r\n}\r\nif (typeof importScripts === 'function') {\r\n // Running in a web worker\r\n globals.monaco = createMonacoBaseAPI();\r\n}\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { SimpleWorkerServer } from '../base/common/worker/simpleWorker.js';\r\nimport { EditorSimpleWorker } from './common/services/editorSimpleWorker.js';\r\nlet initialized = false;\r\nexport function initialize(foreignModule) {\r\n if (initialized) {\r\n return;\r\n }\r\n initialized = true;\r\n const simpleWorker = new SimpleWorkerServer((msg) => {\r\n self.postMessage(msg);\r\n }, (host) => new EditorSimpleWorker(host, foreignModule));\r\n self.onmessage = (e) => {\r\n simpleWorker.onmessage(e.data);\r\n };\r\n}\r\nself.onmessage = (e) => {\r\n // Ignore first message in this case and initialize if not yet initialized\r\n if (!initialized) {\r\n initialize(null);\r\n }\r\n};\r\n"],"sourceRoot":""}