@dou-ui/code 0.1.0-alpha.24 → 0.1.0-alpha.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/default-BWWFJmzn.js.map +1 -0
- package/dist/code-diff.js.map +1 -1
- package/dist/code-diff.vue_vue_type_script_setup_true_lang.js +149 -7
- package/dist/code-diff.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-editor.vue_vue_type_script_setup_true_lang.js +152 -34
- package/dist/code-editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/language/highlighter.js +1 -1
- package/dist/language/highlighter.js.map +1 -1
- package/dist/language/language.js +24 -2
- package/dist/language/language.js.map +1 -1
- package/dist/language/remote-tokens.js +131 -0
- package/dist/language/remote-tokens.js.map +1 -0
- package/dist/language/worker-client.js +308 -33
- package/dist/language/worker-client.js.map +1 -1
- package/dist/language/worker-protocol.js.map +1 -1
- package/dist/shiki/index.js +54 -3
- package/dist/shiki/index.js.map +1 -1
- package/dist/types/code-diff.vue.d.ts +4 -1
- package/dist/types/code-editor.vue.d.ts +2 -1
- package/dist/types/index.d.ts +18 -6
- package/dist/types/language/language.d.ts +27 -0
- package/dist/types/language/remote-tokens.d.ts +38 -0
- package/dist/types/language/worker-client.d.ts +85 -15
- package/dist/types/language/worker-protocol.d.ts +53 -2
- package/dist/types/shiki/index.d.ts +36 -1
- package/dist/types/types.d.ts +36 -7
- package/dist/types/worker/index.d.ts +27 -12
- package/dist/worker/default.js +1 -1
- package/dist/worker/index.js +280 -53
- package/dist/worker/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/assets/default-BZBMZKf_.js.map +0 -1
package/dist/worker/default.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/worker/default.ts?worker&inline
|
|
2
|
-
var jsContent = "(function() {\n // src/core/changes.ts\n /**\n * The changes one step makes to a text: replacements sorted by position,\n * never overlapping, every offset counted in the text before the step.\n *\n * A change set maps positions from the old text to the new one (cursors,\n * marks, diagnostics follow the edit), inverts (undo), and composes with the\n * one after it (merging steps).\n */\n var ChangeSet = class ChangeSet {\n changes;\n length;\n /** Running length difference after each change, for mapping by binary search. */\n shifts;\n constructor(changes, length) {\n this.changes = changes;\n this.length = length;\n }\n /**\n * Changes to a text of `length`. Specs may come in any order; touching\n * ones are joined, overlapping ones are a mistake.\n */\n static of(specs, length) {\n const sorted = (Array.isArray(specs) ? specs : [specs]).map((spec) => ({\n from: spec.from,\n to: spec.to ?? spec.from,\n insert: spec.insert ?? \"\"\n })).filter((change) => change.from !== change.to || change.insert).sort((a, b) => a.from - b.from || a.to - b.to);\n const changes = [];\n for (const change of sorted) {\n if (change.from < 0 || change.to > length || change.from > change.to) throw new RangeError(`[@dou-ui/code] change ${change.from}–${change.to} is outside 0–${length}`);\n const last = changes[changes.length - 1];\n if (last && change.from < last.to) throw new RangeError(`[@dou-ui/code] changes ${last.from}–${last.to} and ${change.from}–${change.to} overlap`);\n if (change.insert.includes(\"\\r\")) change.insert = change.insert.replace(/\\r\\n?/g, \"\\n\");\n if (last && change.from === last.to) {\n last.to = change.to;\n last.insert += change.insert;\n } else changes.push(change);\n }\n return new ChangeSet(changes, length);\n }\n /** No changes at all. */\n static empty(length) {\n return new ChangeSet([], length);\n }\n get empty() {\n return this.changes.length === 0;\n }\n /** Length of the text after the changes. */\n get newLength() {\n let length = this.length;\n for (const change of this.changes) length += change.insert.length - (change.to - change.from);\n return length;\n }\n /** Applies the changes to `text`, which must be the text they were made for. */\n apply(text) {\n if (text.length !== this.length) throw new RangeError(`[@dou-ui/code] changes for a text of ${this.length} applied to one of ${text.length}`);\n for (let i = this.changes.length - 1; i >= 0; i--) {\n const change = this.changes[i];\n text = text.replace(change.from, change.to, change.insert);\n }\n return text;\n }\n /** The changes that undo these, given the text before them. */\n invert(text) {\n let shift = 0;\n const out = [];\n for (const change of this.changes) {\n const from = change.from + shift;\n out.push({\n from,\n to: from + change.insert.length,\n insert: text.slice(change.from, change.to)\n });\n shift += change.insert.length - (change.to - change.from);\n }\n return new ChangeSet(out, this.newLength);\n }\n /** Where `pos` in the old text is in the new one. */\n mapPos(pos, assoc = -1) {\n const changes = this.changes;\n if (!changes.length) return pos;\n if (!this.shifts) {\n let shift = 0;\n this.shifts = changes.map((change) => shift += change.insert.length - (change.to - change.from));\n }\n let lo = 0;\n let hi = changes.length - 1;\n let found = -1;\n while (lo <= hi) {\n const mid = lo + hi >> 1;\n if (changes[mid].from <= pos) {\n found = mid;\n lo = mid + 1;\n } else hi = mid - 1;\n }\n if (found < 0) return pos;\n const change = changes[found];\n const before = found ? this.shifts[found - 1] : 0;\n if (pos > change.to) return pos + this.shifts[found];\n const start = change.from + before;\n const end = start + change.insert.length;\n if (pos === change.from && change.from === change.to) return assoc < 0 ? start : end;\n if (pos === change.from) return start;\n if (pos === change.to) return end;\n return assoc < 0 ? start : end;\n }\n /** Whether any change touches `from`–`to` of the old text. */\n touches(from, to = from) {\n return this.changes.some((change) => change.from <= to && change.to >= from);\n }\n /** These changes followed by `next`, which was made for the text these produce. */\n compose(next) {\n if (next.length !== this.newLength) throw new RangeError(`[@dou-ui/code] composing changes for ${next.length} after ones that make ${this.newLength}`);\n const a = toOps(this);\n const b = toOps(next);\n const out = [];\n let i = 0;\n let j = 0;\n let opA = a[i++];\n let opB = b[j++];\n while (opA || opB) if (opA && \"delete\" in opA) {\n out.push(opA);\n opA = a[i++];\n } else if (opB && \"insert\" in opB) {\n out.push(opB);\n opB = b[j++];\n } else if (opA && opB) {\n const sizeA = \"retain\" in opA ? opA.retain : opA.insert.length;\n const sizeB = \"retain\" in opB ? opB.retain : opB.delete;\n const n = Math.min(sizeA, sizeB);\n if (\"retain\" in opA) out.push(\"retain\" in opB ? { retain: n } : { delete: n });\n else if (\"retain\" in opB) out.push({ insert: opA.insert.slice(0, n) });\n opA = sizeA > n ? shrink(opA, n) : a[i++];\n opB = sizeB > n ? shrink(opB, n) : b[j++];\n } else throw new RangeError(\"[@dou-ui/code] change sets of different lengths\");\n return fromOps(out, this.length);\n }\n };\n function shrink(op, n) {\n if (\"retain\" in op) return { retain: op.retain - n };\n if (\"delete\" in op) return { delete: op.delete - n };\n return { insert: op.insert.slice(n) };\n }\n function toOps(set) {\n const ops = [];\n let pos = 0;\n for (const change of set.changes) {\n if (change.from > pos) ops.push({ retain: change.from - pos });\n if (change.to > change.from) ops.push({ delete: change.to - change.from });\n if (change.insert) ops.push({ insert: change.insert });\n pos = change.to;\n }\n if (set.length > pos) ops.push({ retain: set.length - pos });\n return ops;\n }\n function fromOps(ops, length) {\n const specs = [];\n let pos = 0;\n let open = null;\n for (const op of ops) {\n if (\"retain\" in op) {\n if (!op.retain) continue;\n open = null;\n pos += op.retain;\n continue;\n }\n if (!open) {\n open = {\n from: pos,\n to: pos,\n insert: \"\"\n };\n specs.push(open);\n }\n if (\"delete\" in op) {\n open.to += op.delete;\n pos += op.delete;\n } else open.insert += op.insert;\n }\n return ChangeSet.of(specs, length);\n }\n // ../../node_modules/.bun/@vue+shared@3.5.44/node_modules/@vue/shared/dist/shared.esm-bundler.js\n /**\n * @vue/shared v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n // @__NO_SIDE_EFFECTS__\n function makeMap(str) {\n const map = /* @__PURE__ */ Object.create(null);\n for (const key of str.split(\",\")) map[key] = 1;\n return (val) => val in map;\n }\n const EMPTY_OBJ = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze({}) : {};\n process.env.NODE_ENV !== \"production\" && Object.freeze([]);\n const NOOP = () => {};\n const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);\n const isModelListener = (key) => key.startsWith(\"onUpdate:\");\n const extend = Object.assign;\n const hasOwnProperty$1 = Object.prototype.hasOwnProperty;\n const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);\n const isArray = Array.isArray;\n const isMap = (val) => toTypeString(val) === \"[object Map]\";\n const isSet = (val) => toTypeString(val) === \"[object Set]\";\n const isFunction = (val) => typeof val === \"function\";\n const isString = (val) => typeof val === \"string\";\n const isSymbol = (val) => typeof val === \"symbol\";\n const isObject = (val) => val !== null && typeof val === \"object\";\n const isPromise = (val) => {\n return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);\n };\n const objectToString = Object.prototype.toString;\n const toTypeString = (value) => objectToString.call(value);\n const toRawType = (value) => {\n return toTypeString(value).slice(8, -1);\n };\n const isPlainObject = (val) => toTypeString(val) === \"[object Object]\";\n const isIntegerKey = (key) => isString(key) && key !== \"NaN\" && key[0] !== \"-\" && \"\" + parseInt(key, 10) === key;\n const cacheStringFunction = (fn) => {\n const cache = /* @__PURE__ */ Object.create(null);\n return ((str) => {\n return cache[str] || (cache[str] = fn(str));\n });\n };\n const capitalize = cacheStringFunction((str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n });\n const hasChanged = (value, oldValue) => !Object.is(value, oldValue);\n const def = (obj, key, value, writable = false) => {\n Object.defineProperty(obj, key, {\n configurable: true,\n enumerable: false,\n writable,\n value\n });\n };\n let _globalThis;\n const getGlobalThis = () => {\n return _globalThis || (_globalThis = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : {});\n };\n function normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);\n if (normalized) for (const key in normalized) res[key] = normalized[key];\n }\n return res;\n } else if (isString(value) || isObject(value)) return value;\n }\n const listDelimiterRE = /;(?![^(]*\\))/g;\n const propertyDelimiterRE = /:([^]+)/;\n const styleCommentRE = /\"(?:[^\"\\\\]|\\\\[^])*\"|'(?:[^'\\\\]|\\\\[^])*'|\\\\[^]|\\/\\*[^]*?\\*\\//g;\n function parseStringStyle(cssText) {\n const ret = {};\n cssText.replace(styleCommentRE, (match) => match.startsWith(\"/*\") ? \"\" : match).split(listDelimiterRE).forEach((item) => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n }\n function normalizeClass(value) {\n let res = \"\";\n if (isString(value)) res = value;\n else if (isArray(value)) for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) res += normalized + \" \";\n }\n else if (isObject(value)) {\n for (const name in value) if (value[name]) res += name + \" \";\n }\n return res.trim();\n }\n // ../../node_modules/.bun/@vue+reactivity@3.5.44/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js\n /**\n * @vue/reactivity v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n function warn$2(msg, ...args) {\n console.warn(`[Vue warn] ${msg}`, ...args);\n }\n let activeSub;\n const pausedQueueEffects = /* @__PURE__ */ new WeakSet();\n var ReactiveEffect = class {\n constructor(fn) {\n this.fn = fn;\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 5;\n /**\n * @internal\n */\n this.next = void 0;\n /**\n * @internal\n */\n this.cleanup = void 0;\n this.scheduler = void 0;\n }\n pause() {\n this.flags |= 64;\n }\n resume() {\n if (this.flags & 64) {\n this.flags &= -65;\n if (pausedQueueEffects.has(this)) {\n pausedQueueEffects.delete(this);\n this.trigger();\n }\n }\n }\n /**\n * @internal\n */\n notify() {\n if (this.flags & 2 && !(this.flags & 32)) return;\n if (!(this.flags & 8)) batch(this);\n }\n run() {\n if (!(this.flags & 1)) return this.fn();\n this.flags |= 2;\n cleanupEffect(this);\n prepareDeps(this);\n const prevEffect = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = this;\n shouldTrack = true;\n try {\n return this.fn();\n } finally {\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub !== this) warn$2(\"Active effect was not restored correctly - this is likely a Vue internal bug.\");\n cleanupDeps(this);\n activeSub = prevEffect;\n shouldTrack = prevShouldTrack;\n this.flags &= -3;\n }\n }\n stop() {\n if (this.flags & 1) {\n for (let link = this.deps; link; link = link.nextDep) removeSub(link);\n this.deps = this.depsTail = void 0;\n cleanupEffect(this);\n this.onStop && this.onStop();\n this.flags &= -2;\n }\n }\n trigger() {\n if (this.flags & 64) pausedQueueEffects.add(this);\n else if (this.scheduler) this.scheduler();\n else this.runIfDirty();\n }\n /**\n * @internal\n */\n runIfDirty() {\n if (isDirty(this)) this.run();\n }\n get dirty() {\n return isDirty(this);\n }\n };\n let batchDepth = 0;\n let batchedSub;\n let batchedComputed;\n function batch(sub, isComputed = false) {\n sub.flags |= 8;\n if (isComputed) {\n sub.next = batchedComputed;\n batchedComputed = sub;\n return;\n }\n sub.next = batchedSub;\n batchedSub = sub;\n }\n function startBatch() {\n batchDepth++;\n }\n function endBatch() {\n if (--batchDepth > 0) return;\n if (batchedComputed) {\n let e = batchedComputed;\n batchedComputed = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n e = next;\n }\n }\n let error;\n while (batchedSub) {\n let e = batchedSub;\n batchedSub = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n if (e.flags & 1) try {\n e.trigger();\n } catch (err) {\n if (!error) error = err;\n }\n e = next;\n }\n }\n if (error) throw error;\n }\n function prepareDeps(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n link.version = -1;\n link.prevActiveLink = link.dep.activeLink;\n link.dep.activeLink = link;\n }\n }\n function cleanupDeps(sub) {\n let head;\n let tail = sub.depsTail;\n let link = tail;\n while (link) {\n const prev = link.prevDep;\n if (link.version === -1) {\n if (link === tail) tail = prev;\n removeSub(link);\n removeDep(link);\n } else head = link;\n link.dep.activeLink = link.prevActiveLink;\n link.prevActiveLink = void 0;\n link = prev;\n }\n sub.deps = head;\n sub.depsTail = tail;\n }\n function isDirty(sub) {\n for (let link = sub.deps; link; link = link.nextDep) if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) return true;\n if (sub._dirty) return true;\n return false;\n }\n function refreshComputed(computed) {\n if (computed.flags & 4 && !(computed.flags & 16)) return;\n computed.flags &= -17;\n if (computed.globalVersion === globalVersion) return;\n computed.globalVersion = globalVersion;\n if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) return;\n computed.flags |= 2;\n const dep = computed.dep;\n const prevSub = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = computed;\n shouldTrack = true;\n try {\n prepareDeps(computed);\n const value = computed.fn(computed._value);\n if (dep.version === 0 || hasChanged(value, computed._value)) {\n computed.flags |= 128;\n computed._value = value;\n dep.version++;\n }\n } catch (err) {\n dep.version++;\n throw err;\n } finally {\n activeSub = prevSub;\n shouldTrack = prevShouldTrack;\n cleanupDeps(computed);\n computed.flags &= -3;\n }\n }\n function removeSub(link, soft = false) {\n const { dep, prevSub, nextSub } = link;\n if (prevSub) {\n prevSub.nextSub = nextSub;\n link.prevSub = void 0;\n }\n if (nextSub) {\n nextSub.prevSub = prevSub;\n link.nextSub = void 0;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && dep.subsHead === link) dep.subsHead = nextSub;\n if (dep.subs === link) {\n dep.subs = prevSub;\n if (!prevSub && dep.computed) {\n dep.computed.flags &= -5;\n for (let l = dep.computed.deps; l; l = l.nextDep) removeSub(l, true);\n }\n }\n if (!soft && !--dep.sc && dep.map) dep.map.delete(dep.key);\n }\n function removeDep(link) {\n const { prevDep, nextDep } = link;\n if (prevDep) {\n prevDep.nextDep = nextDep;\n link.prevDep = void 0;\n }\n if (nextDep) {\n nextDep.prevDep = prevDep;\n link.nextDep = void 0;\n }\n }\n let shouldTrack = true;\n const trackStack = [];\n function pauseTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = false;\n }\n function resetTracking() {\n const last = trackStack.pop();\n shouldTrack = last === void 0 ? true : last;\n }\n function cleanupEffect(e) {\n const { cleanup } = e;\n e.cleanup = void 0;\n if (cleanup) {\n const prevSub = activeSub;\n activeSub = void 0;\n try {\n cleanup();\n } finally {\n activeSub = prevSub;\n }\n }\n }\n let globalVersion = 0;\n var Link = class {\n constructor(sub, dep) {\n this.sub = sub;\n this.dep = dep;\n this.version = dep.version;\n this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;\n }\n };\n var Dep = class {\n constructor(computed) {\n this.computed = computed;\n this.version = 0;\n /**\n * Link between this dep and the current active effect\n */\n this.activeLink = void 0;\n /**\n * Doubly linked list representing the subscribing effects (tail)\n */\n this.subs = void 0;\n /**\n * For object property deps cleanup\n */\n this.map = void 0;\n this.key = void 0;\n /**\n * Subscriber counter\n */\n this.sc = 0;\n /**\n * @internal\n */\n this.__v_skip = true;\n if (!!(process.env.NODE_ENV !== \"production\")) this.subsHead = void 0;\n }\n track(debugInfo) {\n if (!activeSub || !shouldTrack || activeSub === this.computed) return;\n let link = this.activeLink;\n if (link === void 0 || link.sub !== activeSub) {\n link = this.activeLink = new Link(activeSub, this);\n if (!activeSub.deps) activeSub.deps = activeSub.depsTail = link;\n else {\n link.prevDep = activeSub.depsTail;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n }\n addSub(link);\n } else if (link.version === -1) {\n link.version = this.version;\n if (link.nextDep) {\n const next = link.nextDep;\n next.prevDep = link.prevDep;\n if (link.prevDep) link.prevDep.nextDep = next;\n link.prevDep = activeSub.depsTail;\n link.nextDep = void 0;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n if (activeSub.deps === link) activeSub.deps = next;\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub.onTrack) activeSub.onTrack(extend({ effect: activeSub }, debugInfo));\n return link;\n }\n trigger(debugInfo) {\n this.version++;\n globalVersion++;\n this.notify(debugInfo);\n }\n notify(debugInfo) {\n startBatch();\n try {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n for (let head = this.subsHead; head; head = head.nextSub) if (head.sub.onTrigger && !(head.sub.flags & 8)) head.sub.onTrigger(extend({ effect: head.sub }, debugInfo));\n }\n for (let link = this.subs; link; link = link.prevSub) if (link.sub.notify()) link.sub.dep.notify();\n } finally {\n endBatch();\n }\n }\n };\n function addSub(link) {\n link.dep.sc++;\n if (link.sub.flags & 4) {\n const computed = link.dep.computed;\n if (computed && !link.dep.subs) {\n computed.flags |= 20;\n for (let l = computed.deps; l; l = l.nextDep) addSub(l);\n }\n const currentTail = link.dep.subs;\n if (currentTail !== link) {\n link.prevSub = currentTail;\n if (currentTail) currentTail.nextSub = link;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && link.dep.subsHead === void 0) link.dep.subsHead = link;\n link.dep.subs = link;\n }\n }\n const targetMap = /* @__PURE__ */ new WeakMap();\n const ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Object iterate\" : \"\");\n const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Map keys iterate\" : \"\");\n const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Array iterate\" : \"\");\n function track(target, type, key) {\n if (shouldTrack && activeSub) {\n let depsMap = targetMap.get(target);\n if (!depsMap) targetMap.set(target, depsMap = /* @__PURE__ */ new Map());\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, dep = new Dep());\n dep.map = depsMap;\n dep.key = key;\n }\n if (!!(process.env.NODE_ENV !== \"production\")) dep.track({\n target,\n type,\n key\n });\n else dep.track();\n }\n }\n function trigger(target, type, key, newValue, oldValue, oldTarget) {\n const depsMap = targetMap.get(target);\n if (!depsMap) {\n globalVersion++;\n return;\n }\n const run = (dep) => {\n if (dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) dep.trigger({\n target,\n type,\n key,\n newValue,\n oldValue,\n oldTarget\n });\n else dep.trigger();\n }\n };\n startBatch();\n if (type === \"clear\") depsMap.forEach(run);\n else {\n const targetIsArray = isArray(target);\n const isArrayIndex = targetIsArray && isIntegerKey(key);\n if (targetIsArray && key === \"length\") {\n const newLength = Number(newValue);\n depsMap.forEach((dep, key2) => {\n if (key2 === \"length\" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) run(dep);\n });\n } else {\n if (key !== void 0 || depsMap.has(void 0)) run(depsMap.get(key));\n if (isArrayIndex) run(depsMap.get(ARRAY_ITERATE_KEY));\n switch (type) {\n case \"add\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));\n } else if (isArrayIndex) run(depsMap.get(\"length\"));\n break;\n case \"delete\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n break;\n case \"set\": if (isMap(target)) run(depsMap.get(ITERATE_KEY));\n }\n }\n }\n endBatch();\n }\n function reactiveReadArray(array) {\n const raw = /* @__PURE__ */ toRaw(array);\n if (raw === array) return raw;\n track(raw, \"iterate\", ARRAY_ITERATE_KEY);\n if (/* @__PURE__ */ isShallow(array)) return raw;\n if (!/* @__PURE__ */ isReadonly(array)) return raw.map(toReactive);\n return /* @__PURE__ */ isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);\n }\n function shallowReadArray(arr) {\n track(arr = /* @__PURE__ */ toRaw(arr), \"iterate\", ARRAY_ITERATE_KEY);\n return arr;\n }\n function toWrapped(target, item) {\n if (/* @__PURE__ */ isReadonly(target)) return /* @__PURE__ */ isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);\n return toReactive(item);\n }\n const arrayInstrumentations = {\n __proto__: null,\n [Symbol.iterator]() {\n return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));\n },\n concat(...args) {\n return reactiveReadArray(this).concat(...args.map((x) => isArray(x) ? reactiveReadArray(x) : x));\n },\n entries() {\n return iterator(this, \"entries\", (value) => {\n value[1] = toWrapped(this, value[1]);\n return value;\n });\n },\n every(fn, thisArg) {\n return apply(this, \"every\", fn, thisArg, void 0, arguments);\n },\n filter(fn, thisArg) {\n return apply(this, \"filter\", fn, thisArg, (v) => v.map((item) => toWrapped(this, item)), arguments);\n },\n find(fn, thisArg) {\n return apply(this, \"find\", fn, thisArg, (item) => toWrapped(this, item), arguments);\n },\n findIndex(fn, thisArg) {\n return apply(this, \"findIndex\", fn, thisArg, void 0, arguments);\n },\n findLast(fn, thisArg) {\n return apply(this, \"findLast\", fn, thisArg, (item) => toWrapped(this, item), arguments);\n },\n findLastIndex(fn, thisArg) {\n return apply(this, \"findLastIndex\", fn, thisArg, void 0, arguments);\n },\n forEach(fn, thisArg) {\n return apply(this, \"forEach\", fn, thisArg, void 0, arguments);\n },\n includes(...args) {\n return searchProxy(this, \"includes\", args);\n },\n indexOf(...args) {\n return searchProxy(this, \"indexOf\", args);\n },\n join(separator) {\n return reactiveReadArray(this).join(separator);\n },\n lastIndexOf(...args) {\n return searchProxy(this, \"lastIndexOf\", args);\n },\n map(fn, thisArg) {\n return apply(this, \"map\", fn, thisArg, void 0, arguments);\n },\n pop() {\n return noTracking(this, \"pop\");\n },\n push(...args) {\n return noTracking(this, \"push\", args);\n },\n reduce(fn, ...args) {\n return reduce(this, \"reduce\", fn, args);\n },\n reduceRight(fn, ...args) {\n return reduce(this, \"reduceRight\", fn, args);\n },\n shift() {\n return noTracking(this, \"shift\");\n },\n some(fn, thisArg) {\n return apply(this, \"some\", fn, thisArg, void 0, arguments);\n },\n splice(...args) {\n return noTracking(this, \"splice\", args);\n },\n toReversed() {\n return reactiveReadArray(this).toReversed();\n },\n toSorted(comparer) {\n return reactiveReadArray(this).toSorted(comparer);\n },\n toSpliced(...args) {\n return reactiveReadArray(this).toSpliced(...args);\n },\n unshift(...args) {\n return noTracking(this, \"unshift\", args);\n },\n values() {\n return iterator(this, \"values\", (item) => toWrapped(this, item));\n }\n };\n function iterator(self, method, wrapValue) {\n const arr = shallowReadArray(self);\n const methodFn = arr[method];\n const iter = methodFn.call(arr);\n if (arr !== self && !/* @__PURE__ */ isShallow(self)) {\n if (iter[Symbol.toStringTag] === \"Array Iterator\") {\n const wrapped = Object.create(Object.getPrototypeOf(iter));\n wrapped.next = () => wrapResult(iter.next(), wrapValue);\n if (methodFn !== arrayProto[method]) Object.defineProperties(wrapped, {\n return: { get() {\n const fn = iter.return;\n return typeof fn === \"function\" ? fn.bind(iter) : fn;\n } },\n throw: { get() {\n const fn = iter.throw;\n return typeof fn === \"function\" ? fn.bind(iter) : fn;\n } }\n });\n return wrapped;\n }\n iter._next = iter.next;\n iter.next = () => wrapResult(iter._next(), wrapValue);\n }\n return iter;\n }\n function wrapResult(result, wrapValue) {\n if (!result.done) result.value = wrapValue(result.value);\n return result;\n }\n const arrayProto = Array.prototype;\n function apply(self, method, fn, thisArg, wrappedRetFn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);\n const methodFn = arr[method];\n if (methodFn !== arrayProto[method]) {\n const result2 = methodFn.apply(self, args);\n return needsWrap ? toReactive(result2) : result2;\n }\n let wrappedFn = fn;\n if (arr !== self) {\n if (needsWrap) wrappedFn = function(item, index) {\n return fn.call(this, toWrapped(self, item), index, self);\n };\n else if (fn.length > 2) wrappedFn = function(item, index) {\n return fn.call(this, item, index, self);\n };\n }\n const result = methodFn.call(arr, wrappedFn, thisArg);\n return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;\n }\n function reduce(self, method, fn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);\n let wrappedFn = fn;\n let wrapInitialAccumulator = false;\n if (arr !== self) {\n if (needsWrap) {\n wrapInitialAccumulator = args.length === 0;\n wrappedFn = function(acc, item, index) {\n if (wrapInitialAccumulator) {\n wrapInitialAccumulator = false;\n acc = toWrapped(self, acc);\n }\n return fn.call(this, acc, toWrapped(self, item), index, self);\n };\n } else if (fn.length > 3) wrappedFn = function(acc, item, index) {\n return fn.call(this, acc, item, index, self);\n };\n }\n const result = arr[method](wrappedFn, ...args);\n return wrapInitialAccumulator ? toWrapped(self, result) : result;\n }\n function searchProxy(self, method, args) {\n const arr = /* @__PURE__ */ toRaw(self);\n track(arr, \"iterate\", ARRAY_ITERATE_KEY);\n const res = arr[method](...args);\n if ((res === -1 || res === false) && /* @__PURE__ */ isProxy(args[0])) {\n args[0] = /* @__PURE__ */ toRaw(args[0]);\n return arr[method](...args);\n }\n return res;\n }\n function noTracking(self, method, args = []) {\n pauseTracking();\n startBatch();\n const res = (/* @__PURE__ */ toRaw(self))[method].apply(self, args);\n endBatch();\n resetTracking();\n return res;\n }\n const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);\n const builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== \"arguments\" && key !== \"caller\").map((key) => Symbol[key]).filter(isSymbol));\n function hasOwnProperty(key) {\n if (!isSymbol(key)) key = String(key);\n const obj = /* @__PURE__ */ toRaw(this);\n track(obj, \"has\", key);\n return obj.hasOwnProperty(key);\n }\n var BaseReactiveHandler = class {\n constructor(_isReadonly = false, _isShallow = false) {\n this._isReadonly = _isReadonly;\n this._isShallow = _isShallow;\n }\n get(target, key, receiver) {\n if (key === \"__v_skip\") return target[\"__v_skip\"];\n const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;\n if (key === \"__v_isReactive\") return !isReadonly2;\n else if (key === \"__v_isReadonly\") return isReadonly2;\n else if (key === \"__v_isShallow\") return isShallow2;\n else if (key === \"__v_raw\") {\n if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) return target;\n return;\n }\n const targetIsArray = isArray(target);\n if (!isReadonly2) {\n let fn;\n if (targetIsArray && (fn = arrayInstrumentations[key])) return fn;\n if (key === \"hasOwnProperty\") return hasOwnProperty;\n }\n const res = Reflect.get(target, key, /* @__PURE__ */ isRef(target) ? target : receiver);\n if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) return res;\n if (!isReadonly2) track(target, \"get\", key);\n if (isShallow2) return res;\n if (/* @__PURE__ */ isRef(res)) {\n const value = targetIsArray && isIntegerKey(key) ? res : res.value;\n return isReadonly2 && isObject(value) ? /* @__PURE__ */ readonly(value) : value;\n }\n if (isObject(res)) return isReadonly2 ? /* @__PURE__ */ readonly(res) : /* @__PURE__ */ reactive(res);\n return res;\n }\n };\n var MutableReactiveHandler = class extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(false, isShallow2);\n }\n set(target, key, value, receiver) {\n let oldValue = target[key];\n const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);\n if (!this._isShallow) {\n const isOldValueReadonly = /* @__PURE__ */ isReadonly(oldValue);\n if (!/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) {\n oldValue = /* @__PURE__ */ toRaw(oldValue);\n value = /* @__PURE__ */ toRaw(value);\n }\n if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {\n if (isOldValueReadonly) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`Set operation on key \"${String(key)}\" failed: target is readonly.`, target[key]);\n return true;\n } else {\n oldValue.value = value;\n return true;\n }\n }\n }\n const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);\n const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);\n if (target === /* @__PURE__ */ toRaw(receiver) && result) {\n if (!hadKey) trigger(target, \"add\", key, value);\n else if (hasChanged(value, oldValue)) trigger(target, \"set\", key, value, oldValue);\n }\n return result;\n }\n deleteProperty(target, key) {\n const hadKey = hasOwn(target, key);\n const oldValue = target[key];\n const result = Reflect.deleteProperty(target, key);\n if (result && hadKey) trigger(target, \"delete\", key, void 0, oldValue);\n return result;\n }\n has(target, key) {\n const result = Reflect.has(target, key);\n if (!isSymbol(key) || !builtInSymbols.has(key)) track(target, \"has\", key);\n return result;\n }\n ownKeys(target) {\n track(target, \"iterate\", isArray(target) ? \"length\" : ITERATE_KEY);\n return Reflect.ownKeys(target);\n }\n };\n var ReadonlyReactiveHandler = class extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(true, isShallow2);\n }\n set(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`Set operation on key \"${String(key)}\" failed: target is readonly.`, target);\n return true;\n }\n deleteProperty(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`Delete operation on key \"${String(key)}\" failed: target is readonly.`, target);\n return true;\n }\n };\n const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();\n const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();\n const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);\n const toShallow = (value) => value;\n const getProto = (v) => Reflect.getPrototypeOf(v);\n function createIterableMethod(method, isReadonly2, isShallow2) {\n return function(...args) {\n const target = this[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const targetIsMap = isMap(rawTarget);\n const isPair = method === \"entries\" || method === Symbol.iterator && targetIsMap;\n const isKeyOnly = method === \"keys\" && targetIsMap;\n const innerIterator = target[method](...args);\n const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;\n !isReadonly2 && track(rawTarget, \"iterate\", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);\n return extend(Object.create(innerIterator), { next() {\n const { value, done } = innerIterator.next();\n return done ? {\n value,\n done\n } : {\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\n done\n };\n } });\n };\n }\n function createReadonlyMethod(type) {\n return function(...args) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\n warn$2(`${capitalize(type)} operation ${key}failed: target is readonly.`, /* @__PURE__ */ toRaw(this));\n }\n return type === \"delete\" ? false : type === \"clear\" ? void 0 : this;\n };\n }\n function createInstrumentations(readonly, shallow) {\n const instrumentations = {\n get(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const rawKey = /* @__PURE__ */ toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) track(rawTarget, \"get\", key);\n track(rawTarget, \"get\", rawKey);\n }\n const { has } = getProto(rawTarget);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n if (has.call(rawTarget, key)) return wrap(target.get(key));\n else if (has.call(rawTarget, rawKey)) return wrap(target.get(rawKey));\n else if (target !== rawTarget) target.get(key);\n },\n get size() {\n const target = this[\"__v_raw\"];\n !readonly && track(/* @__PURE__ */ toRaw(target), \"iterate\", ITERATE_KEY);\n return target.size;\n },\n has(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const rawKey = /* @__PURE__ */ toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) track(rawTarget, \"has\", key);\n track(rawTarget, \"has\", rawKey);\n }\n return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);\n },\n forEach(callback, thisArg) {\n const observed = this;\n const target = observed[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n !readonly && track(rawTarget, \"iterate\", ITERATE_KEY);\n return target.forEach((value, key) => {\n return callback.call(thisArg, wrap(value), wrap(key), observed);\n });\n }\n };\n extend(instrumentations, readonly ? {\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\")\n } : {\n add(value) {\n const target = /* @__PURE__ */ toRaw(this);\n const proto = getProto(target);\n const rawValue = /* @__PURE__ */ toRaw(value);\n const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;\n if (!(proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {\n target.add(valueToAdd);\n trigger(target, \"add\", valueToAdd, valueToAdd);\n }\n return this;\n },\n set(key, value) {\n if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);\n const target = /* @__PURE__ */ toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = /* @__PURE__ */ toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) checkIdentityKeys(target, has, key);\n const oldValue = get.call(target, key);\n target.set(key, value);\n if (!hadKey) trigger(target, \"add\", key, value);\n else if (hasChanged(value, oldValue)) trigger(target, \"set\", key, value, oldValue);\n return this;\n },\n delete(key) {\n const target = /* @__PURE__ */ toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = /* @__PURE__ */ toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) checkIdentityKeys(target, has, key);\n const oldValue = get ? get.call(target, key) : void 0;\n const result = target.delete(key);\n if (hadKey) trigger(target, \"delete\", key, void 0, oldValue);\n return result;\n },\n clear() {\n const target = /* @__PURE__ */ toRaw(this);\n const hadItems = target.size !== 0;\n const oldTarget = !!(process.env.NODE_ENV !== \"production\") ? isMap(target) ? new Map(target) : new Set(target) : void 0;\n const result = target.clear();\n if (hadItems) trigger(target, \"clear\", void 0, void 0, oldTarget);\n return result;\n }\n });\n [\n \"keys\",\n \"values\",\n \"entries\",\n Symbol.iterator\n ].forEach((method) => {\n instrumentations[method] = createIterableMethod(method, readonly, shallow);\n });\n return instrumentations;\n }\n function createInstrumentationGetter(isReadonly2, shallow) {\n const instrumentations = createInstrumentations(isReadonly2, shallow);\n return (target, key, receiver) => {\n if (key === \"__v_isReactive\") return !isReadonly2;\n else if (key === \"__v_isReadonly\") return isReadonly2;\n else if (key === \"__v_isShallow\") return shallow;\n else if (key === \"__v_raw\") return target;\n return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);\n };\n }\n const mutableCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, false) };\n const readonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, false) };\n const shallowReadonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, true) };\n function checkIdentityKeys(target, has, key) {\n const rawKey = /* @__PURE__ */ toRaw(key);\n if (rawKey !== key && has.call(target, rawKey)) {\n const type = toRawType(target);\n warn$2(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);\n }\n }\n const reactiveMap = /* @__PURE__ */ new WeakMap();\n const shallowReactiveMap = /* @__PURE__ */ new WeakMap();\n const readonlyMap = /* @__PURE__ */ new WeakMap();\n const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();\n function targetTypeMap(rawType) {\n switch (rawType) {\n case \"Object\":\n case \"Array\": return 1;\n case \"Map\":\n case \"Set\":\n case \"WeakMap\":\n case \"WeakSet\": return 2;\n default: return 0;\n }\n }\n // @__NO_SIDE_EFFECTS__\n function reactive(target) {\n if (/* @__PURE__ */ isReadonly(target)) return target;\n return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);\n }\n // @__NO_SIDE_EFFECTS__\n function readonly(target) {\n return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);\n }\n // @__NO_SIDE_EFFECTS__\n function shallowReadonly(target) {\n return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);\n }\n function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {\n if (!isObject(target)) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`value cannot be made ${isReadonly2 ? \"readonly\" : \"reactive\"}: ${String(target)}`);\n return target;\n }\n if (target[\"__v_raw\"] && !(isReadonly2 && target[\"__v_isReactive\"])) return target;\n if (target[\"__v_skip\"] || !Object.isExtensible(target)) return target;\n const existingProxy = proxyMap.get(target);\n if (existingProxy) return existingProxy;\n const targetType = targetTypeMap(toRawType(target));\n if (targetType === 0) return target;\n const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);\n proxyMap.set(target, proxy);\n return proxy;\n }\n // @__NO_SIDE_EFFECTS__\n function isReactive(value) {\n if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value[\"__v_raw\"]);\n return !!(value && value[\"__v_isReactive\"]);\n }\n // @__NO_SIDE_EFFECTS__\n function isReadonly(value) {\n return !!(value && value[\"__v_isReadonly\"]);\n }\n // @__NO_SIDE_EFFECTS__\n function isShallow(value) {\n return !!(value && value[\"__v_isShallow\"]);\n }\n // @__NO_SIDE_EFFECTS__\n function isProxy(value) {\n return value ? !!value[\"__v_raw\"] : false;\n }\n // @__NO_SIDE_EFFECTS__\n function toRaw(observed) {\n const raw = observed && observed[\"__v_raw\"];\n return raw ? /* @__PURE__ */ toRaw(raw) : observed;\n }\n function markRaw(value) {\n if (!hasOwn(value, \"__v_skip\") && Object.isExtensible(value)) def(value, \"__v_skip\", true);\n return value;\n }\n const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;\n const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;\n // @__NO_SIDE_EFFECTS__\n function isRef(r) {\n return r ? r[\"__v_isRef\"] === true : false;\n }\n function unref(ref2) {\n return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;\n }\n const shallowUnwrapHandlers = {\n get: (target, key, receiver) => key === \"__v_raw\" ? target : unref(Reflect.get(target, key, receiver)),\n set: (target, key, value, receiver) => {\n const oldValue = target[key];\n if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {\n oldValue.value = value;\n return true;\n } else return Reflect.set(target, key, value, receiver);\n }\n };\n function proxyRefs(objectWithRefs) {\n return /* @__PURE__ */ isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);\n }\n const INITIAL_WATCHER_VALUE = {};\n const cleanupMap = /* @__PURE__ */ new WeakMap();\n let activeWatcher = void 0;\n function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {\n if (owner) {\n let cleanups = cleanupMap.get(owner);\n if (!cleanups) cleanupMap.set(owner, cleanups = []);\n cleanups.push(cleanupFn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) warn$2(`onWatcherCleanup() was called when there was no active watcher to associate with.`);\n }\n function watch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, once, scheduler, augmentJob, call } = options;\n const warnInvalidSource = (s) => {\n (options.onWarn || warn$2)(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`);\n };\n const reactiveGetter = (source2) => {\n if (deep) return source2;\n if (/* @__PURE__ */ isShallow(source2) || deep === false || deep === 0) return traverse(source2, 1);\n return traverse(source2);\n };\n let effect;\n let getter;\n let cleanup;\n let boundCleanup;\n let forceTrigger = false;\n let isMultiSource = false;\n if (/* @__PURE__ */ isRef(source)) {\n getter = () => source.value;\n forceTrigger = /* @__PURE__ */ isShallow(source);\n } else if (/* @__PURE__ */ isReactive(source)) {\n getter = () => reactiveGetter(source);\n forceTrigger = true;\n } else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some((s) => /* @__PURE__ */ isReactive(s) || /* @__PURE__ */ isShallow(s));\n getter = () => source.map((s) => {\n if (/* @__PURE__ */ isRef(s)) return s.value;\n else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s);\n else if (isFunction(s)) return call ? call(s, 2) : s();\n else process.env.NODE_ENV !== \"production\" && warnInvalidSource(s);\n });\n } else if (isFunction(source)) {\n if (cb) getter = call ? () => call(source, 2) : source;\n else getter = () => {\n if (cleanup) {\n pauseTracking();\n try {\n cleanup();\n } finally {\n resetTracking();\n }\n }\n const currentEffect = activeWatcher;\n activeWatcher = effect;\n try {\n return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);\n } finally {\n activeWatcher = currentEffect;\n }\n };\n } else {\n getter = NOOP;\n process.env.NODE_ENV !== \"production\" && warnInvalidSource(source);\n }\n if (cb && deep) {\n const baseGetter = getter;\n const depth = deep === true ? Infinity : deep;\n getter = () => traverse(baseGetter(), depth);\n }\n const watchHandle = () => {\n effect.stop();\n };\n if (once && cb) {\n const _cb = cb;\n cb = (...args) => {\n try {\n return _cb(...args);\n } finally {\n watchHandle();\n }\n };\n }\n let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;\n const job = (immediateFirstRun) => {\n if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) return;\n if (cb) {\n const newValue = effect.run();\n if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {\n const currentWatcher = activeWatcher;\n pauseTracking();\n try {\n if (cleanup) cleanup();\n activeWatcher = effect;\n const args = [\n newValue,\n oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,\n boundCleanup\n ];\n oldValue = newValue;\n call ? call(cb, 3, args) : cb(...args);\n } finally {\n activeWatcher = currentWatcher;\n resetTracking();\n }\n }\n } else effect.run();\n };\n if (augmentJob) augmentJob(job);\n effect = new ReactiveEffect(getter);\n effect.scheduler = scheduler ? () => scheduler(job, false) : job;\n boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);\n cleanup = effect.onStop = () => {\n const cleanups = cleanupMap.get(effect);\n if (cleanups) {\n if (call) call(cleanups, 4);\n else for (const cleanup2 of cleanups) cleanup2();\n cleanupMap.delete(effect);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\")) {\n effect.onTrack = options.onTrack;\n effect.onTrigger = options.onTrigger;\n }\n if (cb) {\n if (immediate) job(true);\n else oldValue = effect.run();\n } else if (scheduler) scheduler(job.bind(null, true), true);\n else effect.run();\n watchHandle.pause = effect.pause.bind(effect);\n watchHandle.resume = effect.resume.bind(effect);\n watchHandle.stop = watchHandle;\n return watchHandle;\n }\n function traverse(value, depth = Infinity, seen) {\n if (depth <= 0 || !isObject(value) || value[\"__v_skip\"]) return value;\n seen = seen || /* @__PURE__ */ new Map();\n if ((seen.get(value) || 0) >= depth) return value;\n seen.set(value, depth);\n depth--;\n if (/* @__PURE__ */ isRef(value)) traverse(value.value, depth, seen);\n else if (isArray(value)) for (let i = 0; i < value.length; i++) traverse(value[i], depth, seen);\n else if (isSet(value) || isMap(value)) value.forEach((v) => {\n traverse(v, depth, seen);\n });\n else if (isPlainObject(value)) {\n for (const key in value) traverse(value[key], depth, seen);\n for (const key of Object.getOwnPropertySymbols(value)) if (Object.prototype.propertyIsEnumerable.call(value, key)) traverse(value[key], depth, seen);\n }\n return value;\n }\n // ../../node_modules/.bun/@vue+runtime-core@3.5.44/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js\n /**\n * @vue/runtime-core v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n const stack = [];\n function pushWarningContext(vnode) {\n stack.push(vnode);\n }\n function popWarningContext() {\n stack.pop();\n }\n let isWarning = false;\n function warn$1(msg, ...args) {\n if (isWarning) return;\n isWarning = true;\n pauseTracking();\n const instance = stack.length ? stack[stack.length - 1].component : null;\n const appWarnHandler = instance && instance.appContext.config.warnHandler;\n const trace = getComponentTrace();\n if (appWarnHandler) callWithErrorHandling(appWarnHandler, instance, 11, [\n msg + args.map((a) => {\n var _a, _b;\n return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);\n }).join(\"\"),\n instance && instance.proxy,\n trace.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`).join(\"\\n\"),\n trace\n ]);\n else {\n const warnArgs = [`[Vue warn]: ${msg}`, ...args];\n if (trace.length && true) warnArgs.push(`\n`, ...formatTrace(trace));\n console.warn(...warnArgs);\n }\n resetTracking();\n isWarning = false;\n }\n function getComponentTrace() {\n let currentVNode = stack[stack.length - 1];\n if (!currentVNode) return [];\n const normalizedStack = [];\n while (currentVNode) {\n const last = normalizedStack[0];\n if (last && last.vnode === currentVNode) last.recurseCount++;\n else normalizedStack.push({\n vnode: currentVNode,\n recurseCount: 0\n });\n const parentInstance = currentVNode.component && currentVNode.component.parent;\n currentVNode = parentInstance && parentInstance.vnode;\n }\n return normalizedStack;\n }\n function formatTrace(trace) {\n const logs = [];\n trace.forEach((entry, i) => {\n logs.push(...i === 0 ? [] : [`\n`], ...formatTraceEntry(entry));\n });\n return logs;\n }\n function formatTraceEntry({ vnode, recurseCount }) {\n const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;\n const isRoot = vnode.component ? vnode.component.parent == null : false;\n const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;\n const close = `>` + postfix;\n return vnode.props ? [\n open,\n ...formatProps(vnode.props),\n close\n ] : [open + close];\n }\n function formatProps(props) {\n const res = [];\n const keys = Object.keys(props);\n keys.slice(0, 3).forEach((key) => {\n res.push(...formatProp(key, props[key]));\n });\n if (keys.length > 3) res.push(` ...`);\n return res;\n }\n function formatProp(key, value, raw) {\n if (isString(value)) {\n value = JSON.stringify(value);\n return raw ? value : [`${key}=${value}`];\n } else if (typeof value === \"number\" || typeof value === \"boolean\" || value == null) return raw ? value : [`${key}=${value}`];\n else if (/* @__PURE__ */ isRef(value)) {\n value = formatProp(key, /* @__PURE__ */ toRaw(value.value), true);\n return raw ? value : [\n `${key}=Ref<`,\n value,\n `>`\n ];\n } else if (isFunction(value)) return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];\n else {\n value = /* @__PURE__ */ toRaw(value);\n return raw ? value : [`${key}=`, value];\n }\n }\n const ErrorTypeStrings$1 = {\n [\"sp\"]: \"serverPrefetch hook\",\n [\"bc\"]: \"beforeCreate hook\",\n [\"c\"]: \"created hook\",\n [\"bm\"]: \"beforeMount hook\",\n [\"m\"]: \"mounted hook\",\n [\"bu\"]: \"beforeUpdate hook\",\n [\"u\"]: \"updated\",\n [\"bum\"]: \"beforeUnmount hook\",\n [\"um\"]: \"unmounted hook\",\n [\"a\"]: \"activated hook\",\n [\"da\"]: \"deactivated hook\",\n [\"ec\"]: \"errorCaptured hook\",\n [\"rtc\"]: \"renderTracked hook\",\n [\"rtg\"]: \"renderTriggered hook\",\n [0]: \"setup function\",\n [1]: \"render function\",\n [2]: \"watcher getter\",\n [3]: \"watcher callback\",\n [4]: \"watcher cleanup function\",\n [5]: \"native event handler\",\n [6]: \"component event handler\",\n [7]: \"vnode hook\",\n [8]: \"directive hook\",\n [9]: \"transition hook\",\n [10]: \"app errorHandler\",\n [11]: \"app warnHandler\",\n [12]: \"ref function\",\n [13]: \"async component loader\",\n [14]: \"scheduler flush\",\n [15]: \"component update\",\n [16]: \"app unmount cleanup function\"\n };\n function callWithErrorHandling(fn, instance, type, args) {\n try {\n return args ? fn(...args) : fn();\n } catch (err) {\n handleError(err, instance, type);\n }\n }\n function callWithAsyncErrorHandling(fn, instance, type, args) {\n if (isFunction(fn)) {\n const res = callWithErrorHandling(fn, instance, type, args);\n if (res && isPromise(res)) res.catch((err) => {\n handleError(err, instance, type);\n });\n return res;\n }\n if (isArray(fn)) {\n const values = [];\n for (let i = 0; i < fn.length; i++) values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));\n return values;\n } else if (!!(process.env.NODE_ENV !== \"production\")) warn$1(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);\n }\n function handleError(err, instance, type, throwInDev = true) {\n const contextVNode = instance ? instance.vnode : null;\n const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;\n if (instance) {\n let cur = instance.parent;\n const exposedInstance = instance.proxy;\n const errorInfo = !!(process.env.NODE_ENV !== \"production\") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;\n while (cur) {\n const errorCapturedHooks = cur.ec;\n if (errorCapturedHooks) {\n for (let i = 0; i < errorCapturedHooks.length; i++) if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) return;\n }\n cur = cur.parent;\n }\n if (errorHandler) {\n pauseTracking();\n callWithErrorHandling(errorHandler, null, 10, [\n err,\n exposedInstance,\n errorInfo\n ]);\n resetTracking();\n return;\n }\n }\n logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);\n }\n function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const info = ErrorTypeStrings$1[type];\n if (contextVNode) pushWarningContext(contextVNode);\n warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);\n if (contextVNode) popWarningContext();\n if (throwInDev) throw err;\n else console.error(err);\n } else if (throwInProd) throw err;\n else console.error(err);\n }\n const queue = [];\n let flushIndex = -1;\n const pendingPostFlushCbs = [];\n let activePostFlushCbs = null;\n let postFlushIndex = 0;\n const resolvedPromise = /* @__PURE__ */ Promise.resolve();\n let currentFlushPromise = null;\n const RECURSION_LIMIT = 100;\n function nextTick(fn) {\n const p = currentFlushPromise || resolvedPromise;\n return fn ? p.then(this ? fn.bind(this) : fn) : p;\n }\n function findInsertionIndex(id) {\n let start = flushIndex + 1;\n let end = queue.length;\n while (start < end) {\n const middle = start + end >>> 1;\n const middleJob = queue[middle];\n const middleJobId = getId(middleJob);\n if (middleJobId < id || middleJobId === id && middleJob.flags & 2) start = middle + 1;\n else end = middle;\n }\n return start;\n }\n function queueJob(job) {\n if (!(job.flags & 1)) {\n const jobId = getId(job);\n const lastJob = queue[queue.length - 1];\n if (!lastJob || !(job.flags & 2) && jobId >= getId(lastJob)) queue.push(job);\n else queue.splice(findInsertionIndex(jobId), 0, job);\n job.flags |= 1;\n queueFlush();\n }\n }\n function queueFlush() {\n if (!currentFlushPromise) currentFlushPromise = resolvedPromise.then(flushJobs);\n }\n function queuePostFlushCb(cb) {\n if (!isArray(cb)) {\n if (activePostFlushCbs && cb.id === -1) activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);\n else if (!(cb.flags & 1)) {\n pendingPostFlushCbs.push(cb);\n cb.flags |= 1;\n }\n } else for (let i = 0; i < cb.length; i++) pendingPostFlushCbs.push(cb[i]);\n queueFlush();\n }\n function flushPostFlushCbs(seen, skip, minUid = 0) {\n if (pendingPostFlushCbs.length) {\n let cbs = pendingPostFlushCbs;\n let kept = 0;\n if (skip) {\n cbs = [];\n for (let i = 0; i < pendingPostFlushCbs.length; i++) {\n const cb = pendingPostFlushCbs[i];\n if (cb.i !== void 0 ? !cb.i || cb.i.uid < minUid : skip.has(cb)) pendingPostFlushCbs[kept++] = cb;\n else cbs.push(cb);\n }\n }\n const deduped = [...new Set(cbs)].sort((a, b) => getId(a) - getId(b));\n pendingPostFlushCbs.length = kept;\n if (activePostFlushCbs) {\n for (let i = 0; i < deduped.length; i++) activePostFlushCbs.push(deduped[i]);\n return;\n }\n activePostFlushCbs = deduped;\n if (!!(process.env.NODE_ENV !== \"production\")) seen = seen || /* @__PURE__ */ new Map();\n for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {\n const cb = activePostFlushCbs[postFlushIndex];\n if (!!(process.env.NODE_ENV !== \"production\") && checkRecursiveUpdates(seen, cb)) continue;\n if (cb.flags & 4) cb.flags &= -2;\n if (!(cb.flags & 8)) cb();\n cb.flags &= -2;\n }\n activePostFlushCbs = null;\n postFlushIndex = 0;\n }\n }\n const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;\n function flushJobs(seen) {\n if (!!(process.env.NODE_ENV !== \"production\")) seen = seen || /* @__PURE__ */ new Map();\n const check = !!(process.env.NODE_ENV !== \"production\") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;\n try {\n for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job && !(job.flags & 8)) {\n if (!!(process.env.NODE_ENV !== \"production\") && check(job)) continue;\n if (job.flags & 4) job.flags &= -2;\n callWithErrorHandling(job, job.i, job.i ? 15 : 14);\n if (!(job.flags & 4)) job.flags &= -2;\n }\n }\n } finally {\n for (; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job) job.flags &= -2;\n }\n flushIndex = -1;\n queue.length = 0;\n flushPostFlushCbs(seen);\n currentFlushPromise = null;\n if (queue.length || pendingPostFlushCbs.length) flushJobs(seen);\n }\n }\n function checkRecursiveUpdates(seen, fn) {\n const count = seen.get(fn) || 0;\n if (count > RECURSION_LIMIT) {\n const instance = fn.i;\n const componentName = instance && getComponentName(instance.type);\n handleError(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, null, 10);\n return true;\n }\n seen.set(fn, count + 1);\n return false;\n }\n const hmrDirtyComponents = /* @__PURE__ */ new Map();\n if (!!(process.env.NODE_ENV !== \"production\")) getGlobalThis().__VUE_HMR_RUNTIME__ = {\n createRecord: tryWrap(createRecord),\n rerender: tryWrap(rerender),\n reload: tryWrap(reload)\n };\n const map = /* @__PURE__ */ new Map();\n function createRecord(id, initialDef) {\n if (map.has(id)) return false;\n map.set(id, {\n initialDef: normalizeClassComponent(initialDef),\n instances: /* @__PURE__ */ new Set()\n });\n return true;\n }\n function normalizeClassComponent(component) {\n return isClassComponent(component) ? component.__vccOpts : component;\n }\n function rerender(id, newRender) {\n const record = map.get(id);\n if (!record) return;\n record.initialDef.render = newRender;\n [...record.instances].forEach((instance) => {\n if (newRender) {\n instance.render = newRender;\n normalizeClassComponent(instance.type).render = newRender;\n }\n instance.renderCache = [];\n if (!(instance.job.flags & 8)) instance.update();\n });\n }\n function reload(id, newComp) {\n const record = map.get(id);\n if (!record) return;\n newComp = normalizeClassComponent(newComp);\n updateComponentDef(record.initialDef, newComp);\n const instances = [...record.instances];\n for (let i = 0; i < instances.length; i++) {\n const instance = instances[i];\n const oldComp = normalizeClassComponent(instance.type);\n let dirtyInstances = hmrDirtyComponents.get(oldComp);\n if (!dirtyInstances) {\n if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);\n hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());\n }\n dirtyInstances.add(instance);\n instance.appContext.propsCache.delete(instance.type);\n instance.appContext.emitsCache.delete(instance.type);\n instance.appContext.optionsCache.delete(instance.type);\n if (instance.ceReload) {\n dirtyInstances.add(instance);\n instance.ceReload(newComp.styles);\n dirtyInstances.delete(instance);\n } else if (instance.parent) queueJob(() => {\n if (!(instance.job.flags & 8)) {\n instance.parent.update();\n dirtyInstances.delete(instance);\n }\n });\n else if (instance.appContext.reload) instance.appContext.reload();\n else if (typeof window !== \"undefined\") window.location.reload();\n else console.warn(\"[HMR] Root or manually mounted instance modified. Full reload required.\");\n if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);\n }\n queuePostFlushCb(() => {\n hmrDirtyComponents.clear();\n });\n }\n function updateComponentDef(oldComp, newComp) {\n extend(oldComp, newComp);\n for (const key in oldComp) if (key !== \"__file\" && !(key in newComp)) delete oldComp[key];\n }\n function tryWrap(fn) {\n return (id, arg) => {\n try {\n return fn(id, arg);\n } catch (e) {\n console.error(e);\n console.warn(`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`);\n }\n };\n }\n let currentRenderingInstance = null;\n let currentScopeId = null;\n function inject(key, defaultValue, treatDefaultAsFactory = false) {\n const instance = getCurrentInstance();\n if (instance || currentApp) {\n let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;\n if (provides && key in provides) return provides[key];\n else if (arguments.length > 1) return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;\n else if (!!(process.env.NODE_ENV !== \"production\")) warn$1(`injection \"${String(key)}\" not found.`);\n } else if (!!(process.env.NODE_ENV !== \"production\")) warn$1(`inject() can only be used inside setup() or functional components.`);\n }\n const ssrContextKey = /* @__PURE__ */ Symbol.for(\"v-scx\");\n const useSSRContext = () => {\n {\n const ctx = inject(ssrContextKey);\n if (!ctx) process.env.NODE_ENV !== \"production\" && warn$1(`Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`);\n return ctx;\n }\n };\n function doWatch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, flush, once } = options;\n if (!!(process.env.NODE_ENV !== \"production\") && !cb) {\n if (immediate !== void 0) warn$1(`watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature.`);\n if (deep !== void 0) warn$1(`watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature.`);\n if (once !== void 0) warn$1(`watch() \"once\" option is only respected when using the watch(source, callback, options?) signature.`);\n }\n const baseWatchOptions = extend({}, options);\n if (!!(process.env.NODE_ENV !== \"production\")) baseWatchOptions.onWarn = warn$1;\n const runsImmediately = cb && immediate || !cb && flush !== \"post\";\n let ssrCleanup;\n if (isInSSRComponentSetup) {\n if (flush === \"sync\") {\n const ctx = useSSRContext();\n ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);\n } else if (!runsImmediately) {\n const watchStopHandle = () => {};\n watchStopHandle.stop = NOOP;\n watchStopHandle.resume = NOOP;\n watchStopHandle.pause = NOOP;\n return watchStopHandle;\n }\n }\n const instance = currentInstance;\n baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);\n let isPre = false;\n if (flush === \"post\") baseWatchOptions.scheduler = (job) => {\n job.i = instance;\n queuePostRenderEffect(job, instance && instance.suspense);\n };\n else if (flush !== \"sync\") {\n isPre = true;\n baseWatchOptions.scheduler = (job, isFirstRun) => {\n if (isFirstRun) job();\n else queueJob(job);\n };\n }\n baseWatchOptions.augmentJob = (job) => {\n if (cb) job.flags |= 4;\n if (isPre) {\n job.flags |= 2;\n if (instance) {\n job.id = instance.uid;\n job.i = instance;\n }\n }\n };\n const watchHandle = watch(source, cb, baseWatchOptions);\n if (isInSSRComponentSetup) {\n if (ssrCleanup) ssrCleanup.push(watchHandle);\n else if (runsImmediately) watchHandle();\n }\n return watchHandle;\n }\n function instanceWatch(source, value, options) {\n const publicThis = this.proxy;\n const getter = isString(source) ? source.includes(\".\") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);\n let cb;\n if (isFunction(value)) cb = value;\n else {\n cb = value.handler;\n options = value;\n }\n const reset = setCurrentInstance(this);\n const res = doWatch(getter, cb.bind(publicThis), options);\n reset();\n return res;\n }\n function createPathGetter(ctx, path) {\n const segments = path.split(\".\");\n return () => {\n let cur = ctx;\n for (let i = 0; i < segments.length && cur; i++) cur = cur[segments[i]];\n return cur;\n };\n }\n const isTeleport = (type) => type.__isTeleport;\n function findNonCommentChild(children) {\n let child = children[0];\n if (children.length > 1) {\n let hasFound = false;\n for (const c of children) if (c.type !== Comment) {\n if (!!(process.env.NODE_ENV !== \"production\") && hasFound) {\n warn$1(\"<transition> can only be used on a single element or component. Use <transition-group> for lists.\");\n break;\n }\n child = c;\n hasFound = true;\n if (!!!(process.env.NODE_ENV !== \"production\")) break;\n }\n }\n return child;\n }\n function getInnerChild$1(vnode) {\n if (!isKeepAlive(vnode)) {\n if (isTeleport(vnode.type) && vnode.children) return findNonCommentChild(vnode.children);\n return vnode;\n }\n if (vnode.component) return vnode.component.subTree;\n const { shapeFlag, children } = vnode;\n if (children) {\n if (shapeFlag & 16) return children[0];\n if (shapeFlag & 32 && isFunction(children.default)) return children.default();\n }\n }\n function setTransitionHooks(vnode, hooks) {\n if (vnode.shapeFlag & 6 && vnode.component) {\n vnode.transition = hooks;\n const subTree = vnode.component.subTree;\n setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);\n } else if (vnode.shapeFlag & 128) {\n vnode.ssContent.transition = hooks.clone(vnode.ssContent);\n vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);\n } else {\n vnode.transition = hooks;\n if (vnode.type === Fragment && isArray(vnode.children)) {\n const child = filterSingleRoot(vnode.children, false);\n if (child) setTransitionHooks(child, hooks);\n }\n }\n }\n getGlobalThis().requestIdleCallback;\n getGlobalThis().cancelIdleCallback;\n const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;\n const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for(\"v-ndc\");\n const getPublicInstance = (i) => {\n if (!i) return null;\n if (isStatefulComponent(i)) return getComponentPublicInstance(i);\n return getPublicInstance(i.parent);\n };\n const resolveDevRootEl = (vnode) => {\n let found = false;\n while (true) {\n if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {\n const root = filterSingleRoot(vnode.children);\n if (!root) return;\n vnode = root;\n found = true;\n continue;\n }\n const component = vnode.component;\n if (component && component.subTree) {\n vnode = component.subTree;\n continue;\n }\n const suspense = vnode.suspense;\n if (suspense && suspense.activeBranch) {\n vnode = suspense.activeBranch;\n continue;\n }\n return found ? vnode.el : void 0;\n }\n };\n const getDevRootFragmentEl = (i) => {\n const el = i.subTree && resolveDevRootEl(i.subTree);\n return el === void 0 ? i.vnode.el : el;\n };\n const publicPropertiesMap = /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {\n $: (i) => i,\n $el: (i) => !!(process.env.NODE_ENV !== \"production\") ? getDevRootFragmentEl(i) : i.vnode.el,\n $data: (i) => i.data,\n $props: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.props) : i.props,\n $attrs: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.attrs) : i.attrs,\n $slots: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.slots) : i.slots,\n $refs: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.refs) : i.refs,\n $parent: (i) => getPublicInstance(i.parent),\n $root: (i) => getPublicInstance(i.root),\n $host: (i) => i.ce,\n $emit: (i) => i.emit,\n $options: (i) => resolveMergedOptions(i),\n $forceUpdate: (i) => i.f || (i.f = () => {\n queueJob(i.update);\n }),\n $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),\n $watch: (i) => instanceWatch.bind(i)\n });\n const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);\n const PublicInstanceProxyHandlers = {\n get({ _: instance }, key) {\n if (key === \"__v_skip\") return true;\n const { ctx, setupState, data, props, accessCache, type, appContext } = instance;\n if (!!(process.env.NODE_ENV !== \"production\") && key === \"__isVue\") return true;\n if (key[0] !== \"$\") {\n const n = accessCache[key];\n if (n !== void 0) switch (n) {\n case 1: return setupState[key];\n case 2: return data[key];\n case 4: return ctx[key];\n case 3: return props[key];\n }\n else if (hasSetupBinding(setupState, key)) {\n accessCache[key] = 1;\n return setupState[key];\n } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {\n accessCache[key] = 2;\n return data[key];\n } else if (hasOwn(props, key)) {\n accessCache[key] = 3;\n return props[key];\n } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4;\n return ctx[key];\n } else if (shouldCacheAccess) accessCache[key] = 0;\n }\n const publicGetter = publicPropertiesMap[key];\n let cssModule, globalProperties;\n if (publicGetter) {\n if (key === \"$attrs\") {\n track(instance.attrs, \"get\", \"\");\n process.env.NODE_ENV;\n } else if (!!(process.env.NODE_ENV !== \"production\") && key === \"$slots\") track(instance, \"get\", key);\n return publicGetter(instance);\n } else if ((cssModule = type.__cssModules) && (cssModule = cssModule[key])) return cssModule;\n else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4;\n return ctx[key];\n } else if (globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) return globalProperties[key];\n else if (!!(process.env.NODE_ENV !== \"production\") && currentRenderingInstance);\n },\n set({ _: instance }, key, value) {\n const { data, setupState, ctx } = instance;\n if (hasSetupBinding(setupState, key)) {\n setupState[key] = value;\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\") && setupState.__isScriptSetup && hasOwn(setupState, key)) {\n warn$1(`Cannot mutate <script setup> binding \"${key}\" from Options API.`);\n return false;\n } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {\n data[key] = value;\n return true;\n } else if (hasOwn(instance.props, key)) {\n process.env.NODE_ENV !== \"production\" && warn$1(`Attempting to mutate prop \"${key}\". Props are readonly.`);\n return false;\n }\n if (key[0] === \"$\" && key.slice(1) in instance) {\n process.env.NODE_ENV !== \"production\" && warn$1(`Attempting to mutate public property \"${key}\". Properties starting with $ are reserved and readonly.`);\n return false;\n } else if (!!(process.env.NODE_ENV !== \"production\") && key in instance.appContext.config.globalProperties) Object.defineProperty(ctx, key, {\n enumerable: true,\n configurable: true,\n value\n });\n else ctx[key] = value;\n return true;\n },\n has({ _: { data, setupState, accessCache, ctx, appContext, props, type } }, key) {\n let cssModules;\n return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== \"$\" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);\n },\n defineProperty(target, key, descriptor) {\n if (descriptor.get != null) target._.accessCache[key] = 0;\n else if (hasOwn(descriptor, \"value\")) this.set(target, key, descriptor.value, null);\n return Reflect.defineProperty(target, key, descriptor);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\") && true) PublicInstanceProxyHandlers.ownKeys = (target) => {\n warn$1(`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`);\n return Reflect.ownKeys(target);\n };\n function normalizePropsOrEmits(props) {\n return isArray(props) ? props.reduce((normalized, p) => (normalized[p] = null, normalized), {}) : props;\n }\n let shouldCacheAccess = true;\n function resolveMergedOptions(instance) {\n const base = instance.type;\n const { mixins, extends: extendsOptions } = base;\n const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;\n const cached = cache.get(base);\n let resolved;\n if (cached) resolved = cached;\n else if (!globalMixins.length && !mixins && !extendsOptions) resolved = base;\n else {\n resolved = {};\n if (globalMixins.length) globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));\n mergeOptions(resolved, base, optionMergeStrategies);\n }\n if (isObject(base)) cache.set(base, resolved);\n return resolved;\n }\n function mergeOptions(to, from, strats, asMixin = false) {\n const { mixins, extends: extendsOptions } = from;\n if (extendsOptions) mergeOptions(to, extendsOptions, strats, true);\n if (mixins) mixins.forEach((m) => mergeOptions(to, m, strats, true));\n for (const key in from) if (asMixin && key === \"expose\") process.env.NODE_ENV !== \"production\" && warn$1(`\"expose\" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`);\n else {\n const strat = internalOptionMergeStrats[key] || strats && strats[key];\n to[key] = strat ? strat(to[key], from[key]) : from[key];\n }\n return to;\n }\n const internalOptionMergeStrats = {\n data: mergeDataFn,\n props: mergeEmitsOrPropsOptions,\n emits: mergeEmitsOrPropsOptions,\n methods: mergeObjectOptions,\n computed: mergeObjectOptions,\n beforeCreate: mergeAsArray,\n created: mergeAsArray,\n beforeMount: mergeAsArray,\n mounted: mergeAsArray,\n beforeUpdate: mergeAsArray,\n updated: mergeAsArray,\n beforeDestroy: mergeAsArray,\n beforeUnmount: mergeAsArray,\n destroyed: mergeAsArray,\n unmounted: mergeAsArray,\n activated: mergeAsArray,\n deactivated: mergeAsArray,\n errorCaptured: mergeAsArray,\n serverPrefetch: mergeAsArray,\n components: mergeObjectOptions,\n directives: mergeObjectOptions,\n watch: mergeWatchOptions,\n provide: mergeDataFn,\n inject: mergeInject\n };\n function mergeDataFn(to, from) {\n if (!from) return to;\n if (!to) return from;\n return function mergedDataFn() {\n return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);\n };\n }\n function mergeInject(to, from) {\n return mergeObjectOptions(normalizeInject(to), normalizeInject(from));\n }\n function normalizeInject(raw) {\n if (isArray(raw)) {\n const res = {};\n for (let i = 0; i < raw.length; i++) res[raw[i]] = raw[i];\n return res;\n }\n return raw;\n }\n function mergeAsArray(to, from) {\n return to ? [...new Set([].concat(to, from))] : from;\n }\n function mergeObjectOptions(to, from) {\n return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;\n }\n function mergeEmitsOrPropsOptions(to, from) {\n if (to) {\n if (isArray(to) && isArray(from)) return [.../* @__PURE__ */ new Set([...to, ...from])];\n return extend(/* @__PURE__ */ Object.create(null), normalizePropsOrEmits(to), normalizePropsOrEmits(from != null ? from : {}));\n } else return from;\n }\n function mergeWatchOptions(to, from) {\n if (!to) return from;\n if (!from) return to;\n const merged = extend(/* @__PURE__ */ Object.create(null), to);\n for (const key in from) merged[key] = mergeAsArray(to[key], from[key]);\n return merged;\n }\n let currentApp = null;\n function filterSingleRoot(children, recurse = true) {\n let singleRoot;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (isVNode(child)) {\n if (child.type !== Comment || child.children === \"v-if\") {\n if (singleRoot) return;\n else {\n singleRoot = child;\n if (!!(process.env.NODE_ENV !== \"production\") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) return filterSingleRoot(singleRoot.children);\n }\n }\n } else return;\n }\n return singleRoot;\n }\n const internalObjectProto = {};\n const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;\n const queuePostRenderEffect = queueEffectWithSuspense;\n const isSuspense = (type) => type.__isSuspense;\n function queueEffectWithSuspense(fn, suspense) {\n if (suspense && suspense.pendingBranch) {\n if (isArray(fn)) suspense.effects.push(...fn);\n else suspense.effects.push(fn);\n } else queuePostFlushCb(fn);\n }\n const Fragment = /* @__PURE__ */ Symbol.for(\"v-fgt\");\n const Text = /* @__PURE__ */ Symbol.for(\"v-txt\");\n const Comment = /* @__PURE__ */ Symbol.for(\"v-cmt\");\n function isVNode(value) {\n return value ? value.__v_isVNode === true : false;\n }\n const createVNodeWithArgsTransform = (...args) => {\n return _createVNode(...args);\n };\n const normalizeKey = ({ key }) => key != null ? key : null;\n const normalizeRef = ({ ref, ref_key, ref_for }) => {\n if (typeof ref === \"number\") ref = \"\" + ref;\n return ref != null ? isString(ref) || /* @__PURE__ */ isRef(ref) || isFunction(ref) ? {\n i: currentRenderingInstance,\n r: ref,\n k: ref_key,\n f: !!ref_for\n } : ref : null;\n };\n function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {\n const vnode = {\n __v_isVNode: true,\n __v_skip: true,\n type,\n props,\n key: props && normalizeKey(props),\n ref: props && normalizeRef(props),\n scopeId: currentScopeId,\n slotScopeIds: null,\n children,\n component: null,\n suspense: null,\n ssContent: null,\n ssFallback: null,\n dirs: null,\n transition: null,\n el: null,\n anchor: null,\n target: null,\n targetStart: null,\n targetAnchor: null,\n staticCount: 0,\n shapeFlag,\n patchFlag,\n dynamicProps,\n dynamicChildren: null,\n appContext: null,\n ctx: currentRenderingInstance\n };\n if (needFullChildrenNormalization) {\n normalizeChildren(vnode, children);\n if (shapeFlag & 128) type.normalize(vnode);\n } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;\n if (!!(process.env.NODE_ENV !== \"production\") && vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);\n if (!!(process.env.NODE_ENV !== \"production\") && props && vnode.shapeFlag & 1) {\n const overwritingProp = props.innerHTML != null ? \"innerHTML\" : props.textContent != null ? \"textContent\" : null;\n if (overwritingProp && hasContentChildren(vnode.children)) warn$1(`The \\`${overwritingProp}\\` prop on <${vnode.type}> will override its children. Remove either the \\`${overwritingProp}\\` prop or the children.`);\n }\n return vnode;\n }\n function hasContentChildren(children) {\n if (isString(children)) return children !== \"\";\n if (isArray(children)) return children.length > 0;\n return false;\n }\n const createVNode = !!(process.env.NODE_ENV !== \"production\") ? createVNodeWithArgsTransform : _createVNode;\n function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {\n if (!type || type === NULL_DYNAMIC_COMPONENT) {\n if (!!(process.env.NODE_ENV !== \"production\") && !type) warn$1(`Invalid vnode type when creating vnode: ${type}.`);\n type = Comment;\n }\n if (isVNode(type)) {\n const cloned = cloneVNode(type, props, true);\n if (children) normalizeChildren(cloned, children);\n cloned.patchFlag = -2;\n return cloned;\n }\n if (isClassComponent(type)) type = type.__vccOpts;\n if (props) {\n props = guardReactiveProps(props);\n let { class: klass, style } = props;\n if (klass && !isString(klass)) props.class = normalizeClass(klass);\n if (isObject(style)) {\n if (/* @__PURE__ */ isProxy(style) && !isArray(style)) style = extend({}, style);\n props.style = normalizeStyle(style);\n }\n }\n const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;\n if (!!(process.env.NODE_ENV !== \"production\") && shapeFlag & 4 && /* @__PURE__ */ isProxy(type)) {\n type = /* @__PURE__ */ toRaw(type);\n warn$1(`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \\`markRaw\\` or using \\`shallowRef\\` instead of \\`ref\\`.`, `\nComponent that was made reactive: `, type);\n }\n return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);\n }\n function guardReactiveProps(props) {\n if (!props) return null;\n return /* @__PURE__ */ isProxy(props) || isInternalObject(props) ? extend({}, props) : props;\n }\n function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {\n const { props, ref, patchFlag, children, transition } = vnode;\n const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;\n const cloned = {\n __v_isVNode: true,\n __v_skip: true,\n type: vnode.type,\n props: mergedProps,\n key: mergedProps && normalizeKey(mergedProps),\n ref: extraProps && extraProps.ref ? mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,\n scopeId: vnode.scopeId,\n slotScopeIds: vnode.slotScopeIds,\n children: !!(process.env.NODE_ENV !== \"production\") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,\n target: vnode.target,\n targetStart: vnode.targetStart,\n targetAnchor: vnode.targetAnchor,\n staticCount: vnode.staticCount,\n shapeFlag: vnode.shapeFlag,\n patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,\n dynamicProps: vnode.dynamicProps,\n dynamicChildren: vnode.dynamicChildren,\n appContext: vnode.appContext,\n dirs: vnode.dirs,\n transition,\n component: vnode.component,\n suspense: vnode.suspense,\n ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),\n ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),\n placeholder: vnode.placeholder,\n el: vnode.el,\n anchor: vnode.anchor,\n ctx: vnode.ctx,\n ce: vnode.ce,\n cacheIndex: vnode.cacheIndex\n };\n if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));\n return cloned;\n }\n function deepCloneVNode(vnode) {\n const cloned = cloneVNode(vnode);\n if (isArray(vnode.children)) cloned.children = vnode.children.map(deepCloneVNode);\n return cloned;\n }\n function createTextVNode(text = \" \", flag = 0) {\n return createVNode(Text, null, text, flag);\n }\n function normalizeChildren(vnode, children) {\n let type = 0;\n const { shapeFlag } = vnode;\n if (children == null) children = null;\n else if (isArray(children)) type = 16;\n else if (typeof children === \"object\") {\n if (shapeFlag & 65) {\n const slot = children.default;\n if (slot) {\n slot._c && (slot._d = false);\n normalizeChildren(vnode, slot());\n slot._c && (slot._d = true);\n }\n return;\n } else {\n type = 32;\n if (!children._ && !isInternalObject(children)) children._ctx = currentRenderingInstance;\n }\n } else if (isFunction(children)) {\n if (shapeFlag & 65) {\n normalizeChildren(vnode, { default: children });\n return;\n }\n children = {\n default: children,\n _ctx: currentRenderingInstance\n };\n type = 32;\n } else {\n children = String(children);\n if (shapeFlag & 64) {\n type = 16;\n children = [createTextVNode(children)];\n } else type = 8;\n }\n vnode.children = children;\n vnode.shapeFlag |= type;\n }\n function mergeProps(...args) {\n const ret = {};\n for (let i = 0; i < args.length; i++) {\n const toMerge = args[i];\n for (const key in toMerge) if (key === \"class\") {\n if (ret.class !== toMerge.class) ret.class = normalizeClass([ret.class, toMerge.class]);\n } else if (key === \"style\") ret.style = normalizeStyle([ret.style, toMerge.style]);\n else if (isOn(key)) {\n const existing = ret[key];\n const incoming = toMerge[key];\n if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;\n else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;\n } else if (key !== \"\") ret[key] = toMerge[key];\n }\n return ret;\n }\n let currentInstance = null;\n const getCurrentInstance = () => currentInstance || currentRenderingInstance;\n let internalSetCurrentInstance;\n {\n const g = getGlobalThis();\n const registerGlobalSetter = (key, setter) => {\n let setters;\n if (!(setters = g[key])) setters = g[key] = [];\n setters.push(setter);\n return (v) => {\n if (setters.length > 1) setters.forEach((set) => set(v));\n else setters[0](v);\n };\n };\n internalSetCurrentInstance = registerGlobalSetter(`__VUE_INSTANCE_SETTERS__`, (v) => currentInstance = v);\n registerGlobalSetter(`__VUE_SSR_SETTERS__`, (v) => isInSSRComponentSetup = v);\n }\n const setCurrentInstance = (instance) => {\n const prev = currentInstance;\n internalSetCurrentInstance(instance);\n instance.scope.on();\n return () => {\n instance.scope.off();\n internalSetCurrentInstance(prev);\n };\n };\n function isStatefulComponent(instance) {\n return instance.vnode.shapeFlag & 4;\n }\n let isInSSRComponentSetup = false;\n process.env.NODE_ENV;\n function getComponentPublicInstance(instance) {\n if (instance.exposed) return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {\n get(target, key) {\n if (key in target) return target[key];\n else if (key in publicPropertiesMap) return publicPropertiesMap[key](instance);\n },\n has(target, key) {\n return key in target || key in publicPropertiesMap;\n }\n }));\n else return instance.proxy;\n }\n const classifyRE = /(?:^|[-_])\\w/g;\n const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, \"\");\n function getComponentName(Component, includeInferred = true) {\n return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;\n }\n function formatComponentName(instance, Component, isRoot = false) {\n let name = getComponentName(Component);\n if (!name && Component.__file) {\n const match = Component.__file.match(/([^/\\\\]+)\\.\\w+$/);\n if (match) name = match[1];\n }\n if (!name && instance) {\n const inferFromRegistry = (registry) => {\n for (const key in registry) if (registry[key] === Component) return key;\n };\n name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(instance.parent.type.components) || inferFromRegistry(instance.appContext.components);\n }\n return name ? classify(name) : isRoot ? `App` : `Anonymous`;\n }\n function isClassComponent(value) {\n return isFunction(value) && \"__vccOpts\" in value;\n }\n function initCustomFormatter() {\n if (!!!(process.env.NODE_ENV !== \"production\") || typeof window === \"undefined\") return;\n const vueStyle = { style: \"color:#3ba776\" };\n const numberStyle = { style: \"color:#1677ff\" };\n const stringStyle = { style: \"color:#f5222d\" };\n const keywordStyle = { style: \"color:#eb2f96\" };\n const formatter = {\n __vue_custom_formatter: true,\n header(obj) {\n if (!isObject(obj)) return null;\n if (obj.__isVue) return [\n \"div\",\n vueStyle,\n `VueInstance`\n ];\n else if (/* @__PURE__ */ isRef(obj)) {\n pauseTracking();\n const value = obj.value;\n resetTracking();\n return [\n \"div\",\n {},\n [\n \"span\",\n vueStyle,\n genRefFlag(obj)\n ],\n \"<\",\n formatValue(value),\n `>`\n ];\n } else if (/* @__PURE__ */ isReactive(obj)) return [\n \"div\",\n {},\n [\n \"span\",\n vueStyle,\n /* @__PURE__ */ isShallow(obj) ? \"ShallowReactive\" : \"Reactive\"\n ],\n \"<\",\n formatValue(obj),\n `>${/* @__PURE__ */ isReadonly(obj) ? ` (readonly)` : ``}`\n ];\n else if (/* @__PURE__ */ isReadonly(obj)) return [\n \"div\",\n {},\n [\n \"span\",\n vueStyle,\n /* @__PURE__ */ isShallow(obj) ? \"ShallowReadonly\" : \"Readonly\"\n ],\n \"<\",\n formatValue(obj),\n \">\"\n ];\n return null;\n },\n hasBody(obj) {\n return obj && obj.__isVue;\n },\n body(obj) {\n if (obj && obj.__isVue) return [\n \"div\",\n {},\n ...formatInstance(obj.$)\n ];\n }\n };\n function formatInstance(instance) {\n const blocks = [];\n if (instance.type.props && instance.props) blocks.push(createInstanceBlock(\"props\", /* @__PURE__ */ toRaw(instance.props)));\n if (instance.setupState !== EMPTY_OBJ) blocks.push(createInstanceBlock(\"setup\", instance.setupState));\n if (instance.data !== EMPTY_OBJ) blocks.push(createInstanceBlock(\"data\", /* @__PURE__ */ toRaw(instance.data)));\n const computed = extractKeys(instance, \"computed\");\n if (computed) blocks.push(createInstanceBlock(\"computed\", computed));\n const injected = extractKeys(instance, \"inject\");\n if (injected) blocks.push(createInstanceBlock(\"injected\", injected));\n blocks.push([\n \"div\",\n {},\n [\n \"span\",\n { style: keywordStyle.style + \";opacity:0.66\" },\n \"$ (internal): \"\n ],\n [\"object\", { object: instance }]\n ]);\n return blocks;\n }\n function createInstanceBlock(type, target) {\n target = extend({}, target);\n if (!Object.keys(target).length) return [\"span\", {}];\n return [\n \"div\",\n { style: \"line-height:1.25em;margin-bottom:0.6em\" },\n [\n \"div\",\n { style: \"color:#476582\" },\n type\n ],\n [\n \"div\",\n { style: \"padding-left:1.25em\" },\n ...Object.keys(target).map((key) => {\n return [\n \"div\",\n {},\n [\n \"span\",\n keywordStyle,\n key + \": \"\n ],\n formatValue(target[key], false)\n ];\n })\n ]\n ];\n }\n function formatValue(v, asRaw = true) {\n if (typeof v === \"number\") return [\n \"span\",\n numberStyle,\n v\n ];\n else if (typeof v === \"string\") return [\n \"span\",\n stringStyle,\n JSON.stringify(v)\n ];\n else if (typeof v === \"boolean\") return [\n \"span\",\n keywordStyle,\n v\n ];\n else if (isObject(v)) return [\"object\", { object: asRaw ? /* @__PURE__ */ toRaw(v) : v }];\n else return [\n \"span\",\n stringStyle,\n String(v)\n ];\n }\n function extractKeys(instance, type) {\n const Comp = instance.type;\n if (isFunction(Comp)) return;\n const extracted = {};\n for (const key in instance.ctx) if (isKeyOfType(Comp, key, type)) extracted[key] = instance.ctx[key];\n return extracted;\n }\n function isKeyOfType(Comp, key, type) {\n const opts = Comp[type];\n if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) return true;\n if (Comp.extends && isKeyOfType(Comp.extends, key, type)) return true;\n if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) return true;\n }\n function genRefFlag(v) {\n if (/* @__PURE__ */ isShallow(v)) return `ShallowRef`;\n if (v.effect) return `ComputedRef`;\n return `Ref`;\n }\n if (window.devtoolsFormatters) window.devtoolsFormatters.push(formatter);\n else window.devtoolsFormatters = [formatter];\n }\n process.env.NODE_ENV;\n process.env.NODE_ENV;\n process.env.NODE_ENV;\n // ../../node_modules/.bun/vue@3.5.44+7524df1edfed9f02/node_modules/vue/dist/vue.runtime.esm-bundler.js\n /**\n * vue v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n function initDev() {\n initCustomFormatter();\n }\n if (!!(process.env.NODE_ENV !== \"production\")) initDev();\n // src/core/text.ts\n /**\n * The document text: an immutable, balanced tree of lines.\n *\n * Leaves hold up to `LEAF_MAX` lines, branches up to `BRANCH_MAX` children,\n * and every node knows its length and line count, so finding a line by\n * number or by offset walks one path from the root: O(log n). An edit copies\n * only that path and shares everything else with the old text, so keeping\n * old versions around (undo, a `v-model:doc` snapshot) costs next to\n * nothing.\n *\n * Offsets count UTF-16 code units, like the browser and language servers.\n * Lines are numbered from 1 and are joined by one `\\n`; a `\\r\\n` or a lone\n * `\\r` in the input becomes `\\n`.\n */\n const LEAF_MAX = 64;\n const LEAF_MIN = 16;\n const BRANCH_MAX = 32;\n const BRANCH_MIN = 8;\n /** New leaves and branches start half full, so the next edits rarely split them. */\n const LEAF_FILL = 32;\n const BRANCH_FILL = 16;\n var Leaf = class {\n text;\n length;\n /** The longest line, in code units. */\n widest;\n constructor(text) {\n this.text = text;\n let length = text.length - 1;\n let widest = 0;\n for (const line of text) {\n length += line.length;\n if (line.length > widest) widest = line.length;\n }\n this.length = length;\n this.widest = widest;\n }\n get lines() {\n return this.text.length;\n }\n };\n var Branch = class {\n children;\n length;\n lines;\n widest;\n constructor(children) {\n this.children = children;\n let length = children.length - 1;\n let lines = 0;\n let widest = 0;\n for (const child of children) {\n length += child.length;\n lines += child.lines;\n if (child.widest > widest) widest = child.widest;\n }\n this.length = length;\n this.lines = lines;\n this.widest = widest;\n }\n };\n const isSmall = (node) => node instanceof Leaf ? node.text.length < LEAF_MIN : node.children.length < BRANCH_MIN;\n /** Cuts a list into nodes of about `fill` items each; never one smaller than half of it. */\n function chunk(items, fill, max, make) {\n if (items.length <= max) return [make(items)];\n const count = Math.ceil(items.length / fill);\n const size = Math.ceil(items.length / count);\n const out = [];\n for (let i = 0; i < items.length; i += size) out.push(make(items.slice(i, i + size)));\n return out;\n }\n const leaves = (lines) => chunk(lines, LEAF_FILL, LEAF_MAX, (part) => new Leaf(part));\n const branches = (nodes) => chunk(nodes, BRANCH_FILL, BRANCH_MAX, (part) => new Branch(part));\n /** Stacks nodes of one height into a single root. */\n function root(nodes) {\n while (nodes.length > 1) nodes = branches(nodes);\n let node = nodes[0] ?? new Leaf([\"\"]);\n while (node instanceof Branch && node.children.length === 1) node = node.children[0];\n return node;\n }\n /** Joins two neighbours of the same height and cuts the result again if it grew too big. */\n function merge(a, b) {\n if (a instanceof Leaf && b instanceof Leaf) return leaves([...a.text, ...b.text]);\n return branches([...a.children, ...b.children]);\n }\n /** Merges every small node into a neighbour, so the tree stays shallow after deletes. */\n function settle(nodes) {\n if (nodes.length < 2 || !nodes.some(isSmall)) return nodes;\n const out = [];\n for (const node of nodes) {\n const last = out[out.length - 1];\n if (last && (isSmall(last) || isSmall(node))) out.splice(-1, 1, ...merge(last, node));\n else out.push(node);\n }\n return out;\n }\n /**\n * Replaces `count` lines from line index `at` (from 0) with `insert`, and\n * returns the nodes that take this one's place, all of its height.\n */\n function splice(node, at, count, insert) {\n if (node instanceof Leaf) {\n const text = node.text.slice(0, at).concat(insert, node.text.slice(at + count));\n return text.length ? leaves(text) : [];\n }\n const children = [];\n let start = 0;\n let pending = insert;\n const last = node.children.length - 1;\n node.children.forEach((child, i) => {\n const end = start + child.lines;\n const holds = at < end || i === last && at === end;\n const overlaps = count > 0 && at < end && at + count > start;\n if (pending && holds && at >= start || overlaps) {\n const from = Math.max(at - start, 0);\n const to = Math.min(at + count - start, child.lines);\n children.push(...splice(child, from, Math.max(to - from, 0), pending ?? []));\n pending = null;\n } else children.push(child);\n start = end;\n });\n const settled = settle(children);\n if (!settled.length) return [];\n return branches(settled);\n }\n /**\n * Each node's text, kept once asked for. Nodes never change and an edit\n * makes new ones only along one path, so joining the whole text again\n * after an edit only joins that path: the engine strings together the\n * kept parts without copying them.\n */\n const joined = /* @__PURE__ */ new WeakMap();\n function joinNode(node) {\n let text = joined.get(node);\n if (text !== void 0) return text;\n if (node instanceof Leaf) text = node.text.join(\"\\n\");\n else {\n text = joinNode(node.children[0]);\n for (let i = 1; i < node.children.length; i++) text += \"\\n\" + joinNode(node.children[i]);\n }\n joined.set(node, text);\n return text;\n }\n /** Collects the text of lines `from`–`to` (indices from 0, `to` exclusive). */\n function collect(node, from, to, out) {\n if (node instanceof Leaf) {\n for (let i = from; i < to; i++) out.push(node.text[i]);\n return;\n }\n let start = 0;\n for (const child of node.children) {\n const end = start + child.lines;\n if (end > from && start < to) collect(child, Math.max(from - start, 0), Math.min(to - start, child.lines), out);\n if (end >= to) return;\n start = end;\n }\n }\n /** Splits text into lines, reading `\\r\\n` and a lone `\\r` as line breaks too. */\n function splitLines(text) {\n return text.split(/\\r\\n?|\\n/);\n }\n /** Where a text keeps its tree; a symbol rather than a private field, so a `ref` around a text keeps its type. */\n const NODE = Symbol(\"node\");\n var CodeText = class CodeText {\n /** @internal */\n [NODE];\n constructor(node) {\n this[NODE] = node;\n markRaw(this);\n }\n /** The text of a string. */\n static of(text) {\n const lines = typeof text === \"string\" ? splitLines(text) : text.length ? text : [\"\"];\n const parts = leaves(lines);\n if (typeof text === \"string\" && !text.includes(\"\\r\")) {\n let at = 0;\n for (const leaf of parts) {\n joined.set(leaf, text.slice(at, at + leaf.length));\n at += leaf.length + 1;\n }\n }\n return new CodeText(root(parts));\n }\n /** An empty text: one empty line. */\n static empty = CodeText.of(\"\");\n /** Length in UTF-16 code units, counting one per line break. */\n get length() {\n return this[NODE].length;\n }\n /** The number of lines, at least 1. */\n get lines() {\n return this[NODE].lines;\n }\n /** The length of the longest line, in code units. */\n get widest() {\n return this[NODE].widest;\n }\n /** Line `n`, counting from 1. */\n line(n) {\n if (n < 1 || n > this.lines) throw new RangeError(`[@dou-ui/code] line ${n} is outside 1–${this.lines}`);\n let node = this[NODE];\n let index = n - 1;\n let from = 0;\n while (node instanceof Branch) for (const child of node.children) {\n if (index < child.lines) {\n node = child;\n break;\n }\n index -= child.lines;\n from += child.length + 1;\n }\n for (let i = 0; i < index; i++) from += node.text[i].length + 1;\n const text = node.text[index];\n return {\n number: n,\n from,\n to: from + text.length,\n text\n };\n }\n /** The text of line `n` (from 1); quicker than `line(n).text`, which also finds where it starts. */\n lineText(n) {\n if (n < 1 || n > this.lines) throw new RangeError(`[@dou-ui/code] line ${n} is outside 1–${this.lines}`);\n let node = this[NODE];\n let index = n - 1;\n while (node instanceof Branch) for (const child of node.children) {\n if (index < child.lines) {\n node = child;\n break;\n }\n index -= child.lines;\n }\n return node.text[index];\n }\n /** The line that holds offset `pos`; a line break belongs to the line before it. */\n lineAt(pos) {\n if (pos < 0 || pos > this.length) throw new RangeError(`[@dou-ui/code] offset ${pos} is outside 0–${this.length}`);\n let node = this[NODE];\n let from = 0;\n let number = 1;\n while (node instanceof Branch) for (const child of node.children) {\n const end = from + child.length;\n if (pos <= end) {\n node = child;\n break;\n }\n from = end + 1;\n number += child.lines;\n }\n for (const text of node.text) {\n const end = from + text.length;\n if (pos <= end) return {\n number,\n from,\n to: end,\n text\n };\n from = end + 1;\n number++;\n }\n throw new RangeError(`[@dou-ui/code] offset ${pos} not found`);\n }\n /** The text of lines `from`–`to`, both counted from 1 and included. */\n lineTexts(from, to = from) {\n const out = [];\n from = Math.max(from, 1);\n to = Math.min(to, this.lines);\n if (from <= to) collect(this[NODE], from - 1, to, out);\n return out;\n }\n /** The text between two offsets. */\n slice(from = 0, to = this.length) {\n from = Math.max(0, from);\n to = Math.min(this.length, to);\n if (from >= to) return \"\";\n const start = this.lineAt(from);\n if (to <= start.to) return start.text.slice(from - start.from, to - start.from);\n const end = this.lineAt(to);\n const lines = this.lineTexts(start.number, end.number);\n lines[0] = lines[0].slice(from - start.from);\n lines[lines.length - 1] = lines[lines.length - 1].slice(0, to - end.from);\n return lines.join(\"\\n\");\n }\n /** A new text with `from`–`to` replaced by `insert`; this one stays as it is. */\n replace(from, to, insert) {\n if (from < 0 || to > this.length || from > to) throw new RangeError(`[@dou-ui/code] range ${from}–${to} is outside 0–${this.length}`);\n const lines = typeof insert === \"string\" ? splitLines(insert) : insert;\n if (from === to && lines.length === 1 && !lines[0]) return this;\n const start = this.lineAt(from);\n const end = to <= start.to ? start : this.lineAt(to);\n const head = start.text.slice(0, from - start.from);\n const tail = end.text.slice(to - end.from);\n const next = lines.slice();\n next[0] = head + next[0];\n next[next.length - 1] += tail;\n const nodes = splice(this[NODE], start.number - 1, end.number - start.number + 1, next);\n return new CodeText(root(nodes));\n }\n /** Every line, from 1 to the end. */\n toLines() {\n return this.lineTexts(1, this.lines);\n }\n /** The whole text, with `\\n` between lines. */\n toString() {\n return joinNode(this[NODE]);\n }\n /** Whether two texts hold the same characters. */\n eq(other) {\n if (other === this) return true;\n if (other.length !== this.length || other.lines !== this.lines) return false;\n const a = this.toLines();\n const b = other.toLines();\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n }\n };\n // src/language/stream.ts\n /**\n * A cursor over one line, handed to a language's `token` function. The\n * function reads one token from `pos` onward (at least one character) and\n * returns its kind; whatever it read becomes that token.\n */\n var CodeStream = class {\n string;\n tabSize;\n /** Where the current token starts. */\n start = 0;\n /** Where reading continues. */\n pos = 0;\n /** Where this stream ends; a nesting language ends it early, e.g. at `<\\/script>`. */\n end;\n constructor(string, tabSize = 2) {\n this.string = string;\n this.tabSize = tabSize;\n this.end = string.length;\n }\n /** Whether the line is read to its end. */\n eol() {\n return this.pos >= this.end;\n }\n /** Whether the stream is at the line's first character that isn't whitespace. */\n sol() {\n for (let i = this.pos - 1; i >= 0; i--) {\n const code = this.string.charCodeAt(i);\n if (code === 32 || code >= 9 && code <= 13) continue;\n if (code < 128 || !SPACE.test(this.string[i])) return false;\n }\n return true;\n }\n /** The next character, without reading it. */\n peek() {\n return this.pos < this.end ? this.string[this.pos] : void 0;\n }\n /** Reads and returns the next character. */\n next() {\n return this.pos < this.end ? this.string[this.pos++] : void 0;\n }\n /** Reads the next character if it is `match` (a character, a set as a regex, or a test). */\n eat(match) {\n const ch = this.peek();\n if (ch === void 0) return void 0;\n if (!(typeof match === \"string\" ? ch === match : match instanceof RegExp ? match.test(ch) : match(ch))) return void 0;\n this.pos++;\n return ch;\n }\n /** Reads characters while they match; returns whether it read any. */\n eatWhile(match) {\n const from = this.pos;\n while (this.eat(match) !== void 0);\n return this.pos > from;\n }\n /** Reads whitespace. */\n eatSpace() {\n return this.eatWhile(isSpace);\n }\n /** Reads to the end of the stream. */\n skipToEnd() {\n this.pos = this.end;\n }\n /** Reads up to (not including) the next `text`; returns whether it was found. */\n skipTo(text) {\n const at = this.string.indexOf(text, this.pos);\n if (at < 0 || at >= this.end) return false;\n this.pos = at;\n return true;\n }\n match(pattern, consume = true, caseInsensitive = false) {\n if (typeof pattern === \"string\") {\n if (this.pos + pattern.length > this.end) return false;\n const ok = caseInsensitive ? this.string.slice(this.pos, this.pos + pattern.length).toLowerCase() === pattern.toLowerCase() : this.string.startsWith(pattern, this.pos);\n if (ok && consume) this.pos += pattern.length;\n return ok;\n }\n const rest = this.pos || this.end < this.string.length ? this.string.slice(this.pos, this.end) : this.string;\n if (pattern.global || pattern.sticky) pattern.lastIndex = 0;\n let found = pattern.exec(rest);\n if (pattern.global || pattern.sticky) pattern.lastIndex = 0;\n if (found && found.index !== 0) found = null;\n if (!found) return null;\n if (consume) this.pos += found[0].length;\n return found;\n }\n /** Steps back `n` characters. */\n backUp(n) {\n this.pos -= n;\n }\n /** The text of the current token so far. */\n current() {\n return this.string.slice(this.start, this.pos);\n }\n /** The line's indentation in columns. */\n indentation() {\n let col = 0;\n for (const ch of this.string) if (ch === \" \") col++;\n else if (ch === \" \") col = (Math.floor(col / this.tabSize) + 1) * this.tabSize;\n else break;\n return col;\n }\n /** The text after the stream, to the line's end (also past `end`). */\n rest() {\n return this.string.slice(this.pos);\n }\n };\n const SPACE = /\\s/;\n const isSpace = (ch) => ch === \" \" || ch === \" \";\n // src/language/language.ts\n /** Every token kind, in a fixed order; tokens are stored by their index here. */\n const tokenTypes = [\n \"keyword\",\n \"string\",\n \"number\",\n \"comment\",\n \"function\",\n \"type\",\n \"variable\",\n \"property\",\n \"operator\",\n \"punctuation\",\n \"tag\",\n \"attribute\",\n \"meta\",\n \"invalid\",\n \"heading\",\n \"strong\",\n \"emphasis\",\n \"link\"\n ];\n /** Lines longer than this are not read. */\n const MAX_LINE = 1e4;\n const typeIndex = new Map(tokenTypes.map((type, i) => [type, i]));\n const isPlain = (value) => typeof value === \"object\" && value !== null && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n /** Copies arrays and plain objects; everything else (languages among them) is shared. */\n function copyPlain(value) {\n if (Array.isArray(value)) return value.map(copyPlain);\n if (isPlain(value)) {\n const out = {};\n for (const key in value) out[key] = copyPlain(value[key]);\n return out;\n }\n return value;\n }\n /** Compares arrays and plain objects by their content; everything else by identity. */\n function samePlain(a, b) {\n if (a === b) return true;\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (!samePlain(a[i], b[i])) return false;\n return true;\n }\n if (isPlain(a) && isPlain(b)) {\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n for (const key of keys) if (!samePlain(a[key], b[key])) return false;\n return true;\n }\n return false;\n }\n /**\n * Defines a language from a tokenizer that reads one line at a time.\n *\n * ```ts\n * const ini = defineCodeLanguage({\n * name: 'ini',\n * token(stream) {\n * if (stream.sol() && stream.match(/^\\s*[;#].*$/)) return 'comment'\n * if (stream.sol() && stream.match(/^\\s*\\[[^\\]]*\\]/)) return 'keyword'\n * if (stream.match(/^[\\w.-]+(?=\\s*=)/)) return 'property'\n * stream.next()\n * return null\n * },\n * })\n * ```\n */\n function defineCodeLanguage(spec) {\n const brackets = spec.brackets ?? \"()[]{}\";\n let openers = \"\";\n for (let i = 0; i < brackets.length; i += 2) openers += brackets[i];\n return markRaw({\n name: spec.name,\n aliases: spec.aliases ?? [],\n startState: spec.startState ?? (() => ({})),\n token: spec.token,\n blankLine: spec.blankLine,\n copyState: spec.copyState ?? copyPlain,\n sameState: spec.sameState ?? samePlain,\n comment: spec.comment ?? {},\n brackets,\n autoClose: spec.autoClose ?? openers + \"'\\\"\",\n indentAfter: spec.indentAfter,\n languageAt: spec.languageAt ?? (() => null),\n nested: spec.nested ?? []\n });\n }\n /** The language among `languages` named `name` or one of its aliases, ignoring case. */\n function languageFor(languages, name) {\n if (!name) return null;\n const key = name.trim().toLowerCase();\n return languages.find((language) => language.name.toLowerCase() === key || language.aliases.includes(key)) ?? null;\n }\n /** Reads one line from `state` (which it changes into the state after the line). */\n function tokenizeLine(language, text, state, tabSize = 2) {\n if (!text) {\n language.blankLine?.(state);\n return [];\n }\n if (text.length > MAX_LINE) return [];\n const out = [];\n const stream = new CodeStream(text, tabSize);\n let guard = 0;\n while (!stream.eol()) {\n stream.start = stream.pos;\n const type = language.token(stream, state);\n if (stream.pos <= stream.start) {\n stream.pos = stream.start + 1;\n push(out, stream.pos, -1);\n } else push(out, stream.pos, type ? typeIndex.get(type) ?? -1 : -1);\n if (++guard > 1e5) break;\n }\n return out;\n }\n function push(out, to, type) {\n if (out.length && out[out.length - 1] === type) out[out.length - 2] = to;\n else out.push(to, type);\n }\n // src/language/highlighter.ts\n /** Lines between the start states kept: a line read again costs at most this many. */\n const INTERVAL = 32;\n /** Lines whose tokens are kept; the rest are read again from a kept state when drawn. */\n const CACHE = 4e3;\n /**\n * Keeps the tokens of a text up to date as it changes.\n *\n * Reading goes down from the top. It keeps the state at the start of\n * every 32nd line read, and the tokens of the lines drawn lately; a line\n * whose tokens are gone is read again from the kept state above it. So a\n * text of a million lines, all read, holds some thirty thousand states\n * and a few thousand lines' tokens.\n *\n * After an edit, lines before it keep everything; reading resumes at the\n * edited line and stops as soon as a line after the edit starts in the\n * same state as before, because from there on nothing can differ. Typing\n * inside a function rereads one line; opening a comment rereads up to\n * where it closes.\n *\n * Lines are read only when asked for (the ones in view and those before\n * them); the rest wait for idle time, or come from a worker through\n * `adopt`, so opening a long file costs nothing up front.\n */\n var CodeHighlighter = class {\n language;\n doc;\n tabSize;\n interval;\n cacheSize;\n /** Kept start states: `lines[k]` starts in `states[k]`; the first is line 0. */\n lines = [0];\n states;\n /** Lines above this index are read; `tip` is the state line `read` starts in. */\n read = 0;\n tip;\n /**\n * What was read past an edit, moved to where those lines are now. Once\n * reading reaches one of these lines in the same state, everything up to\n * `oldEnd` (which starts in `oldTip`) is read again for free.\n */\n oldLines = [];\n oldStates = [];\n oldAt = 0;\n oldEnd = -1;\n oldTip;\n /** Where reading again from a kept state last got to, so going down line by line doesn't start over each time. */\n walk = null;\n /** Tokens by line index, oldest first. */\n cache = /* @__PURE__ */ new Map();\n constructor(language, doc, options = {}) {\n this.language = language;\n this.doc = doc;\n const opts = typeof options === \"number\" ? { tabSize: options } : options;\n this.tabSize = opts.tabSize ?? 2;\n this.interval = Math.max(1, opts.interval ?? INTERVAL);\n this.cacheSize = Math.max(1, opts.cache ?? CACHE);\n this.tip = language.startState();\n this.states = [this.tip];\n }\n /** How many lines from the top are read. */\n get frontier() {\n return this.read;\n }\n /** The text being read. */\n get text() {\n return this.doc;\n }\n /** Takes in a new text, made from the old one by `changes`. Without them, starts over. */\n update(doc, changes) {\n const old = this.doc;\n this.doc = doc;\n if (!changes || changes.empty) {\n if (!changes) this.reset();\n return;\n }\n const list = changes.changes;\n const first = list[0];\n const last = list[list.length - 1];\n const a = old.lineAt(first.from).number - 1;\n const b = old.lineAt(last.to).number - 1;\n const delta = doc.lineAt(changes.mapPos(last.to, 1)).number - 1 - b;\n for (const key of this.cache.keys()) if (key >= a) this.cache.delete(key);\n if (this.walk && this.walk.line > a) this.walk = null;\n const movedLines = [];\n const movedStates = [];\n let endLine = -1;\n let endTip;\n const move = (line, state) => {\n if (line > b) {\n movedLines.push(line + delta);\n movedStates.push(state);\n }\n };\n if (a < this.read) {\n if (b + 1 < this.read) {\n if (this.lines[this.keptAt(b + 1)] !== b + 1) move(b + 1, this.stateIn(old, b + 1));\n }\n for (let k = 0; k < this.lines.length; k++) move(this.lines[k], this.states[k]);\n if (this.read > b) {\n endLine = this.read + delta;\n endTip = this.tip;\n }\n const keep = this.keptAt(a) + 1;\n this.lines.length = keep;\n this.states.length = keep;\n this.read = this.lines[keep - 1];\n this.tip = this.states[keep - 1];\n } else if (this.oldEnd >= 0) {\n const lines = this.oldLines;\n if (this.oldAt < lines.length && lines[this.oldAt] <= a && a < this.oldEnd) for (let k = this.oldAt; k < lines.length && lines[k] <= a; k++) {\n movedLines.push(lines[k]);\n movedStates.push(this.oldStates[k]);\n }\n else {\n for (let k = this.oldAt; k < lines.length; k++) move(lines[k], this.oldStates[k]);\n if (this.oldEnd > b) {\n endLine = this.oldEnd + delta;\n endTip = this.oldTip;\n } else if (this.oldEnd <= a) {\n endLine = this.oldEnd;\n endTip = this.oldTip;\n }\n }\n } else return;\n if (endLine < 0 && movedLines.length) {\n endLine = movedLines.pop();\n endTip = movedStates.pop();\n }\n this.oldLines = movedLines;\n this.oldStates = movedStates;\n this.oldAt = 0;\n this.oldEnd = endLine > this.read && endLine <= doc.lines ? endLine : -1;\n this.oldTip = this.oldEnd >= 0 ? endTip : void 0;\n if (this.oldEnd < 0) this.dropOld();\n }\n reset() {\n this.tip = this.language.startState();\n this.lines = [0];\n this.states = [this.tip];\n this.read = 0;\n this.cache.clear();\n this.walk = null;\n this.dropOld();\n }\n dropOld() {\n this.oldLines = [];\n this.oldStates = [];\n this.oldAt = 0;\n this.oldEnd = -1;\n this.oldTip = void 0;\n }\n /** The index of the last kept state at or above line `i`. */\n keptAt(i) {\n let lo = 0;\n let hi = this.lines.length - 1;\n while (lo < hi) {\n const mid = lo + hi + 1 >> 1;\n if (this.lines[mid] <= i) lo = mid;\n else hi = mid - 1;\n }\n return lo;\n }\n /** Where to start reading line `i` again from: a kept state, or where the last such reading got to. */\n from(i) {\n const k = this.keptAt(i);\n const walk = this.walk;\n if (walk && walk.line <= i && walk.line >= this.lines[k]) return {\n line: walk.line,\n state: this.language.copyState(walk.state)\n };\n return {\n line: this.lines[k],\n state: this.language.copyState(this.states[k])\n };\n }\n /** The state line `i` starts in, read from the kept state above it in `doc`. */\n stateIn(doc, i) {\n if (doc !== this.doc) {\n const k = this.keptAt(i);\n const state = this.language.copyState(this.states[k]);\n for (let j = this.lines[k]; j < i; j++) tokenizeLine(this.language, doc.lineText(j + 1), state, this.tabSize);\n return state;\n }\n const start = this.from(i);\n const state = start.state;\n for (let j = start.line; j < i; j++) tokenizeLine(this.language, doc.lineText(j + 1), state, this.tabSize);\n this.walk = {\n line: i,\n state\n };\n return state;\n }\n remember(i, tokens) {\n this.cache.delete(i);\n this.cache.set(i, tokens);\n if (this.cache.size > this.cacheSize) this.cache.delete(this.cache.keys().next().value);\n }\n /** Reads the next unread line, keeping its tokens with `keep`. */\n step(keep) {\n const i = this.read;\n const state = this.language.copyState(this.tip);\n const tokens = tokenizeLine(this.language, this.doc.lineText(i + 1), state, this.tabSize);\n if (keep) this.remember(i, tokens);\n const next = i + 1;\n if (this.oldEnd >= 0) {\n const lines = this.oldLines;\n while (this.oldAt < lines.length && lines[this.oldAt] < next) this.oldAt++;\n if (next === this.oldEnd ? this.language.sameState(state, this.oldTip) : lines[this.oldAt] === next && this.language.sameState(state, this.oldStates[this.oldAt])) {\n if (next - this.lines[this.lines.length - 1] >= this.interval) {\n this.lines.push(next);\n this.states.push(state);\n }\n for (let k = this.oldAt; k < lines.length; k++) {\n if (lines[k] <= next) continue;\n this.lines.push(lines[k]);\n this.states.push(this.oldStates[k]);\n }\n this.read = this.oldEnd;\n this.tip = this.oldTip;\n this.dropOld();\n return;\n }\n if (next >= this.oldEnd) this.dropOld();\n }\n if (next - this.lines[this.lines.length - 1] >= this.interval) {\n this.lines.push(next);\n this.states.push(state);\n }\n this.read = next;\n this.tip = state;\n }\n /**\n * The tokens of line `n` (from 1), reading up to it if it takes no more\n * than `limit` lines; `null` when it would take more, so the caller\n * draws plain text and lets idle time catch up.\n */\n line(n, limit = Infinity) {\n const i = n - 1;\n if (i < 0 || i >= this.doc.lines) return null;\n const cached = this.cache.get(i);\n if (cached) return cached;\n if (i < this.read) {\n const start = this.from(i);\n const state = start.state;\n let tokens = [];\n for (let j = start.line; j <= i; j++) {\n tokens = tokenizeLine(this.language, this.doc.lineText(j + 1), state, this.tabSize);\n this.remember(j, tokens);\n }\n this.walk = {\n line: i + 1,\n state\n };\n return tokens;\n }\n if (i - this.read > limit) return null;\n const near = i - Math.min(this.cacheSize >> 1, 256);\n while (this.read <= i) this.step(this.read >= near);\n return this.cache.get(i) ?? null;\n }\n /** The state at the start of line `n`, reading up to it. */\n stateAt(n) {\n const i = Math.min(Math.max(n - 1, 0), this.doc.lines - 1);\n if (i === this.read) return this.tip;\n if (i < this.read) return this.stateIn(this.doc, i);\n while (this.read < i) this.step(false);\n return this.tip;\n }\n /** The language active at the start of line `n`: an inner one inside a nesting language. */\n languageAt(n) {\n let language = this.language;\n let state = this.stateAt(n);\n for (let depth = 0; depth < 4; depth++) {\n const inner = language.languageAt(state);\n if (!inner) break;\n const innerState = state.inner?.state;\n language = inner;\n state = innerState;\n }\n return language;\n }\n /** Reads ahead until `deadline` (a `performance.now()` time) or line `until`; returns whether it read any. */\n work(deadline, until = this.doc.lines) {\n const end = Math.min(until, this.doc.lines);\n const start = this.read;\n while (this.read < end) {\n this.step(false);\n if ((this.read & 15) === 0 && performance.now() >= deadline) break;\n }\n return this.read > start;\n }\n /** Whether every line up to `n` is read. */\n ready(n) {\n return this.read >= Math.min(n, this.doc.lines);\n }\n /**\n * The kept start states from line `from` (an index) on, as\n * `[line, state]` pairs, ending with the line reading is at.\n */\n checkpoints(from = 0) {\n const out = [];\n for (let k = this.keptAt(from); k < this.lines.length; k++) if (this.lines[k] >= from) out.push([this.lines[k], this.states[k]]);\n if (this.read > (out.length ? out[out.length - 1][0] : -1)) out.push([this.read, this.tip]);\n return out;\n }\n /**\n * Takes in start states read elsewhere (a worker reading the same text):\n * `[line, state]` pairs in order, the last one where that reading is.\n * Those past what is read here are kept as read.\n */\n adopt(points) {\n if (!points.length) return;\n const [endLine, endState] = points[points.length - 1];\n if (endLine <= this.read || endLine > this.doc.lines) return;\n const after = this.read;\n let k = 0;\n while (k < points.length && points[k][0] <= after) k++;\n let last = this.lines[this.lines.length - 1];\n for (; k < points.length - 1; k++) {\n const [line, state] = points[k];\n if (line - last < this.interval) continue;\n this.lines.push(line);\n this.states.push(state);\n last = line;\n }\n for (const key of this.cache.keys()) if (key >= after) this.cache.delete(key);\n this.read = endLine;\n this.tip = endState;\n this.dropOld();\n }\n };\n // src/language/worker-protocol.ts\n const LANGUAGE = \"$codeLanguage\";\n const isLanguage = (value) => typeof value.token === \"function\" && typeof value.startState === \"function\";\n /** A state as plain data, its languages replaced by their names. */\n function encodeState(value) {\n if (typeof value !== \"object\" || value === null) return value;\n if (Array.isArray(value)) return value.map(encodeState);\n if (isLanguage(value)) return { [LANGUAGE]: value.name };\n const out = {};\n for (const key in value) out[key] = encodeState(value[key]);\n return out;\n }\n /** A language and every language it may hold, by name. */\n function languagesIn(language) {\n const found = /* @__PURE__ */ new Map();\n const visit = (item) => {\n if (found.has(item.name)) return;\n found.set(item.name, item);\n for (const inner of item.nested ?? []) visit(inner);\n };\n visit(language);\n return found;\n }\n // src/languages/javascript.ts\n const words = (list) => new Set(list.split(\" \"));\n const KEYWORDS$3 = words(\"as async await break case catch class const continue debugger default delete do else export extends false finally for from function get if import in instanceof let new null of return set static super switch this throw true try typeof undefined var void while with yield\");\n const TS_KEYWORDS = words(\"abstract asserts declare enum global implements infer interface is keyof module namespace override private protected public readonly satisfies type unique\");\n const TS_TYPES = words(\"any bigint boolean never number object string symbol unknown void\");\n /** After these a `/` starts a regular expression, not a division. */\n const BEFORE_EXPRESSION = words(\"await case delete do else in instanceof new of return throw typeof void yield\");\n const IDENT = /^[\\p{L}_$][\\p{L}\\p{N}_$]*/u;\n const NUMBER$1 = /^(?:0[xX][\\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|(?:\\d[\\d_]*(?:\\.[\\d_]*)?|\\.\\d[\\d_]*)(?:[eE][+-]?\\d+)?)n?/;\n const KEY_COLON = /^\\s*:/;\n const CALL = /^\\s*\\(/;\n const KEY_AFTER = /^\\s*\\??:(?!:)/;\n const SOFT_KEYWORDS = words(\"get set from as of async\");\n const AFTER_SOFT = /^\\s*[(=:,;)]/;\n const AFTER_TS_KEYWORD = /^\\s*[(=:,;.)]/;\n const OPTIONAL_CALL = /^\\s*(?:\\?\\.)?\\(/;\n const ARROW = /^\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|\\w+)\\s*=>/;\n const OPERATOR = \"+-*/%=&|^!<>?~:\";\n const isOperator = (ch) => OPERATOR.includes(ch);\n const isDigit = (ch) => ch !== void 0 && ch >= \"0\" && ch <= \"9\";\n /** The character after the stream's position, without reading past the line. */\n const after = (stream) => stream.pos + 1 < stream.string.length ? stream.string[stream.pos + 1] : void 0;\n const ahead = (stream, pattern) => !!stream.match(pattern, false);\n function readString$2(stream, quote) {\n let escaped = false;\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === quote && !escaped) return;\n escaped = !escaped && ch === \"\\\\\";\n }\n }\n function readRegex(stream) {\n let escaped = false;\n let inClass = false;\n let ch;\n while ((ch = stream.next()) !== void 0) if (escaped) escaped = false;\n else if (ch === \"\\\\\") escaped = true;\n else if (ch === \"[\") inClass = true;\n else if (ch === \"]\") inClass = false;\n else if (ch === \"/\" && !inClass) {\n stream.match(/^[dgimsuvy]*/);\n return;\n }\n }\n const top = (state) => {\n const stack = state.stack;\n return stack.length ? stack[stack.length - 1] : void 0;\n };\n const pop = (state) => {\n state.stack = state.stack.slice(0, -1);\n };\n /** Reads a token inside a JSX tag's attributes. */\n function jsxTag(stream, state) {\n if (stream.eatSpace()) return null;\n if (stream.match(\"/>\")) {\n pop(state);\n state.expr = false;\n return \"tag\";\n }\n if (stream.eat(\">\")) {\n state.stack = state.stack.slice(0, -1) + \">\";\n return \"tag\";\n }\n if (stream.eat(\"{\")) {\n state.stack += \"J\";\n state.expr = true;\n return \"punctuation\";\n }\n const quote = stream.eat(/[\"']/);\n if (quote) {\n readString$2(stream, quote);\n return \"string\";\n }\n if (stream.match(/^[\\p{L}_$][\\p{L}\\p{N}_$:.-]*/u)) return \"attribute\";\n if (stream.eat(\"=\")) return \"operator\";\n stream.next();\n return null;\n }\n /** Reads a token among a JSX element's children. */\n function jsxChildren(stream, state) {\n if (stream.match(/^<\\/[\\p{L}\\p{N}_$:.-]*\\s*>?/u)) {\n pop(state);\n state.expr = false;\n return \"tag\";\n }\n if (stream.match(/^<[\\p{L}_$>]/u, false)) return openTag(stream, state);\n if (stream.eat(\"{\")) {\n state.stack += \"J\";\n state.expr = true;\n return \"punctuation\";\n }\n stream.eatWhile((ch) => ch !== \"<\" && ch !== \"{\");\n return null;\n }\n function openTag(stream, state) {\n stream.next();\n if (stream.eat(\">\")) state.stack += \">\";\n else {\n stream.match(/^[\\p{L}_$][\\p{L}\\p{N}_$:.-]*/u);\n state.stack += \"<\";\n }\n return \"tag\";\n }\n function templateBody(stream, state) {\n if (stream.eat(\"`\")) {\n pop(state);\n state.expr = false;\n return \"string\";\n }\n if (stream.match(\"${\")) {\n state.stack += \"$\";\n state.expr = true;\n return \"punctuation\";\n }\n let escaped = false;\n while (!stream.eol()) {\n const ch = stream.peek();\n if (!escaped && (ch === \"`\" || ch === \"$\" && stream.string[stream.pos + 1] === \"{\")) break;\n escaped = !escaped && ch === \"\\\\\";\n stream.next();\n }\n return \"string\";\n }\n function code(stream, state, options) {\n if (stream.eatSpace()) return null;\n const ch = stream.peek();\n const dot = state.dot;\n const key = state.key || stream.sol() && top(state) === \"{\";\n state.dot = false;\n state.key = false;\n if (ch === \"/\") {\n if (stream.match(\"//\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (!state.comment) stream.pos += 2;\n else stream.skipToEnd();\n return \"comment\";\n }\n if (state.expr) {\n stream.next();\n readRegex(stream);\n state.expr = false;\n return \"string\";\n }\n }\n if (ch === \"\\\"\" || ch === \"'\") {\n stream.next();\n readString$2(stream, ch);\n const isKey = key && !!stream.match(KEY_COLON, false);\n state.expr = false;\n return isKey ? \"property\" : \"string\";\n }\n if (ch === \"`\") {\n stream.next();\n state.stack += \"`\";\n return \"string\";\n }\n if (isDigit(ch) || ch === \".\" && isDigit(after(stream))) {\n if (stream.match(NUMBER$1)) {\n state.expr = false;\n return \"number\";\n }\n }\n if (options.jsx && ch === \"<\" && state.expr && stream.match(/^<[\\p{L}_$>]/u, false)) return openTag(stream, state);\n const word = stream.match(IDENT);\n if (word) {\n const name = word[0];\n state.expr = BEFORE_EXPRESSION.has(name);\n if (dot) return ahead(stream, CALL) ? \"function\" : \"property\";\n if (key && ahead(stream, KEY_AFTER)) return \"property\";\n if (KEYWORDS$3.has(name)) {\n if (SOFT_KEYWORDS.has(name) && ahead(stream, AFTER_SOFT)) return ahead(stream, CALL) ? \"function\" : \"variable\";\n return \"keyword\";\n }\n if (options.typescript) {\n if (TS_TYPES.has(name)) return \"type\";\n if (TS_KEYWORDS.has(name) && !ahead(stream, AFTER_TS_KEYWORD)) return \"keyword\";\n }\n if (ahead(stream, OPTIONAL_CALL) || ahead(stream, ARROW)) return \"function\";\n if (name.charCodeAt(0) >= 65 && name.charCodeAt(0) <= 90) return \"type\";\n return \"variable\";\n }\n if (ch === \"#\") {\n stream.next();\n if (stream.match(IDENT)) {\n state.expr = false;\n return \"property\";\n }\n return \"meta\";\n }\n if (ch === \"@\") {\n stream.next();\n stream.match(/^[\\p{L}_$][\\p{L}\\p{N}_$.]*/u);\n return \"meta\";\n }\n stream.next();\n if (ch === \"{\") {\n state.stack += \"{\";\n state.expr = true;\n state.key = true;\n return \"punctuation\";\n }\n if (ch === \"}\") {\n const t = top(state);\n if (t === \"{\" || t === \"$\" || t === \"J\") pop(state);\n state.expr = false;\n return \"punctuation\";\n }\n if (ch === \"(\" || ch === \"[\") {\n state.expr = true;\n return \"punctuation\";\n }\n if (ch === \")\" || ch === \"]\") {\n state.expr = false;\n return \"punctuation\";\n }\n if (ch === \",\" || ch === \";\") {\n state.expr = true;\n state.key = top(state) === \"{\";\n return \"punctuation\";\n }\n if (ch === \".\") {\n if (stream.match(\"..\")) {\n state.expr = true;\n return \"operator\";\n }\n state.dot = true;\n return \"punctuation\";\n }\n if (ch === \"?\" && stream.peek() === \".\" && !isDigit(after(stream))) {\n stream.next();\n state.dot = true;\n return \"operator\";\n }\n if (OPERATOR.includes(ch)) {\n stream.eatWhile(isOperator);\n const op = stream.current();\n state.expr = op !== \"++\" && op !== \"--\";\n return \"operator\";\n }\n state.expr = false;\n return null;\n }\n /** Makes a JavaScript-family language: plain, TypeScript, JSX or TSX. */\n function createJavaScript(name, aliases, options = {}) {\n return defineCodeLanguage({\n name,\n aliases,\n startState: () => ({\n stack: \"\",\n comment: false,\n expr: true,\n dot: false,\n key: false\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.stack === b.stack && a.comment === b.comment && a.expr === b.expr && a.dot === b.dot && a.key === b.key,\n token(stream, state) {\n if (state.comment) {\n if (stream.skipTo(\"*/\")) {\n stream.pos += 2;\n state.comment = false;\n } else stream.skipToEnd();\n return \"comment\";\n }\n const t = top(state);\n if (t === \"`\") return templateBody(stream, state);\n if (t === \"<\") return jsxTag(stream, state);\n if (t === \">\") return jsxChildren(stream, state);\n return code(stream, state, options);\n },\n comment: {\n line: \"//\",\n block: [\"/*\", \"*/\"]\n },\n autoClose: \"([{'\\\"`\"\n });\n }\n const javascript = createJavaScript(\"javascript\", [\n \"js\",\n \"mjs\",\n \"cjs\"\n ]);\n const typescript = createJavaScript(\"typescript\", [\n \"ts\",\n \"mts\",\n \"cts\"\n ], { typescript: true });\n const jsx = createJavaScript(\"jsx\", [], { jsx: true });\n const tsx = createJavaScript(\"tsx\", [], {\n typescript: true,\n jsx: true\n });\n // src/languages/css.ts\n /**\n * Whether a name at the cursor inside a block is a property: `name:` with\n * a `;`, a `}` or the line's end before any `{` (`a:hover {` is a nested\n * selector).\n */\n const isProperty = (stream) => !!stream.match(/^[\\w-]+\\s*:(?!:)[^{;}]*(?:[;}]|$)/, false);\n function readString$1(stream, quote) {\n let escaped = false;\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === quote && !escaped) return;\n escaped = !escaped && ch === \"\\\\\";\n }\n }\n /** Makes CSS or a nesting dialect such as SCSS (`//` comments, `$` variables). */\n function createCss(name, aliases, scss = false) {\n return defineCodeLanguage({\n name,\n aliases,\n startState: () => ({\n comment: false,\n depth: 0,\n value: false,\n parens: 0,\n at: false\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.comment === b.comment && a.depth === b.depth && a.value === b.value && a.parens === b.parens && a.at === b.at,\n token(stream, state) {\n if (state.comment || stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (state.comment) stream.skipToEnd();\n else stream.pos += 2;\n return \"comment\";\n }\n if (stream.eatSpace()) return null;\n if (scss && stream.match(\"//\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n const ch = stream.peek();\n if (ch === \"\\\"\" || ch === \"'\") {\n stream.next();\n readString$1(stream, ch);\n return \"string\";\n }\n if (ch === \"@\") {\n stream.next();\n stream.match(/^[\\w-]+/);\n state.at = true;\n return \"keyword\";\n }\n if (ch === \"{\") {\n stream.next();\n state.depth++;\n state.value = false;\n state.at = false;\n return \"punctuation\";\n }\n if (ch === \"}\") {\n stream.next();\n state.depth = Math.max(0, state.depth - 1);\n state.value = false;\n return \"punctuation\";\n }\n if (ch === \";\") {\n stream.next();\n state.value = false;\n state.at = false;\n return \"punctuation\";\n }\n if (ch === \"(\") {\n stream.next();\n state.parens++;\n return \"punctuation\";\n }\n if (ch === \")\") {\n stream.next();\n state.parens = Math.max(0, state.parens - 1);\n return \"punctuation\";\n }\n if (stream.match(/^--[\\w-]*/) || scss && stream.match(/^\\$[\\w-]+/)) {\n if (!state.value && stream.match(/^\\s*:/, false)) return \"property\";\n return \"variable\";\n }\n if (state.value || state.at || state.parens) {\n if (stream.match(/^#[\\da-fA-F]{3,8}\\b/)) return \"number\";\n if (stream.match(/^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?(?:%|[a-zA-Z]+)?/)) return \"number\";\n if (stream.match(\"!important\")) return \"keyword\";\n if (stream.match(/^[\\w-]+(?=\\()/)) return \"function\";\n if (stream.match(/^[\\w-]+/)) {\n if (state.at && /^(?:and|or|not|only|screen|print|all)$/.test(stream.current())) return \"keyword\";\n return state.value ? \"variable\" : state.at ? \"variable\" : \"property\";\n }\n } else {\n if (state.depth > 0 && isProperty(stream)) {\n stream.match(/^[\\w-]+/);\n return \"property\";\n }\n if (stream.match(/^[.#][\\w-]+/)) return \"type\";\n if (stream.match(/^::?[\\w-]+/)) return \"keyword\";\n if (stream.match(/^\\[[^\\]]*\\]?/)) return \"attribute\";\n if (stream.match(/^[a-zA-Z][\\w-]*/) || stream.eat(\"*\")) return \"tag\";\n if (scss && stream.eat(\"&\")) return \"keyword\";\n }\n if (ch === \":\") {\n stream.next();\n if (state.depth > 0 && !state.at) state.value = true;\n return \"punctuation\";\n }\n if (stream.eat(/[,>+~/*=]/)) return \"operator\";\n stream.next();\n return null;\n },\n comment: scss ? {\n line: \"//\",\n block: [\"/*\", \"*/\"]\n } : { block: [\"/*\", \"*/\"] },\n autoClose: \"([{'\\\"\"\n });\n }\n const css = createCss(\"css\", []);\n const scss = createCss(\"scss\", [\"less\", \"postcss\"], true);\n // src/languages/json.ts\n /** JSON, also with comments and trailing commas as in `tsconfig.json`. */\n const json = defineCodeLanguage({\n name: \"json\",\n aliases: [\"jsonc\", \"json5\"],\n startState: () => ({ comment: false }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.comment === b.comment,\n token(stream, state) {\n if (state.comment || stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (state.comment) stream.skipToEnd();\n else stream.pos += 2;\n return \"comment\";\n }\n if (stream.eatSpace()) return null;\n if (stream.match(\"//\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (stream.eat(\"\\\"\")) {\n let escaped = false;\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === \"\\\"\" && !escaped) break;\n escaped = !escaped && ch === \"\\\\\";\n }\n return stream.match(/^\\s*:/, false) ? \"property\" : \"string\";\n }\n if (stream.match(/^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/)) return \"number\";\n if (stream.match(/^(?:true|false|null)\\b/)) return \"keyword\";\n if (stream.eat(/[{}[\\],:]/)) return \"punctuation\";\n stream.eatWhile(/[^\\s{}[\\],:\"]/);\n return \"invalid\";\n },\n comment: {\n line: \"//\",\n block: [\"/*\", \"*/\"]\n },\n autoClose: \"[{\\\"\"\n });\n // src/languages/html.ts\n const SCRIPT_TYPES = /^(?:|module|text\\/javascript|application\\/javascript|js|ts|typescript)$/;\n function scriptLanguage(lang) {\n return /^(?:ts|typescript|tsx)$/.test(lang) ? typescript : javascript;\n }\n function styleLanguage(lang) {\n return /^(?:scss|sass|less|postcss)$/.test(lang) ? scss : css;\n }\n /** Whether an attribute's value is an expression in a Vue template. */\n const isDirective = (attr) => /^(?:v-[\\w-]+|[:@#][^=]*)/.test(attr);\n function enter(state, language, end, block) {\n state.inner = {\n language,\n state: language.startState(),\n end,\n block\n };\n }\n let lastLine = \"\";\n let lastLowered = \"\";\n /** The line in lower case, made once for all the tokens read from it. */\n function lowered(line) {\n if (line !== lastLine) {\n lastLine = line;\n lastLowered = line.toLowerCase();\n }\n return lastLowered;\n }\n /** Reads one token of the inner language, stopping where it ends. */\n function inner(stream, state) {\n const at = state.inner;\n const found = at.end.startsWith(\"<\") ? lowered(stream.string).indexOf(at.end, stream.pos) : stream.string.indexOf(at.end, stream.pos);\n const index = found < 0 ? -1 : found - stream.pos;\n if (index === 0) {\n state.inner = null;\n return;\n }\n const end = stream.end;\n if (index > 0) stream.end = stream.pos + index;\n const type = at.language.token(stream, at.state);\n stream.end = end;\n if (stream.pos === stream.start) stream.next();\n return type;\n }\n function tag(stream, state, options) {\n if (stream.eatSpace()) return null;\n if (stream.match(\"/>\") || stream.eat(\">\")) {\n const name = state.tag;\n state.in = \"text\";\n if (stream.current() === \">\") {\n if (name === \"script\" && SCRIPT_TYPES.test(state.lang)) enter(state, scriptLanguage(state.lang), \"<\\/script\", true);\n else if (name === \"style\") enter(state, styleLanguage(state.lang), \"</style\", true);\n }\n state.lang = \"\";\n return \"tag\";\n }\n if (stream.eat(\"=\")) return \"operator\";\n const quote = stream.eat(/[\"']/);\n if (quote) {\n if (options.vue && isDirective(state.attr)) {\n enter(state, typescript, quote, false);\n return \"string\";\n }\n return attrValue(stream, state, quote);\n }\n const name = stream.match(/^[^\\s=>/\"']+/);\n if (name) {\n state.attr = name[0].toLowerCase();\n return \"attribute\";\n }\n stream.next();\n return null;\n }\n /** Reads an attribute value up to its closing quote, which may be on a later line. */\n function attrValue(stream, state, quote) {\n const close = stream.string.indexOf(quote, stream.pos);\n const value = stream.string.slice(stream.pos, close < 0 ? void 0 : close);\n if (state.attr === \"lang\" || state.attr === \"type\") state.lang += value.trim().toLowerCase();\n if (close < 0) {\n stream.skipToEnd();\n state.quote = quote;\n } else {\n stream.pos = close + 1;\n state.quote = \"\";\n }\n return \"string\";\n }\n function text(stream, state, options) {\n if (stream.match(\"<!--\")) {\n state.comment = true;\n return comment(stream, state);\n }\n if (stream.match(/^<![^>]*>?/)) return \"meta\";\n if (stream.match(/^<\\/[\\w:-]*\\s*>?/)) return \"tag\";\n const open = stream.match(/^<([a-zA-Z][\\w:.-]*)/);\n if (open) {\n state.in = \"tag\";\n state.tag = open[1].toLowerCase();\n state.attr = \"\";\n state.lang = \"\";\n return \"tag\";\n }\n if (options.vue && stream.match(\"{{\")) {\n enter(state, typescript, \"}}\", false);\n return \"punctuation\";\n }\n if (stream.match(/^&(?:#\\d+|#x[\\da-fA-F]+|[a-zA-Z]\\w*);/)) return \"meta\";\n stream.next();\n stream.eatWhile(options.vue ? /[^<&{]/ : /[^<&]/);\n return null;\n }\n function comment(stream, state) {\n if (stream.skipTo(\"-->\")) {\n stream.pos += 3;\n state.comment = false;\n } else stream.skipToEnd();\n return \"comment\";\n }\n /** Makes HTML, or a Vue single-file component. */\n function createHtml(name, aliases, options = {}) {\n return defineCodeLanguage({\n name,\n aliases,\n nested: [\n javascript,\n typescript,\n css,\n scss\n ],\n startState: () => ({\n in: \"text\",\n tag: \"\",\n attr: \"\",\n lang: \"\",\n comment: false,\n quote: \"\",\n inner: null\n }),\n copyState: (state) => ({\n ...state,\n inner: state.inner && {\n ...state.inner,\n state: state.inner.language.copyState(state.inner.state)\n }\n }),\n sameState: (a, b) => a.in === b.in && a.tag === b.tag && a.attr === b.attr && a.lang === b.lang && a.comment === b.comment && a.quote === b.quote && (a.inner === b.inner || !!a.inner && !!b.inner && a.inner.language === b.inner.language && a.inner.end === b.inner.end && a.inner.language.sameState(a.inner.state, b.inner.state)),\n token(stream, state) {\n if (state.inner) {\n const type = inner(stream, state);\n if (type !== void 0) return type;\n if (stream.match(\"}}\")) return \"punctuation\";\n if (stream.eat(/[\"']/)) return \"string\";\n }\n if (state.comment) return comment(stream, state);\n if (state.quote) return attrValue(stream, state, state.quote);\n return state.in === \"tag\" ? tag(stream, state, options) : text(stream, state, options);\n },\n comment: { block: [\"<!--\", \"-->\"] },\n autoClose: \"([{\\\"'\",\n indentAfter: /<(?!\\/|!|(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)\\b)[\\w:-]+(?:\\s[^<>]*)?(?<!\\/)>\\s*$/i,\n languageAt: (state) => state.inner?.block ? state.inner.language : null\n });\n }\n const html = createHtml(\"html\", [\n \"htm\",\n \"xml\",\n \"svg\"\n ]);\n const vue = createHtml(\"vue\", [], { vue: true });\n // src/languages/markdown.ts\n function inline(stream) {\n if (stream.match(/^\\\\[\\\\`*_{}[\\]()#+\\-.!|<>~]/)) return null;\n if (stream.match(/^(`+)[^`]*?\\1/) || stream.match(/^`+/)) return \"string\";\n if (stream.match(/^(\\*\\*|__)(?=\\S)[^]*?\\S\\1/)) return \"strong\";\n if (stream.match(/^([*_])(?=\\S)[^*_]*?\\S\\1/)) return \"emphasis\";\n if (stream.match(/^~~(?=\\S)[^~]*?\\S~~/)) return \"meta\";\n if (stream.match(/^!?\\[[^\\]]*\\](?:\\([^)]*\\)|\\[[^\\]]*\\])?/)) return \"link\";\n if (stream.match(/^<(?:https?:\\/\\/|mailto:)[^>]+>/)) return \"link\";\n if (stream.match(/^<\\/?[a-zA-Z][^>]*>/)) return \"tag\";\n stream.next();\n stream.eatWhile(/[^\\\\`*_[!<~]/);\n return null;\n }\n /** Makes Markdown; `languages` lists the languages its fenced code is highlighted with. */\n function createMarkdown(options = {}) {\n const languages = options.languages ?? [];\n return defineCodeLanguage({\n name: \"markdown\",\n aliases: [\"md\"],\n nested: languages,\n startState: () => ({\n fence: \"\",\n inner: null\n }),\n copyState: (state) => ({\n fence: state.fence,\n inner: state.inner && {\n language: state.inner.language,\n state: state.inner.language.copyState(state.inner.state)\n }\n }),\n sameState: (a, b) => a.fence === b.fence && (a.inner === b.inner || !!a.inner && !!b.inner && a.inner.language === b.inner.language && a.inner.language.sameState(a.inner.state, b.inner.state)),\n token(stream, state) {\n if (state.fence) {\n if (stream.pos === 0) {\n const close = stream.match(/^\\s{0,3}(`{3,}|~{3,})\\s*$/, false);\n if (close && close[1].startsWith(state.fence)) {\n stream.skipToEnd();\n state.fence = \"\";\n state.inner = null;\n return \"meta\";\n }\n }\n if (!state.inner) {\n stream.skipToEnd();\n return \"string\";\n }\n return state.inner.language.token(stream, state.inner.state);\n }\n if (stream.pos === 0) {\n const fence = stream.match(/^\\s{0,3}(`{3,}|~{3,})\\s*([\\w+#.-]*)/);\n if (fence) {\n state.fence = fence[1];\n const language = languageFor(languages, fence[2]);\n state.inner = language && {\n language,\n state: language.startState()\n };\n stream.skipToEnd();\n return \"meta\";\n }\n if (stream.match(/^\\s{0,3}#{1,6}(?:\\s|$)/)) {\n stream.skipToEnd();\n return \"heading\";\n }\n if (stream.match(/^\\s{0,3}([-*_])(?:\\s*\\1){2,}\\s*$/)) return \"meta\";\n if (stream.match(/^\\s*>\\s?/)) return \"meta\";\n if (stream.match(/^\\s*(?:[-*+]|\\d+[.)])(?:\\s+\\[[ xX]\\])?(?=\\s)/)) return \"keyword\";\n }\n return inline(stream);\n },\n comment: { block: [\"<!--\", \"-->\"] },\n autoClose: \"([{`\\\"\",\n languageAt: (state) => state.inner?.language ?? null\n });\n }\n const markdown = createMarkdown();\n // src/languages/python.ts\n const KEYWORDS$2 = new Set(\"and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case type\".split(\" \"));\n const CONSTANTS = /* @__PURE__ */ new Set([\n \"True\",\n \"False\",\n \"None\",\n \"Ellipsis\",\n \"NotImplemented\"\n ]);\n const BUILTIN_TYPES = new Set(\"int float complex str bytes bytearray bool list tuple dict set frozenset object type range memoryview Exception\".split(\" \"));\n /** Reads a string from its quotes to their end, or to the line's end; returns whether it closed. */\n function readString(stream, quote, raw) {\n while (!stream.eol()) {\n if (stream.match(quote)) return true;\n if (stream.next() === \"\\\\\" && !raw) stream.next();\n }\n return quote.length === 1;\n }\n /** Python 3, with type hints, decorators and f-strings. */\n const python = defineCodeLanguage({\n name: \"python\",\n aliases: [\n \"py\",\n \"py3\",\n \"pyi\"\n ],\n startState: () => ({\n string: null,\n define: null\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.string === b.string && a.define === b.define,\n token(stream, state) {\n if (state.string) {\n if (readString(stream, state.string, false)) state.string = null;\n return \"string\";\n }\n if (stream.eatSpace()) return null;\n if (stream.eat(\"#\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n const quoted = stream.match(/^([rRbBfFuU]{0,2})(\"\"\"|'''|\"|')/);\n if (quoted) {\n const quote = quoted[2];\n if (!readString(stream, quote, /r/i.test(quoted[1]))) state.string = quote;\n state.define = null;\n return \"string\";\n }\n if (stream.sol() && stream.match(/^@[\\w.]+/)) return \"meta\";\n if (stream.match(/^(?:0[xX][\\da-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+)/)) return \"number\";\n if (stream.match(/^(?:\\d[\\d_]*\\.?[\\d_]*|\\.\\d[\\d_]*)(?:[eE][+-]?\\d+)?[jJ]?/)) return \"number\";\n const word = stream.match(/^[\\p{L}_][\\p{L}\\p{N}_]*/u);\n if (word) {\n const name = word[0];\n if (state.define) {\n const kind = state.define;\n state.define = null;\n return kind === \"def\" ? \"function\" : \"type\";\n }\n if (KEYWORDS$2.has(name)) {\n if ((name === \"match\" || name === \"case\" || name === \"type\") && !atStatement(stream)) return stream.match(/^\\s*\\(/, false) ? \"function\" : \"variable\";\n if (name === \"def\" || name === \"class\") state.define = name;\n return \"keyword\";\n }\n if (CONSTANTS.has(name)) return \"keyword\";\n if (name === \"self\" || name === \"cls\") return \"variable\";\n if (stream.match(/^\\s*\\(/, false)) return \"function\";\n if (BUILTIN_TYPES.has(name) || /^[A-Z][a-z]/.test(name)) return \"type\";\n if (stream.string.slice(0, stream.start).trimEnd().endsWith(\".\")) return \"property\";\n return \"variable\";\n }\n if (stream.match(/^(?:\\*\\*=?|\\/\\/=?|->|:=|<<=?|>>=?|[-+*/%@&|^~<>!=]=?)/)) return \"operator\";\n if (stream.eat(/[()[\\]{},:;.]/)) return \"punctuation\";\n stream.next();\n return null;\n },\n comment: { line: \"#\" },\n indentAfter: /:\\s*(?:#.*)?$/\n });\n /** Whether the word just read starts a statement and is followed by more, as `match x:` is. */\n function atStatement(stream) {\n return /^\\s*$/.test(stream.string.slice(0, stream.start)) && /^\\s+[^\\s=:.(,)]/.test(stream.rest());\n }\n // src/languages/shell.ts\n const KEYWORDS$1 = new Set(\"if then else elif fi for while until do done case esac in function select time coproc\".split(\" \"));\n /** Keywords after which a command comes. */\n const BEFORE_COMMAND = /* @__PURE__ */ new Set([\n \"if\",\n \"then\",\n \"else\",\n \"elif\",\n \"do\",\n \"while\",\n \"until\",\n \"time\"\n ]);\n const BUILTINS = new Set(\"echo printf read cd pwd export local readonly return exit set unset shift source eval exec trap test declare alias let true false\".split(\" \"));\n /** Reads a `$name`, `${…}` or `$(…)`; returns whether there was one. */\n function readVariable(stream) {\n if (stream.match(/^\\$(?:[\\w@*#?$!-]|\\{[^}]*\\}?)/)) {\n stream.match(/^\\w*/);\n return true;\n }\n return false;\n }\n /** Reads a double-quoted string up to its end or a `$`; returns whether it closed. */\n function readDouble(stream) {\n while (!stream.eol()) {\n const ch = stream.peek();\n if (ch === \"$\" && stream.match(/^\\$[\\w{@*#?!-]/, false)) return false;\n stream.next();\n if (ch === \"\\\\\") stream.next();\n else if (ch === \"\\\"\") return true;\n }\n return false;\n }\n /** Shell scripts: Bash, sh and Zsh. */\n const shell = defineCodeLanguage({\n name: \"shell\",\n aliases: [\n \"sh\",\n \"bash\",\n \"zsh\",\n \"shellscript\"\n ],\n startState: () => ({\n quote: null,\n command: true,\n heredoc: null\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.quote === b.quote && a.command === b.command && a.heredoc === b.heredoc,\n blankLine(state) {\n if (!state.quote && !state.heredoc) state.command = true;\n },\n token(stream, state) {\n if (stream.pos === 0 && !state.quote) {\n if (state.heredoc) {\n if (stream.string.trim() === state.heredoc) {\n stream.skipToEnd();\n state.heredoc = null;\n state.command = true;\n return \"string\";\n }\n stream.skipToEnd();\n return \"string\";\n }\n if (!stream.string.trimEnd().endsWith(\"\\\\\")) state.command = true;\n }\n if (state.quote === \"'\") {\n if (stream.skipTo(\"'\")) {\n stream.next();\n state.quote = null;\n } else stream.skipToEnd();\n return \"string\";\n }\n if (state.quote === \"\\\"\") {\n if (readVariable(stream)) return \"variable\";\n if (readDouble(stream)) state.quote = null;\n return \"string\";\n }\n if (stream.eatSpace()) return null;\n const ch = stream.peek();\n if (ch === \"#\" && (stream.pos === 0 || /\\s/.test(stream.string[stream.pos - 1]))) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (ch === \"'\") {\n stream.next();\n if (stream.skipTo(\"'\")) stream.next();\n else {\n stream.skipToEnd();\n state.quote = \"'\";\n }\n state.command = false;\n return \"string\";\n }\n if (ch === \"\\\"\") {\n stream.next();\n state.quote = readDouble(stream) ? null : \"\\\"\";\n state.command = false;\n return \"string\";\n }\n if (ch === \"$\") {\n if (stream.match(\"$(\")) {\n state.command = true;\n return \"punctuation\";\n }\n if (readVariable(stream)) {\n state.command = false;\n return \"variable\";\n }\n }\n const heredoc = stream.match(/^<<-?\\s*(['\"]?)(\\w+)\\1/);\n if (heredoc) {\n state.heredoc = heredoc[2];\n return \"operator\";\n }\n if (stream.match(/^(?:&&|\\|\\||;;|[|;&])/)) {\n state.command = true;\n return \"operator\";\n }\n if (stream.match(/^(?:\\d?>>?|<|&>)/)) return \"operator\";\n if (stream.eat(/[(){}[\\]]/)) {\n state.command = ch === \"(\" || ch === \"{\";\n if (ch === \"[\" || ch === \"]\") stream.eat(ch);\n return \"punctuation\";\n }\n if (state.command && stream.match(/^[A-Za-z_]\\w*(?==)/)) return \"variable\";\n if (stream.eat(\"=\")) return \"operator\";\n const word = stream.match(/^[^\\s|;&<>()\"'$`=]+/);\n if (word) {\n const text = word[0];\n if (KEYWORDS$1.has(text) && (state.command || text === \"in\" || text === \"do\")) {\n state.command = BEFORE_COMMAND.has(text);\n return \"keyword\";\n }\n if (state.command) {\n state.command = false;\n return BUILTINS.has(text) ? \"keyword\" : \"function\";\n }\n if (/^--?[\\w-]/.test(text)) return \"attribute\";\n if (/^\\d+$/.test(text)) return \"number\";\n return null;\n }\n stream.next();\n return null;\n },\n comment: { line: \"#\" },\n brackets: \"()[]{}\",\n indentAfter: /(?:\\bthen|\\bdo|\\{|\\bin)\\s*(?:#.*)?$/\n });\n // src/languages/sql.ts\n const KEYWORDS = new Set(`select from where and or not in is null like ilike between exists as on join inner left right full outer cross natural using\ngroup by order having limit offset fetch first next rows only union all intersect except distinct case when then else end\ninsert into values update set delete returning create table view index unique primary key foreign references constraint default\ncheck alter add drop column rename to if truncate with recursive begin commit rollback transaction grant revoke\nasc desc nulls last over partition window filter cascade materialized temporary temp replace conflict do nothing true false`.split(/\\s+/).filter(Boolean));\n const TYPES = new Set(`int integer smallint bigint serial bigserial decimal numeric real float double precision char varchar text\nboolean bool date time timestamp timestamptz interval json jsonb uuid bytea blob`.split(/\\s+/));\n /** Reads a quoted run up to its closing quote (doubled quotes stay inside); returns whether it closed. */\n function readQuoted(stream, quote) {\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === quote) {\n if (stream.eat(quote)) continue;\n return true;\n }\n if (ch === \"\\\\\" && quote === \"'\") stream.next();\n }\n return false;\n }\n /** SQL, the parts most dialects share (PostgreSQL, MySQL, SQLite). Keywords in any case. */\n const sql = defineCodeLanguage({\n name: \"sql\",\n aliases: [\n \"postgres\",\n \"postgresql\",\n \"pgsql\",\n \"mysql\",\n \"sqlite\",\n \"plsql\"\n ],\n startState: () => ({\n comment: false,\n quote: null\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.comment === b.comment && a.quote === b.quote,\n token(stream, state) {\n if (state.comment || stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (state.comment) stream.skipToEnd();\n else stream.pos += 2;\n return \"comment\";\n }\n if (state.quote) {\n const quote = state.quote;\n if (readQuoted(stream, quote)) state.quote = null;\n return quote === \"'\" ? \"string\" : \"variable\";\n }\n if (stream.eatSpace()) return null;\n if (stream.match(\"--\") || stream.match(\"#\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n const ch = stream.peek();\n if (ch === \"'\" || ch === \"\\\"\" || ch === \"`\") {\n stream.next();\n if (!readQuoted(stream, ch)) state.quote = ch;\n return ch === \"'\" ? \"string\" : \"variable\";\n }\n if (stream.match(/^[eEnNxXbB]'/)) {\n if (!readQuoted(stream, \"'\")) state.quote = \"'\";\n return \"string\";\n }\n if (stream.match(/^(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?/)) return \"number\";\n if (stream.match(/^(?:\\$\\d+|[:@][A-Za-z_]\\w*|\\?)/)) return \"variable\";\n const word = stream.match(/^[\\p{L}_][\\p{L}\\p{N}_$]*/u);\n if (word) {\n const lower = word[0].toLowerCase();\n if (stream.string[stream.start - 1] === \".\") return \"property\";\n if (KEYWORDS.has(lower)) return \"keyword\";\n if (TYPES.has(lower)) return \"type\";\n if (stream.match(/^\\s*\\(/, false)) return \"function\";\n return \"variable\";\n }\n if (stream.match(/^(?:::|<>|!=|<=|>=|\\|\\||->>?|[-+*/%<>=~^|&])/)) return \"operator\";\n if (stream.eat(/[(),;.[\\]]/)) return \"punctuation\";\n stream.next();\n return null;\n },\n comment: {\n line: \"--\",\n block: [\"/*\", \"*/\"]\n },\n brackets: \"()[]\",\n autoClose: \"(['\\\"`\"\n });\n // src/languages/yaml.ts\n const SCALAR = /^(?:true|false|yes|no|on|off|null|~)$/i;\n const NUMBER = /^[-+]?(?:\\d[\\d_]*(?:\\.\\d*)?(?:[eE][-+]?\\d+)?|\\.\\d+|0x[\\da-fA-F]+|0o[0-7]+|\\.inf|\\.nan)$/i;\n /** YAML, as in configuration files and front matter. */\n const yaml = defineCodeLanguage({\n name: \"yaml\",\n aliases: [\"yml\"],\n startState: () => ({\n block: -1,\n quote: null,\n flow: 0\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.block === b.block && a.quote === b.quote && a.flow === b.flow,\n token(stream, state) {\n if (stream.pos === 0 && state.block >= 0) {\n if (stream.indentation() > state.block || !stream.string.trim()) {\n stream.skipToEnd();\n return \"string\";\n }\n state.block = -1;\n }\n if (state.quote) {\n const quote = state.quote;\n while (!stream.eol()) {\n const ch = stream.next();\n if (ch === \"\\\\\" && quote === \"\\\"\") stream.next();\n else if (ch === quote) {\n if (quote === \"'\" && stream.eat(\"'\")) continue;\n state.quote = null;\n break;\n }\n }\n return \"string\";\n }\n if (stream.pos === 0 && stream.match(/^(?:---|\\.\\.\\.)(?=\\s|$)/)) return \"meta\";\n if (stream.eatSpace()) return null;\n const ch = stream.peek();\n if (ch === \"#\" && (stream.pos === 0 || /\\s/.test(stream.string[stream.pos - 1]))) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (ch === \"\\\"\" || ch === \"'\") {\n stream.next();\n state.quote = ch;\n const type = yaml.token(stream, state) ?? \"string\";\n return stream.match(/^\\s*:(?=\\s|$)/, false) ? \"property\" : type;\n }\n if (stream.match(/^-(?=\\s|$)/)) return \"punctuation\";\n if (stream.match(/^[&*][^\\s,[\\]{}]+/)) return \"variable\";\n if (stream.match(/^!{1,2}[^\\s,[\\]{}]*/)) return \"meta\";\n if (stream.match(/^[|>][-+]?\\d?(?=\\s*(?:#.*)?$)/)) {\n state.block = stream.indentation();\n return \"operator\";\n }\n if (stream.eat(/[[{]/)) {\n state.flow++;\n return \"punctuation\";\n }\n if (stream.eat(/[\\]}]/)) {\n state.flow = Math.max(0, state.flow - 1);\n return \"punctuation\";\n }\n if (stream.eat(\",\") && state.flow) return \"punctuation\";\n if (stream.match(/^:(?=\\s|$)/) || state.flow && stream.eat(\":\")) return \"punctuation\";\n if (stream.match(/^[^\\s#,[\\]{}:][^#,[\\]{}]*?(?=\\s*:(?:\\s|$))/)) return \"property\";\n const value = stream.match(state.flow ? /^[^,[\\]{}#]+?(?=\\s*(?:[,\\]}]|#|$))/ : /^.+?(?=\\s+#|\\s*$)/);\n if (value) {\n const text = value[0].trim();\n if (SCALAR.test(text)) return \"keyword\";\n if (NUMBER.test(text)) return \"number\";\n return \"string\";\n }\n stream.next();\n return null;\n },\n comment: { line: \"#\" },\n brackets: \"[]{}\",\n autoClose: \"[{'\\\"\",\n indentAfter: /:\\s*(?:[|>][-+]?\\d?)?\\s*(?:#.*)?$/\n });\n // src/worker/index.ts\n /** How long each piece of reading runs before messages are looked at again (ms). */\n const SLICE = 50;\n /**\n * Reads code in a worker for `DouCodeEditor`'s `worker`, so a long file is\n * colored without the page doing the reading. Call it in the worker's own\n * module with the languages the editors use:\n *\n * ```ts\n * // code-worker.ts\n * import { css, serveCodeHighlighting, typescript } from '@dou-ui/code/worker'\n *\n * serveCodeHighlighting([typescript, css])\n * ```\n *\n * One worker serves every editor that is given it. A language works here\n * when its states are plain data (the built-in ones are); those read by\n * the Shiki adapter stay on the page.\n */\n function serveCodeHighlighting(languages, scope = globalThis) {\n const known = /* @__PURE__ */ new Map();\n for (const language of languages) for (const [name, item] of languagesIn(language)) if (!known.has(name)) known.set(name, item);\n const open = /* @__PURE__ */ new Map();\n /** Texts still coming in. */\n const opening = /* @__PURE__ */ new Map();\n let timer = null;\n const send = (message) => scope.postMessage(message);\n function reply(id, doc) {\n const asked = doc.asked;\n doc.asked = null;\n let points;\n try {\n points = doc.highlighter.checkpoints(asked.from).map(([line, state]) => [line, encodeState(state)]);\n send({\n t: \"states\",\n id,\n version: doc.version,\n points\n });\n } catch {\n open.delete(id);\n send({\n t: \"unsupported\",\n id\n });\n }\n }\n function run() {\n timer = null;\n const deadline = performance.now() + SLICE;\n for (const [id, doc] of open) {\n const hl = doc.highlighter;\n if (doc.asked && hl.ready(doc.asked.until)) reply(id, doc);\n if (performance.now() >= deadline) break;\n if (!hl.ready(hl.text.lines)) {\n hl.work(deadline, doc.asked ? doc.asked.until : hl.text.lines);\n if (doc.asked && hl.ready(doc.asked.until)) reply(id, doc);\n }\n }\n for (const doc of open.values()) if (doc.asked || !doc.highlighter.ready(doc.highlighter.text.lines)) {\n schedule();\n break;\n }\n }\n const schedule = () => {\n timer ??= setTimeout(run, 0);\n };\n scope.addEventListener(\"message\", (event) => {\n const message = event.data;\n if (!message || typeof message !== \"object\") return;\n if (message.t === \"open\") {\n const language = known.get(message.language);\n const inside = language ? languagesIn(language) : null;\n const missing = inside ? message.nested.find((name) => !inside.has(name)) : message.language;\n if (!language || missing) {\n send({\n t: \"unsupported\",\n id: message.id,\n missing\n });\n return;\n }\n opening.set(message.id, {\n language,\n tabSize: message.tabSize,\n lines: []\n });\n return;\n } else if (message.t === \"text\") {\n const pending = opening.get(message.id);\n if (!pending) return;\n for (const line of message.lines) pending.lines.push(line);\n if (!message.done) return;\n opening.delete(message.id);\n open.set(message.id, {\n highlighter: new CodeHighlighter(pending.language, CodeText.of(pending.lines), { tabSize: pending.tabSize }),\n version: 0,\n asked: null\n });\n } else if (message.t === \"close\") {\n open.delete(message.id);\n opening.delete(message.id);\n return;\n } else {\n const doc = open.get(message.id);\n if (!doc) return;\n if (message.t === \"change\") {\n const changes = ChangeSet.of(message.changes.map(([from, to, insert]) => ({\n from,\n to,\n insert\n })), message.length);\n doc.highlighter.update(changes.apply(doc.highlighter.text), changes);\n doc.version++;\n } else doc.asked = {\n from: message.from,\n until: message.until\n };\n }\n schedule();\n });\n }\n // src/worker/default.ts\n serveCodeHighlighting([\n javascript,\n typescript,\n jsx,\n tsx,\n css,\n scss,\n json,\n html,\n vue,\n markdown,\n python,\n shell,\n sql,\n yaml\n ]);\n})();\n\n//# sourceMappingURL=default-BZBMZKf_.js.map";
|
|
2
|
+
var jsContent = "(function() {\n // src/core/changes.ts\n /**\n * The changes one step makes to a text: replacements sorted by position,\n * never overlapping, every offset counted in the text before the step.\n *\n * A change set maps positions from the old text to the new one (cursors,\n * marks, diagnostics follow the edit), inverts (undo), and composes with the\n * one after it (merging steps).\n */\n var ChangeSet = class ChangeSet {\n changes;\n length;\n /** Running length difference after each change, for mapping by binary search. */\n shifts;\n constructor(changes, length) {\n this.changes = changes;\n this.length = length;\n }\n /**\n * Changes to a text of `length`. Specs may come in any order; touching\n * ones are joined, overlapping ones are a mistake.\n */\n static of(specs, length) {\n const sorted = (Array.isArray(specs) ? specs : [specs]).map((spec) => ({\n from: spec.from,\n to: spec.to ?? spec.from,\n insert: spec.insert ?? \"\"\n })).filter((change) => change.from !== change.to || change.insert).sort((a, b) => a.from - b.from || a.to - b.to);\n const changes = [];\n for (const change of sorted) {\n if (change.from < 0 || change.to > length || change.from > change.to) throw new RangeError(`[@dou-ui/code] change ${change.from}–${change.to} is outside 0–${length}`);\n const last = changes[changes.length - 1];\n if (last && change.from < last.to) throw new RangeError(`[@dou-ui/code] changes ${last.from}–${last.to} and ${change.from}–${change.to} overlap`);\n if (change.insert.includes(\"\\r\")) change.insert = change.insert.replace(/\\r\\n?/g, \"\\n\");\n if (last && change.from === last.to) {\n last.to = change.to;\n last.insert += change.insert;\n } else changes.push(change);\n }\n return new ChangeSet(changes, length);\n }\n /** No changes at all. */\n static empty(length) {\n return new ChangeSet([], length);\n }\n get empty() {\n return this.changes.length === 0;\n }\n /** Length of the text after the changes. */\n get newLength() {\n let length = this.length;\n for (const change of this.changes) length += change.insert.length - (change.to - change.from);\n return length;\n }\n /** Applies the changes to `text`, which must be the text they were made for. */\n apply(text) {\n if (text.length !== this.length) throw new RangeError(`[@dou-ui/code] changes for a text of ${this.length} applied to one of ${text.length}`);\n for (let i = this.changes.length - 1; i >= 0; i--) {\n const change = this.changes[i];\n text = text.replace(change.from, change.to, change.insert);\n }\n return text;\n }\n /** The changes that undo these, given the text before them. */\n invert(text) {\n let shift = 0;\n const out = [];\n for (const change of this.changes) {\n const from = change.from + shift;\n out.push({\n from,\n to: from + change.insert.length,\n insert: text.slice(change.from, change.to)\n });\n shift += change.insert.length - (change.to - change.from);\n }\n return new ChangeSet(out, this.newLength);\n }\n /** Where `pos` in the old text is in the new one. */\n mapPos(pos, assoc = -1) {\n const changes = this.changes;\n if (!changes.length) return pos;\n if (!this.shifts) {\n let shift = 0;\n this.shifts = changes.map((change) => shift += change.insert.length - (change.to - change.from));\n }\n let lo = 0;\n let hi = changes.length - 1;\n let found = -1;\n while (lo <= hi) {\n const mid = lo + hi >> 1;\n if (changes[mid].from <= pos) {\n found = mid;\n lo = mid + 1;\n } else hi = mid - 1;\n }\n if (found < 0) return pos;\n const change = changes[found];\n const before = found ? this.shifts[found - 1] : 0;\n if (pos > change.to) return pos + this.shifts[found];\n const start = change.from + before;\n const end = start + change.insert.length;\n if (pos === change.from && change.from === change.to) return assoc < 0 ? start : end;\n if (pos === change.from) return start;\n if (pos === change.to) return end;\n return assoc < 0 ? start : end;\n }\n /** Whether any change touches `from`–`to` of the old text. */\n touches(from, to = from) {\n return this.changes.some((change) => change.from <= to && change.to >= from);\n }\n /** These changes followed by `next`, which was made for the text these produce. */\n compose(next) {\n if (next.length !== this.newLength) throw new RangeError(`[@dou-ui/code] composing changes for ${next.length} after ones that make ${this.newLength}`);\n const a = toOps(this);\n const b = toOps(next);\n const out = [];\n let i = 0;\n let j = 0;\n let opA = a[i++];\n let opB = b[j++];\n while (opA || opB) if (opA && \"delete\" in opA) {\n out.push(opA);\n opA = a[i++];\n } else if (opB && \"insert\" in opB) {\n out.push(opB);\n opB = b[j++];\n } else if (opA && opB) {\n const sizeA = \"retain\" in opA ? opA.retain : opA.insert.length;\n const sizeB = \"retain\" in opB ? opB.retain : opB.delete;\n const n = Math.min(sizeA, sizeB);\n if (\"retain\" in opA) out.push(\"retain\" in opB ? { retain: n } : { delete: n });\n else if (\"retain\" in opB) out.push({ insert: opA.insert.slice(0, n) });\n opA = sizeA > n ? shrink(opA, n) : a[i++];\n opB = sizeB > n ? shrink(opB, n) : b[j++];\n } else throw new RangeError(\"[@dou-ui/code] change sets of different lengths\");\n return fromOps(out, this.length);\n }\n };\n function shrink(op, n) {\n if (\"retain\" in op) return { retain: op.retain - n };\n if (\"delete\" in op) return { delete: op.delete - n };\n return { insert: op.insert.slice(n) };\n }\n function toOps(set) {\n const ops = [];\n let pos = 0;\n for (const change of set.changes) {\n if (change.from > pos) ops.push({ retain: change.from - pos });\n if (change.to > change.from) ops.push({ delete: change.to - change.from });\n if (change.insert) ops.push({ insert: change.insert });\n pos = change.to;\n }\n if (set.length > pos) ops.push({ retain: set.length - pos });\n return ops;\n }\n function fromOps(ops, length) {\n const specs = [];\n let pos = 0;\n let open = null;\n for (const op of ops) {\n if (\"retain\" in op) {\n if (!op.retain) continue;\n open = null;\n pos += op.retain;\n continue;\n }\n if (!open) {\n open = {\n from: pos,\n to: pos,\n insert: \"\"\n };\n specs.push(open);\n }\n if (\"delete\" in op) {\n open.to += op.delete;\n pos += op.delete;\n } else open.insert += op.insert;\n }\n return ChangeSet.of(specs, length);\n }\n // ../../node_modules/.bun/@vue+shared@3.5.44/node_modules/@vue/shared/dist/shared.esm-bundler.js\n /**\n * @vue/shared v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n // @__NO_SIDE_EFFECTS__\n function makeMap(str) {\n const map = /* @__PURE__ */ Object.create(null);\n for (const key of str.split(\",\")) map[key] = 1;\n return (val) => val in map;\n }\n const EMPTY_OBJ = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze({}) : {};\n process.env.NODE_ENV !== \"production\" && Object.freeze([]);\n const NOOP = () => {};\n const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);\n const isModelListener = (key) => key.startsWith(\"onUpdate:\");\n const extend = Object.assign;\n const hasOwnProperty$1 = Object.prototype.hasOwnProperty;\n const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);\n const isArray = Array.isArray;\n const isMap = (val) => toTypeString(val) === \"[object Map]\";\n const isSet = (val) => toTypeString(val) === \"[object Set]\";\n const isFunction = (val) => typeof val === \"function\";\n const isString = (val) => typeof val === \"string\";\n const isSymbol = (val) => typeof val === \"symbol\";\n const isObject = (val) => val !== null && typeof val === \"object\";\n const isPromise = (val) => {\n return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);\n };\n const objectToString = Object.prototype.toString;\n const toTypeString = (value) => objectToString.call(value);\n const toRawType = (value) => {\n return toTypeString(value).slice(8, -1);\n };\n const isPlainObject = (val) => toTypeString(val) === \"[object Object]\";\n const isIntegerKey = (key) => isString(key) && key !== \"NaN\" && key[0] !== \"-\" && \"\" + parseInt(key, 10) === key;\n const cacheStringFunction = (fn) => {\n const cache = /* @__PURE__ */ Object.create(null);\n return ((str) => {\n return cache[str] || (cache[str] = fn(str));\n });\n };\n const capitalize = cacheStringFunction((str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n });\n const hasChanged = (value, oldValue) => !Object.is(value, oldValue);\n const def = (obj, key, value, writable = false) => {\n Object.defineProperty(obj, key, {\n configurable: true,\n enumerable: false,\n writable,\n value\n });\n };\n let _globalThis;\n const getGlobalThis = () => {\n return _globalThis || (_globalThis = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : {});\n };\n function normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);\n if (normalized) for (const key in normalized) res[key] = normalized[key];\n }\n return res;\n } else if (isString(value) || isObject(value)) return value;\n }\n const listDelimiterRE = /;(?![^(]*\\))/g;\n const propertyDelimiterRE = /:([^]+)/;\n const styleCommentRE = /\"(?:[^\"\\\\]|\\\\[^])*\"|'(?:[^'\\\\]|\\\\[^])*'|\\\\[^]|\\/\\*[^]*?\\*\\//g;\n function parseStringStyle(cssText) {\n const ret = {};\n cssText.replace(styleCommentRE, (match) => match.startsWith(\"/*\") ? \"\" : match).split(listDelimiterRE).forEach((item) => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n }\n function normalizeClass(value) {\n let res = \"\";\n if (isString(value)) res = value;\n else if (isArray(value)) for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) res += normalized + \" \";\n }\n else if (isObject(value)) {\n for (const name in value) if (value[name]) res += name + \" \";\n }\n return res.trim();\n }\n // ../../node_modules/.bun/@vue+reactivity@3.5.44/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js\n /**\n * @vue/reactivity v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n function warn$2(msg, ...args) {\n console.warn(`[Vue warn] ${msg}`, ...args);\n }\n let activeSub;\n const pausedQueueEffects = /* @__PURE__ */ new WeakSet();\n var ReactiveEffect = class {\n constructor(fn) {\n this.fn = fn;\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 5;\n /**\n * @internal\n */\n this.next = void 0;\n /**\n * @internal\n */\n this.cleanup = void 0;\n this.scheduler = void 0;\n }\n pause() {\n this.flags |= 64;\n }\n resume() {\n if (this.flags & 64) {\n this.flags &= -65;\n if (pausedQueueEffects.has(this)) {\n pausedQueueEffects.delete(this);\n this.trigger();\n }\n }\n }\n /**\n * @internal\n */\n notify() {\n if (this.flags & 2 && !(this.flags & 32)) return;\n if (!(this.flags & 8)) batch(this);\n }\n run() {\n if (!(this.flags & 1)) return this.fn();\n this.flags |= 2;\n cleanupEffect(this);\n prepareDeps(this);\n const prevEffect = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = this;\n shouldTrack = true;\n try {\n return this.fn();\n } finally {\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub !== this) warn$2(\"Active effect was not restored correctly - this is likely a Vue internal bug.\");\n cleanupDeps(this);\n activeSub = prevEffect;\n shouldTrack = prevShouldTrack;\n this.flags &= -3;\n }\n }\n stop() {\n if (this.flags & 1) {\n for (let link = this.deps; link; link = link.nextDep) removeSub(link);\n this.deps = this.depsTail = void 0;\n cleanupEffect(this);\n this.onStop && this.onStop();\n this.flags &= -2;\n }\n }\n trigger() {\n if (this.flags & 64) pausedQueueEffects.add(this);\n else if (this.scheduler) this.scheduler();\n else this.runIfDirty();\n }\n /**\n * @internal\n */\n runIfDirty() {\n if (isDirty(this)) this.run();\n }\n get dirty() {\n return isDirty(this);\n }\n };\n let batchDepth = 0;\n let batchedSub;\n let batchedComputed;\n function batch(sub, isComputed = false) {\n sub.flags |= 8;\n if (isComputed) {\n sub.next = batchedComputed;\n batchedComputed = sub;\n return;\n }\n sub.next = batchedSub;\n batchedSub = sub;\n }\n function startBatch() {\n batchDepth++;\n }\n function endBatch() {\n if (--batchDepth > 0) return;\n if (batchedComputed) {\n let e = batchedComputed;\n batchedComputed = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n e = next;\n }\n }\n let error;\n while (batchedSub) {\n let e = batchedSub;\n batchedSub = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n if (e.flags & 1) try {\n e.trigger();\n } catch (err) {\n if (!error) error = err;\n }\n e = next;\n }\n }\n if (error) throw error;\n }\n function prepareDeps(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n link.version = -1;\n link.prevActiveLink = link.dep.activeLink;\n link.dep.activeLink = link;\n }\n }\n function cleanupDeps(sub) {\n let head;\n let tail = sub.depsTail;\n let link = tail;\n while (link) {\n const prev = link.prevDep;\n if (link.version === -1) {\n if (link === tail) tail = prev;\n removeSub(link);\n removeDep(link);\n } else head = link;\n link.dep.activeLink = link.prevActiveLink;\n link.prevActiveLink = void 0;\n link = prev;\n }\n sub.deps = head;\n sub.depsTail = tail;\n }\n function isDirty(sub) {\n for (let link = sub.deps; link; link = link.nextDep) if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) return true;\n if (sub._dirty) return true;\n return false;\n }\n function refreshComputed(computed) {\n if (computed.flags & 4 && !(computed.flags & 16)) return;\n computed.flags &= -17;\n if (computed.globalVersion === globalVersion) return;\n computed.globalVersion = globalVersion;\n if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) return;\n computed.flags |= 2;\n const dep = computed.dep;\n const prevSub = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = computed;\n shouldTrack = true;\n try {\n prepareDeps(computed);\n const value = computed.fn(computed._value);\n if (dep.version === 0 || hasChanged(value, computed._value)) {\n computed.flags |= 128;\n computed._value = value;\n dep.version++;\n }\n } catch (err) {\n dep.version++;\n throw err;\n } finally {\n activeSub = prevSub;\n shouldTrack = prevShouldTrack;\n cleanupDeps(computed);\n computed.flags &= -3;\n }\n }\n function removeSub(link, soft = false) {\n const { dep, prevSub, nextSub } = link;\n if (prevSub) {\n prevSub.nextSub = nextSub;\n link.prevSub = void 0;\n }\n if (nextSub) {\n nextSub.prevSub = prevSub;\n link.nextSub = void 0;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && dep.subsHead === link) dep.subsHead = nextSub;\n if (dep.subs === link) {\n dep.subs = prevSub;\n if (!prevSub && dep.computed) {\n dep.computed.flags &= -5;\n for (let l = dep.computed.deps; l; l = l.nextDep) removeSub(l, true);\n }\n }\n if (!soft && !--dep.sc && dep.map) dep.map.delete(dep.key);\n }\n function removeDep(link) {\n const { prevDep, nextDep } = link;\n if (prevDep) {\n prevDep.nextDep = nextDep;\n link.prevDep = void 0;\n }\n if (nextDep) {\n nextDep.prevDep = prevDep;\n link.nextDep = void 0;\n }\n }\n let shouldTrack = true;\n const trackStack = [];\n function pauseTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = false;\n }\n function resetTracking() {\n const last = trackStack.pop();\n shouldTrack = last === void 0 ? true : last;\n }\n function cleanupEffect(e) {\n const { cleanup } = e;\n e.cleanup = void 0;\n if (cleanup) {\n const prevSub = activeSub;\n activeSub = void 0;\n try {\n cleanup();\n } finally {\n activeSub = prevSub;\n }\n }\n }\n let globalVersion = 0;\n var Link = class {\n constructor(sub, dep) {\n this.sub = sub;\n this.dep = dep;\n this.version = dep.version;\n this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;\n }\n };\n var Dep = class {\n constructor(computed) {\n this.computed = computed;\n this.version = 0;\n /**\n * Link between this dep and the current active effect\n */\n this.activeLink = void 0;\n /**\n * Doubly linked list representing the subscribing effects (tail)\n */\n this.subs = void 0;\n /**\n * For object property deps cleanup\n */\n this.map = void 0;\n this.key = void 0;\n /**\n * Subscriber counter\n */\n this.sc = 0;\n /**\n * @internal\n */\n this.__v_skip = true;\n if (!!(process.env.NODE_ENV !== \"production\")) this.subsHead = void 0;\n }\n track(debugInfo) {\n if (!activeSub || !shouldTrack || activeSub === this.computed) return;\n let link = this.activeLink;\n if (link === void 0 || link.sub !== activeSub) {\n link = this.activeLink = new Link(activeSub, this);\n if (!activeSub.deps) activeSub.deps = activeSub.depsTail = link;\n else {\n link.prevDep = activeSub.depsTail;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n }\n addSub(link);\n } else if (link.version === -1) {\n link.version = this.version;\n if (link.nextDep) {\n const next = link.nextDep;\n next.prevDep = link.prevDep;\n if (link.prevDep) link.prevDep.nextDep = next;\n link.prevDep = activeSub.depsTail;\n link.nextDep = void 0;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n if (activeSub.deps === link) activeSub.deps = next;\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub.onTrack) activeSub.onTrack(extend({ effect: activeSub }, debugInfo));\n return link;\n }\n trigger(debugInfo) {\n this.version++;\n globalVersion++;\n this.notify(debugInfo);\n }\n notify(debugInfo) {\n startBatch();\n try {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n for (let head = this.subsHead; head; head = head.nextSub) if (head.sub.onTrigger && !(head.sub.flags & 8)) head.sub.onTrigger(extend({ effect: head.sub }, debugInfo));\n }\n for (let link = this.subs; link; link = link.prevSub) if (link.sub.notify()) link.sub.dep.notify();\n } finally {\n endBatch();\n }\n }\n };\n function addSub(link) {\n link.dep.sc++;\n if (link.sub.flags & 4) {\n const computed = link.dep.computed;\n if (computed && !link.dep.subs) {\n computed.flags |= 20;\n for (let l = computed.deps; l; l = l.nextDep) addSub(l);\n }\n const currentTail = link.dep.subs;\n if (currentTail !== link) {\n link.prevSub = currentTail;\n if (currentTail) currentTail.nextSub = link;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && link.dep.subsHead === void 0) link.dep.subsHead = link;\n link.dep.subs = link;\n }\n }\n const targetMap = /* @__PURE__ */ new WeakMap();\n const ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Object iterate\" : \"\");\n const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Map keys iterate\" : \"\");\n const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Array iterate\" : \"\");\n function track(target, type, key) {\n if (shouldTrack && activeSub) {\n let depsMap = targetMap.get(target);\n if (!depsMap) targetMap.set(target, depsMap = /* @__PURE__ */ new Map());\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, dep = new Dep());\n dep.map = depsMap;\n dep.key = key;\n }\n if (!!(process.env.NODE_ENV !== \"production\")) dep.track({\n target,\n type,\n key\n });\n else dep.track();\n }\n }\n function trigger(target, type, key, newValue, oldValue, oldTarget) {\n const depsMap = targetMap.get(target);\n if (!depsMap) {\n globalVersion++;\n return;\n }\n const run = (dep) => {\n if (dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) dep.trigger({\n target,\n type,\n key,\n newValue,\n oldValue,\n oldTarget\n });\n else dep.trigger();\n }\n };\n startBatch();\n if (type === \"clear\") depsMap.forEach(run);\n else {\n const targetIsArray = isArray(target);\n const isArrayIndex = targetIsArray && isIntegerKey(key);\n if (targetIsArray && key === \"length\") {\n const newLength = Number(newValue);\n depsMap.forEach((dep, key2) => {\n if (key2 === \"length\" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) run(dep);\n });\n } else {\n if (key !== void 0 || depsMap.has(void 0)) run(depsMap.get(key));\n if (isArrayIndex) run(depsMap.get(ARRAY_ITERATE_KEY));\n switch (type) {\n case \"add\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));\n } else if (isArrayIndex) run(depsMap.get(\"length\"));\n break;\n case \"delete\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n break;\n case \"set\": if (isMap(target)) run(depsMap.get(ITERATE_KEY));\n }\n }\n }\n endBatch();\n }\n function reactiveReadArray(array) {\n const raw = /* @__PURE__ */ toRaw(array);\n if (raw === array) return raw;\n track(raw, \"iterate\", ARRAY_ITERATE_KEY);\n if (/* @__PURE__ */ isShallow(array)) return raw;\n if (!/* @__PURE__ */ isReadonly(array)) return raw.map(toReactive);\n return /* @__PURE__ */ isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);\n }\n function shallowReadArray(arr) {\n track(arr = /* @__PURE__ */ toRaw(arr), \"iterate\", ARRAY_ITERATE_KEY);\n return arr;\n }\n function toWrapped(target, item) {\n if (/* @__PURE__ */ isReadonly(target)) return /* @__PURE__ */ isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);\n return toReactive(item);\n }\n const arrayInstrumentations = {\n __proto__: null,\n [Symbol.iterator]() {\n return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));\n },\n concat(...args) {\n return reactiveReadArray(this).concat(...args.map((x) => isArray(x) ? reactiveReadArray(x) : x));\n },\n entries() {\n return iterator(this, \"entries\", (value) => {\n value[1] = toWrapped(this, value[1]);\n return value;\n });\n },\n every(fn, thisArg) {\n return apply(this, \"every\", fn, thisArg, void 0, arguments);\n },\n filter(fn, thisArg) {\n return apply(this, \"filter\", fn, thisArg, (v) => v.map((item) => toWrapped(this, item)), arguments);\n },\n find(fn, thisArg) {\n return apply(this, \"find\", fn, thisArg, (item) => toWrapped(this, item), arguments);\n },\n findIndex(fn, thisArg) {\n return apply(this, \"findIndex\", fn, thisArg, void 0, arguments);\n },\n findLast(fn, thisArg) {\n return apply(this, \"findLast\", fn, thisArg, (item) => toWrapped(this, item), arguments);\n },\n findLastIndex(fn, thisArg) {\n return apply(this, \"findLastIndex\", fn, thisArg, void 0, arguments);\n },\n forEach(fn, thisArg) {\n return apply(this, \"forEach\", fn, thisArg, void 0, arguments);\n },\n includes(...args) {\n return searchProxy(this, \"includes\", args);\n },\n indexOf(...args) {\n return searchProxy(this, \"indexOf\", args);\n },\n join(separator) {\n return reactiveReadArray(this).join(separator);\n },\n lastIndexOf(...args) {\n return searchProxy(this, \"lastIndexOf\", args);\n },\n map(fn, thisArg) {\n return apply(this, \"map\", fn, thisArg, void 0, arguments);\n },\n pop() {\n return noTracking(this, \"pop\");\n },\n push(...args) {\n return noTracking(this, \"push\", args);\n },\n reduce(fn, ...args) {\n return reduce(this, \"reduce\", fn, args);\n },\n reduceRight(fn, ...args) {\n return reduce(this, \"reduceRight\", fn, args);\n },\n shift() {\n return noTracking(this, \"shift\");\n },\n some(fn, thisArg) {\n return apply(this, \"some\", fn, thisArg, void 0, arguments);\n },\n splice(...args) {\n return noTracking(this, \"splice\", args);\n },\n toReversed() {\n return reactiveReadArray(this).toReversed();\n },\n toSorted(comparer) {\n return reactiveReadArray(this).toSorted(comparer);\n },\n toSpliced(...args) {\n return reactiveReadArray(this).toSpliced(...args);\n },\n unshift(...args) {\n return noTracking(this, \"unshift\", args);\n },\n values() {\n return iterator(this, \"values\", (item) => toWrapped(this, item));\n }\n };\n function iterator(self, method, wrapValue) {\n const arr = shallowReadArray(self);\n const methodFn = arr[method];\n const iter = methodFn.call(arr);\n if (arr !== self && !/* @__PURE__ */ isShallow(self)) {\n if (iter[Symbol.toStringTag] === \"Array Iterator\") {\n const wrapped = Object.create(Object.getPrototypeOf(iter));\n wrapped.next = () => wrapResult(iter.next(), wrapValue);\n if (methodFn !== arrayProto[method]) Object.defineProperties(wrapped, {\n return: { get() {\n const fn = iter.return;\n return typeof fn === \"function\" ? fn.bind(iter) : fn;\n } },\n throw: { get() {\n const fn = iter.throw;\n return typeof fn === \"function\" ? fn.bind(iter) : fn;\n } }\n });\n return wrapped;\n }\n iter._next = iter.next;\n iter.next = () => wrapResult(iter._next(), wrapValue);\n }\n return iter;\n }\n function wrapResult(result, wrapValue) {\n if (!result.done) result.value = wrapValue(result.value);\n return result;\n }\n const arrayProto = Array.prototype;\n function apply(self, method, fn, thisArg, wrappedRetFn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);\n const methodFn = arr[method];\n if (methodFn !== arrayProto[method]) {\n const result2 = methodFn.apply(self, args);\n return needsWrap ? toReactive(result2) : result2;\n }\n let wrappedFn = fn;\n if (arr !== self) {\n if (needsWrap) wrappedFn = function(item, index) {\n return fn.call(this, toWrapped(self, item), index, self);\n };\n else if (fn.length > 2) wrappedFn = function(item, index) {\n return fn.call(this, item, index, self);\n };\n }\n const result = methodFn.call(arr, wrappedFn, thisArg);\n return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;\n }\n function reduce(self, method, fn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);\n let wrappedFn = fn;\n let wrapInitialAccumulator = false;\n if (arr !== self) {\n if (needsWrap) {\n wrapInitialAccumulator = args.length === 0;\n wrappedFn = function(acc, item, index) {\n if (wrapInitialAccumulator) {\n wrapInitialAccumulator = false;\n acc = toWrapped(self, acc);\n }\n return fn.call(this, acc, toWrapped(self, item), index, self);\n };\n } else if (fn.length > 3) wrappedFn = function(acc, item, index) {\n return fn.call(this, acc, item, index, self);\n };\n }\n const result = arr[method](wrappedFn, ...args);\n return wrapInitialAccumulator ? toWrapped(self, result) : result;\n }\n function searchProxy(self, method, args) {\n const arr = /* @__PURE__ */ toRaw(self);\n track(arr, \"iterate\", ARRAY_ITERATE_KEY);\n const res = arr[method](...args);\n if ((res === -1 || res === false) && /* @__PURE__ */ isProxy(args[0])) {\n args[0] = /* @__PURE__ */ toRaw(args[0]);\n return arr[method](...args);\n }\n return res;\n }\n function noTracking(self, method, args = []) {\n pauseTracking();\n startBatch();\n const res = (/* @__PURE__ */ toRaw(self))[method].apply(self, args);\n endBatch();\n resetTracking();\n return res;\n }\n const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);\n const builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== \"arguments\" && key !== \"caller\").map((key) => Symbol[key]).filter(isSymbol));\n function hasOwnProperty(key) {\n if (!isSymbol(key)) key = String(key);\n const obj = /* @__PURE__ */ toRaw(this);\n track(obj, \"has\", key);\n return obj.hasOwnProperty(key);\n }\n var BaseReactiveHandler = class {\n constructor(_isReadonly = false, _isShallow = false) {\n this._isReadonly = _isReadonly;\n this._isShallow = _isShallow;\n }\n get(target, key, receiver) {\n if (key === \"__v_skip\") return target[\"__v_skip\"];\n const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;\n if (key === \"__v_isReactive\") return !isReadonly2;\n else if (key === \"__v_isReadonly\") return isReadonly2;\n else if (key === \"__v_isShallow\") return isShallow2;\n else if (key === \"__v_raw\") {\n if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) return target;\n return;\n }\n const targetIsArray = isArray(target);\n if (!isReadonly2) {\n let fn;\n if (targetIsArray && (fn = arrayInstrumentations[key])) return fn;\n if (key === \"hasOwnProperty\") return hasOwnProperty;\n }\n const res = Reflect.get(target, key, /* @__PURE__ */ isRef(target) ? target : receiver);\n if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) return res;\n if (!isReadonly2) track(target, \"get\", key);\n if (isShallow2) return res;\n if (/* @__PURE__ */ isRef(res)) {\n const value = targetIsArray && isIntegerKey(key) ? res : res.value;\n return isReadonly2 && isObject(value) ? /* @__PURE__ */ readonly(value) : value;\n }\n if (isObject(res)) return isReadonly2 ? /* @__PURE__ */ readonly(res) : /* @__PURE__ */ reactive(res);\n return res;\n }\n };\n var MutableReactiveHandler = class extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(false, isShallow2);\n }\n set(target, key, value, receiver) {\n let oldValue = target[key];\n const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);\n if (!this._isShallow) {\n const isOldValueReadonly = /* @__PURE__ */ isReadonly(oldValue);\n if (!/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) {\n oldValue = /* @__PURE__ */ toRaw(oldValue);\n value = /* @__PURE__ */ toRaw(value);\n }\n if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {\n if (isOldValueReadonly) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`Set operation on key \"${String(key)}\" failed: target is readonly.`, target[key]);\n return true;\n } else {\n oldValue.value = value;\n return true;\n }\n }\n }\n const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);\n const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);\n if (target === /* @__PURE__ */ toRaw(receiver) && result) {\n if (!hadKey) trigger(target, \"add\", key, value);\n else if (hasChanged(value, oldValue)) trigger(target, \"set\", key, value, oldValue);\n }\n return result;\n }\n deleteProperty(target, key) {\n const hadKey = hasOwn(target, key);\n const oldValue = target[key];\n const result = Reflect.deleteProperty(target, key);\n if (result && hadKey) trigger(target, \"delete\", key, void 0, oldValue);\n return result;\n }\n has(target, key) {\n const result = Reflect.has(target, key);\n if (!isSymbol(key) || !builtInSymbols.has(key)) track(target, \"has\", key);\n return result;\n }\n ownKeys(target) {\n track(target, \"iterate\", isArray(target) ? \"length\" : ITERATE_KEY);\n return Reflect.ownKeys(target);\n }\n };\n var ReadonlyReactiveHandler = class extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(true, isShallow2);\n }\n set(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`Set operation on key \"${String(key)}\" failed: target is readonly.`, target);\n return true;\n }\n deleteProperty(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`Delete operation on key \"${String(key)}\" failed: target is readonly.`, target);\n return true;\n }\n };\n const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();\n const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();\n const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);\n const toShallow = (value) => value;\n const getProto = (v) => Reflect.getPrototypeOf(v);\n function createIterableMethod(method, isReadonly2, isShallow2) {\n return function(...args) {\n const target = this[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const targetIsMap = isMap(rawTarget);\n const isPair = method === \"entries\" || method === Symbol.iterator && targetIsMap;\n const isKeyOnly = method === \"keys\" && targetIsMap;\n const innerIterator = target[method](...args);\n const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;\n !isReadonly2 && track(rawTarget, \"iterate\", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);\n return extend(Object.create(innerIterator), { next() {\n const { value, done } = innerIterator.next();\n return done ? {\n value,\n done\n } : {\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\n done\n };\n } });\n };\n }\n function createReadonlyMethod(type) {\n return function(...args) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\n warn$2(`${capitalize(type)} operation ${key}failed: target is readonly.`, /* @__PURE__ */ toRaw(this));\n }\n return type === \"delete\" ? false : type === \"clear\" ? void 0 : this;\n };\n }\n function createInstrumentations(readonly, shallow) {\n const instrumentations = {\n get(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const rawKey = /* @__PURE__ */ toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) track(rawTarget, \"get\", key);\n track(rawTarget, \"get\", rawKey);\n }\n const { has } = getProto(rawTarget);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n if (has.call(rawTarget, key)) return wrap(target.get(key));\n else if (has.call(rawTarget, rawKey)) return wrap(target.get(rawKey));\n else if (target !== rawTarget) target.get(key);\n },\n get size() {\n const target = this[\"__v_raw\"];\n !readonly && track(/* @__PURE__ */ toRaw(target), \"iterate\", ITERATE_KEY);\n return target.size;\n },\n has(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const rawKey = /* @__PURE__ */ toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) track(rawTarget, \"has\", key);\n track(rawTarget, \"has\", rawKey);\n }\n return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);\n },\n forEach(callback, thisArg) {\n const observed = this;\n const target = observed[\"__v_raw\"];\n const rawTarget = /* @__PURE__ */ toRaw(target);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n !readonly && track(rawTarget, \"iterate\", ITERATE_KEY);\n return target.forEach((value, key) => {\n return callback.call(thisArg, wrap(value), wrap(key), observed);\n });\n }\n };\n extend(instrumentations, readonly ? {\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\")\n } : {\n add(value) {\n const target = /* @__PURE__ */ toRaw(this);\n const proto = getProto(target);\n const rawValue = /* @__PURE__ */ toRaw(value);\n const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;\n if (!(proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {\n target.add(valueToAdd);\n trigger(target, \"add\", valueToAdd, valueToAdd);\n }\n return this;\n },\n set(key, value) {\n if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);\n const target = /* @__PURE__ */ toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = /* @__PURE__ */ toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) checkIdentityKeys(target, has, key);\n const oldValue = get.call(target, key);\n target.set(key, value);\n if (!hadKey) trigger(target, \"add\", key, value);\n else if (hasChanged(value, oldValue)) trigger(target, \"set\", key, value, oldValue);\n return this;\n },\n delete(key) {\n const target = /* @__PURE__ */ toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = /* @__PURE__ */ toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) checkIdentityKeys(target, has, key);\n const oldValue = get ? get.call(target, key) : void 0;\n const result = target.delete(key);\n if (hadKey) trigger(target, \"delete\", key, void 0, oldValue);\n return result;\n },\n clear() {\n const target = /* @__PURE__ */ toRaw(this);\n const hadItems = target.size !== 0;\n const oldTarget = !!(process.env.NODE_ENV !== \"production\") ? isMap(target) ? new Map(target) : new Set(target) : void 0;\n const result = target.clear();\n if (hadItems) trigger(target, \"clear\", void 0, void 0, oldTarget);\n return result;\n }\n });\n [\n \"keys\",\n \"values\",\n \"entries\",\n Symbol.iterator\n ].forEach((method) => {\n instrumentations[method] = createIterableMethod(method, readonly, shallow);\n });\n return instrumentations;\n }\n function createInstrumentationGetter(isReadonly2, shallow) {\n const instrumentations = createInstrumentations(isReadonly2, shallow);\n return (target, key, receiver) => {\n if (key === \"__v_isReactive\") return !isReadonly2;\n else if (key === \"__v_isReadonly\") return isReadonly2;\n else if (key === \"__v_isShallow\") return shallow;\n else if (key === \"__v_raw\") return target;\n return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);\n };\n }\n const mutableCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, false) };\n const readonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, false) };\n const shallowReadonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, true) };\n function checkIdentityKeys(target, has, key) {\n const rawKey = /* @__PURE__ */ toRaw(key);\n if (rawKey !== key && has.call(target, rawKey)) {\n const type = toRawType(target);\n warn$2(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);\n }\n }\n const reactiveMap = /* @__PURE__ */ new WeakMap();\n const shallowReactiveMap = /* @__PURE__ */ new WeakMap();\n const readonlyMap = /* @__PURE__ */ new WeakMap();\n const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();\n function targetTypeMap(rawType) {\n switch (rawType) {\n case \"Object\":\n case \"Array\": return 1;\n case \"Map\":\n case \"Set\":\n case \"WeakMap\":\n case \"WeakSet\": return 2;\n default: return 0;\n }\n }\n // @__NO_SIDE_EFFECTS__\n function reactive(target) {\n if (/* @__PURE__ */ isReadonly(target)) return target;\n return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);\n }\n // @__NO_SIDE_EFFECTS__\n function readonly(target) {\n return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);\n }\n // @__NO_SIDE_EFFECTS__\n function shallowReadonly(target) {\n return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);\n }\n function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {\n if (!isObject(target)) {\n if (!!(process.env.NODE_ENV !== \"production\")) warn$2(`value cannot be made ${isReadonly2 ? \"readonly\" : \"reactive\"}: ${String(target)}`);\n return target;\n }\n if (target[\"__v_raw\"] && !(isReadonly2 && target[\"__v_isReactive\"])) return target;\n if (target[\"__v_skip\"] || !Object.isExtensible(target)) return target;\n const existingProxy = proxyMap.get(target);\n if (existingProxy) return existingProxy;\n const targetType = targetTypeMap(toRawType(target));\n if (targetType === 0) return target;\n const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);\n proxyMap.set(target, proxy);\n return proxy;\n }\n // @__NO_SIDE_EFFECTS__\n function isReactive(value) {\n if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value[\"__v_raw\"]);\n return !!(value && value[\"__v_isReactive\"]);\n }\n // @__NO_SIDE_EFFECTS__\n function isReadonly(value) {\n return !!(value && value[\"__v_isReadonly\"]);\n }\n // @__NO_SIDE_EFFECTS__\n function isShallow(value) {\n return !!(value && value[\"__v_isShallow\"]);\n }\n // @__NO_SIDE_EFFECTS__\n function isProxy(value) {\n return value ? !!value[\"__v_raw\"] : false;\n }\n // @__NO_SIDE_EFFECTS__\n function toRaw(observed) {\n const raw = observed && observed[\"__v_raw\"];\n return raw ? /* @__PURE__ */ toRaw(raw) : observed;\n }\n function markRaw(value) {\n if (!hasOwn(value, \"__v_skip\") && Object.isExtensible(value)) def(value, \"__v_skip\", true);\n return value;\n }\n const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;\n const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;\n // @__NO_SIDE_EFFECTS__\n function isRef(r) {\n return r ? r[\"__v_isRef\"] === true : false;\n }\n function unref(ref2) {\n return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;\n }\n const shallowUnwrapHandlers = {\n get: (target, key, receiver) => key === \"__v_raw\" ? target : unref(Reflect.get(target, key, receiver)),\n set: (target, key, value, receiver) => {\n const oldValue = target[key];\n if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {\n oldValue.value = value;\n return true;\n } else return Reflect.set(target, key, value, receiver);\n }\n };\n function proxyRefs(objectWithRefs) {\n return /* @__PURE__ */ isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);\n }\n const INITIAL_WATCHER_VALUE = {};\n const cleanupMap = /* @__PURE__ */ new WeakMap();\n let activeWatcher = void 0;\n function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {\n if (owner) {\n let cleanups = cleanupMap.get(owner);\n if (!cleanups) cleanupMap.set(owner, cleanups = []);\n cleanups.push(cleanupFn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) warn$2(`onWatcherCleanup() was called when there was no active watcher to associate with.`);\n }\n function watch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, once, scheduler, augmentJob, call } = options;\n const warnInvalidSource = (s) => {\n (options.onWarn || warn$2)(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`);\n };\n const reactiveGetter = (source2) => {\n if (deep) return source2;\n if (/* @__PURE__ */ isShallow(source2) || deep === false || deep === 0) return traverse(source2, 1);\n return traverse(source2);\n };\n let effect;\n let getter;\n let cleanup;\n let boundCleanup;\n let forceTrigger = false;\n let isMultiSource = false;\n if (/* @__PURE__ */ isRef(source)) {\n getter = () => source.value;\n forceTrigger = /* @__PURE__ */ isShallow(source);\n } else if (/* @__PURE__ */ isReactive(source)) {\n getter = () => reactiveGetter(source);\n forceTrigger = true;\n } else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some((s) => /* @__PURE__ */ isReactive(s) || /* @__PURE__ */ isShallow(s));\n getter = () => source.map((s) => {\n if (/* @__PURE__ */ isRef(s)) return s.value;\n else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s);\n else if (isFunction(s)) return call ? call(s, 2) : s();\n else process.env.NODE_ENV !== \"production\" && warnInvalidSource(s);\n });\n } else if (isFunction(source)) {\n if (cb) getter = call ? () => call(source, 2) : source;\n else getter = () => {\n if (cleanup) {\n pauseTracking();\n try {\n cleanup();\n } finally {\n resetTracking();\n }\n }\n const currentEffect = activeWatcher;\n activeWatcher = effect;\n try {\n return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);\n } finally {\n activeWatcher = currentEffect;\n }\n };\n } else {\n getter = NOOP;\n process.env.NODE_ENV !== \"production\" && warnInvalidSource(source);\n }\n if (cb && deep) {\n const baseGetter = getter;\n const depth = deep === true ? Infinity : deep;\n getter = () => traverse(baseGetter(), depth);\n }\n const watchHandle = () => {\n effect.stop();\n };\n if (once && cb) {\n const _cb = cb;\n cb = (...args) => {\n try {\n return _cb(...args);\n } finally {\n watchHandle();\n }\n };\n }\n let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;\n const job = (immediateFirstRun) => {\n if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) return;\n if (cb) {\n const newValue = effect.run();\n if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {\n const currentWatcher = activeWatcher;\n pauseTracking();\n try {\n if (cleanup) cleanup();\n activeWatcher = effect;\n const args = [\n newValue,\n oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,\n boundCleanup\n ];\n oldValue = newValue;\n call ? call(cb, 3, args) : cb(...args);\n } finally {\n activeWatcher = currentWatcher;\n resetTracking();\n }\n }\n } else effect.run();\n };\n if (augmentJob) augmentJob(job);\n effect = new ReactiveEffect(getter);\n effect.scheduler = scheduler ? () => scheduler(job, false) : job;\n boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);\n cleanup = effect.onStop = () => {\n const cleanups = cleanupMap.get(effect);\n if (cleanups) {\n if (call) call(cleanups, 4);\n else for (const cleanup2 of cleanups) cleanup2();\n cleanupMap.delete(effect);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\")) {\n effect.onTrack = options.onTrack;\n effect.onTrigger = options.onTrigger;\n }\n if (cb) {\n if (immediate) job(true);\n else oldValue = effect.run();\n } else if (scheduler) scheduler(job.bind(null, true), true);\n else effect.run();\n watchHandle.pause = effect.pause.bind(effect);\n watchHandle.resume = effect.resume.bind(effect);\n watchHandle.stop = watchHandle;\n return watchHandle;\n }\n function traverse(value, depth = Infinity, seen) {\n if (depth <= 0 || !isObject(value) || value[\"__v_skip\"]) return value;\n seen = seen || /* @__PURE__ */ new Map();\n if ((seen.get(value) || 0) >= depth) return value;\n seen.set(value, depth);\n depth--;\n if (/* @__PURE__ */ isRef(value)) traverse(value.value, depth, seen);\n else if (isArray(value)) for (let i = 0; i < value.length; i++) traverse(value[i], depth, seen);\n else if (isSet(value) || isMap(value)) value.forEach((v) => {\n traverse(v, depth, seen);\n });\n else if (isPlainObject(value)) {\n for (const key in value) traverse(value[key], depth, seen);\n for (const key of Object.getOwnPropertySymbols(value)) if (Object.prototype.propertyIsEnumerable.call(value, key)) traverse(value[key], depth, seen);\n }\n return value;\n }\n // ../../node_modules/.bun/@vue+runtime-core@3.5.44/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js\n /**\n * @vue/runtime-core v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n const stack = [];\n function pushWarningContext(vnode) {\n stack.push(vnode);\n }\n function popWarningContext() {\n stack.pop();\n }\n let isWarning = false;\n function warn$1(msg, ...args) {\n if (isWarning) return;\n isWarning = true;\n pauseTracking();\n const instance = stack.length ? stack[stack.length - 1].component : null;\n const appWarnHandler = instance && instance.appContext.config.warnHandler;\n const trace = getComponentTrace();\n if (appWarnHandler) callWithErrorHandling(appWarnHandler, instance, 11, [\n msg + args.map((a) => {\n var _a, _b;\n return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);\n }).join(\"\"),\n instance && instance.proxy,\n trace.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`).join(\"\\n\"),\n trace\n ]);\n else {\n const warnArgs = [`[Vue warn]: ${msg}`, ...args];\n if (trace.length && true) warnArgs.push(`\n`, ...formatTrace(trace));\n console.warn(...warnArgs);\n }\n resetTracking();\n isWarning = false;\n }\n function getComponentTrace() {\n let currentVNode = stack[stack.length - 1];\n if (!currentVNode) return [];\n const normalizedStack = [];\n while (currentVNode) {\n const last = normalizedStack[0];\n if (last && last.vnode === currentVNode) last.recurseCount++;\n else normalizedStack.push({\n vnode: currentVNode,\n recurseCount: 0\n });\n const parentInstance = currentVNode.component && currentVNode.component.parent;\n currentVNode = parentInstance && parentInstance.vnode;\n }\n return normalizedStack;\n }\n function formatTrace(trace) {\n const logs = [];\n trace.forEach((entry, i) => {\n logs.push(...i === 0 ? [] : [`\n`], ...formatTraceEntry(entry));\n });\n return logs;\n }\n function formatTraceEntry({ vnode, recurseCount }) {\n const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;\n const isRoot = vnode.component ? vnode.component.parent == null : false;\n const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;\n const close = `>` + postfix;\n return vnode.props ? [\n open,\n ...formatProps(vnode.props),\n close\n ] : [open + close];\n }\n function formatProps(props) {\n const res = [];\n const keys = Object.keys(props);\n keys.slice(0, 3).forEach((key) => {\n res.push(...formatProp(key, props[key]));\n });\n if (keys.length > 3) res.push(` ...`);\n return res;\n }\n function formatProp(key, value, raw) {\n if (isString(value)) {\n value = JSON.stringify(value);\n return raw ? value : [`${key}=${value}`];\n } else if (typeof value === \"number\" || typeof value === \"boolean\" || value == null) return raw ? value : [`${key}=${value}`];\n else if (/* @__PURE__ */ isRef(value)) {\n value = formatProp(key, /* @__PURE__ */ toRaw(value.value), true);\n return raw ? value : [\n `${key}=Ref<`,\n value,\n `>`\n ];\n } else if (isFunction(value)) return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];\n else {\n value = /* @__PURE__ */ toRaw(value);\n return raw ? value : [`${key}=`, value];\n }\n }\n const ErrorTypeStrings$1 = {\n [\"sp\"]: \"serverPrefetch hook\",\n [\"bc\"]: \"beforeCreate hook\",\n [\"c\"]: \"created hook\",\n [\"bm\"]: \"beforeMount hook\",\n [\"m\"]: \"mounted hook\",\n [\"bu\"]: \"beforeUpdate hook\",\n [\"u\"]: \"updated\",\n [\"bum\"]: \"beforeUnmount hook\",\n [\"um\"]: \"unmounted hook\",\n [\"a\"]: \"activated hook\",\n [\"da\"]: \"deactivated hook\",\n [\"ec\"]: \"errorCaptured hook\",\n [\"rtc\"]: \"renderTracked hook\",\n [\"rtg\"]: \"renderTriggered hook\",\n [0]: \"setup function\",\n [1]: \"render function\",\n [2]: \"watcher getter\",\n [3]: \"watcher callback\",\n [4]: \"watcher cleanup function\",\n [5]: \"native event handler\",\n [6]: \"component event handler\",\n [7]: \"vnode hook\",\n [8]: \"directive hook\",\n [9]: \"transition hook\",\n [10]: \"app errorHandler\",\n [11]: \"app warnHandler\",\n [12]: \"ref function\",\n [13]: \"async component loader\",\n [14]: \"scheduler flush\",\n [15]: \"component update\",\n [16]: \"app unmount cleanup function\"\n };\n function callWithErrorHandling(fn, instance, type, args) {\n try {\n return args ? fn(...args) : fn();\n } catch (err) {\n handleError(err, instance, type);\n }\n }\n function callWithAsyncErrorHandling(fn, instance, type, args) {\n if (isFunction(fn)) {\n const res = callWithErrorHandling(fn, instance, type, args);\n if (res && isPromise(res)) res.catch((err) => {\n handleError(err, instance, type);\n });\n return res;\n }\n if (isArray(fn)) {\n const values = [];\n for (let i = 0; i < fn.length; i++) values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));\n return values;\n } else if (!!(process.env.NODE_ENV !== \"production\")) warn$1(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);\n }\n function handleError(err, instance, type, throwInDev = true) {\n const contextVNode = instance ? instance.vnode : null;\n const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;\n if (instance) {\n let cur = instance.parent;\n const exposedInstance = instance.proxy;\n const errorInfo = !!(process.env.NODE_ENV !== \"production\") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;\n while (cur) {\n const errorCapturedHooks = cur.ec;\n if (errorCapturedHooks) {\n for (let i = 0; i < errorCapturedHooks.length; i++) if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) return;\n }\n cur = cur.parent;\n }\n if (errorHandler) {\n pauseTracking();\n callWithErrorHandling(errorHandler, null, 10, [\n err,\n exposedInstance,\n errorInfo\n ]);\n resetTracking();\n return;\n }\n }\n logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);\n }\n function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const info = ErrorTypeStrings$1[type];\n if (contextVNode) pushWarningContext(contextVNode);\n warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);\n if (contextVNode) popWarningContext();\n if (throwInDev) throw err;\n else console.error(err);\n } else if (throwInProd) throw err;\n else console.error(err);\n }\n const queue = [];\n let flushIndex = -1;\n const pendingPostFlushCbs = [];\n let activePostFlushCbs = null;\n let postFlushIndex = 0;\n const resolvedPromise = /* @__PURE__ */ Promise.resolve();\n let currentFlushPromise = null;\n const RECURSION_LIMIT = 100;\n function nextTick(fn) {\n const p = currentFlushPromise || resolvedPromise;\n return fn ? p.then(this ? fn.bind(this) : fn) : p;\n }\n function findInsertionIndex(id) {\n let start = flushIndex + 1;\n let end = queue.length;\n while (start < end) {\n const middle = start + end >>> 1;\n const middleJob = queue[middle];\n const middleJobId = getId(middleJob);\n if (middleJobId < id || middleJobId === id && middleJob.flags & 2) start = middle + 1;\n else end = middle;\n }\n return start;\n }\n function queueJob(job) {\n if (!(job.flags & 1)) {\n const jobId = getId(job);\n const lastJob = queue[queue.length - 1];\n if (!lastJob || !(job.flags & 2) && jobId >= getId(lastJob)) queue.push(job);\n else queue.splice(findInsertionIndex(jobId), 0, job);\n job.flags |= 1;\n queueFlush();\n }\n }\n function queueFlush() {\n if (!currentFlushPromise) currentFlushPromise = resolvedPromise.then(flushJobs);\n }\n function queuePostFlushCb(cb) {\n if (!isArray(cb)) {\n if (activePostFlushCbs && cb.id === -1) activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);\n else if (!(cb.flags & 1)) {\n pendingPostFlushCbs.push(cb);\n cb.flags |= 1;\n }\n } else for (let i = 0; i < cb.length; i++) pendingPostFlushCbs.push(cb[i]);\n queueFlush();\n }\n function flushPostFlushCbs(seen, skip, minUid = 0) {\n if (pendingPostFlushCbs.length) {\n let cbs = pendingPostFlushCbs;\n let kept = 0;\n if (skip) {\n cbs = [];\n for (let i = 0; i < pendingPostFlushCbs.length; i++) {\n const cb = pendingPostFlushCbs[i];\n if (cb.i !== void 0 ? !cb.i || cb.i.uid < minUid : skip.has(cb)) pendingPostFlushCbs[kept++] = cb;\n else cbs.push(cb);\n }\n }\n const deduped = [...new Set(cbs)].sort((a, b) => getId(a) - getId(b));\n pendingPostFlushCbs.length = kept;\n if (activePostFlushCbs) {\n for (let i = 0; i < deduped.length; i++) activePostFlushCbs.push(deduped[i]);\n return;\n }\n activePostFlushCbs = deduped;\n if (!!(process.env.NODE_ENV !== \"production\")) seen = seen || /* @__PURE__ */ new Map();\n for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {\n const cb = activePostFlushCbs[postFlushIndex];\n if (!!(process.env.NODE_ENV !== \"production\") && checkRecursiveUpdates(seen, cb)) continue;\n if (cb.flags & 4) cb.flags &= -2;\n if (!(cb.flags & 8)) cb();\n cb.flags &= -2;\n }\n activePostFlushCbs = null;\n postFlushIndex = 0;\n }\n }\n const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;\n function flushJobs(seen) {\n if (!!(process.env.NODE_ENV !== \"production\")) seen = seen || /* @__PURE__ */ new Map();\n const check = !!(process.env.NODE_ENV !== \"production\") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;\n try {\n for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job && !(job.flags & 8)) {\n if (!!(process.env.NODE_ENV !== \"production\") && check(job)) continue;\n if (job.flags & 4) job.flags &= -2;\n callWithErrorHandling(job, job.i, job.i ? 15 : 14);\n if (!(job.flags & 4)) job.flags &= -2;\n }\n }\n } finally {\n for (; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job) job.flags &= -2;\n }\n flushIndex = -1;\n queue.length = 0;\n flushPostFlushCbs(seen);\n currentFlushPromise = null;\n if (queue.length || pendingPostFlushCbs.length) flushJobs(seen);\n }\n }\n function checkRecursiveUpdates(seen, fn) {\n const count = seen.get(fn) || 0;\n if (count > RECURSION_LIMIT) {\n const instance = fn.i;\n const componentName = instance && getComponentName(instance.type);\n handleError(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, null, 10);\n return true;\n }\n seen.set(fn, count + 1);\n return false;\n }\n const hmrDirtyComponents = /* @__PURE__ */ new Map();\n if (!!(process.env.NODE_ENV !== \"production\")) getGlobalThis().__VUE_HMR_RUNTIME__ = {\n createRecord: tryWrap(createRecord),\n rerender: tryWrap(rerender),\n reload: tryWrap(reload)\n };\n const map = /* @__PURE__ */ new Map();\n function createRecord(id, initialDef) {\n if (map.has(id)) return false;\n map.set(id, {\n initialDef: normalizeClassComponent(initialDef),\n instances: /* @__PURE__ */ new Set()\n });\n return true;\n }\n function normalizeClassComponent(component) {\n return isClassComponent(component) ? component.__vccOpts : component;\n }\n function rerender(id, newRender) {\n const record = map.get(id);\n if (!record) return;\n record.initialDef.render = newRender;\n [...record.instances].forEach((instance) => {\n if (newRender) {\n instance.render = newRender;\n normalizeClassComponent(instance.type).render = newRender;\n }\n instance.renderCache = [];\n if (!(instance.job.flags & 8)) instance.update();\n });\n }\n function reload(id, newComp) {\n const record = map.get(id);\n if (!record) return;\n newComp = normalizeClassComponent(newComp);\n updateComponentDef(record.initialDef, newComp);\n const instances = [...record.instances];\n for (let i = 0; i < instances.length; i++) {\n const instance = instances[i];\n const oldComp = normalizeClassComponent(instance.type);\n let dirtyInstances = hmrDirtyComponents.get(oldComp);\n if (!dirtyInstances) {\n if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);\n hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());\n }\n dirtyInstances.add(instance);\n instance.appContext.propsCache.delete(instance.type);\n instance.appContext.emitsCache.delete(instance.type);\n instance.appContext.optionsCache.delete(instance.type);\n if (instance.ceReload) {\n dirtyInstances.add(instance);\n instance.ceReload(newComp.styles);\n dirtyInstances.delete(instance);\n } else if (instance.parent) queueJob(() => {\n if (!(instance.job.flags & 8)) {\n instance.parent.update();\n dirtyInstances.delete(instance);\n }\n });\n else if (instance.appContext.reload) instance.appContext.reload();\n else if (typeof window !== \"undefined\") window.location.reload();\n else console.warn(\"[HMR] Root or manually mounted instance modified. Full reload required.\");\n if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);\n }\n queuePostFlushCb(() => {\n hmrDirtyComponents.clear();\n });\n }\n function updateComponentDef(oldComp, newComp) {\n extend(oldComp, newComp);\n for (const key in oldComp) if (key !== \"__file\" && !(key in newComp)) delete oldComp[key];\n }\n function tryWrap(fn) {\n return (id, arg) => {\n try {\n return fn(id, arg);\n } catch (e) {\n console.error(e);\n console.warn(`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`);\n }\n };\n }\n let currentRenderingInstance = null;\n let currentScopeId = null;\n function inject(key, defaultValue, treatDefaultAsFactory = false) {\n const instance = getCurrentInstance();\n if (instance || currentApp) {\n let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;\n if (provides && key in provides) return provides[key];\n else if (arguments.length > 1) return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;\n else if (!!(process.env.NODE_ENV !== \"production\")) warn$1(`injection \"${String(key)}\" not found.`);\n } else if (!!(process.env.NODE_ENV !== \"production\")) warn$1(`inject() can only be used inside setup() or functional components.`);\n }\n const ssrContextKey = /* @__PURE__ */ Symbol.for(\"v-scx\");\n const useSSRContext = () => {\n {\n const ctx = inject(ssrContextKey);\n if (!ctx) process.env.NODE_ENV !== \"production\" && warn$1(`Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`);\n return ctx;\n }\n };\n function doWatch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, flush, once } = options;\n if (!!(process.env.NODE_ENV !== \"production\") && !cb) {\n if (immediate !== void 0) warn$1(`watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature.`);\n if (deep !== void 0) warn$1(`watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature.`);\n if (once !== void 0) warn$1(`watch() \"once\" option is only respected when using the watch(source, callback, options?) signature.`);\n }\n const baseWatchOptions = extend({}, options);\n if (!!(process.env.NODE_ENV !== \"production\")) baseWatchOptions.onWarn = warn$1;\n const runsImmediately = cb && immediate || !cb && flush !== \"post\";\n let ssrCleanup;\n if (isInSSRComponentSetup) {\n if (flush === \"sync\") {\n const ctx = useSSRContext();\n ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);\n } else if (!runsImmediately) {\n const watchStopHandle = () => {};\n watchStopHandle.stop = NOOP;\n watchStopHandle.resume = NOOP;\n watchStopHandle.pause = NOOP;\n return watchStopHandle;\n }\n }\n const instance = currentInstance;\n baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);\n let isPre = false;\n if (flush === \"post\") baseWatchOptions.scheduler = (job) => {\n job.i = instance;\n queuePostRenderEffect(job, instance && instance.suspense);\n };\n else if (flush !== \"sync\") {\n isPre = true;\n baseWatchOptions.scheduler = (job, isFirstRun) => {\n if (isFirstRun) job();\n else queueJob(job);\n };\n }\n baseWatchOptions.augmentJob = (job) => {\n if (cb) job.flags |= 4;\n if (isPre) {\n job.flags |= 2;\n if (instance) {\n job.id = instance.uid;\n job.i = instance;\n }\n }\n };\n const watchHandle = watch(source, cb, baseWatchOptions);\n if (isInSSRComponentSetup) {\n if (ssrCleanup) ssrCleanup.push(watchHandle);\n else if (runsImmediately) watchHandle();\n }\n return watchHandle;\n }\n function instanceWatch(source, value, options) {\n const publicThis = this.proxy;\n const getter = isString(source) ? source.includes(\".\") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);\n let cb;\n if (isFunction(value)) cb = value;\n else {\n cb = value.handler;\n options = value;\n }\n const reset = setCurrentInstance(this);\n const res = doWatch(getter, cb.bind(publicThis), options);\n reset();\n return res;\n }\n function createPathGetter(ctx, path) {\n const segments = path.split(\".\");\n return () => {\n let cur = ctx;\n for (let i = 0; i < segments.length && cur; i++) cur = cur[segments[i]];\n return cur;\n };\n }\n const isTeleport = (type) => type.__isTeleport;\n function findNonCommentChild(children) {\n let child = children[0];\n if (children.length > 1) {\n let hasFound = false;\n for (const c of children) if (c.type !== Comment) {\n if (!!(process.env.NODE_ENV !== \"production\") && hasFound) {\n warn$1(\"<transition> can only be used on a single element or component. Use <transition-group> for lists.\");\n break;\n }\n child = c;\n hasFound = true;\n if (!!!(process.env.NODE_ENV !== \"production\")) break;\n }\n }\n return child;\n }\n function getInnerChild$1(vnode) {\n if (!isKeepAlive(vnode)) {\n if (isTeleport(vnode.type) && vnode.children) return findNonCommentChild(vnode.children);\n return vnode;\n }\n if (vnode.component) return vnode.component.subTree;\n const { shapeFlag, children } = vnode;\n if (children) {\n if (shapeFlag & 16) return children[0];\n if (shapeFlag & 32 && isFunction(children.default)) return children.default();\n }\n }\n function setTransitionHooks(vnode, hooks) {\n if (vnode.shapeFlag & 6 && vnode.component) {\n vnode.transition = hooks;\n const subTree = vnode.component.subTree;\n setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);\n } else if (vnode.shapeFlag & 128) {\n vnode.ssContent.transition = hooks.clone(vnode.ssContent);\n vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);\n } else {\n vnode.transition = hooks;\n if (vnode.type === Fragment && isArray(vnode.children)) {\n const child = filterSingleRoot(vnode.children, false);\n if (child) setTransitionHooks(child, hooks);\n }\n }\n }\n getGlobalThis().requestIdleCallback;\n getGlobalThis().cancelIdleCallback;\n const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;\n const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for(\"v-ndc\");\n const getPublicInstance = (i) => {\n if (!i) return null;\n if (isStatefulComponent(i)) return getComponentPublicInstance(i);\n return getPublicInstance(i.parent);\n };\n const resolveDevRootEl = (vnode) => {\n let found = false;\n while (true) {\n if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {\n const root = filterSingleRoot(vnode.children);\n if (!root) return;\n vnode = root;\n found = true;\n continue;\n }\n const component = vnode.component;\n if (component && component.subTree) {\n vnode = component.subTree;\n continue;\n }\n const suspense = vnode.suspense;\n if (suspense && suspense.activeBranch) {\n vnode = suspense.activeBranch;\n continue;\n }\n return found ? vnode.el : void 0;\n }\n };\n const getDevRootFragmentEl = (i) => {\n const el = i.subTree && resolveDevRootEl(i.subTree);\n return el === void 0 ? i.vnode.el : el;\n };\n const publicPropertiesMap = /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {\n $: (i) => i,\n $el: (i) => !!(process.env.NODE_ENV !== \"production\") ? getDevRootFragmentEl(i) : i.vnode.el,\n $data: (i) => i.data,\n $props: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.props) : i.props,\n $attrs: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.attrs) : i.attrs,\n $slots: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.slots) : i.slots,\n $refs: (i) => !!(process.env.NODE_ENV !== \"production\") ? /* @__PURE__ */ shallowReadonly(i.refs) : i.refs,\n $parent: (i) => getPublicInstance(i.parent),\n $root: (i) => getPublicInstance(i.root),\n $host: (i) => i.ce,\n $emit: (i) => i.emit,\n $options: (i) => resolveMergedOptions(i),\n $forceUpdate: (i) => i.f || (i.f = () => {\n queueJob(i.update);\n }),\n $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),\n $watch: (i) => instanceWatch.bind(i)\n });\n const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);\n const PublicInstanceProxyHandlers = {\n get({ _: instance }, key) {\n if (key === \"__v_skip\") return true;\n const { ctx, setupState, data, props, accessCache, type, appContext } = instance;\n if (!!(process.env.NODE_ENV !== \"production\") && key === \"__isVue\") return true;\n if (key[0] !== \"$\") {\n const n = accessCache[key];\n if (n !== void 0) switch (n) {\n case 1: return setupState[key];\n case 2: return data[key];\n case 4: return ctx[key];\n case 3: return props[key];\n }\n else if (hasSetupBinding(setupState, key)) {\n accessCache[key] = 1;\n return setupState[key];\n } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {\n accessCache[key] = 2;\n return data[key];\n } else if (hasOwn(props, key)) {\n accessCache[key] = 3;\n return props[key];\n } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4;\n return ctx[key];\n } else if (shouldCacheAccess) accessCache[key] = 0;\n }\n const publicGetter = publicPropertiesMap[key];\n let cssModule, globalProperties;\n if (publicGetter) {\n if (key === \"$attrs\") {\n track(instance.attrs, \"get\", \"\");\n process.env.NODE_ENV;\n } else if (!!(process.env.NODE_ENV !== \"production\") && key === \"$slots\") track(instance, \"get\", key);\n return publicGetter(instance);\n } else if ((cssModule = type.__cssModules) && (cssModule = cssModule[key])) return cssModule;\n else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4;\n return ctx[key];\n } else if (globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) return globalProperties[key];\n else if (!!(process.env.NODE_ENV !== \"production\") && currentRenderingInstance);\n },\n set({ _: instance }, key, value) {\n const { data, setupState, ctx } = instance;\n if (hasSetupBinding(setupState, key)) {\n setupState[key] = value;\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\") && setupState.__isScriptSetup && hasOwn(setupState, key)) {\n warn$1(`Cannot mutate <script setup> binding \"${key}\" from Options API.`);\n return false;\n } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {\n data[key] = value;\n return true;\n } else if (hasOwn(instance.props, key)) {\n process.env.NODE_ENV !== \"production\" && warn$1(`Attempting to mutate prop \"${key}\". Props are readonly.`);\n return false;\n }\n if (key[0] === \"$\" && key.slice(1) in instance) {\n process.env.NODE_ENV !== \"production\" && warn$1(`Attempting to mutate public property \"${key}\". Properties starting with $ are reserved and readonly.`);\n return false;\n } else if (!!(process.env.NODE_ENV !== \"production\") && key in instance.appContext.config.globalProperties) Object.defineProperty(ctx, key, {\n enumerable: true,\n configurable: true,\n value\n });\n else ctx[key] = value;\n return true;\n },\n has({ _: { data, setupState, accessCache, ctx, appContext, props, type } }, key) {\n let cssModules;\n return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== \"$\" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);\n },\n defineProperty(target, key, descriptor) {\n if (descriptor.get != null) target._.accessCache[key] = 0;\n else if (hasOwn(descriptor, \"value\")) this.set(target, key, descriptor.value, null);\n return Reflect.defineProperty(target, key, descriptor);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\") && true) PublicInstanceProxyHandlers.ownKeys = (target) => {\n warn$1(`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`);\n return Reflect.ownKeys(target);\n };\n function normalizePropsOrEmits(props) {\n return isArray(props) ? props.reduce((normalized, p) => (normalized[p] = null, normalized), {}) : props;\n }\n let shouldCacheAccess = true;\n function resolveMergedOptions(instance) {\n const base = instance.type;\n const { mixins, extends: extendsOptions } = base;\n const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;\n const cached = cache.get(base);\n let resolved;\n if (cached) resolved = cached;\n else if (!globalMixins.length && !mixins && !extendsOptions) resolved = base;\n else {\n resolved = {};\n if (globalMixins.length) globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));\n mergeOptions(resolved, base, optionMergeStrategies);\n }\n if (isObject(base)) cache.set(base, resolved);\n return resolved;\n }\n function mergeOptions(to, from, strats, asMixin = false) {\n const { mixins, extends: extendsOptions } = from;\n if (extendsOptions) mergeOptions(to, extendsOptions, strats, true);\n if (mixins) mixins.forEach((m) => mergeOptions(to, m, strats, true));\n for (const key in from) if (asMixin && key === \"expose\") process.env.NODE_ENV !== \"production\" && warn$1(`\"expose\" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`);\n else {\n const strat = internalOptionMergeStrats[key] || strats && strats[key];\n to[key] = strat ? strat(to[key], from[key]) : from[key];\n }\n return to;\n }\n const internalOptionMergeStrats = {\n data: mergeDataFn,\n props: mergeEmitsOrPropsOptions,\n emits: mergeEmitsOrPropsOptions,\n methods: mergeObjectOptions,\n computed: mergeObjectOptions,\n beforeCreate: mergeAsArray,\n created: mergeAsArray,\n beforeMount: mergeAsArray,\n mounted: mergeAsArray,\n beforeUpdate: mergeAsArray,\n updated: mergeAsArray,\n beforeDestroy: mergeAsArray,\n beforeUnmount: mergeAsArray,\n destroyed: mergeAsArray,\n unmounted: mergeAsArray,\n activated: mergeAsArray,\n deactivated: mergeAsArray,\n errorCaptured: mergeAsArray,\n serverPrefetch: mergeAsArray,\n components: mergeObjectOptions,\n directives: mergeObjectOptions,\n watch: mergeWatchOptions,\n provide: mergeDataFn,\n inject: mergeInject\n };\n function mergeDataFn(to, from) {\n if (!from) return to;\n if (!to) return from;\n return function mergedDataFn() {\n return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);\n };\n }\n function mergeInject(to, from) {\n return mergeObjectOptions(normalizeInject(to), normalizeInject(from));\n }\n function normalizeInject(raw) {\n if (isArray(raw)) {\n const res = {};\n for (let i = 0; i < raw.length; i++) res[raw[i]] = raw[i];\n return res;\n }\n return raw;\n }\n function mergeAsArray(to, from) {\n return to ? [...new Set([].concat(to, from))] : from;\n }\n function mergeObjectOptions(to, from) {\n return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;\n }\n function mergeEmitsOrPropsOptions(to, from) {\n if (to) {\n if (isArray(to) && isArray(from)) return [.../* @__PURE__ */ new Set([...to, ...from])];\n return extend(/* @__PURE__ */ Object.create(null), normalizePropsOrEmits(to), normalizePropsOrEmits(from != null ? from : {}));\n } else return from;\n }\n function mergeWatchOptions(to, from) {\n if (!to) return from;\n if (!from) return to;\n const merged = extend(/* @__PURE__ */ Object.create(null), to);\n for (const key in from) merged[key] = mergeAsArray(to[key], from[key]);\n return merged;\n }\n let currentApp = null;\n function filterSingleRoot(children, recurse = true) {\n let singleRoot;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (isVNode(child)) {\n if (child.type !== Comment || child.children === \"v-if\") {\n if (singleRoot) return;\n else {\n singleRoot = child;\n if (!!(process.env.NODE_ENV !== \"production\") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) return filterSingleRoot(singleRoot.children);\n }\n }\n } else return;\n }\n return singleRoot;\n }\n const internalObjectProto = {};\n const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;\n const queuePostRenderEffect = queueEffectWithSuspense;\n const isSuspense = (type) => type.__isSuspense;\n function queueEffectWithSuspense(fn, suspense) {\n if (suspense && suspense.pendingBranch) {\n if (isArray(fn)) suspense.effects.push(...fn);\n else suspense.effects.push(fn);\n } else queuePostFlushCb(fn);\n }\n const Fragment = /* @__PURE__ */ Symbol.for(\"v-fgt\");\n const Text = /* @__PURE__ */ Symbol.for(\"v-txt\");\n const Comment = /* @__PURE__ */ Symbol.for(\"v-cmt\");\n function isVNode(value) {\n return value ? value.__v_isVNode === true : false;\n }\n const createVNodeWithArgsTransform = (...args) => {\n return _createVNode(...args);\n };\n const normalizeKey = ({ key }) => key != null ? key : null;\n const normalizeRef = ({ ref, ref_key, ref_for }) => {\n if (typeof ref === \"number\") ref = \"\" + ref;\n return ref != null ? isString(ref) || /* @__PURE__ */ isRef(ref) || isFunction(ref) ? {\n i: currentRenderingInstance,\n r: ref,\n k: ref_key,\n f: !!ref_for\n } : ref : null;\n };\n function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {\n const vnode = {\n __v_isVNode: true,\n __v_skip: true,\n type,\n props,\n key: props && normalizeKey(props),\n ref: props && normalizeRef(props),\n scopeId: currentScopeId,\n slotScopeIds: null,\n children,\n component: null,\n suspense: null,\n ssContent: null,\n ssFallback: null,\n dirs: null,\n transition: null,\n el: null,\n anchor: null,\n target: null,\n targetStart: null,\n targetAnchor: null,\n staticCount: 0,\n shapeFlag,\n patchFlag,\n dynamicProps,\n dynamicChildren: null,\n appContext: null,\n ctx: currentRenderingInstance\n };\n if (needFullChildrenNormalization) {\n normalizeChildren(vnode, children);\n if (shapeFlag & 128) type.normalize(vnode);\n } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;\n if (!!(process.env.NODE_ENV !== \"production\") && vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);\n if (!!(process.env.NODE_ENV !== \"production\") && props && vnode.shapeFlag & 1) {\n const overwritingProp = props.innerHTML != null ? \"innerHTML\" : props.textContent != null ? \"textContent\" : null;\n if (overwritingProp && hasContentChildren(vnode.children)) warn$1(`The \\`${overwritingProp}\\` prop on <${vnode.type}> will override its children. Remove either the \\`${overwritingProp}\\` prop or the children.`);\n }\n return vnode;\n }\n function hasContentChildren(children) {\n if (isString(children)) return children !== \"\";\n if (isArray(children)) return children.length > 0;\n return false;\n }\n const createVNode = !!(process.env.NODE_ENV !== \"production\") ? createVNodeWithArgsTransform : _createVNode;\n function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {\n if (!type || type === NULL_DYNAMIC_COMPONENT) {\n if (!!(process.env.NODE_ENV !== \"production\") && !type) warn$1(`Invalid vnode type when creating vnode: ${type}.`);\n type = Comment;\n }\n if (isVNode(type)) {\n const cloned = cloneVNode(type, props, true);\n if (children) normalizeChildren(cloned, children);\n cloned.patchFlag = -2;\n return cloned;\n }\n if (isClassComponent(type)) type = type.__vccOpts;\n if (props) {\n props = guardReactiveProps(props);\n let { class: klass, style } = props;\n if (klass && !isString(klass)) props.class = normalizeClass(klass);\n if (isObject(style)) {\n if (/* @__PURE__ */ isProxy(style) && !isArray(style)) style = extend({}, style);\n props.style = normalizeStyle(style);\n }\n }\n const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;\n if (!!(process.env.NODE_ENV !== \"production\") && shapeFlag & 4 && /* @__PURE__ */ isProxy(type)) {\n type = /* @__PURE__ */ toRaw(type);\n warn$1(`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \\`markRaw\\` or using \\`shallowRef\\` instead of \\`ref\\`.`, `\nComponent that was made reactive: `, type);\n }\n return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);\n }\n function guardReactiveProps(props) {\n if (!props) return null;\n return /* @__PURE__ */ isProxy(props) || isInternalObject(props) ? extend({}, props) : props;\n }\n function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {\n const { props, ref, patchFlag, children, transition } = vnode;\n const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;\n const cloned = {\n __v_isVNode: true,\n __v_skip: true,\n type: vnode.type,\n props: mergedProps,\n key: mergedProps && normalizeKey(mergedProps),\n ref: extraProps && extraProps.ref ? mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,\n scopeId: vnode.scopeId,\n slotScopeIds: vnode.slotScopeIds,\n children: !!(process.env.NODE_ENV !== \"production\") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,\n target: vnode.target,\n targetStart: vnode.targetStart,\n targetAnchor: vnode.targetAnchor,\n staticCount: vnode.staticCount,\n shapeFlag: vnode.shapeFlag,\n patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,\n dynamicProps: vnode.dynamicProps,\n dynamicChildren: vnode.dynamicChildren,\n appContext: vnode.appContext,\n dirs: vnode.dirs,\n transition,\n component: vnode.component,\n suspense: vnode.suspense,\n ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),\n ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),\n placeholder: vnode.placeholder,\n el: vnode.el,\n anchor: vnode.anchor,\n ctx: vnode.ctx,\n ce: vnode.ce,\n cacheIndex: vnode.cacheIndex\n };\n if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));\n return cloned;\n }\n function deepCloneVNode(vnode) {\n const cloned = cloneVNode(vnode);\n if (isArray(vnode.children)) cloned.children = vnode.children.map(deepCloneVNode);\n return cloned;\n }\n function createTextVNode(text = \" \", flag = 0) {\n return createVNode(Text, null, text, flag);\n }\n function normalizeChildren(vnode, children) {\n let type = 0;\n const { shapeFlag } = vnode;\n if (children == null) children = null;\n else if (isArray(children)) type = 16;\n else if (typeof children === \"object\") {\n if (shapeFlag & 65) {\n const slot = children.default;\n if (slot) {\n slot._c && (slot._d = false);\n normalizeChildren(vnode, slot());\n slot._c && (slot._d = true);\n }\n return;\n } else {\n type = 32;\n if (!children._ && !isInternalObject(children)) children._ctx = currentRenderingInstance;\n }\n } else if (isFunction(children)) {\n if (shapeFlag & 65) {\n normalizeChildren(vnode, { default: children });\n return;\n }\n children = {\n default: children,\n _ctx: currentRenderingInstance\n };\n type = 32;\n } else {\n children = String(children);\n if (shapeFlag & 64) {\n type = 16;\n children = [createTextVNode(children)];\n } else type = 8;\n }\n vnode.children = children;\n vnode.shapeFlag |= type;\n }\n function mergeProps(...args) {\n const ret = {};\n for (let i = 0; i < args.length; i++) {\n const toMerge = args[i];\n for (const key in toMerge) if (key === \"class\") {\n if (ret.class !== toMerge.class) ret.class = normalizeClass([ret.class, toMerge.class]);\n } else if (key === \"style\") ret.style = normalizeStyle([ret.style, toMerge.style]);\n else if (isOn(key)) {\n const existing = ret[key];\n const incoming = toMerge[key];\n if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;\n else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;\n } else if (key !== \"\") ret[key] = toMerge[key];\n }\n return ret;\n }\n let currentInstance = null;\n const getCurrentInstance = () => currentInstance || currentRenderingInstance;\n let internalSetCurrentInstance;\n {\n const g = getGlobalThis();\n const registerGlobalSetter = (key, setter) => {\n let setters;\n if (!(setters = g[key])) setters = g[key] = [];\n setters.push(setter);\n return (v) => {\n if (setters.length > 1) setters.forEach((set) => set(v));\n else setters[0](v);\n };\n };\n internalSetCurrentInstance = registerGlobalSetter(`__VUE_INSTANCE_SETTERS__`, (v) => currentInstance = v);\n registerGlobalSetter(`__VUE_SSR_SETTERS__`, (v) => isInSSRComponentSetup = v);\n }\n const setCurrentInstance = (instance) => {\n const prev = currentInstance;\n internalSetCurrentInstance(instance);\n instance.scope.on();\n return () => {\n instance.scope.off();\n internalSetCurrentInstance(prev);\n };\n };\n function isStatefulComponent(instance) {\n return instance.vnode.shapeFlag & 4;\n }\n let isInSSRComponentSetup = false;\n process.env.NODE_ENV;\n function getComponentPublicInstance(instance) {\n if (instance.exposed) return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {\n get(target, key) {\n if (key in target) return target[key];\n else if (key in publicPropertiesMap) return publicPropertiesMap[key](instance);\n },\n has(target, key) {\n return key in target || key in publicPropertiesMap;\n }\n }));\n else return instance.proxy;\n }\n const classifyRE = /(?:^|[-_])\\w/g;\n const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, \"\");\n function getComponentName(Component, includeInferred = true) {\n return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;\n }\n function formatComponentName(instance, Component, isRoot = false) {\n let name = getComponentName(Component);\n if (!name && Component.__file) {\n const match = Component.__file.match(/([^/\\\\]+)\\.\\w+$/);\n if (match) name = match[1];\n }\n if (!name && instance) {\n const inferFromRegistry = (registry) => {\n for (const key in registry) if (registry[key] === Component) return key;\n };\n name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(instance.parent.type.components) || inferFromRegistry(instance.appContext.components);\n }\n return name ? classify(name) : isRoot ? `App` : `Anonymous`;\n }\n function isClassComponent(value) {\n return isFunction(value) && \"__vccOpts\" in value;\n }\n function initCustomFormatter() {\n if (!!!(process.env.NODE_ENV !== \"production\") || typeof window === \"undefined\") return;\n const vueStyle = { style: \"color:#3ba776\" };\n const numberStyle = { style: \"color:#1677ff\" };\n const stringStyle = { style: \"color:#f5222d\" };\n const keywordStyle = { style: \"color:#eb2f96\" };\n const formatter = {\n __vue_custom_formatter: true,\n header(obj) {\n if (!isObject(obj)) return null;\n if (obj.__isVue) return [\n \"div\",\n vueStyle,\n `VueInstance`\n ];\n else if (/* @__PURE__ */ isRef(obj)) {\n pauseTracking();\n const value = obj.value;\n resetTracking();\n return [\n \"div\",\n {},\n [\n \"span\",\n vueStyle,\n genRefFlag(obj)\n ],\n \"<\",\n formatValue(value),\n `>`\n ];\n } else if (/* @__PURE__ */ isReactive(obj)) return [\n \"div\",\n {},\n [\n \"span\",\n vueStyle,\n /* @__PURE__ */ isShallow(obj) ? \"ShallowReactive\" : \"Reactive\"\n ],\n \"<\",\n formatValue(obj),\n `>${/* @__PURE__ */ isReadonly(obj) ? ` (readonly)` : ``}`\n ];\n else if (/* @__PURE__ */ isReadonly(obj)) return [\n \"div\",\n {},\n [\n \"span\",\n vueStyle,\n /* @__PURE__ */ isShallow(obj) ? \"ShallowReadonly\" : \"Readonly\"\n ],\n \"<\",\n formatValue(obj),\n \">\"\n ];\n return null;\n },\n hasBody(obj) {\n return obj && obj.__isVue;\n },\n body(obj) {\n if (obj && obj.__isVue) return [\n \"div\",\n {},\n ...formatInstance(obj.$)\n ];\n }\n };\n function formatInstance(instance) {\n const blocks = [];\n if (instance.type.props && instance.props) blocks.push(createInstanceBlock(\"props\", /* @__PURE__ */ toRaw(instance.props)));\n if (instance.setupState !== EMPTY_OBJ) blocks.push(createInstanceBlock(\"setup\", instance.setupState));\n if (instance.data !== EMPTY_OBJ) blocks.push(createInstanceBlock(\"data\", /* @__PURE__ */ toRaw(instance.data)));\n const computed = extractKeys(instance, \"computed\");\n if (computed) blocks.push(createInstanceBlock(\"computed\", computed));\n const injected = extractKeys(instance, \"inject\");\n if (injected) blocks.push(createInstanceBlock(\"injected\", injected));\n blocks.push([\n \"div\",\n {},\n [\n \"span\",\n { style: keywordStyle.style + \";opacity:0.66\" },\n \"$ (internal): \"\n ],\n [\"object\", { object: instance }]\n ]);\n return blocks;\n }\n function createInstanceBlock(type, target) {\n target = extend({}, target);\n if (!Object.keys(target).length) return [\"span\", {}];\n return [\n \"div\",\n { style: \"line-height:1.25em;margin-bottom:0.6em\" },\n [\n \"div\",\n { style: \"color:#476582\" },\n type\n ],\n [\n \"div\",\n { style: \"padding-left:1.25em\" },\n ...Object.keys(target).map((key) => {\n return [\n \"div\",\n {},\n [\n \"span\",\n keywordStyle,\n key + \": \"\n ],\n formatValue(target[key], false)\n ];\n })\n ]\n ];\n }\n function formatValue(v, asRaw = true) {\n if (typeof v === \"number\") return [\n \"span\",\n numberStyle,\n v\n ];\n else if (typeof v === \"string\") return [\n \"span\",\n stringStyle,\n JSON.stringify(v)\n ];\n else if (typeof v === \"boolean\") return [\n \"span\",\n keywordStyle,\n v\n ];\n else if (isObject(v)) return [\"object\", { object: asRaw ? /* @__PURE__ */ toRaw(v) : v }];\n else return [\n \"span\",\n stringStyle,\n String(v)\n ];\n }\n function extractKeys(instance, type) {\n const Comp = instance.type;\n if (isFunction(Comp)) return;\n const extracted = {};\n for (const key in instance.ctx) if (isKeyOfType(Comp, key, type)) extracted[key] = instance.ctx[key];\n return extracted;\n }\n function isKeyOfType(Comp, key, type) {\n const opts = Comp[type];\n if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) return true;\n if (Comp.extends && isKeyOfType(Comp.extends, key, type)) return true;\n if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) return true;\n }\n function genRefFlag(v) {\n if (/* @__PURE__ */ isShallow(v)) return `ShallowRef`;\n if (v.effect) return `ComputedRef`;\n return `Ref`;\n }\n if (window.devtoolsFormatters) window.devtoolsFormatters.push(formatter);\n else window.devtoolsFormatters = [formatter];\n }\n process.env.NODE_ENV;\n process.env.NODE_ENV;\n process.env.NODE_ENV;\n // ../../node_modules/.bun/vue@3.5.44+7524df1edfed9f02/node_modules/vue/dist/vue.runtime.esm-bundler.js\n /**\n * vue v3.5.44\n * (c) 2018-present Yuxi (Evan) You and Vue contributors\n * @license MIT\n **/\n function initDev() {\n initCustomFormatter();\n }\n if (!!(process.env.NODE_ENV !== \"production\")) initDev();\n // src/core/text.ts\n /**\n * The document text: an immutable, balanced tree of lines.\n *\n * Leaves hold up to `LEAF_MAX` lines, branches up to `BRANCH_MAX` children,\n * and every node knows its length and line count, so finding a line by\n * number or by offset walks one path from the root: O(log n). An edit copies\n * only that path and shares everything else with the old text, so keeping\n * old versions around (undo, a `v-model:doc` snapshot) costs next to\n * nothing.\n *\n * Offsets count UTF-16 code units, like the browser and language servers.\n * Lines are numbered from 1 and are joined by one `\\n`; a `\\r\\n` or a lone\n * `\\r` in the input becomes `\\n`.\n */\n const LEAF_MAX = 64;\n const LEAF_MIN = 16;\n const BRANCH_MAX = 32;\n const BRANCH_MIN = 8;\n /** New leaves and branches start half full, so the next edits rarely split them. */\n const LEAF_FILL = 32;\n const BRANCH_FILL = 16;\n var Leaf = class {\n text;\n length;\n /** The longest line, in code units. */\n widest;\n constructor(text) {\n this.text = text;\n let length = text.length - 1;\n let widest = 0;\n for (const line of text) {\n length += line.length;\n if (line.length > widest) widest = line.length;\n }\n this.length = length;\n this.widest = widest;\n }\n get lines() {\n return this.text.length;\n }\n };\n var Branch = class {\n children;\n length;\n lines;\n widest;\n constructor(children) {\n this.children = children;\n let length = children.length - 1;\n let lines = 0;\n let widest = 0;\n for (const child of children) {\n length += child.length;\n lines += child.lines;\n if (child.widest > widest) widest = child.widest;\n }\n this.length = length;\n this.lines = lines;\n this.widest = widest;\n }\n };\n const isSmall = (node) => node instanceof Leaf ? node.text.length < LEAF_MIN : node.children.length < BRANCH_MIN;\n /** Cuts a list into nodes of about `fill` items each; never one smaller than half of it. */\n function chunk(items, fill, max, make) {\n if (items.length <= max) return [make(items)];\n const count = Math.ceil(items.length / fill);\n const size = Math.ceil(items.length / count);\n const out = [];\n for (let i = 0; i < items.length; i += size) out.push(make(items.slice(i, i + size)));\n return out;\n }\n const leaves = (lines) => chunk(lines, LEAF_FILL, LEAF_MAX, (part) => new Leaf(part));\n const branches = (nodes) => chunk(nodes, BRANCH_FILL, BRANCH_MAX, (part) => new Branch(part));\n /** Stacks nodes of one height into a single root. */\n function root(nodes) {\n while (nodes.length > 1) nodes = branches(nodes);\n let node = nodes[0] ?? new Leaf([\"\"]);\n while (node instanceof Branch && node.children.length === 1) node = node.children[0];\n return node;\n }\n /** Joins two neighbours of the same height and cuts the result again if it grew too big. */\n function merge(a, b) {\n if (a instanceof Leaf && b instanceof Leaf) return leaves([...a.text, ...b.text]);\n return branches([...a.children, ...b.children]);\n }\n /** Merges every small node into a neighbour, so the tree stays shallow after deletes. */\n function settle(nodes) {\n if (nodes.length < 2 || !nodes.some(isSmall)) return nodes;\n const out = [];\n for (const node of nodes) {\n const last = out[out.length - 1];\n if (last && (isSmall(last) || isSmall(node))) out.splice(-1, 1, ...merge(last, node));\n else out.push(node);\n }\n return out;\n }\n /**\n * Replaces `count` lines from line index `at` (from 0) with `insert`, and\n * returns the nodes that take this one's place, all of its height.\n */\n function splice(node, at, count, insert) {\n if (node instanceof Leaf) {\n const text = node.text.slice(0, at).concat(insert, node.text.slice(at + count));\n return text.length ? leaves(text) : [];\n }\n const children = [];\n let start = 0;\n let pending = insert;\n const last = node.children.length - 1;\n node.children.forEach((child, i) => {\n const end = start + child.lines;\n const holds = at < end || i === last && at === end;\n const overlaps = count > 0 && at < end && at + count > start;\n if (pending && holds && at >= start || overlaps) {\n const from = Math.max(at - start, 0);\n const to = Math.min(at + count - start, child.lines);\n children.push(...splice(child, from, Math.max(to - from, 0), pending ?? []));\n pending = null;\n } else children.push(child);\n start = end;\n });\n const settled = settle(children);\n if (!settled.length) return [];\n return branches(settled);\n }\n /**\n * Each node's text, kept once asked for. Nodes never change and an edit\n * makes new ones only along one path, so joining the whole text again\n * after an edit only joins that path: the engine strings together the\n * kept parts without copying them.\n */\n const joined = /* @__PURE__ */ new WeakMap();\n function joinNode(node) {\n let text = joined.get(node);\n if (text !== void 0) return text;\n if (node instanceof Leaf) text = node.text.join(\"\\n\");\n else {\n text = joinNode(node.children[0]);\n for (let i = 1; i < node.children.length; i++) text += \"\\n\" + joinNode(node.children[i]);\n }\n joined.set(node, text);\n return text;\n }\n /** Collects the text of lines `from`–`to` (indices from 0, `to` exclusive). */\n function collect(node, from, to, out) {\n if (node instanceof Leaf) {\n for (let i = from; i < to; i++) out.push(node.text[i]);\n return;\n }\n let start = 0;\n for (const child of node.children) {\n const end = start + child.lines;\n if (end > from && start < to) collect(child, Math.max(from - start, 0), Math.min(to - start, child.lines), out);\n if (end >= to) return;\n start = end;\n }\n }\n /** Splits text into lines, reading `\\r\\n` and a lone `\\r` as line breaks too. */\n function splitLines(text) {\n return text.split(/\\r\\n?|\\n/);\n }\n /** Where a text keeps its tree; a symbol rather than a private field, so a `ref` around a text keeps its type. */\n const NODE = Symbol(\"node\");\n var CodeText = class CodeText {\n /** @internal */\n [NODE];\n constructor(node) {\n this[NODE] = node;\n markRaw(this);\n }\n /** The text of a string. */\n static of(text) {\n const lines = typeof text === \"string\" ? splitLines(text) : text.length ? text : [\"\"];\n const parts = leaves(lines);\n if (typeof text === \"string\" && !text.includes(\"\\r\")) {\n let at = 0;\n for (const leaf of parts) {\n joined.set(leaf, text.slice(at, at + leaf.length));\n at += leaf.length + 1;\n }\n }\n return new CodeText(root(parts));\n }\n /** An empty text: one empty line. */\n static empty = CodeText.of(\"\");\n /** Length in UTF-16 code units, counting one per line break. */\n get length() {\n return this[NODE].length;\n }\n /** The number of lines, at least 1. */\n get lines() {\n return this[NODE].lines;\n }\n /** The length of the longest line, in code units. */\n get widest() {\n return this[NODE].widest;\n }\n /** Line `n`, counting from 1. */\n line(n) {\n if (n < 1 || n > this.lines) throw new RangeError(`[@dou-ui/code] line ${n} is outside 1–${this.lines}`);\n let node = this[NODE];\n let index = n - 1;\n let from = 0;\n while (node instanceof Branch) for (const child of node.children) {\n if (index < child.lines) {\n node = child;\n break;\n }\n index -= child.lines;\n from += child.length + 1;\n }\n for (let i = 0; i < index; i++) from += node.text[i].length + 1;\n const text = node.text[index];\n return {\n number: n,\n from,\n to: from + text.length,\n text\n };\n }\n /** The text of line `n` (from 1); quicker than `line(n).text`, which also finds where it starts. */\n lineText(n) {\n if (n < 1 || n > this.lines) throw new RangeError(`[@dou-ui/code] line ${n} is outside 1–${this.lines}`);\n let node = this[NODE];\n let index = n - 1;\n while (node instanceof Branch) for (const child of node.children) {\n if (index < child.lines) {\n node = child;\n break;\n }\n index -= child.lines;\n }\n return node.text[index];\n }\n /** The line that holds offset `pos`; a line break belongs to the line before it. */\n lineAt(pos) {\n if (pos < 0 || pos > this.length) throw new RangeError(`[@dou-ui/code] offset ${pos} is outside 0–${this.length}`);\n let node = this[NODE];\n let from = 0;\n let number = 1;\n while (node instanceof Branch) for (const child of node.children) {\n const end = from + child.length;\n if (pos <= end) {\n node = child;\n break;\n }\n from = end + 1;\n number += child.lines;\n }\n for (const text of node.text) {\n const end = from + text.length;\n if (pos <= end) return {\n number,\n from,\n to: end,\n text\n };\n from = end + 1;\n number++;\n }\n throw new RangeError(`[@dou-ui/code] offset ${pos} not found`);\n }\n /** The text of lines `from`–`to`, both counted from 1 and included. */\n lineTexts(from, to = from) {\n const out = [];\n from = Math.max(from, 1);\n to = Math.min(to, this.lines);\n if (from <= to) collect(this[NODE], from - 1, to, out);\n return out;\n }\n /** The text between two offsets. */\n slice(from = 0, to = this.length) {\n from = Math.max(0, from);\n to = Math.min(this.length, to);\n if (from >= to) return \"\";\n const start = this.lineAt(from);\n if (to <= start.to) return start.text.slice(from - start.from, to - start.from);\n const end = this.lineAt(to);\n const lines = this.lineTexts(start.number, end.number);\n lines[0] = lines[0].slice(from - start.from);\n lines[lines.length - 1] = lines[lines.length - 1].slice(0, to - end.from);\n return lines.join(\"\\n\");\n }\n /** A new text with `from`–`to` replaced by `insert`; this one stays as it is. */\n replace(from, to, insert) {\n if (from < 0 || to > this.length || from > to) throw new RangeError(`[@dou-ui/code] range ${from}–${to} is outside 0–${this.length}`);\n const lines = typeof insert === \"string\" ? splitLines(insert) : insert;\n if (from === to && lines.length === 1 && !lines[0]) return this;\n const start = this.lineAt(from);\n const end = to <= start.to ? start : this.lineAt(to);\n const head = start.text.slice(0, from - start.from);\n const tail = end.text.slice(to - end.from);\n const next = lines.slice();\n next[0] = head + next[0];\n next[next.length - 1] += tail;\n const nodes = splice(this[NODE], start.number - 1, end.number - start.number + 1, next);\n return new CodeText(root(nodes));\n }\n /** Every line, from 1 to the end. */\n toLines() {\n return this.lineTexts(1, this.lines);\n }\n /** The whole text, with `\\n` between lines. */\n toString() {\n return joinNode(this[NODE]);\n }\n /** Whether two texts hold the same characters. */\n eq(other) {\n if (other === this) return true;\n if (other.length !== this.length || other.lines !== this.lines) return false;\n const a = this.toLines();\n const b = other.toLines();\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n }\n };\n // src/core/diff.ts\n /**\n * The middle of the shortest edit path from `a[aLo..aHi)` to `b[bLo..bHi)`,\n * found from both ends at once (Myers, linear space), or `null` when the\n * two share nothing or it costs more than `maxCost` steps.\n */\n function bisect(a, aLo, aHi, b, bLo, bHi, maxCost) {\n const n = aHi - aLo;\n const m = bHi - bLo;\n const maxD = Math.min(Math.ceil((n + m) / 2), maxCost);\n const offset = maxD + 1;\n const size = 2 * offset + 1;\n const v1 = new Int32Array(size).fill(-1);\n const v2 = new Int32Array(size).fill(-1);\n v1[offset + 1] = 0;\n v2[offset + 1] = 0;\n const delta = n - m;\n const front = (delta & 1) !== 0;\n let k1start = 0;\n let k1end = 0;\n let k2start = 0;\n let k2end = 0;\n for (let d = 0; d < maxD; d++) {\n for (let k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n const i = offset + k1;\n let x1 = k1 === -d || k1 !== d && v1[i - 1] < v1[i + 1] ? v1[i + 1] : v1[i - 1] + 1;\n let y1 = x1 - k1;\n while (x1 < n && y1 < m && a[aLo + x1] === b[bLo + y1]) {\n x1++;\n y1++;\n }\n v1[i] = x1;\n if (x1 > n) k1end += 2;\n else if (y1 > m) k1start += 2;\n else if (front) {\n const j = offset + delta - k1;\n if (j >= 0 && j < size && v2[j] !== -1 && x1 >= n - v2[j]) return [x1, y1];\n }\n }\n for (let k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n const i = offset + k2;\n let x2 = k2 === -d || k2 !== d && v2[i - 1] < v2[i + 1] ? v2[i + 1] : v2[i - 1] + 1;\n let y2 = x2 - k2;\n while (x2 < n && y2 < m && a[aHi - x2 - 1] === b[bHi - y2 - 1]) {\n x2++;\n y2++;\n }\n v2[i] = x2;\n if (x2 > n) k2end += 2;\n else if (y2 > m) k2start += 2;\n else if (!front) {\n const j = offset + delta - k2;\n if (j >= 0 && j < size && v1[j] !== -1) {\n const x1 = v1[j];\n const y1 = x1 - (j - offset);\n if (x1 >= n - x2) return [x1, y1];\n }\n }\n }\n }\n return null;\n }\n /** The changes from `a[aLo..aHi)` to `b[bLo..bHi)`, in order, pushed to `out`. */\n function diffRange(a, aLo, aHi, b, bLo, bHi, maxCost, out) {\n while (aLo < aHi && bLo < bHi && a[aLo] === b[bLo]) {\n aLo++;\n bLo++;\n }\n while (aLo < aHi && bLo < bHi && a[aHi - 1] === b[bHi - 1]) {\n aHi--;\n bHi--;\n }\n if (aLo === aHi && bLo === bHi) return;\n if (aLo === aHi || bLo === bHi) {\n out.push([\n aLo,\n aHi,\n bLo,\n bHi\n ]);\n return;\n }\n const split = bisect(a, aLo, aHi, b, bLo, bHi, maxCost);\n if (!split) {\n out.push([\n aLo,\n aHi,\n bLo,\n bHi\n ]);\n return;\n }\n diffRange(a, aLo, aLo + split[0], b, bLo, bLo + split[1], maxCost, out);\n diffRange(a, aLo + split[0], aHi, b, bLo + split[1], bHi, maxCost, out);\n }\n /** The changes between two lists, items compared with `===`, with touching ones joined. */\n function diffLists(a, b, maxCost) {\n const raw = [];\n diffRange(a, 0, a.length, b, 0, b.length, maxCost, raw);\n const out = [];\n for (const change of raw) {\n const last = out[out.length - 1];\n if (last && last[1] === change[0] && last[3] === change[2]) {\n last[1] = change[1];\n last[3] = change[3];\n } else out.push(change);\n }\n return out;\n }\n /** Words, runs of spaces, and single other characters (each CJK character on its own). */\n const TOKEN = /[\\p{L}\\p{N}_$]+|\\s+|[^]/gu;\n const CJK = /[⺀-鿿豈--]/u;\n function tokenize(text) {\n const tokens = [];\n const starts = [];\n for (const match of text.matchAll(TOKEN)) {\n const word = match[0];\n if (word.length > 1 && CJK.test(word)) for (let i = 0; i < word.length; i++) {\n tokens.push(word[i]);\n starts.push(match.index + i);\n }\n else {\n tokens.push(word);\n starts.push(match.index);\n }\n }\n starts.push(text.length);\n return {\n tokens,\n starts\n };\n }\n /** Above this many characters on both sides together, a block's words aren't compared. */\n const WORDS_LIMIT = 2e4;\n /** The words that differ between two blocks of text, at offsets `aBase` and `bBase`. */\n function diffWords(a, aBase, b, bBase, maxCost) {\n if (a.length + b.length > WORDS_LIMIT) return [];\n const ta = tokenize(a);\n const tb = tokenize(b);\n const changes = diffLists(ta.tokens, tb.tokens, maxCost);\n const joined = [];\n for (const change of changes) {\n const last = joined[joined.length - 1];\n if (last) {\n const gap = ta.starts[change[0]] - ta.starts[last[1]];\n const gapText = a.slice(ta.starts[last[1]], ta.starts[change[0]]);\n if (gap <= 1 || /^[ \\t]+$/.test(gapText)) {\n last[1] = change[1];\n last[3] = change[3];\n continue;\n }\n }\n joined.push([...change]);\n }\n let same = a.length;\n for (const [aFrom, aTo] of joined) same -= ta.starts[aTo] - ta.starts[aFrom];\n if (same < Math.min(a.length, b.length) * .3) return [];\n return joined.map(([aFrom, aTo, bFrom, bTo]) => ({\n original: {\n from: aBase + ta.starts[aFrom],\n to: aBase + ta.starts[aTo]\n },\n modified: {\n from: bBase + tb.starts[bFrom],\n to: bBase + tb.starts[bTo]\n }\n }));\n }\n /** The lines of a text; a plain split when there is no `\\r`, which is much faster. */\n const linesOf = (text) => text.includes(\"\\r\") ? splitLines(text) : text.split(\"\\n\");\n const squeeze = (text) => text.replace(/\\s+/g, \" \").trim();\n /** Where each line starts in the text, plus where the text would go on after the last one. */\n function lineStarts(lines) {\n const starts = [];\n let pos = 0;\n for (const line of lines) {\n starts.push(pos);\n pos += line.length + 1;\n }\n starts.push(pos);\n return starts;\n }\n /**\n * The blocks of lines that differ between `original` and `modified`, in\n * order, each with the words that differ inside it. Lines are compared\n * whole (Myers' algorithm, in linear space).\n */\n function diffText(original, modified, options = {}) {\n const maxCost = options.maxCost ?? 1e3;\n const aLines = linesOf(original);\n const bLines = linesOf(modified);\n const changes = options.ignoreWhitespace ? diffLists(aLines.map(squeeze), bLines.map(squeeze), maxCost) : diffLists(aLines, bLines, maxCost);\n const aStarts = lineStarts(aLines);\n const bStarts = lineStarts(bLines);\n const words = options.words !== false;\n return changes.map(([aFrom, aTo, bFrom, bTo]) => {\n const hunk = {\n originalStart: aFrom + 1,\n originalCount: aTo - aFrom,\n modifiedStart: bFrom + 1,\n modifiedCount: bTo - bFrom,\n parts: []\n };\n if (words && aTo > aFrom && bTo > bFrom) {\n const aText = aLines.slice(aFrom, aTo).join(\"\\n\");\n const bText = bLines.slice(bFrom, bTo).join(\"\\n\");\n hunk.parts = diffWords(aText, aStarts[aFrom], bText, bStarts[bFrom], maxCost);\n }\n return hunk;\n });\n }\n // src/language/stream.ts\n /**\n * A cursor over one line, handed to a language's `token` function. The\n * function reads one token from `pos` onward (at least one character) and\n * returns its kind; whatever it read becomes that token.\n */\n var CodeStream = class {\n string;\n tabSize;\n /** Where the current token starts. */\n start = 0;\n /** Where reading continues. */\n pos = 0;\n /** Where this stream ends; a nesting language ends it early, e.g. at `<\\/script>`. */\n end;\n constructor(string, tabSize = 2) {\n this.string = string;\n this.tabSize = tabSize;\n this.end = string.length;\n }\n /** Whether the line is read to its end. */\n eol() {\n return this.pos >= this.end;\n }\n /** Whether the stream is at the line's first character that isn't whitespace. */\n sol() {\n for (let i = this.pos - 1; i >= 0; i--) {\n const code = this.string.charCodeAt(i);\n if (code === 32 || code >= 9 && code <= 13) continue;\n if (code < 128 || !SPACE.test(this.string[i])) return false;\n }\n return true;\n }\n /** The next character, without reading it. */\n peek() {\n return this.pos < this.end ? this.string[this.pos] : void 0;\n }\n /** Reads and returns the next character. */\n next() {\n return this.pos < this.end ? this.string[this.pos++] : void 0;\n }\n /** Reads the next character if it is `match` (a character, a set as a regex, or a test). */\n eat(match) {\n const ch = this.peek();\n if (ch === void 0) return void 0;\n if (!(typeof match === \"string\" ? ch === match : match instanceof RegExp ? match.test(ch) : match(ch))) return void 0;\n this.pos++;\n return ch;\n }\n /** Reads characters while they match; returns whether it read any. */\n eatWhile(match) {\n const from = this.pos;\n while (this.eat(match) !== void 0);\n return this.pos > from;\n }\n /** Reads whitespace. */\n eatSpace() {\n return this.eatWhile(isSpace);\n }\n /** Reads to the end of the stream. */\n skipToEnd() {\n this.pos = this.end;\n }\n /** Reads up to (not including) the next `text`; returns whether it was found. */\n skipTo(text) {\n const at = this.string.indexOf(text, this.pos);\n if (at < 0 || at >= this.end) return false;\n this.pos = at;\n return true;\n }\n match(pattern, consume = true, caseInsensitive = false) {\n if (typeof pattern === \"string\") {\n if (this.pos + pattern.length > this.end) return false;\n const ok = caseInsensitive ? this.string.slice(this.pos, this.pos + pattern.length).toLowerCase() === pattern.toLowerCase() : this.string.startsWith(pattern, this.pos);\n if (ok && consume) this.pos += pattern.length;\n return ok;\n }\n const rest = this.pos || this.end < this.string.length ? this.string.slice(this.pos, this.end) : this.string;\n if (pattern.global || pattern.sticky) pattern.lastIndex = 0;\n let found = pattern.exec(rest);\n if (pattern.global || pattern.sticky) pattern.lastIndex = 0;\n if (found && found.index !== 0) found = null;\n if (!found) return null;\n if (consume) this.pos += found[0].length;\n return found;\n }\n /** Steps back `n` characters. */\n backUp(n) {\n this.pos -= n;\n }\n /** The text of the current token so far. */\n current() {\n return this.string.slice(this.start, this.pos);\n }\n /** The line's indentation in columns. */\n indentation() {\n let col = 0;\n for (const ch of this.string) if (ch === \" \") col++;\n else if (ch === \" \") col = (Math.floor(col / this.tabSize) + 1) * this.tabSize;\n else break;\n return col;\n }\n /** The text after the stream, to the line's end (also past `end`). */\n rest() {\n return this.string.slice(this.pos);\n }\n };\n const SPACE = /\\s/;\n const isSpace = (ch) => ch === \" \" || ch === \" \";\n // src/language/language.ts\n /** Every token kind, in a fixed order; tokens are stored by their index here. */\n const tokenTypes = [\n \"keyword\",\n \"string\",\n \"number\",\n \"comment\",\n \"function\",\n \"type\",\n \"variable\",\n \"property\",\n \"operator\",\n \"punctuation\",\n \"tag\",\n \"attribute\",\n \"meta\",\n \"invalid\",\n \"heading\",\n \"strong\",\n \"emphasis\",\n \"link\"\n ];\n /** Lines longer than this are not read. */\n const MAX_LINE = 1e4;\n const typeIndex = new Map(tokenTypes.map((type, i) => [type, i]));\n const isPlain = (value) => typeof value === \"object\" && value !== null && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n /** Copies arrays and plain objects; everything else (languages among them) is shared. */\n function copyPlain(value) {\n if (Array.isArray(value)) return value.map(copyPlain);\n if (isPlain(value)) {\n const out = {};\n for (const key in value) out[key] = copyPlain(value[key]);\n return out;\n }\n return value;\n }\n /** Compares arrays and plain objects by their content; everything else by identity. */\n function samePlain(a, b) {\n if (a === b) return true;\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (!samePlain(a[i], b[i])) return false;\n return true;\n }\n if (isPlain(a) && isPlain(b)) {\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n for (const key of keys) if (!samePlain(a[key], b[key])) return false;\n return true;\n }\n return false;\n }\n /**\n * Defines a language from a tokenizer that reads one line at a time.\n *\n * ```ts\n * const ini = defineCodeLanguage({\n * name: 'ini',\n * token(stream) {\n * if (stream.sol() && stream.match(/^\\s*[;#].*$/)) return 'comment'\n * if (stream.sol() && stream.match(/^\\s*\\[[^\\]]*\\]/)) return 'keyword'\n * if (stream.match(/^[\\w.-]+(?=\\s*=)/)) return 'property'\n * stream.next()\n * return null\n * },\n * })\n * ```\n */\n function defineCodeLanguage(spec) {\n const brackets = spec.brackets ?? \"()[]{}\";\n let openers = \"\";\n for (let i = 0; i < brackets.length; i += 2) openers += brackets[i];\n return markRaw({\n name: spec.name,\n aliases: spec.aliases ?? [],\n startState: spec.startState ?? (() => ({})),\n token: spec.token,\n blankLine: spec.blankLine,\n copyState: spec.copyState ?? copyPlain,\n sameState: spec.sameState ?? samePlain,\n comment: spec.comment ?? {},\n brackets,\n autoClose: spec.autoClose ?? openers + \"'\\\"\",\n indentAfter: spec.indentAfter,\n languageAt: spec.languageAt ?? (() => null),\n nested: spec.nested ?? [],\n workerMode: spec.workerMode\n });\n }\n /** The language among `languages` named `name` or one of its aliases, ignoring case. */\n function languageFor(languages, name) {\n if (!name) return null;\n const key = name.trim().toLowerCase();\n return languages.find((language) => language.name.toLowerCase() === key || language.aliases.includes(key)) ?? null;\n }\n /** Reads one line from `state` (which it changes into the state after the line). */\n function tokenizeLine(language, text, state, tabSize = 2) {\n if (!text) {\n language.blankLine?.(state);\n return [];\n }\n if (text.length > MAX_LINE) return [];\n const out = [];\n const stream = new CodeStream(text, tabSize);\n let guard = 0;\n while (!stream.eol()) {\n stream.start = stream.pos;\n const type = language.token(stream, state);\n if (stream.pos <= stream.start) {\n stream.pos = stream.start + 1;\n push(out, stream.pos, -1);\n } else push(out, stream.pos, type ? typeIndex.get(type) ?? -1 : -1);\n if (++guard > 1e5) break;\n }\n return out;\n }\n function push(out, to, type) {\n if (out.length && out[out.length - 1] === type) out[out.length - 2] = to;\n else out.push(to, type);\n }\n // src/language/highlighter.ts\n /** Lines between the start states kept: a line read again costs at most this many. */\n const INTERVAL = 32;\n /** Lines whose tokens are kept; the rest are read again from a kept state when drawn. */\n const CACHE = 4e3;\n /**\n * Keeps the tokens of a text up to date as it changes.\n *\n * Reading goes down from the top. It keeps the state at the start of\n * every 32nd line read, and the tokens of the lines drawn lately; a line\n * whose tokens are gone is read again from the kept state above it. So a\n * text of a million lines, all read, holds some thirty thousand states\n * and a few thousand lines' tokens.\n *\n * After an edit, lines before it keep everything; reading resumes at the\n * edited line and stops as soon as a line after the edit starts in the\n * same state as before, because from there on nothing can differ. Typing\n * inside a function rereads one line; opening a comment rereads up to\n * where it closes.\n *\n * Lines are read only when asked for (the ones in view and those before\n * them); the rest wait for idle time, or come from a worker through\n * `adopt`, so opening a long file costs nothing up front.\n */\n var CodeHighlighter = class {\n language;\n doc;\n tabSize;\n interval;\n cacheSize;\n /** Kept start states: `lines[k]` starts in `states[k]`; the first is line 0. */\n lines = [0];\n states;\n /** Lines above this index are read; `tip` is the state line `read` starts in. */\n read = 0;\n tip;\n /**\n * What was read past an edit, moved to where those lines are now. Once\n * reading reaches one of these lines in the same state, everything up to\n * `oldEnd` (which starts in `oldTip`) is read again for free.\n */\n oldLines = [];\n oldStates = [];\n oldAt = 0;\n oldEnd = -1;\n oldTip;\n /** Where reading again from a kept state last got to, so going down line by line doesn't start over each time. */\n walk = null;\n /** Tokens by line index, oldest first. */\n cache = /* @__PURE__ */ new Map();\n constructor(language, doc, options = {}) {\n this.language = language;\n this.doc = doc;\n const opts = typeof options === \"number\" ? { tabSize: options } : options;\n this.tabSize = opts.tabSize ?? 2;\n this.interval = Math.max(1, opts.interval ?? INTERVAL);\n this.cacheSize = Math.max(1, opts.cache ?? CACHE);\n this.tip = language.startState();\n this.states = [this.tip];\n }\n /** How many lines from the top are read. */\n get frontier() {\n return this.read;\n }\n /** The text being read. */\n get text() {\n return this.doc;\n }\n /** Takes in a new text, made from the old one by `changes`. Without them, starts over. */\n update(doc, changes) {\n const old = this.doc;\n this.doc = doc;\n if (!changes || changes.empty) {\n if (!changes) this.reset();\n return;\n }\n const list = changes.changes;\n const first = list[0];\n const last = list[list.length - 1];\n const a = old.lineAt(first.from).number - 1;\n const b = old.lineAt(last.to).number - 1;\n const delta = doc.lineAt(changes.mapPos(last.to, 1)).number - 1 - b;\n for (const key of this.cache.keys()) if (key >= a) this.cache.delete(key);\n if (this.walk && this.walk.line > a) this.walk = null;\n const movedLines = [];\n const movedStates = [];\n let endLine = -1;\n let endTip;\n const move = (line, state) => {\n if (line > b) {\n movedLines.push(line + delta);\n movedStates.push(state);\n }\n };\n if (a < this.read) {\n if (b + 1 < this.read) {\n if (this.lines[this.keptAt(b + 1)] !== b + 1) move(b + 1, this.stateIn(old, b + 1));\n }\n for (let k = 0; k < this.lines.length; k++) move(this.lines[k], this.states[k]);\n if (this.read > b) {\n endLine = this.read + delta;\n endTip = this.tip;\n }\n const keep = this.keptAt(a) + 1;\n this.lines.length = keep;\n this.states.length = keep;\n this.read = this.lines[keep - 1];\n this.tip = this.states[keep - 1];\n } else if (this.oldEnd >= 0) {\n const lines = this.oldLines;\n if (this.oldAt < lines.length && lines[this.oldAt] <= a && a < this.oldEnd) for (let k = this.oldAt; k < lines.length && lines[k] <= a; k++) {\n movedLines.push(lines[k]);\n movedStates.push(this.oldStates[k]);\n }\n else {\n for (let k = this.oldAt; k < lines.length; k++) move(lines[k], this.oldStates[k]);\n if (this.oldEnd > b) {\n endLine = this.oldEnd + delta;\n endTip = this.oldTip;\n } else if (this.oldEnd <= a) {\n endLine = this.oldEnd;\n endTip = this.oldTip;\n }\n }\n } else return;\n if (endLine < 0 && movedLines.length) {\n endLine = movedLines.pop();\n endTip = movedStates.pop();\n }\n this.oldLines = movedLines;\n this.oldStates = movedStates;\n this.oldAt = 0;\n this.oldEnd = endLine > this.read && endLine <= doc.lines ? endLine : -1;\n this.oldTip = this.oldEnd >= 0 ? endTip : void 0;\n if (this.oldEnd < 0) this.dropOld();\n }\n reset() {\n this.tip = this.language.startState();\n this.lines = [0];\n this.states = [this.tip];\n this.read = 0;\n this.cache.clear();\n this.walk = null;\n this.dropOld();\n }\n dropOld() {\n this.oldLines = [];\n this.oldStates = [];\n this.oldAt = 0;\n this.oldEnd = -1;\n this.oldTip = void 0;\n }\n /** The index of the last kept state at or above line `i`. */\n keptAt(i) {\n let lo = 0;\n let hi = this.lines.length - 1;\n while (lo < hi) {\n const mid = lo + hi + 1 >> 1;\n if (this.lines[mid] <= i) lo = mid;\n else hi = mid - 1;\n }\n return lo;\n }\n /** Where to start reading line `i` again from: a kept state, or where the last such reading got to. */\n from(i) {\n const k = this.keptAt(i);\n const walk = this.walk;\n if (walk && walk.line <= i && walk.line >= this.lines[k]) return {\n line: walk.line,\n state: this.language.copyState(walk.state)\n };\n return {\n line: this.lines[k],\n state: this.language.copyState(this.states[k])\n };\n }\n /** The state line `i` starts in, read from the kept state above it in `doc`. */\n stateIn(doc, i) {\n if (doc !== this.doc) {\n const k = this.keptAt(i);\n const state = this.language.copyState(this.states[k]);\n for (let j = this.lines[k]; j < i; j++) tokenizeLine(this.language, doc.lineText(j + 1), state, this.tabSize);\n return state;\n }\n const start = this.from(i);\n const state = start.state;\n for (let j = start.line; j < i; j++) tokenizeLine(this.language, doc.lineText(j + 1), state, this.tabSize);\n this.walk = {\n line: i,\n state\n };\n return state;\n }\n remember(i, tokens) {\n this.cache.delete(i);\n this.cache.set(i, tokens);\n if (this.cache.size > this.cacheSize) this.cache.delete(this.cache.keys().next().value);\n }\n /** Reads the next unread line, keeping its tokens with `keep`. */\n step(keep) {\n const i = this.read;\n const state = this.language.copyState(this.tip);\n const tokens = tokenizeLine(this.language, this.doc.lineText(i + 1), state, this.tabSize);\n if (keep) this.remember(i, tokens);\n const next = i + 1;\n if (this.oldEnd >= 0) {\n const lines = this.oldLines;\n while (this.oldAt < lines.length && lines[this.oldAt] < next) this.oldAt++;\n if (next === this.oldEnd ? this.language.sameState(state, this.oldTip) : lines[this.oldAt] === next && this.language.sameState(state, this.oldStates[this.oldAt])) {\n if (next - this.lines[this.lines.length - 1] >= this.interval) {\n this.lines.push(next);\n this.states.push(state);\n }\n for (let k = this.oldAt; k < lines.length; k++) {\n if (lines[k] <= next) continue;\n this.lines.push(lines[k]);\n this.states.push(this.oldStates[k]);\n }\n this.read = this.oldEnd;\n this.tip = this.oldTip;\n this.dropOld();\n return;\n }\n if (next >= this.oldEnd) this.dropOld();\n }\n if (next - this.lines[this.lines.length - 1] >= this.interval) {\n this.lines.push(next);\n this.states.push(state);\n }\n this.read = next;\n this.tip = state;\n }\n /**\n * The tokens of line `n` (from 1), reading up to it if it takes no more\n * than `limit` lines; `null` when it would take more, so the caller\n * draws plain text and lets idle time catch up.\n */\n line(n, limit = Infinity) {\n const i = n - 1;\n if (i < 0 || i >= this.doc.lines) return null;\n const cached = this.cache.get(i);\n if (cached) return cached;\n if (i < this.read) {\n const start = this.from(i);\n const state = start.state;\n let tokens = [];\n for (let j = start.line; j <= i; j++) {\n tokens = tokenizeLine(this.language, this.doc.lineText(j + 1), state, this.tabSize);\n this.remember(j, tokens);\n }\n this.walk = {\n line: i + 1,\n state\n };\n return tokens;\n }\n if (i - this.read > limit) return null;\n const near = i - Math.min(this.cacheSize >> 1, 256);\n while (this.read <= i) this.step(this.read >= near);\n return this.cache.get(i) ?? null;\n }\n /** The state at the start of line `n`, reading up to it. */\n stateAt(n) {\n const i = Math.min(Math.max(n - 1, 0), this.doc.lines - 1);\n if (i === this.read) return this.tip;\n if (i < this.read) return this.stateIn(this.doc, i);\n while (this.read < i) this.step(false);\n return this.tip;\n }\n /** The language active at the start of line `n`: an inner one inside a nesting language. */\n languageAt(n) {\n let language = this.language;\n let state = this.stateAt(n);\n for (let depth = 0; depth < 4; depth++) {\n const inner = language.languageAt(state);\n if (!inner) break;\n const innerState = state.inner?.state;\n language = inner;\n state = innerState;\n }\n return language;\n }\n /** Reads ahead until `deadline` (a `performance.now()` time) or line `until`; returns whether it read any. */\n work(deadline, until = this.doc.lines) {\n const end = Math.min(until, this.doc.lines);\n const start = this.read;\n while (this.read < end) {\n this.step(false);\n if ((this.read & 3) === 0 && performance.now() >= deadline) break;\n }\n return this.read > start;\n }\n /** Whether every line up to `n` is read. */\n ready(n) {\n return this.read >= Math.min(n, this.doc.lines);\n }\n /**\n * The kept start states from line `from` (an index) on, as\n * `[line, state]` pairs, ending with the line reading is at.\n */\n checkpoints(from = 0) {\n const out = [];\n for (let k = this.keptAt(from); k < this.lines.length; k++) if (this.lines[k] >= from) out.push([this.lines[k], this.states[k]]);\n if (this.read > (out.length ? out[out.length - 1][0] : -1)) out.push([this.read, this.tip]);\n return out;\n }\n /**\n * Takes in start states read elsewhere (a worker reading the same text):\n * `[line, state]` pairs in order, the last one where that reading is.\n * Those past what is read here are kept as read.\n */\n adopt(points) {\n if (!points.length) return;\n const [endLine, endState] = points[points.length - 1];\n if (endLine <= this.read || endLine > this.doc.lines) return;\n const after = this.read;\n let k = 0;\n while (k < points.length && points[k][0] <= after) k++;\n let last = this.lines[this.lines.length - 1];\n for (; k < points.length - 1; k++) {\n const [line, state] = points[k];\n if (line - last < this.interval) continue;\n this.lines.push(line);\n this.states.push(state);\n last = line;\n }\n for (const key of this.cache.keys()) if (key >= after) this.cache.delete(key);\n this.read = endLine;\n this.tip = endState;\n this.dropOld();\n }\n };\n // src/language/worker-protocol.ts\n const LANGUAGE = \"$codeLanguage\";\n const isLanguage = (value) => typeof value.token === \"function\" && typeof value.startState === \"function\";\n /** A state as plain data, its languages replaced by their names. */\n function encodeState(value) {\n if (typeof value !== \"object\" || value === null) return value;\n if (Array.isArray(value)) return value.map(encodeState);\n if (isLanguage(value)) return { [LANGUAGE]: value.name };\n const out = {};\n for (const key in value) out[key] = encodeState(value[key]);\n return out;\n }\n /** A language and every language it may hold, by name. */\n function languagesIn(language) {\n const found = /* @__PURE__ */ new Map();\n const visit = (item) => {\n if (found.has(item.name)) return;\n found.set(item.name, item);\n for (const inner of item.nested ?? []) visit(inner);\n };\n visit(language);\n return found;\n }\n // src/languages/javascript.ts\n const words = (list) => new Set(list.split(\" \"));\n const KEYWORDS$3 = words(\"as async await break case catch class const continue debugger default delete do else export extends false finally for from function get if import in instanceof let new null of return set static super switch this throw true try typeof undefined var void while with yield\");\n const TS_KEYWORDS = words(\"abstract asserts declare enum global implements infer interface is keyof module namespace override private protected public readonly satisfies type unique\");\n const TS_TYPES = words(\"any bigint boolean never number object string symbol unknown void\");\n /** After these a `/` starts a regular expression, not a division. */\n const BEFORE_EXPRESSION = words(\"await case delete do else in instanceof new of return throw typeof void yield\");\n const IDENT = /^[\\p{L}_$][\\p{L}\\p{N}_$]*/u;\n const NUMBER$1 = /^(?:0[xX][\\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|(?:\\d[\\d_]*(?:\\.[\\d_]*)?|\\.\\d[\\d_]*)(?:[eE][+-]?\\d+)?)n?/;\n const KEY_COLON = /^\\s*:/;\n const CALL = /^\\s*\\(/;\n const KEY_AFTER = /^\\s*\\??:(?!:)/;\n const SOFT_KEYWORDS = words(\"get set from as of async\");\n const AFTER_SOFT = /^\\s*[(=:,;)]/;\n const AFTER_TS_KEYWORD = /^\\s*[(=:,;.)]/;\n const OPTIONAL_CALL = /^\\s*(?:\\?\\.)?\\(/;\n const ARROW = /^\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|\\w+)\\s*=>/;\n const OPERATOR = \"+-*/%=&|^!<>?~:\";\n const isOperator = (ch) => OPERATOR.includes(ch);\n const isDigit = (ch) => ch !== void 0 && ch >= \"0\" && ch <= \"9\";\n /** The character after the stream's position, without reading past the line. */\n const after = (stream) => stream.pos + 1 < stream.string.length ? stream.string[stream.pos + 1] : void 0;\n const ahead = (stream, pattern) => !!stream.match(pattern, false);\n function readString$2(stream, quote) {\n let escaped = false;\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === quote && !escaped) return;\n escaped = !escaped && ch === \"\\\\\";\n }\n }\n function readRegex(stream) {\n let escaped = false;\n let inClass = false;\n let ch;\n while ((ch = stream.next()) !== void 0) if (escaped) escaped = false;\n else if (ch === \"\\\\\") escaped = true;\n else if (ch === \"[\") inClass = true;\n else if (ch === \"]\") inClass = false;\n else if (ch === \"/\" && !inClass) {\n stream.match(/^[dgimsuvy]*/);\n return;\n }\n }\n const top = (state) => {\n const stack = state.stack;\n return stack.length ? stack[stack.length - 1] : void 0;\n };\n const pop = (state) => {\n state.stack = state.stack.slice(0, -1);\n };\n /** Reads a token inside a JSX tag's attributes. */\n function jsxTag(stream, state) {\n if (stream.eatSpace()) return null;\n if (stream.match(\"/>\")) {\n pop(state);\n state.expr = false;\n return \"tag\";\n }\n if (stream.eat(\">\")) {\n state.stack = state.stack.slice(0, -1) + \">\";\n return \"tag\";\n }\n if (stream.eat(\"{\")) {\n state.stack += \"J\";\n state.expr = true;\n return \"punctuation\";\n }\n const quote = stream.eat(/[\"']/);\n if (quote) {\n readString$2(stream, quote);\n return \"string\";\n }\n if (stream.match(/^[\\p{L}_$][\\p{L}\\p{N}_$:.-]*/u)) return \"attribute\";\n if (stream.eat(\"=\")) return \"operator\";\n stream.next();\n return null;\n }\n /** Reads a token among a JSX element's children. */\n function jsxChildren(stream, state) {\n if (stream.match(/^<\\/[\\p{L}\\p{N}_$:.-]*\\s*>?/u)) {\n pop(state);\n state.expr = false;\n return \"tag\";\n }\n if (stream.match(/^<[\\p{L}_$>]/u, false)) return openTag(stream, state);\n if (stream.eat(\"{\")) {\n state.stack += \"J\";\n state.expr = true;\n return \"punctuation\";\n }\n stream.eatWhile((ch) => ch !== \"<\" && ch !== \"{\");\n return null;\n }\n function openTag(stream, state) {\n stream.next();\n if (stream.eat(\">\")) state.stack += \">\";\n else {\n stream.match(/^[\\p{L}_$][\\p{L}\\p{N}_$:.-]*/u);\n state.stack += \"<\";\n }\n return \"tag\";\n }\n function templateBody(stream, state) {\n if (stream.eat(\"`\")) {\n pop(state);\n state.expr = false;\n return \"string\";\n }\n if (stream.match(\"${\")) {\n state.stack += \"$\";\n state.expr = true;\n return \"punctuation\";\n }\n let escaped = false;\n while (!stream.eol()) {\n const ch = stream.peek();\n if (!escaped && (ch === \"`\" || ch === \"$\" && stream.string[stream.pos + 1] === \"{\")) break;\n escaped = !escaped && ch === \"\\\\\";\n stream.next();\n }\n return \"string\";\n }\n function code(stream, state, options) {\n if (stream.eatSpace()) return null;\n const ch = stream.peek();\n const dot = state.dot;\n const key = state.key || stream.sol() && top(state) === \"{\";\n state.dot = false;\n state.key = false;\n if (ch === \"/\") {\n if (stream.match(\"//\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (!state.comment) stream.pos += 2;\n else stream.skipToEnd();\n return \"comment\";\n }\n if (state.expr) {\n stream.next();\n readRegex(stream);\n state.expr = false;\n return \"string\";\n }\n }\n if (ch === \"\\\"\" || ch === \"'\") {\n stream.next();\n readString$2(stream, ch);\n const isKey = key && !!stream.match(KEY_COLON, false);\n state.expr = false;\n return isKey ? \"property\" : \"string\";\n }\n if (ch === \"`\") {\n stream.next();\n state.stack += \"`\";\n return \"string\";\n }\n if (isDigit(ch) || ch === \".\" && isDigit(after(stream))) {\n if (stream.match(NUMBER$1)) {\n state.expr = false;\n return \"number\";\n }\n }\n if (options.jsx && ch === \"<\" && state.expr && stream.match(/^<[\\p{L}_$>]/u, false)) return openTag(stream, state);\n const word = stream.match(IDENT);\n if (word) {\n const name = word[0];\n state.expr = BEFORE_EXPRESSION.has(name);\n if (dot) return ahead(stream, CALL) ? \"function\" : \"property\";\n if (key && ahead(stream, KEY_AFTER)) return \"property\";\n if (KEYWORDS$3.has(name)) {\n if (SOFT_KEYWORDS.has(name) && ahead(stream, AFTER_SOFT)) return ahead(stream, CALL) ? \"function\" : \"variable\";\n return \"keyword\";\n }\n if (options.typescript) {\n if (TS_TYPES.has(name)) return \"type\";\n if (TS_KEYWORDS.has(name) && !ahead(stream, AFTER_TS_KEYWORD)) return \"keyword\";\n }\n if (ahead(stream, OPTIONAL_CALL) || ahead(stream, ARROW)) return \"function\";\n if (name.charCodeAt(0) >= 65 && name.charCodeAt(0) <= 90) return \"type\";\n return \"variable\";\n }\n if (ch === \"#\") {\n stream.next();\n if (stream.match(IDENT)) {\n state.expr = false;\n return \"property\";\n }\n return \"meta\";\n }\n if (ch === \"@\") {\n stream.next();\n stream.match(/^[\\p{L}_$][\\p{L}\\p{N}_$.]*/u);\n return \"meta\";\n }\n stream.next();\n if (ch === \"{\") {\n state.stack += \"{\";\n state.expr = true;\n state.key = true;\n return \"punctuation\";\n }\n if (ch === \"}\") {\n const t = top(state);\n if (t === \"{\" || t === \"$\" || t === \"J\") pop(state);\n state.expr = false;\n return \"punctuation\";\n }\n if (ch === \"(\" || ch === \"[\") {\n state.expr = true;\n return \"punctuation\";\n }\n if (ch === \")\" || ch === \"]\") {\n state.expr = false;\n return \"punctuation\";\n }\n if (ch === \",\" || ch === \";\") {\n state.expr = true;\n state.key = top(state) === \"{\";\n return \"punctuation\";\n }\n if (ch === \".\") {\n if (stream.match(\"..\")) {\n state.expr = true;\n return \"operator\";\n }\n state.dot = true;\n return \"punctuation\";\n }\n if (ch === \"?\" && stream.peek() === \".\" && !isDigit(after(stream))) {\n stream.next();\n state.dot = true;\n return \"operator\";\n }\n if (OPERATOR.includes(ch)) {\n stream.eatWhile(isOperator);\n const op = stream.current();\n state.expr = op !== \"++\" && op !== \"--\";\n return \"operator\";\n }\n state.expr = false;\n return null;\n }\n /** Makes a JavaScript-family language: plain, TypeScript, JSX or TSX. */\n function createJavaScript(name, aliases, options = {}) {\n return defineCodeLanguage({\n name,\n aliases,\n startState: () => ({\n stack: \"\",\n comment: false,\n expr: true,\n dot: false,\n key: false\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.stack === b.stack && a.comment === b.comment && a.expr === b.expr && a.dot === b.dot && a.key === b.key,\n token(stream, state) {\n if (state.comment) {\n if (stream.skipTo(\"*/\")) {\n stream.pos += 2;\n state.comment = false;\n } else stream.skipToEnd();\n return \"comment\";\n }\n const t = top(state);\n if (t === \"`\") return templateBody(stream, state);\n if (t === \"<\") return jsxTag(stream, state);\n if (t === \">\") return jsxChildren(stream, state);\n return code(stream, state, options);\n },\n comment: {\n line: \"//\",\n block: [\"/*\", \"*/\"]\n },\n autoClose: \"([{'\\\"`\"\n });\n }\n const javascript = createJavaScript(\"javascript\", [\n \"js\",\n \"mjs\",\n \"cjs\"\n ]);\n const typescript = createJavaScript(\"typescript\", [\n \"ts\",\n \"mts\",\n \"cts\"\n ], { typescript: true });\n const jsx = createJavaScript(\"jsx\", [], { jsx: true });\n const tsx = createJavaScript(\"tsx\", [], {\n typescript: true,\n jsx: true\n });\n // src/languages/css.ts\n /**\n * Whether a name at the cursor inside a block is a property: `name:` with\n * a `;`, a `}` or the line's end before any `{` (`a:hover {` is a nested\n * selector).\n */\n const isProperty = (stream) => !!stream.match(/^[\\w-]+\\s*:(?!:)[^{;}]*(?:[;}]|$)/, false);\n function readString$1(stream, quote) {\n let escaped = false;\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === quote && !escaped) return;\n escaped = !escaped && ch === \"\\\\\";\n }\n }\n /** Makes CSS or a nesting dialect such as SCSS (`//` comments, `$` variables). */\n function createCss(name, aliases, scss = false) {\n return defineCodeLanguage({\n name,\n aliases,\n startState: () => ({\n comment: false,\n depth: 0,\n value: false,\n parens: 0,\n at: false\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.comment === b.comment && a.depth === b.depth && a.value === b.value && a.parens === b.parens && a.at === b.at,\n token(stream, state) {\n if (state.comment || stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (state.comment) stream.skipToEnd();\n else stream.pos += 2;\n return \"comment\";\n }\n if (stream.eatSpace()) return null;\n if (scss && stream.match(\"//\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n const ch = stream.peek();\n if (ch === \"\\\"\" || ch === \"'\") {\n stream.next();\n readString$1(stream, ch);\n return \"string\";\n }\n if (ch === \"@\") {\n stream.next();\n stream.match(/^[\\w-]+/);\n state.at = true;\n return \"keyword\";\n }\n if (ch === \"{\") {\n stream.next();\n state.depth++;\n state.value = false;\n state.at = false;\n return \"punctuation\";\n }\n if (ch === \"}\") {\n stream.next();\n state.depth = Math.max(0, state.depth - 1);\n state.value = false;\n return \"punctuation\";\n }\n if (ch === \";\") {\n stream.next();\n state.value = false;\n state.at = false;\n return \"punctuation\";\n }\n if (ch === \"(\") {\n stream.next();\n state.parens++;\n return \"punctuation\";\n }\n if (ch === \")\") {\n stream.next();\n state.parens = Math.max(0, state.parens - 1);\n return \"punctuation\";\n }\n if (stream.match(/^--[\\w-]*/) || scss && stream.match(/^\\$[\\w-]+/)) {\n if (!state.value && stream.match(/^\\s*:/, false)) return \"property\";\n return \"variable\";\n }\n if (state.value || state.at || state.parens) {\n if (stream.match(/^#[\\da-fA-F]{3,8}\\b/)) return \"number\";\n if (stream.match(/^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?(?:%|[a-zA-Z]+)?/)) return \"number\";\n if (stream.match(\"!important\")) return \"keyword\";\n if (stream.match(/^[\\w-]+(?=\\()/)) return \"function\";\n if (stream.match(/^[\\w-]+/)) {\n if (state.at && /^(?:and|or|not|only|screen|print|all)$/.test(stream.current())) return \"keyword\";\n return state.value ? \"variable\" : state.at ? \"variable\" : \"property\";\n }\n } else {\n if (state.depth > 0 && isProperty(stream)) {\n stream.match(/^[\\w-]+/);\n return \"property\";\n }\n if (stream.match(/^[.#][\\w-]+/)) return \"type\";\n if (stream.match(/^::?[\\w-]+/)) return \"keyword\";\n if (stream.match(/^\\[[^\\]]*\\]?/)) return \"attribute\";\n if (stream.match(/^[a-zA-Z][\\w-]*/) || stream.eat(\"*\")) return \"tag\";\n if (scss && stream.eat(\"&\")) return \"keyword\";\n }\n if (ch === \":\") {\n stream.next();\n if (state.depth > 0 && !state.at) state.value = true;\n return \"punctuation\";\n }\n if (stream.eat(/[,>+~/*=]/)) return \"operator\";\n stream.next();\n return null;\n },\n comment: scss ? {\n line: \"//\",\n block: [\"/*\", \"*/\"]\n } : { block: [\"/*\", \"*/\"] },\n autoClose: \"([{'\\\"\"\n });\n }\n const css = createCss(\"css\", []);\n const scss = createCss(\"scss\", [\"less\", \"postcss\"], true);\n // src/languages/json.ts\n /** JSON, also with comments and trailing commas as in `tsconfig.json`. */\n const json = defineCodeLanguage({\n name: \"json\",\n aliases: [\"jsonc\", \"json5\"],\n startState: () => ({ comment: false }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.comment === b.comment,\n token(stream, state) {\n if (state.comment || stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (state.comment) stream.skipToEnd();\n else stream.pos += 2;\n return \"comment\";\n }\n if (stream.eatSpace()) return null;\n if (stream.match(\"//\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (stream.eat(\"\\\"\")) {\n let escaped = false;\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === \"\\\"\" && !escaped) break;\n escaped = !escaped && ch === \"\\\\\";\n }\n return stream.match(/^\\s*:/, false) ? \"property\" : \"string\";\n }\n if (stream.match(/^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/)) return \"number\";\n if (stream.match(/^(?:true|false|null)\\b/)) return \"keyword\";\n if (stream.eat(/[{}[\\],:]/)) return \"punctuation\";\n stream.eatWhile(/[^\\s{}[\\],:\"]/);\n return \"invalid\";\n },\n comment: {\n line: \"//\",\n block: [\"/*\", \"*/\"]\n },\n autoClose: \"[{\\\"\"\n });\n // src/languages/html.ts\n const SCRIPT_TYPES = /^(?:|module|text\\/javascript|application\\/javascript|js|ts|typescript)$/;\n function scriptLanguage(lang) {\n return /^(?:ts|typescript|tsx)$/.test(lang) ? typescript : javascript;\n }\n function styleLanguage(lang) {\n return /^(?:scss|sass|less|postcss)$/.test(lang) ? scss : css;\n }\n /** Whether an attribute's value is an expression in a Vue template. */\n const isDirective = (attr) => /^(?:v-[\\w-]+|[:@#][^=]*)/.test(attr);\n function enter(state, language, end, block) {\n state.inner = {\n language,\n state: language.startState(),\n end,\n block\n };\n }\n let lastLine = \"\";\n let lastLowered = \"\";\n /** The line in lower case, made once for all the tokens read from it. */\n function lowered(line) {\n if (line !== lastLine) {\n lastLine = line;\n lastLowered = line.toLowerCase();\n }\n return lastLowered;\n }\n /** Reads one token of the inner language, stopping where it ends. */\n function inner(stream, state) {\n const at = state.inner;\n const found = at.end.startsWith(\"<\") ? lowered(stream.string).indexOf(at.end, stream.pos) : stream.string.indexOf(at.end, stream.pos);\n const index = found < 0 ? -1 : found - stream.pos;\n if (index === 0) {\n state.inner = null;\n return;\n }\n const end = stream.end;\n if (index > 0) stream.end = stream.pos + index;\n const type = at.language.token(stream, at.state);\n stream.end = end;\n if (stream.pos === stream.start) stream.next();\n return type;\n }\n function tag(stream, state, options) {\n if (stream.eatSpace()) return null;\n if (stream.match(\"/>\") || stream.eat(\">\")) {\n const name = state.tag;\n state.in = \"text\";\n if (stream.current() === \">\") {\n if (name === \"script\" && SCRIPT_TYPES.test(state.lang)) enter(state, scriptLanguage(state.lang), \"<\\/script\", true);\n else if (name === \"style\") enter(state, styleLanguage(state.lang), \"</style\", true);\n }\n state.lang = \"\";\n return \"tag\";\n }\n if (stream.eat(\"=\")) return \"operator\";\n const quote = stream.eat(/[\"']/);\n if (quote) {\n if (options.vue && isDirective(state.attr)) {\n enter(state, typescript, quote, false);\n return \"string\";\n }\n return attrValue(stream, state, quote);\n }\n const name = stream.match(/^[^\\s=>/\"']+/);\n if (name) {\n state.attr = name[0].toLowerCase();\n return \"attribute\";\n }\n stream.next();\n return null;\n }\n /** Reads an attribute value up to its closing quote, which may be on a later line. */\n function attrValue(stream, state, quote) {\n const close = stream.string.indexOf(quote, stream.pos);\n const value = stream.string.slice(stream.pos, close < 0 ? void 0 : close);\n if (state.attr === \"lang\" || state.attr === \"type\") state.lang += value.trim().toLowerCase();\n if (close < 0) {\n stream.skipToEnd();\n state.quote = quote;\n } else {\n stream.pos = close + 1;\n state.quote = \"\";\n }\n return \"string\";\n }\n function text(stream, state, options) {\n if (stream.match(\"<!--\")) {\n state.comment = true;\n return comment(stream, state);\n }\n if (stream.match(/^<![^>]*>?/)) return \"meta\";\n if (stream.match(/^<\\/[\\w:-]*\\s*>?/)) return \"tag\";\n const open = stream.match(/^<([a-zA-Z][\\w:.-]*)/);\n if (open) {\n state.in = \"tag\";\n state.tag = open[1].toLowerCase();\n state.attr = \"\";\n state.lang = \"\";\n return \"tag\";\n }\n if (options.vue && stream.match(\"{{\")) {\n enter(state, typescript, \"}}\", false);\n return \"punctuation\";\n }\n if (stream.match(/^&(?:#\\d+|#x[\\da-fA-F]+|[a-zA-Z]\\w*);/)) return \"meta\";\n stream.next();\n stream.eatWhile(options.vue ? /[^<&{]/ : /[^<&]/);\n return null;\n }\n function comment(stream, state) {\n if (stream.skipTo(\"-->\")) {\n stream.pos += 3;\n state.comment = false;\n } else stream.skipToEnd();\n return \"comment\";\n }\n /** Makes HTML, or a Vue single-file component. */\n function createHtml(name, aliases, options = {}) {\n return defineCodeLanguage({\n name,\n aliases,\n nested: [\n javascript,\n typescript,\n css,\n scss\n ],\n startState: () => ({\n in: \"text\",\n tag: \"\",\n attr: \"\",\n lang: \"\",\n comment: false,\n quote: \"\",\n inner: null\n }),\n copyState: (state) => ({\n ...state,\n inner: state.inner && {\n ...state.inner,\n state: state.inner.language.copyState(state.inner.state)\n }\n }),\n sameState: (a, b) => a.in === b.in && a.tag === b.tag && a.attr === b.attr && a.lang === b.lang && a.comment === b.comment && a.quote === b.quote && (a.inner === b.inner || !!a.inner && !!b.inner && a.inner.language === b.inner.language && a.inner.end === b.inner.end && a.inner.language.sameState(a.inner.state, b.inner.state)),\n token(stream, state) {\n if (state.inner) {\n const type = inner(stream, state);\n if (type !== void 0) return type;\n if (stream.match(\"}}\")) return \"punctuation\";\n if (stream.eat(/[\"']/)) return \"string\";\n }\n if (state.comment) return comment(stream, state);\n if (state.quote) return attrValue(stream, state, state.quote);\n return state.in === \"tag\" ? tag(stream, state, options) : text(stream, state, options);\n },\n comment: { block: [\"<!--\", \"-->\"] },\n autoClose: \"([{\\\"'\",\n indentAfter: /<(?!\\/|!|(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)\\b)[\\w:-]+(?:\\s[^<>]*)?(?<!\\/)>\\s*$/i,\n languageAt: (state) => state.inner?.block ? state.inner.language : null\n });\n }\n const html = createHtml(\"html\", [\n \"htm\",\n \"xml\",\n \"svg\"\n ]);\n const vue = createHtml(\"vue\", [], { vue: true });\n // src/languages/markdown.ts\n function inline(stream) {\n if (stream.match(/^\\\\[\\\\`*_{}[\\]()#+\\-.!|<>~]/)) return null;\n if (stream.match(/^(`+)[^`]*?\\1/) || stream.match(/^`+/)) return \"string\";\n if (stream.match(/^(\\*\\*|__)(?=\\S)[^]*?\\S\\1/)) return \"strong\";\n if (stream.match(/^([*_])(?=\\S)[^*_]*?\\S\\1/)) return \"emphasis\";\n if (stream.match(/^~~(?=\\S)[^~]*?\\S~~/)) return \"meta\";\n if (stream.match(/^!?\\[[^\\]]*\\](?:\\([^)]*\\)|\\[[^\\]]*\\])?/)) return \"link\";\n if (stream.match(/^<(?:https?:\\/\\/|mailto:)[^>]+>/)) return \"link\";\n if (stream.match(/^<\\/?[a-zA-Z][^>]*>/)) return \"tag\";\n stream.next();\n stream.eatWhile(/[^\\\\`*_[!<~]/);\n return null;\n }\n /** Makes Markdown; `languages` lists the languages its fenced code is highlighted with. */\n function createMarkdown(options = {}) {\n const languages = options.languages ?? [];\n return defineCodeLanguage({\n name: \"markdown\",\n aliases: [\"md\"],\n nested: languages,\n startState: () => ({\n fence: \"\",\n inner: null\n }),\n copyState: (state) => ({\n fence: state.fence,\n inner: state.inner && {\n language: state.inner.language,\n state: state.inner.language.copyState(state.inner.state)\n }\n }),\n sameState: (a, b) => a.fence === b.fence && (a.inner === b.inner || !!a.inner && !!b.inner && a.inner.language === b.inner.language && a.inner.language.sameState(a.inner.state, b.inner.state)),\n token(stream, state) {\n if (state.fence) {\n if (stream.pos === 0) {\n const close = stream.match(/^\\s{0,3}(`{3,}|~{3,})\\s*$/, false);\n if (close && close[1].startsWith(state.fence)) {\n stream.skipToEnd();\n state.fence = \"\";\n state.inner = null;\n return \"meta\";\n }\n }\n if (!state.inner) {\n stream.skipToEnd();\n return \"string\";\n }\n return state.inner.language.token(stream, state.inner.state);\n }\n if (stream.pos === 0) {\n const fence = stream.match(/^\\s{0,3}(`{3,}|~{3,})\\s*([\\w+#.-]*)/);\n if (fence) {\n state.fence = fence[1];\n const language = languageFor(languages, fence[2]);\n state.inner = language && {\n language,\n state: language.startState()\n };\n stream.skipToEnd();\n return \"meta\";\n }\n if (stream.match(/^\\s{0,3}#{1,6}(?:\\s|$)/)) {\n stream.skipToEnd();\n return \"heading\";\n }\n if (stream.match(/^\\s{0,3}([-*_])(?:\\s*\\1){2,}\\s*$/)) return \"meta\";\n if (stream.match(/^\\s*>\\s?/)) return \"meta\";\n if (stream.match(/^\\s*(?:[-*+]|\\d+[.)])(?:\\s+\\[[ xX]\\])?(?=\\s)/)) return \"keyword\";\n }\n return inline(stream);\n },\n comment: { block: [\"<!--\", \"-->\"] },\n autoClose: \"([{`\\\"\",\n languageAt: (state) => state.inner?.language ?? null\n });\n }\n const markdown = createMarkdown();\n // src/languages/python.ts\n const KEYWORDS$2 = new Set(\"and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case type\".split(\" \"));\n const CONSTANTS = /* @__PURE__ */ new Set([\n \"True\",\n \"False\",\n \"None\",\n \"Ellipsis\",\n \"NotImplemented\"\n ]);\n const BUILTIN_TYPES = new Set(\"int float complex str bytes bytearray bool list tuple dict set frozenset object type range memoryview Exception\".split(\" \"));\n /** Reads a string from its quotes to their end, or to the line's end; returns whether it closed. */\n function readString(stream, quote, raw) {\n while (!stream.eol()) {\n if (stream.match(quote)) return true;\n if (stream.next() === \"\\\\\" && !raw) stream.next();\n }\n return quote.length === 1;\n }\n /** Python 3, with type hints, decorators and f-strings. */\n const python = defineCodeLanguage({\n name: \"python\",\n aliases: [\n \"py\",\n \"py3\",\n \"pyi\"\n ],\n startState: () => ({\n string: null,\n define: null\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.string === b.string && a.define === b.define,\n token(stream, state) {\n if (state.string) {\n if (readString(stream, state.string, false)) state.string = null;\n return \"string\";\n }\n if (stream.eatSpace()) return null;\n if (stream.eat(\"#\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n const quoted = stream.match(/^([rRbBfFuU]{0,2})(\"\"\"|'''|\"|')/);\n if (quoted) {\n const quote = quoted[2];\n if (!readString(stream, quote, /r/i.test(quoted[1]))) state.string = quote;\n state.define = null;\n return \"string\";\n }\n if (stream.sol() && stream.match(/^@[\\w.]+/)) return \"meta\";\n if (stream.match(/^(?:0[xX][\\da-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+)/)) return \"number\";\n if (stream.match(/^(?:\\d[\\d_]*\\.?[\\d_]*|\\.\\d[\\d_]*)(?:[eE][+-]?\\d+)?[jJ]?/)) return \"number\";\n const word = stream.match(/^[\\p{L}_][\\p{L}\\p{N}_]*/u);\n if (word) {\n const name = word[0];\n if (state.define) {\n const kind = state.define;\n state.define = null;\n return kind === \"def\" ? \"function\" : \"type\";\n }\n if (KEYWORDS$2.has(name)) {\n if ((name === \"match\" || name === \"case\" || name === \"type\") && !atStatement(stream)) return stream.match(/^\\s*\\(/, false) ? \"function\" : \"variable\";\n if (name === \"def\" || name === \"class\") state.define = name;\n return \"keyword\";\n }\n if (CONSTANTS.has(name)) return \"keyword\";\n if (name === \"self\" || name === \"cls\") return \"variable\";\n if (stream.match(/^\\s*\\(/, false)) return \"function\";\n if (BUILTIN_TYPES.has(name) || /^[A-Z][a-z]/.test(name)) return \"type\";\n if (stream.string.slice(0, stream.start).trimEnd().endsWith(\".\")) return \"property\";\n return \"variable\";\n }\n if (stream.match(/^(?:\\*\\*=?|\\/\\/=?|->|:=|<<=?|>>=?|[-+*/%@&|^~<>!=]=?)/)) return \"operator\";\n if (stream.eat(/[()[\\]{},:;.]/)) return \"punctuation\";\n stream.next();\n return null;\n },\n comment: { line: \"#\" },\n indentAfter: /:\\s*(?:#.*)?$/\n });\n /** Whether the word just read starts a statement and is followed by more, as `match x:` is. */\n function atStatement(stream) {\n return /^\\s*$/.test(stream.string.slice(0, stream.start)) && /^\\s+[^\\s=:.(,)]/.test(stream.rest());\n }\n // src/languages/shell.ts\n const KEYWORDS$1 = new Set(\"if then else elif fi for while until do done case esac in function select time coproc\".split(\" \"));\n /** Keywords after which a command comes. */\n const BEFORE_COMMAND = /* @__PURE__ */ new Set([\n \"if\",\n \"then\",\n \"else\",\n \"elif\",\n \"do\",\n \"while\",\n \"until\",\n \"time\"\n ]);\n const BUILTINS = new Set(\"echo printf read cd pwd export local readonly return exit set unset shift source eval exec trap test declare alias let true false\".split(\" \"));\n /** Reads a `$name`, `${…}` or `$(…)`; returns whether there was one. */\n function readVariable(stream) {\n if (stream.match(/^\\$(?:[\\w@*#?$!-]|\\{[^}]*\\}?)/)) {\n stream.match(/^\\w*/);\n return true;\n }\n return false;\n }\n /** Reads a double-quoted string up to its end or a `$`; returns whether it closed. */\n function readDouble(stream) {\n while (!stream.eol()) {\n const ch = stream.peek();\n if (ch === \"$\" && stream.match(/^\\$[\\w{@*#?!-]/, false)) return false;\n stream.next();\n if (ch === \"\\\\\") stream.next();\n else if (ch === \"\\\"\") return true;\n }\n return false;\n }\n /** Shell scripts: Bash, sh and Zsh. */\n const shell = defineCodeLanguage({\n name: \"shell\",\n aliases: [\n \"sh\",\n \"bash\",\n \"zsh\",\n \"shellscript\"\n ],\n startState: () => ({\n quote: null,\n command: true,\n heredoc: null\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.quote === b.quote && a.command === b.command && a.heredoc === b.heredoc,\n blankLine(state) {\n if (!state.quote && !state.heredoc) state.command = true;\n },\n token(stream, state) {\n if (stream.pos === 0 && !state.quote) {\n if (state.heredoc) {\n if (stream.string.trim() === state.heredoc) {\n stream.skipToEnd();\n state.heredoc = null;\n state.command = true;\n return \"string\";\n }\n stream.skipToEnd();\n return \"string\";\n }\n if (!stream.string.trimEnd().endsWith(\"\\\\\")) state.command = true;\n }\n if (state.quote === \"'\") {\n if (stream.skipTo(\"'\")) {\n stream.next();\n state.quote = null;\n } else stream.skipToEnd();\n return \"string\";\n }\n if (state.quote === \"\\\"\") {\n if (readVariable(stream)) return \"variable\";\n if (readDouble(stream)) state.quote = null;\n return \"string\";\n }\n if (stream.eatSpace()) return null;\n const ch = stream.peek();\n if (ch === \"#\" && (stream.pos === 0 || /\\s/.test(stream.string[stream.pos - 1]))) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (ch === \"'\") {\n stream.next();\n if (stream.skipTo(\"'\")) stream.next();\n else {\n stream.skipToEnd();\n state.quote = \"'\";\n }\n state.command = false;\n return \"string\";\n }\n if (ch === \"\\\"\") {\n stream.next();\n state.quote = readDouble(stream) ? null : \"\\\"\";\n state.command = false;\n return \"string\";\n }\n if (ch === \"$\") {\n if (stream.match(\"$(\")) {\n state.command = true;\n return \"punctuation\";\n }\n if (readVariable(stream)) {\n state.command = false;\n return \"variable\";\n }\n }\n const heredoc = stream.match(/^<<-?\\s*(['\"]?)(\\w+)\\1/);\n if (heredoc) {\n state.heredoc = heredoc[2];\n return \"operator\";\n }\n if (stream.match(/^(?:&&|\\|\\||;;|[|;&])/)) {\n state.command = true;\n return \"operator\";\n }\n if (stream.match(/^(?:\\d?>>?|<|&>)/)) return \"operator\";\n if (stream.eat(/[(){}[\\]]/)) {\n state.command = ch === \"(\" || ch === \"{\";\n if (ch === \"[\" || ch === \"]\") stream.eat(ch);\n return \"punctuation\";\n }\n if (state.command && stream.match(/^[A-Za-z_]\\w*(?==)/)) return \"variable\";\n if (stream.eat(\"=\")) return \"operator\";\n const word = stream.match(/^[^\\s|;&<>()\"'$`=]+/);\n if (word) {\n const text = word[0];\n if (KEYWORDS$1.has(text) && (state.command || text === \"in\" || text === \"do\")) {\n state.command = BEFORE_COMMAND.has(text);\n return \"keyword\";\n }\n if (state.command) {\n state.command = false;\n return BUILTINS.has(text) ? \"keyword\" : \"function\";\n }\n if (/^--?[\\w-]/.test(text)) return \"attribute\";\n if (/^\\d+$/.test(text)) return \"number\";\n return null;\n }\n stream.next();\n return null;\n },\n comment: { line: \"#\" },\n brackets: \"()[]{}\",\n indentAfter: /(?:\\bthen|\\bdo|\\{|\\bin)\\s*(?:#.*)?$/\n });\n // src/languages/sql.ts\n const KEYWORDS = new Set(`select from where and or not in is null like ilike between exists as on join inner left right full outer cross natural using\ngroup by order having limit offset fetch first next rows only union all intersect except distinct case when then else end\ninsert into values update set delete returning create table view index unique primary key foreign references constraint default\ncheck alter add drop column rename to if truncate with recursive begin commit rollback transaction grant revoke\nasc desc nulls last over partition window filter cascade materialized temporary temp replace conflict do nothing true false`.split(/\\s+/).filter(Boolean));\n const TYPES = new Set(`int integer smallint bigint serial bigserial decimal numeric real float double precision char varchar text\nboolean bool date time timestamp timestamptz interval json jsonb uuid bytea blob`.split(/\\s+/));\n /** Reads a quoted run up to its closing quote (doubled quotes stay inside); returns whether it closed. */\n function readQuoted(stream, quote) {\n let ch;\n while ((ch = stream.next()) !== void 0) {\n if (ch === quote) {\n if (stream.eat(quote)) continue;\n return true;\n }\n if (ch === \"\\\\\" && quote === \"'\") stream.next();\n }\n return false;\n }\n /** SQL, the parts most dialects share (PostgreSQL, MySQL, SQLite). Keywords in any case. */\n const sql = defineCodeLanguage({\n name: \"sql\",\n aliases: [\n \"postgres\",\n \"postgresql\",\n \"pgsql\",\n \"mysql\",\n \"sqlite\",\n \"plsql\"\n ],\n startState: () => ({\n comment: false,\n quote: null\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.comment === b.comment && a.quote === b.quote,\n token(stream, state) {\n if (state.comment || stream.match(\"/*\")) {\n state.comment = !stream.skipTo(\"*/\");\n if (state.comment) stream.skipToEnd();\n else stream.pos += 2;\n return \"comment\";\n }\n if (state.quote) {\n const quote = state.quote;\n if (readQuoted(stream, quote)) state.quote = null;\n return quote === \"'\" ? \"string\" : \"variable\";\n }\n if (stream.eatSpace()) return null;\n if (stream.match(\"--\") || stream.match(\"#\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n const ch = stream.peek();\n if (ch === \"'\" || ch === \"\\\"\" || ch === \"`\") {\n stream.next();\n if (!readQuoted(stream, ch)) state.quote = ch;\n return ch === \"'\" ? \"string\" : \"variable\";\n }\n if (stream.match(/^[eEnNxXbB]'/)) {\n if (!readQuoted(stream, \"'\")) state.quote = \"'\";\n return \"string\";\n }\n if (stream.match(/^(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?/)) return \"number\";\n if (stream.match(/^(?:\\$\\d+|[:@][A-Za-z_]\\w*|\\?)/)) return \"variable\";\n const word = stream.match(/^[\\p{L}_][\\p{L}\\p{N}_$]*/u);\n if (word) {\n const lower = word[0].toLowerCase();\n if (stream.string[stream.start - 1] === \".\") return \"property\";\n if (KEYWORDS.has(lower)) return \"keyword\";\n if (TYPES.has(lower)) return \"type\";\n if (stream.match(/^\\s*\\(/, false)) return \"function\";\n return \"variable\";\n }\n if (stream.match(/^(?:::|<>|!=|<=|>=|\\|\\||->>?|[-+*/%<>=~^|&])/)) return \"operator\";\n if (stream.eat(/[(),;.[\\]]/)) return \"punctuation\";\n stream.next();\n return null;\n },\n comment: {\n line: \"--\",\n block: [\"/*\", \"*/\"]\n },\n brackets: \"()[]\",\n autoClose: \"(['\\\"`\"\n });\n // src/languages/yaml.ts\n const SCALAR = /^(?:true|false|yes|no|on|off|null|~)$/i;\n const NUMBER = /^[-+]?(?:\\d[\\d_]*(?:\\.\\d*)?(?:[eE][-+]?\\d+)?|\\.\\d+|0x[\\da-fA-F]+|0o[0-7]+|\\.inf|\\.nan)$/i;\n /** YAML, as in configuration files and front matter. */\n const yaml = defineCodeLanguage({\n name: \"yaml\",\n aliases: [\"yml\"],\n startState: () => ({\n block: -1,\n quote: null,\n flow: 0\n }),\n copyState: (state) => ({ ...state }),\n sameState: (a, b) => a.block === b.block && a.quote === b.quote && a.flow === b.flow,\n token(stream, state) {\n if (stream.pos === 0 && state.block >= 0) {\n if (stream.indentation() > state.block || !stream.string.trim()) {\n stream.skipToEnd();\n return \"string\";\n }\n state.block = -1;\n }\n if (state.quote) {\n const quote = state.quote;\n while (!stream.eol()) {\n const ch = stream.next();\n if (ch === \"\\\\\" && quote === \"\\\"\") stream.next();\n else if (ch === quote) {\n if (quote === \"'\" && stream.eat(\"'\")) continue;\n state.quote = null;\n break;\n }\n }\n return \"string\";\n }\n if (stream.pos === 0 && stream.match(/^(?:---|\\.\\.\\.)(?=\\s|$)/)) return \"meta\";\n if (stream.eatSpace()) return null;\n const ch = stream.peek();\n if (ch === \"#\" && (stream.pos === 0 || /\\s/.test(stream.string[stream.pos - 1]))) {\n stream.skipToEnd();\n return \"comment\";\n }\n if (ch === \"\\\"\" || ch === \"'\") {\n stream.next();\n state.quote = ch;\n const type = yaml.token(stream, state) ?? \"string\";\n return stream.match(/^\\s*:(?=\\s|$)/, false) ? \"property\" : type;\n }\n if (stream.match(/^-(?=\\s|$)/)) return \"punctuation\";\n if (stream.match(/^[&*][^\\s,[\\]{}]+/)) return \"variable\";\n if (stream.match(/^!{1,2}[^\\s,[\\]{}]*/)) return \"meta\";\n if (stream.match(/^[|>][-+]?\\d?(?=\\s*(?:#.*)?$)/)) {\n state.block = stream.indentation();\n return \"operator\";\n }\n if (stream.eat(/[[{]/)) {\n state.flow++;\n return \"punctuation\";\n }\n if (stream.eat(/[\\]}]/)) {\n state.flow = Math.max(0, state.flow - 1);\n return \"punctuation\";\n }\n if (stream.eat(\",\") && state.flow) return \"punctuation\";\n if (stream.match(/^:(?=\\s|$)/) || state.flow && stream.eat(\":\")) return \"punctuation\";\n if (stream.match(/^[^\\s#,[\\]{}:][^#,[\\]{}]*?(?=\\s*:(?:\\s|$))/)) return \"property\";\n const value = stream.match(state.flow ? /^[^,[\\]{}#]+?(?=\\s*(?:[,\\]}]|#|$))/ : /^.+?(?=\\s+#|\\s*$)/);\n if (value) {\n const text = value[0].trim();\n if (SCALAR.test(text)) return \"keyword\";\n if (NUMBER.test(text)) return \"number\";\n return \"string\";\n }\n stream.next();\n return null;\n },\n comment: { line: \"#\" },\n brackets: \"[]{}\",\n autoClose: \"[{'\\\"\",\n indentAfter: /:\\s*(?:[|>][-+]?\\d?)?\\s*(?:#.*)?$/\n });\n // src/worker/index.ts\n /** How long each piece of work runs before yielding to handle cancel/preempt messages (ms). */\n const SLICE = 16;\n /**\n * Reads code and computes diffs in a worker for `DouCodeEditor` and\n * `DouCodeDiff`'s `worker`, so syntax highlighting and large diffs stay off\n * the main thread. Call it in the worker's own module with the languages the\n * editors use, or with a `resolve` callback to lazy-load grammars (such as\n * Shiki) on demand:\n *\n * ```ts\n * // code-worker.ts\n * import { css, serveCodeHighlighting, typescript } from '@dou-ui/code/worker'\n *\n * serveCodeHighlighting([typescript, css])\n * ```\n *\n * Languages with plain-data states send state checkpoints; languages with\n * non-serializable states (such as Shiki's `StateStack`) automatically keep\n * their state in the worker and return flat per-line token arrays.\n */\n function serveCodeHighlighting(languagesOrOptions, scope = globalThis) {\n const options = Array.isArray(languagesOrOptions) ? { languages: languagesOrOptions } : languagesOrOptions;\n const known = /* @__PURE__ */ new Map();\n const register = (language) => {\n for (const [name, item] of languagesIn(language)) if (!known.has(name)) known.set(name, item);\n };\n for (const language of options.languages ?? []) register(language);\n const resolving = /* @__PURE__ */ new Map();\n const open = /* @__PURE__ */ new Map();\n /** Texts still coming in. */\n const opening = /* @__PURE__ */ new Map();\n /** Documents waiting for async `options.resolve(name)`. */\n const pendingOpen = /* @__PURE__ */ new Map();\n /** Queued diff computations by request id, in FIFO order. */\n const diffTasks = /* @__PURE__ */ new Map();\n let timer = null;\n const send = (message) => scope.postMessage(message);\n function targetOf(doc, asked) {\n const lineCount = doc.highlighter.text.lines;\n let wanted = asked.until;\n if (doc.tokenMode) {\n if (asked.tokensTo !== void 0) wanted = Math.max(wanted, asked.tokensTo);\n if (asked.tokenRanges) {\n for (const [, to] of asked.tokenRanges) if (to > wanted) wanted = to;\n }\n }\n return Math.min(lineCount, Math.max(0, wanted));\n }\n function replyTokens(id, doc, asked) {\n const hl = doc.highlighter;\n const total = hl.text.lines;\n if (total === 0) {\n send({\n t: \"tokens\",\n id,\n version: doc.version,\n seq: asked.seq,\n from: 1,\n lines: [],\n frontier: 0\n });\n return;\n }\n if (asked.tokenRanges) {\n const chunks = [];\n for (const [rawFrom, rawTo] of asked.tokenRanges) {\n const from = Math.max(1, Math.min(total, rawFrom));\n const to = Math.max(0, Math.min(total, rawTo));\n if (to < from) continue;\n const lines = [];\n for (let n = from; n <= to; n++) lines.push(hl.line(n) ?? []);\n chunks.push([from, lines]);\n }\n if (chunks.length === 0) {\n send({\n t: \"tokens\",\n id,\n version: doc.version,\n seq: asked.seq,\n from: 1,\n lines: [],\n frontier: hl.frontier\n });\n return;\n }\n if (chunks.length === 1) {\n const [from, lines] = chunks[0];\n send({\n t: \"tokens\",\n id,\n version: doc.version,\n seq: asked.seq,\n from,\n lines,\n frontier: hl.frontier\n });\n return;\n }\n send({\n t: \"tokens\",\n id,\n version: doc.version,\n seq: asked.seq,\n from: chunks[0][0],\n lines: [],\n ranges: chunks,\n frontier: hl.frontier\n });\n return;\n }\n const from = Math.max(1, Math.min(total, asked.tokensFrom ?? 1));\n const to = Math.max(from, Math.min(total, asked.tokensTo ?? asked.until));\n const lines = [];\n for (let n = from; n <= to; n++) lines.push(hl.line(n) ?? []);\n send({\n t: \"tokens\",\n id,\n version: doc.version,\n seq: asked.seq,\n from,\n lines,\n frontier: hl.frontier\n });\n }\n function reply(id, doc) {\n const asked = doc.asked;\n doc.asked = null;\n if (doc.tokenMode) {\n replyTokens(id, doc, asked);\n return;\n }\n try {\n const points = doc.highlighter.checkpoints(asked.from).map(([line, state]) => [line, encodeState(state)]);\n send({\n t: \"states\",\n id,\n version: doc.version,\n seq: asked.seq,\n points\n });\n } catch {\n doc.tokenMode = true;\n replyTokens(id, doc, asked);\n }\n }\n function run() {\n timer = null;\n const deadline = performance.now() + SLICE;\n for (const [diffId, task] of diffTasks) {\n diffTasks.delete(diffId);\n const hunks = diffText(task.original, task.modified, task.options);\n send({\n t: \"diffResult\",\n id: diffId,\n hunks\n });\n if (performance.now() >= deadline) break;\n }\n if (performance.now() < deadline) for (const [id, doc] of open) {\n if (!doc.asked) continue;\n const hl = doc.highlighter;\n const target = targetOf(doc, doc.asked);\n if (hl.ready(target)) {\n reply(id, doc);\n continue;\n }\n hl.work(deadline, target);\n if (doc.asked && hl.ready(target)) reply(id, doc);\n if (performance.now() >= deadline) break;\n }\n let hasUrgent = diffTasks.size > 0;\n if (!hasUrgent) {\n for (const doc of open.values()) if (doc.asked) {\n hasUrgent = true;\n break;\n }\n }\n if (!hasUrgent && performance.now() < deadline) for (const doc of open.values()) {\n if (doc.paused || doc.tokenMode) continue;\n const hl = doc.highlighter;\n if (!hl.ready(hl.text.lines)) {\n hl.work(deadline, hl.text.lines);\n if (performance.now() >= deadline) break;\n }\n }\n if (diffTasks.size > 0) {\n schedule();\n return;\n }\n for (const doc of open.values()) {\n if (doc.asked) {\n schedule();\n return;\n }\n if (!doc.paused && !doc.tokenMode && !doc.highlighter.ready(doc.highlighter.text.lines)) {\n schedule();\n return;\n }\n }\n }\n const schedule = () => {\n timer ??= setTimeout(run, 0);\n };\n function resolveLanguage(name) {\n const existing = known.get(name);\n if (existing) return Promise.resolve(existing);\n const inflight = resolving.get(name);\n if (inflight) return inflight;\n if (!options.resolve) return Promise.resolve(null);\n const promise = Promise.resolve().then(() => options.resolve(name)).then((resolved) => {\n resolving.delete(name);\n if (resolved) {\n if (!known.has(name)) known.set(name, resolved);\n register(resolved);\n return resolved;\n }\n return null;\n }, () => {\n resolving.delete(name);\n return null;\n });\n resolving.set(name, promise);\n return promise;\n }\n function openResolved(id, languageName, language, nested, tabSize, mode) {\n const inside = language ? languagesIn(language) : null;\n const missing = inside ? nested.find((name) => !inside.has(name)) : languageName;\n if (!language || missing) {\n send({\n t: \"unsupported\",\n id,\n missing\n });\n return false;\n }\n opening.set(id, {\n language,\n tabSize,\n mode,\n lines: []\n });\n return true;\n }\n function handleMessage(message) {\n if (message.t === \"diff\") {\n diffTasks.set(message.id, {\n id: message.id,\n original: message.original,\n modified: message.modified,\n options: message.options\n });\n schedule();\n return;\n }\n if (message.t === \"cancelDiff\") {\n diffTasks.delete(message.id);\n return;\n }\n if (message.t === \"open\") {\n const mode = message.mode ?? \"auto\";\n const immediate = known.get(message.language);\n if (immediate || !options.resolve) {\n openResolved(message.id, message.language, immediate ?? null, message.nested, message.tabSize, mode);\n return;\n }\n const pending = {\n nested: message.nested,\n tabSize: message.tabSize,\n mode,\n messages: [],\n closed: false\n };\n pendingOpen.set(message.id, pending);\n resolveLanguage(message.language).then((language) => {\n if (pending.closed || pendingOpen.get(message.id) !== pending) return;\n pendingOpen.delete(message.id);\n if (!openResolved(message.id, message.language, language, pending.nested, pending.tabSize, pending.mode)) return;\n for (const buffered of pending.messages) handleMessage(buffered);\n });\n return;\n }\n if (message.t === \"close\") {\n const waiting = pendingOpen.get(message.id);\n if (waiting) {\n waiting.closed = true;\n pendingOpen.delete(message.id);\n }\n open.delete(message.id);\n opening.delete(message.id);\n return;\n }\n const waiting = pendingOpen.get(message.id);\n if (waiting) {\n if (message.t === \"read\") waiting.messages = waiting.messages.filter((item) => item.t !== \"read\");\n else if (message.t === \"cancel\") waiting.messages = waiting.messages.filter((item) => item.t !== \"read\");\n waiting.messages.push(message);\n return;\n }\n if (message.t === \"text\") {\n const incoming = opening.get(message.id);\n if (!incoming) return;\n for (const line of message.lines) incoming.lines.push(line);\n if (!message.done) return;\n opening.delete(message.id);\n const tokenMode = incoming.mode === \"tokens\" || incoming.mode === \"auto\" && incoming.language.workerMode === \"tokens\";\n open.set(message.id, {\n highlighter: new CodeHighlighter(incoming.language, CodeText.of(incoming.lines), { tabSize: incoming.tabSize }),\n version: 0,\n tokenMode,\n paused: false,\n asked: null\n });\n } else {\n const doc = open.get(message.id);\n if (!doc) return;\n if (message.t === \"change\") {\n const changes = ChangeSet.of(message.changes.map(([from, to, insert]) => ({\n from,\n to,\n insert\n })), message.length);\n doc.highlighter.update(changes.apply(doc.highlighter.text), changes);\n doc.version++;\n } else if (message.t === \"cancel\") {\n doc.asked = null;\n doc.paused = true;\n return;\n } else {\n doc.paused = false;\n doc.asked = {\n from: message.from,\n until: message.until,\n tokensFrom: message.tokensFrom,\n tokensTo: message.tokensTo,\n tokenRanges: message.tokenRanges,\n seq: message.seq\n };\n }\n }\n schedule();\n }\n scope.addEventListener(\"message\", (event) => {\n const message = event.data;\n if (!message || typeof message !== \"object\") return;\n handleMessage(message);\n });\n }\n // src/worker/default.ts\n serveCodeHighlighting([\n javascript,\n typescript,\n jsx,\n tsx,\n css,\n scss,\n json,\n html,\n vue,\n markdown,\n python,\n shell,\n sql,\n yaml\n ]);\n})();\n\n//# sourceMappingURL=default-BWWFJmzn.js.map";
|
|
3
3
|
var blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
4
4
|
function WorkerWrapper(options) {
|
|
5
5
|
let objURL;
|