open-webui/static/pyscript/index-CTWZX_TW.js.map
2024-05-16 17:49:28 -10:00

1 line
134 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"index-CTWZX_TW.js","sources":["../node_modules/@codemirror/autocomplete/dist/index.js"],"sourcesContent":["import { Annotation, StateEffect, EditorSelection, codePointAt, codePointSize, fromCodePoint, Facet, combineConfig, StateField, Prec, Text, Transaction, MapMode, RangeValue, RangeSet, CharCategory } from '@codemirror/state';\nimport { Direction, logException, showTooltip, EditorView, ViewPlugin, getTooltip, Decoration, WidgetType, keymap } from '@codemirror/view';\nimport { syntaxTree, indentUnit } from '@codemirror/language';\n\n/**\nAn instance of this is passed to completion source functions.\n*/\nclass CompletionContext {\n /**\n Create a new completion context. (Mostly useful for testing\n completion sources—in the editor, the extension will create\n these for you.)\n */\n constructor(\n /**\n The editor state that the completion happens in.\n */\n state, \n /**\n The position at which the completion is happening.\n */\n pos, \n /**\n Indicates whether completion was activated explicitly, or\n implicitly by typing. The usual way to respond to this is to\n only return completions when either there is part of a\n completable entity before the cursor, or `explicit` is true.\n */\n explicit) {\n this.state = state;\n this.pos = pos;\n this.explicit = explicit;\n /**\n @internal\n */\n this.abortListeners = [];\n }\n /**\n Get the extent, content, and (if there is a token) type of the\n token before `this.pos`.\n */\n tokenBefore(types) {\n let token = syntaxTree(this.state).resolveInner(this.pos, -1);\n while (token && types.indexOf(token.name) < 0)\n token = token.parent;\n return token ? { from: token.from, to: this.pos,\n text: this.state.sliceDoc(token.from, this.pos),\n type: token.type } : null;\n }\n /**\n Get the match of the given expression directly before the\n cursor.\n */\n matchBefore(expr) {\n let line = this.state.doc.lineAt(this.pos);\n let start = Math.max(line.from, this.pos - 250);\n let str = line.text.slice(start - line.from, this.pos - line.from);\n let found = str.search(ensureAnchor(expr, false));\n return found < 0 ? null : { from: start + found, to: this.pos, text: str.slice(found) };\n }\n /**\n Yields true when the query has been aborted. Can be useful in\n asynchronous queries to avoid doing work that will be ignored.\n */\n get aborted() { return this.abortListeners == null; }\n /**\n Allows you to register abort handlers, which will be called when\n the query is\n [aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).\n */\n addEventListener(type, listener) {\n if (type == \"abort\" && this.abortListeners)\n this.abortListeners.push(listener);\n }\n}\nfunction toSet(chars) {\n let flat = Object.keys(chars).join(\"\");\n let words = /\\w/.test(flat);\n if (words)\n flat = flat.replace(/\\w/g, \"\");\n return `[${words ? \"\\\\w\" : \"\"}${flat.replace(/[^\\w\\s]/g, \"\\\\$&\")}]`;\n}\nfunction prefixMatch(options) {\n let first = Object.create(null), rest = Object.create(null);\n for (let { label } of options) {\n first[label[0]] = true;\n for (let i = 1; i < label.length; i++)\n rest[label[i]] = true;\n }\n let source = toSet(first) + toSet(rest) + \"*$\";\n return [new RegExp(\"^\" + source), new RegExp(source)];\n}\n/**\nGiven a a fixed array of options, return an autocompleter that\ncompletes them.\n*/\nfunction completeFromList(list) {\n let options = list.map(o => typeof o == \"string\" ? { label: o } : o);\n let [validFor, match] = options.every(o => /^\\w+$/.test(o.label)) ? [/\\w*$/, /\\w+$/] : prefixMatch(options);\n return (context) => {\n let token = context.matchBefore(match);\n return token || context.explicit ? { from: token ? token.from : context.pos, options, validFor } : null;\n };\n}\n/**\nWrap the given completion source so that it will only fire when the\ncursor is in a syntax node with one of the given names.\n*/\nfunction ifIn(nodes, source) {\n return (context) => {\n for (let pos = syntaxTree(context.state).resolveInner(context.pos, -1); pos; pos = pos.parent) {\n if (nodes.indexOf(pos.name) > -1)\n return source(context);\n if (pos.type.isTop)\n break;\n }\n return null;\n };\n}\n/**\nWrap the given completion source so that it will not fire when the\ncursor is in a syntax node with one of the given names.\n*/\nfunction ifNotIn(nodes, source) {\n return (context) => {\n for (let pos = syntaxTree(context.state).resolveInner(context.pos, -1); pos; pos = pos.parent) {\n if (nodes.indexOf(pos.name) > -1)\n return null;\n if (pos.type.isTop)\n break;\n }\n return source(context);\n };\n}\nclass Option {\n constructor(completion, source, match, score) {\n this.completion = completion;\n this.source = source;\n this.match = match;\n this.score = score;\n }\n}\nfunction cur(state) { return state.selection.main.from; }\n// Make sure the given regexp has a $ at its end and, if `start` is\n// true, a ^ at its start.\nfunction ensureAnchor(expr, start) {\n var _a;\n let { source } = expr;\n let addStart = start && source[0] != \"^\", addEnd = source[source.length - 1] != \"$\";\n if (!addStart && !addEnd)\n return expr;\n return new RegExp(`${addStart ? \"^\" : \"\"}(?:${source})${addEnd ? \"$\" : \"\"}`, (_a = expr.flags) !== null && _a !== void 0 ? _a : (expr.ignoreCase ? \"i\" : \"\"));\n}\n/**\nThis annotation is added to transactions that are produced by\npicking a completion.\n*/\nconst pickedCompletion = /*@__PURE__*/Annotation.define();\n/**\nHelper function that returns a transaction spec which inserts a\ncompletion's text in the main selection range, and any other\nselection range that has the same text in front of it.\n*/\nfunction insertCompletionText(state, text, from, to) {\n let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;\n return Object.assign(Object.assign({}, state.changeByRange(range => {\n if (range != main && from != to &&\n state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))\n return { range };\n return {\n changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: text },\n range: EditorSelection.cursor(range.from + fromOff + text.length)\n };\n })), { scrollIntoView: true, userEvent: \"input.complete\" });\n}\nconst SourceCache = /*@__PURE__*/new WeakMap();\nfunction asSource(source) {\n if (!Array.isArray(source))\n return source;\n let known = SourceCache.get(source);\n if (!known)\n SourceCache.set(source, known = completeFromList(source));\n return known;\n}\nconst startCompletionEffect = /*@__PURE__*/StateEffect.define();\nconst closeCompletionEffect = /*@__PURE__*/StateEffect.define();\n\n// A pattern matcher for fuzzy completion matching. Create an instance\n// once for a pattern, and then use that to match any number of\n// completions.\nclass FuzzyMatcher {\n constructor(pattern) {\n this.pattern = pattern;\n this.chars = [];\n this.folded = [];\n // Buffers reused by calls to `match` to track matched character\n // positions.\n this.any = [];\n this.precise = [];\n this.byWord = [];\n this.score = 0;\n this.matched = [];\n for (let p = 0; p < pattern.length;) {\n let char = codePointAt(pattern, p), size = codePointSize(char);\n this.chars.push(char);\n let part = pattern.slice(p, p + size), upper = part.toUpperCase();\n this.folded.push(codePointAt(upper == part ? part.toLowerCase() : upper, 0));\n p += size;\n }\n this.astral = pattern.length != this.chars.length;\n }\n ret(score, matched) {\n this.score = score;\n this.matched = matched;\n return true;\n }\n // Matches a given word (completion) against the pattern (input).\n // Will return a boolean indicating whether there was a match and,\n // on success, set `this.score` to the score, `this.matched` to an\n // array of `from, to` pairs indicating the matched parts of `word`.\n //\n // The score is a number that is more negative the worse the match\n // is. See `Penalty` above.\n match(word) {\n if (this.pattern.length == 0)\n return this.ret(-100 /* Penalty.NotFull */, []);\n if (word.length < this.pattern.length)\n return false;\n let { chars, folded, any, precise, byWord } = this;\n // For single-character queries, only match when they occur right\n // at the start\n if (chars.length == 1) {\n let first = codePointAt(word, 0), firstSize = codePointSize(first);\n let score = firstSize == word.length ? 0 : -100 /* Penalty.NotFull */;\n if (first == chars[0]) ;\n else if (first == folded[0])\n score += -200 /* Penalty.CaseFold */;\n else\n return false;\n return this.ret(score, [0, firstSize]);\n }\n let direct = word.indexOf(this.pattern);\n if (direct == 0)\n return this.ret(word.length == this.pattern.length ? 0 : -100 /* Penalty.NotFull */, [0, this.pattern.length]);\n let len = chars.length, anyTo = 0;\n if (direct < 0) {\n for (let i = 0, e = Math.min(word.length, 200); i < e && anyTo < len;) {\n let next = codePointAt(word, i);\n if (next == chars[anyTo] || next == folded[anyTo])\n any[anyTo++] = i;\n i += codePointSize(next);\n }\n // No match, exit immediately\n if (anyTo < len)\n return false;\n }\n // This tracks the extent of the precise (non-folded, not\n // necessarily adjacent) match\n let preciseTo = 0;\n // Tracks whether there is a match that hits only characters that\n // appear to be starting words. `byWordFolded` is set to true when\n // a case folded character is encountered in such a match\n let byWordTo = 0, byWordFolded = false;\n // If we've found a partial adjacent match, these track its state\n let adjacentTo = 0, adjacentStart = -1, adjacentEnd = -1;\n let hasLower = /[a-z]/.test(word), wordAdjacent = true;\n // Go over the option's text, scanning for the various kinds of matches\n for (let i = 0, e = Math.min(word.length, 200), prevType = 0 /* Tp.NonWord */; i < e && byWordTo < len;) {\n let next = codePointAt(word, i);\n if (direct < 0) {\n if (preciseTo < len && next == chars[preciseTo])\n precise[preciseTo++] = i;\n if (adjacentTo < len) {\n if (next == chars[adjacentTo] || next == folded[adjacentTo]) {\n if (adjacentTo == 0)\n adjacentStart = i;\n adjacentEnd = i + 1;\n adjacentTo++;\n }\n else {\n adjacentTo = 0;\n }\n }\n }\n let ch, type = next < 0xff\n ? (next >= 48 && next <= 57 || next >= 97 && next <= 122 ? 2 /* Tp.Lower */ : next >= 65 && next <= 90 ? 1 /* Tp.Upper */ : 0 /* Tp.NonWord */)\n : ((ch = fromCodePoint(next)) != ch.toLowerCase() ? 1 /* Tp.Upper */ : ch != ch.toUpperCase() ? 2 /* Tp.Lower */ : 0 /* Tp.NonWord */);\n if (!i || type == 1 /* Tp.Upper */ && hasLower || prevType == 0 /* Tp.NonWord */ && type != 0 /* Tp.NonWord */) {\n if (chars[byWordTo] == next || (folded[byWordTo] == next && (byWordFolded = true)))\n byWord[byWordTo++] = i;\n else if (byWord.length)\n wordAdjacent = false;\n }\n prevType = type;\n i += codePointSize(next);\n }\n if (byWordTo == len && byWord[0] == 0 && wordAdjacent)\n return this.result(-100 /* Penalty.ByWord */ + (byWordFolded ? -200 /* Penalty.CaseFold */ : 0), byWord, word);\n if (adjacentTo == len && adjacentStart == 0)\n return this.ret(-200 /* Penalty.CaseFold */ - word.length + (adjacentEnd == word.length ? 0 : -100 /* Penalty.NotFull */), [0, adjacentEnd]);\n if (direct > -1)\n return this.ret(-700 /* Penalty.NotStart */ - word.length, [direct, direct + this.pattern.length]);\n if (adjacentTo == len)\n return this.ret(-200 /* Penalty.CaseFold */ + -700 /* Penalty.NotStart */ - word.length, [adjacentStart, adjacentEnd]);\n if (byWordTo == len)\n return this.result(-100 /* Penalty.ByWord */ + (byWordFolded ? -200 /* Penalty.CaseFold */ : 0) + -700 /* Penalty.NotStart */ +\n (wordAdjacent ? 0 : -1100 /* Penalty.Gap */), byWord, word);\n return chars.length == 2 ? false\n : this.result((any[0] ? -700 /* Penalty.NotStart */ : 0) + -200 /* Penalty.CaseFold */ + -1100 /* Penalty.Gap */, any, word);\n }\n result(score, positions, word) {\n let result = [], i = 0;\n for (let pos of positions) {\n let to = pos + (this.astral ? codePointSize(codePointAt(word, pos)) : 1);\n if (i && result[i - 1] == pos)\n result[i - 1] = to;\n else {\n result[i++] = pos;\n result[i++] = to;\n }\n }\n return this.ret(score - word.length, result);\n }\n}\n\nconst completionConfig = /*@__PURE__*/Facet.define({\n combine(configs) {\n return combineConfig(configs, {\n activateOnTyping: true,\n activateOnTypingDelay: 100,\n selectOnOpen: true,\n override: null,\n closeOnBlur: true,\n maxRenderedOptions: 100,\n defaultKeymap: true,\n tooltipClass: () => \"\",\n optionClass: () => \"\",\n aboveCursor: false,\n icons: true,\n addToOptions: [],\n positionInfo: defaultPositionInfo,\n compareCompletions: (a, b) => a.label.localeCompare(b.label),\n interactionDelay: 75,\n updateSyncTime: 100\n }, {\n defaultKeymap: (a, b) => a && b,\n closeOnBlur: (a, b) => a && b,\n icons: (a, b) => a && b,\n tooltipClass: (a, b) => c => joinClass(a(c), b(c)),\n optionClass: (a, b) => c => joinClass(a(c), b(c)),\n addToOptions: (a, b) => a.concat(b)\n });\n }\n});\nfunction joinClass(a, b) {\n return a ? b ? a + \" \" + b : a : b;\n}\nfunction defaultPositionInfo(view, list, option, info, space, tooltip) {\n let rtl = view.textDirection == Direction.RTL, left = rtl, narrow = false;\n let side = \"top\", offset, maxWidth;\n let spaceLeft = list.left - space.left, spaceRight = space.right - list.right;\n let infoWidth = info.right - info.left, infoHeight = info.bottom - info.top;\n if (left && spaceLeft < Math.min(infoWidth, spaceRight))\n left = false;\n else if (!left && spaceRight < Math.min(infoWidth, spaceLeft))\n left = true;\n if (infoWidth <= (left ? spaceLeft : spaceRight)) {\n offset = Math.max(space.top, Math.min(option.top, space.bottom - infoHeight)) - list.top;\n maxWidth = Math.min(400 /* Info.Width */, left ? spaceLeft : spaceRight);\n }\n else {\n narrow = true;\n maxWidth = Math.min(400 /* Info.Width */, (rtl ? list.right : space.right - list.left) - 30 /* Info.Margin */);\n let spaceBelow = space.bottom - list.bottom;\n if (spaceBelow >= infoHeight || spaceBelow > list.top) { // Below the completion\n offset = option.bottom - list.top;\n }\n else { // Above it\n side = \"bottom\";\n offset = list.bottom - option.top;\n }\n }\n let scaleY = (list.bottom - list.top) / tooltip.offsetHeight;\n let scaleX = (list.right - list.left) / tooltip.offsetWidth;\n return {\n style: `${side}: ${offset / scaleY}px; max-width: ${maxWidth / scaleX}px`,\n class: \"cm-completionInfo-\" + (narrow ? (rtl ? \"left-narrow\" : \"right-narrow\") : left ? \"left\" : \"right\")\n };\n}\n\nfunction optionContent(config) {\n let content = config.addToOptions.slice();\n if (config.icons)\n content.push({\n render(completion) {\n let icon = document.createElement(\"div\");\n icon.classList.add(\"cm-completionIcon\");\n if (completion.type)\n icon.classList.add(...completion.type.split(/\\s+/g).map(cls => \"cm-completionIcon-\" + cls));\n icon.setAttribute(\"aria-hidden\", \"true\");\n return icon;\n },\n position: 20\n });\n content.push({\n render(completion, _s, _v, match) {\n let labelElt = document.createElement(\"span\");\n labelElt.className = \"cm-completionLabel\";\n let label = completion.displayLabel || completion.label, off = 0;\n for (let j = 0; j < match.length;) {\n let from = match[j++], to = match[j++];\n if (from > off)\n labelElt.appendChild(document.createTextNode(label.slice(off, from)));\n let span = labelElt.appendChild(document.createElement(\"span\"));\n span.appendChild(document.createTextNode(label.slice(from, to)));\n span.className = \"cm-completionMatchedText\";\n off = to;\n }\n if (off < label.length)\n labelElt.appendChild(document.createTextNode(label.slice(off)));\n return labelElt;\n },\n position: 50\n }, {\n render(completion) {\n if (!completion.detail)\n return null;\n let detailElt = document.createElement(\"span\");\n detailElt.className = \"cm-completionDetail\";\n detailElt.textContent = completion.detail;\n return detailElt;\n },\n position: 80\n });\n return content.sort((a, b) => a.position - b.position).map(a => a.render);\n}\nfunction rangeAroundSelected(total, selected, max) {\n if (total <= max)\n return { from: 0, to: total };\n if (selected < 0)\n selected = 0;\n if (selected <= (total >> 1)) {\n let off = Math.floor(selected / max);\n return { from: off * max, to: (off + 1) * max };\n }\n let off = Math.floor((total - selected) / max);\n return { from: total - (off + 1) * max, to: total - off * max };\n}\nclass CompletionTooltip {\n constructor(view, stateField, applyCompletion) {\n this.view = view;\n this.stateField = stateField;\n this.applyCompletion = applyCompletion;\n this.info = null;\n this.infoDestroy = null;\n this.placeInfoReq = {\n read: () => this.measureInfo(),\n write: (pos) => this.placeInfo(pos),\n key: this\n };\n this.space = null;\n this.currentClass = \"\";\n let cState = view.state.field(stateField);\n let { options, selected } = cState.open;\n let config = view.state.facet(completionConfig);\n this.optionContent = optionContent(config);\n this.optionClass = config.optionClass;\n this.tooltipClass = config.tooltipClass;\n this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);\n this.dom = document.createElement(\"div\");\n this.dom.className = \"cm-tooltip-autocomplete\";\n this.updateTooltipClass(view.state);\n this.dom.addEventListener(\"mousedown\", (e) => {\n let { options } = view.state.field(stateField).open;\n for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {\n if (dom.nodeName == \"LI\" && (match = /-(\\d+)$/.exec(dom.id)) && +match[1] < options.length) {\n this.applyCompletion(view, options[+match[1]]);\n e.preventDefault();\n return;\n }\n }\n });\n this.dom.addEventListener(\"focusout\", (e) => {\n let state = view.state.field(this.stateField, false);\n if (state && state.tooltip && view.state.facet(completionConfig).closeOnBlur &&\n e.relatedTarget != view.contentDOM)\n view.dispatch({ effects: closeCompletionEffect.of(null) });\n });\n this.showOptions(options, cState.id);\n }\n mount() { this.updateSel(); }\n showOptions(options, id) {\n if (this.list)\n this.list.remove();\n this.list = this.dom.appendChild(this.createListBox(options, id, this.range));\n this.list.addEventListener(\"scroll\", () => {\n if (this.info)\n this.view.requestMeasure(this.placeInfoReq);\n });\n }\n update(update) {\n var _a;\n let cState = update.state.field(this.stateField);\n let prevState = update.startState.field(this.stateField);\n this.updateTooltipClass(update.state);\n if (cState != prevState) {\n let { options, selected, disabled } = cState.open;\n if (!prevState.open || prevState.open.options != options) {\n this.range = rangeAroundSelected(options.length, selected, update.state.facet(completionConfig).maxRenderedOptions);\n this.showOptions(options, cState.id);\n }\n this.updateSel();\n if (disabled != ((_a = prevState.open) === null || _a === void 0 ? void 0 : _a.disabled))\n this.dom.classList.toggle(\"cm-tooltip-autocomplete-disabled\", !!disabled);\n }\n }\n updateTooltipClass(state) {\n let cls = this.tooltipClass(state);\n if (cls != this.currentClass) {\n for (let c of this.currentClass.split(\" \"))\n if (c)\n this.dom.classList.remove(c);\n for (let c of cls.split(\" \"))\n if (c)\n this.dom.classList.add(c);\n this.currentClass = cls;\n }\n }\n positioned(space) {\n this.space = space;\n if (this.info)\n this.view.requestMeasure(this.placeInfoReq);\n }\n updateSel() {\n let cState = this.view.state.field(this.stateField), open = cState.open;\n if (open.selected > -1 && open.selected < this.range.from || open.selected >= this.range.to) {\n this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions);\n this.showOptions(open.options, cState.id);\n }\n if (this.updateSelectedOption(open.selected)) {\n this.destroyInfo();\n let { completion } = open.options[open.selected];\n let { info } = completion;\n if (!info)\n return;\n let infoResult = typeof info === \"string\" ? document.createTextNode(info) : info(completion);\n if (!infoResult)\n return;\n if (\"then\" in infoResult) {\n infoResult.then(obj => {\n if (obj && this.view.state.field(this.stateField, false) == cState)\n this.addInfoPane(obj, completion);\n }).catch(e => logException(this.view.state, e, \"completion info\"));\n }\n else {\n this.addInfoPane(infoResult, completion);\n }\n }\n }\n addInfoPane(content, completion) {\n this.destroyInfo();\n let wrap = this.info = document.createElement(\"div\");\n wrap.className = \"cm-tooltip cm-completionInfo\";\n if (content.nodeType != null) {\n wrap.appendChild(content);\n this.infoDestroy = null;\n }\n else {\n let { dom, destroy } = content;\n wrap.appendChild(dom);\n this.infoDestroy = destroy || null;\n }\n this.dom.appendChild(wrap);\n this.view.requestMeasure(this.placeInfoReq);\n }\n updateSelectedOption(selected) {\n let set = null;\n for (let opt = this.list.firstChild, i = this.range.from; opt; opt = opt.nextSibling, i++) {\n if (opt.nodeName != \"LI\" || !opt.id) {\n i--; // A section header\n }\n else if (i == selected) {\n if (!opt.hasAttribute(\"aria-selected\")) {\n opt.setAttribute(\"aria-selected\", \"true\");\n set = opt;\n }\n }\n else {\n if (opt.hasAttribute(\"aria-selected\"))\n opt.removeAttribute(\"aria-selected\");\n }\n }\n if (set)\n scrollIntoView(this.list, set);\n return set;\n }\n measureInfo() {\n let sel = this.dom.querySelector(\"[aria-selected]\");\n if (!sel || !this.info)\n return null;\n let listRect = this.dom.getBoundingClientRect();\n let infoRect = this.info.getBoundingClientRect();\n let selRect = sel.getBoundingClientRect();\n let space = this.space;\n if (!space) {\n let win = this.dom.ownerDocument.defaultView || window;\n space = { left: 0, top: 0, right: win.innerWidth, bottom: win.innerHeight };\n }\n if (selRect.top > Math.min(space.bottom, listRect.bottom) - 10 ||\n selRect.bottom < Math.max(space.top, listRect.top) + 10)\n return null;\n return this.view.state.facet(completionConfig).positionInfo(this.view, listRect, selRect, infoRect, space, this.dom);\n }\n placeInfo(pos) {\n if (this.info) {\n if (pos) {\n if (pos.style)\n this.info.style.cssText = pos.style;\n this.info.className = \"cm-tooltip cm-completionInfo \" + (pos.class || \"\");\n }\n else {\n this.info.style.cssText = \"top: -1e6px\";\n }\n }\n }\n createListBox(options, id, range) {\n const ul = document.createElement(\"ul\");\n ul.id = id;\n ul.setAttribute(\"role\", \"listbox\");\n ul.setAttribute(\"aria-expanded\", \"true\");\n ul.setAttribute(\"aria-label\", this.view.state.phrase(\"Completions\"));\n let curSection = null;\n for (let i = range.from; i < range.to; i++) {\n let { completion, match } = options[i], { section } = completion;\n if (section) {\n let name = typeof section == \"string\" ? section : section.name;\n if (name != curSection && (i > range.from || range.from == 0)) {\n curSection = name;\n if (typeof section != \"string\" && section.header) {\n ul.appendChild(section.header(section));\n }\n else {\n let header = ul.appendChild(document.createElement(\"completion-section\"));\n header.textContent = name;\n }\n }\n }\n const li = ul.appendChild(document.createElement(\"li\"));\n li.id = id + \"-\" + i;\n li.setAttribute(\"role\", \"option\");\n let cls = this.optionClass(completion);\n if (cls)\n li.className = cls;\n for (let source of this.optionContent) {\n let node = source(completion, this.view.state, this.view, match);\n if (node)\n li.appendChild(node);\n }\n }\n if (range.from)\n ul.classList.add(\"cm-completionListIncompleteTop\");\n if (range.to < options.length)\n ul.classList.add(\"cm-completionListIncompleteBottom\");\n return ul;\n }\n destroyInfo() {\n if (this.info) {\n if (this.infoDestroy)\n this.infoDestroy();\n this.info.remove();\n this.info = null;\n }\n }\n destroy() {\n this.destroyInfo();\n }\n}\nfunction completionTooltip(stateField, applyCompletion) {\n return (view) => new CompletionTooltip(view, stateField, applyCompletion);\n}\nfunction scrollIntoView(container, element) {\n let parent = container.getBoundingClientRect();\n let self = element.getBoundingClientRect();\n let scaleY = parent.height / container.offsetHeight;\n if (self.top < parent.top)\n container.scrollTop -= (parent.top - self.top) / scaleY;\n else if (self.bottom > parent.bottom)\n container.scrollTop += (self.bottom - parent.bottom) / scaleY;\n}\n\n// Used to pick a preferred option when two options with the same\n// label occur in the result.\nfunction score(option) {\n return (option.boost || 0) * 100 + (option.apply ? 10 : 0) + (option.info ? 5 : 0) +\n (option.type ? 1 : 0);\n}\nfunction sortOptions(active, state) {\n let options = [];\n let sections = null;\n let addOption = (option) => {\n options.push(option);\n let { section } = option.completion;\n if (section) {\n if (!sections)\n sections = [];\n let name = typeof section == \"string\" ? section : section.name;\n if (!sections.some(s => s.name == name))\n sections.push(typeof section == \"string\" ? { name } : section);\n }\n };\n for (let a of active)\n if (a.hasResult()) {\n let getMatch = a.result.getMatch;\n if (a.result.filter === false) {\n for (let option of a.result.options) {\n addOption(new Option(option, a.source, getMatch ? getMatch(option) : [], 1e9 - options.length));\n }\n }\n else {\n let matcher = new FuzzyMatcher(state.sliceDoc(a.from, a.to));\n for (let option of a.result.options)\n if (matcher.match(option.label)) {\n let matched = !option.displayLabel ? matcher.matched : getMatch ? getMatch(option, matcher.matched) : [];\n addOption(new Option(option, a.source, matched, matcher.score + (option.boost || 0)));\n }\n }\n }\n if (sections) {\n let sectionOrder = Object.create(null), pos = 0;\n let cmp = (a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : 1e9) - ((_b = b.rank) !== null && _b !== void 0 ? _b : 1e9) || (a.name < b.name ? -1 : 1); };\n for (let s of sections.sort(cmp)) {\n pos -= 1e5;\n sectionOrder[s.name] = pos;\n }\n for (let option of options) {\n let { section } = option.completion;\n if (section)\n option.score += sectionOrder[typeof section == \"string\" ? section : section.name];\n }\n }\n let result = [], prev = null;\n let compare = state.facet(completionConfig).compareCompletions;\n for (let opt of options.sort((a, b) => (b.score - a.score) || compare(a.completion, b.completion))) {\n let cur = opt.completion;\n if (!prev || prev.label != cur.label || prev.detail != cur.detail ||\n (prev.type != null && cur.type != null && prev.type != cur.type) ||\n prev.apply != cur.apply || prev.boost != cur.boost)\n result.push(opt);\n else if (score(opt.completion) > score(prev))\n result[result.length - 1] = opt;\n prev = opt.completion;\n }\n return result;\n}\nclass CompletionDialog {\n constructor(options, attrs, tooltip, timestamp, selected, disabled) {\n this.options = options;\n this.attrs = attrs;\n this.tooltip = tooltip;\n this.timestamp = timestamp;\n this.selected = selected;\n this.disabled = disabled;\n }\n setSelected(selected, id) {\n return selected == this.selected || selected >= this.options.length ? this\n : new CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);\n }\n static build(active, state, id, prev, conf) {\n let options = sortOptions(active, state);\n if (!options.length) {\n return prev && active.some(a => a.state == 1 /* State.Pending */) ?\n new CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null;\n }\n let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;\n if (prev && prev.selected != selected && prev.selected != -1) {\n let selectedValue = prev.options[prev.selected].completion;\n for (let i = 0; i < options.length; i++)\n if (options[i].completion == selectedValue) {\n selected = i;\n break;\n }\n }\n return new CompletionDialog(options, makeAttrs(id, selected), {\n pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8),\n create: createTooltip,\n above: conf.aboveCursor,\n }, prev ? prev.timestamp : Date.now(), selected, false);\n }\n map(changes) {\n return new CompletionDialog(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: changes.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled);\n }\n}\nclass CompletionState {\n constructor(active, id, open) {\n this.active = active;\n this.id = id;\n this.open = open;\n }\n static start() {\n return new CompletionState(none, \"cm-ac-\" + Math.floor(Math.random() * 2e6).toString(36), null);\n }\n update(tr) {\n let { state } = tr, conf = state.facet(completionConfig);\n let sources = conf.override ||\n state.languageDataAt(\"autocomplete\", cur(state)).map(asSource);\n let active = sources.map(source => {\n let value = this.active.find(s => s.source == source) ||\n new ActiveSource(source, this.active.some(a => a.state != 0 /* State.Inactive */) ? 1 /* State.Pending */ : 0 /* State.Inactive */);\n return value.update(tr, conf);\n });\n if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))\n active = this.active;\n let open = this.open;\n if (open && tr.docChanged)\n open = open.map(tr.changes);\n if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||\n !sameResults(active, this.active))\n open = CompletionDialog.build(active, state, this.id, open, conf);\n else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))\n open = null;\n if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))\n active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);\n for (let effect of tr.effects)\n if (effect.is(setSelectedEffect))\n open = open && open.setSelected(effect.value, this.id);\n return active == this.active && open == this.open ? this : new CompletionState(active, this.id, open);\n }\n get tooltip() { return this.open ? this.open.tooltip : null; }\n get attrs() { return this.open ? this.open.attrs : baseAttrs; }\n}\nfunction sameResults(a, b) {\n if (a == b)\n return true;\n for (let iA = 0, iB = 0;;) {\n while (iA < a.length && !a[iA].hasResult)\n iA++;\n while (iB < b.length && !b[iB].hasResult)\n iB++;\n let endA = iA == a.length, endB = iB == b.length;\n if (endA || endB)\n return endA == endB;\n if (a[iA++].result != b[iB++].result)\n return false;\n }\n}\nconst baseAttrs = {\n \"aria-autocomplete\": \"list\"\n};\nfunction makeAttrs(id, selected) {\n let result = {\n \"aria-autocomplete\": \"list\",\n \"aria-haspopup\": \"listbox\",\n \"aria-controls\": id\n };\n if (selected > -1)\n result[\"aria-activedescendant\"] = id + \"-\" + selected;\n return result;\n}\nconst none = [];\nfunction getUserEvent(tr) {\n return tr.isUserEvent(\"input.type\") ? \"input\" : tr.isUserEvent(\"delete.backward\") ? \"delete\" : null;\n}\nclass ActiveSource {\n constructor(source, state, explicitPos = -1) {\n this.source = source;\n this.state = state;\n this.explicitPos = explicitPos;\n }\n hasResult() { return false; }\n update(tr, conf) {\n let event = getUserEvent(tr), value = this;\n if (event)\n value = value.handleUserEvent(tr, event, conf);\n else if (tr.docChanged)\n value = value.handleChange(tr);\n else if (tr.selection && value.state != 0 /* State.Inactive */)\n value = new ActiveSource(value.source, 0 /* State.Inactive */);\n for (let effect of tr.effects) {\n if (effect.is(startCompletionEffect))\n value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value ? cur(tr.state) : -1);\n else if (effect.is(closeCompletionEffect))\n value = new ActiveSource(value.source, 0 /* State.Inactive */);\n else if (effect.is(setActiveEffect))\n for (let active of effect.value)\n if (active.source == value.source)\n value = active;\n }\n return value;\n }\n handleUserEvent(tr, type, conf) {\n return type == \"delete\" || !conf.activateOnTyping ? this.map(tr.changes) : new ActiveSource(this.source, 1 /* State.Pending */);\n }\n handleChange(tr) {\n return tr.changes.touchesRange(cur(tr.startState)) ? new ActiveSource(this.source, 0 /* State.Inactive */) : this.map(tr.changes);\n }\n map(changes) {\n return changes.empty || this.explicitPos < 0 ? this : new ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));\n }\n}\nclass ActiveResult extends ActiveSource {\n constructor(source, explicitPos, result, from, to) {\n super(source, 2 /* State.Result */, explicitPos);\n this.result = result;\n this.from = from;\n this.to = to;\n }\n hasResult() { return true; }\n handleUserEvent(tr, type, conf) {\n var _a;\n let from = tr.changes.mapPos(this.from), to = tr.changes.mapPos(this.to, 1);\n let pos = cur(tr.state);\n if ((this.explicitPos < 0 ? pos <= from : pos < this.from) ||\n pos > to ||\n type == \"delete\" && cur(tr.startState) == this.from)\n return new ActiveSource(this.source, type == \"input\" && conf.activateOnTyping ? 1 /* State.Pending */ : 0 /* State.Inactive */);\n let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos), updated;\n if (checkValid(this.result.validFor, tr.state, from, to))\n return new ActiveResult(this.source, explicitPos, this.result, from, to);\n if (this.result.update &&\n (updated = this.result.update(this.result, from, to, new CompletionContext(tr.state, pos, explicitPos >= 0))))\n return new ActiveResult(this.source, explicitPos, updated, updated.from, (_a = updated.to) !== null && _a !== void 0 ? _a : cur(tr.state));\n return new ActiveSource(this.source, 1 /* State.Pending */, explicitPos);\n }\n handleChange(tr) {\n return tr.changes.touchesRange(this.from, this.to) ? new ActiveSource(this.source, 0 /* State.Inactive */) : this.map(tr.changes);\n }\n map(mapping) {\n return mapping.empty ? this :\n new ActiveResult(this.source, this.explicitPos < 0 ? -1 : mapping.mapPos(this.explicitPos), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));\n }\n}\nfunction checkValid(validFor, state, from, to) {\n if (!validFor)\n return false;\n let text = state.sliceDoc(from, to);\n return typeof validFor == \"function\" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);\n}\nconst setActiveEffect = /*@__PURE__*/StateEffect.define({\n map(sources, mapping) { return sources.map(s => s.map(mapping)); }\n});\nconst setSelectedEffect = /*@__PURE__*/StateEffect.define();\nconst completionState = /*@__PURE__*/StateField.define({\n create() { return CompletionState.start(); },\n update(value, tr) { return value.update(tr); },\n provide: f => [\n showTooltip.from(f, val => val.tooltip),\n EditorView.contentAttributes.from(f, state => state.attrs)\n ]\n});\nfunction applyCompletion(view, option) {\n const apply = option.completion.apply || option.completion.label;\n let result = view.state.field(completionState).active.find(a => a.source == option.source);\n if (!(result instanceof ActiveResult))\n return false;\n if (typeof apply == \"string\")\n view.dispatch(Object.assign(Object.assign({}, insertCompletionText(view.state, apply, result.from, result.to)), { annotations: pickedCompletion.of(option.completion) }));\n else\n apply(view, option.completion, result.from, result.to);\n return true;\n}\nconst createTooltip = /*@__PURE__*/completionTooltip(completionState, applyCompletion);\n\n/**\nReturns a command that moves the completion selection forward or\nbackward by the given amount.\n*/\nfunction moveCompletionSelection(forward, by = \"option\") {\n return (view) => {\n let cState = view.state.field(completionState, false);\n if (!cState || !cState.open || cState.open.disabled ||\n Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)\n return false;\n let step = 1, tooltip;\n if (by == \"page\" && (tooltip = getTooltip(view, cState.open.tooltip)))\n step = Math.max(2, Math.floor(tooltip.dom.offsetHeight /\n tooltip.dom.querySelector(\"li\").offsetHeight) - 1);\n let { length } = cState.open.options;\n let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1;\n if (selected < 0)\n selected = by == \"page\" ? 0 : length - 1;\n else if (selected >= length)\n selected = by == \"page\" ? length - 1 : 0;\n view.dispatch({ effects: setSelectedEffect.of(selected) });\n return true;\n };\n}\n/**\nAccept the current completion.\n*/\nconst acceptCompletion = (view) => {\n let cState = view.state.field(completionState, false);\n if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled ||\n Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)\n return false;\n return applyCompletion(view, cState.open.options[cState.open.selected]);\n};\n/**\nExplicitly start autocompletion.\n*/\nconst startCompletion = (view) => {\n let cState = view.state.field(completionState, false);\n if (!cState)\n return false;\n view.dispatch({ effects: startCompletionEffect.of(true) });\n return true;\n};\n/**\nClose the currently active completion.\n*/\nconst closeCompletion = (view) => {\n let cState = view.state.field(completionState, false);\n if (!cState || !cState.active.some(a => a.state != 0 /* State.Inactive */))\n return false;\n view.dispatch({ effects: closeCompletionEffect.of(null) });\n return true;\n};\nclass RunningQuery {\n constructor(active, context) {\n this.active = active;\n this.context = context;\n this.time = Date.now();\n this.updates = [];\n // Note that 'undefined' means 'not done yet', whereas 'null' means\n // 'query returned null'.\n this.done = undefined;\n }\n}\nconst MaxUpdateCount = 50, MinAbortTime = 1000;\nconst completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.debounceUpdate = -1;\n this.running = [];\n this.debounceAccept = -1;\n this.pendingStart = false;\n this.composing = 0 /* CompositionState.None */;\n for (let active of view.state.field(completionState).active)\n if (active.state == 1 /* State.Pending */)\n this.startQuery(active);\n }\n update(update) {\n let cState = update.state.field(completionState);\n if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState)\n return;\n let doesReset = update.transactions.some(tr => {\n return (tr.selection || tr.docChanged) && !getUserEvent(tr);\n });\n for (let i = 0; i < this.running.length; i++) {\n let query = this.running[i];\n if (doesReset ||\n query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) {\n for (let handler of query.context.abortListeners) {\n try {\n handler();\n }\n catch (e) {\n logException(this.view.state, e);\n }\n }\n query.context.abortListeners = null;\n this.running.splice(i--, 1);\n }\n else {\n query.updates.push(...update.transactions);\n }\n }\n if (this.debounceUpdate > -1)\n clearTimeout(this.debounceUpdate);\n if (update.transactions.some(tr => tr.effects.some(e => e.is(startCompletionEffect))))\n this.pendingStart = true;\n let delay = this.pendingStart ? 50 : update.state.facet(completionConfig).activateOnTypingDelay;\n this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))\n ? setTimeout(() => this.startUpdate(), delay) : -1;\n if (this.composing != 0 /* CompositionState.None */)\n for (let tr of update.transactions) {\n if (getUserEvent(tr) == \"input\")\n this.composing = 2 /* CompositionState.Changed */;\n else if (this.composing == 2 /* CompositionState.Changed */ && tr.selection)\n this.composing = 3 /* CompositionState.ChangedAndMoved */;\n }\n }\n startUpdate() {\n this.debounceUpdate = -1;\n this.pendingStart = false;\n let { state } = this.view, cState = state.field(completionState);\n for (let active of cState.active) {\n if (active.state == 1 /* State.Pending */ && !this.running.some(r => r.active.source == active.source))\n this.startQuery(active);\n }\n }\n startQuery(active) {\n let { state } = this.view, pos = cur(state);\n let context = new CompletionContext(state, pos, active.explicitPos == pos);\n let pending = new RunningQuery(active, context);\n this.running.push(pending);\n Promise.resolve(active.source(context)).then(result => {\n if (!pending.context.aborted) {\n pending.done = result || null;\n this.scheduleAccept();\n }\n }, err => {\n this.view.dispatch({ effects: closeCompletionEffect.of(null) });\n logException(this.view.state, err);\n });\n }\n scheduleAccept() {\n if (this.running.every(q => q.done !== undefined))\n this.accept();\n else if (this.debounceAccept < 0)\n this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);\n }\n // For each finished query in this.running, try to create a result\n // or, if appropriate, restart the query.\n accept() {\n var _a;\n if (this.debounceAccept > -1)\n clearTimeout(this.debounceAccept);\n this.debounceAccept = -1;\n let updated = [];\n let conf = this.view.state.facet(completionConfig);\n for (let i = 0; i < this.running.length; i++) {\n let query = this.running[i];\n if (query.done === undefined)\n continue;\n this.running.splice(i--, 1);\n if (query.done) {\n let active = new ActiveResult(query.active.source, query.active.explicitPos, query.done, query.done.from, (_a = query.done.to) !== null && _a !== void 0 ? _a : cur(query.updates.length ? query.updates[0].startState : this.view.state));\n // Replay the transactions that happened since the start of\n // the request and see if that preserves the result\n for (let tr of query.updates)\n active = active.update(tr, conf);\n if (active.hasResult()) {\n updated.push(active);\n continue;\n }\n }\n let current = this.view.state.field(completionState).active.find(a => a.source == query.active.source);\n if (current && current.state == 1 /* State.Pending */) {\n if (query.done == null) {\n // Explicitly failed. Should clear the pending status if it\n // hasn't been re-set in the meantime.\n let active = new ActiveSource(query.active.source, 0 /* State.Inactive */);\n for (let tr of query.updates)\n active = active.update(tr, conf);\n if (active.state != 1 /* State.Pending */)\n updated.push(active);\n }\n else {\n // Cleared by subsequent transactions. Restart.\n this.startQuery(current);\n }\n }\n }\n if (updated.length)\n this.view.dispatch({ effects: setActiveEffect.of(updated) });\n }\n}, {\n eventHandlers: {\n blur(event) {\n let state = this.view.state.field(completionState, false);\n if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {\n let dialog = state.open && getTooltip(this.view, state.open.tooltip);\n if (!dialog || !dialog.dom.contains(event.relatedTarget))\n setTimeout(() => this.view.dispatch({ effects: closeCompletionEffect.of(null) }), 10);\n }\n },\n compositionstart() {\n this.composing = 1 /* CompositionState.Started */;\n },\n compositionend() {\n if (this.composing == 3 /* CompositionState.ChangedAndMoved */) {\n // Safari fires compositionend events synchronously, possibly\n // from inside an update, so dispatch asynchronously to avoid reentrancy\n setTimeout(() => this.view.dispatch({ effects: startCompletionEffect.of(false) }), 20);\n }\n this.composing = 0 /* CompositionState.None */;\n }\n }\n});\n\nconst baseTheme = /*@__PURE__*/EditorView.baseTheme({\n \".cm-tooltip.cm-tooltip-autocomplete\": {\n \"& > ul\": {\n fontFamily: \"monospace\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden auto\",\n maxWidth_fallback: \"700px\",\n maxWidth: \"min(700px, 95vw)\",\n minWidth: \"250px\",\n maxHeight: \"10em\",\n height: \"100%\",\n listStyle: \"none\",\n margin: 0,\n padding: 0,\n \"& > li, & > completion-section\": {\n padding: \"1px 3px\",\n lineHeight: 1.2\n },\n \"& > li\": {\n overflowX: \"hidden\",\n textOverflow: \"ellipsis\",\n cursor: \"pointer\"\n },\n \"& > completion-section\": {\n display: \"list-item\",\n borderBottom: \"1px solid silver\",\n paddingLeft: \"0.5em\",\n opacity: 0.7\n }\n }\n },\n \"&light .cm-tooltip-autocomplete ul li[aria-selected]\": {\n background: \"#17c\",\n color: \"white\",\n },\n \"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]\": {\n background: \"#777\",\n },\n \"&dark .cm-tooltip-autocomplete ul li[aria-selected]\": {\n background: \"#347\",\n color: \"white\",\n },\n \"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]\": {\n background: \"#444\",\n },\n \".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after\": {\n content: '\"···\"',\n opacity: 0.5,\n display: \"block\",\n textAlign: \"center\"\n },\n \".cm-tooltip.cm-completionInfo\": {\n position: \"absolute\",\n padding: \"3px 9px\",\n width: \"max-content\",\n maxWidth: `${400 /* Info.Width */}px`,\n boxSizing: \"border-box\"\n },\n \".cm-completionInfo.cm-completionInfo-left\": { right: \"100%\" },\n \".cm-completionInfo.cm-completionInfo-right\": { left: \"100%\" },\n \".cm-completionInfo.cm-completionInfo-left-narrow\": { right: `${30 /* Info.Margin */}px` },\n \".cm-completionInfo.cm-completionInfo-right-narrow\": { left: `${30 /* Info.Margin */}px` },\n \"&light .cm-snippetField\": { backgroundColor: \"#00000022\" },\n \"&dark .cm-snippetField\": { backgroundColor: \"#ffffff22\" },\n \".cm-snippetFieldPosition\": {\n verticalAlign: \"text-top\",\n width: 0,\n height: \"1.15em\",\n display: \"inline-block\",\n margin: \"0 -0.7px -.7em\",\n borderLeft: \"1.4px dotted #888\"\n },\n \".cm-completionMatchedText\": {\n textDecoration: \"underline\"\n },\n \".cm-completionDetail\": {\n marginLeft: \"0.5em\",\n fontStyle: \"italic\"\n },\n \".cm-completionIcon\": {\n fontSize: \"90%\",\n width: \".8em\",\n display: \"inline-block\",\n textAlign: \"center\",\n paddingRight: \".6em\",\n opacity: \"0.6\",\n boxSizing: \"content-box\"\n },\n \".cm-completionIcon-function, .cm-completionIcon-method\": {\n \"&:after\": { content: \"'ƒ'\" }\n },\n \".cm-completionIcon-class\": {\n \"&:after\": { content: \"'○'\" }\n },\n \".cm-completionIcon-interface\": {\n \"&:after\": { content: \"'◌'\" }\n },\n \".cm-completionIcon-variable\": {\n \"&:after\": { content: \"'𝑥'\" }\n },\n \".cm-completionIcon-constant\": {\n \"&:after\": { content: \"'𝐶'\" }\n },\n \".cm-completionIcon-type\": {\n \"&:after\": { content: \"'𝑡'\" }\n },\n \".cm-completionIcon-enum\": {\n \"&:after\": { content: \"''\" }\n },\n \".cm-completionIcon-property\": {\n \"&:after\": { content: \"'□'\" }\n },\n \".cm-completionIcon-keyword\": {\n \"&:after\": { content: \"'🔑\\uFE0E'\" } // Disable emoji rendering\n },\n \".cm-completionIcon-namespace\": {\n \"&:after\": { content: \"'▢'\" }\n },\n \".cm-completionIcon-text\": {\n \"&:after\": { content: \"'abc'\", fontSize: \"50%\", verticalAlign: \"middle\" }\n }\n});\n\nclass FieldPos {\n constructor(field, line, from, to) {\n this.field = field;\n this.line = line;\n this.from = from;\n this.to = to;\n }\n}\nclass FieldRange {\n constructor(field, from, to) {\n this.field = field;\n this.from = from;\n this.to = to;\n }\n map(changes) {\n let from = changes.mapPos(this.from, -1, MapMode.TrackDel);\n let to = changes.mapPos(this.to, 1, MapMode.TrackDel);\n return from == null || to == null ? null : new FieldRange(this.field, from, to);\n }\n}\nclass Snippet {\n constructor(lines, fieldPositions) {\n this.lines = lines;\n this.fieldPositions = fieldPositions;\n }\n instantiate(state, pos) {\n let text = [], lineStart = [pos];\n let lineObj = state.doc.lineAt(pos), baseIndent = /^\\s*/.exec(lineObj.text)[0];\n for (let line of this.lines) {\n if (text.length) {\n let indent = baseIndent, tabs = /^\\t*/.exec(line)[0].length;\n for (let i = 0; i < tabs; i++)\n indent += state.facet(indentUnit);\n lineStart.push(pos + indent.length - tabs);\n line = indent + line.slice(tabs);\n }\n text.push(line);\n pos += line.length + 1;\n }\n let ranges = this.fieldPositions.map(pos => new FieldRange(pos.field, lineStart[pos.line] + pos.from, lineStart[pos.line] + pos.to));\n return { text, ranges };\n }\n static parse(template) {\n let fields = [];\n let lines = [], positions = [], m;\n for (let line of template.split(/\\r\\n?|\\n/)) {\n while (m = /[#$]\\{(?:(\\d+)(?::([^}]*))?|([^}]*))\\}/.exec(line)) {\n let seq = m[1] ? +m[1] : null, name = m[2] || m[3] || \"\", found = -1;\n for (let i = 0; i < fields.length; i++) {\n if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false)\n found = i;\n }\n if (found < 0) {\n let i = 0;\n while (i < fields.length && (seq == null || (fields[i].seq != null && fields[i].seq < seq)))\n i++;\n fields.splice(i, 0, { seq, name });\n found = i;\n for (let pos of positions)\n if (pos.field >= found)\n pos.field++;\n }\n positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));\n line = line.slice(0, m.index) + name + line.slice(m.index + m[0].length);\n }\n for (let esc; esc = /\\\\([{}])/.exec(line);) {\n line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length);\n for (let pos of positions)\n if (pos.line == lines.length && pos.from > esc.index) {\n pos.from--;\n pos.to--;\n }\n }\n lines.push(line);\n }\n return new Snippet(lines, positions);\n }\n}\nlet fieldMarker = /*@__PURE__*/Decoration.widget({ widget: /*@__PURE__*/new class extends WidgetType {\n toDOM() {\n let span = document.createElement(\"span\");\n span.className = \"cm-snippetFieldPosition\";\n return span;\n }\n ignoreEvent() { return false; }\n } });\nlet fieldRange = /*@__PURE__*/Decoration.mark({ class: \"cm-snippetField\" });\nclass ActiveSnippet {\n constructor(ranges, active) {\n this.ranges = ranges;\n this.active = active;\n this.deco = Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)));\n }\n map(changes) {\n let ranges = [];\n for (let r of this.ranges) {\n let mapped = r.map(changes);\n if (!mapped)\n return null;\n ranges.push(mapped);\n }\n return new ActiveSnippet(ranges, this.active);\n }\n selectionInsideField(sel) {\n return sel.ranges.every(range => this.ranges.some(r => r.field == this.active && r.from <= range.from && r.to >= range.to));\n }\n}\nconst setActive = /*@__PURE__*/StateEffect.define({\n map(value, changes) { return value && value.map(changes); }\n});\nconst moveToField = /*@__PURE__*/StateEffect.define();\nconst snippetState = /*@__PURE__*/StateField.define({\n create() { return null; },\n update(value, tr) {\n for (let effect of tr.effects) {\n if (effect.is(setActive))\n return effect.value;\n if (effect.is(moveToField) && value)\n return new ActiveSnippet(value.ranges, effect.value);\n }\n if (value && tr.docChanged)\n value = value.map(tr.changes);\n if (value && tr.selection && !value.selectionInsideField(tr.selection))\n value = null;\n return value;\n },\n provide: f => EditorView.decorations.from(f, val => val ? val.deco : Decoration.none)\n});\nfunction fieldSelection(ranges, field) {\n return EditorSelection.create(ranges.filter(r => r.field == field).map(r => EditorSelection.range(r.from, r.to)));\n}\n/**\nConvert a snippet template to a function that can\n[apply](https://codemirror.net/6/docs/ref/#autocomplete.Completion.apply) it. Snippets are written\nusing syntax like this:\n\n \"for (let ${index} = 0; ${index} < ${end}; ${index}++) {\\n\\t${}\\n}\"\n\nEach `${}` placeholder (you may also use `#{}`) indicates a field\nthat the user can fill in. Its name, if any, will be the default\ncontent for the field.\n\nWhen the snippet is activated by calling the returned function,\nthe code is inserted at the given position. Newlines in the\ntemplate are indented by the indentation of the start line, plus\none [indent unit](https://codemirror.net/6/docs/ref/#language.indentUnit) per tab character after\nthe newline.\n\nOn activation, (all instances of) the first field are selected.\nThe user can move between fields with Tab and Shift-Tab as long as\nthe fields are active. Moving to the last field or moving the\ncursor out of the current field deactivates the fields.\n\nThe order of fields defaults to textual order, but you can add\nnumbers to placeholders (`${1}` or `${1:defaultText}`) to provide\na custom order.\n\nTo include a literal `{` or `}` in your template, put a backslash\nin front of it. This will be removed and the brace will not be\ninterpreted as indicating a placeholder.\n*/\nfunction snippet(template) {\n let snippet = Snippet.parse(template);\n return (editor, completion, from, to) => {\n let { text, ranges } = snippet.instantiate(editor.state, from);\n let spec = {\n changes: { from, to, insert: Text.of(text) },\n scrollIntoView: true,\n annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of(\"input.complete\")] : undefined\n };\n if (ranges.length)\n spec.selection = fieldSelection(ranges, 0);\n if (ranges.some(r => r.field > 0)) {\n let active = new ActiveSnippet(ranges, 0);\n let effects = spec.effects = [setActive.of(active)];\n if (editor.state.field(snippetState, false) === undefined)\n effects.push(StateEffect.appendConfig.of([snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme]));\n }\n editor.dispatch(editor.state.update(spec));\n };\n}\nfunction moveField(dir) {\n return ({ state, dispatch }) => {\n let active = state.field(snippetState, false);\n if (!active || dir < 0 && active.active == 0)\n return false;\n let next = active.active + dir, last = dir > 0 && !active.ranges.some(r => r.field == next + dir);\n dispatch(state.update({\n selection: fieldSelection(active.ranges, next),\n effects: setActive.of(last ? null : new ActiveSnippet(active.ranges, next)),\n scrollIntoView: true\n }));\n return true;\n };\n}\n/**\nA command that clears the active snippet, if any.\n*/\nconst clearSnippet = ({ state, dispatch }) => {\n let active = state.field(snippetState, false);\n if (!active)\n return false;\n dispatch(state.update({ effects: setActive.of(null) }));\n return true;\n};\n/**\nMove to the next snippet field, if available.\n*/\nconst nextSnippetField = /*@__PURE__*/moveField(1);\n/**\nMove to the previous snippet field, if available.\n*/\nconst prevSnippetField = /*@__PURE__*/moveField(-1);\n/**\nCheck if there is an active snippet with a next field for\n`nextSnippetField` to move to.\n*/\nfunction hasNextSnippetField(state) {\n let active = state.field(snippetState, false);\n return !!(active && active.ranges.some(r => r.field == active.active + 1));\n}\n/**\nReturns true if there is an active snippet and a previous field\nfor `prevSnippetField` to move to.\n*/\nfunction hasPrevSnippetField(state) {\n let active = state.field(snippetState, false);\n return !!(active && active.active > 0);\n}\nconst defaultSnippetKeymap = [\n { key: \"Tab\", run: nextSnippetField, shift: prevSnippetField },\n { key: \"Escape\", run: clearSnippet }\n];\n/**\nA facet that can be used to configure the key bindings used by\nsnippets. The default binds Tab to\n[`nextSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.nextSnippetField), Shift-Tab to\n[`prevSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.prevSnippetField), and Escape\nto [`clearSnippet`](https://codemirror.net/6/docs/ref/#autocomplete.clearSnippet).\n*/\nconst snippetKeymap = /*@__PURE__*/Facet.define({\n combine(maps) { return maps.length ? maps[0] : defaultSnippetKeymap; }\n});\nconst addSnippetKeymap = /*@__PURE__*/Prec.highest(/*@__PURE__*/keymap.compute([snippetKeymap], state => state.facet(snippetKeymap)));\n/**\nCreate a completion from a snippet. Returns an object with the\nproperties from `completion`, plus an `apply` function that\napplies the snippet.\n*/\nfunction snippetCompletion(template, completion) {\n return Object.assign(Object.assign({}, completion), { apply: snippet(template) });\n}\nconst snippetPointerHandler = /*@__PURE__*/EditorView.domEventHandlers({\n mousedown(event, view) {\n let active = view.state.field(snippetState, false), pos;\n if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)\n return false;\n let match = active.ranges.find(r => r.from <= pos && r.to >= pos);\n if (!match || match.field == active.active)\n return false;\n view.dispatch({\n selection: fieldSelection(active.ranges, match.field),\n effects: setActive.of(active.ranges.some(r => r.field > match.field)\n ? new ActiveSnippet(active.ranges, match.field) : null),\n scrollIntoView: true\n });\n return true;\n }\n});\n\nfunction wordRE(wordChars) {\n let escaped = wordChars.replace(/[\\]\\-\\\\]/g, \"\\\\$&\");\n try {\n return new RegExp(`[\\\\p{Alphabetic}\\\\p{Number}_${escaped}]+`, \"ug\");\n }\n catch (_a) {\n return new RegExp(`[\\w${escaped}]`, \"g\");\n }\n}\nfunction mapRE(re, f) {\n return new RegExp(f(re.source), re.unicode ? \"u\" : \"\");\n}\nconst wordCaches = /*@__PURE__*/Object.create(null);\nfunction wordCache(wordChars) {\n return wordCaches[wordChars] || (wordCaches[wordChars] = new WeakMap);\n}\nfunction storeWords(doc, wordRE, result, seen, ignoreAt) {\n for (let lines = doc.iterLines(), pos = 0; !lines.next().done;) {\n let { value } = lines, m;\n wordRE.lastIndex = 0;\n while (m = wordRE.exec(value)) {\n if (!seen[m[0]] && pos + m.index != ignoreAt) {\n result.push({ type: \"text\", label: m[0] });\n seen[m[0]] = true;\n if (result.length >= 2000 /* C.MaxList */)\n return;\n }\n }\n pos += value.length + 1;\n }\n}\nfunction collectWords(doc, cache, wordRE, to, ignoreAt) {\n let big = doc.length >= 1000 /* C.MinCacheLen */;\n let cached = big && cache.get(doc);\n if (cached)\n return cached;\n let result = [], seen = Object.create(null);\n if (doc.children) {\n let pos = 0;\n for (let ch of doc.children) {\n if (ch.length >= 1000 /* C.MinCacheLen */) {\n for (let c of collectWords(ch, cache, wordRE, to - pos, ignoreAt - pos)) {\n if (!seen[c.label]) {\n seen[c.label] = true;\n result.push(c);\n }\n }\n }\n else {\n storeWords(ch, wordRE, result, seen, ignoreAt - pos);\n }\n pos += ch.length + 1;\n }\n }\n else {\n storeWords(doc, wordRE, result, seen, ignoreAt);\n }\n if (big && result.length < 2000 /* C.MaxList */)\n cache.set(doc, result);\n return result;\n}\n/**\nA completion source that will scan the document for words (using a\n[character categorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer)), and\nreturn those as completions.\n*/\nconst completeAnyWord = context => {\n let wordChars = context.state.languageDataAt(\"wordChars\", context.pos).join(\"\");\n let re = wordRE(wordChars);\n let token = context.matchBefore(mapRE(re, s => s + \"$\"));\n if (!token && !context.explicit)\n return null;\n let from = token ? token.from : context.pos;\n let options = collectWords(context.state.doc, wordCache(wordChars), re, 50000 /* C.Range */, from);\n return { from, options, validFor: mapRE(re, s => \"^\" + s) };\n};\n\nconst defaults = {\n brackets: [\"(\", \"[\", \"{\", \"'\", '\"'],\n before: \")]}:;>\",\n stringPrefixes: []\n};\nconst closeBracketEffect = /*@__PURE__*/StateEffect.define({\n map(value, mapping) {\n let mapped = mapping.mapPos(value, -1, MapMode.TrackAfter);\n return mapped == null ? undefined : mapped;\n }\n});\nconst closedBracket = /*@__PURE__*/new class extends RangeValue {\n};\nclosedBracket.startSide = 1;\nclosedBracket.endSide = -1;\nconst bracketState = /*@__PURE__*/StateField.define({\n create() { return RangeSet.empty; },\n update(value, tr) {\n value = value.map(tr.changes);\n if (tr.selection) {\n let line = tr.state.doc.lineAt(tr.selection.main.head);\n value = value.update({ filter: from => from >= line.from && from <= line.to });\n }\n for (let effect of tr.effects)\n if (effect.is(closeBracketEffect))\n value = value.update({ add: [closedBracket.range(effect.value, effect.value + 1)] });\n return value;\n }\n});\n/**\nExtension to enable bracket-closing behavior. When a closeable\nbracket is typed, its closing bracket is immediately inserted\nafter the cursor. When closing a bracket directly in front of a\nclosing bracket inserted by the extension, the cursor moves over\nthat bracket.\n*/\nfunction closeBrackets() {\n return [inputHandler, bracketState];\n}\nconst definedClosing = \"()[]{}<>\";\nfunction closing(ch) {\n for (let i = 0; i < definedClosing.length; i += 2)\n if (definedClosing.charCodeAt(i) == ch)\n return definedClosing.charAt(i + 1);\n return fromCodePoint(ch < 128 ? ch : ch + 1);\n}\nfunction config(state, pos) {\n return state.languageDataAt(\"closeBrackets\", pos)[0] || defaults;\n}\nconst android = typeof navigator == \"object\" && /*@__PURE__*//Android\\b/.test(navigator.userAgent);\nconst inputHandler = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, insert) => {\n if ((android ? view.composing : view.compositionStarted) || view.state.readOnly)\n return false;\n let sel = view.state.selection.main;\n if (insert.length > 2 || insert.length == 2 && codePointSize(codePointAt(insert, 0)) == 1 ||\n from != sel.from || to != sel.to)\n return false;\n let tr = insertBracket(view.state, insert);\n if (!tr)\n return false;\n view.dispatch(tr);\n return true;\n});\n/**\nCommand that implements deleting a pair of matching brackets when\nthe cursor is between them.\n*/\nconst deleteBracketPair = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let conf = config(state, state.selection.main.head);\n let tokens = conf.brackets || defaults.brackets;\n let dont = null, changes = state.changeByRange(range => {\n if (range.empty) {\n let before = prevChar(state.doc, range.head);\n for (let token of tokens) {\n if (token == before && nextChar(state.doc, range.head) == closing(codePointAt(token, 0)))\n return { changes: { from: range.head - token.length, to: range.head + token.length },\n range: EditorSelection.cursor(range.head - token.length) };\n }\n }\n return { range: dont = range };\n });\n if (!dont)\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: \"delete.backward\" }));\n return !dont;\n};\n/**\nClose-brackets related key bindings. Binds Backspace to\n[`deleteBracketPair`](https://codemirror.net/6/docs/ref/#autocomplete.deleteBracketPair).\n*/\nconst closeBracketsKeymap = [\n { key: \"Backspace\", run: deleteBracketPair }\n];\n/**\nImplements the extension's behavior on text insertion. If the\ngiven string counts as a bracket in the language around the\nselection, and replacing the selection with it requires custom\nbehavior (inserting a closing version or skipping past a\npreviously-closed bracket), this function returns a transaction\nrepresenting that custom behavior. (You only need this if you want\nto programmatically insert brackets—the\n[`closeBrackets`](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets) extension will\ntake care of running this for user input.)\n*/\nfunction insertBracket(state, bracket) {\n let conf = config(state, state.selection.main.head);\n let tokens = conf.brackets || defaults.brackets;\n for (let tok of tokens) {\n let closed = closing(codePointAt(tok, 0));\n if (bracket == tok)\n return closed == tok ? handleSame(state, tok, tokens.indexOf(tok + tok + tok) > -1, conf)\n : handleOpen(state, tok, closed, conf.before || defaults.before);\n if (bracket == closed && closedBracketAt(state, state.selection.main.from))\n return handleClose(state, tok, closed);\n }\n return null;\n}\nfunction closedBracketAt(state, pos) {\n let found = false;\n state.field(bracketState).between(0, state.doc.length, from => {\n if (from == pos)\n found = true;\n });\n return found;\n}\nfunction nextChar(doc, pos) {\n let next = doc.sliceString(pos, pos + 2);\n return next.slice(0, codePointSize(codePointAt(next, 0)));\n}\nfunction prevChar(doc, pos) {\n let prev = doc.sliceString(pos - 2, pos);\n return codePointSize(codePointAt(prev, 0)) == prev.length ? prev : prev.slice(1);\n}\nfunction handleOpen(state, open, close, closeBefore) {\n let dont = null, changes = state.changeByRange(range => {\n if (!range.empty)\n return { changes: [{ insert: open, from: range.from }, { insert: close, from: range.to }],\n effects: closeBracketEffect.of(range.to + open.length),\n range: EditorSelection.range(range.anchor + open.length, range.head + open.length) };\n let next = nextChar(state.doc, range.head);\n if (!next || /\\s/.test(next) || closeBefore.indexOf(next) > -1)\n return { changes: { insert: open + close, from: range.head },\n effects: closeBracketEffect.of(range.head + open.length),\n range: EditorSelection.cursor(range.head + open.length) };\n return { range: dont = range };\n });\n return dont ? null : state.update(changes, {\n scrollIntoView: true,\n userEvent: \"input.type\"\n });\n}\nfunction handleClose(state, _open, close) {\n let dont = null, changes = state.changeByRange(range => {\n if (range.empty && nextChar(state.doc, range.head) == close)\n return { changes: { from: range.head, to: range.head + close.length, insert: close },\n range: EditorSelection.cursor(range.head + close.length) };\n return dont = { range };\n });\n return dont ? null : state.update(changes, {\n scrollIntoView: true,\n userEvent: \"input.type\"\n });\n}\n// Handles cases where the open and close token are the same, and\n// possibly triple quotes (as in `\"\"\"abc\"\"\"`-style quoting).\nfunction handleSame(state, token, allowTriple, config) {\n let stringPrefixes = config.stringPrefixes || defaults.stringPrefixes;\n let dont = null, changes = state.changeByRange(range => {\n if (!range.empty)\n return { changes: [{ insert: token, from: range.from }, { insert: token, from: range.to }],\n effects: closeBracketEffect.of(range.to + token.length),\n range: EditorSelection.range(range.anchor + token.length, range.head + token.length) };\n let pos = range.head, next = nextChar(state.doc, pos), start;\n if (next == token) {\n if (nodeStart(state, pos)) {\n return { changes: { insert: token + token, from: pos },\n effects: closeBracketEffect.of(pos + token.length),\n range: EditorSelection.cursor(pos + token.length) };\n }\n else if (closedBracketAt(state, pos)) {\n let isTriple = allowTriple && state.sliceDoc(pos, pos + token.length * 3) == token + token + token;\n let content = isTriple ? token + token + token : token;\n return { changes: { from: pos, to: pos + content.length, insert: content },\n range: EditorSelection.cursor(pos + content.length) };\n }\n }\n else if (allowTriple && state.sliceDoc(pos - 2 * token.length, pos) == token + token &&\n (start = canStartStringAt(state, pos - 2 * token.length, stringPrefixes)) > -1 &&\n nodeStart(state, start)) {\n return { changes: { insert: token + token + token + token, from: pos },\n effects: closeBracketEffect.of(pos + token.length),\n range: EditorSelection.cursor(pos + token.length) };\n }\n else if (state.charCategorizer(pos)(next) != CharCategory.Word) {\n if (canStartStringAt(state, pos, stringPrefixes) > -1 && !probablyInString(state, pos, token, stringPrefixes))\n return { changes: { insert: token + token, from: pos },\n effects: closeBracketEffect.of(pos + token.length),\n range: EditorSelection.cursor(pos + token.length) };\n }\n return { range: dont = range };\n });\n return dont ? null : state.update(changes, {\n scrollIntoView: true,\n userEvent: \"input.type\"\n });\n}\nfunction nodeStart(state, pos) {\n let tree = syntaxTree(state).resolveInner(pos + 1);\n return tree.parent && tree.from == pos;\n}\nfunction probablyInString(state, pos, quoteToken, prefixes) {\n let node = syntaxTree(state).resolveInner(pos, -1);\n let maxPrefix = prefixes.reduce((m, p) => Math.max(m, p.length), 0);\n for (let i = 0; i < 5; i++) {\n let start = state.sliceDoc(node.from, Math.min(node.to, node.from + quoteToken.length + maxPrefix));\n let quotePos = start.indexOf(quoteToken);\n if (!quotePos || quotePos > -1 && prefixes.indexOf(start.slice(0, quotePos)) > -1) {\n let first = node.firstChild;\n while (first && first.from == node.from && first.to - first.from > quoteToken.length + quotePos) {\n if (state.sliceDoc(first.to - quoteToken.length, first.to) == quoteToken)\n return false;\n first = first.firstChild;\n }\n return true;\n }\n let parent = node.to == pos && node.parent;\n if (!parent)\n break;\n node = parent;\n }\n return false;\n}\nfunction canStartStringAt(state, pos, prefixes) {\n let charCat = state.charCategorizer(pos);\n if (charCat(state.sliceDoc(pos - 1, pos)) != CharCategory.Word)\n return pos;\n for (let prefix of prefixes) {\n let start = pos - prefix.length;\n if (state.sliceDoc(start, pos) == prefix && charCat(state.sliceDoc(start - 1, start)) != CharCategory.Word)\n return start;\n }\n return -1;\n}\n\n/**\nReturns an extension that enables autocompletion.\n*/\nfunction autocompletion(config = {}) {\n return [\n completionState,\n completionConfig.of(config),\n completionPlugin,\n completionKeymapExt,\n baseTheme\n ];\n}\n/**\nBasic keybindings for autocompletion.\n\n - Ctrl-Space: [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)\n - Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)\n - ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`\n - ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`\n - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, \"page\")`\n - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, \"page\")`\n - Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)\n*/\nconst completionKeymap = [\n { key: \"Ctrl-Space\", run: startCompletion },\n { key: \"Escape\", run: closeCompletion },\n { key: \"ArrowDown\", run: /*@__PURE__*/moveCompletionSelection(true) },\n { key: \"ArrowUp\", run: /*@__PURE__*/moveCompletionSelection(false) },\n { key: \"PageDown\", run: /*@__PURE__*/moveCompletionSelection(true, \"page\") },\n { key: \"PageUp\", run: /*@__PURE__*/moveCompletionSelection(false, \"page\") },\n { key: \"Enter\", run: acceptCompletion }\n];\nconst completionKeymapExt = /*@__PURE__*/Prec.highest(/*@__PURE__*/keymap.computeN([completionConfig], state => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));\n/**\nGet the current completion status. When completions are available,\nthis will return `\"active\"`. When completions are pending (in the\nprocess of being queried), this returns `\"pending\"`. Otherwise, it\nreturns `null`.\n*/\nfunction completionStatus(state) {\n let cState = state.field(completionState, false);\n return cState && cState.active.some(a => a.state == 1 /* State.Pending */) ? \"pending\"\n : cState && cState.active.some(a => a.state != 0 /* State.Inactive */) ? \"active\" : null;\n}\nconst completionArrayCache = /*@__PURE__*/new WeakMap;\n/**\nReturns the available completions as an array.\n*/\nfunction currentCompletions(state) {\n var _a;\n let open = (_a = state.field(completionState, false)) === null || _a === void 0 ? void 0 : _a.open;\n if (!open || open.disabled)\n return [];\n let completions = completionArrayCache.get(open.options);\n if (!completions)\n completionArrayCache.set(open.options, completions = open.options.map(o => o.completion));\n return completions;\n}\n/**\nReturn the currently selected completion, if any.\n*/\nfunction selectedCompletion(state) {\n var _a;\n let open = (_a = state.field(completionState, false)) === null || _a === void 0 ? void 0 : _a.open;\n return open && !open.disabled && open.selected >= 0 ? open.options[open.selected].completion : null;\n}\n/**\nReturns the currently selected position in the active completion\nlist, or null if no completions are active.\n*/\nfunction selectedCompletionIndex(state) {\n var _a;\n let open = (_a = state.field(completionState, false)) === null || _a === void 0 ? void 0 : _a.open;\n return open && !open.disabled && open.selected >= 0 ? open.selected : null;\n}\n/**\nCreate an effect that can be attached to a transaction to change\nthe currently selected completion.\n*/\nfunction setSelectedCompletion(index) {\n return setSelectedEffect.of(index);\n}\n\nexport { CompletionContext, acceptCompletion, autocompletion, clearSnippet, closeBrackets, closeBracketsKeymap, closeCompletion, completeAnyWord, completeFromList, completionKeymap, completionStatus, currentCompletions, deleteBracketPair, hasNextSnippetField, hasPrevSnippetField, ifIn, ifNotIn, insertBracket, insertCompletionText, moveCompletionSelection, nextSnippetField, pickedCompletion, prevSnippetField, selectedCompletion, selectedCompletionIndex, setSelectedCompletion, snippet, snippetCompletion, snippetKeymap, startCompletion };\n"],"names":["CompletionContext","constructor","state","pos","explicit","this","abortListeners","tokenBefore","types","token","syntaxTree","resolveInner","indexOf","name","parent","from","to","text","sliceDoc","type","matchBefore","expr","line","doc","lineAt","start","Math","max","str","slice","found","search","ensureAnchor","aborted","addEventListener","listener","push","toSet","chars","flat","Object","keys","join","words","test","replace","completeFromList","list","options","map","o","label","validFor","match","every","first","create","rest","i","length","source","RegExp","prefixMatch","context","ifNotIn","nodes","isTop","Option","completion","score","cur","selection","main","_a","addStart","addEnd","flags","ignoreCase","pickedCompletion","Annotation","define","SourceCache","WeakMap","asSource","Array","isArray","known","get","set","startCompletionEffect","StateEffect","closeCompletionEffect","FuzzyMatcher","pattern","folded","any","precise","byWord","matched","p","char","codePointAt","size","codePointSize","part","upper","toUpperCase","toLowerCase","astral","ret","word","firstSize","direct","len","anyTo","e","min","next","preciseTo","byWordTo","byWordFolded","adjacentTo","adjacentStart","adjacentEnd","hasLower","wordAdjacent","prevType","ch","fromCodePoint","result","positions","completionConfig","Facet","combine","configs","combineConfig","activateOnTyping","activateOnTypingDelay","selectOnOpen","override","closeOnBlur","maxRenderedOptions","defaultKeymap","tooltipClass","optionClass","aboveCursor","icons","addToOptions","positionInfo","defaultPositionInfo","compareCompletions","a","b","localeCompare","interactionDelay","updateSyncTime","c","joinClass","concat","view","option","info","space","tooltip","offset","maxWidth","rtl","textDirection","Direction","RTL","left","narrow","side","spaceLeft","spaceRight","right","infoWidth","infoHeight","bottom","top","spaceBelow","style","offsetHeight","offsetWidth","class","rangeAroundSelected","total","selected","off","floor","CompletionTooltip","stateField","applyCompletion","infoDestroy","placeInfoReq","read","measureInfo","write","placeInfo","key","currentClass","cState","field","open","config","facet","optionContent","content","render","icon","document","createElement","classList","add","split","cls","setAttribute","position","_s","_v","labelElt","className","displayLabel","j","appendChild","createTextNode","span","detail","detailElt","textContent","sort","range","dom","updateTooltipClass","target","parentNode","nodeName","exec","id","preventDefault","relatedTarget","contentDOM","dispatch","effects","of","showOptions","mount","updateSel","remove","createListBox","requestMeasure","update","prevState","startState","disabled","toggle","positioned","updateSelectedOption","destroyInfo","infoResult","then","obj","addInfoPane","catch","logException","wrap","nodeType","destroy","opt","firstChild","nextSibling","hasAttribute","removeAttribute","container","element","getBoundingClientRect","self","scaleY","height","scrollTop","scrollIntoView","sel","querySelector","listRect","infoRect","selRect","win","ownerDocument","defaultView","window","innerWidth","innerHeight","cssText","ul","phrase","curSection","section","header","li","node","completionTooltip","boost","apply","CompletionDialog","attrs","timestamp","setSelected","makeAttrs","build","active","prev","conf","sections","addOption","some","s","hasResult","getMatch","filter","matcher","sectionOrder","cmp","_b","rank","compare","sortOptions","selectedValue","reduce","createTooltip","above","Date","now","changes","assign","mapPos","CompletionState","none","random","toString","tr","languageDataAt","find","ActiveSource","docChanged","touchesRange","iA","iB","endA","endB","sameResults","effect","is","setSelectedEffect","value","baseAttrs","getUserEvent","isUserEvent","explicitPos","event","handleUserEvent","handleChange","setActiveEffect","empty","ActiveResult","super","updated","checkValid","mapping","sources","completionState","StateField","provide","f","showTooltip","val","EditorView","contentAttributes","fromOff","toOff","changeByRange","insert","EditorSelection","cursor","userEvent","insertCompletionText","annotations","moveCompletionSelection","forward","by","step","getTooltip","RunningQuery","time","updates","done","undefined","completionPlugin","ViewPlugin","fromClass","debounceUpdate","running","debounceAccept","pendingStart","composing","startQuery","selectionSet","doesReset","transactions","query","handler","splice","clearTimeout","delay","q","setTimeout","startUpdate","r","pending","Promise","resolve","scheduleAccept","err","accept","current","eventHandlers","blur","dialog","contains","compositionstart","compositionend","baseTheme","fontFamily","whiteSpace","overflow","maxWidth_fallback","minWidth","maxHeight","listStyle","margin","padding","lineHeight","overflowX","textOverflow","display","borderBottom","paddingLeft","opacity","background","color","textAlign","width","boxSizing","backgroundColor","verticalAlign","borderLeft","textDecoration","marginLeft","fontStyle","fontSize","paddingRight","FieldPos","FieldRange","MapMode","TrackDel","Snippet","lines","fieldPositions","instantiate","lineStart","lineObj","baseIndent","indent","tabs","indentUnit","ranges","parse","template","m","fields","seq","index","esc","fieldMarker","Decoration","widget","WidgetType","toDOM","ignoreEvent","fieldRange","mark","ActiveSnippet","deco","mapped","selectionInsideField","setActive","moveToField","snippetState","decorations","fieldSelection","snippet","editor","spec","Text","Transaction","appendConfig","addSnippetKeymap","snippetPointerHandler","moveField","dir","last","defaultSnippetKeymap","run","shift","snippetKeymap","maps","Prec","highest","keymap","compute","snippetCompletion","domEventHandlers","mousedown","posAtCoords","x","clientX","y","clientY","defaults","brackets","before","stringPrefixes","closeBracketEffect","TrackAfter","closedBracket","RangeValue","startSide","endSide","bracketState","RangeSet","head","closeBrackets","inputHandler","definedClosing","closing","charCodeAt","charAt","android","navigator","userAgent","compositionStarted","readOnly","bracket","tokens","tok","closed","handleSame","handleOpen","closedBracketAt","handleClose","insertBracket","closeBracketsKeymap","dont","sliceString","prevChar","nextChar","between","close","closeBefore","anchor","_open","allowTriple","nodeStart","canStartStringAt","charCategorizer","CharCategory","Word","quoteToken","prefixes","maxPrefix","quotePos","probablyInString","tree","charCat","prefix","autocompletion","completionKeymapExt","completionKeymap","computeN"],"mappings":"gdAOA,MAAMA,EAMF,WAAAC,CAIAC,EAIAC,EAOAC,GACIC,KAAKH,MAAQA,EACbG,KAAKF,IAAMA,EACXE,KAAKD,SAAWA,EAIhBC,KAAKC,eAAiB,EACzB,CAKD,WAAAC,CAAYC,GACR,IAAIC,EAAQC,EAAWL,KAAKH,OAAOS,aAAaN,KAAKF,KAAM,GAC3D,KAAOM,GAASD,EAAMI,QAAQH,EAAMI,MAAQ,GACxCJ,EAAQA,EAAMK,OAClB,OAAOL,EAAQ,CAAEM,KAAMN,EAAMM,KAAMC,GAAIX,KAAKF,IACxCc,KAAMZ,KAAKH,MAAMgB,SAAST,EAAMM,KAAMV,KAAKF,KAC3CgB,KAAMV,EAAMU,MAAS,IAC5B,CAKD,WAAAC,CAAYC,GACR,IAAIC,EAAOjB,KAAKH,MAAMqB,IAAIC,OAAOnB,KAAKF,KAClCsB,EAAQC,KAAKC,IAAIL,EAAKP,KAAMV,KAAKF,IAAM,KACvCyB,EAAMN,EAAKL,KAAKY,MAAMJ,EAAQH,EAAKP,KAAMV,KAAKF,IAAMmB,EAAKP,MACzDe,EAAQF,EAAIG,OAAOC,EAAaX,GAAM,IAC1C,OAAOS,EAAQ,EAAI,KAAO,CAAEf,KAAMU,EAAQK,EAAOd,GAAIX,KAAKF,IAAKc,KAAMW,EAAIC,MAAMC,GAClF,CAKD,WAAIG,GAAY,OAA8B,MAAvB5B,KAAKC,cAAyB,CAMrD,gB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