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/ChE,EAAOD,Q,qGCff,WAoBMsE,EAAiB,IAAIxC,OAAOkB,+SAElC,SAASuB,EAAWlD,EAAmBC,GACrC,IAAMkD,EAAYC,OAAOC,OACzB,GAAIF,EAAW,CACb,IACEA,EAAUG,OAAS,KACnB,UAGFH,EAAUI,SAASC,KAAOvD,OAE1BkB,QAAQsC,KAAK,uDAUjB,iBAKE,WACUvE,EACAC,EACAuE,QAFA,IAAAxE,IAAAA,EAAA,QACA,IAAAC,IAAAA,EAAA,SACA,IAAAuE,IAAAA,GAAA,GAFA,KAAAxE,SAAAA,EACA,KAAAC,SAAAA,EACA,KAAAuE,iBAAAA,EA0BZ,OAtBS,YAAApD,SAAP,SAAgBD,GAGd,GAFAX,KAAKV,UAAYqB,EAEbX,KAAKgE,kBAAoB,yBAA0BhE,KAAKV,UAAW,CACrE,IACMoB,GADAuD,EAAUjE,KAAKP,UACCyE,UAAYX,EAClCvD,KAAKmE,cAAgBnE,KAAKV,UAAU8E,qBAAqB,IAAI,EAAA3D,gBAAgBT,KAAKV,UAAWoB,EAAOV,KAAKR,SAAUyE,QAC9G,CAEL,IAAMA,GAAAA,EAAUjE,KAAKP,UACb4E,WAAa,EACrBrE,KAAKsE,eAAkBtE,KAAKV,UAAuBiF,oBAAoBhB,EAAgBvD,KAAKR,SAAUyE,KAInG,YAAAO,QAAP,W,WAC8BnB,IAAxBrD,KAAKsE,qBAAmDjB,IAAnBrD,KAAKV,WAC5CU,KAAKV,UAAUmF,sBAAsBzE,KAAKsE,gBAG1B,QAAlB,EAAAtE,KAAKmE,qBAAa,SAAEK,WAExB,EAlCA,GAAa,EAAAE,cAAAA,G","sources":["webpack://WebLinksAddon/webpack/universalModuleDefinition","webpack://WebLinksAddon/./src/WebLinkProvider.ts","webpack://WebLinksAddon/webpack/bootstrap","webpack://WebLinksAddon/./src/WebLinksAddon.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WebLinksAddon\"] = factory();\n\telse\n\t\troot[\"WebLinksAddon\"] = factory();\n})(self, function() {\nreturn ","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ILinkProvider, ILink, Terminal, IViewportRange } from 'xterm';\n\ninterface ILinkProviderOptions {\n hover?(event: MouseEvent, text: string, location: IViewportRange): void;\n leave?(event: MouseEvent, text: string): void;\n}\n\nexport class WebLinkProvider implements ILinkProvider {\n\n constructor(\n private readonly _terminal: Terminal,\n private readonly _regex: RegExp,\n private readonly _handler: (event: MouseEvent, uri: string) => void,\n private readonly _options: ILinkProviderOptions = {}\n ) {\n\n }\n\n public provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void {\n const links = LinkComputer.computeLink(y, this._regex, this._terminal, this._handler);\n callback(this._addCallbacks(links));\n }\n\n private _addCallbacks(links: ILink[]): ILink[] {\n return links.map(link => {\n link.leave = this._options.leave;\n link.hover = (event: MouseEvent, uri: string): void => {\n if (this._options.hover) {\n const { range } = link;\n this._options.hover(event, uri, range);\n }\n };\n return link;\n });\n }\n}\n\nexport class LinkComputer {\n public static computeLink(y: number, regex: RegExp, terminal: Terminal, activate: (event: MouseEvent, uri: string) => void): ILink[] {\n const rex = new RegExp(regex.source, (regex.flags || '') + 'g');\n\n const [line, startLineIndex] = LinkComputer._translateBufferLineToStringWithWrap(y - 1, false, terminal);\n\n let match;\n let stringIndex = -1;\n const result: ILink[] = [];\n\n while ((match = rex.exec(line)) !== null) {\n const text = match[1];\n if (!text) {\n // something matched but does not comply with the given matchIndex\n // since this is most likely a bug the regex itself we simply do nothing here\n console.log('match found without corresponding matchIndex');\n break;\n }\n\n // Get index, match.index is for the outer match which includes negated chars\n // therefore we cannot use match.index directly, instead we search the position\n // of the match group in text again\n // also correct regex and string search offsets for the next loop run\n stringIndex = line.indexOf(text, stringIndex + 1);\n rex.lastIndex = stringIndex + text.length;\n if (stringIndex < 0) {\n // invalid stringIndex (should not have happened)\n break;\n }\n\n let endX = stringIndex + text.length;\n let endY = startLineIndex + 1;\n\n while (endX > terminal.cols) {\n endX -= terminal.cols;\n endY++;\n }\n\n const range = {\n start: {\n x: stringIndex + 1,\n y: startLineIndex + 1\n },\n end: {\n x: endX,\n y: endY\n }\n };\n\n result.push({ range, text, activate });\n }\n\n return result;\n }\n\n /**\n * Gets the entire line for the buffer line\n * @param line The line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param terminal The terminal\n */\n private static _translateBufferLineToStringWithWrap(lineIndex: number, trimRight: boolean, terminal: Terminal): [string, number] {\n let lineString = '';\n let lineWrapsToNext: boolean;\n let prevLinesToWrap: boolean;\n\n do {\n const line = terminal.buffer.active.getLine(lineIndex);\n if (!line) {\n break;\n }\n\n if (line.isWrapped) {\n lineIndex--;\n }\n\n prevLinesToWrap = line.isWrapped;\n } while (prevLinesToWrap);\n\n const startLineIndex = lineIndex;\n\n do {\n const nextLine = terminal.buffer.active.getLine(lineIndex + 1);\n lineWrapsToNext = nextLine ? nextLine.isWrapped : false;\n const line = terminal.buffer.active.getLine(lineIndex);\n if (!line) {\n break;\n }\n lineString += line.translateToString(!lineWrapsToNext && trimRight).substring(0, terminal.cols);\n lineIndex++;\n } while (lineWrapsToNext);\n\n return [lineString, startLineIndex];\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Terminal, ILinkMatcherOptions, ITerminalAddon, IDisposable, IViewportRange } from 'xterm';\nimport { WebLinkProvider } from './WebLinkProvider';\n\nconst protocolClause = '(https?:\\\\/\\\\/)';\nconst domainCharacterSet = '[\\\\da-z\\\\.-]+';\nconst negatedDomainCharacterSet = '[^\\\\da-z\\\\.-]+';\nconst domainBodyClause = '(' + domainCharacterSet + ')';\nconst tldClause = '([a-z\\\\.]{2,6})';\nconst ipClause = '((\\\\d{1,3}\\\\.){3}\\\\d{1,3})';\nconst localHostClause = '(localhost)';\nconst portClause = '(:\\\\d{1,5})';\nconst hostClause = '((' + domainBodyClause + '\\\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?';\nconst pathCharacterSet = '(\\\\/[\\\\/\\\\w\\\\.\\\\-%~:+@]*)*([^:\"\\'\\\\s])';\nconst pathClause = '(' + pathCharacterSet + ')?';\nconst queryStringHashFragmentCharacterSet = '[0-9\\\\w\\\\[\\\\]\\\\(\\\\)\\\\/\\\\?\\\\!#@$%&\\'*+,:;~\\\\=\\\\.\\\\-]*';\nconst queryStringClause = '(\\\\?' + queryStringHashFragmentCharacterSet + ')?';\nconst hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?';\nconst negatedPathCharacterSet = '[^\\\\/\\\\w\\\\.\\\\-%]+';\nconst bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause;\nconst start = '(?:^|' + negatedDomainCharacterSet + ')(';\nconst end = ')($|' + negatedPathCharacterSet + ')';\nconst strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);\n\nfunction handleLink(event: MouseEvent, uri: string): void {\n const newWindow = window.open();\n if (newWindow) {\n try {\n newWindow.opener = null;\n } catch {\n // no-op, Electron can throw\n }\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n}\n\ninterface ILinkProviderOptions {\n hover?(event: MouseEvent, text: string, location: IViewportRange): void;\n leave?(event: MouseEvent, text: string): void;\n urlRegex?: RegExp;\n}\n\nexport class WebLinksAddon implements ITerminalAddon {\n private _linkMatcherId: number | undefined;\n private _terminal: Terminal | undefined;\n private _linkProvider: IDisposable | undefined;\n\n constructor(\n private _handler: (event: MouseEvent, uri: string) => void = handleLink,\n private _options: ILinkMatcherOptions | ILinkProviderOptions = {},\n private _useLinkProvider: boolean = false\n ) {\n }\n\n public activate(terminal: Terminal): void {\n this._terminal = terminal;\n\n if (this._useLinkProvider && 'registerLinkProvider' in this._terminal) {\n const options = this._options as ILinkProviderOptions;\n const regex = options.urlRegex || strictUrlRegex;\n this._linkProvider = this._terminal.registerLinkProvider(new WebLinkProvider(this._terminal, regex, this._handler, options));\n } else {\n // TODO: This should be removed eventually\n const options = this._options as ILinkMatcherOptions;\n options.matchIndex = 1;\n this._linkMatcherId = (this._terminal as Terminal).registerLinkMatcher(strictUrlRegex, this._handler, options);\n }\n }\n\n public dispose(): void {\n if (this._linkMatcherId !== undefined && this._terminal !== undefined) {\n this._terminal.deregisterLinkMatcher(this._linkMatcherId);\n }\n\n this._linkProvider?.dispose();\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","_terminal","_regex","_handler","_options","provideLinks","y","callback","links","LinkComputer","computeLink","this","_addCallbacks","map","link","leave","hover","event","uri","range","WebLinkProvider","regex","terminal","activate","match","rex","RegExp","source","flags","_translateBufferLineToStringWithWrap","line","startLineIndex","stringIndex","result","exec","text","console","log","indexOf","lastIndex","length","endX","endY","cols","start","x","end","push","lineIndex","trimRight","lineWrapsToNext","prevLinesToWrap","lineString","buffer","active","getLine","isWrapped","nextLine","translateToString","substring","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","strictUrlRegex","handleLink","newWindow","window","open","opener","location","href","warn","_useLinkProvider","options","urlRegex","_linkProvider","registerLinkProvider","matchIndex","_linkMatcherId","registerLinkMatcher","dispose","deregisterLinkMatcher","WebLinksAddon"],"sourceRoot":""}