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AC;CACF","sourcesContent":["import { type Form, parseClass } from './parse-class.js'\n\nexport type { Form }\n\nexport type MatcherOptions = {\n /** perform a case-insensitive match */\n nocase?: boolean\n /** do not treat strings starting with `.` specially */\n dot?: boolean\n /** do not match extglobs (treat them as normal strings) */\n noext?: boolean\n /**\n * normalize unicode in the pattern and the tested strings, with\n * this form. `true` means `'NFC'`.\n */\n normalize?: boolean | Form\n}\n\n// parsed pattern items\nexport type Item =\n | { t: 'lit'; ch: string }\n | { t: 'any' | 'star' }\n | { t: 'class'; re: RegExp }\n | { t: 'ext'; type: string; alts: Item[][] }\n\n// extglob syntax tokens become literals if they are not part of a\n// closed extglob\nexport type Token =\n Item | { t: 'open'; type: string } | { t: 'bar' } | { t: 'close' }\n\n// state machine nodes\nexport type NegNode = { t: 'neg'; id: number; sub: Node; next: Node }\nexport type SplitNode = { t: 'split'; id: number; out: Node[] }\nexport type Node =\n | ({ t: 'lit'; id: number; next: Node } & Lit)\n | { t: 'any' | 'star'; id: number; next: Node }\n | { t: 'class'; id: number; re: RegExp; next: Node }\n | SplitNode\n | NegNode\n | { t: 'match'; id: number }\n\n// the end of the pattern, or of a negated sub-pattern\nconst MATCH: Node = { t: 'match', id: 0 }\n\nconst extTypes = '!?+*@'\n\nconst lit = (ch: string): Item => ({ t: 'lit', ch })\n\nconst reEscape = (s: string) => s.replace(/[\\\\^$.*+?()[\\]{}|/]/g, '\\\\$&')\n\n// a RegExp that only matches `s`, with unicode case folding\nconst newFoldRe = (s: string) => new RegExp(`^${reEscape(s)}$`, 'iu')\n\n// foldRe for one literal char. The same chars are in most patterns,\n// so keep them. A RegExp without the `g` or `y` flag has no state to\n// share.\nconst foldCache = new Map()\nconst foldRe = (ch: string) => {\n let re = foldCache.get(ch)\n if (!re) {\n re = newFoldRe(ch)\n if (foldCache.size >= 1000) foldCache.clear()\n foldCache.set(ch, re)\n }\n return re\n}\n\n/**\n * A literal char. With `nocase:true`, `re` folds case, and `ascii`\n * holds its results for ASCII chars, by char code: 1 for a match,\n * and 2 for not.\n */\nexport type Lit = { ch: string; re?: RegExp; ascii?: Uint8Array }\n\nconst litMatch = (l: Lit, c: string) => {\n if (c === l.ch) return true\n if (!l.re) return false\n const code = c.charCodeAt(0)\n if (code >= 128) return l.re.test(c)\n const ascii = (l.ascii ??= new Uint8Array(128))\n ascii[code] ||= l.re.test(c) ? 1 : 2\n return ascii[code] === 1\n}\n\nconst tokenize = (\n p: string,\n nocase: boolean,\n noext: boolean,\n form?: Form,\n) => {\n const toks: Token[] = []\n for (let i = 0; i < p.length;) {\n const c = String.fromCodePoint(p.codePointAt(i)!)\n if (c === '\\\\') {\n // a trailing \\ is a literal \\\n const e = p.codePointAt(i + 1)\n const ch = e === undefined ? c : String.fromCodePoint(e)\n toks.push(lit(ch))\n i += 1 + ch.length\n continue\n }\n if (c === '[') {\n const [re, consumed] = parseClass(p, i, nocase, form)\n if (consumed) {\n toks.push({ t: 'class', re })\n i += consumed\n continue\n }\n }\n if (!noext && extTypes.includes(c) && p[i + 1] === '(') {\n toks.push({ t: 'open', type: c })\n i += 2\n continue\n }\n toks.push(\n !noext && c === '|' ? { t: 'bar' }\n : !noext && c === ')' ? { t: 'close' }\n : c === '*' ? { t: 'star' }\n : c === '?' ? { t: 'any' }\n : lit(c),\n )\n i += c.length\n }\n return toks\n}\n\n// map each open token index to the index of its close token\nconst pair = (toks: Token[]) => {\n const pairs = new Map()\n const stack: number[] = []\n toks.forEach((tok, i) => {\n if (tok.t === 'open') stack.push(i)\n else if (tok.t === 'close' && stack.length) pairs.set(stack.pop()!, i)\n })\n return pairs\n}\n\n// build the alternatives between start and end. An open token that\n// is not closed is never inside a closed extglob, so bar and close\n// tokens are only literal at the top level.\nconst build = (\n toks: Token[],\n pairs: Map,\n start: number,\n end: number,\n top: boolean,\n): Item[][] => {\n let seq: Item[] = []\n const alts = [seq]\n for (let i = start; i < end; i++) {\n const tok = toks[i]!\n const close = pairs.get(i)\n if (tok.t === 'open' && close !== undefined) {\n const sub = build(toks, pairs, i + 1, close, false)\n seq.push({ t: 'ext', type: tok.type, alts: sub })\n i = close\n } else if (tok.t === 'bar' && !top) {\n alts.push((seq = []))\n } else if (tok.t === 'open') {\n seq.push(lit(tok.type), lit('('))\n } else if (tok.t === 'bar') {\n seq.push(lit('|'))\n } else if (tok.t === 'close') {\n seq.push(lit(')'))\n } else {\n seq.push(tok)\n }\n }\n return alts\n}\n\n// normalize each run of literal chars as one string, so that a char\n// and the combining marks after it compose (or decompose) together.\n// Syntax is already parsed, so a char that normalizes to a syntax\n// char (such as full-width `*` in NFKC) stays a literal.\nconst normalize = (items: Item[], form: Form): Item[] => {\n const out: Item[] = []\n let run = ''\n const flush = () => {\n for (const ch of run.normalize(form)) out.push(lit(ch))\n run = ''\n }\n for (const it of items) {\n if (it.t === 'lit') {\n run += it.ch\n continue\n }\n flush()\n out.push(\n it.t === 'ext' ?\n { ...it, alts: it.alts.map(a => normalize(a, form)) }\n : it,\n )\n }\n flush()\n return out\n}\n\n// the start node, and the number of node ids. Ids are dense, from 0\n// for the match node.\nconst compile = (\n items: Item[],\n nocase: boolean,\n): [start: Node, size: number] => {\n let id = 1\n const split = (out: Node[]): SplitNode => ({ t: 'split', id: id++, out })\n const seq = (items: Item[], next: Node): Node =>\n items.reduceRight((next, it) => item(it, next), next)\n const item = (it: Item, next: Node): Node => {\n switch (it.t) {\n case 'lit':\n const re = nocase ? foldRe(it.ch) : undefined\n return { t: 'lit', id: id++, ch: it.ch, re, next }\n case 'any':\n case 'star':\n return { t: it.t, id: id++, next }\n case 'class':\n return { t: 'class', id: id++, re: it.re, next }\n }\n const alts = (next: Node) => it.alts.map(a => seq(a, next))\n switch (it.type) {\n case '@':\n return split(alts(next))\n case '?':\n return split([next, ...alts(next)])\n case '!':\n return { t: 'neg', id: id++, sub: split(alts(MATCH)), next }\n }\n // * and +, loop back after each match\n const after = split([])\n const entry = split(alts(after))\n after.out.push(next, entry)\n return it.type === '*' ? after : entry\n }\n const start = seq(items, MATCH)\n return [start, id]\n}\n\n// one line per node, in the order that a walk from the start\n// reaches them. Edges point to node ids. The nodes of a negated\n// sub-pattern are indented under their negation.\nconst show = (start: Node): string => {\n const lines: string[] = []\n const seen = new Set()\n const ref = (n: Node) => (n.t === 'match' ? 'match' : String(n.id))\n const walk = (n: Node, indent: string) => {\n if (n.t === 'match' || seen.has(n)) return\n seen.add(n)\n const line = (desc: string) => lines.push(`${indent}${n.id}: ${desc}`)\n switch (n.t) {\n case 'split':\n line(`split -> ${n.out.map(ref).join(', ')}`)\n for (const o of n.out) walk(o, indent)\n return\n case 'neg':\n line(`!(${ref(n.sub)}) -> ${ref(n.next)}`)\n walk(n.sub, indent + ' ')\n return walk(n.next, indent)\n case 'lit':\n line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`)\n break\n case 'class':\n line(`${n.re} -> ${ref(n.next)}`)\n break\n default:\n line(`${n.t === 'any' ? '?' : '*'} -> ${ref(n.next)}`)\n }\n walk(n.next, indent)\n }\n walk(start, '')\n return [`start -> ${ref(start)}`, ...lines].join('\\n')\n}\n\n// A thread inside a !(...) negation. It holds the threads of the\n// negated sub-pattern, started where the negation started. The\n// negation matches the chars so far if the sub-pattern does not.\ntype Run = { t: 'run'; neg: NegNode; state: State }\n\n// The threads at one position in the string. Each node thread is\n// only kept once, and runs with the same state are only kept once,\n// so that identical threads merge. The match node is not in\n// `threads`, because it can not step. It sets `match` instead.\nclass State {\n // set by the Sim, to mark the nodes that this state has\n gen: number\n threads: Node[] = []\n match = false\n runs: Run[] = []\n // the sorted ids of the threads, with 0 for a match, once the\n // state is done\n ids: number[] = []\n\n constructor(gen: number) {\n this.gen = gen\n }\n\n // no threads, so nothing more can match\n get dead() {\n return !this.threads.length && !this.match && !this.runs.length\n }\n}\n\n// true if the two states hold the same threads\nconst sameState = (a: State, b: State): boolean => {\n if (a.ids.length !== b.ids.length) return false\n if (a.runs.length !== b.runs.length) return false\n if (a.ids.some((id, i) => id !== b.ids[i])) return false\n return a.runs.every(r =>\n b.runs.some(o => o.neg === r.neg && sameState(o.state, r.state)),\n )\n}\n\n/**\n * For each node id, the gen of the last state that has the node as\n * a thread, and of the last state that walked through it. A state is\n * built to the end before the states around it go on, and the nodes\n * of a negated sub-pattern are only in its states (other than the\n * match node, which is never marked). So one mark for each node is\n * enough to know if the state being built has it. The Sims of a\n * matcher never run at the same time, so they share one Marks.\n */\nexport type Marks = { has: Float64Array; seen: Float64Array; gen: number }\n\nconst marks = (size: number): Marks => ({\n has: new Float64Array(size),\n seen: new Float64Array(size),\n gen: 0,\n})\n\nclass Sim {\n // `.` and `..` only match literal dots, even with `dot:true`\n dots: boolean\n // the string starts with `.`, and `dot:true` is not set\n dotStart: boolean\n #marks: Marks\n\n constructor(dots: boolean, dotStart: boolean, marks: Marks) {\n this.dots = dots\n this.dotStart = dotStart\n this.#marks = marks\n }\n\n state() {\n return new State(++this.#marks.gen)\n }\n\n // sort the ids of a state, once it has all of its threads\n done(state: State) {\n state.ids = state.threads.map(n => n.id).sort((a, b) => a - b)\n if (state.match) state.ids.unshift(MATCH.id)\n return state\n }\n\n // true the first time that the state walks through the node, so\n // that loops in the graph stop\n #visit(state: State, node: Node) {\n const { seen } = this.#marks\n if (seen[node.id] === state.gen) return false\n seen[node.id] = state.gen\n return true\n }\n\n #addThread(state: State, node: Node) {\n const { has } = this.#marks\n if (has[node.id] === state.gen) return false\n has[node.id] = state.gen\n state.threads.push(node)\n return true\n }\n\n // wildcards only match a leading dot if `dot:true`. In a negated\n // sub-pattern, this does not apply, because the negation itself\n // can not match a leading dot.\n restricted(i: number, top: boolean) {\n return top && (this.dots || (this.dotStart && i === 0))\n }\n\n add(state: State, node: Node, i: number, top: boolean): void {\n switch (node.t) {\n case 'split':\n if (!this.#visit(state, node)) return\n for (const o of node.out) this.add(state, o, i, top)\n return\n case 'neg':\n if (!this.#visit(state, node)) return\n const sub = this.state()\n this.add(sub, node.sub, i, false)\n this.done(sub)\n return this.addRun(\n state,\n { t: 'run', neg: node, state: sub },\n i,\n top,\n )\n case 'star':\n // a * can not start a dotfile, even if it matches nothing\n if (this.restricted(i, top)) return\n if (this.#addThread(state, node))\n this.add(state, node.next, i, top)\n return\n case 'match':\n state.match = true\n return\n default:\n this.#addThread(state, node)\n }\n }\n\n addRun(state: State, run: Run, i: number, top: boolean) {\n for (const r of state.runs) {\n if (r.neg === run.neg && sameState(r.state, run.state)) return\n }\n state.runs.push(run)\n if (!run.state.match) {\n this.add(state, run.neg.next, i, top)\n }\n }\n\n // the threads after char `c`, at index `i`\n step(state: State, c: string, i: number, top: boolean): State {\n const next = this.state()\n for (const th of state.threads) {\n switch (th.t) {\n case 'lit':\n if (litMatch(th, c)) {\n this.add(next, th.next, i + 1, top)\n }\n break\n case 'any':\n if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top)\n break\n case 'class':\n if (!this.restricted(i, top) && th.re.test(c)) {\n this.add(next, th.next, i + 1, top)\n }\n break\n case 'star':\n if (!this.restricted(i, top)) this.add(next, th, i + 1, top)\n }\n }\n if (!this.restricted(i, top)) {\n for (const run of state.runs) {\n // a sub-pattern with no threads can not match again, so the\n // run stays the same\n if (run.state.dead) {\n this.addRun(next, run, i + 1, top)\n continue\n }\n const sub = this.step(run.state, c, i, false)\n this.addRun(\n next,\n { t: 'run', neg: run.neg, state: sub },\n i + 1,\n top,\n )\n }\n }\n return this.done(next)\n }\n}\n\n// A canonical key for the threads in a state. States with the same\n// key hold the same threads, so they match the same strings.\nconst stateKey = (state: State): string => {\n const ids = state.ids.join()\n if (!state.runs.length) return ids\n const runs = state.runs.map(r => `${r.neg.id}(${stateKey(r.state)})`)\n return `${ids}|${runs.sort().join('|')}`\n}\n\n// A cached state of the simulation, and the states that each char\n// leads to.\ntype DState = {\n state: State\n match: boolean\n // no threads, so nothing more can match\n dead: boolean\n // the next state for each ASCII char, by char code, and for the\n // other chars\n ascii?: (DState | undefined)[]\n next: Map\n}\n\n// The cache can hold about this many chars of state keys and\n// transitions. When it is full, it is cleared, so that a pattern\n// can not use an unbounded amount of memory.\nconst DFA_BUDGET = 1 << 18\n\n// A cache of the states that the simulation reaches, built as the\n// matcher is used. Each char of a string is then one Map lookup,\n// once the states that it leads to are known.\n//\n// The dot rules only restrict the first char of a dotfile (strings\n// that are only `.` or `..` do not use the cache). So a dotfile\n// starts at its own state, which takes its first step with the\n// restriction, and every other state takes steps without it.\nclass Dfa {\n #start: Node\n #states = new Map()\n #size = 0\n #plain?: DState\n #dotStart?: DState\n #sim: Sim\n #dotSim: Sim\n\n constructor(start: Node, marks: Marks) {\n this.#start = start\n this.#sim = new Sim(false, false, marks)\n this.#dotSim = new Sim(false, true, marks)\n }\n\n #make(state: State): DState {\n return {\n state,\n match: state.match,\n dead: state.dead,\n next: new Map(),\n }\n }\n\n #intern(state: State): DState {\n const key = stateKey(state)\n const found = this.#states.get(key)\n if (found) return found\n if (this.#size > DFA_BUDGET) this.#clear()\n const d = this.#make(state)\n this.#states.set(key, d)\n this.#size += key.length + 1\n return d\n }\n\n #clear() {\n this.#states.clear()\n this.#size = 0\n this.#plain = undefined\n this.#dotStart = undefined\n }\n\n start(dotStart: boolean): DState {\n if (dotStart) {\n if (this.#dotStart) return this.#dotStart\n const state = this.#dotSim.state()\n this.#dotSim.add(state, this.#start, 0, true)\n return (this.#dotStart = this.#make(this.#dotSim.done(state)))\n }\n if (this.#plain) return this.#plain\n const state = this.#sim.state()\n this.#sim.add(state, this.#start, 0, true)\n return (this.#plain = this.#intern(this.#sim.done(state)))\n }\n\n // the next state, after a miss in `d.ascii`\n next(d: DState, c: string): DState {\n const code = c.charCodeAt(0)\n const found = code < 128 ? undefined : d.next.get(c)\n if (found) return found\n // the dotfile start is not in the cache, so it is never shared\n const n =\n d === this.#dotStart ?\n this.#intern(this.#dotSim.step(d.state, c, 0, true))\n : this.#intern(this.#sim.step(d.state, c, 1, true))\n if (code < 128) {\n if (!d.ascii) {\n d.ascii = new Array(128)\n this.#size += 128\n }\n d.ascii[code] = n\n } else {\n d.next.set(c, n)\n }\n this.#size++\n return n\n }\n}\n\n/**\n * A node in a graph with no splits or negations. Such a graph is a\n * chain of nodes that each match one char, or a `*`.\n */\nexport type LinearNode = Exclude<\n Node,\n SplitNode | NegNode | { t: 'match' }\n>\n\n// the nodes in order, if the graph is a single chain\nconst linear = (start: Node): LinearNode[] | undefined => {\n const nodes: LinearNode[] = []\n for (let n = start; n.t !== 'match'; n = n.next) {\n if (n.t === 'split' || n.t === 'neg') return undefined\n nodes.push(n)\n }\n return nodes\n}\n\n// Match a chain of nodes. Each node other than `*` matches exactly\n// one char, so on a failure it is enough to go back to the last `*`\n// and let it match one more char. This takes at most\n// nodes.length * chars.length steps.\nconst testLinear = (\n nodes: LinearNode[],\n chars: ArrayLike,\n start: number,\n end: number,\n) => {\n let ni = 0\n let ci = start\n let starNi = -1\n let starCi = 0\n while (ci < end) {\n const n = nodes[ni]\n if (n?.t === 'star') {\n starNi = ni++\n starCi = ci\n continue\n }\n const c = chars[ci]!\n if (\n n &&\n (n.t === 'any' ||\n (n.t === 'lit' && litMatch(n, c)) ||\n (n.t === 'class' && n.re.test(c)))\n ) {\n ni++\n ci++\n continue\n }\n if (starNi === -1) return false\n ni = starNi + 1\n ci = ++starCi\n }\n while (nodes[ni]?.t === 'star') ni++\n return ni === nodes.length\n}\n\n// The least and most chars that the items can match. These are only\n// bounds: a negation can match a string of any length, so it counts\n// as 0 to Infinity.\nconst lengths = (items: Item[]): [min: number, max: number] => {\n let min = 0\n let max = 0\n for (const it of items) {\n const [lo, hi] = itemLengths(it)\n min += lo\n max += hi\n }\n return [min, max]\n}\n\nconst itemLengths = (it: Item): [min: number, max: number] => {\n if (it.t === 'star') return [0, Infinity]\n if (it.t !== 'ext') return [1, 1]\n if (it.type === '!') return [0, Infinity]\n const alts = it.alts.map(lengths)\n const min = Math.min(...alts.map(a => a[0]))\n const max = Math.max(...alts.map(a => a[1]))\n // a loop of alternatives that only match the empty string is empty\n const loop = max === 0 ? 0 : Infinity\n return (\n it.type === '@' ? [min, max]\n : it.type === '?' ? [0, max]\n : it.type === '*' ? [0, loop]\n : [min, loop]\n )\n}\n\n// true if the chars from `start` match the literals\nconst hasAffix = (\n lits: Lit[],\n chars: ArrayLike,\n start: number,\n) => {\n for (let j = 0; j < lits.length; j++) {\n if (!litMatch(lits[j]!, chars[start + j]!)) return false\n }\n return true\n}\n\n// a `/`, or half of a surrogate pair\nconst slashOrSurrogate = /[/\\ud800-\\udfff]/\nconst surrogate = /[\\ud800-\\udfff]/\n\n// a string can be indexed by code point, unless it has surrogate\n// pairs\nconst codePoints = (s: string): ArrayLike =>\n surrogate.test(s) ? [...s] : s\n\nconst noSlash = (s: string) => {\n if (s.includes('/')) {\n throw new Error('can only match a single path portion, got: ' + s)\n }\n}\n\nexport class Matcher {\n pattern: string\n options: MatcherOptions\n #start: Node\n // the number of node ids\n #size: number\n #marks?: Marks\n // the Sim for strings that are only `.` or `..`\n #dotsSim?: Sim\n // the string to compare, if the pattern has no magic. With\n // `nocase:true`, the RegExp that folds case is made when it is\n // first used.\n #literal?: string\n #literalFold = false\n #literalRe?: RegExp\n // the nodes between the prefix and suffix, if the graph is a\n // single chain\n #linear?: LinearNode[]\n // the linear nodes are only `*` and `?`, so the length bounds and\n // the prefix and suffix decide the match\n #wild = false\n // the least and most chars that a match can have\n #min = 0\n #max = Infinity\n // the literals that a match must start and end with. Each one\n // matches exactly one char, and they are distinct items in the\n // pattern, so a string that does not have them can not match.\n #prefix: Lit[] = []\n #suffix: Lit[] = []\n // the prefix and suffix as strings, if they do not fold case\n #prefixStr?: string\n #suffixStr?: string\n // there is a prefix or suffix to check\n #affix = false\n #dfa?: Dfa\n #form?: Form\n\n constructor(pattern: string, options: MatcherOptions = {}) {\n if (pattern.includes('/')) {\n throw new Error(\n 'can only match a single path portion, got pattern: ' + pattern,\n )\n }\n this.pattern = pattern\n this.options = options\n const { nocase = false, noext = false, normalize: n } = options\n this.#form = n === true ? 'NFC' : n || undefined\n // a pattern that is only an empty extglob is a literal string,\n // except for `!()`, which matches any non-empty string\n const literal = /^[?*+@]\\(\\)$/.test(pattern)\n const toks = tokenize(pattern, nocase, noext || literal, this.#form)\n let [items] = build(toks, pair(toks), 0, toks.length, true)\n if (this.#form) items = normalize(items!, this.#form)\n const [start, size] = compile(items!, nocase)\n this.#start = start\n this.#size = size\n if (items!.every(it => it.t === 'lit')) {\n this.#literal = items!.map(it => it.ch).join('')\n this.#literalFold = nocase\n } else {\n const lit = (it: Item): Lit | undefined =>\n it.t !== 'lit' ? undefined\n : nocase ? { ch: it.ch, re: foldRe(it.ch) }\n : { ch: it.ch }\n for (const it of items!) {\n const l = lit(it)\n if (!l) break\n this.#prefix.push(l)\n }\n for (let j = items!.length - 1; j >= 0; j--) {\n const l = lit(items![j]!)\n if (!l) break\n this.#suffix.unshift(l)\n }\n this.#affix = !!(this.#prefix.length || this.#suffix.length)\n if (!nocase) {\n this.#prefixStr = this.#prefix.map(l => l.ch).join('')\n this.#suffixStr = this.#suffix.map(l => l.ch).join('')\n }\n this.#linear = linear(this.#start)?.slice(\n this.#prefix.length,\n -this.#suffix.length || undefined,\n )\n this.#wild = !!this.#linear?.every(\n n => n.t === 'star' || n.t === 'any',\n )\n const [min, max] = lengths(items!)\n this.#min = min\n this.#max = max\n }\n }\n\n test(s: string): boolean {\n // The `/` check uses the string as given, so with normalization it\n // is a separate step. Otherwise, one scan finds both a `/` and the\n // surrogate pairs that stop the string being indexed by code point.\n if (this.#form) {\n noSlash(s)\n return this.#test(s.normalize(this.#form))\n }\n if (slashOrSurrogate.test(s)) {\n noSlash(s)\n return this.#test(s, [...s])\n }\n return this.#test(s, s)\n }\n\n /**\n * The same as {@link Matcher#test}, but the string is not checked\n * for `/` chars, so the result for a string that has one is not\n * defined. Only use it for a string that is known to be one path\n * portion, such as a part of a path that was split on `/`. It can\n * be faster, because some patterns do not need to look at each char\n * of the string.\n */\n testUnchecked(s: string): boolean {\n return this.#test(this.#form ? s.normalize(this.#form) : s)\n }\n\n // Test a string that has no `/`. `chars` indexes it by code point.\n // If it is not given, it is only found if a step needs it.\n #test(s: string, chars?: ArrayLike): boolean {\n if (this.#literal !== undefined) {\n return this.#literalFold ?\n (this.#literalRe ??= newFoldRe(this.#literal)).test(s)\n : s === this.#literal\n }\n // the length check means that the prefix and suffix do not\n // overlap. Without the chars, the length in code points is from\n // half of the UTF-16 length (if each one is a surrogate pair) to\n // all of it, which is often enough to know.\n const min = this.#min\n const max = this.#max\n if (chars === undefined) {\n const most = s.length\n const least = (most + 1) >> 1\n if (most < min || least > max) return false\n if (least < min || most > max) chars = codePoints(s)\n }\n if (\n chars !== undefined &&\n (chars.length < min || chars.length > max)\n ) {\n return false\n }\n const prefix = this.#prefix.length\n if (this.#affix) {\n if (this.#prefixStr !== undefined && this.#suffixStr !== undefined) {\n if (\n !s.startsWith(this.#prefixStr) ||\n !s.endsWith(this.#suffixStr)\n ) {\n return false\n }\n } else {\n chars ??= codePoints(s)\n const end = chars.length - this.#suffix.length\n if (\n !hasAffix(this.#prefix, chars, 0) ||\n !hasAffix(this.#suffix, chars, end)\n ) {\n return false\n }\n }\n }\n const dotStart = !this.options.dot && s.startsWith('.')\n if (this.#linear) {\n // `.` and `..` only match literal dots, even with `dot:true`\n if (s === '.' || s === '..') return false\n // only a literal can match the leading dot. A `*` can not\n // start a dotfile, even if it matches nothing.\n if (dotStart && !prefix) return false\n if (this.#wild) return true\n chars ??= codePoints(s)\n const end = chars.length - this.#suffix.length\n return testLinear(this.#linear, chars, prefix, end)\n }\n chars ??= codePoints(s)\n if (s === '.' || s === '..') {\n this.#marks ??= marks(this.#size)\n const sim = (this.#dotsSim ??= new Sim(true, false, this.#marks))\n const start = sim.state()\n sim.add(start, this.#start, 0, true)\n let state = sim.done(start)\n for (let i = 0; i < chars.length; i++) {\n state = sim.step(state, chars[i]!, i, true)\n }\n return state.match\n }\n this.#marks ??= marks(this.#size)\n const dfa = (this.#dfa ??= new Dfa(this.#start, this.#marks))\n let d = dfa.start(dotStart)\n // read char codes from the string, so that a one-char string is\n // only made for a cache miss\n const str = chars === s\n for (let i = 0; i < chars.length; i++) {\n if (d.dead) return false\n const code = str ? s.charCodeAt(i) : chars[i]!.charCodeAt(0)\n d = d.ascii?.[code] ?? dfa.next(d, chars[i]!)\n }\n return d.match\n }\n\n /** a readable listing of the state machine */\n toString(): string {\n return show(this.#start)\n }\n}\n"]}