@teipublisher/oddity-language-server 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/edit.js +1211 -0
- package/dist/edit.js.map +7 -0
- package/dist/index.js +1701 -0
- package/dist/index.js.map +7 -0
- package/dist/node.cjs +45925 -0
- package/dist/node.cjs.map +7 -0
- package/package.json +74 -4
- package/schema/README.md +45 -0
- package/schema/docbook/docbook.rng +18457 -0
- package/schema/jats/BITS-embedded-index2.ent.rng +340 -0
- package/schema/jats/BITS-question-answer2.ent.rng +795 -0
- package/schema/jats/JATS-XHTMLtablesetup1-3.ent.rng +614 -0
- package/schema/jats/JATS-ali-namespace1-3.ent.rng +284 -0
- package/schema/jats/JATS-archivearticle1-3-mathml3.rng +1277 -0
- package/schema/jats/JATS-archivecustom-classes1-3.ent.rng +427 -0
- package/schema/jats/JATS-archivecustom-mixes1-3.ent.rng +630 -0
- package/schema/jats/JATS-archivecustom-models1-3.ent.rng +2205 -0
- package/schema/jats/JATS-articlemeta1-3.ent.rng +3138 -0
- package/schema/jats/JATS-backmatter1-3.ent.rng +601 -0
- package/schema/jats/JATS-chars1-3.ent.rng +715 -0
- package/schema/jats/JATS-common-atts1-3.ent.rng +367 -0
- package/schema/jats/JATS-common1-3.ent.rng +6007 -0
- package/schema/jats/JATS-default-classes1-3.ent.rng +1953 -0
- package/schema/jats/JATS-default-mixes1-3.ent.rng +583 -0
- package/schema/jats/JATS-display1-3.ent.rng +1669 -0
- package/schema/jats/JATS-format1-3.ent.rng +1256 -0
- package/schema/jats/JATS-funding1-3.ent.rng +1389 -0
- package/schema/jats/JATS-journalmeta1-3.ent.rng +691 -0
- package/schema/jats/JATS-link1-3.ent.rng +664 -0
- package/schema/jats/JATS-list1-3.ent.rng +747 -0
- package/schema/jats/JATS-math1-3.ent.rng +620 -0
- package/schema/jats/JATS-mathml3-mathmlsetup1-3.ent.rng +459 -0
- package/schema/jats/JATS-nlmcitation1-3.ent.rng +522 -0
- package/schema/jats/JATS-para1-3.ent.rng +780 -0
- package/schema/jats/JATS-phrase1-3.ent.rng +725 -0
- package/schema/jats/JATS-references1-3.ent.rng +1713 -0
- package/schema/jats/JATS-related-object1-3.ent.rng +453 -0
- package/schema/jats/JATS-section1-3.ent.rng +482 -0
- package/schema/jats/mathml3-qname1.mod.rng +61 -0
- package/schema/jats/mathml3.rng +4094 -0
- package/schema/jats/xhtml-inlstyle-1.mod.rng +37 -0
- package/schema/jats/xhtml-table-1.mod.rng +426 -0
- package/schema/odd/teipublisher_odds.rng +12769 -0
- package/schema/opm/opm.schema.json +402 -0
- package/schema/tei/tei_all.rng +23212 -0
- package/src/core/association.ts +155 -0
- package/src/core/complete.ts +147 -0
- package/src/core/elements.ts +86 -0
- package/src/core/opmToml.ts +432 -0
- package/src/core/outline.ts +156 -0
- package/src/core/schema.ts +55 -0
- package/src/core/tags.ts +104 -0
- package/src/core/toml.ts +64 -0
- package/src/core/tomlScan.ts +155 -0
- package/src/core/validate.ts +128 -0
- package/src/core/wellformed.ts +16 -0
- package/src/edit.ts +12 -0
- package/src/index.ts +17 -0
- package/src/node.ts +39 -0
- package/src/server/server.ts +322 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/validate.ts", "../src/core/complete.ts", "../src/core/wellformed.ts", "../src/core/schema.ts", "../src/core/toml.ts", "../src/core/association.ts", "../src/core/tags.ts", "../src/core/outline.ts", "../src/core/opmToml.ts", "../schema/opm/opm.schema.json", "../src/core/tomlScan.ts", "../src/core/elements.ts"],
|
|
4
|
+
"sourcesContent": ["// \u2500\u2500 RELAX NG validation of one XML text with salve, errors as text ranges \u2500\u2500\n// Pure, so tests run it without a worker; runtime/validator.ts is the worker around it.\nimport {\n AnyName, AttributeNameError, AttributeValueError, ChoiceError, DefaultNameResolver, Name, NameChoice, NsName,\n type BaseName, type Grammar, type ValidationError,\n} from 'salve-annos';\nimport { SaxesParser, type SaxesTagNS } from 'saxes';\n\nexport interface Problem { from: number; to: number; message: string }\n\n/** More would only slow the editor down; the first ones are what needs fixing. */\nconst MAX = 200;\n\n/** A name as the document would write it: prefixed where it declares one for the namespace. */\nfunction nameText(n: BaseName, resolver: DefaultNameResolver, attribute: boolean): string {\n if (n instanceof Name) {\n if (!n.ns || (attribute && n.ns === '')) return n.name;\n const q = resolver.unresolveName(n.ns, n.name);\n return q ?? `${n.name} (${n.ns})`;\n }\n if (n instanceof NameChoice) return `${nameText(n.a, resolver, attribute)} or ${nameText(n.b, resolver, attribute)}`;\n if (n instanceof NsName) return `any name in ${n.ns}`;\n if (n instanceof AnyName) return 'any name';\n return String(n);\n}\n\n/** salve's messages, worded as the editor shows them; `value` is the attribute value just checked. */\nfunction messageOf(e: ValidationError, resolver: DefaultNameResolver, value?: string): string {\n const attribute = e instanceof AttributeNameError || e instanceof AttributeValueError;\n const names = e.getNames().map(n => nameText(n, resolver, attribute));\n const one = names.join(', ');\n switch (e.msg) {\n case 'tag not allowed here': return `<${one}> is not allowed here`;\n case 'tag required': return `<${one}> is required here`;\n case 'unexpected end tag': return `</${one}> was not expected here`;\n case 'attribute not allowed here': return `@${one} is not allowed here`;\n case 'attribute missing': return `Required attribute @${one} is missing`;\n case 'invalid attribute value': return value === undefined ? `Invalid value for @${one}` : `\"${value}\" is not a valid value for @${one}`;\n case 'text not allowed here': return 'Text is not allowed here';\n }\n if (e instanceof ChoiceError) return `Expected one of: ${names.map(n => `<${n}>`).join(', ')}`;\n const text = e.toStringWithNames(names);\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n/** Validate xml against grammar: well-formedness first, then the schema, stopping at the first syntax error. */\nexport function validate(grammar: Grammar, xml: string): Problem[] {\n const resolver = new DefaultNameResolver();\n const walker = grammar.newWalker(resolver);\n const parser = new SaxesParser({ xmlns: true, position: true });\n const problems: Problem[] = [];\n let broken = false;\n\n // where the parser last was: tags are located from there, backwards to their '<'\n let tagFrom = 0, tagTo = 0, textFrom = 0;\n let text = '';\n const report = (r: ReturnType<typeof walker.fireEvent>, from: number, to: number, value?: string) => {\n if (!r) return;\n for (const e of r) if (problems.length < MAX) problems.push({ from, to, message: messageOf(e, resolver, value) });\n };\n const flush = () => {\n if (text === '') return;\n // whitespace between elements is never an error worth showing\n if (text.trim() !== '') report(walker.fireEvent('text', [text]), textFrom, tagFrom);\n text = '';\n };\n /** The span of a tag's name, given where its '<' is. */\n const nameSpan = (from: number, name: string, closing: boolean) => {\n const start = from + (closing ? 2 : 1);\n return [start, start + name.length] as const;\n };\n\n parser.on('opentag', (node: SaxesTagNS) => {\n if (broken) return;\n tagTo = parser.position;\n tagFrom = xml.lastIndexOf('<', tagTo - 1);\n flush();\n resolver.enterContext();\n for (const [qn, a] of Object.entries(node.attributes)) {\n if (qn === 'xmlns') resolver.definePrefix('', a.value);\n else if (a.prefix === 'xmlns') resolver.definePrefix(a.local, a.value);\n }\n const [nf, nt] = nameSpan(tagFrom, node.name, false);\n report(walker.fireEvent('enterStartTag', [node.uri, node.local]), nf, nt);\n const tag = xml.slice(tagFrom, tagTo);\n for (const [qn, a] of Object.entries(node.attributes)) {\n if (qn === 'xmlns' || a.prefix === 'xmlns') continue;\n const at = tag.search(new RegExp(`\\\\s${qn.replace(/[.*+?^${}()|[\\]\\\\-]/g, '\\\\$&')}\\\\s*=`));\n const af = at < 0 ? nf : tagFrom + at + 1, aend = at < 0 ? nt : af + qn.length;\n report(walker.fireEvent('attributeName', [a.uri, a.local]), af, aend);\n report(walker.fireEvent('attributeValue', [a.value]), af, aend, a.value);\n }\n report(walker.fireEvent('leaveStartTag', []), nf, nt);\n if (node.isSelfClosing) return;\n textFrom = tagTo;\n });\n parser.on('closetag', (node: SaxesTagNS) => {\n if (broken) return;\n if (node.isSelfClosing) {\n // the start tag was the whole element\n report(walker.fireEvent('endTag', [node.uri, node.local]), ...nameSpan(tagFrom, node.name, false));\n } else {\n tagTo = parser.position;\n tagFrom = xml.lastIndexOf('</', tagTo - 1);\n flush();\n report(walker.fireEvent('endTag', [node.uri, node.local]), ...nameSpan(tagFrom, node.name, true));\n }\n resolver.leaveContext();\n textFrom = tagTo;\n });\n parser.on('text', s => { text += s; });\n parser.on('cdata', s => { text += s; });\n parser.on('error', e => {\n if (broken) return;\n broken = true;\n const at = Math.min(parser.position, xml.length);\n problems.push({ from: Math.max(0, at - 1), to: at, message: e.message.replace(/^(?:[^:\\n]*:)?\\d+:\\d+: /, '') });\n });\n\n // saxes keeps going after an error, but the walker would only report the fallout:\n // the handlers above stop, and what came before the error stays reported\n try { parser.write(xml).close(); } catch { /* reported through 'error' */ }\n if (broken) return problems;\n\n const end = walker.end();\n report(end, tagFrom, tagTo);\n return problems;\n}\n", "// \u2500\u2500 what the schema allows at the cursor, from salve's walker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Pure, like validate.ts: the worker (runtime/validator.ts) runs it, tests call it directly.\n// The text before the cursor is fed to the walker, which then knows what may come next,\n// in document order: after <TEI> only <teiHeader>, inside <hi only its attributes.\nimport { DefaultNameResolver, Name, NameChoice, type BaseName, type Grammar } from 'salve-annos';\nimport { SaxesParser, type SaxesTagNS } from 'saxes';\n\nexport interface Suggestion { kind: 'element' | 'attribute' | 'value'; label: string; detail?: string; info?: string }\n/** Suggestions for the text from `from` to the cursor; `inTag` is false between tags, where they are only offered on request. */\nexport interface Possible { from: number; inTag: boolean; suggestions: Suggestion[] }\n\n/** A detail longer than this is cut at a word. */\nconst DETAIL_MAX = 80;\n\n/**\n * detail and info from an a:documentation. TEI's open with the gloss in parentheses,\n * \"(paragraph) marks paragraphs in prose. [3.1. Paragraphs]\": the gloss becomes the detail,\n * the chapters cited at the end are dropped. Otherwise the detail is the first sentence.\n */\nexport function described(doc: string | undefined): Pick<Suggestion, 'detail' | 'info'> {\n const text = (doc ?? '').replace(/\\s+/g, ' ').trim().replace(/\\s*\\[\\d+(?:\\.\\d+)*\\.\\s[^[\\]]*\\]$/, '');\n if (!text) return {};\n const gloss = text.match(/^\\(([^()]+)\\)\\s*(.*)$/);\n if (gloss) return gloss[2] ? { detail: gloss[1], info: gloss[2] } : { detail: gloss[1] };\n let detail = text.split(/(?<=[.;:])\\s/, 1)[0].replace(/[.;:]$/, '');\n if (detail.length > DETAIL_MAX) detail = detail.slice(0, DETAIL_MAX).replace(/\\s\\S*$/, '') + '\u2026';\n return detail === text ? { detail } : { detail, info: text };\n}\n\n/** The names a name pattern stands for, as the document can write them: in a namespace it has a prefix (or the default) for. */\nfunction names(n: BaseName, resolver: DefaultNameResolver, attribute: boolean): { label: string; doc?: string }[] {\n if (n instanceof NameChoice) return [...names(n.a, resolver, attribute), ...names(n.b, resolver, attribute)];\n if (!(n instanceof Name)) return []; // any name, or any in a namespace: nothing to offer by name\n const label = attribute && n.ns === '' ? n.name : resolver.unresolveName(n.ns, n.name);\n return label ? [{ label, doc: n.documentation }] : [];\n}\n\nconst ATTR = /\\s([^\\s=/>]+)\\s*=\\s*(\"[^\"]*\"|'[^']*')/g;\n\n/** Where the cursor is: in a start tag's name, among its attributes, in a value, or between tags. */\nfunction context(before: string) {\n // a '<' in a comment, CDATA section or processing instruction is not a tag\n for (const [open, close] of [['<!--', '-->'], ['<![CDATA[', ']]>'], ['<?', '?>']]) {\n if (before.lastIndexOf(open) > before.lastIndexOf(close)) return null;\n }\n const lt = before.lastIndexOf('<');\n if (lt <= before.lastIndexOf('>')) return { at: 'text' as const, tagStart: before.length };\n const tag = before.slice(lt);\n if (/^<[/!?]/.test(tag)) return null;\n const partialName = tag.match(/^<([^\\s/>]*)$/);\n if (partialName) return { at: 'name' as const, tagStart: lt, typed: partialName[1] };\n const name = tag.match(/^<([^\\s/>]+)/)?.[1];\n if (!name) return null;\n const done = [...tag.matchAll(ATTR)];\n const tail = tag.slice(done.length ? done[done.length - 1].index! + done[done.length - 1][0].length : name.length + 1);\n const attrs = done.map(m => ({ name: m[1], value: m[2].slice(1, -1) }));\n const inValue = tail.match(/\\s([^\\s=/>]+)\\s*=\\s*([\"'])([^\"']*)$/);\n if (inValue) return { at: 'value' as const, tagStart: lt, name, attrs, attr: inValue[1], typed: inValue[3] };\n const inName = tail.match(/\\s([^\\s=/>]*)$/);\n if (inName) return { at: 'attribute' as const, tagStart: lt, name, attrs, typed: inName[1] };\n return null;\n}\n\n/** What may be written at position `at` of xml. */\nexport function possibleAt(grammar: Grammar, xml: string, at: number): Possible | null {\n const before = xml.slice(0, at);\n const ctx = context(before);\n if (!ctx) return null;\n\n const resolver = new DefaultNameResolver();\n const walker = grammar.newWalker(resolver);\n const parser = new SaxesParser({ xmlns: true });\n let text = '';\n const flush = () => { if (text.trim() !== '') walker.fireEvent('text', [text]); text = ''; };\n // the text before the cursor is rarely valid, or even finished: errors are ignored, the walker goes on\n parser.on('error', () => {});\n parser.on('opentag', (node: SaxesTagNS) => {\n flush();\n resolver.enterContext();\n for (const [qn, a] of Object.entries(node.attributes)) {\n if (qn === 'xmlns') resolver.definePrefix('', a.value);\n else if (a.prefix === 'xmlns') resolver.definePrefix(a.local, a.value);\n }\n walker.fireEvent('enterStartTag', [node.uri, node.local]);\n for (const [qn, a] of Object.entries(node.attributes)) {\n if (qn === 'xmlns' || a.prefix === 'xmlns') continue;\n walker.fireEvent('attributeName', [a.uri, a.local]);\n walker.fireEvent('attributeValue', [a.value]);\n }\n walker.fireEvent('leaveStartTag', []);\n });\n parser.on('closetag', (node: SaxesTagNS) => { flush(); walker.fireEvent('endTag', [node.uri, node.local]); resolver.leaveContext(); });\n parser.on('text', s => { text += s; });\n parser.on('cdata', s => { text += s; });\n try { parser.write(xml.slice(0, ctx.tagStart)); } catch { /* ignored, as above */ }\n flush();\n\n const seen = new Set<string>();\n const suggestions: Suggestion[] = [];\n const add = (kind: Suggestion['kind'], label: string, doc?: string) => {\n if (seen.has(label)) return;\n seen.add(label);\n suggestions.push({ kind, label, ...described(doc) });\n };\n\n if (ctx.at === 'text' || ctx.at === 'name') {\n for (const ev of walker.possible()) {\n if (ev.name === 'enterStartTag') for (const n of names(ev.param, resolver, false)) add('element', n.label, n.doc);\n }\n return { from: at - (ctx.at === 'name' ? ctx.typed.length : 0), inTag: ctx.at === 'name', suggestions };\n }\n\n // inside a start tag: enter it with the attributes already written, then ask\n resolver.enterContext();\n for (const a of ctx.attrs) {\n if (a.name === 'xmlns') resolver.definePrefix('', a.value);\n else if (a.name.startsWith('xmlns:')) resolver.definePrefix(a.name.slice(6), a.value);\n }\n const element = resolver.resolveName(ctx.name);\n if (!element) return null;\n walker.fireEvent('enterStartTag', [element.ns, element.name]);\n const written = new Set<string>();\n for (const a of ctx.attrs) {\n written.add(a.name);\n if (a.name === 'xmlns' || a.name.startsWith('xmlns:') || (ctx.at === 'value' && a.name === ctx.attr)) continue;\n const n = resolver.resolveName(a.name, true);\n if (!n) continue;\n walker.fireEvent('attributeName', [n.ns, n.name]);\n walker.fireEvent('attributeValue', [a.value]);\n }\n\n if (ctx.at === 'attribute') {\n for (const ev of walker.possible()) {\n if (ev.name !== 'attributeName') continue;\n for (const n of names(ev.param, resolver, true)) if (!written.has(n.label)) add('attribute', n.label, n.doc);\n }\n return { from: at - ctx.typed.length, inTag: true, suggestions };\n }\n\n const n = resolver.resolveName(ctx.attr, true);\n if (!n) return null;\n walker.fireEvent('attributeName', [n.ns, n.name]);\n for (const ev of walker.possible()) {\n if (ev.name === 'attributeValue' && typeof ev.param === 'string') add('value', ev.param, ev.documentation);\n }\n return { from: at - ctx.typed.length, inTag: true, suggestions };\n}\n", "// \u2500\u2500 well-formedness alone, for documents without a schema \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nimport { SaxesParser } from 'saxes';\nimport type { Problem } from './validate.ts';\n\n/** The first syntax error in xml, if any, as validate() reports it. */\nexport function wellFormed(xml: string): Problem[] {\n const parser = new SaxesParser({ xmlns: true, position: true });\n const problems: Problem[] = [];\n parser.on('error', e => {\n if (problems.length) return;\n const at = Math.min(parser.position, xml.length);\n problems.push({ from: Math.max(0, at - 1), to: at, message: e.message.replace(/^(?:[^:\\n]*:)?\\d+:\\d+: /, '') });\n });\n try { parser.write(xml).close(); } catch { /* reported through 'error' */ }\n return problems;\n}\n", "// \u2500\u2500 compiled RELAX NG grammars, kept once and shared by every document \u2500\u2500\u2500\u2500\u2500\n// Compiling a large RNG takes the better part of a second, so a grammar is\n// compiled the first time it is asked for and kept until one of the files it\n// was read from changes (invalidate).\nimport { convertRNGToPattern, type Grammar, type Resource } from 'salve-annos';\n\n/** Reads the text of an RNG (or a file it includes) by URL. */\nexport type ReadText = (url: URL) => Promise<string>;\n\ninterface Entry { grammar: Promise<Grammar>; files: Set<string> }\n\nexport class Grammars {\n private entries = new Map<string, Entry>();\n private readText: ReadText;\n\n constructor(readText: ReadText) {\n this.readText = readText;\n }\n\n /** The grammar of the RNG at url, compiled once. */\n get(url: string): Promise<Grammar> {\n const known = this.entries.get(url);\n if (known) return known.grammar;\n const files = new Set<string>();\n const resourceLoader = {\n load: async (u: URL): Promise<Resource> => {\n files.add(u.href);\n const text = await this.readText(u);\n return { url: u, getText: async () => text };\n },\n };\n // the options type wants every field; salve fills in the others\n const grammar = convertRNGToPattern(new URL(url), { resourceLoader } as Parameters<typeof convertRNGToPattern>[1])\n .then(r => r.pattern);\n const entry = { grammar, files };\n this.entries.set(url, entry);\n // a schema that failed to compile is tried again next time\n grammar.catch(() => { if (this.entries.get(url) === entry) this.entries.delete(url); });\n return grammar;\n }\n\n /** Forget every grammar read from url, or all of them. Returns whether any was dropped. */\n invalidate(url?: string): boolean {\n if (url === undefined) {\n const any = this.entries.size > 0;\n this.entries.clear();\n return any;\n }\n let dropped = false;\n for (const [key, e] of this.entries) {\n if (key === url || e.files.has(url)) { this.entries.delete(key); dropped = true; }\n }\n return dropped;\n }\n}\n", "// \u2500\u2500 opm.toml: write the keys the page controls, read the few it needs \u2500\u2500\u2500\u2500\u2500\n// Reading parses the whole file with smol-toml (TOML 1.0). Writing does not\n// serialize: the edits leave every other line of the file, comments included, as it is.\nimport { parse } from 'smol-toml';\n\nexport type TomlValue = string | string[];\nexport type TomlConfig = Record<string, Record<string, TomlValue>>;\n\nconst q = (s: string) => JSON.stringify(s);\nconst sectionEnd = (lines: string[], head: number) => {\n for (let i = head + 1; i < lines.length; i++) if (/^\\s*\\[/.test(lines[i])) return i;\n return lines.length;\n};\n\n/** Set section.key = value in place, keeping everything else in the file as it is. */\nexport function setToml(text: string, section: string, key: string, value: string): string {\n const line = `${key} = ${q(value)}`, lines = text ? text.split('\\n') : [];\n const head = lines.findIndex(l => l.trim() === `[${section}]`);\n if (head < 0) return (text && !text.endsWith('\\n') ? text + '\\n' : text) + (text ? '\\n' : '') + `[${section}]\\n${line}\\n`;\n const end = sectionEnd(lines, head), re = new RegExp(`^\\\\s*${key}\\\\s*=`);\n for (let i = head + 1; i < end; i++) if (re.test(lines[i])) { lines[i] = line; return lines.join('\\n'); }\n lines.splice(head + 1, 0, line);\n return lines.join('\\n');\n}\n\n/** Drop section.key, leaving the rest of the file as it is. */\nexport function unsetToml(text: string, section: string, key: string): string {\n const lines = text.split('\\n'), head = lines.findIndex(l => l.trim() === `[${section}]`);\n if (head < 0) return text;\n const end = sectionEnd(lines, head), re = new RegExp(`^\\\\s*${key}\\\\s*=`);\n for (let i = head + 1; i < end; i++) if (re.test(lines[i])) { lines.splice(i, 1); break; }\n return lines.join('\\n');\n}\n\n/**\n * The string and string-array values of a TOML file, by table: `[transform.web] template = \u2026`,\n * `[transform] web.template = \u2026` and `transform.web.template = \u2026` all end up under\n * cfg['transform.web'].template. Other values and arrays of tables are left out.\n * A file that is not valid TOML gives no values, as opm would not run with it either.\n */\nexport function readToml(text: string): TomlConfig {\n let doc: Record<string, unknown>;\n try { doc = parse(text); } catch { return {}; }\n const cfg: TomlConfig = {};\n const walk = (table: Record<string, unknown>, path: string[]) => {\n for (const [key, v] of Object.entries(table)) {\n if (typeof v === 'string' || (Array.isArray(v) && v.length && v.every(x => typeof x === 'string'))) {\n (cfg[path.join('.')] ||= {})[key] = v as TomlValue;\n } else if (Array.isArray(v) && !v.length) {\n (cfg[path.join('.')] ||= {})[key] = [];\n } else if (v && typeof v === 'object' && !Array.isArray(v) && !(v instanceof Date)) {\n walk(v as Record<string, unknown>, [...path, key]);\n }\n }\n };\n walk(doc, []);\n return cfg;\n}\n\n/** A string value from the config, or '' when it is missing or not a string. */\nexport const tomlString = (cfg: TomlConfig, section: string, key: string): string => {\n const v = cfg[section]?.[key];\n return typeof v === 'string' ? v : '';\n};\n", "// \u2500\u2500 which RELAX NG schema an XML file gets \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// The same order as opm studio (src/ui/xmlSchema.ts there):\n// 1. a local RNG named by the document's <?xml-model?>\n// 2. for documents other than ODDs, [editor] schema in the nearest opm.toml\n// 3. a default by vocabulary: TEI Publisher's ODD schema for ODDs, tei_all for TEI,\n// DocBook 5.2 and JATS 1.3 Archiving\n// Everything is a URL, so relative paths resolve the same way on every platform.\nimport { readToml, tomlString } from './toml.ts';\n\nexport const RNG_NS = 'http://relaxng.org/ns/structure/1.0';\n\n/** What association needs to know about files: synchronous, as the files are small or only checked. */\nexport interface Files {\n exists(url: string): boolean;\n read(url: string): string | undefined;\n}\n\n/** Default schema URL by vocabulary ('odd', 'tei', \u2026). */\nexport type Defaults = Record<string, string | undefined>;\n\nexport interface SchemaChoice {\n /** URL of the main RNG. */\n url: string;\n /** Where the choice came from. */\n via: 'xml-model' | 'project' | 'default';\n}\n\nexport const isOdd = (url: string) => /\\.odd$/i.test(new URL(url).pathname);\n\n/** The main file of each default schema, relative to the schema folder shipped with the package. */\nexport const DEFAULT_SCHEMA_FILES: Record<string, string> = {\n odd: 'odd/teipublisher_odds.rng',\n tei: 'tei/tei_all.rng',\n docbook: 'docbook/docbook.rng',\n jats: 'jats/JATS-archivearticle1-3-mathml3.rng',\n};\n\n/** Where each default schema is published; documents often name these in their <?xml-model?>. */\nexport const PUBLIC_SCHEMA_URLS: Record<string, string> = {\n tei: 'https://tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng',\n docbook: 'https://cdn.docbook.org/schema/5.2/rng/docbook.rng',\n jats: 'https://jats.nlm.nih.gov/archiving/1.3/rng/JATS-archivearticle1-3-mathml3.rng',\n};\n\n/**\n * The default schema a published schema URL stands for, so that the bundled copy is used\n * instead of fetching it. Any JATS tag set maps to Archiving, the loosest of them.\n */\nexport function publicSchema(url: string): string | undefined {\n if (/^https?:\\/\\/(www\\.)?tei-c\\.org\\/.*\\/tei_all\\.rng$/i.test(url)) return 'tei';\n if (/^https?:\\/\\/([\\w-]+\\.)?docbook\\.org\\/.*\\/docbook\\.rng$/i.test(url)) return 'docbook';\n if (/^https?:\\/\\/jats\\.nlm\\.nih\\.gov\\/.*\\.rng$/i.test(url)) return 'jats';\n return undefined;\n}\n\n/** The vocabulary of a document by namespace, root element or doctype; '' for none we know. */\nexport function vocabulary(text: string): string {\n const head = text.slice(0, 5000);\n if (head.includes('http://www.tei-c.org/ns/1.0') || /<(TEI|teiCorpus)[\\s>]/.test(head)) return 'tei';\n if (head.includes('http://docbook.org/ns/docbook')) return 'docbook';\n // JATS has no namespace: its doctype, or an <article> without one (DocBook's has its own)\n // that says it is JATS by @dtd-version, @article-type or its <front>\n if (/<!DOCTYPE\\s+article\\s+PUBLIC\\s+\"-\\/\\/NLM\\/\\/DTD/.test(head)) return 'jats';\n const article = head.match(/<article(?=[\\s>])[^>]*>/)?.[0];\n if (article && !/\\sxmlns\\s*=/.test(article) && (/\\s(dtd-version|article-type)\\s*=/.test(article) || /<front[\\s>]/.test(head))) return 'jats';\n return '';\n}\n\n/** The <?xml-model?> processing instructions in the head of a document, with their pseudo-attributes. */\nexport function xmlModels(text: string): { from: number; to: number; href?: string; schematypens?: string; raw: string }[] {\n const out = [];\n for (const m of text.slice(0, 5000).matchAll(/<\\?xml-model\\s([^?]*)\\?>/g)) {\n const pseudo = (name: string) => m[1].match(new RegExp(`\\\\b${name}\\\\s*=\\\\s*[\"']([^\"']*)[\"']`))?.[1];\n out.push({ from: m.index!, to: m.index! + m[0].length, href: pseudo('href'), schematypens: pseudo('schematypens'), raw: m[0] });\n }\n return out;\n}\n\n/** True for an xml-model PI that points at a RELAX NG schema (not Schematron). */\nexport const isRngModel = (pi: { href?: string; schematypens?: string; raw: string }) =>\n pi.schematypens === RNG_NS || (!pi.schematypens && !!pi.href && /\\.rng$/i.test(pi.href) && !/schematron/i.test(pi.raw));\n\n/** URL of the folder (ending in '/') holding the nearest opm.toml above url, stopping at any of stops. */\nexport function projectRoot(url: string, files: Files, stops: string[] = []): string | undefined {\n let dir = new URL('./', url);\n for (;;) {\n if (files.exists(new URL('opm.toml', dir).href)) return dir.href;\n const parent = new URL('../', dir);\n if (parent.href === dir.href || stops.some(s => sameDir(s, dir.href))) return undefined;\n dir = parent;\n }\n}\n\nconst sameDir = (a: string, b: string) => a.replace(/\\/?$/, '/') === b.replace(/\\/?$/, '/');\n\n/** The schema of the document at url with text, or null when it has none. */\nexport function schemaFor(url: string, text: string, files: Files, defaults: Defaults, stops: string[] = []): SchemaChoice | null {\n for (const pi of xmlModels(text)) {\n if (!isRngModel(pi) || !pi.href) continue;\n // a published default schema is used from the bundled copy; other remote ones are left alone\n if (/^(https?|ftp):/i.test(pi.href)) {\n const bundled = defaults[publicSchema(pi.href) ?? ''];\n if (bundled) return { url: bundled, via: 'xml-model' };\n continue;\n }\n const target = new URL(pi.href, url).href;\n if (files.exists(target)) return { url: target, via: 'xml-model' };\n }\n const odd = isOdd(url);\n if (!odd) {\n const root = projectRoot(url, files, stops);\n const toml = root && files.read(new URL('opm.toml', root).href);\n const configured = toml ? tomlString(readToml(toml), 'editor', 'schema') : '';\n if (configured && /\\.rng$/i.test(configured)) {\n const bundled = defaults[publicSchema(configured) ?? ''];\n if (bundled) return { url: bundled, via: 'project' };\n const target = new URL(configured, root).href;\n if (files.exists(target)) return { url: target, via: 'project' };\n }\n }\n const fallback = defaults[odd ? 'odd' : vocabulary(text)];\n return fallback ? { url: fallback, via: 'default' } : null;\n}\n\n/** A relative href from the document at `from` to `to`, or `to` itself when they share no root. */\nexport function relativeHref(from: string, to: string): string {\n const a = new URL(from), b = new URL(to);\n if (a.protocol !== b.protocol || a.host !== b.host) return to;\n const dir = a.pathname.split('/').slice(0, -1), target = b.pathname.split('/');\n let i = 0;\n while (i < dir.length && i < target.length - 1 && dir[i] === target[i]) i++;\n return [...Array(dir.length - i).fill('..'), ...target.slice(i)].join('/');\n}\n\nexport interface TextEdit { from: number; to: number; insert: string }\n\n/**\n * The edit that makes text associate with the RNG at href: it replaces the first RELAX NG\n * xml-model PI, or adds one after the XML declaration. With href null it removes them all.\n */\nexport function xmlModelEdits(text: string, href: string | null): TextEdit[] {\n const nl = text.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const models = xmlModels(text).filter(isRngModel);\n const pi = href && `<?xml-model href=\"${href.replace(/&/g, '&').replace(/\"/g, '"')}\" type=\"application/xml\" schematypens=\"${RNG_NS}\"?>`;\n const removal = (m: { from: number; to: number }): TextEdit => {\n const after = text.slice(m.to).match(/^\\r?\\n/)?.[0].length ?? 0;\n return { from: m.from, to: m.to + after, insert: '' };\n };\n if (!pi) return models.map(removal);\n if (models.length) return [{ from: models[0].from, to: models[0].to, insert: pi }, ...models.slice(1).map(removal)];\n const decl = text.match(/^\uFEFF?<\\?xml\\s[^?]*\\?>/);\n if (decl) return [{ from: decl[0].length, to: decl[0].length, insert: nl + pi }];\n const bom = text.startsWith('\uFEFF') ? 1 : 0;\n return [{ from: bom, to: bom, insert: pi + nl }];\n}\n", "// \u2500\u2500 start and end tags: matching pairs and closing tags \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// A light scanner rather than a parser: it has to work on half-typed documents.\n\nexport interface Tag {\n kind: 'open' | 'close' | 'empty';\n name: string;\n /** Offset of the '<'. */\n from: number;\n nameFrom: number;\n nameTo: number;\n /** Offset just after the '>', or the end of the text for an unfinished tag. */\n to: number;\n}\n\nconst SKIP: [string, string][] = [['<!--', '-->'], ['<![CDATA[', ']]>'], ['<?', '?>'], ['<!', '>']];\n\n/** Every tag in text, skipping comments, CDATA, processing instructions and declarations. */\nexport function scanTags(text: string): Tag[] {\n const tags: Tag[] = [];\n let i = 0;\n while ((i = text.indexOf('<', i)) >= 0) {\n const skip = SKIP.find(([open]) => text.startsWith(open, i));\n if (skip) {\n const end = text.indexOf(skip[1], i + skip[0].length);\n if (end < 0) break;\n i = end + skip[1].length;\n continue;\n }\n const closing = text[i + 1] === '/';\n const nameFrom = i + (closing ? 2 : 1);\n const name = text.slice(nameFrom).match(/^[^\\s<>/=\"']*/)![0];\n // the end of the tag: the first '>' outside a quoted value\n let j = nameFrom + name.length, quote = '';\n for (; j < text.length; j++) {\n const c = text[j];\n if (quote) { if (c === quote) quote = ''; } else if (c === '\"' || c === \"'\") quote = c; else if (c === '>' || c === '<') break;\n }\n const finished = text[j] === '>';\n const to = finished ? j + 1 : j;\n const kind = closing ? 'close' : finished && text[j - 1] === '/' ? 'empty' : 'open';\n tags.push({ kind, name, from: i, nameFrom, nameTo: nameFrom + name.length, to });\n i = finished ? to : Math.max(j, i + 1);\n }\n return tags;\n}\n\n/** Pairs of open and close tags, by index into tags, matched like a parser would. */\nexport function pairs(tags: Tag[]): Map<number, number> {\n const stack: number[] = [];\n const pair = new Map<number, number>();\n tags.forEach((t, i) => {\n if (t.kind === 'open') stack.push(i);\n else if (t.kind === 'close') {\n // close the nearest open tag of the same name; anything above it was left open\n const k = stack.map(s => tags[s].name).lastIndexOf(t.name);\n if (k < 0) return;\n pair.set(stack[k], i);\n pair.set(i, stack[k]);\n stack.length = k;\n }\n });\n return pair;\n}\n\n/** The name ranges of the tag whose name holds offset and its partner, for renaming both at once. */\nexport function matchingTags(text: string, offset: number): { from: number; to: number }[] | null {\n const tags = scanTags(text);\n const at = tags.findIndex(t => t.kind !== 'empty' && t.nameFrom <= offset && offset <= t.nameTo);\n if (at < 0) return null;\n const other = pairs(tags).get(at);\n if (other === undefined) return null;\n return [at, other].sort((a, b) => a - b).map(i => ({ from: tags[i].nameFrom, to: tags[i].nameTo }));\n}\n\n/** The innermost element still open at offset. */\nexport function openElementAt(text: string, offset: number): string | undefined {\n const tags = scanTags(text.slice(0, offset));\n const pair = pairs(tags);\n for (let i = tags.length - 1; i >= 0; i--) {\n if (tags[i].kind === 'open' && !pair.has(i) && tags[i].to <= offset && text[tags[i].to - 1] === '>') return tags[i].name;\n }\n return undefined;\n}\n\n/**\n * What to insert at offset, just after the user typed a character, to close a tag:\n * after the '>' of a start tag its end tag, after '</' the name of the open element.\n */\nexport function closeTagAt(text: string, offset: number): string | undefined {\n const before = text.slice(0, offset);\n if (before.endsWith('</')) {\n const name = openElementAt(text, offset - 2);\n if (!name) return undefined;\n return text.slice(offset).startsWith('>') ? name : `${name}>`;\n }\n if (!before.endsWith('>') || before.endsWith('/>')) return undefined;\n const tags = scanTags(before);\n const last = tags[tags.length - 1];\n if (!last || last.kind !== 'open' || last.to !== offset || !last.name) return undefined;\n const end = `</${last.name}>`;\n // already closed right after the cursor, e.g. when a '>' is retyped\n if (text.slice(offset).startsWith(end)) return undefined;\n return end;\n}\n", "// \u2500\u2500 document outline: ODD structure for ODDs, divisions for TEI \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// The ODD outline is ODDity's (src/oddOutline.ts there), with editor-neutral results.\nimport { parse } from '@xml-tools/parser';\nimport { buildAst, type XMLElement, type XMLDocument } from '@xml-tools/ast';\n\n/** LSP symbol kinds used here (the protocol's numbers). */\nexport const Kind = {\n Module: 2, Namespace: 3, Package: 4, Class: 5, Method: 6, Property: 7,\n Interface: 11, Constant: 14, Array: 18, Object: 19, Struct: 23, TypeParameter: 26,\n} as const;\n\nexport interface OutlineSymbol {\n name: string;\n detail: string;\n kind: number;\n from: number;\n to: number;\n nameFrom: number;\n nameTo: number;\n children: OutlineSymbol[];\n}\n\nconst localName = (name: string | null) => (name ?? '').replace(/^[^:]*:/, '');\n\nconst unescape = (v: string) => v.replace(/&(?:#(\\d+)|#x([0-9a-fA-F]+)|(quot|lt|gt|apos|amp));/g, (_, d, h, n) =>\n d ? String.fromCharCode(Number(d)) : h ? String.fromCharCode(parseInt(h, 16)) : ({ quot: '\"', lt: '<', gt: '>', apos: \"'\", amp: '&' } as Record<string, string>)[n]);\n\nfunction attr(el: XMLElement, key: string): string | undefined {\n const raw = el.attributes.find(a => a.key === key && a.value !== null)?.value;\n return raw != null ? unescape(raw) : undefined;\n}\n\nfunction children(root: XMLDocument | XMLElement, name: string): XMLElement[] {\n const out: XMLElement[] = [];\n const walk = (el: XMLElement) => { if (localName(el.name) === name) out.push(el); el.subElements.forEach(walk); };\n ('rootElement' in root ? (root.rootElement ? [root.rootElement] : []) : [root]).forEach(walk);\n return out;\n}\n\nfunction symbol(el: XMLElement, name: string, detail: string, kind: number, kids: OutlineSymbol[] = []): OutlineSymbol {\n const p = el.position, open = el.syntax?.openName;\n const from = p && p.startOffset >= 0 ? p.startOffset : 0, to = p && p.startOffset >= 0 ? p.endOffset + 1 : 0;\n const named = open && open.startOffset >= 0;\n return { name, detail, kind, from, to, nameFrom: named ? open.startOffset : from, nameTo: named ? open.endOffset + 1 : to, children: kids };\n}\n\nfunction ast(text: string): XMLDocument {\n const { cst, tokenVector } = parse(text);\n return buildAst(cst as Parameters<typeof buildAst>[0], tokenVector);\n}\n\n/** The outline of an ODD: tagsDecl, then each schemaSpec with its specs and processing models. */\nexport function oddOutline(text: string): OutlineSymbol[] {\n const doc = ast(text);\n return [\n ...children(doc, 'tagsDecl').map(tagsDecl),\n ...children(doc, 'schemaSpec').map(schemaSpec),\n ];\n}\n\nfunction tagsDecl(el: XMLElement): OutlineSymbol {\n const kids = el.subElements.flatMap(c => {\n switch (localName(c.name)) {\n case 'behaviour': {\n const ident = attr(c, 'ident') ?? '(no ident)', output = attr(c, 'output');\n return [symbol(c, output ? `${ident} \u00B7 ${output}` : ident, '', Kind.Method)];\n }\n case 'rendition': return [symbol(c, attr(c, 'xml:id') ?? attr(c, 'source') ?? '(rendition)', '', Kind.Property)];\n case 'namespace': return [symbol(c, attr(c, 'name') ?? '(namespace)', '', Kind.Namespace)];\n default: return [];\n }\n });\n return symbol(el, 'tagsDecl', '', Kind.Namespace, kids);\n}\n\nfunction schemaSpec(el: XMLElement): OutlineSymbol {\n const source = attr(el, 'source');\n const kids = el.subElements.flatMap(c => {\n const ident = attr(c, 'ident') ?? '(no ident)', mode = attr(c, 'mode') ?? '';\n switch (localName(c.name)) {\n case 'moduleRef': {\n const include = attr(c, 'include'), except = attr(c, 'except');\n const detail = [include && `include: ${include}`, except && `except: ${except}`].filter(Boolean).join(' \u00B7 ');\n return [symbol(c, attr(c, 'key') ?? '(no key)', detail, Kind.Module)];\n }\n case 'dataSpec': return [symbol(c, ident, mode, Kind.TypeParameter)];\n case 'macroSpec': return [symbol(c, ident, mode, Kind.Constant)];\n case 'classSpec': return [symbol(c, ident, [attr(c, 'type'), attr(c, 'mode')].filter(Boolean).join(' \u00B7 '), Kind.Interface)];\n case 'elementSpec': return [symbol(c, ident, mode, Kind.Class, rules(c))];\n default: return [];\n }\n });\n return symbol(el, attr(el, 'ident') ?? '(no ident)', source ? `source: ${source}` : '', Kind.Package, kids);\n}\n\n/** Direct model, modelGrp and modelSequence children, nested as in the ODD. */\nfunction rules(parent: XMLElement): OutlineSymbol[] {\n return parent.subElements.flatMap(c => {\n const type = localName(c.name);\n if (type !== 'model' && type !== 'modelGrp' && type !== 'modelSequence') return [];\n const label = [attr(c, 'output'), attr(c, 'predicate'), type === 'model' ? (attr(c, 'behaviour') ?? '(no behaviour)') : type]\n .filter(Boolean).join(' \u00B7 ');\n const kind = type === 'modelGrp' ? Kind.Namespace : type === 'modelSequence' ? Kind.Array : Kind.Method;\n return [symbol(c, label, '', kind, type === 'model' ? [] : rules(c))];\n });\n}\n\n/** TEI elements that make up a document's structure. */\nconst STRUCTURE = new Set(['teiCorpus', 'TEI', 'teiHeader', 'text', 'front', 'body', 'back', 'group', 'div',\n 'div1', 'div2', 'div3', 'div4', 'div5', 'div6', 'div7', 'floatingText']);\n\n/** Text of an element, whitespace collapsed. */\nfunction textOf(el: XMLElement): string {\n const parts: { at: number; text: string }[] = [];\n const walk = (e: XMLElement) => {\n for (const t of e.textContents) parts.push({ at: t.position.startOffset, text: t.text ?? '' });\n e.subElements.forEach(walk);\n };\n walk(el);\n return parts.sort((a, b) => a.at - b.at).map(p => p.text).join('').replace(/\\s+/g, ' ').trim();\n}\n\nconst MAX_LABEL = 60;\n\n/** The outline of a TEI document: its texts and divisions, labelled by their heads. */\nexport function teiOutline(text: string): OutlineSymbol[] {\n const root = ast(text).rootElement;\n if (!root) return [];\n const walk = (el: XMLElement): OutlineSymbol[] => {\n const name = localName(el.name);\n const kids = el.subElements.flatMap(walk);\n if (!STRUCTURE.has(name)) return kids;\n if (name === 'teiHeader') return [symbol(el, 'teiHeader', '', Kind.Object)];\n const head = el.subElements.find(c => localName(c.name) === 'head');\n let label = head ? textOf(head) : '';\n if (label.length > MAX_LABEL) label = label.slice(0, MAX_LABEL).replace(/\\s\\S*$/, '') + '\u2026';\n const type = attr(el, 'type'), n = attr(el, 'n'), id = attr(el, 'xml:id');\n const title = label || [type, n].filter(Boolean).join(' ') || name;\n const detail = [label ? name : '', id ? `#${id}` : ''].filter(Boolean).join(' ');\n return [symbol(el, title, detail, name.startsWith('div') ? Kind.Struct : Kind.Namespace, kids)];\n };\n return walk(root);\n}\n\n/** A plain element tree, for XML that is neither ODD nor TEI. */\nexport function elementOutline(text: string, max = 2000): OutlineSymbol[] {\n const root = ast(text).rootElement;\n let count = 0;\n const walk = (el: XMLElement): OutlineSymbol => {\n count++;\n const kids = count < max ? el.subElements.slice(0, max - count).map(walk) : [];\n const id = attr(el, 'xml:id') ?? attr(el, 'id');\n return symbol(el, el.name ?? '?', id ? `#${id}` : '', Kind.Object, kids);\n };\n return root ? [walk(root)] : [];\n}\n", "// \u2500\u2500 opm.toml: checking, completion and hover from opm's JSON Schema \u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// schema/opm/opm.schema.json ships with opm (npm run schemas copies it), so\n// what the editor knows about opm.toml follows opm. The checker understands\n// the part of JSON Schema that file uses: type, properties,\n// additionalProperties, required, items, enum, anyOf, minimum, $ref and\n// deprecated.\nimport { parse, TomlError } from 'smol-toml';\nimport opmSchema from '../../schema/opm/opm.schema.json' with { type: 'json' };\nimport { scanToml, tableAt, readKey, type Seg, type TomlScan } from './tomlScan.ts';\n\nexport interface Schema {\n type?: string | string[];\n description?: string;\n properties?: Record<string, Schema>;\n additionalProperties?: boolean | Schema;\n required?: string[];\n items?: Schema;\n enum?: unknown[];\n anyOf?: Schema[];\n minimum?: number;\n default?: unknown;\n examples?: unknown[];\n deprecated?: boolean;\n $ref?: string;\n definitions?: Record<string, Schema>;\n}\n\nexport const OPM_SCHEMA = opmSchema as Schema;\n\n/** Whether a document is an opm project config, by its name. */\nexport const isOpmToml = (uri: string): boolean => /(^|[/\\\\])opm\\.toml$/.test(uri);\n\nexport interface TomlProblem {\n from: number;\n to: number;\n message: string;\n severity: 'error' | 'warning';\n /** syntax, unknown, type, enum, required, range or deprecated. */\n code: string;\n}\n\n// \u2500\u2500 schema navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction deref(s: Schema, root: Schema): Schema {\n let seen = 0;\n while (s.$ref && seen++ < 20) {\n const target = s.$ref.replace(/^#\\/definitions\\//, '');\n const { $ref: _, ...rest } = s;\n s = { ...root.definitions?.[target], ...rest };\n }\n return s;\n}\n\nconst typesOf = (s: Schema): string[] => (s.type === undefined ? [] : Array.isArray(s.type) ? s.type : [s.type]);\n\n/** The anyOf branches of s (or s itself), dereferenced. */\nconst branches = (s: Schema, root: Schema): Schema[] => {\n s = deref(s, root);\n if (!s.anyOf) return [s];\n const { anyOf, ...own } = s;\n return anyOf.flatMap(b => branches(b, root)).map(b => ({ ...b, description: own.description ?? b.description, deprecated: own.deprecated ?? b.deprecated }));\n};\n\n/** The schema of the value at path, or undefined where the schema says nothing. */\nexport function schemaAt(path: Seg[], root: Schema = OPM_SCHEMA): Schema | undefined {\n let s: Schema | undefined = deref(root, root);\n for (const seg of path) {\n if (!s) return undefined;\n const options = branches(s, root);\n if (typeof seg === 'number') {\n const arr = options.find(b => typesOf(b).includes('array'));\n s = arr?.items && deref(arr.items, root);\n } else {\n const obj = options.find(b => typesOf(b).includes('object') || b.properties);\n const next: Schema | boolean | undefined = obj?.properties?.[seg] ?? obj?.additionalProperties;\n s = next && typeof next === 'object' ? { ...deref(next, root), ...(obj?.properties?.[seg]?.description ? { description: obj.properties[seg].description } : {}) } : undefined;\n }\n }\n return s;\n}\n\n// \u2500\u2500 checking \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface SchemaError { path: Seg[]; message: string; code: string; severity: 'error' | 'warning' }\n\nconst kindOf = (v: unknown): string =>\n typeof v === 'string' ? 'string' : typeof v === 'boolean' ? 'boolean'\n : typeof v === 'number' || typeof v === 'bigint' ? (Number.isInteger(Number(v)) ? 'integer' : 'number')\n : Array.isArray(v) ? 'array' : v && typeof v === 'object' && !(v instanceof Date) && !('toISOString' in (v as object)) ? 'object' : 'datetime';\n\nconst accepts = (type: string, kind: string) => type === kind || (type === 'number' && kind === 'integer');\n\nconst NOUN: Record<string, string> = {\n string: 'a string', integer: 'a whole number', number: 'a number', boolean: 'true or false',\n array: 'a list', object: 'a table', datetime: 'a date',\n};\n\n/** \"a string or a list of strings\", from the branches a value could have matched. */\nfunction expected(options: Schema[], root: Schema): string {\n const words = options.flatMap(b => typesOf(b).map(t => {\n if (t === 'array' && b.items) {\n const item = typesOf(deref(b.items, root))[0];\n return item ? `a list of ${NOUN[item].replace(/^an? /, '')}s` : NOUN.array;\n }\n return NOUN[t] ?? t;\n }));\n return [...new Set(words)].join(' or ');\n}\n\nexport function tableName(path: Seg[]): string {\n const names = path.filter((s): s is string => typeof s === 'string');\n const array = typeof path[path.length - 1] === 'number';\n return names.length ? (array ? `[[${names.join('.')}]]` : `[${names.join('.')}]`) : 'the top level';\n}\n\nconst keyName = (path: Seg[]) => String(path.filter(s => typeof s === 'string').pop() ?? '');\n\nfunction distance(a: string, b: string): number {\n const d = Array.from({ length: b.length + 1 }, (_, j) => j);\n for (let i = 1; i <= a.length; i++) {\n let prev = d[0];\n d[0] = i;\n for (let j = 1; j <= b.length; j++) {\n const tmp = d[j];\n d[j] = Math.min(d[j] + 1, d[j - 1] + 1, prev + (a[i - 1] === b[j - 1] ? 0 : 1));\n prev = tmp;\n }\n }\n return d[b.length];\n}\n\nfunction check(value: unknown, s: Schema, path: Seg[], root: Schema, errors: SchemaError[]): void {\n const options = branches(s, root);\n const kind = kindOf(value);\n const fits = options.filter(b => !typesOf(b).length || typesOf(b).some(t => accepts(t, kind)));\n if (!fits.length) {\n const name = path.length ? `\"${keyName(path)}\"` : 'opm.toml';\n errors.push({ path, code: 'type', severity: 'error', message: `${name} should be ${expected(options, root)}, not ${NOUN[kind] ?? kind}.` });\n return;\n }\n let chosen = fits[0];\n if (fits.length > 1) {\n // the first branch the value passes, else the first that fits its kind\n for (const b of fits) {\n const trial: SchemaError[] = [];\n checkOne(value, b, path, root, trial);\n if (!trial.some(e => e.severity === 'error')) { chosen = b; break; }\n }\n }\n checkOne(value, chosen, path, root, errors);\n}\n\nfunction checkOne(value: unknown, s: Schema, path: Seg[], root: Schema, errors: SchemaError[]): void {\n if (s.deprecated && path.length) {\n errors.push({ path, code: 'deprecated', severity: 'warning', message: s.description ?? `\"${keyName(path)}\" is deprecated.` });\n }\n if (s.enum && !s.enum.includes(value)) {\n errors.push({ path, code: 'enum', severity: 'error', message: `\"${keyName(path)}\" should be one of ${s.enum.map(v => JSON.stringify(v)).join(', ')}.` });\n }\n if (s.minimum !== undefined && (typeof value === 'number' || typeof value === 'bigint') && Number(value) < s.minimum) {\n errors.push({ path, code: 'range', severity: 'error', message: `\"${keyName(path)}\" should be at least ${s.minimum}.` });\n }\n if (Array.isArray(value) && s.items) {\n value.forEach((item, n) => check(item, s.items!, [...path, n], root, errors));\n } else if (kindOf(value) === 'object') {\n const obj = value as Record<string, unknown>;\n for (const req of s.required ?? []) {\n if (!(req in obj)) errors.push({ path, code: 'required', severity: 'error', message: `${tableName(path)} needs \"${req}\".` });\n }\n for (const [k, v] of Object.entries(obj)) {\n const prop = s.properties?.[k];\n if (prop) { check(v, prop, [...path, k], root, errors); continue; }\n if (s.additionalProperties === false) {\n const known = Object.keys(s.properties ?? {});\n const close = known.map(n => [n, distance(k, n)] as const).filter(([, d]) => d <= 2).sort((a, b) => a[1] - b[1])[0];\n errors.push({\n path: [...path, k], code: 'unknown', severity: 'warning',\n message: `opm does not know \"${k}\" in ${tableName(path)}.${close ? ` Did you mean \"${close[0]}\"?` : ''}`,\n });\n } else if (s.additionalProperties && typeof s.additionalProperties === 'object') {\n check(v, s.additionalProperties, [...path, k], root, errors);\n }\n }\n }\n}\n\nconst startsWith = (path: Seg[], prefix: Seg[]) => prefix.length <= path.length && prefix.every((s, i) => path[i] === s);\nconst same = (a: Seg[], b: Seg[]) => a.length === b.length && startsWith(a, b);\n\n/** Where an error at path is shown: the key or header that writes it, or the value it sits inside. */\nfunction rangeOf(scan: TomlScan, e: SchemaError): { from: number; to: number } {\n const key = scan.keys.find(k => same(k.path, e.path));\n if (key) return e.code === 'unknown' || e.code === 'deprecated' ? { from: key.from, to: key.to } : { from: key.valueFrom, to: key.valueTo };\n const table = scan.tables.find(t => same(t.path, e.path)) ?? scan.tables.find(t => startsWith(t.path, e.path));\n if (table) return { from: table.from, to: table.to };\n const below = scan.keys.find(k => startsWith(k.path, e.path));\n if (below) return { from: below.from, to: below.to };\n // inside an inline table or array: the value that holds it\n let holder: { from: number; to: number } | undefined;\n for (const k of scan.keys) if (startsWith(e.path, k.path)) holder = { from: k.valueFrom, to: k.valueTo };\n return holder ?? { from: 0, to: 0 };\n}\n\n/** Problems in an opm.toml: TOML syntax first, then what opm's schema says. */\nexport function checkOpmToml(text: string, schema: Schema = OPM_SCHEMA): TomlProblem[] {\n let data: unknown;\n try {\n data = parse(text);\n } catch (err) {\n if (!(err instanceof TomlError)) throw err;\n const lines = text.split('\\n');\n const line = Math.max(0, Math.min(lines.length - 1, err.line - 1));\n const start = lines.slice(0, line).reduce((n, l) => n + l.length + 1, 0);\n const from = start + Math.max(0, Math.min(lines[line].length, err.column - 1));\n const message = err.message.split('\\n')[0].replace(/^Invalid TOML document: /, '');\n return [{ from, to: Math.max(from, start + lines[line].length), message: `Not valid TOML: ${message}.`, severity: 'error', code: 'syntax' }];\n }\n const errors: SchemaError[] = [];\n check(data, schema, [], schema, errors);\n const scan = scanToml(text);\n return errors.map(e => ({ ...rangeOf(scan, e), message: e.message, severity: e.severity, code: e.code }));\n}\n\n// \u2500\u2500 completion \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface TomlOption {\n label: string;\n kind: 'table' | 'key' | 'value';\n /** Short type summary, e.g. \"string\", \"true or false\". */\n detail?: string;\n /** The description from the schema. */\n info?: string;\n /** Text that replaces from\u2026to. */\n apply: string;\n /** Where the cursor goes, as an offset into apply; the end when missing. */\n cursor?: number;\n}\n\nexport interface TomlCompletions { from: number; to: number; options: TomlOption[] }\n\nfunction summary(s: Schema, root: Schema): string {\n const options = branches(s, root);\n if (options.length === 1 && options[0].enum) return options[0].enum.map(v => JSON.stringify(v)).join(' | ');\n return expected(options, root).replace(/^an? /, '').replace(/ or an? /g, ' or ');\n}\n\n/** A starting value for a key, and where the cursor goes in it. */\nfunction template(s: Schema, root: Schema): { text: string; cursor: number } {\n const first = branches(s, root)[0] ?? {};\n const t = typesOf(first)[0];\n if (first.enum?.length) return { text: JSON.stringify(first.enum[0]), cursor: 1 };\n if (t === 'string') return { text: '\"\"', cursor: 1 };\n if (t === 'array') {\n const item = first.items && typesOf(deref(first.items, root))[0];\n return item === 'string' ? { text: '[\"\"]', cursor: 2 } : { text: '[]', cursor: 1 };\n }\n if (t === 'object') return { text: '{ }', cursor: 2 };\n if (t === 'boolean') return { text: String(first.default ?? true), cursor: String(first.default ?? true).length };\n return { text: '', cursor: 0 };\n}\n\nconst isTable = (s: Schema, root: Schema) => branches(s, root).some(b => typesOf(b).includes('object') || b.properties);\nconst isTableArray = (s: Schema, root: Schema) => branches(s, root).some(b => {\n if (!typesOf(b).includes('array') || !b.items) return false;\n return isTable(b.items, root);\n});\n\n/** Whether a value is only ever written as a [header] or [[header]]: a table with known keys, or an array of tables. */\nconst isHeaderOnly = (s: Schema, root: Schema) => branches(s, root).every(b =>\n (typesOf(b).includes('object') && !!b.properties) || (typesOf(b).includes('array') && !!b.items && isTable(b.items, root)));\n\n/** Every table a header can name, as [path, array]: [transform.web], [[chunking]], [[chunking.fragments]], \u2026 */\nfunction headers(root: Schema): { name: string; array: boolean; schema: Schema }[] {\n const out: { name: string; array: boolean; schema: Schema }[] = [];\n const walk = (s: Schema, names: string[], depth: number) => {\n if (depth > 4) return;\n for (const b of branches(s, root)) {\n for (const [k, raw] of Object.entries(b.properties ?? {})) {\n const p = deref(raw, root);\n if (p.deprecated || raw.deprecated) continue;\n const ns = [...names, k];\n const desc = { ...p, description: raw.description ?? p.description };\n if (isTable(p, root)) { out.push({ name: ns.join('.'), array: false, schema: desc }); walk(p, ns, depth + 1); }\n if (isTableArray(p, root)) {\n out.push({ name: ns.join('.'), array: true, schema: desc });\n const items = branches(p, root).find(x => typesOf(x).includes('array'))?.items;\n if (items) walk(items, ns, depth + 1);\n }\n }\n }\n };\n walk(root, [], 0);\n return out;\n}\n\n/** Suggestions at offset: table names in a header, keys at the start of a line, values after \"=\". */\nexport function completeOpmToml(text: string, offset: number, schema: Schema = OPM_SCHEMA): TomlCompletions | null {\n const lineStart = text.lastIndexOf('\\n', offset - 1) + 1;\n const before = text.slice(lineStart, offset);\n if (/^\\s*#/.test(before) || /#[^\"']*$/.test(before)) return null;\n const scan = scanToml(text);\n\n // a header: [transform.w| or [[chunk|\n const header = /^\\s*(\\[\\[?)\\s*([A-Za-z0-9_.-]*)$/.exec(before);\n if (header) {\n const from = offset - header[2].length;\n const lineEnd = text.indexOf('\\n', offset);\n const rest = text.slice(offset, lineEnd < 0 ? text.length : lineEnd);\n const closing = /^[A-Za-z0-9_.-]*\\]{1,2}/.exec(rest);\n const to = closing ? offset + closing[0].length : offset;\n const double = header[1] === '[[';\n return {\n from, to,\n options: headers(schema).filter(h => h.array === double).map(h => ({\n label: h.name, kind: 'table', detail: h.array ? 'array of tables' : 'table', info: h.schema.description,\n apply: h.name + (double ? ']]' : ']'),\n })),\n };\n }\n\n const table = tableAt(scan, offset);\n const tablePath = table?.path ?? [];\n\n // a value: key = \u2026|\n const eq = before.indexOf('=');\n if (eq >= 0) {\n const key = readKey(before, 0, ch => ch === '=');\n if (!key) return null;\n let s = schemaAt([...tablePath, ...key.parts], schema);\n if (!s) return null;\n let after = before.slice(eq + 1);\n // inside a list: the item's schema\n if ((after.match(/\\[/g)?.length ?? 0) > (after.match(/\\]/g)?.length ?? 0)) {\n const arr = branches(s, schema).find(b => typesOf(b).includes('array'));\n if (!arr?.items) return null;\n s = deref(arr.items, schema);\n after = after.slice(after.lastIndexOf(',') >= 0 && after.lastIndexOf(',') > after.lastIndexOf('[') ? after.lastIndexOf(',') + 1 : after.lastIndexOf('[') + 1);\n }\n const word = /(\"?)([^\"\\s,[\\]{}=]*)$/.exec(after)!;\n const quoted = word[1] === '\"';\n const from = offset - word[2].length - (quoted ? 1 : 0);\n const values = new Map<string, string | undefined>();\n for (const b of branches(s, schema)) {\n for (const v of b.enum ?? []) values.set(JSON.stringify(v), b.description);\n if (typesOf(b).includes('boolean')) { values.set('true', undefined); values.set('false', undefined); }\n for (const v of b.examples ?? []) values.set(JSON.stringify(v), 'example');\n if (b.default !== undefined && typeof b.default !== 'object') values.set(JSON.stringify(b.default), 'default');\n }\n if (!values.size) return null;\n // a closing quote the editor already typed is replaced too\n const to = quoted && text[offset] === '\"' ? offset + 1 : offset;\n return {\n from, to,\n options: [...values].map(([v, note]) => ({ label: v, kind: 'value', detail: note === 'example' || note === 'default' ? note : undefined, apply: v })),\n };\n }\n\n // a key at the start of a line\n const typed = /^\\s*([A-Za-z0-9_.-]*)$/.exec(before);\n if (!typed) return null;\n const dots = typed[1].split('.');\n const partial = dots.pop()!;\n const parent = [...tablePath, ...dots.filter(Boolean)];\n const s = schemaAt(parent, schema);\n const from = offset - partial.length;\n if (!table && !dots.filter(Boolean).length) {\n // before any header: offer the tables themselves\n return {\n from, to: offset,\n options: headers(schema).map(h => ({\n label: h.array ? `[[${h.name}]]` : `[${h.name}]`, kind: 'table' as const, detail: h.array ? 'array of tables' : 'table', info: h.schema.description,\n apply: h.array ? `[[${h.name}]]` : `[${h.name}]`,\n })),\n };\n }\n if (!s) return null;\n const present = new Set(scan.keys.filter(k => startsWith(k.path, parent) && k.path.length > parent.length).map(k => k.path[parent.length]));\n for (const t of scan.tables) if (startsWith(t.path, parent) && t.path.length > parent.length) present.add(t.path[parent.length]);\n const options: TomlOption[] = [];\n for (const b of branches(s, schema)) {\n for (const [name, raw] of Object.entries(b.properties ?? {})) {\n const p = deref(raw, schema);\n if (present.has(name) || p.deprecated || raw.deprecated) continue;\n // tables with keys of their own, and arrays of them, are written as headers\n if (isHeaderOnly(p, schema)) continue;\n const value = template(p, schema);\n options.push({\n label: name, kind: 'key', detail: summary(p, schema), info: raw.description ?? p.description,\n apply: `${name} = ${value.text}`, cursor: name.length + 3 + value.cursor,\n });\n }\n }\n return { from, to: offset, options };\n}\n\n// \u2500\u2500 hover \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface TomlHover { from: number; to: number; title: string; detail: string; info?: string }\n\n/** What the schema says about the key or table header at offset. */\nexport function describeOpmToml(text: string, offset: number, schema: Schema = OPM_SCHEMA): TomlHover | null {\n const scan = scanToml(text);\n const table = scan.tables.find(t => t.from <= offset && offset <= t.to);\n const key = table ? undefined : scan.keys.find(k => k.from <= offset && offset <= k.to);\n const hit = table ?? key;\n if (!hit) return null;\n let path = hit.path;\n // a dotted key: the part under the cursor\n if (key) {\n const parts = readKey(text, key.from, ch => ch === '=')?.parts ?? [];\n const prefixLen = key.path.length - parts.length;\n let at = key.from, n = 0;\n for (; n < parts.length - 1; n++) {\n at = text.indexOf(parts[n], at) + parts[n].length;\n if (offset <= at) break;\n }\n path = key.path.slice(0, prefixLen + n + 1);\n } else if (typeof path[path.length - 1] === 'number') {\n path = path.slice(0, -1);\n }\n const s = schemaAt(path, schema);\n if (!s) return null;\n const extras: string[] = [summary(s, schema)];\n const def = branches(s, schema).find(b => b.default !== undefined)?.default;\n if (def !== undefined) extras.push(`default ${JSON.stringify(def)}`);\n return {\n from: hit.from, to: hit.to,\n title: table ? tableName(table.path) : keyName(path),\n detail: extras.join(', '),\n info: s.description,\n };\n}\n", "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://github.com/eeditiones/open-processing-model/opm.schema.json\",\n \"$comment\": \"SPDX-FileCopyrightText: 2026 e-editiones. SPDX-License-Identifier: CC0-1.0\",\n \"title\": \"opm.toml\",\n \"description\": \"Project configuration for the Open Processing Model. Relative paths resolve against the directory of opm.toml.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"project\": {\n \"description\": \"Python paths and profiles of the project.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"pythonpath\": {\n \"description\": \"Extra Python paths, relative to opm.toml, so the project's extension modules can be imported.\",\n \"$ref\": \"#/definitions/stringOrList\",\n \"default\": [\".\"]\n },\n \"profiles\": {\n \"description\": \"Profiles to switch on: ready-made features such as registers, search or a facsimile viewer. `opm profile list` shows them.\",\n \"$ref\": \"#/definitions/profileList\"\n }\n }\n },\n \"transform\": { \"$ref\": \"#/definitions/transform\" },\n \"context\": {\n \"description\": \"Free-form values handed to every template as `context`. TOML types are kept. A [transform.<type>.context] table overlays this per output type.\",\n \"type\": \"object\",\n \"properties\": {\n \"site_name\": { \"description\": \"Title of the site, shown in the menu bar of opm's page layout.\", \"type\": \"string\" },\n \"logo\": { \"description\": \"Logo shown in the menu bar, as a URL relative to the page.\", \"type\": \"string\" },\n \"webcomponents_url\": { \"description\": \"URL of the TEI Publisher web components bundle, to serve it yourself or pin another version.\", \"type\": \"string\" },\n \"menu\": {\n \"description\": \"The menu bar of opm's page layout.\",\n \"type\": \"object\",\n \"properties\": {\n \"items\": {\n \"description\": \"Links in the menu bar, after the logo.\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"label\": { \"description\": \"Text of the link.\", \"type\": \"string\" },\n \"url\": { \"description\": \"Target of the link.\", \"type\": \"string\" }\n }\n }\n }\n }\n },\n \"features\": {\n \"description\": \"Settings of profiles, one table per profile: [context.features.<name>]. They override the defaults in the profile's opm-profile.toml.\",\n \"type\": \"object\",\n \"additionalProperties\": { \"type\": \"object\" }\n }\n }\n },\n \"chunking\": {\n \"description\": \"How `opm chunk` splits documents into pages. A [chunking] table is one run; a [[chunking]] array declares several, run in order into one output directory.\",\n \"anyOf\": [\n { \"$ref\": \"#/definitions/chunkingRun\" },\n { \"type\": \"array\", \"items\": { \"$ref\": \"#/definitions/chunkingRun\" } }\n ]\n },\n \"pages\": {\n \"description\": \"Auxiliary pages of the chunked site, written by `opm chunk` after the chunking runs: an about page, register overviews, one page per register entry.\",\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/definitions/page\" }\n },\n \"index\": { \"$ref\": \"#/definitions/index\" },\n \"document\": {\n \"description\": \"Makes this project an `opm odd document` site.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"source\": { \"description\": \"The ODD, compiled spec document or Specs directory to document.\", \"type\": \"string\" },\n \"lang\": { \"description\": \"xml:lang to prefer for gloss, desc and remarks.\", \"type\": \"string\" }\n }\n },\n \"editor\": {\n \"description\": \"Settings for editors (opm studio, ODDity). opm itself ignores them.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"schema\": { \"description\": \"RELAX NG schema to check documents against when they have no <?xml-model?> of their own.\", \"type\": \"string\" }\n }\n },\n \"web\": { \"$ref\": \"#/definitions/webSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.web].\" },\n \"print\": { \"$ref\": \"#/definitions/printSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.print].\" },\n \"epub\": { \"$ref\": \"#/definitions/epubSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.epub].\" },\n \"markdown\": { \"$ref\": \"#/definitions/typeSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.markdown].\" },\n \"docx\": { \"$ref\": \"#/definitions/docxSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.docx].\" },\n \"typst\": { \"$ref\": \"#/definitions/typstSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.typst].\" },\n \"json\": { \"$ref\": \"#/definitions/typeSection\", \"deprecated\": true, \"description\": \"Deprecated: use [transform.json].\" }\n },\n \"definitions\": {\n \"stringOrList\": {\n \"anyOf\": [\n { \"type\": \"string\" },\n { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n ]\n },\n \"profileList\": {\n \"anyOf\": [\n { \"$ref\": \"#/definitions/profileName\" },\n { \"type\": \"array\", \"items\": { \"$ref\": \"#/definitions/profileName\" } }\n ]\n },\n \"profileName\": {\n \"type\": \"string\",\n \"examples\": [\"edition-navigation\", \"iiif\", \"pagefind\", \"registers\"]\n },\n \"outputType\": {\n \"type\": \"string\",\n \"enum\": [\"web\", \"print\", \"epub\", \"markdown\", \"docx\", \"typst\", \"json\", \"json-web\", \"json-print\", \"json-epub\", \"json-markdown\", \"json-docx\", \"json-typst\"]\n },\n \"scalar\": { \"type\": [\"string\", \"number\", \"boolean\"] },\n \"odd\": { \"description\": \"ODD for this output type, overriding [transform] odd.\", \"type\": \"string\" },\n \"typeContext\": {\n \"description\": \"Template context for this output type only, over [context].\",\n \"type\": \"object\"\n },\n \"transform\": {\n \"description\": \"Settings shared by every output type, and one table per type.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"description\": \"Default ODD for every output type, compiled on demand. Without one, the packaged teipublisher.odd is used.\", \"type\": \"string\" },\n \"css\": { \"description\": \"Base rules compiled into the ODD stylesheet for every output type, replacing the packaged defaults. Design CSS belongs in [transform.web] assets.\", \"type\": \"string\" },\n \"documents\": {\n \"description\": \"XML documents loaded up front for XPath doc(), such as registers that most pages look things up in.\",\n \"$ref\": \"#/definitions/stringOrList\"\n },\n \"document_roots\": {\n \"description\": \"Further folders doc() may open any XML file in, read the first time an expression asks for it. The project folder is always allowed.\",\n \"$ref\": \"#/definitions/stringOrList\"\n },\n \"footnote_order\": {\n \"description\": \"Dotted path of a callable that orders each run's footnotes before they are placed (web, markdown).\",\n \"type\": \"string\",\n \"examples\": [\"opm.runtime.footnote_order.labelled_first\"]\n },\n \"xpath_extensions\": {\n \"description\": \"Python modules whose functions the ODD calls as tp:\u2026(). [[transform.extensions]] does the same and more.\",\n \"$ref\": \"#/definitions/stringOrList\"\n },\n \"extensions\": {\n \"description\": \"Python modules whose functions the ODD calls, one table each. A module may use its own prefix and define behaviours.\",\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/definitions/extension\" }\n },\n \"collections\": {\n \"description\": \"Documents returned by XPath collection() for a URI.\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"uri\"],\n \"properties\": {\n \"uri\": { \"description\": \"Absolute URI matched against the argument of collection(), e.g. urn:registers.\", \"type\": \"string\" },\n \"documents\": { \"description\": \"Files of the collection; an entry may be a glob such as data/*.xml.\", \"$ref\": \"#/definitions/stringOrList\" }\n }\n }\n },\n \"namespaces\": {\n \"description\": \"Namespace prefixes for XPath written in the ODD, as prefix = URI.\",\n \"type\": \"object\",\n \"additionalProperties\": { \"type\": \"string\" }\n },\n \"variables\": {\n \"description\": \"Values of XPath variables. A key straight under this table is $name; a sub-table named after a prefix from [transform.namespaces] holds that namespace's variables.\",\n \"type\": \"object\",\n \"additionalProperties\": {\n \"anyOf\": [\n { \"$ref\": \"#/definitions/scalar\" },\n { \"type\": \"object\", \"additionalProperties\": { \"$ref\": \"#/definitions/scalar\" } }\n ]\n }\n },\n \"parameters\": {\n \"description\": \"Values of the ODD's $parameters, for every output type.\",\n \"type\": \"object\",\n \"additionalProperties\": { \"$ref\": \"#/definitions/scalar\" }\n },\n \"web\": { \"$ref\": \"#/definitions/webSection\" },\n \"print\": { \"$ref\": \"#/definitions/printSection\" },\n \"epub\": { \"$ref\": \"#/definitions/epubSection\" },\n \"markdown\": { \"$ref\": \"#/definitions/typeSection\", \"description\": \"Markdown output.\" },\n \"docx\": { \"$ref\": \"#/definitions/docxSection\" },\n \"typst\": { \"$ref\": \"#/definitions/typstSection\" },\n \"json\": { \"$ref\": \"#/definitions/typeSection\", \"description\": \"JSON data output, for every json-<type> channel.\" }\n }\n },\n \"typeSection\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"$ref\": \"#/definitions/odd\" },\n \"context\": { \"$ref\": \"#/definitions/typeContext\" }\n }\n },\n \"webSection\": {\n \"description\": \"HTML output of a whole document, and the defaults for chunk pages.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"$ref\": \"#/definitions/odd\" },\n \"context\": { \"$ref\": \"#/definitions/typeContext\" },\n \"template\": { \"description\": \"Jinks page template for HTML output (.html.tpl).\", \"type\": \"string\" },\n \"webcomponents\": { \"description\": \"Emit TEI Publisher web components and let the template load their bundle.\", \"type\": \"boolean\", \"default\": false },\n \"assets\": {\n \"description\": \"Stylesheets, images and fonts the template uses, copied into an assets/ folder beside the output. An entry may be a glob.\",\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n },\n \"pages\": {\n \"description\": \"Show the document page by page: dotted path of a chunk selector, one <section class=\\\"opm-page\\\"> per page.\",\n \"type\": \"string\",\n \"examples\": [\"opm.navigation.tei_pb_chunks\"]\n }\n }\n },\n \"printSection\": {\n \"description\": \"Paged HTML for print.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"$ref\": \"#/definitions/odd\" },\n \"context\": { \"$ref\": \"#/definitions/typeContext\" },\n \"template\": { \"description\": \"Jinks page template for print output (.html.tpl).\", \"type\": \"string\" }\n }\n },\n \"epubSection\": {\n \"description\": \"EPUB output.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"$ref\": \"#/definitions/odd\" },\n \"context\": { \"$ref\": \"#/definitions/typeContext\" },\n \"css\": { \"description\": \"Stylesheet for the EPUB, replacing the packaged one.\", \"type\": \"string\" },\n \"skip_title\": { \"description\": \"Leave out the generated title page.\", \"type\": \"boolean\", \"default\": false },\n \"xpath\": { \"description\": \"XPath selecting the elements that become the EPUB's chapters, instead of [chunking] xpath.\", \"type\": \"string\" },\n \"selector\": { \"description\": \"Dotted path of a chunk selector for the chapters, instead of [chunking] selector.\", \"type\": \"string\" },\n \"depth\": { \"description\": \"Heading depth for chapters, instead of [chunking] depth.\", \"type\": \"integer\", \"minimum\": 1 }\n }\n },\n \"docxSection\": {\n \"description\": \"Word output.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"$ref\": \"#/definitions/odd\" },\n \"context\": { \"$ref\": \"#/definitions/typeContext\" },\n \"template\": { \"description\": \"Word document whose styles the output uses (.docx).\", \"type\": \"string\" }\n }\n },\n \"typstSection\": {\n \"description\": \"Typst output.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"odd\": { \"$ref\": \"#/definitions/odd\" },\n \"context\": { \"$ref\": \"#/definitions/typeContext\" },\n \"template\": { \"description\": \"Typst template (.typ.tpl).\", \"type\": \"string\" }\n }\n },\n \"extension\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"module\"],\n \"properties\": {\n \"module\": { \"description\": \"Dotted path of the Python module.\", \"type\": \"string\", \"examples\": [\"opm.runtime.common_xpath_functions\"] },\n \"prefix\": { \"description\": \"Prefix the ODD calls the module's functions with.\", \"type\": \"string\", \"default\": \"tp\" },\n \"namespace\": { \"description\": \"Namespace URI of the prefix. Not allowed for tp, whose namespace is fixed.\", \"type\": \"string\" },\n \"output\": {\n \"description\": \"Output types the module is used for; all when empty.\",\n \"anyOf\": [\n { \"$ref\": \"#/definitions/outputType\" },\n { \"type\": \"array\", \"items\": { \"$ref\": \"#/definitions/outputType\" } }\n ]\n }\n }\n },\n \"fragment\": {\n \"description\": \"A piece of HTML rendered beside each chunk or once for the document, e.g. a table of contents or a register, available to templates by name.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"name\"],\n \"properties\": {\n \"name\": { \"description\": \"Name templates use to place the fragment.\", \"type\": \"string\" },\n \"scope\": { \"description\": \"per-chunk: rendered for each chunk; global: once for the document.\", \"type\": \"string\", \"enum\": [\"per-chunk\", \"global\"], \"default\": \"per-chunk\" },\n \"xpath\": { \"description\": \"XPath selecting what the fragment renders, relative to the chunk root.\", \"type\": \"string\", \"default\": \".\" },\n \"xpath_dynamic\": { \"description\": \"The xpath the consuming pb-view sends, when it differs from xpath (pb-view index keys only).\", \"type\": \"string\" },\n \"parameters\": { \"description\": \"Values of the ODD's $parameters for this fragment, e.g. { mode = \\\"register\\\" }.\", \"type\": \"object\" },\n \"odd\": { \"description\": \"ODD to render the fragment with.\", \"type\": \"string\" },\n \"mode\": { \"description\": \"Output type the ODD is compiled for.\", \"$ref\": \"#/definitions/outputType\", \"default\": \"web\" }\n }\n },\n \"chunkingRun\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": { \"description\": \"Label of the run, for [[chunking]] arrays: names it in manifest.json, progress and errors, and for `opm chunk --run`.\", \"type\": \"string\" },\n \"input\": { \"description\": \"What the run reads: an XML file, a directory or a glob pattern (** matches any number of subdirectories).\", \"type\": \"string\", \"examples\": [\"data/**/*.xml\"] },\n \"odd\": { \"description\": \"ODD used for chunking; falls back to [transform] odd.\", \"type\": \"string\" },\n \"xpath\": { \"description\": \"XPath selecting the chunk root elements.\", \"type\": \"string\", \"examples\": [\"//text/body/div\"] },\n \"xpath_dynamic\": { \"description\": \"The xpath the consuming pb-view sends, when it differs from xpath (pb-view index keys only).\", \"type\": \"string\" },\n \"selector\": { \"description\": \"Dotted path of a Python callable that selects the chunks, instead of xpath.\", \"type\": \"string\", \"examples\": [\"opm.navigation.tei_pb_chunks\"] },\n \"depth\": { \"description\": \"Maximum heading depth for splitting.\", \"type\": \"integer\", \"minimum\": 1, \"default\": 1 },\n \"output_dir\": { \"description\": \"Output directory, relative to the project root. Only the first run may set it.\", \"type\": \"string\", \"default\": \"chunks\" },\n \"template\": { \"description\": \"Page template for chunk pages; defaults to the [transform.web] template.\", \"type\": \"string\" },\n \"index_template\": { \"description\": \"Page template for the collection index written when chunking several documents.\", \"type\": \"string\" },\n \"index_title\": { \"description\": \"Heading of the collection index; defaults to the input directory name.\", \"type\": \"string\" },\n \"assets\": {\n \"description\": \"Files copied into <output>/assets/ instead of the [transform.web] assets; [] for none. An entry may be a glob.\",\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n },\n \"file_pattern\": { \"description\": \"File name of chunk pages, with {xml_id}, {ident}, {index} or {stem}. Default: 001.html, 002.html, \u2026\", \"type\": \"string\", \"examples\": [\"{xml_id}.html\", \"{index:03d}.html\"] },\n \"document_name\": { \"description\": \"XPath naming each document's output directory (default: its file name); a / in the name nests it.\", \"type\": \"string\", \"examples\": [\"/TEI/@xml:id\"] },\n \"link_pattern\": { \"description\": \"URL of cross-chunk links, with {file}, {stem}, {anchor}, {doc} or {doc_stem}. Default: {file}#{anchor}.\", \"type\": \"string\", \"examples\": [\"/{doc}/{file}\"] },\n \"webcomponents\": { \"description\": \"Web components for this run's pages only; defaults to [transform.web] webcomponents.\", \"type\": \"boolean\" },\n \"fragments\": {\n \"description\": \"Fragments rendered beside the chunks, such as a table of contents or a register.\",\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/definitions/fragment\" }\n },\n \"view\": { \"description\": \"pb-view view mode in index keys (--format pb-view).\", \"type\": \"string\", \"enum\": [\"div\", \"page\", \"single\"], \"default\": \"div\" },\n \"map\": { \"description\": \"pb-view map parameter in index keys (--format pb-view).\", \"type\": \"string\" },\n \"parameters\": { \"description\": \"pb-view user parameters in index keys (--format pb-view), emitted as user.<key>=<value>.\", \"type\": \"object\" },\n \"doc_path\": { \"description\": \"Subdirectory for --format pb-view data; must match the path of the consuming pb-document.\", \"type\": \"string\" }\n }\n },\n \"page\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"path\"],\n \"properties\": {\n \"path\": { \"description\": \"Output path below the chunk output root. With {xml_id}, {ident}, {stem} or {index}, one page per node xpath selects.\", \"type\": \"string\", \"examples\": [\"about.html\", \"places/{xml_id}.html\"] },\n \"template\": { \"description\": \"Page template; defaults to the first chunking run's.\", \"type\": \"string\" },\n \"context\": { \"description\": \"Template context for this page only, over [context].\", \"type\": \"object\" },\n \"source\": { \"description\": \"XML file or directory the page is generated from. Without one the page is static: only the template is rendered.\", \"type\": \"string\" },\n \"xpath\": { \"description\": \"XPath selecting the nodes rendered into the page, from source.\", \"type\": \"string\" },\n \"selector\": { \"description\": \"Dotted path of a chunk selector, instead of xpath.\", \"type\": \"string\" },\n \"odd\": { \"description\": \"ODD for this page; defaults to the first chunking run's.\", \"type\": \"string\" },\n \"parameters\": { \"description\": \"Values of the ODD's $parameters for this page, over [transform.parameters].\", \"type\": \"object\" },\n \"fragments\": {\n \"description\": \"Fragments rendered into the page, as for chunks.\",\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/definitions/fragment\" }\n },\n \"enabled\": { \"description\": \"false switches the page off, e.g. one a profile contributes with the same path.\", \"type\": \"boolean\", \"default\": true }\n }\n },\n \"index\": {\n \"description\": \"Search index written by `opm index`.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"granularity\": { \"description\": \"split: one record per unit, cut to max_chars, for vector search; page: one record per published page, for site search.\", \"type\": \"string\", \"enum\": [\"split\", \"page\"], \"default\": \"split\" },\n \"max_chars\": { \"description\": \"Maximum length of a passage.\", \"type\": \"integer\", \"minimum\": 1, \"default\": 1500 },\n \"min_chars\": { \"description\": \"Records shorter than this are not indexed on their own.\", \"type\": \"integer\", \"minimum\": 0, \"default\": 40 },\n \"overlap\": { \"description\": \"Records carried over from the end of one part into the next, for context (split only).\", \"type\": \"integer\", \"minimum\": 0, \"default\": 1 },\n \"units\": {\n \"description\": \"JSON records that open a passage; declaring any replaces the default walk over titled divisions.\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"name\"],\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"behaviours\": { \"description\": \"ODD behaviours whose records open a unit.\", \"$ref\": \"#/definitions/stringOrList\" },\n \"elements\": { \"description\": \"Elements whose records open a unit.\", \"$ref\": \"#/definitions/stringOrList\" },\n \"models\": { \"description\": \"ODD models whose records open a unit.\", \"$ref\": \"#/definitions/stringOrList\" },\n \"emit\": { \"description\": \"false: use the match only as context, e.g. a heading for the following paragraph, and write no record of its own.\", \"type\": \"boolean\", \"default\": true },\n \"min_chars\": { \"description\": \"Overrides [index] min_chars for this unit.\", \"type\": \"integer\", \"minimum\": 0 }\n }\n }\n },\n \"fields\": {\n \"description\": \"Material pulled out of passages: a facet for filtering, a record of its own, or a chunking fragment copied onto every record of a page.\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"name\"],\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"fragment\": { \"description\": \"Name of a [[chunking.fragments]] entry, copied onto every record of its page. Cannot be mixed with behaviours, elements or models.\", \"type\": \"string\" },\n \"behaviours\": { \"description\": \"ODD behaviours whose records the field takes its text from.\", \"$ref\": \"#/definitions/stringOrList\" },\n \"elements\": { \"description\": \"Elements whose records the field takes its text from.\", \"$ref\": \"#/definitions/stringOrList\" },\n \"models\": { \"description\": \"ODD models whose records the field takes its text from.\", \"$ref\": \"#/definitions/stringOrList\" },\n \"metadata\": { \"description\": \"true: copy the text onto the passage, for filtering; false: write it as a record of its own.\", \"type\": \"boolean\", \"default\": true },\n \"inline\": { \"description\": \"Whether the text stays in the passage's own text; defaults to metadata.\", \"type\": \"boolean\" }\n }\n }\n }\n }\n }\n }\n}\n", "// \u2500\u2500 where things are in a TOML file \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// smol-toml tells whether a file is valid and what it holds, but not where a\n// key or table is written. This scanner finds the headers and key/value lines\n// with their offsets, and resolves each to the path its value has in the parsed\n// document: [[chunking]] tables count up, so the fragments of the second run are\n// chunking[1].fragments. It never throws: a line it cannot read is skipped.\n\nexport type Seg = string | number;\n\nexport interface TomlTable {\n /** Path of the table in the parsed document, e.g. ['chunking', 1, 'fragments', 0]. */\n path: Seg[];\n /** The header, brackets included. */\n from: number;\n to: number;\n /** Whether it is an array-of-tables header, [[\u2026]]. */\n array: boolean;\n}\n\nexport interface TomlKey {\n /** Path of the value, e.g. ['transform', 'web', 'template']. */\n path: Seg[];\n /** The whole (possibly dotted) key. */\n from: number;\n to: number;\n /** The value, trimmed. */\n valueFrom: number;\n valueTo: number;\n}\n\nexport interface TomlScan { tables: TomlTable[]; keys: TomlKey[] }\n\nconst isBare = (c: string) => /[A-Za-z0-9_-]/.test(c);\nconst isSpace = (c: string) => c === ' ' || c === '\\t';\n\n/** A dotted key starting at i: its parts and where it ends, or null. */\nexport function readKey(text: string, i: number, stop: (c: string) => boolean): { parts: string[]; end: number } | null {\n const parts: string[] = [];\n for (;;) {\n while (isSpace(text[i])) i++;\n const c = text[i];\n if (c === '\"' || c === \"'\") {\n let j = i + 1, part = '';\n while (j < text.length && text[j] !== c && text[j] !== '\\n') {\n if (c === '\"' && text[j] === '\\\\' && j + 1 < text.length) { part += text[j + 1]; j += 2; continue; }\n part += text[j++];\n }\n if (text[j] !== c) return null;\n parts.push(part);\n i = j + 1;\n } else if (c !== undefined && isBare(c)) {\n const start = i;\n while (i < text.length && isBare(text[i])) i++;\n parts.push(text.slice(start, i));\n } else {\n return null;\n }\n while (isSpace(text[i])) i++;\n if (text[i] === '.') { i++; continue; }\n return i < text.length && stop(text[i]) ? { parts, end: i } : null;\n }\n}\n\n/**\n * A value starting at i, past strings, arrays and inline tables, which may span lines:\n * where its text ends (before a trailing comment and blanks) and where scanning goes on.\n */\nexport function skipValue(text: string, i: number): { valueTo: number; next: number } {\n let depth = 0, contentEnd = -1;\n while (i < text.length) {\n const c = text[i];\n if (c === '\"' || c === \"'\") {\n if (text.startsWith(c.repeat(3), i)) {\n const end = text.indexOf(c.repeat(3), i + 3);\n i = end < 0 ? text.length : end + 3;\n while (text[i] === c) i++;\n } else {\n i++;\n while (i < text.length && text[i] !== c && text[i] !== '\\n') i += c === '\"' && text[i] === '\\\\' ? 2 : 1;\n if (text[i] === c) i++;\n }\n continue;\n }\n if (c === '#') {\n if (depth === 0 && contentEnd < 0) contentEnd = i;\n while (i < text.length && text[i] !== '\\n') i++;\n continue;\n }\n if (c === '\\n' && depth === 0) break;\n if (c === '[' || c === '{') depth++;\n else if ((c === ']' || c === '}') && depth) depth--;\n i++;\n }\n let valueTo = contentEnd < 0 ? i : contentEnd;\n while (valueTo > 0 && /\\s/.test(text[valueTo - 1])) valueTo--;\n return { valueTo, next: i };\n}\n\nexport function scanToml(text: string): TomlScan {\n const tables: TomlTable[] = [], keys: TomlKey[] = [];\n const counts = new Map<string, number>();\n const id = (p: Seg[]) => JSON.stringify(p);\n // resolve a header's parts: a prefix that names an array of tables means its last element\n const resolve = (parts: string[], array: boolean): Seg[] => {\n const path: Seg[] = [];\n parts.forEach((part, n) => {\n path.push(part);\n const last = n === parts.length - 1;\n if (last && array) {\n const count = counts.get(id(path)) ?? 0;\n counts.set(id(path), count + 1);\n path.push(count);\n } else if (!last && counts.has(id(path))) {\n path.push(counts.get(id(path))! - 1);\n }\n });\n return path;\n };\n let table: Seg[] = [];\n let i = 0;\n while (i < text.length) {\n const c = text[i];\n if (c === '\\n' || isSpace(c) || c === '\\r') { i++; continue; }\n const eol = () => { const n = text.indexOf('\\n', i); return n < 0 ? text.length : n; };\n if (c === '#') { i = eol(); continue; }\n if (c === '[') {\n const array = text[i + 1] === '[';\n const key = readKey(text, i + (array ? 2 : 1), ch => ch === ']');\n if (key && (!array || text[key.end + 1] === ']')) {\n const end = key.end + (array ? 2 : 1);\n table = resolve(key.parts, array);\n tables.push({ path: table, from: i, to: end, array });\n }\n i = eol();\n continue;\n }\n const key = readKey(text, i, ch => ch === '=');\n if (!key) { i = eol(); continue; }\n let keyTo = key.end;\n while (keyTo > i && isSpace(text[keyTo - 1])) keyTo--;\n let v = key.end + 1;\n while (isSpace(text[v])) v++;\n const { valueTo, next } = skipValue(text, v);\n keys.push({ path: [...table, ...key.parts], from: i, to: keyTo, valueFrom: v, valueTo: Math.max(v, valueTo) });\n i = Math.max(next, i + 1);\n }\n return { tables, keys };\n}\n\n/** The table a position belongs to: the path of the last header before it, [] before any. */\nexport function tableAt(scan: TomlScan, offset: number): TomlTable | undefined {\n let found: TomlTable | undefined;\n for (const t of scan.tables) if (t.from <= offset) found = t; else break;\n return found;\n}\n", "// \u2500\u2500 element editing: select, remove tags, split, surround \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// The commands of opm studio's src/ui/xmlCommands.ts, on plain text: each takes\n// the text and one selection and returns the changes plus the selection after them.\nimport { pairs, scanTags, type Tag } from './tags.ts';\nimport type { TextEdit } from './association.ts';\n\nexport interface Element {\n name: string;\n from: number;\n to: number;\n open: Tag;\n /** Missing for a self-closing element. */\n close?: Tag;\n}\n\nexport interface Selection { anchor: number; head: number }\n\n/** The result of a command for one selection: changes and the selection after them (counting only these changes). */\nexport interface ElementEdit { changes: TextEdit[]; selection: Selection }\n\n/** Every complete element in text, in document order of their start tags. */\nexport function elements(text: string): Element[] {\n const tags = scanTags(text), pair = pairs(tags), out: Element[] = [];\n tags.forEach((t, i) => {\n if (t.kind === 'empty') out.push({ name: t.name, from: t.from, to: t.to, open: t });\n else if (t.kind === 'open' && pair.has(i)) {\n const close = tags[pair.get(i)!];\n out.push({ name: t.name, from: t.from, to: close.to, open: t, close });\n }\n });\n return out;\n}\n\n/** The elements holding from..to, innermost first. */\nexport function elementsAround(text: string, from: number, to = from): Element[] {\n return elements(text).filter(e => e.from <= from && e.to >= to).sort((a, b) => (a.to - a.from) - (b.to - b.from));\n}\n\n/**\n * The element around a range. With `outer`, one that is larger than the range,\n * so that selecting the element again moves on to its parent.\n */\nexport function elementAround(text: string, from: number, to: number, outer: boolean): Element | undefined {\n return elementsAround(text, from, to).find(e => !outer || from === to || e.from < from || e.to > to);\n}\n\n/** Select the element around the selection; again for its parent. */\nexport function selectElement(text: string, from: number, to: number): ElementEdit | null {\n const e = elementAround(text, from, to, true);\n return e ? { changes: [], selection: { anchor: e.from, head: e.to } } : null;\n}\n\n/** Remove the tags of the element around the selection, keeping its content selected. */\nexport function removeElementTags(text: string, from: number, to: number): ElementEdit | null {\n const e = elementAround(text, from, to, false);\n if (!e) return null;\n const { open, close } = e;\n if (!close) return { changes: [{ from: open.from, to: open.to, insert: '' }], selection: { anchor: open.from, head: open.from } };\n const length = open.to - open.from;\n return {\n changes: [{ from: open.from, to: open.to, insert: '' }, { from: close.from, to: close.to, insert: '' }],\n selection: { anchor: open.from, head: close.from - length },\n };\n}\n\n/**\n * Split the element around the cursor in two at the cursor: its end tag, then its\n * start tag again, with the same attributes but for an id, which has to stay unique.\n */\nexport function splitElement(text: string, pos: number): ElementEdit | null {\n // the innermost element whose content holds the cursor, not one whose tag does\n const e = elementsAround(text, pos).find(x => x.close && pos >= x.open.to && pos <= x.close.from);\n if (!e) return null;\n const start = text.slice(e.open.from, e.open.to).replace(/\\s(xml:)?id\\s*=\\s*(\"[^\"]*\"|'[^']*')/g, '');\n const insert = `</${e.name}>${start}`;\n return { changes: [{ from: pos, to: pos, insert }], selection: { anchor: pos + insert.length, head: pos + insert.length } };\n}\n\n/** Wrap from..to in an element; `tag` is its name, optionally followed by attributes. The text stays selected. */\nexport function surroundWithElement(from: number, to: number, tag: string): ElementEdit {\n const start = `<${tag.trim()}>`, end = `</${tag.trim().split(/\\s/)[0]}>`;\n return {\n changes: [{ from, to: from, insert: start }, { from: to, to, insert: end }],\n selection: { anchor: from + start.length, head: to + start.length },\n };\n}\n"],
|
|
5
|
+
"mappings": ";AAEA;AAAA,EACE;AAAA,EAAS;AAAA,EAAoB;AAAA,EAAqB;AAAA,EAAa;AAAA,EAAqB;AAAA,EAAM;AAAA,EAAY;AAAA,OAEjG;AACP,SAAS,mBAAoC;AAK7C,IAAM,MAAM;AAGZ,SAAS,SAAS,GAAa,UAA+B,WAA4B;AACxF,MAAI,aAAa,MAAM;AACrB,QAAI,CAAC,EAAE,MAAO,aAAa,EAAE,OAAO,GAAK,QAAO,EAAE;AAClD,UAAMA,KAAI,SAAS,cAAc,EAAE,IAAI,EAAE,IAAI;AAC7C,WAAOA,MAAK,GAAG,EAAE,IAAI,KAAK,EAAE,EAAE;AAAA,EAChC;AACA,MAAI,aAAa,WAAY,QAAO,GAAG,SAAS,EAAE,GAAG,UAAU,SAAS,CAAC,OAAO,SAAS,EAAE,GAAG,UAAU,SAAS,CAAC;AAClH,MAAI,aAAa,OAAQ,QAAO,eAAe,EAAE,EAAE;AACnD,MAAI,aAAa,QAAS,QAAO;AACjC,SAAO,OAAO,CAAC;AACjB;AAGA,SAAS,UAAU,GAAoB,UAA+B,OAAwB;AAC5F,QAAM,YAAY,aAAa,sBAAsB,aAAa;AAClE,QAAMC,SAAQ,EAAE,SAAS,EAAE,IAAI,OAAK,SAAS,GAAG,UAAU,SAAS,CAAC;AACpE,QA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