@mark1russell7/vex-compiler 0.11.2 → 0.13.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["FREE","call","eachUnderLets","join","call","NEGATIVE_ZERO","partsOf"],"sources":["../src/facts.ts","../src/loop.ts","../src/js.ts","../src/memo.ts","../src/lower.ts","../src/runtime.ts","../src/tiers.ts","../src/sheet-order.ts","../src/module.ts"],"sourcesContent":["/**\n * The facts of the options that the printer uses (docs/COMPILER.md §13.2). For each op site, they give the domain\n * whose op the interpreter takes first, and the kinds and the lifts of its parameters. The facts come from the op\n * tables, so the same options always give the same facts, and the same source.\n */\nimport { children, isListOp, isOpName, isVexList, liftsAt, listOf, type AnyDomain, type Expr, type ExtHandler, type FreeFn, type OpSpec, type ParamKind, type PrimitiveKind, type ReturnKind } from \"@mark1russell7/vex\";\n\n/**\n * The most bodies of functions that tier 2 puts at the calls of one program. A function that calls another function\n * twice doubles its body, so a chain of such functions grows fast. A module prints each function once.\n */\nexport const MAX_CALLS = 10_000;\n\n/**\n * The list ops that give a list, or read a position or a key of a list (LIST.SORT, LIST.TAKE, LIST.NTH, LIST.BUILD,\n * LIST.GET).\n */\nconst ORDER_OPS: ReadonlySet<string> = new Set([\"sortBy\", \"take\", \"nth\", \"drop\", \"append\", \"flat\", \"without\", \"get\"]);\n\n/**\n * This function gives the reason that tier 2 cannot take a program with lists as values. The reason is the axis `list`,\n * an op on the order or the keys of a list, or a list literal. Tier 1 evaluates such a program. It uses a stack, not\n * recursion.\n */\nexport function listReason(expr: Expr): string | undefined {\n const todo: Expr[] = [expr];\n for (let x = todo.pop(); x !== undefined; x = todo.pop()) {\n if ((x.tag === \"each\" || x.tag === \"fold\") && listOf(x.axis) !== undefined) return 'the program has the axis \"list\", and tier 2 does not have lists as values yet';\n // Stryker disable next-line ConditionalExpression: a node that is not an app has no field op, so the set does not have it\n if (x.tag === \"app\" && ORDER_OPS.has(x.op)) return `the program has the list op \"${x.op}\", and tier 2 does not have lists as values yet`;\n if (x.tag === \"lit\" && isVexList(x.value)) return \"the program has a list literal, and tier 2 does not have lists as values yet\";\n todo.push(...children(x));\n }\n return undefined;\n}\n\n/** The function of an op of a domain, or a method. */\nexport type Method = (...args: unknown[]) => unknown;\n\n/**\n * The kind of a value that the compiler knows: a primitive type, or `domain:Name`. The second kind is for a value of\n * the domain `Name` without a primitive type (KIND.DOMAIN).\n */\nexport type Kind = PrimitiveKind | `domain:${string}`;\n\n/** This function gives the kind of the values of a domain. */\nexport const kindOfDomain = (d: AnyDomain): Kind => d.primitive ?? `domain:${d.name}`;\n\n/** This function gives a kind if it is a primitive type, else `undefined`. */\nexport const primitiveOf = (k: Kind | undefined): PrimitiveKind | undefined => (k === \"number\" || k === \"string\" || k === \"boolean\" ? k : undefined);\n\n/**\n * The kinds that a host declares (docs/COMPILER.md §3.2): the kind of each field of the records, and of each variable of\n * the run. A read of a declared field or variable checks the kind. When the check fails, tier 1 evaluates the program.\n */\nexport interface Schema {\n readonly fields?: Readonly<Record<string, Kind>>;\n readonly vars?: Readonly<Record<string, Kind>>;\n}\n\n/** The options of a program: the domains, the free functions and the extension handlers, and the schema of the host. */\nexport interface Options {\n readonly domains?: readonly AnyDomain[];\n readonly fns?: Readonly<Record<string, FreeFn>>;\n readonly extensions?: Readonly<Record<string, ExtHandler>>;\n readonly schema?: Schema;\n}\n\n/**\n * The op of one name in one domain, as `resolveOp` of the core finds it. It is the function of the spec, or else a\n * method of the receiver.\n */\nexport interface Entry {\n readonly domain: AnyDomain;\n readonly spec: OpSpec<unknown>;\n readonly fn: Method | undefined;\n}\n\nconst NO_SPEC: OpSpec<unknown> = Object.freeze({});\n\n/** This function gives the op of a name in a domain, or `undefined` for a domain without the op. */\nexport function entryOf(domain: AnyDomain, name: string): Entry | undefined {\n if (!isOpName(name)) return undefined;\n const declared = Object.hasOwn(domain.ops, name) ? (domain.ops[name] as OpSpec<unknown>) : undefined;\n if (declared === undefined) return domain.methods === \"all\" ? { domain, spec: NO_SPEC, fn: undefined } : undefined;\n return { domain, spec: declared, fn: declared.fn as Method | undefined };\n}\n\n/**\n * The facts of an op site:\n * - `op`: the op of the domain `domain` comes first. It is a method of the receiver, or else the function of the spec.\n * `params` are the kinds of the parameters, and `lift` lifts numbers (`liftScalar`, if the domain has `fromScalar`).\n * - `free`: no domain has the op, and a free function has the name.\n *\n * Without facts, the site uses the dispatch of the runtime only.\n */\nexport type SiteFacts =\n | {\n readonly t: \"op\";\n readonly domain: number;\n readonly method: boolean;\n readonly params: readonly ParamKind[] | undefined;\n readonly lift: OpSpec<unknown>[\"liftScalar\"];\n }\n | { readonly t: \"free\" };\n\nconst FREE: SiteFacts = Object.freeze({ t: \"free\" });\n\n/**\n * The op of a site whose values have known kinds (KIND.STATIC):\n * - `fn`: the function of the op of the domain `domain`. `bad` is true when an argument has a kind that the op does\n * not accept, so the interpreter gives an error. `returns` is the kind of the result, if the op declares it.\n * - `free`: no domain that accepts the receiver has the op, and a free function has the name.\n */\nexport type StaticSite =\n | { readonly t: \"fn\"; readonly domain: number; readonly bad: boolean; readonly returns: Kind | undefined }\n | { readonly t: \"free\" };\n\nconst STATIC_FREE: StaticSite = Object.freeze({ t: \"free\" });\n\n/** This function gives the kind of the result of an op of a domain, if the op declares it. */\nfunction returnsOf(domain: AnyDomain, kind: ReturnKind | undefined): Kind | undefined {\n if (kind === \"domain\") return kindOfDomain(domain);\n return kind === \"any\" ? undefined : kind;\n}\n\n/** This function tells if an argument of a kind fits a parameter, or `undefined` if the kind of the argument is unknown. */\nfunction fits(domain: AnyDomain, param: ParamKind | undefined, arg: Kind | undefined): boolean | undefined {\n if (param === undefined || param === \"any\") return true;\n if (arg === undefined) return undefined;\n return arg === (param === \"domain\" ? kindOfDomain(domain) : param);\n}\n\n/**\n * This function tells if a domain accepts a value of a kind. A domain with a primitive type accepts its type, and a\n * domain without one accepts the values of its kind. For another value, it gives `undefined`: its `is` can accept it.\n */\nfunction accepts(d: AnyDomain, kind: Kind): boolean | undefined {\n if (d.primitive !== undefined) return d.primitive === kind;\n return kind === kindOfDomain(d) ? true : undefined;\n}\n\n/** The facts of the options. */\nexport interface Facts {\n /** This function gives the facts of the site of the op `name` with `arity` values, the receiver first, if it has facts. */\n site(name: string, arity: number): SiteFacts | undefined;\n /**\n * The checks of the result of an op, as `#checkResult` of the interpreter: for each domain, `true` if it has `valid`.\n * The list ends at the last domain with `valid`, because the domains after it check nothing.\n */\n readonly checks: readonly boolean[];\n /**\n * This function gives the op of a site with the kinds of its values, the receiver first. When the kinds do not decide\n * the op, it gives `undefined`. Each domain before the op must declare a primitive type. Then the interpreter takes\n * the same op at each run.\n */\n staticSite(name: string, kinds: readonly (Kind | undefined)[]): StaticSite | undefined;\n /**\n * This function gives the index of the domain that checks a result of a kind. When no domain accepts such a value,\n * it gives -1. When a domain without a primitive type comes first, it gives `undefined`.\n */\n checkOf(kind: Kind): number | undefined;\n}\n\n/** This function gives the facts of a set of options. */\nexport function factsOf(options: Options): Facts {\n const domains = options.domains ?? [];\n const fns = options.fns;\n const last = domains.findLastIndex((d) => d.valid !== undefined);\n return {\n checks: domains.slice(0, last + 1).map((d) => d.valid !== undefined),\n staticSite(name, kinds) {\n const [self, ...args] = kinds;\n // A primitive value is not a list, so a list op name is an op of a domain here, as in the interpreter.\n if (self === undefined) return undefined;\n for (const [i, d] of domains.entries()) {\n const takes = accepts(d, self);\n if (takes === undefined) return undefined;\n const e = takes ? entryOf(d, name) : undefined;\n // A primitive value has no methods, so only the function of a spec is an op for it. The domain of a value without\n // a primitive type can have methods, and a later domain can accept the value too.\n if (e?.fn === undefined) {\n if (takes && d.primitive === undefined) return undefined;\n continue;\n }\n // A lifted number goes through fromScalar: the site keeps the dispatch of the runtime.\n if (d.fromScalar !== undefined && args.some((a, j) => a !== \"string\" && a !== \"boolean\" && liftsAt(e.spec.liftScalar, j))) return undefined;\n const ok = args.map((a, j) => fits(d, e.spec.params?.[j], a));\n if (ok.includes(undefined)) return undefined;\n return { t: \"fn\", domain: i, bad: ok.includes(false), returns: returnsOf(d, e.spec.returns) };\n }\n return fns !== undefined && Object.hasOwn(fns, name) ? STATIC_FREE : undefined;\n },\n checkOf(kind) {\n for (const [i, d] of domains.entries()) {\n const takes = accepts(d, kind);\n if (takes === undefined) return undefined;\n if (takes) return i;\n }\n return -1;\n },\n site(name, arity) {\n // Without values, the interpreter takes no op of a domain. A list op can have a list as its receiver.\n if (arity === 0 || isListOp(name)) return undefined;\n const index = domains.findIndex((d) => entryOf(d, name) !== undefined);\n if (index < 0) return fns !== undefined && Object.hasOwn(fns, name) ? FREE : undefined;\n const e = entryOf(domains[index] as AnyDomain, name) as Entry;\n return { t: \"op\", domain: index, method: e.fn === undefined, params: e.spec.params, lift: e.domain.fromScalar === undefined ? undefined : e.spec.liftScalar };\n },\n };\n}\n","import type { PrimitiveKind } from \"@mark1russell7/vex\";\n\n/**\n * The loop IR (docs/COMPILER.md §3.3): a small language of statements between the Vex IR and the back ends. It has\n * locals, loops over arrays, checks and the functions of the runtime. A back end reads only this IR.\n *\n * A check that fails stops the program with the value `FALLBACK`. Then tier 1 does the evaluation again, so the result\n * is the result of the interpreter (§4.1).\n */\n\n/** The fixed locals of each program: the space, the origin, the variables and the tables of the run. */\nexport const SPACE = 0;\nexport const ORIGIN = 1;\nexport const VARS = 2;\nexport const TABLES = 3;\n/** The number of fixed locals. */\nexport const FIXED_LOCALS = 4;\n\n/** The functions of the runtime that generated code calls. Each one gives `FALLBACK` for a value it cannot give. */\nexport type RuntimeFn =\n | \"has\" // has(space, key): boolean\n | \"addr\" // addr(space, origin, focus, address, values?): the key of an address, with the values of its computed moves\n | \"table\" // table(tables, name): the space of a table\n | \"keys\" // keys(space): the keys of a space\n | \"step\" // step(name, acc, value): one step of reduce\n | \"result\" // result(value): the checks of the value of an op\n | \"opts\" // opts(value): the read of the option strict of a list op\n | \"rec\" // rec(names, values): a frozen record\n | \"list\" // list(keys, values): a list of an axis\n | \"frozen\" // frozen(array): a frozen copy\n | \"ext\" // ext(kind, data, space, origin, focus, path): an extension\n | \"var\"; // var(vars, name): a variable of the run\n\n/** The primitive operations of the loop IR. They copy no arithmetic of a domain (§4.2). */\nexport type PrimOp =\n | \"+\" // the sum of a reduction, in the order of the interpreter\n | \"/\" // the mean of a reduction\n | \"===\"\n | \"!==\"\n | \"!\"\n | \"||\"\n | \"&&\"\n | \"min\" // Math.min, the minimum of a reduction\n | \"max\" // Math.max, the maximum of a reduction\n | \"isNumber\"\n | \"isBoolean\"\n | \"isString\"\n | \"isValue\" // not undefined and not null\n | \"isObject\" // an object or a function\n | \"get\" // get(space, key): the record of a key\n | \"member\" // member(object, name): the property of an object\n | \"records\" // records(space): the records of the space by index, or undefined (SPACE.RECORDS)\n | \"recordAt\" // recordAt(records, index, space, key): the record at an index, or else the record of the key\n | \"keysOf\" // keysOf(targets): the keys of the targets of an axis\n | \"idxOf\" // idxOf(targets): the index of each target in the keys of the space\n | \"memoGet\" // memoGet(memo, space, keys): the entry of a space and the values of its keys, or undefined\n | \"memoPut\" // memoPut(memo, space, keys, value, ok): the new entry of a space and the values of its keys\n | \"entryValue\" // entryValue(entry): the value of an entry of a memo\n | \"entryOk\"; // entryOk(entry): true if the entry has a value\n\n/** A value of the loop IR. */\nexport type LExpr =\n | { readonly t: \"const\"; readonly i: number }\n | { readonly t: \"local\"; readonly n: number }\n | { readonly t: \"num\"; readonly v: number }\n | { readonly t: \"bool\"; readonly v: boolean }\n | { readonly t: \"fallback\" }\n | { readonly t: \"array\"; readonly items: readonly LExpr[] }\n | { readonly t: \"prim\"; readonly op: PrimOp; readonly args: readonly LExpr[] }\n | { readonly t: \"call\"; readonly fn: RuntimeFn; readonly args: readonly LExpr[] }\n /**\n * The dispatch of the op whose name is the constant `name`, with the values of its arguments, the receiver first.\n * `kinds` are the kinds of the values that the lowering knows (KIND.STATIC).\n */\n | { readonly t: \"op\"; readonly name: number; readonly args: readonly LExpr[]; readonly kinds: readonly (PrimitiveKind | undefined)[] }\n /** The memo `id` of the program: the value of one node for each space (§7.2). */\n | { readonly t: \"memo\"; readonly id: number }\n /** The targets of the base axis that is the constant `axis`, at the space, the origin and the focus of `args`. */\n | { readonly t: \"targets\"; readonly axis: number; readonly args: readonly [LExpr, LExpr, LExpr] };\n\n/**\n * What a failed check does. The interpreter gives an error value at the node of the check, and the context of the node\n * decides what happens to that error:\n *\n * - `return`: the program stops with `FALLBACK`, and tier 1 evaluates it again.\n * - `continue`: the item of a list op is an error item. The list op skips it, as the interpreter does. With the option\n * `strict`, the list op fails instead, and `strict.else` tells what that failure does.\n * - `break`: the first argument of `ifError` failed, so the block ends, and the second argument gives the value.\n */\nexport type Fail =\n | { readonly t: \"return\" }\n | { readonly t: \"continue\"; readonly label: number; readonly strict?: { readonly cond: LExpr; readonly else: Fail } }\n | { readonly t: \"break\"; readonly label: number };\n\n/** A statement of the loop IR. */\nexport type LStmt =\n /** A new local with a value. */\n | { readonly t: \"let\"; readonly n: number; readonly value: LExpr }\n /** A new value of a local. */\n | { readonly t: \"set\"; readonly n: number; readonly value: LExpr }\n /** When `ok` is false, the statement does `fail`. The reason names the check. */\n | { readonly t: \"check\"; readonly ok: LExpr; readonly reason: string; readonly fail: Fail }\n /** A check that fails always: the interpreter always gives an error here. */\n | { readonly t: \"fail\"; readonly fail: Fail }\n | { readonly t: \"if\"; readonly cond: LExpr; readonly yes: readonly LStmt[]; readonly no: readonly LStmt[] }\n /**\n * A loop over the items of an array, in order. The local `array` holds the array, `index` the index, and `item` each\n * item. A `continue` with the label goes to the next item.\n */\n | { readonly t: \"loop\"; readonly label: number; readonly item: number; readonly index: number; readonly array: number; readonly over: LExpr; readonly body: readonly LStmt[] }\n /** A block with a label. A `break` with the label ends it. */\n | { readonly t: \"block\"; readonly label: number; readonly body: readonly LStmt[] }\n /** A loop with a label that repeats its body until a `break` with the label ends it. */\n | { readonly t: \"repeat\"; readonly label: number; readonly body: readonly LStmt[] }\n /** The next item of the innermost loop. */\n | { readonly t: \"next\" }\n /** A value at the end of an array. */\n | { readonly t: \"push\"; readonly n: number; readonly value: LExpr }\n | { readonly t: \"return\"; readonly value: LExpr };\n\n/** A program of the loop IR: its statements, the number of its locals and its constants. Each local is a name in the function. */\nexport interface LoopProgram {\n readonly body: readonly LStmt[];\n readonly locals: number;\n /** The constants, by index: literals, paths, addresses, axes and names. Generated code reads them by index (§5). */\n readonly constants: readonly unknown[];\n}\n\n// The constructors of the values of the loop IR.\nexport const local = (n: number): LExpr => ({ t: \"local\", n });\nexport const constant = (i: number): LExpr => ({ t: \"const\", i });\nexport const num = (v: number): LExpr => ({ t: \"num\", v });\nexport const bool = (v: boolean): LExpr => ({ t: \"bool\", v });\nexport const FALLBACK_EXPR: LExpr = { t: \"fallback\" };\nexport const RETURN: Fail = Object.freeze({ t: \"return\" });\nexport const array = (...items: LExpr[]): LExpr => ({ t: \"array\", items });\nexport const prim = (op: PrimOp, ...args: LExpr[]): LExpr => ({ t: \"prim\", op, args });\nexport const call = (fn: RuntimeFn, ...args: LExpr[]): LExpr => ({ t: \"call\", fn, args });\n","/**\n * The back end of JavaScript source (docs/COMPILER.md §3.4). It prints a program of the loop IR as the body of a\n * function with the parameters `K` (the constants) and `R` (the runtime).\n *\n * The source has no name and no literal of the program as text: it reads each one from `K`, by its index (§5). The\n * same program and the same facts always give the same source.\n *\n * With the facts of the options, each op site gets its fast path in the source (§13.2). Each site then has its own\n * inline caches in the engine, and a guard sends each other case to the dispatch of the runtime.\n */\nimport { liftsAt, type ParamKind } from \"@mark1russell7/vex\";\nimport { primitiveOf, type Facts, type SiteFacts, type StaticSite } from \"./facts.ts\";\nimport { constant, FIXED_LOCALS, type Fail, type LExpr, type LoopProgram, type LStmt, type RuntimeFn } from \"./loop.ts\";\n\ntype OpExpr = Extract<LExpr, { readonly t: \"op\" }>;\n\n/** This function gives the call of the dispatch of a site. With more than 3 values, the dispatch takes an array. */\nfunction generic(x: OpExpr, site: string, values: readonly string[]): string {\n return x.args.length <= 3 ? `${site}(${values.join(\", \")})` : `${site}([${values.join(\", \")}])`;\n}\n\n/** This function gives the check of an argument of the kind `kind`, for an op of the domain `d`. */\nfunction kindCheck(kind: ParamKind | undefined, a: string, d: string): readonly string[] {\n if (kind === \"domain\") return [`${d}.is(${a})`];\n if (kind === \"number\" || kind === \"boolean\" || kind === \"string\") return [`typeof ${a} === \"${kind}\"`];\n return [];\n}\n\nconst name = (n: number): string => `l${n}`;\n\n/** This function prints the source of a program. The body gives the function of the program. */\nexport function printJs(p: LoopProgram, facts: Facts): string {\n const used = new Set<RuntimeFn>();\n const constants = new Set<number>();\n const sites = new Map<string, string>();\n const domains = new Set<number>();\n // The functions of the ops of the static sites. They read the domains, so they come after them.\n const fns = new Map<string, string>();\n let threw = false;\n let siteLabels = 0;\n const expr = (x: LExpr): string => {\n switch (x.t) {\n case \"const\":\n constants.add(x.i);\n return `k${x.i}`;\n case \"local\":\n return name(x.n);\n case \"num\":\n case \"bool\":\n return String(x.v);\n case \"fallback\":\n return \"F\";\n case \"array\":\n return `[${x.items.map(expr).join(\", \")}]`;\n case \"call\":\n used.add(x.fn);\n return `${x.fn}_(${x.args.map(expr).join(\", \")})`;\n case \"op\":\n return generic(x, siteOf(x), x.args.map(expr));\n case \"memo\":\n sites.set(`mo${x.id}`, \"R.memo()\");\n return `mo${x.id}`;\n case \"targets\": {\n // An axis has one function of targets for each site, with its cache.\n const site = `a${x.axis}`;\n sites.set(site, `R.axis(${expr(constant(x.axis))})`);\n return `${site}(${x.args.map(expr).join(\", \")})`;\n }\n case \"prim\": {\n const [a, b, c, d, e] = x.args.map(expr);\n switch (x.op) {\n case \"!\":\n return `(!${a})`;\n case \"min\":\n case \"max\":\n return `Math.${x.op}(${a}, ${b})`;\n case \"isNumber\":\n return `(typeof ${a} === \"number\")`;\n case \"isBoolean\":\n return `(typeof ${a} === \"boolean\")`;\n case \"isString\":\n return `(typeof ${a} === \"string\")`;\n case \"isValue\":\n return `(${a} !== undefined && ${a} !== null)`;\n case \"isObject\":\n return `(typeof ${a} === \"object\" || typeof ${a} === \"function\")`;\n case \"get\":\n return `${a}.get(${b})`;\n case \"member\":\n return `${a}[${b}]`;\n case \"records\":\n return `${a}.records`;\n case \"recordAt\":\n return `(${a} !== undefined ? ${a}[${b}] : ${c}.get(${d}))`;\n case \"keysOf\":\n return `${a}.keys`;\n case \"idxOf\":\n return `${a}.idx`;\n case \"memoGet\":\n return `${a}.get(${b}, ${c})`;\n case \"memoPut\":\n return `${a}.put(${b}, ${c}, ${d}, ${e})`;\n case \"entryValue\":\n return `${a}.v`;\n case \"entryOk\":\n return `${a}.ok`;\n case \"+\":\n case \"/\":\n case \"===\":\n case \"!==\":\n case \"||\":\n case \"&&\":\n return `(${a} ${x.op} ${b})`;\n }\n }\n }\n };\n // An op has one dispatch for each name and number of arguments, and the function gets it when it loads.\n function siteOf(x: OpExpr): string {\n const site = `s${x.name}_${x.args.length}`;\n sites.set(site, `R.site(${expr(constant(x.name))}, ${x.args.length})`);\n return site;\n }\n const domain = (i: number): string => {\n domains.add(i);\n return `d${i}`;\n };\n // The checks of the result of an op, as `#checkResult` of the interpreter. A domain without `valid` stops the search.\n const resultChecks = (out: string, checks: readonly boolean[], indent: string): void => {\n lines.push(`${indent}if (${out} !== F) {`);\n lines.push(`${indent} if (${out} === undefined || ${out} === null || (typeof ${out} === \"number\" && !Number.isFinite(${out}))) ${out} = F;`);\n checks.forEach((valid, i) => {\n const d = domain(i);\n lines.push(valid ? `${indent} else if (${d}.is(${out})) { try { if (!${d}.valid(${out})) ${out} = F; } catch (e) { ${out} = threw_(e); } }` : `${indent} else if (${d}.is(${out})) {}`);\n });\n lines.push(`${indent}}`);\n };\n /**\n * The fast path of an op site that assigns the local `n`. A method site guards the method of the last receiver and\n * the domain of the receiver, and a site of a function guards the domain. Then the site checks the arguments, calls\n * the op in a `try`, and checks the result. A number that the op lifts, and each failed guard, go to the dispatch.\n */\n const siteBlock = (n: number, x: OpExpr, indent: string): boolean => {\n const attempt = (call: string, ind: string): void => {\n threw = true;\n lines.push(`${ind}try { ${name(n)} = ${call}; } catch (e) { ${name(n)} = threw_(e); }`);\n };\n const st = facts.staticSite(p.constants[x.name] as string, x.kinds);\n if (st !== undefined) {\n staticBlock(n, x, st, indent, attempt);\n return true;\n }\n const f = facts.site(p.constants[x.name] as string, x.args.length);\n switch (f?.t) {\n case undefined:\n return false;\n case \"free\": {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${x.args.map(expr).join(\", \")})`, indent);\n resultChecks(name(n), facts.checks, indent);\n return true;\n }\n case \"op\":\n opBlock(n, x, f, indent, attempt);\n return true;\n }\n };\n /**\n * The block of a static site (KIND.STATIC). The kinds of its values decide its op, so the site uses the function of the\n * op with no guard. A result of another kind breaks the declaration of the op. Then the program stops, and tier 1\n * evaluates it.\n */\n const staticBlock = (n: number, x: OpExpr, st: StaticSite, indent: string, attempt: (call: string, ind: string) => void): void => {\n const out = name(n);\n const values = x.args.map(expr);\n if (st.t === \"free\") {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${values.join(\", \")})`, indent);\n resultChecks(out, facts.checks, indent);\n return;\n }\n // An argument of a kind that the op does not accept: the interpreter gives an error.\n if (st.bad) {\n lines.push(`${indent}${out} = F;`);\n return;\n }\n const f = `f${x.name}_${st.domain}`;\n fns.set(f, `${domain(st.domain)}.ops[${expr(constant(x.name))}].fn`);\n attempt(`${f}(${values.join(\", \")})`, indent);\n // A local of tier 2 has a primitive kind or no kind (lower.ts). Thus a result of the kind of a domain gets the checks\n // of the interpreter, as a result of the kind any (V-059).\n const kind = primitiveOf(st.returns);\n if (kind === undefined) {\n resultChecks(out, facts.checks, indent);\n return;\n }\n lines.push(`${indent}if (${out} !== F && typeof ${out} !== \"${kind}\") return F; // the kind of the result`);\n if (kind === \"number\") lines.push(`${indent}if (${out} !== F && !Number.isFinite(${out})) ${out} = F;`);\n const check = facts.checkOf(kind);\n if (check === undefined) resultChecks(out, facts.checks, indent);\n else if (facts.checks[check] === true) {\n const d = domain(check);\n lines.push(`${indent}if (${out} !== F) { try { if (!${d}.valid(${out})) ${out} = F; } catch (e) { ${out} = threw_(e); } }`);\n }\n };\n const opBlock = (n: number, x: OpExpr, f: Extract<SiteFacts, { readonly t: \"op\" }>, indent: string, attempt: (call: string, ind: string) => void): void => {\n const site = siteOf(x);\n const values = x.args.map(expr);\n const out = name(n);\n const label = `S${siteLabels++}`;\n const [self, ...args] = values as [string, ...string[]];\n const d = domain(f.domain);\n lines.push(`${indent}${label}: {`);\n let inner: string;\n let call: string;\n if (f.method) {\n const m = `m${label}`;\n lines.push(`${indent} if (typeof ${self} === \"object\" && ${self} !== null) {`, `${indent} const ${m} = ${site}.m;`);\n lines.push(`${indent} if (${m} !== undefined && ${self}[${expr(constant(x.name))}] === ${m} && ${d}.is(${self})) {`);\n inner = `${indent} `;\n call = `${self}[${expr(constant(x.name))}](${args.join(\", \")})`;\n } else {\n sites.set(`${site}_f`, `${site}.fn`);\n lines.push(`${indent} if (${d}.is(${self})) {`);\n inner = `${indent} `;\n call = `${site}_f(${values.join(\", \")})`;\n }\n const lifted = args.filter((_a, i) => liftsAt(f.lift, i)).map((a) => `typeof ${a} === \"number\"`);\n if (lifted.length > 0) lines.push(`${inner}if (${lifted.join(\" || \")}) { ${out} = ${generic(x, site, values)}; break ${label}; }`);\n const kinds = args.flatMap((a, i) => kindCheck(f.params?.[i], a, d));\n if (kinds.length > 0) lines.push(`${inner}if (!(${kinds.join(\" && \")})) { ${out} = F; break ${label}; }`);\n attempt(call, inner);\n resultChecks(out, facts.checks, inner);\n lines.push(`${inner}break ${label};`);\n if (f.method) lines.push(`${indent} }`);\n lines.push(`${indent} }`, `${indent} ${out} = ${generic(x, site, values)};`, `${indent}}`);\n };\n // The statement of a failure (docs/COMPILER.md §4.1).\n const action = (f: Fail): string => {\n switch (f.t) {\n case \"return\":\n return \"return F;\";\n case \"break\":\n return `break L${f.label};`;\n case \"continue\":\n return f.strict === undefined ? `continue L${f.label};` : `{ if (${expr(f.strict.cond)}) ${action(f.strict.else)} continue L${f.label}; }`;\n }\n };\n const lines: string[] = [];\n const stmts = (ss: readonly LStmt[], indent: string): void => {\n for (const s of ss) stmt(s, indent);\n };\n const stmt = (s: LStmt, indent: string): void => {\n switch (s.t) {\n case \"let\":\n case \"set\":\n if (s.value.t === \"op\" && siteBlock(s.n, s.value, indent)) return;\n lines.push(`${indent}${name(s.n)} = ${expr(s.value)};`);\n return;\n case \"check\":\n lines.push(`${indent}if (!(${expr(s.ok)})) ${action(s.fail)} // ${s.reason}`);\n return;\n case \"fail\":\n lines.push(`${indent}${action(s.fail)}`);\n return;\n case \"if\":\n lines.push(`${indent}if (${expr(s.cond)}) {`);\n stmts(s.yes, `${indent} `);\n if (s.no.length > 0) {\n lines.push(`${indent}} else {`);\n stmts(s.no, `${indent} `);\n }\n lines.push(`${indent}}`);\n return;\n case \"loop\": {\n const [a, i] = [name(s.array), name(s.index)];\n lines.push(`${indent}${a} = ${expr(s.over)};`);\n lines.push(`${indent}L${s.label}: for (${i} = 0; ${i} < ${a}.length; ${i}++) {`);\n lines.push(`${indent} ${name(s.item)} = ${a}[${i}];`);\n stmts(s.body, `${indent} `);\n lines.push(`${indent}}`);\n return;\n }\n case \"block\":\n lines.push(`${indent}L${s.label}: {`);\n stmts(s.body, `${indent} `);\n lines.push(`${indent}}`);\n return;\n case \"repeat\":\n lines.push(`${indent}L${s.label}: for (;;) {`);\n stmts(s.body, `${indent} `);\n lines.push(`${indent}}`);\n return;\n case \"next\":\n lines.push(`${indent}continue;`);\n return;\n case \"push\":\n lines.push(`${indent}${name(s.n)}.push(${expr(s.value)});`);\n return;\n case \"return\":\n lines.push(`${indent}return ${expr(s.value)};`);\n return;\n }\n };\n stmts(p.body, \" \");\n const params = Array.from({ length: FIXED_LOCALS }, (_, n) => name(n));\n const locals = Array.from({ length: p.locals - FIXED_LOCALS }, (_, n) => name(n + FIXED_LOCALS));\n const head = [\n `\"use strict\";`,\n `const F = R.F;`,\n // The order is the order of the first use, so the same program gives the same source.\n ...[...used].map((fn) => `const ${fn}_ = R.${fn};`),\n ...[...constants].map((i) => `const k${i} = K[${i}];`),\n ...[...sites].map(([site, init]) => `const ${site} = ${init};`),\n ...[...domains].map((i) => `const d${i} = R.domain(${i});`),\n ...[...fns].map(([f, init]) => `const ${f} = ${init};`),\n ...(threw ? [`const threw_ = R.threw;`] : []),\n `return function vex(${params.join(\", \")}) {`,\n ...(locals.length > 0 ? [` let ${locals.join(\", \")};`] : []),\n ` try {`,\n ];\n const tail = [` } catch {`, ` return F;`, ` }`, `};`, ``];\n return [...head, ...lines, ...tail].join(\"\\n\");\n}\n","/**\n * The memo of a program (docs/COMPILER.md §7.2 and §7.3). The value of some nodes depends only on the space and on a\n * few values that the node reads from outside: its keys. A program keeps the value of such a node for each space and\n * each value of its keys. Thus a run at each key of a space evaluates the node once for each value of its keys.\n *\n * - `AVERAGE(all.Score)` has no keys, so it evaluates once for each space.\n * - \"The largest width in the column of the origin\" has one key, the column of the origin. It evaluates once for each\n * column, not once for each origin.\n *\n * A key reads the origin or a name from outside the node, and nothing that the node changes. Inside the node, the\n * value of the key replaces the key. Thus the value of the node depends only on the space and the values of the keys.\n */\nimport { addrExprs, isListOp, listOf, type Addr, type Axis, type Expr } from \"@mark1russell7/vex\";\n\n/** A read of the focus of the expression, outside its own loops. */\nconst FOCUS = 1;\n/** A move to the origin. */\nconst ORIGIN = 2;\n/** A name that the node does not bind: a variable of the run, or a binding outside the node. */\nconst FREE = 4;\n/** A name that the node binds, outside the expression. */\nconst INTERNAL = 8;\n/** An extension or an axis table. An extension can read each part of the evaluation, and a table is another space. */\nconst OPAQUE = 16;\n/** A move to the origin or a free name inside a loop of the expression. Such a loop is a part of a node, not a key. */\nconst DEEP = 32;\n\n/** This function gives the axis inside the `where` axes of an axis, and the tests of the `where` axes. */\nfunction parts(a: Axis): { readonly base: Exclude<Axis, { readonly t: \"where\" }>; readonly tests: readonly Expr[] } {\n // Stryker disable next-line ArrayDeclaration: a test that is not an expression reads nothing, and it has no keys\n const tests: Expr[] = [];\n let x: Axis = a;\n while (x.t === \"where\") {\n tests.push(x.test);\n x = x.axis;\n }\n return { base: x, tests };\n}\n\n/** This function adds `DEEP` to a read of the origin or of a free name inside a loop. */\nconst inLoop = (r: number, top: boolean): number => (top || (r & (ORIGIN | FREE)) === 0 ? r : r | DEEP);\n\n/**\n * This function gives the reads of an address: the focus at the top of the expression, or the origin, or nothing. A\n * move from the focus or the origin can fail, so the address reads its start also before a fixed key (V-052).\n */\nfunction addressReads(at: Addr | undefined, top: boolean): number {\n let start = top ? FOCUS : 0;\n let found = 0;\n at?.forEach((m) => {\n if (m.t === \"key\" || m.t === \"index\") start = 0;\n else if (m.t === \"origin\") start = ORIGIN;\n else found |= start;\n });\n return inLoop(found | start, top);\n}\n\n/**\n * This function gives the reads of `e`. `outer` has the names that the node binds outside `e`, and `inner` has the\n * names that `e` binds above this part. `top` is true outside the loops of `e`.\n */\nfunction reads(e: Expr, outer: ReadonlySet<string>, inner: ReadonlySet<string>, top: boolean): number {\n switch (e.tag) {\n // A missing case gives undefined, and a bitwise operation counts it as 0.\n // Stryker disable next-line StringLiteral: see the comment above\n case \"lit\":\n return 0;\n case \"var\":\n return inner.has(e.name) ? 0 : outer.has(e.name) ? INTERNAL : inLoop(FREE, top);\n case \"ext\":\n // A loop of names is not in the memo yet, so a node with one is not either. A call reads what its body reads, and a\n // function reads nothing where it is bound, but the memo does not follow them yet (FN.CALL).\n case \"fold\":\n case \"iterate\":\n // A let with a function and no call has the value of its body, and a call is opaque, so this case only keeps the\n // memo simple.\n // Stryker disable next-line StringLiteral: see the comment above\n case \"fn\":\n case \"call\":\n return OPAQUE;\n case \"ref\":\n // The expressions of computed moves evaluate at the position of the node (NAV.COMPUTED).\n return addrExprs(e.at).reduce((r, x) => r | reads(x, outer, inner, top), addressReads(e.at, top));\n case \"app\":\n return e.args.reduce((r, x) => r | reads(x, outer, inner, top), 0);\n case \"rec\":\n return Object.values(e.fields).reduce((r, x) => r | reads(x, outer, inner, top), 0);\n case \"let\": {\n const binds = Object.values(e.bind).reduce((r, x) => r | reads(x, outer, inner, top), 0);\n return binds | reads(e.body, outer, new Set([...inner, ...Object.keys(e.bind)]), top);\n }\n case \"each\": {\n const { base, tests } = parts(e.axis);\n // The targets of `all` do not depend on the focus, but its address can fail (V-051). Each other axis starts at its\n // address. The targets of the axis list are the items of a value, and the memo does not follow them yet (AXIS.LIST).\n const targets = base.t === \"table\" || listOf(e.axis) !== undefined ? OPAQUE : base.t === \"all\" && (e.at ?? []).length === 0 ? 0 : addressReads(e.at, top);\n const at = addrExprs(e.at).reduce((r, x) => r | reads(x, outer, inner, top), targets);\n return [e.body, ...tests].reduce((r, x) => r | reads(x, outer, inner, false), at);\n }\n }\n}\n\n/** This function joins the keys of the parts of an expression. A part that cannot be in the memo makes the expression the same. */\nfunction all(xs: readonly (readonly Expr[] | undefined)[]): readonly Expr[] | undefined {\n // Stryker disable next-line ArrayDeclaration: after the check, each part has its keys, so no one reads the default list\n return xs.every((x) => x !== undefined) ? xs.flatMap((x) => x ?? []) : undefined;\n}\n\n/**\n * This function gives the keys of the part `e` of a node, or `undefined` if the part cannot be in the memo. `top` is\n * true outside the loops of the node, and `outer` has the names that the node binds above `e`. The node itself (`root`)\n * is not a key of itself.\n */\nfunction keysOf(e: Expr, top: boolean, outer: ReadonlySet<string>, pure: Set<Expr>, root = false): readonly Expr[] | undefined {\n const r = reads(e, outer, new Set(), true);\n // In a loop of the node, the focus is a target of the node, and the node can read it. A part that depends only on\n // the space has a memo of its own, if it has a loop.\n if ((r & (ORIGIN | FREE | OPAQUE | (top ? FOCUS : 0))) === 0) {\n if (!root) pure.add(e);\n return [];\n }\n // A key evaluates once, outside the loops of the node. A loop that reads the origin is a part of the node, not a key.\n if (!root && (r & (FOCUS | INTERNAL | OPAQUE | DEEP)) === 0) return [e];\n switch (e.tag) {\n case \"app\":\n return all(e.args.map((x) => keysOf(x, top, outer, pure)));\n case \"rec\":\n return all(Object.values(e.fields).map((x) => keysOf(x, top, outer, pure)));\n case \"let\": {\n const inner = new Set([...outer, ...Object.keys(e.bind)]);\n return all([...Object.values(e.bind).map((x) => keysOf(x, top, outer, pure)), keysOf(e.body, top, inner, pure)]);\n }\n case \"each\": {\n const { base, tests } = parts(e.axis);\n // The targets of a loop must not depend on the origin: a set of targets is not a value of a key. The address of\n // `all` can fail, so it must not depend on the origin either. The targets of the axis list are the items of a\n // value, and the memo does not follow them yet (AXIS.LIST).\n if (base.t === \"table\" || listOf(e.axis) !== undefined || ((base.t !== \"all\" || (e.at ?? []).length > 0) && addressReads(e.at, top) !== 0)) return undefined;\n // The expressions of computed moves give the targets too, so they must read nothing.\n if (addrExprs(e.at).some((x) => reads(x, outer, new Set(), top) !== 0)) return undefined;\n return all([e.body, ...tests].map((x) => keysOf(x, false, outer, pure)));\n }\n // A leaf here reads the focus or a name of the node, so it is not a key, and the part cannot be in the memo. A\n // missing case gives undefined too.\n // Stryker disable StringLiteral,ConditionalExpression: see the comment above\n case \"lit\":\n case \"ref\":\n case \"var\":\n case \"ext\":\n case \"fold\":\n case \"iterate\":\n case \"fn\":\n case \"call\":\n return undefined;\n // Stryker restore StringLiteral,ConditionalExpression\n }\n}\n\n/** This function tells if an expression has a loop outside its keys and outside the parts that have a memo of their own. */\nfunction loopOutside(e: Expr, keys: ReadonlySet<Expr>): boolean {\n if (keys.has(e)) return false;\n switch (e.tag) {\n case \"each\":\n case \"fold\":\n case \"iterate\":\n return true;\n case \"app\":\n return e.args.some((x) => loopOutside(x, keys));\n case \"rec\":\n return Object.values(e.fields).some((x) => loopOutside(x, keys));\n case \"let\":\n return [...Object.values(e.bind), e.body].some((x) => loopOutside(x, keys));\n case \"ref\":\n return addrExprs(e.at).some((x) => loopOutside(x, keys));\n // A missing case gives undefined, which is false too.\n // Stryker disable StringLiteral,ConditionalExpression: see the comment above\n case \"lit\":\n case \"var\":\n case \"ext\":\n // A node with a function or a call is opaque (reads), so it is not a node of the memo.\n case \"fn\":\n case \"call\":\n return false;\n // Stryker restore StringLiteral,ConditionalExpression\n }\n}\n\n/** This function gives the `let` expressions above an `each`, and the `each`, or `undefined` for another expression. */\nfunction eachUnderLets(e: Expr | undefined): { readonly lets: readonly Extract<Expr, { readonly tag: \"let\" }>[]; readonly each: Extract<Expr, { readonly tag: \"each\" }> } | undefined {\n const lets: Extract<Expr, { readonly tag: \"let\" }>[] = [];\n let x = e;\n while (x?.tag === \"let\") {\n lets.push(x);\n x = x.body;\n }\n return x?.tag === \"each\" ? { lets, each: x } : undefined;\n}\n\n/**\n * This function gives the nodes of `expr` that a program keeps in its memo, each with its keys. Each such node has a\n * loop outside its keys. A node inside such a node can be in the memo too. Thus the first evaluation of the outer\n * node evaluates the inner node once.\n */\nexport function memoNodes(expr: Expr): ReadonlyMap<Expr, readonly Expr[]> {\n const out = new Map<Expr, readonly Expr[]>();\n const visit = (e: Expr): void => {\n const pure = new Set<Expr>();\n const keys = keysOf(e, true, new Set(), pure, true);\n if (keys !== undefined && loopOutside(e, new Set([...keys, ...pure]))) out.set(e, keys);\n if (e.tag === \"app\") {\n // A list op over an `each` under `let` expressions is one loop, so that `each` and those `let` expressions have\n // no value of their own. Their parts can be in the memo.\n const [first, ...rest] = e.args;\n const fused = isListOp(e.op) ? eachUnderLets(first) : undefined;\n if (fused === undefined) {\n if (first !== undefined) visit(first);\n } else {\n for (const l of fused.lets) Object.values(l.bind).forEach(visit);\n [fused.each.body, ...parts(fused.each.axis).tests, ...addrExprs(fused.each.at)].forEach(visit);\n }\n rest.forEach(visit);\n } else if (e.tag === \"rec\") {\n Object.values(e.fields).forEach(visit);\n } else if (e.tag === \"let\") {\n Object.values(e.bind).forEach(visit);\n visit(e.body);\n } else if (e.tag === \"each\") {\n [e.body, ...parts(e.axis).tests, ...addrExprs(e.at)].forEach(visit);\n } else if (e.tag === \"ref\") {\n addrExprs(e.at).forEach(visit);\n }\n };\n visit(expr);\n return out;\n}\n","/**\n * The lowering: a Vex expression becomes a program of the loop IR (docs/COMPILER.md §3.3). A list op over a direct\n * `each` becomes one loop with a running value, so it makes no list.\n *\n * Each value that the interpreter can give as an error has a check. The block of the check tells what a failure does\n * (`Fail`). A list op skips an error item, and an error in the first argument of `ifError` gives the second argument.\n * Each other error stops the program with `FALLBACK`.\n */\nimport { addrExprs, isFieldName, isListOp, MAX_NESTING, nestingOf, shapeError, type Addr, type Axis, type Expr, type ExprOf, type ListOp, type Names, type PrimitiveKind } from \"@mark1russell7/vex\";\nimport { factsOf, listReason, MAX_CALLS, primitiveOf, type Facts, type Schema } from \"./facts.ts\";\nimport { memoNodes } from \"./memo.ts\";\nimport {\n array,\n bool,\n call,\n constant,\n FALLBACK_EXPR,\n FIXED_LOCALS,\n local,\n num,\n ORIGIN,\n prim,\n RETURN,\n SPACE,\n TABLES,\n VARS,\n type Fail,\n type LExpr,\n type LoopProgram,\n type LStmt,\n} from \"./loop.ts\";\n\n/** The error of an expression that the compiler cannot lower. Then the program operates in tier 1. */\nexport class Unsupported extends Error {}\n\n/** A bound name: its value, and the flag that tells if its binding gave a value. Without a flag, it always does. */\ninterface Bound {\n readonly value: LExpr;\n readonly ok?: LExpr;\n}\n\n/** A bound function: its node, the path of its node, and the scope of its binding. */\ninterface BoundFn {\n readonly fn: ExprOf<\"fn\">;\n readonly path: readonly number[];\n readonly scope: Scope;\n}\n\n/** The facts of the lexical position of a node: its space, its origin, its focus and its bound names. */\ninterface Scope {\n readonly space: LExpr;\n readonly origin: LExpr;\n readonly focus: LExpr;\n readonly env: ReadonlyMap<string, Bound>;\n /** The bound functions (FN.BIND): a call puts the body of its function at the place of the call. */\n readonly fns: ReadonlyMap<string, BoundFn>;\n /** The record at the focus. In a loop, it reads the record by its index (SPACE.RECORDS). */\n readonly rec: LExpr;\n}\n\n/** A list of statements, and what a failed check in it does. */\ninterface Block {\n readonly stmts: LStmt[];\n readonly fail: Fail;\n}\n\nconst block = (fail: Fail): Block => ({ stmts: [], fail });\n\n/** This function gives the axis inside the `where` axes of an axis. */\nconst baseAxis = (a: Axis): Exclude<Axis, { readonly t: \"where\" }> => (a.t === \"where\" ? baseAxis(a.axis) : a);\n\n/** This function gives the tests of the `where` axes of an axis, from the inside out, as the interpreter applies them. */\nfunction whereTests(a: Axis): readonly Expr[] {\n const out: Expr[] = [];\n for (let x: Axis = a; x.t === \"where\"; x = x.axis) out.unshift(x.test);\n return out;\n}\n\n/** This function gives the `each` under the `let` expressions of a list argument, or `undefined`. */\nfunction eachUnderLets(e: Expr | undefined): ExprOf<\"each\"> | undefined {\n let x = e;\n while (x?.tag === \"let\") x = x.body;\n return x?.tag === \"each\" ? x : undefined;\n}\n\n/** The kinds of the values of the primitive operations that always give a boolean. */\nconst BOOLEAN_PRIMS: ReadonlySet<string> = new Set([\"!\", \"===\", \"!==\", \"isNumber\", \"isBoolean\", \"isString\", \"isValue\", \"isObject\"]);\n\n/** The checks of the kinds of a schema. */\nconst KIND_CHECKS = { number: \"isNumber\", string: \"isString\", boolean: \"isBoolean\" } as const;\n\n/** This function gives the kind of two values in the branches of a form, if they have the same kind. */\nconst join = (a: PrimitiveKind | undefined, b: PrimitiveKind | undefined): PrimitiveKind | undefined => (a === b ? a : undefined);\n\n/**\n * This function lowers an expression into a program of the loop IR. It throws `Unsupported` for an expression it cannot\n * lower. The facts of the options decide the op of a site whose values have known kinds (KIND.STATIC).\n */\nexport function lower(expr: Expr, facts: Facts = factsOf({}), schema: Schema = {}): LoopProgram {\n // EVAL.SHAPE and EVAL.NESTING: tier 1 gives the error of a program that is not valid or that is nested too deep.\n const shape = shapeError(expr);\n if (shape !== undefined) throw new Unsupported(shape);\n if (nestingOf(expr) > MAX_NESTING) throw new Unsupported(`the expression is nested deeper than ${MAX_NESTING} levels`);\n const lists = listReason(expr);\n if (lists !== undefined) throw new Unsupported(lists);\n const l = new Lowerer(memoNodes(expr), facts, schema);\n const b = block(RETURN);\n l.check(b, call(\"has\", local(SPACE), local(ORIGIN)), \"the origin is a key of the space\");\n const top: Scope = { space: local(SPACE), origin: local(ORIGIN), focus: local(ORIGIN), env: new Map(), fns: new Map(), rec: prim(\"get\", local(SPACE), local(ORIGIN)) };\n const value = l.expr(expr, top, [], b);\n b.stmts.push({ t: \"return\", value });\n return { body: b.stmts, locals: l.locals, constants: l.constants };\n}\n\nclass Lowerer {\n locals = FIXED_LOCALS;\n labels = 0;\n memos = 0;\n /** The number of bodies of functions that the lowering put at calls (MAX_CALLS). */\n #calls = 0;\n readonly #memo: ReadonlyMap<Expr, readonly Expr[]>;\n /** The keys of the nodes of the memo whose code the lowering makes, with their values. */\n #keys: ReadonlyMap<Expr, Bound> = new Map();\n readonly #facts: Facts;\n readonly #schema: Schema;\n /** The kind of each local whose kind the lowering knows. A local gets its kind where it gets its value. */\n readonly #kinds = new Map<number, PrimitiveKind>();\n\n constructor(memo: ReadonlyMap<Expr, readonly Expr[]>, facts: Facts, schema: Schema) {\n this.#memo = memo;\n this.#facts = facts;\n this.#schema = schema;\n }\n\n /** This method gives the kind of a value, if the lowering knows it. */\n kindOf(x: LExpr): PrimitiveKind | undefined {\n if (x.t === \"const\") {\n const t = typeof this.constants[x.i];\n return t === \"number\" || t === \"string\" || t === \"boolean\" ? t : undefined;\n }\n if (x.t === \"local\") return this.#kinds.get(x.n);\n // The other values have no kind that the lowering knows.\n return x.t === \"prim\" && BOOLEAN_PRIMS.has(x.op) ? \"boolean\" : undefined;\n }\n\n /** This method gives a local the kind `kind`. A value that is not a local keeps its kind. */\n #typed(x: LExpr, kind: PrimitiveKind | undefined): LExpr {\n if (x.t === \"local\" && kind !== undefined) this.#kinds.set(x.n, kind);\n return x;\n }\n\n /**\n * This method checks the kind that the schema declares for a value. A failure is no error of the interpreter, so it\n * stops the program, and tier 1 evaluates it.\n */\n #declared(b: Block, x: LExpr, kind: PrimitiveKind | undefined, reason: string): LExpr {\n if (kind === undefined) return x;\n b.stmts.push({ t: \"check\", ok: prim(KIND_CHECKS[kind], x), reason, fail: RETURN });\n return this.#typed(x, kind);\n }\n readonly constants: unknown[] = [];\n readonly #pool = new Map<unknown, number>();\n\n /** This method gives the index of the constant of a value. The same value has one constant. A map key does not tell 0 from -0, so -0 has its own. */\n index(value: unknown): number {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different constants\n const k = Object.is(value, -0) ? NEGATIVE_ZERO : value;\n let i = this.#pool.get(k);\n if (i === undefined) {\n i = this.constants.push(value) - 1;\n this.#pool.set(k, i);\n }\n return i;\n }\n\n /** This method gives the constant of a value. */\n constant(value: unknown): LExpr {\n return constant(this.index(value));\n }\n\n /** This method gives the number of a new local of a kind. */\n typedLocal(kind: PrimitiveKind): number {\n const n = this.locals++;\n this.#kinds.set(n, kind);\n return n;\n }\n\n /** This method gives a new local with a value. */\n value(b: Block, value: LExpr): LExpr {\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n return local(n);\n }\n\n check(b: Block, ok: LExpr, reason: string): void {\n b.stmts.push({ t: \"check\", ok, reason, fail: b.fail });\n }\n\n /** This method gives a new local with the value of a call of the runtime, and a check that the value is not `FALLBACK`. */\n checked(b: Block, value: LExpr, reason: string): LExpr {\n const x = this.value(b, value);\n this.check(b, prim(\"!==\", x, FALLBACK_EXPR), reason);\n return x;\n }\n\n /** This method adds a failure: the interpreter always gives an error here. */\n fail(b: Block): LExpr {\n b.stmts.push({ t: \"fail\", fail: b.fail });\n return FALLBACK_EXPR;\n }\n\n expr(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n // Inside a node of the memo, the value of a key replaces the key. An error of the key is an error at each place.\n const key = this.#keys.get(e);\n if (key !== undefined) {\n if (key.ok !== undefined) this.check(b, key.ok, \"a key with a value\");\n return key.value;\n }\n const keys = this.#memo.get(e);\n return keys === undefined ? this.#node(e, s, path, b) : this.#memoized(e, keys, s, path, b);\n }\n\n /** This method lowers a node itself, without the memo. */\n #node(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n switch (e.tag) {\n case \"lit\":\n return this.constant(e.value);\n case \"ref\":\n return this.#ref(e, s, path, b);\n case \"var\": {\n const bound = s.env.get(e.name);\n // A function is not a value (FN.VALUE): tier 1 gives the error. A name of a loop hides a function with its name.\n if (bound === undefined && s.fns.has(e.name)) return this.fail(b);\n if (bound === undefined) {\n const x = this.checked(b, call(\"var\", local(VARS), this.constant(e.name)), \"a variable\");\n return this.#declared(b, x, primitiveOf(this.#schema.vars?.[e.name]), \"a variable of the schema\");\n }\n if (bound.ok !== undefined) this.check(b, bound.ok, \"a binding with a value\");\n return bound.value;\n }\n case \"let\":\n return this.expr(e.body, { ...s, ...this.#bind(e, s, path, b) }, [...path, Object.keys(e.bind).length], b);\n // A function is only a binding of let, so the check of the shape stops this node first.\n // Stryker disable next-line all: see the comment above\n /* v8 ignore next -- @preserve */\n case \"fn\": return this.fail(b);\n case \"call\":\n return this.#call(e, s, path, b);\n case \"rec\": {\n const values = Object.values(e.fields).map((x, i) => this.expr(x, s, [...path, i], b));\n return this.value(b, call(\"rec\", this.constant(Object.keys(e.fields)), array(...values)));\n }\n case \"app\":\n return this.#app(e, s, path, b);\n case \"fold\":\n return this.#fold(e, s, path, b);\n case \"iterate\":\n return this.#iterate(e, s, path, b);\n case \"each\": {\n // A list keeps its error items, and generated code makes no error values. Thus an error item stops the program.\n const keys = this.locals++;\n const values = this.locals++;\n b.stmts.push({ t: \"let\", n: keys, value: array() }, { t: \"let\", n: values, value: array() });\n this.#loop(e, s, path, b, () => RETURN, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: keys, value: key }, { t: \"push\", n: values, value: v });\n });\n return this.value(b, call(\"list\", local(keys), local(values)));\n }\n case \"ext\": {\n // An extension can give the error #DEPTH!, which a list op does not skip. Thus an error of an extension stops the program.\n const x = this.value(b, call(\"ext\", this.constant(e.kind), this.constant(e.data), s.space, s.origin, s.focus, this.constant(path)));\n b.stmts.push({ t: \"check\", ok: prim(\"!==\", x, FALLBACK_EXPR), reason: \"an extension\", fail: RETURN });\n return x;\n }\n }\n }\n\n /**\n * This method gives the value of a node that depends only on the space (§7.2). The memo has an entry for each space.\n * Without the entry of the space, the node evaluates in a block, and an error of it makes an entry without a value.\n * An exception stops the program, so the memo gets no entry for it.\n */\n #memoized(e: Expr, keys: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const memo: LExpr = { t: \"memo\", id: this.memos++ };\n // Each key evaluates here, in a block of its own, as a binding does.\n const values = keys.map((k): Bound => this.#attempt(b, (inner) => this.expr(k, s, path, inner)));\n const tuple = array(...values.flatMap((k) => [k.value, flag(k)]));\n const h = this.locals++;\n const outer = this.#keys;\n this.#keys = new Map([...outer, ...keys.map((k, i): [Expr, Bound] => [k, values[i] as Bound])]);\n const compute = block(b.fail);\n const node = this.#attempt(compute, (inner) => this.#node(e, s, path, inner));\n this.#keys = outer;\n compute.stmts.push({ t: \"set\", n: h, value: prim(\"memoPut\", memo, s.space, tuple, node.value, flag(node)) });\n b.stmts.push({ t: \"let\", n: h, value: prim(\"memoGet\", memo, s.space, tuple) }, { t: \"if\", cond: prim(\"!\", prim(\"isValue\", local(h))), yes: compute.stmts, no: [] });\n this.check(b, prim(\"entryOk\", local(h)), \"a value of the memo\");\n // Each entry of the memo comes from the code of the node, so it has the kind of the value of the node.\n return this.#typed(this.value(b, prim(\"entryValue\", local(h))), this.kindOf(node.value));\n }\n\n /**\n * This method evaluates an expression in a block whose errors end the block, as a binding does. It gives the value\n * and the flag that tells if the value exists. Without statements, the expression always has a value, so it gets no flag.\n */\n #attempt(b: Block, make: (inner: Block) => LExpr): Bound {\n const label = this.labels++;\n const attempt = block({ t: \"break\", label });\n const value = make(attempt);\n if (attempt.stmts.length === 0) return { value };\n const v = this.locals++;\n const ok = this.locals++;\n this.#typed(local(v), this.kindOf(value));\n attempt.stmts.push({ t: \"set\", n: v, value }, { t: \"set\", n: ok, value: bool(true) });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts });\n return { value: local(v), ok: local(ok) };\n }\n\n /**\n * This method reads a field, as `ref` of the interpreter: the record of the key, and then each segment of the path.\n * A segment that cannot name a field always gives an error.\n */\n #ref(e: ExprOf<\"ref\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const record = e.at === undefined || e.at.length === 0 ? s.rec : prim(\"get\", s.space, this.#address(e.at, s, path, 0, b));\n if (!e.path.every(isFieldName)) return this.fail(b);\n const n = this.locals++;\n const x = local(n);\n b.stmts.push({ t: \"let\", n, value: record });\n this.check(b, prim(\"isValue\", x), \"a record\");\n for (const seg of e.path) {\n this.check(b, prim(\"isObject\", x), \"an object\");\n b.stmts.push({ t: \"set\", n, value: prim(\"member\", x, this.constant(seg)) });\n this.check(b, prim(\"isValue\", x), \"a field\");\n }\n const [field, ...more] = e.path;\n // Tier 2 knows only the primitive kinds. A value of a domain goes through the dispatch of the runtime.\n return field === undefined || more.length > 0 ? x : this.#declared(b, x, primitiveOf(this.#schema.fields?.[field]), \"a field of the schema\");\n }\n\n /**\n * This method binds the names of a `let`. The interpreter evaluates each binding in the scope outside the `let`. An\n * error of a binding is an error only where the body reads the name. Thus an error ends the block of the binding, and\n * a flag tells each read of the name that the binding has no value.\n */\n #bind(e: ExprOf<\"let\">, s: Scope, path: readonly number[], b: Block): Pick<Scope, \"env\" | \"fns\"> {\n const env = new Map(s.env);\n const fns = new Map(s.fns);\n Object.entries(e.bind).forEach(([name, x], i) => {\n // A function evaluates at each call. A binding sees the scope of the let, so a function cannot call itself.\n // A value hides a function of its name, because a read looks at the values first.\n if (x.tag === \"fn\") {\n fns.set(name, { fn: x, path: [...path, i], scope: s });\n env.delete(name);\n } else {\n env.set(name, this.#attempt(b, (inner) => this.expr(x, s, [...path, i], inner)));\n }\n });\n return { env, fns };\n }\n\n /**\n * This method lowers a call (FN.CALL). The body of the function goes at the place of the call, with the values of the\n * arguments for its parameters. The body sees the names of the place of its binding. A call that is not valid goes\n * to tier 1.\n */\n #call(e: ExprOf<\"call\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const bound = s.env.has(e.fn) ? undefined : s.fns.get(e.fn);\n if (bound?.fn.params.length !== e.args.length) return this.fail(b);\n if (++this.#calls > MAX_CALLS) throw new Unsupported(`the calls put the bodies of functions in more than ${String(MAX_CALLS)} places`);\n const env = new Map(bound.scope.env);\n bound.fn.params.forEach((p, i) => env.set(p, this.#attempt(b, (inner) => this.expr(e.args[i] as Expr, s, [...path, i], inner))));\n return this.expr(bound.fn.body, { ...s, env, fns: bound.scope.fns }, [...bound.path, 0], b);\n }\n\n #app(e: ExprOf<\"app\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const { op, args } = e;\n switch (op) {\n case \"if\":\n return this.#if(args, s, path, b);\n case \"and\":\n case \"or\":\n return args.length === 0 ? this.fail(b) : this.#andOr(op === \"or\", args, 0, s, path, b);\n case \"ifError\":\n return this.#ifError(args, s, path, b);\n }\n if (isListOp(op)) {\n const target = eachUnderLets(args[0]);\n if (target !== undefined) return this.#fused(op, e, target, s, path, b);\n }\n const values = args.map((x, i) => this.expr(x, s, [...path, i], b));\n const kinds = values.map((x) => this.kindOf(x));\n // A static site checks the kind of its result, so the result has the kind that the op declares (KIND.RETURNS).\n const site = this.#facts.staticSite(op, kinds);\n const x = this.checked(b, { t: \"op\", name: this.index(op), args: values, kinds }, \"an op\");\n return this.#typed(x, site?.t === \"fn\" ? primitiveOf(site.returns) : undefined);\n }\n\n /** The condition must be a boolean. Only the branch that the condition selects is evaluated. */\n #if(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [cond, yes, no] = args;\n if (cond === undefined) return this.fail(b);\n const c = this.#boolean(this.expr(cond, s, [...path, 0], b), b);\n const r = this.locals++;\n const kinds: (PrimitiveKind | undefined)[] = [];\n const branch = (x: Expr | undefined, i: number): LStmt[] => {\n const inner = block(b.fail);\n const value = x === undefined ? this.fail(inner) : this.expr(x, s, [...path, i], inner);\n kinds.push(this.kindOf(value));\n inner.stmts.push({ t: \"set\", n: r, value });\n return inner.stmts;\n };\n b.stmts.push({ t: \"if\", cond: c, yes: branch(yes, 1), no: branch(no, 2) });\n return this.#typed(local(r), join(kinds[0], kinds[1]));\n }\n\n /** `or` stops at the first `true`, and `and` at the first `false`. Each argument before the stop must be a boolean. */\n #andOr(isOr: boolean, args: readonly Expr[], i: number, s: Scope, path: readonly number[], b: Block, r = this.locals++): LExpr {\n const x = this.#boolean(this.expr(args[i] as Expr, s, [...path, i], b), b);\n this.#typed(local(r), \"boolean\");\n if (i === args.length - 1) {\n b.stmts.push({ t: \"set\", n: r, value: x });\n } else {\n const rest = block(b.fail);\n this.#andOr(isOr, args, i + 1, s, path, rest, r);\n const stop: LStmt[] = [{ t: \"set\", n: r, value: bool(isOr) }];\n b.stmts.push(isOr ? { t: \"if\", cond: x, yes: stop, no: rest.stmts } : { t: \"if\", cond: x, yes: rest.stmts, no: stop });\n }\n return local(r);\n }\n\n /**\n * The value of the first argument, or else the value of the second argument. An error of the first argument ends its\n * block. An exception, for example #DEPTH!, stops the program, so `ifError` does not hide it (EVAL.DEPTH).\n */\n #ifError(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [first, second] = args;\n if (first === undefined) return this.fail(b);\n const label = this.labels++;\n const r = this.locals++;\n const ok = this.locals++;\n const attempt = block({ t: \"break\", label });\n const value = this.expr(first, s, [...path, 0], attempt);\n attempt.stmts.push({ t: \"set\", n: r, value }, { t: \"set\", n: ok, value: bool(true) });\n const otherwise = block(b.fail);\n const fallback = second === undefined ? this.fail(otherwise) : this.expr(second, s, [...path, 1], otherwise);\n otherwise.stmts.push({ t: \"set\", n: r, value: fallback });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts }, { t: \"if\", cond: prim(\"!\", local(ok)), yes: otherwise.stmts, no: [] });\n return this.#typed(local(r), join(this.kindOf(value), this.kindOf(fallback)));\n }\n\n /** A value of a known kind needs no check. */\n #boolean(x: LExpr, b: Block): LExpr {\n if (this.kindOf(x) !== \"boolean\") this.check(b, prim(\"isBoolean\", x), \"a boolean\");\n return x;\n }\n\n #number(x: LExpr, b: Block): LExpr {\n if (this.kindOf(x) !== \"number\") this.check(b, prim(\"isNumber\", x), \"a number\");\n return x;\n }\n\n /**\n * This method lowers a list op over an `each` into one loop. Like the interpreter, the loop skips an error item, and\n * with the option `strict` the list op fails at an error item. `errors` gives the error values, so an error item of\n * `errors` stops the program.\n */\n #fused(op: ListOp, e: ExprOf<\"app\">, target: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block): LExpr {\n // The `let` expressions above the `each`, from the outside in.\n let inner = s;\n let at = [...path, 0];\n for (let x = e.args[0] as Expr; x.tag === \"let\"; x = x.body) {\n inner = { ...inner, ...this.#bind(x, inner, at, b) };\n at = [...at, Object.keys(x.bind).length];\n }\n const rest = e.args.slice(1).map((x, i) => this.expr(x, s, [...path, i + 1], b));\n const options = op === \"reduce\" ? rest[1] : rest[0];\n const strict = options === undefined ? undefined : this.value(b, prim(\"===\", call(\"opts\", options), bool(true)));\n const name = rest[0];\n if (op === \"reduce\") {\n if (name === undefined) return this.fail(b);\n this.check(b, prim(\"isString\", name), \"an op name\");\n }\n const items = (label: number): Fail => {\n if (op === \"errors\") return RETURN;\n return strict === undefined ? { t: \"continue\", label } : { t: \"continue\", label, strict: { cond: strict, else: b.fail } };\n };\n\n const acc = this.locals++;\n const n = this.typedLocal(\"number\");\n const init = (value: LExpr): void => {\n b.stmts.push({ t: \"let\", n: acc, value });\n };\n b.stmts.push({ t: \"let\", n, value: num(0) });\n const count = (body: Block): void => {\n body.stmts.push({ t: \"set\", n, value: prim(\"+\", local(n), num(1)) });\n };\n // A check of the list op itself is in the loop, but its failure is a failure of the list op.\n const opCheck = (body: Block): Block => ({ stmts: body.stmts, fail: b.fail });\n const firstThen = (body: Block, v: LExpr, then: (later: Block) => LExpr): void => {\n const later = block(b.fail);\n later.stmts.push({ t: \"set\", n: acc, value: then(later) });\n body.stmts.push({ t: \"if\", cond: prim(\"===\", local(n), num(0)), yes: [{ t: \"set\", n: acc, value: v }], no: later.stmts });\n };\n const nonEmpty = (): void => {\n this.check(b, prim(\"!==\", local(n), num(0)), \"a list that is not empty\");\n };\n\n switch (op) {\n case \"count\":\n this.#loop(target, inner, at, b, items, (body) => count(body));\n return local(n);\n case \"sum\":\n case \"mean\":\n init(num(0));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(\"+\", local(acc), this.#number(v, opCheck(body))) });\n count(body);\n });\n if (op === \"sum\") return this.#typed(this.checked(b, call(\"result\", local(acc)), \"a finite sum\"), \"number\");\n nonEmpty();\n return this.#typed(this.checked(b, call(\"result\", prim(\"/\", local(acc), local(n))), \"a finite mean\"), \"number\");\n case \"min\":\n case \"max\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n this.#number(v, opCheck(body));\n firstThen(body, v, () => prim(op, local(acc), v));\n count(body);\n });\n nonEmpty();\n return this.#typed(local(acc), \"number\");\n case \"any\":\n case \"all\":\n case \"none\":\n init(bool(op === \"all\"));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(op === \"all\" ? \"&&\" : \"||\", local(acc), this.#boolean(v, opCheck(body))) });\n });\n return op === \"none\" ? prim(\"!\", local(acc)) : this.#typed(local(acc), \"boolean\");\n case \"first\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, () => local(acc));\n count(body);\n });\n nonEmpty();\n return local(acc);\n case \"values\":\n case \"keys\":\n init(array());\n this.#loop(target, inner, at, b, items, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: acc, value: op === \"keys\" ? key : v });\n });\n return this.value(b, call(\"frozen\", local(acc)));\n case \"errors\":\n this.#loop(target, inner, at, b, items, () => undefined);\n return this.value(b, call(\"frozen\", array()));\n case \"reduce\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, (later) => this.checked(later, call(\"step\", name as LExpr, local(acc), v), \"a step of reduce\"));\n count(body);\n });\n nonEmpty();\n return local(acc);\n // listReason stops a program with these ops before the lowering, so this case is defensive.\n case \"sortBy\":\n case \"take\":\n case \"nth\":\n case \"drop\":\n case \"append\":\n case \"flat\":\n case \"without\":\n case \"get\":\n /* v8 ignore next -- @preserve */\n // Stryker disable next-line all: listReason stops these ops before the lowering\n throw new Unsupported(`the list op \"${op}\"`);\n }\n }\n\n /**\n * This method lowers the loop over the targets of an axis. The tests of `where` and the body evaluate at each target\n * in a block whose failure is `items(label)`. Then `onItem` adds the statements for the value of the body.\n */\n /**\n * This method gives the key of an address. The expressions of its computed moves evaluate first, at the position of\n * the node, and their child indexes start at `first` (NAV.COMPUTED).\n */\n #address(at: Addr, s: Scope, path: readonly number[], first: number, b: Block): LExpr {\n const values = addrExprs(at).map((x, i) => this.expr(x, s, [...path, first + i], b));\n const args = [s.space, s.origin, s.focus, this.constant(at), ...(values.length === 0 ? [] : [array(...values)])];\n return this.checked(b, call(\"addr\", ...args), \"an address\");\n }\n\n #loop(e: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block, items: (label: number) => Fail, onItem: (body: Block, key: LExpr, value: LExpr) => void): void {\n this.#targetLoop(e.axis, e.at, s, path, 1, b, items, (body, key, at) => {\n onItem(body, key, this.expr(e.body, at, [...path, 0], body));\n });\n }\n\n /**\n * This method lowers the loop over the targets of an axis with the address `addr`. The tests of `where` have the child\n * indexes from `firstTest`, and the expressions of the address come after them. `each` adds the statements of a target.\n */\n #targetLoop(\n axis: Axis,\n addr: Addr | undefined,\n s: Scope,\n path: readonly number[],\n firstTest: number,\n b: Block,\n items: (label: number) => Fail,\n each: (body: Block, key: LExpr, at: Scope) => void,\n ): void {\n const from = addr === undefined || addr.length === 0 ? s.focus : this.#address(addr, s, path, firstTest + whereTests(axis).length, b);\n const base = baseAxis(axis);\n let space = s.space;\n let over: LExpr;\n let skip: LExpr | undefined;\n // The index of the record of each target: the index of the loop, or else the index that the axis gives.\n let idx: LExpr | undefined;\n if (base.t === \"table\") {\n // The axis table moves the evaluation to the space of its table, and there the origin is the target.\n space = this.checked(b, call(\"table\", local(TABLES), this.constant(base.name)), \"a table\");\n over = call(\"keys\", space);\n } else if (base.t === \"all\" || base.t === \"others\") {\n over = call(\"keys\", s.space);\n if (base.t === \"others\") skip = from;\n } else {\n const targets = this.checked(b, { t: \"targets\", axis: this.index(base), args: [s.space, s.origin, from] }, \"the targets of an axis\");\n over = prim(\"keysOf\", targets);\n idx = this.value(b, prim(\"idxOf\", targets));\n }\n const records = this.value(b, prim(\"records\", space));\n const label = this.labels++;\n const array_ = this.locals++;\n const index = this.locals++;\n const item = this.locals++;\n const key = local(item);\n const body = block(items(label));\n if (skip !== undefined) body.stmts.push({ t: \"if\", cond: prim(\"===\", key, skip), yes: [{ t: \"next\" }], no: [] });\n const slot = idx === undefined ? local(index) : prim(\"member\", idx, local(index));\n const at: Scope = { space, origin: base.t === \"table\" ? key : s.origin, focus: key, env: s.env, fns: s.fns, rec: prim(\"recordAt\", records, slot, space, key) };\n whereTests(axis).forEach((test, i) => {\n const ok = this.#boolean(this.expr(test, at, [...path, firstTest + i], body), body);\n body.stmts.push({ t: \"if\", cond: prim(\"!\", ok), yes: [{ t: \"next\" }], no: [] });\n });\n each(body, key, at);\n b.stmts.push({ t: \"loop\", label, item, index, array: array_, over, body: body.stmts });\n }\n\n /** This method gives a local for each name of a loop, with its first value at the node (LOOP.NAMES). */\n #loopNames(init: Names, s: Scope, path: readonly number[], b: Block): { readonly env: ReadonlyMap<string, Bound>; readonly locals: ReadonlyMap<string, number> } {\n const env = new Map(s.env);\n const locals = new Map<string, number>();\n Object.entries(init).forEach(([name, x], i) => {\n const value = this.expr(x, s, [...path, i], b);\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n this.#typed(local(n), this.kindOf(value));\n env.set(name, { value: local(n) });\n locals.set(name, n);\n });\n return { env, locals };\n }\n\n /**\n * This method lowers one step of a loop: each new value first, and then each name gets its value. A name keeps the\n * kind of its first value, so a new value of another kind stops the program, and tier 1 evaluates it.\n */\n #loopStep(step: Names, s: Scope, path: readonly number[], first: number, b: Block, locals: ReadonlyMap<string, number>): void {\n const values = Object.entries(step).map(([name, x], i): [number, LExpr] => {\n const n = locals.get(name) as number;\n const value = this.value(b, this.expr(x, s, [...path, first + i], b));\n return [n, this.#declared(b, value, this.kindOf(local(n)), \"a value of the kind of a name of a loop\")];\n });\n for (const [n, value] of values) b.stmts.push({ t: \"set\", n, value });\n }\n\n /** This method lowers an iteration (ITERATE.LIMIT, ITERATE.UNTIL): a repeated block with a count of its steps. */\n #iterate(e: ExprOf<\"iterate\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n const inner: Scope = { ...s, env };\n const label = this.labels++;\n const k = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n: k, value: num(0) });\n const body = block(b.fail);\n if (e.until !== undefined) {\n const stop = this.#boolean(this.expr(e.until, inner, [...path, tests], body), body);\n body.stmts.push({ t: \"check\", ok: prim(\"!\", stop), reason: \"the test until\", fail: { t: \"break\", label } });\n }\n // At the limit, an iteration without a test ends, and an iteration with a test fails.\n body.stmts.push({ t: \"check\", ok: prim(\"!==\", local(k), num(e.limit)), reason: \"the limit of iterate\", fail: e.until === undefined ? { t: \"break\", label } : b.fail });\n this.#loopStep(e.step, inner, path, first, body, locals);\n body.stmts.push({ t: \"set\", n: k, value: prim(\"+\", local(k), num(1)) });\n b.stmts.push({ t: \"repeat\", label, body: body.stmts });\n return this.expr(e.result, inner, [...path, tests + (e.until === undefined ? 0 : 1)], b);\n }\n\n /** This method lowers a fold (FOLD.ORDER): the loop over the targets, with a step at each target. */\n #fold(e: ExprOf<\"fold\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n // An error of a test or of a step is the error of the fold.\n this.#targetLoop(e.axis, e.at, s, path, tests, b, () => b.fail, (body, _key, at) => {\n this.#loopStep(e.step, { ...at, env }, path, first, body, locals);\n });\n return this.expr(e.result, { ...s, env }, [...path, tests + whereTests(e.axis).length + addrExprs(e.at).length], b);\n }\n}\n\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function gives the flag of a bound value: its local, or `true` for a value without a flag. */\n// Stryker disable next-line BooleanLiteral: a value without a flag always exists, so each constant gives the same entries\nconst flag = (b: Bound): LExpr => b.ok ?? bool(true);\n","/**\n * The runtime of generated code. Each function follows the rule of the interpreter of the core. Where the interpreter\n * gives an error value, the function gives `FALLBACK`, and tier 1 then does the evaluation again (docs/COMPILER.md §4.1).\n * Thus the runtime makes no error values and no `Result` objects.\n *\n * Generated code uses the runtime inside a `try`, and an exception gives `FALLBACK` for the whole program. A function\n * of the runtime catches an exception only where the interpreter makes a value of it. In an op, it is `#CALC!`, and in\n * `safeIs`, it is `false`. A full call stack is `#DEPTH!`, which no list op and no `ifError` hides, so it goes on to\n * the program.\n */\nimport {\n axisTargets,\n findMethod,\n isListOp,\n isStackOverflow,\n isVexList,\n liftsAt,\n matchesKind,\n fixAddr,\n resolveAddr,\n safeIs,\n vexList,\n type Addr,\n type AnyDomain,\n type Axis,\n type FixedMove,\n type FreeFn,\n type Space,\n} from \"@mark1russell7/vex\";\nimport { entryOf, type Entry, type Method, type Options } from \"./facts.ts\";\n\n/** The value of a program that stops at a failed check. */\nexport const FALLBACK: unique symbol = Symbol(\"vex.fallback\");\nexport type Fallback = typeof FALLBACK;\n\n/** The options that a runtime keeps: the domains, the free functions and the extension handlers. */\nexport type RuntimeOptions = Options;\n\n/**\n * The dispatch of one op name and one number of arguments. With up to 3 arguments, it takes the values themselves, the\n * receiver first. With more, it takes an array of the values. Generated code also reads its fields: the method of the\n * last receiver, the function of the op of the first domain, and the free function.\n */\nexport interface Site {\n (...values: never[]): unknown;\n m: Method | undefined;\n readonly fn: Method | undefined;\n readonly free: FreeFn | undefined;\n}\n\n/** A base axis: an axis that is not `where`. */\nexport type BaseAxis = Exclude<Axis, { readonly t: \"where\" }>;\n\n/** The targets of an axis at a focus: the keys, and the index of each key in `keys` of the space. */\nexport interface Targets {\n readonly keys: readonly string[];\n readonly idx: readonly (number | undefined)[];\n}\n\n/** An entry of a memo: the value of a node for one space, or no value after an error. */\nexport interface MemoEntry {\n readonly v: unknown;\n readonly ok: boolean;\n}\n\n/**\n * The memo of one node: an entry for each space and each value of the keys (docs/COMPILER.md §7.2 and §7.3). An entry\n * with an object or a function in its keys is not kept, because each run can make a new one.\n */\nexport interface Memo {\n get(s: Space, keys: readonly unknown[]): MemoEntry | undefined;\n put(s: Space, keys: readonly unknown[], v: unknown, ok: boolean): MemoEntry;\n}\n\n/** A level of a memo: the entry of the keys so far, and the levels of the next key. */\ninterface MemoLevel {\n entry?: MemoEntry;\n next?: Map<unknown, MemoLevel>;\n}\n\n/** A map key does not tell 0 from -0, but an op can. Thus -0 has its own key. */\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function tells if a memo keeps an entry with these keys: keys without objects and functions. */\nconst kept = (keys: readonly unknown[]): boolean => keys.every((k) => (typeof k !== \"object\" || k === null) && typeof k !== \"function\");\n\n/** The functions of the runtime. The names are the names of `RuntimeFn` in the loop IR. */\nexport interface Runtime {\n readonly F: Fallback;\n has(s: Space, key: string): boolean;\n /** This function gives the key of an address. `values` has the values of its computed moves (NAV.COMPUTED). */\n addr(s: Space, origin: string, focus: string, at: Addr, values?: readonly unknown[]): unknown;\n /**\n * This function gives the function of the targets of one base axis. A space does not change, so the targets stay in\n * a cache for each space and focus. Generated code gets it once, when it loads.\n */\n axis(axis: BaseAxis): (s: Space, origin: string, focus: string) => Targets | Fallback;\n table(tables: Readonly<Record<string, Space>> | undefined, name: string): unknown;\n keys(s: Space): readonly string[];\n /** This function gives the dispatch of an op name with `arity` arguments. Generated code gets it once, when it loads. */\n site(name: string, arity: number): Site;\n /** This function gives a new memo. Generated code gets one for each node of the memo, when it loads. */\n memo(): Memo;\n /** This function gives the domain at an index of the options. */\n domain(index: number): AnyDomain | undefined;\n /** An exception of an op is the error #CALC! of that op, so this function gives `FALLBACK`. A full call stack goes on. */\n threw(thrown: unknown): Fallback;\n step(name: string, acc: unknown, value: unknown): unknown;\n result(value: unknown): unknown;\n opts(value: unknown): unknown;\n rec(names: readonly string[], values: readonly unknown[]): unknown;\n list(keys: readonly string[], values: readonly unknown[]): unknown;\n frozen(values: readonly unknown[]): unknown;\n ext(kind: string, data: unknown, s: Space, origin: string, focus: string, path: readonly number[]): unknown;\n var(vars: Readonly<Record<string, unknown>> | undefined, name: string): unknown;\n}\n\n/** This function makes the runtime of one set of options. */\nexport function createRuntime(options: RuntimeOptions): Runtime {\n const domains = options.domains ?? [];\n const fns = options.fns;\n const extensions = options.extensions ?? {};\n const F: Fallback = FALLBACK;\n\n const threw = (thrown: unknown): Fallback => {\n if (isStackOverflow(thrown)) throw thrown;\n return F;\n };\n\n // The checks of the result of an op: a value, a finite number, and a valid value of its first domain.\n const checked = (value: unknown): unknown => {\n if (value === undefined || value === null) return F;\n if (typeof value === \"number\" && !Number.isFinite(value)) return F;\n for (const d of domains) {\n if (safeIs(d, value)) return d.valid === undefined || d.valid(value) ? value : F;\n }\n return value;\n };\n\n // The call of an op, as `#call` of the interpreter: the lift of numbers, the kinds of the parameters, the call, and\n // the checks of the result.\n const invoke = (e: Entry, call: (args: readonly unknown[]) => unknown, rest: readonly unknown[]): unknown => {\n try {\n const lift = e.spec.liftScalar;\n const from = e.domain.fromScalar;\n const args = lift && from !== undefined ? rest.map((a, i): unknown => (typeof a === \"number\" && liftsAt(lift, i) ? from(a) : a)) : rest;\n const params = e.spec.params;\n if (params !== undefined && !args.every((a, i) => matchesKind(params[i] ?? \"any\", a, e.domain))) return F;\n return checked(call(args));\n } catch (thrown) {\n return threw(thrown);\n }\n };\n\n // The op of a name for a receiver: the first domain that accepts the receiver and has the op. `undefined` is no op.\n // `seen` receives each method that the dispatch finds.\n const dispatch = (entries: readonly (Entry | undefined)[], name: string, values: readonly unknown[], seen?: (m: Method) => void): unknown => {\n const [self, ...rest] = values;\n for (const e of entries) {\n if (e === undefined || !safeIs(e.domain, self)) continue;\n const fn = e.fn;\n if (fn !== undefined) return invoke(e, (args) => fn(self, ...args), rest);\n const method = findMethod(self, name);\n if (method === undefined) continue;\n seen?.(method);\n return invoke(e, (args) => method.apply(self, [...args]), rest);\n }\n return undefined;\n };\n\n const entriesOf = (name: string): readonly (Entry | undefined)[] => domains.map((d) => entryOf(d, name));\n\n // The entries of the op names of reduce. A program can compute such a name, so the runtime keeps them by name.\n const stepEntries = new Map<string, readonly (Entry | undefined)[]>();\n\n // The index of each key of a space, for the targets of an axis. A miss of the cache only makes the map again.\n const indexes = new WeakMap<Space, ReadonlyMap<string, number>>();\n const indexOf = (s: Space): ReadonlyMap<string, number> => {\n let m = indexes.get(s);\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (m === undefined) {\n m = new Map(s.keys.map((k, i) => [k, i]));\n // Stryker disable next-line CallExpression: see the comment above\n indexes.set(s, m);\n }\n return m;\n };\n\n return {\n F,\n has: (s, key) => s.has(key),\n addr(s, origin, focus, at, values) {\n const pos = { origin, focus };\n // An address without computed moves has no values, and its moves are fixed.\n // Stryker disable next-line ConditionalExpression: fixAddr gives the same fixed moves, so the test only saves an array\n const fixed = values === undefined ? undefined : fixAddr(at, values, pos);\n if (fixed?.ok === false) return F;\n const r = resolveAddr(s, pos, fixed === undefined ? (at as readonly FixedMove[]) : fixed.value);\n return r.ok ? r.value : F;\n },\n axis(axis) {\n const cache = new WeakMap<Space, Map<string, Targets | Fallback>>();\n return (s, origin, focus) => {\n let byFocus = cache.get(s);\n if (byFocus === undefined) {\n byFocus = new Map();\n cache.set(s, byFocus);\n }\n let targets = byFocus.get(focus);\n if (targets === undefined) {\n const r = axisTargets(s, { origin, focus }, axis);\n const index = indexOf(s);\n targets = r.ok ? { keys: r.value, idx: r.value.map((k) => index.get(k)) } : F;\n byFocus.set(focus, targets);\n }\n return targets;\n };\n },\n table(tables, name) {\n const t = tables !== undefined && Object.hasOwn(tables, name) ? tables[name] : undefined;\n return t ?? F;\n },\n keys: (s) => s.keys,\n // The dispatch of `app` in the interpreter: the first domain that accepts the receiver and has the op, and else a\n // free function. Generated code has the fast path of each site, and it uses this dispatch for each other case.\n site(name, arity) {\n const entries = entriesOf(name);\n const listOp = isListOp(name);\n const fn = fns !== undefined && Object.hasOwn(fns, name) ? fns[name] : undefined;\n const generic = (values: readonly unknown[]): unknown => {\n // A list op on a list value is not an error, but tier 2 does not have it. The exception stops the program.\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (listOp && isVexList(values[0])) throw new Error(\"tier 1 gives a list op on a list value\");\n if (values.length > 0) {\n const r = dispatch(entries, name, values, (m) => {\n site.m = m;\n });\n if (r !== undefined) return r;\n }\n try {\n // Stryker disable next-line ConditionalExpression: a call of undefined throws, and the catch also gives F\n return fn === undefined ? F : checked(fn(...values));\n } catch (thrown) {\n return threw(thrown);\n }\n };\n const call = arity <= 3 ? (...values: unknown[]): unknown => generic(values) : generic;\n const site: Site = Object.assign(call, { m: undefined, fn: entries.find((e) => e !== undefined)?.fn, free: fn });\n return site;\n },\n memo() {\n const spaces = new WeakMap<Space, MemoLevel>();\n // The level of a space and some keys. With `make`, the function makes each missing level. A level that a read\n // makes only uses memory, so the checks of `make` have no other effect.\n const level = (s: Space, keys: readonly unknown[], make: boolean): MemoLevel | undefined => {\n let at: MemoLevel | undefined = spaces.get(s);\n if (at === undefined) {\n // A read comes before each write, so the level of the space exists for each write.\n // Stryker disable next-line ConditionalExpression,BooleanLiteral: see the comments above\n if (!make) return undefined;\n at = {};\n spaces.set(s, at);\n }\n for (const k of keys) {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different entries\n const slot = Object.is(k, -0) ? NEGATIVE_ZERO : k;\n let next: MemoLevel | undefined = at.next?.get(slot);\n if (next === undefined) {\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (!make) return undefined;\n next = {};\n (at.next ??= new Map()).set(slot, next);\n }\n at = next;\n }\n return at;\n };\n return {\n // Stryker disable next-line BooleanLiteral: a read that makes the levels only uses memory\n get: (s, keys) => level(s, keys, false)?.entry,\n put(s, keys, v, ok) {\n const e = { v, ok };\n if (kept(keys)) (level(s, keys, true) as MemoLevel).entry = e;\n return e;\n },\n };\n },\n domain: (index) => domains[index],\n threw,\n // One step of `reduce`: the first domain that accepts the accumulator and has the op. No free function.\n step(name, acc, value) {\n let entries = stepEntries.get(name);\n // A miss of the cache only reads the op tables again.\n // Stryker disable ConditionalExpression,BlockStatement,CallExpression\n if (entries === undefined) {\n entries = entriesOf(name);\n stepEntries.set(name, entries);\n }\n // Stryker restore ConditionalExpression,BlockStatement,CallExpression\n return dispatch(entries, name, [acc, value]) ?? F;\n },\n result(value) {\n try {\n return checked(value);\n } catch (thrown) {\n return threw(thrown);\n }\n },\n // A list op reads the option `strict` of its options. The read can throw, as in the interpreter.\n opts: (value) => (value as { readonly strict?: unknown } | null | undefined)?.strict,\n // Object.fromEntries gives an own field for each name, also for \"__proto__\" (V-062).\n rec: (names, values) => Object.freeze(Object.fromEntries(names.map((n, i) => [n, values[i]]))),\n list: (keys, values) => vexList(keys.map((key, i) => ({ key, result: { ok: true, value: values[i] } }))),\n frozen: (values) => Object.freeze([...values]),\n ext(kind, data, s, origin, focus, path) {\n const handler = Object.hasOwn(extensions, kind) ? extensions[kind] : undefined;\n // Stryker disable next-line ConditionalExpression: a call of undefined throws, and the program gives F for it too\n if (handler === undefined) return F;\n const r = handler(data, { space: s, position: { origin, focus }, path });\n return r.ok ? r.value : F;\n },\n // The interpreter reads the own enumerable properties of the variables, with `Object.entries`.\n var(vars, name) {\n return vars !== undefined && Object.prototype.propertyIsEnumerable.call(vars, name) ? vars[name] : F;\n },\n };\n}\n","/**\n * The tiers (docs/COMPILER.md §2.1). Tier 2 is generated JavaScript. Tier 1 is the closure compiler of the core, and it\n * gives each result that tier 2 cannot give. Thus a tiered program gives the results of the interpreter.\n */\nimport { compile, fromDocument, isDocument, ok, type CompileOptions, type Envelope, type Expr, type Program, type Space } from \"@mark1russell7/vex\";\nimport { factsOf, type Schema } from \"./facts.ts\";\n\n/** The options of the compiler: the options of `compile`, and the schema of the host (docs/COMPILER.md §3.2). */\nexport type GenerateOptions = CompileOptions & { readonly schema?: Schema };\nimport { printJs } from \"./js.ts\";\nimport type { LoopProgram } from \"./loop.ts\";\nimport { lower, Unsupported } from \"./lower.ts\";\nimport { createRuntime, FALLBACK } from \"./runtime.ts\";\n\n/**\n * The output of `generate`: the loop IR and the source of a program, and the options that the source is for. Or else\n * the reason that the compiler cannot lower the program.\n */\nexport type Generated =\n | { readonly ok: true; readonly program: LoopProgram; readonly source: string; readonly options: GenerateOptions }\n | { readonly ok: false; readonly reason: string };\n\n/** A function of tier 2. It gives the value of the program, or `FALLBACK`. */\nexport type Tier2 = (space: Space, origin: string, vars: Readonly<Record<string, unknown>> | undefined, tables: Readonly<Record<string, Space>> | undefined) => unknown;\n\n/**\n * This function lowers an expression or a document and prints its source for the options (DOC.ENTRY). The op tables of\n * the domains give the fast path of each op site. It is pure, so a build can use it.\n */\nexport function generate(source: Expr | Envelope, options: GenerateOptions = {}): Generated {\n // DOC.ENTRY: a document gives its expression first, or the reason that it is not valid.\n const read = isDocument(source) ? fromDocument(source, options.domains) : ok(source);\n if (!read.ok) return { ok: false, reason: read.error.message };\n try {\n const facts = factsOf(options);\n const program = lower(read.value, facts, options.schema);\n return { ok: true, program, source: printJs(program, facts), options };\n } catch (thrown) {\n // A stack overflow in the lowering of a deep expression also goes to tier 1.\n return { ok: false, reason: thrown instanceof Unsupported ? thrown.message : \"the lowering threw an exception\" };\n }\n}\n\n/**\n * This function makes the function of tier 2 with `new Function`, with the options of the source. It throws on a page\n * that does not permit `new Function`.\n */\nexport function load(generated: Extract<Generated, { readonly ok: true }>): Tier2 {\n // oxlint-disable-next-line typescript/no-implied-eval -- the source comes from printJs, and it reads each name and literal from K (§5).\n const make = new Function(\"K\", \"R\", generated.source) as (k: readonly unknown[], r: ReturnType<typeof createRuntime>) => Tier2;\n return make(generated.program.constants, createRuntime(generated.options));\n}\n\n/** The counts of the runs of a tiered program. */\nexport interface TierStats {\n /** The number of runs. */\n readonly runs: number;\n /** The number of runs where tier 2 gave `FALLBACK`, so tier 1 gave the result. */\n readonly fallbacks: number;\n}\n\n/** A program with tiers. It has the interface `Program` of the core, so it can replace a compiled program. */\nexport interface TieredProgram extends Program {\n /** The tier of the program: 2 when it has generated code, and else 1. */\n readonly tier: 1 | 2;\n /** The reason that the program has no generated code. */\n readonly reason?: string;\n readonly stats: TierStats;\n}\n\n/**\n * This function compiles an expression or a document into tier 2 if it can, and else into tier 1 (DOC.ENTRY). After a\n * failed check of tier 2, tier 1 does that evaluation again. A run with a trace and `explain` always use tier 1, because\n * tier 2 makes no trace.\n */\nexport function tiered(source: Expr | Envelope, options: GenerateOptions = {}): TieredProgram {\n const slow = compile(source, options);\n // The program of tier 1 has the expression of a document, so tier 2 does not read the document again.\n const { expr } = slow;\n const generated = generate(expr, options);\n let fast: Tier2 | undefined;\n let reason: string | undefined;\n if (generated.ok) {\n try {\n fast = load(generated);\n } catch {\n reason = \"the page does not permit new Function\";\n }\n } else {\n reason = generated.reason;\n }\n const stats = { runs: 0, fallbacks: 0 };\n return {\n expr,\n tier: fast === undefined ? 1 : 2,\n ...(reason === undefined ? {} : { reason }),\n stats,\n run(r) {\n stats.runs++;\n if (fast === undefined || r.trace !== undefined) return slow.run(r);\n const value = fast(r.space, r.origin, r.vars, r.tables);\n if (value !== FALLBACK) return ok(value);\n stats.fallbacks++;\n return slow.run(r);\n },\n explain: (r) => slow.explain(r),\n };\n}\n","/**\n * The static order of the cells of a sheet in a module (COMPILE.MODULE.SHEET). It is the order of `SheetRun.fill` in\n * `packages/core/src/sheet.ts` (SHEET.FILL). Each column comes after the columns that it reads. The keys of a column\n * follow its reads from itself. The order changes only the speed, not a result (SHEET.ORDER).\n */\nimport { addrExprs, CELL_KIND, children, isMove, listOf, moveExpr, shapeError, type Axis, type CellFormulas, type CellRef, type Expr, type Move } from \"@mark1russell7/vex\";\n\n/** A direction of the reads of a column from itself: to an earlier key, to a later key, or down a tree to the children. */\nexport type Direction = \"before\" | \"after\" | \"down\";\n\n/** This function tells if the data of an extension is a cell reference: a column, and an address of fixed moves. */\nexport const isCellRef = (u: unknown): u is CellRef =>\n typeof u === \"object\" &&\n u !== null &&\n typeof (u as { column?: unknown }).column === \"string\" &&\n Array.isArray((u as { at?: unknown }).at) &&\n (u as { at: readonly unknown[] }).at.every((m) => isMove(m) && moveExpr(m) === undefined);\n\n/** This function adds the direction of one move or one axis of a read of a column from itself. */\nfunction addDirection(d: Set<Direction>, m: Move | Axis): void {\n // The reverse order reads the same keys as its axis.\n if (m.t === \"reverse\") {\n addDirection(d, m.axis);\n return;\n }\n if (m.t === \"offset\" || m.t === \"window\") {\n // An offset moves by its first step that is not 0. A window reads the keys from `from` to `to`.\n const steps = m.t === \"offset\" ? [m.d.find((x) => x !== 0) ?? 0] : [m.from, m.to];\n // A step of 0 reads the cell itself, which is a cycle in each order.\n // Stryker disable next-line EqualityOperator: see the comment above\n if (steps.some((x) => x < 0)) d.add(\"before\");\n // Stryker disable next-line EqualityOperator: see the comment above\n if (steps.some((x) => x > 0)) d.add(\"after\");\n } else if (m.t === \"children\" || m.t === \"descendants\") d.add(\"down\");\n // The items of a list can be at each key, so the axis list gives no direction, and the other reads decide the order.\n}\n\n/** This function gives the base axis of an axis, and the tests of its `where` axes. */\nfunction partsOf(axis: Axis): { readonly base: Axis; readonly tests: readonly Expr[] } {\n const tests: Expr[] = [];\n let base = axis;\n while (base.t === \"where\") {\n tests.push(base.test);\n base = base.axis;\n }\n return { base, tests };\n}\n\n/**\n * This function gives the columns that the formulas of the column `self` read with a cell reference: its formula and\n * the formulas of its cells. It also gives the directions of their reads of the column itself. A read in the body or\n * in a test of an axis also has the direction of that axis.\n */\nexport function readsOf(columns: ReadonlyMap<string, Expr>, cells: CellFormulas, self: string): { readonly columns: ReadonlySet<string>; readonly directions: ReadonlySet<Direction> } {\n const read = new Set<string>();\n const directions = new Set<Direction>();\n const formula = columns.get(self);\n // An expression that is not valid reads no column. A module gives the reason for it.\n const todo: [Expr, Axis | undefined][] = [...(formula === undefined ? [] : [formula]), ...(cells.get(self)?.values() ?? [])].filter((e) => shapeError(e) === undefined).map((e) => [e, undefined]);\n for (let item = todo.pop(); item !== undefined; item = todo.pop()) {\n const [e, axis] = item;\n if (e.tag === \"each\" || e.tag === \"fold\") {\n const { base, tests } = partsOf(e.axis);\n for (const x of [...(e.tag === \"each\" ? [e.body] : Object.values(e.step)), ...tests]) todo.push([x, base]);\n // The values of init, the result of a fold, the list of the axis list and the expressions of the address evaluate\n // at the node, so they keep the outer direction.\n const list = listOf(e.axis);\n for (const x of [...(e.tag === \"fold\" ? [...Object.values(e.init), e.result] : []), ...addrExprs(e.at), ...(list === undefined ? [] : [list])]) todo.push([x, axis]);\n } else if (e.tag !== \"ext\") {\n for (const child of children(e)) todo.push([child, axis]);\n // The data of an extension of another kind can look like a cell reference. It only changes the order of a fill.\n // Stryker disable next-line ConditionalExpression,LogicalOperator: see the comment above\n } else if (e.kind === CELL_KIND && isCellRef(e.data)) {\n read.add(e.data.column);\n // The directions of the reads of another column only change the order, because that column comes first.\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (e.data.column === self) for (const m of [...(axis === undefined ? [] : [axis]), ...e.data.at]) addDirection(directions, m);\n }\n }\n return { columns: read, directions };\n}\n\n/**\n * This function gives the columns of a sheet in an order where each column comes after the columns that it reads. The\n * columns of a cycle keep their order. The columns with formulas of cells only come last.\n */\nexport function columnOrder(columns: ReadonlyMap<string, Expr>, cells: CellFormulas): readonly string[] {\n const names = new Set([...columns.keys(), ...cells.keys()]);\n let left = [...names].map((c) => ({ c, needs: [...readsOf(columns, cells, c).columns].filter((x) => x !== c && names.has(x)) }));\n const order: string[] = [];\n const placed = new Set<string>();\n // Each pass places each column whose reads are placed. A pass that places no column leaves a cycle, so it places\n // the first column that is left.\n while (left.length > 0) {\n const ready = left.filter((x) => x.needs.every((n) => placed.has(n)));\n for (const x of ready.length > 0 ? ready : left.slice(0, 1)) {\n order.push(x.c);\n placed.add(x.c);\n }\n left = left.filter((x) => !placed.has(x.c));\n }\n return order;\n}\n\n/**\n * The order of the keys of a column, from the directions of its reads from itself. `reverse` reverses the key order. In\n * a tree, `post` puts the children before their parent, and `back` reverses the order of the siblings.\n */\nexport interface KeyOrder {\n readonly reverse: boolean;\n readonly post: boolean;\n readonly back: boolean;\n}\n\n/**\n * This function gives the order of the keys of a column. A read of a later key reverses the order. In a tree, a read of\n * the children puts the children before their parent, as `keyOrder` of `SheetRun` does.\n */\nexport function keyOrderOf(d: ReadonlySet<Direction>): KeyOrder {\n const reverse = d.has(\"after\") && !d.has(\"before\");\n const post = d.has(\"down\");\n return { reverse, post, back: post !== reverse };\n}\n","/**\n * Standalone modules (docs/COMPILER.md §4.4 and §6). `emitModule` prints a program as an ES module that has no import of\n * Vex. A host that guarantees the kinds of its input uses it without the interpreter, for example ireko at build time.\n *\n * The module gives the results of the interpreter for each input that keeps the schema. It checks the schema once, at\n * the start of a run, and an input against the schema throws a `VexContractError`. An error of Vex is a value too:\n * the run gives `VEX_ERROR` at its key.\n *\n * The printer gives statements and loops, as a person writes them. A binding is a variable, and a list op is a `for`\n * loop with a running value. An error of Vex is a thrown sentinel. A binding, `ifError` and an item of a list op catch\n * it, as in the interpreter. A node of the memo and the key of the run catch it too. Each op is the function of its\n * domain, as text, so it has the bits of the interpreter (§4.2).\n *\n * A part of the program that depends on no key of the space is a constant of the run. The module evaluates it once,\n * before the loop over the keys. A node of the memo is one function of its other keys, with a map of its values. The\n * nodes with the same expression share the function.\n *\n * The printer takes a part of the language. It takes an array space or a tree space of records, and the fields and\n * the variables of the schema. It takes the axes `all`, `others` and `window`. A tree space also has the move `parent` and the\n * axes of a tree (COMPILE.MODULE.TREE). The kinds of each op site must decide its op. Another construct gives a\n * reason, not code.\n *\n * `emitSheetModule` prints the formula columns of a sheet as one module (COMPILE.MODULE.SHEET). Each column is an array\n * of results, and the run fills the arrays in the static order of `SheetRun.fill`. A read of a cell that is not finished\n * starts the search of `SheetRun`. Thus each cell on a cycle gives the error of Vex.\n */\nimport { addrExprs, CELL_KIND, children, fromDocument, isDocument, isFieldName, lit, moveExpr, nestingOf, rec, shapeError, type AnyDomain, type Axis, type CellFormulas, type Envelope, type Expr, type ExprOf, type Move, type Names, type PrimitiveKind } from \"@mark1russell7/vex\";\nimport { factsOf, kindOfDomain, primitiveOf, type Facts, type Kind, type Schema } from \"./facts.ts\";\nimport { memoNodes } from \"./memo.ts\";\nimport { columnOrder, isCellRef, keyOrderOf, readsOf } from \"./sheet-order.ts\";\n\n/** The options of a standalone module. */\nexport interface ModuleOptions {\n readonly domains?: readonly AnyDomain[];\n /** The kinds of the fields of the records and of the variables. A module reads only the names of its schema. */\n readonly schema: Schema;\n /**\n * The name of the function that the module exports. The default is `run`. A reserved word, a name that the module\n * declares and a global that a module reads (`MODULE_GLOBALS`) are not names of the run (V-060).\n */\n readonly name?: string;\n /**\n * The space of the records. In both spaces, the key of a record is the text of its position. The default `array`\n * has no parents. A `tree` takes the parents as the third argument of the run (COMPILE.MODULE.TREE). Each entry\n * is the position of the parent of its record, or -1 for a root.\n */\n readonly space?: \"array\" | \"tree\";\n}\n\n/** The options of a module of a sheet (COMPILE.MODULE.SHEET): the options of a module, and the parts of a sheet. */\nexport interface SheetModuleOptions extends ModuleOptions {\n /** The cells with their own formula (SHEET.CELL.FORMULA). The formula of a cell replaces the formula of its column at its key. */\n readonly cells?: CellFormulas;\n /**\n * The kind of the values of each column. The printer prints each column after the columns that it reads. A column\n * that a formula reads before its own formula prints needs its kind here, for example a column that reads itself.\n */\n readonly kinds?: Readonly<Record<string, Kind>>;\n /** The budget of the stack of the search of a run, in estimated frames, as in `SheetRun`. The default is 3000. */\n readonly budget?: number;\n}\n\n/** The source of a standalone module, or the reason that the program cannot be one. */\nexport type Emitted = { readonly ok: true; readonly source: string } | { readonly ok: false; readonly reason: string };\n\n/** The error of a construct that a standalone module does not have. */\nclass NotStandalone extends Error {}\n\n/**\n * A value of the printer: its code, its kind if the printer knows it, and true when its code cannot throw. A literal,\n * a variable of the schema and a field of the schema at the focus or at the origin cannot throw.\n */\ninterface Value {\n readonly code: string;\n readonly kind: Kind | undefined;\n readonly safe: boolean;\n /** For the read of a name that can hold the error sentinel: the name itself, which holds the value or the sentinel. */\n readonly held?: string;\n /**\n * The levels of the keys that the value depends on: 1 for the key of the run, and one more for each axis around it.\n * A value with no levels is a constant of the run.\n */\n readonly deps: ReadonlySet<number>;\n /** True for a literal and for the read of a name: a constant of the run with such code needs no variable of its own. */\n readonly plain?: boolean;\n /** For a list (LIST.VALUE): the kind of its items. The code is an array of pairs of a key and a value or the sentinel. */\n readonly list?: ListInfo | undefined;\n}\n\n/** The facts of a list of the code: the kind of the values of its items, if the printer knows it. */\ninterface ListInfo {\n readonly item: Kind | undefined;\n}\n\n/** The code of a node: the statements before its value, and its value. `safe` covers the statements too. */\ninterface Code {\n readonly s: readonly string[];\n readonly v: Value;\n}\n\n/** A name of the program in the code: its variable, its kind, true when it can hold the error sentinel, and its levels. */\ninterface Name {\n readonly code: string;\n readonly kind: Kind | undefined;\n readonly lazy: boolean;\n readonly deps: ReadonlySet<number>;\n readonly list?: ListInfo | undefined;\n}\n\n/** An argument of a call: its code, its kind and its levels. */\ninterface Arg {\n readonly code: string;\n readonly kind: Kind | undefined;\n readonly deps: ReadonlySet<number>;\n}\n\n/** The levels of a constant of the run. */\nconst NO_DEPS: ReadonlySet<number> = new Set();\n\n/**\n * The level of a read of a cell (COMPILE.MODULE.SHEET). The results of the cells change in a run. Thus a value that reads\n * a cell is not a constant or a column of the run. The level is far from the other levels.\n */\nconst CELLS = -1;\n\n/** The name of the function of a run of a sheet that reads a cell: its column and its position. */\nconst READ_CELL = \"RC\";\n\n/** This pattern finds a read of a cell in the code of a value: the read, or a printed function that can read a cell. */\nconst READS_IN_CODE = /\\b(RC|fn\\d+)\\(/;\n\n/** The columns of a sheet for the printer (COMPILE.MODULE.SHEET). */\ninterface SheetInfo {\n /** The position of each column in the arrays of the run. */\n readonly columns: ReadonlyMap<string, number>;\n /** The kind of each column that the printer knows: a kind of the options, or the kind of a printed formula. */\n readonly kinds: Map<string, Kind | undefined>;\n}\n\n/** This function gives the levels of some codes together. */\nconst depsOf = (...xs: readonly Code[]): ReadonlySet<number> => new Set(xs.flatMap((x) => [...x.v.deps]));\n\n/** This function gives the statements of some codes, in order. */\nconst stmtsOf = (...xs: readonly Code[]): string[] => xs.flatMap((x) => x.s);\n\n/** This function indents some statements by one level. */\nconst ind = (xs: readonly string[]): string[] => xs.map((x) => ` ${x}`);\n\n/**\n * The lexical position of a node: the code of the index of its origin and of its focus, and its names. It also has the\n * keys of its node of the memo. A node of the memo reads neither its origin nor its focus, so these are undefined there.\n */\ninterface Ctx {\n readonly origin: string | undefined;\n readonly focus: string | undefined;\n /** The level of the focus: 1 at the key of the run, and one more in each axis. */\n readonly level: number;\n /** The level of the origin: 1 at the key of the run, and the marker of the origin in the body of a function. */\n readonly originLevel: number;\n readonly env: ReadonlyMap<string, Name>;\n readonly keys: ReadonlyMap<Expr, Name>;\n /** The bound functions (FN.BIND), with the context of their binding. */\n readonly fns: ReadonlyMap<string, BoundFn>;\n}\n\n/**\n * A bound function of the printer (FN.BIND): its node and the context of its binding. It also has one printed\n * JavaScript function for each signature of the arguments of its calls.\n */\ninterface BoundFn {\n /** The number of the binding. Two functions with one name are two functions, so a key of a constant needs it. */\n readonly id: number;\n readonly fn: ExprOf<\"fn\">;\n readonly ctx: Ctx;\n /** The printed function for each signature: the kind of each argument. */\n readonly specs: Map<string, Spec>;\n /** The declarations of the printed functions that read names of the place of the binding. The let prints them. */\n readonly decls: string[];\n /** True when a printed function of the binding is at the place of the binding, not at the start of a run. */\n local: boolean;\n}\n\n/**\n * A function that the printer prints at this time. Its parameters, and the bindings at the root of its body, keep their\n * values for the whole call. Thus a part of a loop that reads only them and its target is a column of the call.\n */\ninterface CallScope {\n /** The marker of the parameters. */\n readonly param: number;\n /** The level of the focus of the function. A part at a higher level is in a loop of the function. */\n readonly focus: number;\n /** True when the body has a loop in a loop, so a call can read a part of a loop more than once. */\n readonly repeats: boolean;\n /** The variables that the start of the body can read: the parameters, and the bindings at the root of the body. */\n readonly names: Set<string>;\n /** The declarations of the columns of the call. The function prints them at the start of its body. */\n readonly decls: string[];\n /** The root of the body. A let at the root moves it to its body, because its bindings are at the start of the body. */\n root: Expr;\n}\n\n/**\n * A printed function. The levels of the value of its body have a marker for the origin, for the focus and for each\n * parameter. A call replaces each marker with the levels at the call.\n */\ninterface Spec {\n readonly name: string;\n readonly kind: Kind | undefined;\n readonly safe: boolean;\n readonly deps: ReadonlySet<number>;\n readonly origin: number;\n readonly focus: number;\n readonly param: number;\n /** True when the body reads only constants of the run, its parameters and its position, so it is at the start of a run. */\n readonly global: boolean;\n}\n\n/** The name of a helper of the generated code. */\ntype Helper = \"F\" | \"C\" | \"T\" | \"L\" | \"Q\" | \"G\" | \"B\" | \"U\" | \"X\" | \"I\" | \"K\" | \"M\" | \"M1\" | \"S\" | \"V\" | \"SB\" | \"TK\" | \"NT\" | TreeHelper | SheetHelper;\n\n/** The helpers of a tree space (COMPILE.MODULE.TREE). */\ntype TreeHelper = \"PT\" | \"CH\" | \"SG\" | \"PR\" | \"UP\" | \"SO\" | \"AN\" | \"BF\";\n\n/** The helpers of a sheet (COMPILE.MODULE.SHEET): the state of a run of a sheet, and the order of the keys of a tree. */\ntype SheetHelper = \"SH\" | \"KO\";\n\n/** The helpers of the generated code. A module has only the helpers that it uses. */\nconst HELPERS: Readonly<Record<Exclude<Helper, \"S\">, string>> = {\n F: \"function F() { throw E; }\",\n C: \"function C(m) { throw new VexContractError(m); }\",\n // An exception of an op is an error of Vex too, as in the interpreter. Only the checks of the contract throw a\n // VexContractError, and they come before the run, so each catch of the run gives the sentinel.\n T: \"function T(f) { try { return f(); } catch { return E; } }\",\n // A constant of the run with a loop evaluates on its first read, so a loop in a branch that no run takes costs nothing.\n L: \"function L(f) { let done = false, v; return () => { if (!done) { done = true; try { v = f(); } catch { v = E; } } return v; }; }\",\n // A column of the run: the value of an expression at each record, on its first read.\n Q: \"function Q(f) { const m = []; return (j) => { let v = m[j]; if (v === undefined) { try { v = f(j); } catch { v = E; } m[j] = v; } return v; }; }\",\n G: \"function G(x) { return x === E ? F() : x; }\",\n B: 'function B(x) { return typeof x === \"boolean\" ? x : F(); }',\n U: 'function U(x) { return typeof x === \"number\" ? x : F(); }',\n X: \"function X(t, n) { return t >= 0 && t < n ? t : F(); }\",\n // The index of a computed position, and of a computed key: a key of an array space is the text of its index.\n I: \"function I(t, n) { return Number.isInteger(t) && t >= 0 && t < n ? t : F(); }\",\n K: 'function K(k, n) { return typeof k === \"string\" && /^(0|[1-9]\\\\d*)$/.test(k) && +k < n ? +k : F(); }',\n // The ops on the order of a list (LIST.SORT, LIST.TAKE, LIST.NTH) work on the items with values. With strict, an\n // error item is the error of the op. A sort is stable, and the values are numbers without NaN or texts of one kind.\n V: \"function V(l, s) { if (s && l.some((x) => x[1] === E)) F(); return l.filter((x) => x[1] !== E); }\",\n SB: [\n \"function SB(l, s) {\",\n \" const o = V(l, s);\",\n \" const t = o.length > 0 ? typeof o[0][1] : \\\"number\\\";\",\n \" for (const [, v] of o) if (typeof v !== t || (t !== \\\"number\\\" && t !== \\\"string\\\") || v !== v) F();\",\n \" return o.sort((a, b) => (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0));\",\n \"}\",\n ].join(\"\\n\"),\n TK: \"function TK(l, n, s) { const o = V(l, s); return Number.isSafeInteger(n) && n >= 0 ? o.slice(0, n) : F(); }\",\n NT: \"function NT(l, i, s) { const o = V(l, s); return Number.isSafeInteger(i) && i >= 0 && i < o.length ? o[i][1] : F(); }\",\n // The parents of a tree space: the position of the parent of each record, or -1 for a root. A walk up from each record\n // marks its keys, so a walk that meets a key of the same walk finds a cycle. Each key is in one walk, so the check is linear.\n PT: [\n \"function PT(p, n) {\",\n ' if (!Array.isArray(p) || p.length !== n) C(\"the parents are not an array with one parent for each record\");',\n \" const P = new Int32Array(n), s = new Uint8Array(n);\",\n \" for (let i = 0; i < n; i++) {\",\n \" const x = p[i];\",\n \" if (x !== -1 && !(Number.isInteger(x) && x >= 0 && x < n)) C(`the parent of the record ${i} is not -1 or the position of a record`);\",\n \" P[i] = x;\",\n \" }\",\n \" for (let i = 0; i < n; i++) {\",\n \" let k = i;\",\n \" while (k >= 0 && s[k] === 0) {\",\n \" s[k] = 1;\",\n \" k = P[k];\",\n \" }\",\n \" if (k >= 0 && s[k] === 1) C(`the parents of the record ${i} make a cycle`);\",\n \" for (k = i; k >= 0 && s[k] === 1; k = P[k]) s[k] = 2;\",\n \" }\",\n \" return P;\",\n \"}\",\n ].join(\"\\n\"),\n // The children of each record and the roots, in key order.\n CH: [\n \"function CH(P, n) {\",\n \" const h = [], r = [];\",\n \" for (let i = 0; i < n; i++) h.push([]);\",\n \" for (let i = 0; i < n; i++) (P[i] < 0 ? r : h[P[i]]).push(i);\",\n \" return [h, r];\",\n \"}\",\n ].join(\"\\n\"),\n // The siblings of each record with the record itself, and its position among them. The roots are the siblings of a root.\n SG: [\n \"function SG(P, h, r, n) {\",\n \" const g = [], s = new Int32Array(n);\",\n \" for (let i = 0; i < n; i++) g.push(P[i] < 0 ? r : h[P[i]]);\",\n \" for (const x of [r, ...h]) for (let q = 0; q < x.length; q++) s[x[q]] = q;\",\n \" return [g, s];\",\n \"}\",\n ].join(\"\\n\"),\n // The keys depth first, with each parent before its children, and the position and the size of the subtree of each\n // record. Thus the descendants of a record are the keys after it, as many as its subtree has under it.\n PR: [\n \"function PR(h, r, n) {\",\n \" const o = [], at = new Int32Array(n), z = new Int32Array(n), st = [];\",\n \" for (let q = r.length - 1; q >= 0; q--) st.push(r[q]);\",\n \" while (st.length > 0) {\",\n \" const k = st.pop();\",\n \" at[k] = o.length;\",\n \" o.push(k);\",\n \" for (let q = h[k].length - 1; q >= 0; q--) st.push(h[k][q]);\",\n \" }\",\n \" for (let q = n - 1; q >= 0; q--) {\",\n \" const k = o[q];\",\n \" z[k] = 1;\",\n \" for (const c of h[k]) z[k] += z[c];\",\n \" }\",\n \" return [o, at, z];\",\n \"}\",\n ].join(\"\\n\"),\n UP: \"function UP(P, k) { const p = P[k]; return p < 0 ? F() : p; }\",\n SO: \"function SO(g, s, k, d) { const t = g[k][s[k] + d]; return t === undefined ? F() : t; }\",\n AN: \"function AN(P, k) { const o = []; for (let p = P[k]; p >= 0; p = P[p]) o.push(p); return o; }\",\n // The record and the keys under it, in the order of a breadth-first search. A tree has no cycle, so no key comes twice.\n BF: \"function BF(h, k) { const o = [k]; for (let i = 0; i < o.length; i++) for (const c of h[o[i]]) o.push(c); return o; }\",\n // The state of a run of a sheet (COMPILE.MODULE.SHEET), as in SheetRun: the result of each finished cell, the search\n // of Tarjan with its stack, and the budget of the stack. `r` reads a cell, `f` fills a cell, and `o` gives a column.\n // A cell without a formula has the error sentinel from the start, as the error of its read.\n SH: [\n \"function SH(n, cols, own, budget) {\",\n \" const pg = (c, k) => {\",\n \" const o = own[c];\",\n \" const g = o === undefined ? undefined : o[k];\",\n \" return g === undefined ? cols[c] : g;\",\n \" };\",\n \" const D = [];\",\n \" for (let c = 0; c < cols.length; c++) {\",\n \" const d = new Array(n);\",\n \" for (let k = 0; k < n; k++) if (pg(c, k) === undefined) d[k] = E;\",\n \" D.push(d);\",\n \" }\",\n \" const seen = new Map(), stack = [], FILL = {};\",\n \" let top = FILL, missed = false, next = 0, used = 0;\",\n \" const start = (c, k) => {\",\n \" const i = next++;\",\n \" const v = { id: c * n + k, c, k, i, low: i, re: false, r: E, p: false, need: undefined };\",\n \" seen.set(v.id, v);\",\n \" stack.push(v);\",\n \" return v;\",\n \" };\",\n \" const ev = (v, g) => {\",\n \" const caller = top;\",\n \" v.p = false;\",\n \" v.need = undefined;\",\n \" top = v;\",\n \" used += g[1];\",\n \" const x = g[0](v.k);\",\n \" used -= g[1];\",\n \" top = caller;\",\n \" if (!v.p) v.r = x;\",\n \" };\",\n \" const end = (v, caller) => {\",\n \" if (v.low === v.i) {\",\n \" const ms = stack.splice(stack.lastIndexOf(v));\",\n \" const cycle = ms.length > 1 || v.re;\",\n \" for (const m of ms) {\",\n \" seen.delete(m.id);\",\n \" D[m.c][m.k] = cycle ? E : m.r;\",\n \" }\",\n \" } else if (caller !== undefined) caller.low = Math.min(caller.low, v.low);\",\n \" };\",\n \" const r = (c, k) => {\",\n \" const d = D[c][k];\",\n \" if (d !== undefined) return d;\",\n \" const caller = top;\",\n \" if (caller === FILL) {\",\n \" missed = true;\",\n \" return E;\",\n \" }\",\n \" if (caller.p) return E;\",\n \" const s = seen.get(c * n + k);\",\n \" if (s !== undefined) {\",\n \" caller.low = Math.min(caller.low, s.i);\",\n \" s.re = true;\",\n \" return E;\",\n \" }\",\n \" const g = pg(c, k);\",\n \" const v = start(c, k);\",\n \" if (used + g[1] > budget) {\",\n \" caller.p = true;\",\n \" caller.need = v;\",\n \" return E;\",\n \" }\",\n \" ev(v, g);\",\n \" if (v.p) {\",\n \" caller.p = true;\",\n \" caller.need = v;\",\n \" return E;\",\n \" }\",\n \" end(v, caller);\",\n \" const x = D[c][k];\",\n \" return x === undefined ? E : x;\",\n \" };\",\n \" const drive = (c, k) => {\",\n \" const work = [start(c, k)];\",\n \" for (let v = work[0]; v !== undefined; v = work[work.length - 1]) {\",\n \" ev(v, pg(v.c, v.k));\",\n \" if (v.p) {\",\n \" for (let q = v.need; q !== undefined; q = q.need) work.push(q);\",\n \" continue;\",\n \" }\",\n \" work.pop();\",\n \" end(v, work[work.length - 1]);\",\n \" }\",\n \" };\",\n \" const f = (c, k) => {\",\n \" if (D[c][k] !== undefined) return;\",\n \" missed = false;\",\n \" const x = pg(c, k)[0](k);\",\n \" if (missed) drive(c, k);\",\n \" else D[c][k] = x;\",\n \" };\",\n \" const o = (c) => {\",\n \" const d = D[c], out = [];\",\n \" for (let k = 0; k < n; k++) out.push(d[k] === E ? VEX_ERROR : d[k]);\",\n \" return out;\",\n \" };\",\n \" return { r, f, o };\",\n \"}\",\n ].join(\"\\n\"),\n // The keys of a tree in the order of a fill (SHEET.FILL): each parent before its children, or after them with `post`.\n // `back` reverses the order of the siblings.\n KO: [\n \"function KO(h, r, post, back) {\",\n \" const o = [], st = [];\",\n \" const push = (x) => {\",\n \" if (back) for (let q = 0; q < x.length; q++) st.push(x[q]);\",\n \" else for (let q = x.length - 1; q >= 0; q--) st.push(x[q]);\",\n \" };\",\n \" push(r);\",\n \" while (st.length > 0) {\",\n \" const k = st.pop();\",\n \" o.push(k);\",\n \" push(h[k]);\",\n \" }\",\n \" return post ? o.reverse() : o;\",\n \"}\",\n ].join(\"\\n\"),\n // The memo of a function of one key, and of more keys. -0 has its own entry, because an op can tell it from 0.\n M1: [\n \"function M1(f) {\",\n \" const m = new Map();\",\n \" return (k) => {\",\n \" const s = Object.is(k, -0) ? Z : k;\",\n \" let r = m.get(s);\",\n \" if (r === undefined) {\",\n \" try { r = f(k); } catch { r = E; }\",\n \" m.set(s, r);\",\n \" }\",\n \" return G(r);\",\n \" };\",\n \"}\",\n ].join(\"\\n\"),\n M: [\n \"function M(f) {\",\n \" const root = new Map();\",\n \" return (...k) => {\",\n \" let m = root;\",\n \" for (const x of k.slice(0, -1)) {\",\n \" const s = Object.is(x, -0) ? Z : x;\",\n \" let c = m.get(s);\",\n \" if (c === undefined) m.set(s, (c = new Map()));\",\n \" m = c;\",\n \" }\",\n \" const last = k.at(-1);\",\n \" const s = Object.is(last, -0) ? Z : last;\",\n \" let r = m.get(s);\",\n \" if (r === undefined) {\",\n \" try { r = f(...k); } catch { r = E; }\",\n \" m.set(s, r);\",\n \" }\",\n \" return G(r);\",\n \" };\",\n \"}\",\n ].join(\"\\n\"),\n};\n\n/**\n * This list has the globals of JavaScript that the code of a module reads. This code is the helpers, the run and the\n * copies of the ops of the test domains. A test reads the text of the modules of the golden files and checks this list (V-060).\n */\nexport const MODULE_GLOBALS: ReadonlySet<string> = new Set(\"Array Error Int32Array Map Math Number Object Uint8Array undefined\".split(\" \"));\n\n/** A part of the helper S that only some nodes need (helperS). */\ntype Feature = \"group\" | \"prefix\" | \"strict\" | \"ok\" | \"pre\";\n\n/**\n * This function gives the code of the helper S, a node of the memo that keeps its items (Printer.#cached). The helper\n * has only the parts that the nodes of the module need:\n *\n * - `group`: the groups of the values of the key (mode 1).\n * - `prefix`: the prefixes of the items (mode 2).\n * - `strict`: the option strict of a list op.\n * - `ok`: the check of the kind of a value.\n * - `pre`: the tests before the test of the key.\n *\n * The node gives `key` for the value of each item, and `val` for the value of an item from its index. It gives `test`\n * for the test of the key.\n */\nconst helperS = (has: ReadonlySet<Feature>): string => {\n const on = (f: Feature, ...lines: readonly string[]): readonly string[] => (has.has(f) ? lines : []);\n const strict = has.has(\"strict\");\n const ok = has.has(\"ok\");\n // The items that end the lookup with an error, and the items that the lookup skips.\n const fails = [...(strict ? [\"x === E\"] : []), ...(ok ? [\"x === W\"] : [])].join(\" || \");\n const skips = strict ? \"x === N || (x === E && !strict)\" : \"x === N || x === E\";\n return [\n \"function S(n, mode, strict, a0, step, result, key, val, test, pre, ok) {\",\n \" let ts, js, xs, bad, reach, gs, mono, pa, pc, pe;\",\n \" const value = (i) => {\",\n \" let x = xs[i];\",\n \" if (x === undefined) {\",\n \" x = val(js[i]);\",\n ...on(\"ok\", \" if (ok && x !== E && x !== N && !ok(x)) x = W;\"),\n \" xs[i] = x;\",\n \" }\",\n \" return x;\",\n \" };\",\n \" return M1((q) => {\",\n \" if (ts === undefined) {\",\n \" ts = [];\",\n \" js = [];\",\n \" xs = [];\",\n ...on(\"strict\", \" bad = false;\", \" reach = 0;\"),\n \" for (let j = 0; j < n; j++) {\",\n \" try {\",\n ...on(\"pre\", \" if (pre && !pre(j)) continue;\"),\n ...on(\"strict\", \" reach++;\"),\n \" const t = key(j);\",\n // NaN satisfies no test of a group or of a prefix, so its item is in none.\n \" if (mode && t !== t) continue;\",\n \" ts.push(t);\",\n \" js.push(j);\",\n \" } catch {\",\n ...on(\"strict\", \" bad = true;\"),\n \" }\",\n \" }\",\n ...on(\"group\", \" if (mode === 1) {\", \" gs = new Map();\", \" for (let i = 0; i < ts.length; i++) {\", \" let g = gs.get(ts[i]);\", \" if (g === undefined) gs.set(ts[i], (g = []));\", \" g.push(i);\", \" }\", \" }\"),\n ...on(\"prefix\", \" if (mode === 2) {\", \" mono = true;\", \" for (let i = 1; i < ts.length; i++) if (!(ts[i - 1] <= ts[i])) mono = false;\", \" pa = [a0];\", \" pc = [0];\", \" pe = [false];\", \" }\"),\n \" }\",\n // A key with an error makes an error item of each item that reaches the test of the key.\n strict ? \" if (q === E) return strict && (bad || reach > 0) ? F() : result(a0, 0);\" : \" if (q === E) return result(a0, 0);\",\n ...on(\"strict\", \" if (strict && bad) F();\"),\n \" let a = a0, c = 0;\",\n \" const add = (i) => {\",\n \" const x = value(i);\",\n ` if (${skips}) return;`,\n ...(fails === \"\" ? [] : [` if (${fails}) F();`]),\n \" a = step(a, c, x);\",\n \" c++;\",\n \" };\",\n ...on(\"group\", \" if (mode === 1) {\", \" const g = gs.get(q);\", \" if (g !== undefined) for (const i of g) add(i);\", \" return result(a, c);\", \" }\"),\n // The values t do not decrease, so the items whose test is true are a prefix. Each prefix keeps its running value.\n ...on(\n \"prefix\",\n \" if (mode === 2 && mono) {\",\n \" let lo = 0, hi = ts.length;\",\n \" while (lo < hi) {\",\n \" const h = (lo + hi) >> 1;\",\n \" if (test(ts[h], q)) lo = h + 1;\",\n \" else hi = h;\",\n \" }\",\n \" for (let i = pa.length - 1; i < lo; i++) {\",\n \" let x = value(i), b = pa[i], d = pc[i], err = pe[i];\",\n ...(fails === \"\" ? [\" if (x !== N && x !== E) {\"] : [` if (${fails.replace(\"x === E\", \"(x === E && strict)\")}) err = true;`, \" else if (x !== N && x !== E) {\"]),\n \" b = step(b, d, x);\",\n \" d++;\",\n \" }\",\n \" pa.push(b);\",\n \" pc.push(d);\",\n \" pe.push(err);\",\n \" }\",\n \" if (pe[lo]) F();\",\n \" return result(pa[lo], pc[lo]);\",\n \" }\",\n ),\n \" for (let i = 0; i < ts.length; i++) if (test(ts[i], q)) add(i);\",\n \" return result(a, c);\",\n \" });\",\n \"}\",\n ].join(\"\\n\");\n};\n\n/** The step of the running value of first and of count: the name of its function in a module, and its code. */\nconst FIRST_STEP: readonly [string, string] = [\"s_first\", \"(a, c, x) => (c === 0 ? x : a)\"];\n\n/** The step of the running value of each list op: the name of its function in a module, and its code. */\nconst STEPS: Readonly<Record<string, readonly [string, string]>> = {\n count: FIRST_STEP,\n first: FIRST_STEP,\n sum: [\"s_add\", \"(a, c, x) => a + x\"],\n mean: [\"s_add\", \"(a, c, x) => a + x\"],\n min: [\"s_min\", \"(a, c, x) => (c === 0 ? x : Math.min(a, x))\"],\n max: [\"s_max\", \"(a, c, x) => (c === 0 ? x : Math.max(a, x))\"],\n any: [\"s_or\", \"(a, c, x) => a || x\"],\n none: [\"s_or\", \"(a, c, x) => a || x\"],\n all: [\"s_and\", \"(a, c, x) => a && x\"],\n};\n\n/** The helpers that each helper uses. */\nconst NEEDS: Readonly<Record<Helper, readonly Helper[]>> = {\n F: [], C: [], T: [], L: [], Q: [], G: [\"F\"], B: [\"F\"], U: [\"F\"], X: [\"F\"], I: [\"F\"], K: [\"F\"], M: [\"G\"], M1: [\"G\"], S: [\"M1\", \"F\"],\n // Only SB, TK and NT use V, and they need F too, so the need of V only completes the list.\n // Stryker disable next-line ArrayDeclaration: see the comment above\n V: [\"F\"],\n SB: [\"V\", \"F\"], TK: [\"V\", \"F\"], NT: [\"V\", \"F\"],\n // Each module has C, and each move uses F (#move), so these needs only complete the list.\n // Stryker disable next-line ArrayDeclaration: see the comment above\n PT: [\"C\"], UP: [\"F\"], SO: [\"F\"],\n CH: [], SG: [], PR: [], AN: [], BF: [],\n SH: [], KO: [],\n};\n\n/** The parts of a tree that a run computes before the loop over its keys, if the program needs them. */\ntype TreePart = \"children\" | \"siblings\" | \"order\";\n\n/** The statement of each part of a tree in a run, with the helper that computes it. */\nconst TREE_PARTS: Readonly<Record<TreePart, readonly [TreeHelper, string]>> = {\n children: [\"CH\", \"const [H, RT] = CH(P, n);\"],\n siblings: [\"SG\", \"const [GP, SI] = SG(P, H, RT, n);\"],\n order: [\"PR\", \"const [PO, PI, SZ] = PR(H, RT, n);\"],\n};\n\n/** An axis whose targets in a tree space are a range of an array of positions: an axis of a tree, or a window. */\ntype TreeAxis = Extract<Axis, { readonly t: \"children\" | \"ancestors\" | \"descendants\" | \"siblings\" | \"successors\" | \"predecessors\" | \"reachable\" | \"window\" }>;\n\n/** The axes of a tree space in a module, and the axes that a module of an array space does not have. */\nconst TREE_AXES: ReadonlySet<string> = new Set([\"children\", \"ancestors\", \"descendants\", \"siblings\", \"successors\", \"predecessors\", \"reachable\"]);\n\n/** This function tells if an axis has its targets in a range of an array of positions in a tree space. */\nconst isTreeAxis = (a: Axis): a is TreeAxis => a.t === \"window\" || TREE_AXES.has(a.t);\n\n/**\n * The targets of an axis of a tree space: the statements before the loop, and the positions `a[q]` for `q` from `lo` up\n * to `hi`. The loop skips the key `skip`.\n */\ninterface TreeRange {\n readonly s: readonly string[];\n readonly a: string;\n readonly lo: string;\n readonly hi: string;\n readonly skip: string | undefined;\n}\n\n/** The list ops of a standalone module. */\nconst LIST_OPS: ReadonlySet<string> = new Set([\"count\", \"sum\", \"mean\", \"min\", \"max\", \"any\", \"all\", \"none\", \"first\"]);\nconst NUMBER_LIST_OPS: ReadonlySet<string> = new Set([\"count\", \"sum\", \"mean\", \"min\", \"max\"]);\nconst BOOLEAN_LIST_OPS: ReadonlySet<string> = new Set([\"any\", \"all\", \"none\"]);\n/** The list ops that build a list from lists (LIST.BUILD), and `get` (LIST.GET). A module gives a reason for them. */\nconst BUILD_OPS: ReadonlySet<string> = new Set([\"drop\", \"append\", \"flat\", \"without\", \"get\"]);\n\n/** This function tells if the step of a list op throws for a value of the kind `kind`, which is the wrong kind. */\nconst stepThrows = (op: string, kind: Kind | undefined): boolean => (NUMBER_STEPS.has(op) && kind !== \"number\") || (BOOLEAN_LIST_OPS.has(op) && kind !== \"boolean\");\n\n/** The list ops whose step takes a number. */\nconst NUMBER_STEPS: ReadonlySet<string> = new Set([\"sum\", \"mean\", \"min\", \"max\"]);\n\n/** This function gives the kind of the result of a list op: first gives the kind of its items. */\nconst listKind = (op: string, item: Kind | undefined): Kind | undefined => (NUMBER_LIST_OPS.has(op) ? \"number\" : BOOLEAN_LIST_OPS.has(op) ? \"boolean\" : item);\n\nconst LOOPS = new WeakMap<Expr, boolean>();\n\n/** This function gives the names that an expression reads, also the names that it binds itself. */\nfunction namesOf(e: Expr, out = new Set<string>()): Set<string> {\n if (e.tag === \"var\") out.add(e.name);\n for (const x of children(e)) namesOf(x, out);\n return out;\n}\n\n/**\n * The smallest work of an expression in a column of the run. The work is the number of nodes. A node of the memo and a\n * constant of the run count as one node each. A part with less work costs less than the read of its column.\n */\nconst COLUMN_WORK = 10;\n\n/** This function gives the head of a loop over targets: from `lo` up to `hi`, or from `hi` down to `lo` in the reverse order. */\nconst forHead = (j: string, lo: string, hi: string, reverse: boolean): string => (reverse ? `for (let ${j} = ${hi} - 1; ${j} >= ${lo}; ${j}--) {` : `for (let ${j} = ${lo}; ${j} < ${hi}; ${j}++) {`);\n\n/** This function tells if an expression has a loop in a loop: an axis, a fold or an iteration in another one. */\nfunction nestsLoops(e: Expr, inLoop = false): boolean {\n const loop = e.tag === \"each\" || e.tag === \"fold\" || e.tag === \"iterate\";\n return (loop && inLoop) || children(e).some((x) => nestsLoops(x, inLoop || loop));\n}\n\n/** This function tells if an expression has a loop of names: a fold or an iteration. */\nfunction hasLoop(e: Expr): boolean {\n let found = LOOPS.get(e);\n if (found === undefined) {\n found = e.tag === \"fold\" || e.tag === \"iterate\" || children(e).some(hasLoop);\n LOOPS.set(e, found);\n }\n return found;\n}\n\n/**\n * This function tells if a node of the memo has a loop of its own. Such a loop is outside its keys and outside the nodes\n * of the memo in it. A node without one combines the values of other nodes, and a function of its own only costs time.\n */\nfunction ownLoop(e: Expr, root: Expr, memo: ReadonlyMap<Expr, readonly Expr[]>, keys: ReadonlySet<Expr>): boolean {\n if (e !== root && (memo.has(e) || keys.has(e))) return false;\n return e.tag === \"each\" || children(e).some((x) => ownLoop(x, root, memo, keys));\n}\n\n/** This function gives the nodes of the memo of an expression that have a loop of their own, with their keys. */\nfunction memoOf(expr: Expr): ReadonlyMap<Expr, readonly Expr[]> {\n const all = memoNodes(expr);\n return new Map([...all].filter(([e, keys]) => ownLoop(e, e, all, new Set(keys))));\n}\n\n/** This function tells if an expression contains the expression `x`, the same object. */\nfunction contains(e: Expr, x: Expr): boolean {\n return e === x || children(e).some((c) => contains(c, x));\n}\n\n/** This function gives the base of an axis and its tests in the order of evaluation. */\nfunction testsOf(axis: Axis): { readonly base: Axis; readonly tests: readonly Expr[] } {\n const tests: Expr[] = [];\n let base = axis;\n while (base.t === \"where\") {\n tests.unshift(base.test);\n base = base.axis;\n }\n return { base, tests };\n}\n\n/**\n * This function gives the parts of a test `and`, and of each part that is a test `and` too. `and` stops at the first\n * `false`, as a chain of tests does, and each part must be a boolean.\n */\nfunction partsOf(t: Expr): readonly Expr[] {\n return t.tag === \"app\" && t.op === \"and\" && t.args.length > 0 ? t.args.flatMap(partsOf) : [t];\n}\n\n/** This function gives the kind of two values in the branches of a form, if they have the same kind. */\nconst join = (a: Kind | undefined, b: Kind | undefined): Kind | undefined => (a === b ? a : undefined);\n\n/** This function gives a value that is a constant of the run, with plain code. */\nconst plainValue = (code: string, kind: Kind | undefined): Value => ({ code, kind, safe: true, deps: NO_DEPS, plain: true });\n\n/** This function gives the code of a value with no statements. */\nconst bare = (v: Value): Code => ({ s: [], v });\n\n/** This function gives the code of a literal. A value that is not a finite number, a text, a boolean or null has no code. */\nfunction literal(value: unknown): Value {\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) throw new NotStandalone(\"a literal is a number that is not finite\");\n return plainValue(Object.is(value, -0) ? \"-0\" : String(value), \"number\");\n }\n if (typeof value === \"string\") return plainValue(JSON.stringify(value), \"string\");\n if (typeof value === \"boolean\") return plainValue(String(value), \"boolean\");\n if (value === null) return plainValue(\"null\", undefined);\n throw new NotStandalone(\"a literal is not a number, a text, a boolean or null\");\n}\n\n/**\n * This function gives a text that is the same for two expressions with the same structure. -0 is not 0. A part with a\n * token gives the token, so the text does not depend on that part. A token is an object, and a literal of a module is\n * not, so a token is not the text of a literal.\n */\nfunction canonical(e: Expr, token: (x: unknown) => object | undefined): string {\n return JSON.stringify(e, (_name, x: unknown) => token(x) ?? (Object.is(x, -0) ? { \"-0\": 0 } : x));\n}\n\n/** The values of each kind that `copied` gives to a function and to its copy. */\nconst SAMPLES: Readonly<Record<PrimitiveKind, readonly unknown[]>> = {\n number: [0, 1, -1, 2.5, -0, 1e300, -7],\n string: [\"\", \"a\", \"ab c\"],\n boolean: [true, false],\n};\n\n/** This function gives each list of arguments with one sample of each parameter, from the samples of each parameter. */\nfunction samples(each: readonly (readonly unknown[])[]): readonly (readonly unknown[])[] {\n return each.reduce<readonly (readonly unknown[])[]>((acc, values) => acc.flatMap((xs) => values.map((x) => [...xs, x])), [[]]);\n}\n\n/** This function gives the text of plain data, with -0 apart from 0. */\nconst dataText = (x: unknown): string => canonical(x as Expr, () => undefined);\n\n/** This function tells if two values are the same: the same primitive, or plain data with the same structure. */\nfunction same(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (typeof a !== \"object\" || a === null || typeof b !== \"object\" || b === null || Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;\n return dataText(a) === dataText(b);\n}\n\n/** This function gives the value of a call, or that it threw. */\nfunction call(f: () => unknown): { readonly threw: boolean; readonly value?: unknown } {\n try {\n return { threw: false, value: f() };\n } catch {\n return { threw: true };\n }\n}\n\n/** This function tells if two calls give the same: the same value, or an exception in both. */\nfunction sameCall(a: () => unknown, b: () => unknown): boolean {\n const x = call(a);\n const y = call(b);\n return x.threw === y.threw && same(x.value, y.value);\n}\n\n/**\n * This function gives the source of a function of a domain, for a copy in a module. The source must be an expression:\n * the source of a native function or of a method does not compile as one. A copy must give the values of the function:\n * a function that reads a name outside itself gives an exception in the copy. Thus the copy and the function must give\n * the same for the samples of their kinds.\n */\nfunction copied(f: (...a: never[]) => unknown, each: readonly (readonly unknown[])[], what: string): string {\n const src = Function.prototype.toString.call(f);\n let copy: (...a: unknown[]) => unknown;\n try {\n // oxlint-disable-next-line typescript/no-implied-eval -- the source is the source of a function of a domain.\n const make = new Function(`\"use strict\"; return (${src});`) as () => (...a: unknown[]) => unknown;\n copy = make();\n } catch {\n throw new NotStandalone(`${what} has no source that a module can copy`);\n }\n const fn = f as (...a: unknown[]) => unknown;\n if (!samples(each).every((xs) => sameCall(() => fn(...xs), () => copy(...xs)))) throw new NotStandalone(`${what} reads a name outside itself, so a module cannot copy it`);\n return src;\n}\n\n/** The functions that an inline form can use. They do not throw for numbers. */\nconst CALLS: ReadonlySet<string> = new Set([\n \"Math.abs\",\n \"Math.ceil\",\n \"Math.floor\",\n \"Math.round\",\n \"Math.trunc\",\n \"Math.sign\",\n \"Math.sqrt\",\n \"Math.cbrt\",\n \"Math.exp\",\n \"Math.log\",\n \"Math.log10\",\n \"Math.log2\",\n \"Math.min\",\n \"Math.max\",\n \"Math.pow\",\n \"Math.hypot\",\n \"Math.sin\",\n \"Math.cos\",\n \"Math.tan\",\n \"Math.atan2\",\n \"Number.isFinite\",\n]);\n\n/** The inline form of a function of an op: its parameters, and its body with a hole for each use of a parameter. */\ninterface InlineForm {\n readonly params: readonly string[];\n /** The parts of the body, and between two parts the index of a parameter. */\n readonly parts: readonly (string | number)[];\n /** The number of uses of each parameter. */\n readonly uses: readonly number[];\n}\n\n/**\n * The tokens of the text between the names of an inline form: digits, spaces, operators and parentheses. The tokenizer\n * takes the first token that matches at each position, as the tokenizer of JavaScript takes the longest operator. So\n * `<<=`, `>>=` and `>>>=` leave a lone `=`, and an assignment stops the inline form (V-058).\n */\nconst TOKEN = /\\d|\\.\\d|\\s|===?|!==?|<<|>>>?|<=|>=|[+\\-*/%<>!?:(),&|^~]/y;\n\n/**\n * This function tells if a text is a sequence of tokens. It takes one token at each step, so its time is linear in the\n * length of the text. A repeated group of the tokens can split `!==` in two ways, and its time is exponential (V-057).\n */\nfunction isTokens(t: string): boolean {\n TOKEN.lastIndex = 0;\n while (TOKEN.lastIndex < t.length) if (!TOKEN.test(t)) return false;\n return true;\n}\n\n/**\n * This function gives the inline form of the source of an arrow function. The body of the function must be an\n * expression of operators, numbers, its parameters and the functions of `CALLS`. Such a body cannot throw for primitive\n * values (§7.1). The inline form is the text of the function itself, so it has its bits.\n */\nfunction inlineForm(src: string): InlineForm | undefined {\n const m = /^\\(?\\s*((?:[A-Za-z_$][\\w$]*\\s*,\\s*)*[A-Za-z_$][\\w$]*)\\s*\\)?\\s*=>\\s*([\\s\\S]*)/.exec(src);\n if (m === null) return undefined;\n const params = (m[1] as string).split(\",\").map((x) => x.trim());\n const parts: (string | number)[] = [];\n const uses = params.map(() => 0);\n let text = \"\";\n // The even parts are the text between the names: numbers, operators and parentheses. An assignment, a call of a value\n // and another character, for example a quote, stop the inline form.\n const split = (m[2] as string).split(/([A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)?)/);\n for (const [i, t] of split.entries()) {\n if (i % 2 === 0) {\n if (!isTokens(t) || /\\+\\+|--|\\)\\s*\\(/.test(t)) return undefined;\n text += t;\n } else if (CALLS.has(t)) text += t;\n else {\n const p = params.indexOf(t);\n if (p < 0 || /^\\s*\\(/.test(split[i + 1] as string)) return undefined;\n parts.push(text, p);\n text = \"\";\n uses[p] = (uses[p] as number) + 1;\n }\n }\n parts.push(text);\n return { params, parts, uses };\n}\n\n/** This function gives the text of an inline form without spaces, with `#i` for the parameter `at(i)`. */\nconst patternOf = (form: InlineForm, at: (p: number) => number): string => form.parts.map((p) => (typeof p === \"number\" ? `#${at(p)}` : p.replaceAll(/\\s/g, \"\"))).join(\"\");\n\n/** The reserved words of the strict code of a module, and the two names that strict code does not bind. */\nconst RESERVED: ReadonlySet<string> = new Set(\n \"await break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield arguments eval\".split(\" \"),\n);\n\n/**\n * This function gives the reason that a name cannot be the name of the run, or `undefined` for a good name (V-060). A\n * reserved word does not parse, and a second declaration of a name of the module does not parse. The function of the\n * run with the name of a global of `MODULE_GLOBALS` hides that global from the code of the module.\n */\nfunction nameReason(name: string, declared: ReadonlySet<string>): string | undefined {\n if (RESERVED.has(name)) return `the name \"${name}\" is a reserved word of JavaScript`;\n if (MODULE_GLOBALS.has(name)) return `the name \"${name}\" is a global that a module reads`;\n return declared.has(name) ? `the name \"${name}\" is a name of the module` : undefined;\n}\n\nclass Printer {\n readonly #facts: Facts;\n readonly #domains: readonly AnyDomain[];\n readonly #schema: Schema;\n readonly #memo: ReadonlyMap<Expr, readonly Expr[]>;\n readonly helpers = new Set<Helper>();\n /** The declarations at the top of the module: the functions of the domains and the checks of the results. */\n readonly top = new Map<string, string>();\n /** The statements at the start of a run: the constants of the run and the functions of the memo. */\n readonly run: string[] = [];\n /** The variables of the schema that the program reads. */\n readonly vars = new Map<string, string>();\n /** True when the module has a node of the memo, so it needs the key of -0. */\n memos = false;\n /** The parts of the helper S that the nodes of the memo that keep their items need (helperS). */\n readonly features = new Set<Feature>();\n /** True for a tree space, and the parts of the tree that the program reads (COMPILE.MODULE.TREE). */\n readonly #tree: boolean;\n readonly treeParts = new Set<TreePart>();\n /** The columns of a sheet, for a module of a sheet (COMPILE.MODULE.SHEET). */\n readonly #sheet: SheetInfo | undefined;\n #names = 0;\n /** The number of the next bound function, and of the next printed function. */\n #fnIds = 0;\n #printed = 0;\n /** The level of the names of the next loop. It is far above the levels of the axes, so the two do not meet. */\n #loops = 1_000_000;\n /** The node of the memo whose function the printer prints, so it prints the node itself. */\n #inside: Expr | undefined;\n readonly #structures = new Map<string, string>();\n readonly #kinds = new Map<string, Kind | undefined>();\n readonly #ops = new Map<string, number>();\n /** The inline form of each function of an op, or undefined for a function that the module calls. */\n readonly #forms = new Map<string, InlineForm | undefined>();\n /** The functions of ops that the module calls, not in an inline form. */\n readonly #called = new Set<string>();\n /** The key of the expression of each code that is a constant of the run, and the read of each hoisted constant by key. */\n readonly #keyOf = new WeakMap<Code, string>();\n readonly #constants = new Map<string, Code>();\n /** The columns of the run, by the structure of their expression. */\n readonly #columns = new Map<string, string>();\n /** The expressions whose code is the read of a column of the run. */\n readonly #columned = new WeakSet<Expr>();\n /** The lazy constants of the run, and the printed functions that have a loop: code that reads one waits for its read. */\n readonly #deferred = new Set<string>();\n /** The functions that the printer prints at this time, the innermost last. */\n // Stryker disable next-line ArrayDeclaration: a value that is not a scope has no field repeats or root, so it acts as no scope\n readonly #scopes: CallScope[] = [];\n /** The work of the body of each bound function, by the number of its binding. */\n readonly #fnWork = new Map<number, number>();\n /** The expressions whose code is a constant of the run. */\n readonly #constant = new WeakSet<Expr>();\n /** The expressions at a place that takes a list: a binding, the head of a list op and the list of an axis. */\n readonly #wantList = new WeakSet<Expr>();\n /** The facts of the list of each function of the memo whose value is a list. */\n readonly #lists = new Map<string, ListInfo | undefined>();\n\n constructor(expr: Expr, options: ModuleOptions, sheet?: SheetInfo) {\n this.#domains = options.domains ?? [];\n this.#facts = factsOf({ domains: this.#domains });\n this.#schema = options.schema;\n this.#memo = memoOf(expr);\n this.#tree = options.space === \"tree\";\n this.#sheet = sheet;\n }\n\n use(name: Helper): string {\n this.helpers.add(name);\n return name;\n }\n\n /** This method gives the name of a part of the tree, for example `H` for the children, and marks the part as read. */\n #part(part: TreePart, name: string): string {\n this.treeParts.add(part);\n return name;\n }\n\n /**\n * This method gives the check of a result of a kind, or undefined for a result that needs no check. A number must be\n * finite, and the domain of the kind can check the value with valid. The law checker of the test kit checks the\n * declaration `returns` of each op (KIND.RETURNS), so the module trusts the kind itself.\n */\n check(kind: Kind): string | undefined {\n const d = this.#facts.checkOf(kind);\n // The kind is primitive here. A static site on a value of a domain has no domain without a primitive type before it.\n if (d === undefined) throw new NotStandalone(`a domain without a primitive type comes before the domain of a ${kind}`);\n // The name of a domain can have each character. For a name that is not a JavaScript name, the check has the index\n // of its domain in its name (V-061).\n const plain = `k_${kind.replace(\":\", \"_\")}`;\n const name = /^[\\w$]+$/.test(plain) ? plain : `k_d${String(d)}`;\n // Stryker disable next-line ConditionalExpression: a check of a kind is always the same, so the map only saves time\n if (!this.top.has(name)) {\n const domain = this.#domains[d];\n const valid = domain?.valid === undefined ? undefined : this.#valid(d, domain.name, kind, domain.valid);\n const conds = [...(kind === \"number\" ? [\"Number.isFinite(x)\"] : []), ...(valid === undefined ? [] : [`${valid}(x)`])];\n if (conds.length === 0) return undefined;\n this.top.set(name, `const ${name} = (x) => (${conds.join(\" && \")} ? x : ${this.use(\"F\")}());`);\n }\n return name;\n }\n\n /** This method gives the code of a result with its check, if it needs one. */\n #checked(kind: Kind, code: string): string {\n const k = this.check(kind);\n return k === undefined ? code : `${k}(${code})`;\n }\n\n #valid(d: number, domain: string, kind: Kind, valid: (x: never) => boolean): string | undefined {\n const name = `v_${d}`;\n const src = copied(valid, [this.#samples(kind)], `the check \"valid\" of the domain ${domain}`);\n // A check that is Number.isFinite of a number adds nothing to the check of the result.\n const form = inlineForm(src);\n if (kind === \"number\" && form !== undefined && patternOf(form, (p) => p) === \"Number.isFinite(#0)\") return undefined;\n this.top.set(name, `const ${name} = ${src};`);\n return name;\n }\n\n /** This method gives the samples of a kind: the samples of a primitive type, or the samples of a domain (KIND.DOMAIN). */\n #samples(kind: Kind): readonly unknown[] {\n const primitive = primitiveOf(kind);\n if (primitive !== undefined) return SAMPLES[primitive];\n const d = this.#domains.find((x) => kindOfDomain(x) === kind) as AnyDomain;\n if (d.samples === undefined) throw new NotStandalone(`the domain ${d.name} gives no samples, so a module cannot check a copy of its op`);\n return d.samples();\n }\n\n /**\n * This method gives the code of a check of the kind of an input. The check is a test of its JavaScript type, or the\n * copy of `is` of a domain. The code is true for an input against the kind.\n */\n against(kind: Kind, input: string): string {\n const primitive = primitiveOf(kind);\n if (primitive !== undefined) return `typeof ${input} !== \"${primitive}\"`;\n const d = this.#domains.findIndex((x) => kindOfDomain(x) === kind);\n const domain = this.#domains[d];\n if (domain === undefined) throw new NotStandalone(`the schema has the kind ${kind}, and no domain has it`);\n const name = `is_${String(d)}`;\n if (!this.top.has(name)) {\n const src = copied(domain.is, [[...SAMPLES.number, ...SAMPLES.string, ...SAMPLES.boolean, null, {}, [], ...this.#samples(kind)]], `the test \"is\" of the domain ${domain.name}`);\n this.top.set(name, `const ${name} = ${src};`);\n }\n return `!${name}(${input})`;\n }\n\n /** This method gives a new name for the code. */\n fresh(prefix: string): string {\n return `${prefix}${this.#names++}`;\n }\n\n /** This method tells if code reads a lazy constant of the run, or calls a printed function that has a loop. */\n #defers(c: Code): boolean {\n return [c.v.code, ...c.s].some((line) => [...line.matchAll(/\\b(c\\d+|fn\\d+)\\(/g)].some((m) => this.#deferred.has(m[1] as string)));\n }\n\n /** This method gives the code of a name: a read that throws the error of its value, if it can hold an error. */\n #read(name: Name): Value {\n const base = { kind: name.kind, deps: name.deps, plain: true, list: name.list };\n return name.lazy ? { ...base, code: `${this.use(\"G\")}(${name.code})`, safe: false, held: name.code } : { ...base, code: name.code, safe: true };\n }\n\n /** This method gives the name of a constant of the run, from the read of its value. */\n #nameOf(v: Value): Name {\n return { code: v.held ?? v.code, kind: v.kind, lazy: v.held !== undefined, deps: NO_DEPS, list: v.list };\n }\n\n /**\n * This method gives the statements that put the value of a code, or the error sentinel, into a new variable `name`.\n * A constant of the run without statements uses the helper `T`: it evaluates once, so its closure costs little.\n */\n #store(name: string, c: Code, run = false): string[] {\n if (c.v.safe) return [...c.s, `const ${name} = ${c.v.code};`];\n if (c.s.length === 0 && c.v.held !== undefined) return [`const ${name} = ${c.v.held};`];\n if (run && c.s.length === 0) return [`const ${name} = ${this.use(\"T\")}(() => ${c.v.code});`];\n return [`let ${name};`, \"try {\", ...ind(c.s), ` ${name} = ${c.v.code};`, \"} catch {\", ` ${name} = E;`, \"}\"];\n }\n\n /**\n * This method evaluates a constant of the run once, before the loop over the keys, and gives the read of its value. A\n * constant with a loop (`lazy`) evaluates on its first read instead, as a branch of the interpreter does. So does a\n * constant that reads a lazy constant or calls a function with a loop. Else it starts that loop before the run.\n */\n #hoist(c: Code, lazy = false): Code {\n if (c.v.deps.size > 0 || (c.v.plain === true && c.s.length === 0)) return c;\n const key = this.#keyOf.get(c);\n const hit = key === undefined ? undefined : this.#constants.get(key);\n if (hit !== undefined) return hit;\n const name = this.fresh(\"c\");\n const deferred = lazy || this.#defers(c);\n if (deferred) {\n this.#deferred.add(name);\n this.run.push(`const ${name} = ${this.use(\"L\")}(() => {`, ...ind(c.s), ` return ${c.v.code};`, \"});\");\n } else this.run.push(...this.#store(name, c, true));\n const { list } = c.v;\n const read = bare(this.#read(deferred ? { code: `${name}()`, kind: c.v.kind, lazy: true, deps: NO_DEPS, list } : { code: name, kind: c.v.kind, lazy: !c.v.safe, deps: NO_DEPS, list }));\n if (key !== undefined) this.#constants.set(key, read);\n return read;\n }\n\n /**\n * This method gives the parts of a node with levels `deps`. When the node is not a constant of the run, each part that\n * is a constant evaluates once, before the loop. A node that is a constant keeps its parts, and its parent decides.\n */\n #settle(parts: readonly Code[], deps: ReadonlySet<number>, exprs: readonly Expr[] = []): readonly Code[] {\n return deps.size === 0 ? parts : parts.map((x, i) => this.#hoist(x, exprs[i] !== undefined && hasLoop(exprs[i])));\n }\n\n expr(e: Expr, ctx: Ctx): Code {\n const key = ctx.keys.get(e);\n if (key !== undefined) return bare(this.#read(key));\n const keys = this.#memo.get(e);\n const c = keys !== undefined && this.#inside !== e ? this.#memoized(e, keys, ctx) : this.#node(e, ctx);\n if (c.v.deps.size === 0) {\n // A constant of the run with the structure of an earlier one is that constant.\n this.#keyOf.set(c, this.#constKey(e, ctx));\n this.#constant.add(e);\n }\n // A list is a value only at a place that takes a list. A result, an argument and a field take no list.\n if (c.v.list !== undefined && !this.#wantList.has(e)) throw new NotStandalone(\"a list is a value of the program\");\n return this.#columnar(e, c, ctx) ? this.#column(e, c, ctx) : c;\n }\n\n /** This method gives the code of a list at a place that takes a list (LIST.VALUE): an each, a name, sortBy or take. */\n #listOf(e: Expr, ctx: Ctx): Code {\n this.#wantList.add(e);\n const c = this.expr(e, ctx);\n if (c.v.list === undefined) throw new NotStandalone(\"a list op on a value that is not a list\");\n return c;\n }\n\n /** This method tells if an expression gives a list at a place that takes one: an each, sortBy, take or a name of a list. */\n #isList(e: Expr, ctx: Ctx): boolean {\n if (e.tag === \"each\") return true;\n if (e.tag === \"app\") return e.op === \"sortBy\" || e.op === \"take\";\n return e.tag === \"var\" && ctx.env.get(e.name)?.list !== undefined;\n }\n\n /**\n * This method tells if a part of a loop over the targets is a column of the run. Its value depends only on the\n * target and on the constants of the run, so each run computes it once for each record. Each name that it reads\n * from outside is a constant of the run, so its code can be outside the loop.\n */\n #columnar(e: Expr, c: Code, ctx: Ctx): boolean {\n // A node of the memo has the level 1, so a column has a focus. The results of the cells change in a run, so a part\n // that reads a cell is not a column.\n if (ctx.level < 2 || c.v.deps.has(CELLS) || !c.v.deps.has(ctx.level) || this.#work(e, ctx.fns) < COLUMN_WORK) return false;\n const scope = this.#callScope(c, ctx);\n if (c.v.deps.size !== 1 && scope === undefined) return false;\n // A node of the memo with keys keeps its costly part for each value of its keys already.\n if (this.#keyed(e)) return false;\n const visible = (name: string): boolean => {\n const bound = ctx.env.get(name);\n return (bound?.deps.size ?? 0) === 0 || (scope?.names.has((bound as Name).code) ?? false);\n };\n return [...namesOf(e)].every(visible) && !this.#callsLocal(e, ctx);\n }\n\n /**\n * This method gives the function whose call can hold a column of a part. The part is in a loop of the function, and it\n * reads a parameter. The body of the function has a loop in a loop, so a call can read the part more than once. Each\n * name that the part reads is a parameter, a binding at the root of the body or a constant (`#columnar`). So the\n * part depends only on its target and on values that one call does not change. These are the parameters, the focus\n * and the origin. The levels in a node of the memo start at 1, far below the focus of a function. So a node of the\n * memo holds no column of a call.\n */\n #callScope(c: Code, ctx: Ctx): CallScope | undefined {\n const scope = this.#scopes.at(-1);\n // A part that reads a parameter reads a variable of this function, so its structure gives no column of another function.\n return scope !== undefined && scope.repeats && ctx.level > scope.focus && c.v.deps.has(scope.param) ? scope : undefined;\n }\n\n /** This method tells if an expression calls a function that is at the place of its binding, not at the start of a run. */\n #callsLocal(e: Expr, ctx: Ctx): boolean {\n // Stryker disable next-line ConditionalExpression: a node that is not a call has no field fn, so the map gives undefined\n if (e.tag === \"call\" && ctx.fns.get(e.fn)?.local === true) return true;\n return children(e).some((x) => this.#callsLocal(x, ctx));\n }\n\n /** This method tells if an expression has a node of the memo with keys in it. */\n #keyed(e: Expr): boolean {\n return (this.#memo.get(e)?.length ?? 0) > 0 || children(e).some((x) => this.#keyed(x));\n }\n\n /**\n * This method gives the work of an expression: a node of the memo and a constant of the run are one read each. A call\n * adds the work of the body of its function, because the body evaluates at each call.\n */\n #work(e: Expr, fns: ReadonlyMap<string, BoundFn>): number {\n if (this.#memo.has(e) || this.#constant.has(e)) return 1;\n // Stryker disable next-line ConditionalExpression: a node that is not a call has no field fn, so the map gives undefined\n const body = e.tag === \"call\" ? this.#bodyWork(fns.get(e.fn)) : 0;\n return children(e).reduce((sum, x) => sum + this.#work(x, fns), 1 + body);\n }\n\n /**\n * This method gives the work of the body of a function, once for each function. Thus a chain of calls costs no more\n * than its functions. A body that is a column of the run is one read. A body sees the functions of the place of its\n * binding, and no function calls itself (FN.TOTAL).\n */\n #bodyWork(bound: BoundFn | undefined): number {\n if (bound === undefined) return 0;\n let work = this.#fnWork.get(bound.id);\n if (work === undefined) {\n work = this.#columned.has(bound.fn.body) ? 1 : this.#work(bound.fn.body, bound.ctx.fns);\n this.#fnWork.set(bound.id, work);\n }\n return work;\n }\n\n /** This method gives the read of a column of the run. Two parts with the same structure share one column. */\n #column(e: Expr, c: Code, ctx: Ctx): Code {\n const key = this.#constKey(e, ctx);\n let name = this.#columns.get(key);\n if (name === undefined) {\n name = this.fresh(\"col\");\n // A column of a call is at the start of the body of its function, so each call has its own.\n const scope = this.#callScope(c, ctx);\n (scope?.decls ?? this.run).push(`const ${name} = ${this.use(\"Q\")}((${ctx.focus as string}) => {`, ...ind(c.s), ` return ${c.v.code};`, \"});\");\n this.#columns.set(key, name);\n }\n this.#columned.add(e);\n return bare({ code: `${this.use(\"G\")}(${name}(${ctx.focus as string}))`, kind: c.v.kind, safe: false, deps: c.v.deps, list: c.v.list });\n }\n\n #node(e: Expr, ctx: Ctx): Code {\n switch (e.tag) {\n case \"lit\":\n return bare(literal(e.value));\n case \"ref\":\n return this.#ref(e, ctx);\n case \"var\":\n return bare(this.#var(e.name, ctx));\n case \"let\":\n return this.#let(e, ctx);\n // A function is only a binding of let, so the check of the shape stops this node first.\n // Stryker disable next-line all: see the comment above\n /* v8 ignore next -- @preserve */\n case \"fn\": throw new NotStandalone(\"a function outside the bindings of a let\");\n case \"call\":\n return this.#call(e, ctx);\n case \"rec\": {\n const names = Object.keys(e.fields);\n const raw = Object.values(e.fields).map((x) => this.expr(x, ctx));\n const deps = depsOf(...raw);\n // The interpreter evaluates each field, also after an error.\n const fields = this.#inOrder(this.#settle(raw, deps, Object.values(e.fields)), true);\n // A record of a module is a new object, so it needs no freeze.\n const code = `({ ${fields.map((x, i) => `${names[i] === \"__proto__\" ? '[\"__proto__\"]' : JSON.stringify(names[i])}: ${x.v.code}`).join(\", \")} })`;\n return { s: stmtsOf(...fields), v: { code, kind: undefined, safe: fields.every((x) => x.v.safe), deps } };\n }\n case \"app\":\n return this.#app(e, ctx);\n case \"each\":\n return this.#eachList(e, ctx);\n case \"fold\":\n return this.#fold(e, ctx);\n case \"iterate\":\n return this.#iterate(e, ctx);\n case \"ext\":\n return this.#cell(e, ctx);\n }\n }\n\n /**\n * This method gives the code of a read of a cell in a module of a sheet (COMPILE.MODULE.SHEET). The value is the result\n * of the cell, which can be the error sentinel, so the read throws its error. A read that is not a cell reference, or\n * of a column that the sheet does not have, gives an error, as in `SheetRun`.\n */\n #cell(e: ExprOf<\"ext\">, ctx: Ctx): Code {\n const sheet = this.#sheet;\n if (sheet === undefined || e.kind !== CELL_KIND) throw new NotStandalone(`the extension \"${e.kind}\"`);\n const F = this.use(\"F\");\n if (!isCellRef(e.data)) return bare({ code: `${F}()`, kind: undefined, safe: false, deps: new Set([CELLS]) });\n const { column, at } = e.data;\n const deps = new Set([...this.#addressDeps(at, ctx, []), CELLS]);\n const index = sheet.columns.get(column);\n // The read of a column that the sheet does not have is an error. A kind of the options lets an op take it.\n if (index === undefined) return bare({ code: `${F}()`, kind: sheet.kinds.get(column), safe: false, deps });\n if (!sheet.kinds.has(column)) throw new NotStandalone(`a formula reads the column \"${column}\" before its formula, so the column needs its kind in the option kinds`);\n const read = `${READ_CELL}(${String(index)}, ${this.#address(at, ctx, [])})`;\n const v = { code: `${this.use(\"G\")}(${read})`, kind: sheet.kinds.get(column), safe: false, deps };\n // The read itself gives the result or the error sentinel. A move of the address can throw, so then the read is not\n // a value that holds the sentinel.\n return bare(at.every((m) => m.t === \"origin\") ? { ...v, held: read } : v);\n }\n\n /**\n * This method gives the parts of a node in the order of the interpreter, when a part reads a cell (COMPILE.MODULE.SHEET).\n * A read of a cell can start the search of the run, and the search decides the cycles. So the module must read each\n * cell that the interpreter reads. With `all`, the interpreter evaluates each part also after an error, so each part\n * goes into a variable that can hold the error. Else the first error stops the parts, so each part goes into a\n * variable before the next part starts.\n *\n * The statements of the parts come before the code of their values. The last part that reads a cell keeps its place\n * only if no statement after it can throw. Also, with `all`, a value before it must not throw, or the code of its value\n * must read no cell.\n */\n #inOrder(parts: readonly Code[], all: boolean): readonly Code[] {\n const last = parts.findLastIndex((x) => x.v.deps.has(CELLS));\n const after = parts.slice(last + 1).every((x) => x.s.length === 0 || x.v.safe);\n const before = !all || parts.slice(0, Math.max(last, 0)).every((x) => x.v.safe) || !READS_IN_CODE.test((parts[last] as Code).v.code);\n return parts.map((x, i) => {\n // A part after the last read of a cell cannot stop a read. A part that cannot throw and reads no cell cannot either.\n if (i > last || (x.v.safe && !x.v.deps.has(CELLS)) || (i === last && after && before)) return x;\n const b = this.fresh(\"b\");\n if (all && !x.v.safe) return { s: this.#store(b, x), v: { ...x.v, code: `${this.use(\"G\")}(${b})`, held: b, plain: false } };\n return { s: [...x.s, `const ${b} = ${x.v.code};`], v: { kind: x.v.kind, deps: x.v.deps, list: x.v.list, code: b, safe: true, plain: true } };\n });\n }\n\n /**\n * This method gives the code of the index of an address from the focus. `values` has the code of the value of each\n * computed move, in order (NAV.COMPUTED).\n */\n #address(at: readonly Move[], ctx: Ctx, values: readonly Code[]): string {\n let index = ctx.focus;\n let next = 0;\n // A move that can fail keeps its check when a later fixed key, index or origin replaces its index (V-052). The focus\n // and the origin cannot fail, and the code of a move from an index has the code of that index in it. In a tree,\n // the move parent is a move from an index.\n let fails = false;\n const checks: string[] = [];\n for (const m of at) {\n if (fails && index !== undefined && m.t !== \"offset\" && m.t !== \"other\" && (m.t !== \"parent\" || !this.#tree)) checks.push(index);\n index = moveExpr(m) === undefined ? this.#move(m, index, ctx.origin) : this.#computed(m, values[next++] as Code);\n fails = m.t !== \"origin\";\n }\n // A node of the memo reads neither its origin nor its focus (memo.ts), so the guards of this method do not fail.\n // Stryker disable next-line ConditionalExpression,StringLiteral: see the comment above\n /* v8 ignore next -- @preserve */\n if (index === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n return checks.length === 0 ? index : `(${[...checks, index].join(\", \")})`;\n }\n\n /** This method gives the code of the index of a computed move, from the code of its value. */\n #computed(m: Move, value: Code): string {\n return `${this.use(m.t === \"key\" ? \"K\" : \"I\")}(${value.v.code}, n)`;\n }\n\n #move(m: Move, focus: string | undefined, origin: string | undefined): string {\n const F = this.use(\"F\");\n switch (m.t) {\n case \"origin\":\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (origin === undefined) throw new NotStandalone(\"a node of the memo reads its origin\");\n return origin;\n case \"key\":\n // A key of an array space is the text of its index.\n return typeof m.key === \"string\" && /^(0|[1-9]\\d*)$/.test(m.key) ? `(${m.key} < n ? ${m.key} : ${F}())` : `${F}()`;\n case \"index\":\n return typeof m.i === \"number\" && Number.isInteger(m.i) && m.i >= 0 ? `(${m.i} < n ? ${m.i} : ${F}())` : `${F}()`;\n case \"offset\": {\n const [d, ...more] = m.d;\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (focus === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n if (d === undefined || more.length > 0 || !Number.isInteger(d)) return `${F}()`;\n // In a tree space, an offset goes among the siblings (NAV.OFFSET.TREE).\n if (this.#tree) return `${this.use(\"SO\")}(${this.#part(\"siblings\", \"GP\")}, SI, ${focus}, ${d})`;\n return `${this.use(\"X\")}(${focus} + ${d}, n)`;\n }\n case \"other\":\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (focus === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n return `(n === 2 ? 1 - ${focus} : ${F}())`;\n case \"parent\":\n // Only a tree space has parents (NAV.PARENT).\n if (!this.#tree) return `${F}()`;\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (focus === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n return `${this.use(\"UP\")}(P, ${focus})`;\n }\n }\n\n #ref(e: ExprOf<\"ref\">, ctx: Ctx): Code {\n const [field, ...more] = e.path;\n const kind = field === undefined ? undefined : this.#schema.fields?.[field];\n if (field === undefined || more.length > 0 || !isFieldName(field) || kind === undefined) throw new NotStandalone(`a read of a field that is not in the schema: \"${e.path.join(\".\")}\"`);\n // A move to the origin cannot fail, and the schema has the field in each record.\n const at = e.at ?? [];\n const safe = at.every((m) => m.t === \"origin\");\n const values = this.#addressValues(at, ctx);\n const deps = this.#addressDeps(at, ctx, values);\n // The interpreter evaluates the expressions of the address before its moves, and the first error stops them.\n const parts = this.#inOrder(this.#settle(values, deps), false);\n return { s: stmtsOf(...parts), v: { code: `R[${this.#address(at, ctx, parts)}][${JSON.stringify(field)}]`, kind, safe, deps } };\n }\n\n /** This method gives the code of the expressions of the computed moves of an address. They evaluate at the node. */\n #addressValues(at: readonly Move[], ctx: Ctx): readonly Code[] {\n return addrExprs(at).map((x) => this.expr(x, ctx));\n }\n\n /**\n * This method gives the levels of the key of an address. The focus and the origin have their level, and a fixed key\n * has no level. A computed move has the levels of its value.\n */\n #addressDeps(at: readonly Move[], ctx: Ctx, values: readonly Code[]): ReadonlySet<number> {\n let deps: ReadonlySet<number> = new Set([ctx.level]);\n let next = 0;\n // A move that can fail keeps the levels of its index when a later move replaces the index (V-052). An offset and\n // other keep the index, so their levels stay.\n let fails = false;\n const kept = new Set<number>();\n for (const m of at) {\n if (fails) for (const d of deps) kept.add(d);\n if (moveExpr(m) !== undefined) deps = (values[next++] as Code).v.deps;\n else if (m.t === \"origin\") deps = new Set([ctx.originLevel]);\n // The parent of a key of a tree depends on the key. Outside a tree, the move fails at each key.\n else if (m.t === \"key\" || m.t === \"index\" || (m.t === \"parent\" && !this.#tree)) deps = NO_DEPS;\n fails = m.t !== \"origin\";\n }\n return new Set([...deps, ...kept]);\n }\n\n #var(name: string, ctx: Ctx): Value {\n const bound = ctx.env.get(name);\n if (bound !== undefined) return this.#read(bound);\n // A name of a loop hides a function with its name, so this check comes after the names of the scope.\n if (ctx.fns.has(name)) throw new NotStandalone(`the name \"${name}\" is a function, not a value`);\n const kind = this.#schema.vars?.[name];\n if (kind === undefined) throw new NotStandalone(`a variable that is not in the schema: \"${name}\"`);\n let code = this.vars.get(name);\n if (code === undefined) {\n code = `v${this.vars.size}`;\n this.vars.set(name, code);\n }\n return plainValue(code, kind);\n }\n\n /**\n * A binding is a variable. A binding with an error is an error only where the body reads its name, so the variable\n * can hold the sentinel. A binding that is a constant of the run is the variable of that constant.\n */\n #let(e: ExprOf<\"let\">, ctx: Ctx): Code {\n const env = new Map(ctx.env);\n const fns = new Map(ctx.fns);\n const s: string[] = [];\n let deps = new Set<number>();\n const bound: BoundFn[] = [];\n // The bindings of a let at the root of the body of a function are at the start of the body, so a column of the\n // call can read them. A let at the root that is a node of the memo binds variables of its function of the memo, but\n // the memo holds no column of a call (`#callScope`), so these names have no reader.\n const scope = this.#scopes.at(-1);\n const root = scope !== undefined && scope.root === e ? scope : undefined;\n for (const [name, x] of Object.entries(e.bind)) {\n // A binding sees the context of the let, so a function cannot call itself.\n if (x.tag === \"fn\") {\n // Stryker disable next-line UpdateOperator: the numbers of the bindings only need to be distinct\n const b: BoundFn = { id: this.#fnIds++, fn: x, ctx, specs: new Map(), decls: [], local: false };\n bound.push(b);\n fns.set(name, b);\n env.delete(name);\n continue;\n }\n // A binding takes a list (LIST.VALUE). A value hides a function of its name, because a read looks at the values first.\n this.#wantList.add(x);\n const c = this.#hoist(this.expr(x, ctx), hasLoop(x));\n if (c.v.deps.size === 0) {\n env.set(name, this.#nameOf(c.v));\n continue;\n }\n const b = this.fresh(\"b\");\n s.push(...this.#store(b, c));\n env.set(name, { code: b, kind: c.v.kind, lazy: !c.v.safe, deps: c.v.deps, list: c.v.list });\n root?.names.add(b);\n // The statements of the binding read its keys, so the let is not a constant of the run.\n deps = new Set([...deps, ...c.v.deps]);\n }\n if (root !== undefined) root.root = e.body;\n const body = this.expr(e.body, { ...ctx, env, fns });\n // A function that reads names of the place of the binding comes after them, before the body.\n return { s: [...s, ...bound.flatMap((b) => b.decls), ...body.s], v: { ...body.v, deps: new Set([...deps, ...body.v.deps]) } };\n }\n\n /**\n * This method prints a call (FN.CALL). Each argument evaluates at the place of the call, as a binding of a let. The\n * call goes to the printed function of the signature of its arguments, with the focus and the origin if it reads them.\n */\n #call(e: ExprOf<\"call\">, ctx: Ctx): Code {\n const bound = ctx.env.has(e.fn) ? undefined : ctx.fns.get(e.fn);\n if (bound === undefined) throw new NotStandalone(`a call of \"${e.fn}\", which is not a function`);\n if (bound.fn.params.length !== e.args.length) throw new NotStandalone(`a call of \"${e.fn}\" with ${String(e.args.length)} arguments, not ${String(bound.fn.params.length)}`);\n const s: string[] = [];\n const args = e.args.map((x): Arg => {\n const c = this.#hoist(this.expr(x, ctx), hasLoop(x));\n // A value that cannot throw is the argument itself. A read of a name that can hold the error passes the name.\n if (c.v.safe) {\n s.push(...c.s);\n return { code: c.v.code, kind: c.v.kind, deps: c.v.deps };\n }\n // Stryker disable next-line ConditionalExpression: the statements with a read of a name bind other names and do not throw, so the read alone has the same value\n if (c.s.length === 0 && c.v.held !== undefined) return { code: c.v.held, kind: c.v.kind, deps: c.v.deps };\n const b = this.fresh(\"b\");\n s.push(...this.#store(b, c));\n return { code: b, kind: c.v.kind, deps: c.v.deps };\n });\n // Each parameter can hold the error of its argument, so one function serves the arguments of one kind.\n const sig = JSON.stringify(args.map((a) => a.kind ?? null));\n const spec = bound.specs.get(sig) ?? this.#printFn(bound, args, sig);\n // Each marker becomes the levels at the call. The levels of the arguments count for each call, because their\n // statements read their keys, so the marker of the parameters gives no level.\n const levels = (d: number): readonly number[] => (d === spec.origin ? [ctx.originLevel] : d === spec.focus ? [ctx.level] : d === spec.param ? [] : [d]);\n const deps = new Set([...args.flatMap((a) => [...a.deps]), ...[...spec.deps].flatMap(levels)]);\n const position = spec.deps.has(spec.origin) ? [ctx.focus, ctx.origin] : spec.deps.has(spec.focus) ? [ctx.focus] : [];\n return { s, v: { code: `${spec.name}(${[...args.map((a) => a.code), ...position].join(\", \")})`, kind: spec.kind, safe: spec.safe, deps } };\n }\n\n /**\n * This method prints a bound function for one signature of its arguments, as one JavaScript function. Its parameters\n * are the arguments, then the focus and the origin, if the body reads them. A function that reads a name of the place\n * of its binding is at that place. Each other function is at the start of a run, so a constant of the run can call it.\n */\n #printFn(bound: BoundFn, args: readonly Arg[], sig: string): Spec {\n // The markers are far from the levels of the axes and of the loops, so they do not meet them. They only need to be\n // distinct.\n // Stryker disable next-line ArithmeticOperator,UpdateOperator: see the comment above\n const origin = 2_000_000 + 1000 * this.#printed++;\n const focus = origin + 1;\n const param = -origin;\n const names = args.map(() => this.fresh(\"p\"));\n const k = this.fresh(\"k\");\n const o = this.fresh(\"o\");\n const env = new Map(bound.ctx.env);\n // A parameter hides a function of its name, because a read looks at the values first.\n bound.fn.params.forEach((p, i) => env.set(p, { code: names[i] as string, kind: (args[i] as Arg).kind, lazy: true, deps: new Set([param]) }));\n const scope: CallScope = { param, focus, repeats: nestsLoops(bound.fn.body), names: new Set(names), decls: [], root: bound.fn.body };\n this.#scopes.push(scope);\n const body = this.expr(bound.fn.body, { origin: o, focus: k, level: focus, originLevel: origin, env, fns: bound.ctx.fns, keys: new Map() });\n this.#scopes.pop();\n const markers = new Set([origin, focus, param]);\n const global = [...body.v.deps].every((d) => markers.has(d));\n const name = this.fresh(\"fn\");\n if (hasLoop(bound.fn.body) || this.#defers(body)) this.#deferred.add(name);\n const position = body.v.deps.has(origin) ? [k, o] : body.v.deps.has(focus) ? [k] : [];\n const head = `const ${name} = (${[...names, ...position].join(\", \")}) =>`;\n // The columns of the call come first. Each one reads a binding of the root only after the binding has its value.\n const s = [...scope.decls, ...body.s];\n const decl = s.length === 0 ? [`${head} ${body.v.code};`] : [`${head} {`, ...ind(s), ` return ${body.v.code};`, \"};\"];\n (global ? this.run : bound.decls).push(...decl);\n if (!global) bound.local = true;\n const spec: Spec = { name, kind: body.v.kind, safe: body.v.safe, deps: body.v.deps, origin, focus, param, global };\n bound.specs.set(sig, spec);\n return spec;\n }\n\n #boolean(v: Value): string {\n return v.kind === \"boolean\" ? v.code : `${this.use(\"B\")}(${v.code})`;\n }\n\n /** A condition is safe when it is a safe boolean. */\n #safeBoolean(v: Value): boolean {\n return v.safe && v.kind === \"boolean\";\n }\n\n #app(e: ExprOf<\"app\">, ctx: Ctx): Code {\n const { op, args } = e;\n if (op === \"if\") return this.#if(args, ctx);\n if (op === \"and\" || op === \"or\") return this.#andOr(op === \"and\", args, ctx);\n if (op === \"ifError\") return this.#ifError(args, ctx);\n const [head] = args;\n if (LIST_OPS.has(op) && head?.tag === \"each\") return this.#list(op, head, args.slice(1), ctx);\n if (head !== undefined && (op === \"sortBy\" || op === \"take\")) return this.#order(op, head, args.slice(1), ctx);\n // LIST.BUILD and LIST.GET: a module does not have the ops that build a list, or get, yet. The interpreter evaluates them.\n if (head !== undefined && BUILD_OPS.has(op) && this.#isList(head, ctx)) throw new NotStandalone(`the list op \"${op}\" is not in a module yet`);\n if (head !== undefined && (LIST_OPS.has(op) || op === \"nth\") && this.#isList(head, ctx)) return this.#overList(op, head, args.slice(1), ctx);\n const raw = args.map((x) => this.expr(x, ctx));\n const deps = depsOf(...raw);\n // The interpreter evaluates each argument, also after an error.\n const values = this.#inOrder(this.#settle(raw, deps, args), true);\n const site = this.#facts.staticSite(op, values.map((x) => x.v.kind));\n if (site?.t !== \"fn\") throw new NotStandalone(`the kinds of the values of \"${op}\" do not decide its op`);\n if (site.bad) return { s: stmtsOf(...values), v: { code: `${this.use(\"F\")}()`, kind: site.returns, safe: false, deps } };\n if (site.returns === undefined) throw new NotStandalone(`the op \"${op}\" does not declare the kind of its result`);\n const d = this.#domains[site.domain] as AnyDomain;\n const name = `op_${site.domain}_${this.#opIndex(op)}`;\n // Stryker disable next-line ConditionalExpression: the form of an op is always the same, so the map only saves time\n if (!this.#forms.has(name)) {\n // A static site of a domain has the function of the op of that domain.\n const fn = (d.ops[op] as { fn: (...a: never[]) => unknown }).fn;\n const kinds = values.map((x) => x.v.kind).filter((k): k is Kind => k !== undefined);\n const src = copied(fn, kinds.map((k) => this.#samples(k)), `the op \"${op}\" of the domain ${d.name}`);\n // An inline form cannot throw for primitive values only.\n this.#forms.set(name, kinds.every((k) => primitiveOf(k) !== undefined) ? inlineForm(src) : undefined);\n this.top.set(name, `const ${name} = ${src};`);\n }\n const form = this.#forms.get(name);\n // An inline form takes each argument once, or a plain argument more often, so each argument evaluates once.\n const inline = form !== undefined && form.params.length === values.length && values.every((x, i) => form.uses[i] === 1 || (x.v.plain === true && x.v.safe && (form.uses[i] as number) > 0));\n if (inline) {\n const text = form.parts.map((x) => (typeof x === \"number\" ? `(${(values[x] as Code).v.code})` : x)).join(\"\");\n const checked = this.check(site.returns);\n const code = checked === undefined ? `(${text})` : `${checked}(${text})`;\n return { s: stmtsOf(...values), v: { code, kind: site.returns, safe: checked === undefined && values.every((x) => x.v.safe), deps } };\n }\n this.#called.add(name);\n // An exception of the op is an error of Vex: the boundary around the op catches it.\n const code = this.#checked(site.returns, `${name}(${values.map((x) => x.v.code).join(\", \")})`);\n return { s: stmtsOf(...values), v: { code, kind: site.returns, safe: false, deps } };\n }\n\n /** The condition must be a boolean. Only the branch that the condition selects is evaluated. */\n #if(args: readonly Expr[], ctx: Ctx): Code {\n if (args.length !== 3) throw new NotStandalone(\"an if without three arguments\");\n const [c, a, b] = args as [Expr, Expr, Expr];\n const raw = [this.expr(c, ctx), this.expr(a, ctx), this.expr(b, ctx)];\n const deps = depsOf(...raw);\n const [cond, yes, no] = this.#settle(raw, deps, [c, a, b]) as [Code, Code, Code];\n const v = { kind: join(yes.v.kind, no.v.kind), safe: this.#safeBoolean(cond.v) && yes.v.safe && no.v.safe, deps };\n if (yes.s.length === 0 && no.s.length === 0) return { s: cond.s, v: { ...v, code: `(${this.#boolean(cond.v)} ? ${yes.v.code} : ${no.v.code})` } };\n const t = this.fresh(\"t\");\n const s = [...cond.s, `let ${t};`, `if (${this.#boolean(cond.v)}) {`, ...ind(yes.s), ` ${t} = ${yes.v.code};`, \"} else {\", ...ind(no.s), ` ${t} = ${no.v.code};`, \"}\"];\n return { s, v: { ...v, code: t } };\n }\n\n /** `and` stops at the first `false`, and `or` at the first `true`. Each argument before the stop must be a boolean. */\n #andOr(and: boolean, args: readonly Expr[], ctx: Ctx): Code {\n if (args.length === 0) throw new NotStandalone(`an ${and ? \"and\" : \"or\"} without arguments`);\n const raw = args.map((x) => this.expr(x, ctx));\n const deps = depsOf(...raw);\n const parts = this.#settle(raw, deps, args);\n const v = { kind: \"boolean\" as const, safe: parts.every((x) => this.#safeBoolean(x.v)), deps };\n const [first, ...rest] = parts as [Code, ...Code[]];\n if (rest.every((x) => x.s.length === 0)) return { s: first.s, v: { ...v, code: `(${parts.map((x) => this.#boolean(x.v)).join(and ? \" && \" : \" || \")})` } };\n const t = this.fresh(\"t\");\n const s = [...first.s, `let ${t} = ${this.#boolean(first.v)};`];\n for (const x of rest) s.push(`if (${and ? \"\" : \"!\"}${t}) {`, ...ind(x.s), ` ${t} = ${this.#boolean(x.v)};`, \"}\");\n return { s, v: { ...v, code: t } };\n }\n\n /** The value of the first argument, or else the value of the second argument. */\n #ifError(args: readonly Expr[], ctx: Ctx): Code {\n if (args.length !== 2) throw new NotStandalone(\"an ifError without two arguments\");\n const [a, b] = args as [Expr, Expr];\n const raw = [this.expr(a, ctx), this.expr(b, ctx)];\n const deps = depsOf(...raw);\n const [first, second] = this.#settle(raw, deps, [a, b]) as [Code, Code];\n if (first.v.safe) return first;\n const t = this.fresh(\"t\");\n const s = [`let ${t};`, \"try {\", ...ind(first.s), ` ${t} = ${first.v.code};`, \"} catch {\", ...ind(second.s), ` ${t} = ${second.v.code};`, \"}\"];\n return { s, v: { code: t, kind: join(first.v.kind, second.v.kind), safe: second.v.safe, deps } };\n }\n\n #opIndex(op: string): number {\n let i = this.#ops.get(op);\n if (i === undefined) {\n i = this.#ops.size;\n this.#ops.set(op, i);\n }\n return i;\n }\n\n /**\n * This method gives the option strict of a list op. The options must be one literal with only strict. Only a literal\n * has a value, so another expression gives the reason too.\n */\n #strict(op: string, rest: readonly Expr[]): boolean {\n const [options, ...more] = rest;\n if (more.length > 0) throw new NotStandalone(`\"${op}\" with more than one option`);\n if (options === undefined) return false;\n const opts = (options as { readonly value?: unknown }).value;\n if (typeof opts !== \"object\" || opts === null || Object.keys(opts).some((k) => k !== \"strict\")) throw new NotStandalone(`the options of \"${op}\" are not a literal with strict`);\n return (opts as { readonly strict?: unknown }).strict === true;\n }\n\n /**\n * A list op over an axis: one `for` loop with a running value. An item with an error is skipped, and with `strict` it\n * is an error of the list op. A value of the wrong kind is an error of the list op, as in the interpreter.\n */\n /**\n * This method gives the loop over the targets of an axis: the statements before it, its bounds and the key that it\n * skips. `start` has the levels of the address, and `inner` is the position at a target. The axes all, others,\n * window and list have a loop. In a tree space, the axes of a tree have a loop too.\n */\n #targetLoop(axis: Axis, at: readonly Move[], ctx: Ctx): {\n readonly s: string[];\n readonly j: string;\n /** The head of the loop, and the statements at the start of each item before the try and inside it. */\n readonly head: string;\n readonly key: readonly string[];\n readonly check: readonly string[];\n readonly skip: string | undefined;\n readonly fixed: boolean;\n readonly start: ReadonlySet<number>;\n /** True when the statements before the loop cannot throw. */\n readonly startSafe: boolean;\n readonly tests: readonly Expr[];\n readonly inner: Ctx;\n } {\n const { base: outer, tests } = testsOf(axis);\n // The reverse order of an axis is a loop from its end (AXIS.REVERSE). The validation keeps a base axis inside.\n const reverse = outer.t === \"reverse\";\n const base = outer.t === \"reverse\" ? outer.axis : outer;\n const j = this.fresh(\"j\");\n const inner: Ctx = { ...ctx, focus: j, level: ctx.level + 1 };\n // The axis list goes over the array of its list (AXIS.LIST). The list evaluates at the node, before the loop, and an\n // error item is an item that fails.\n if (base.t === \"list\") {\n if (at.length > 0) throw new NotStandalone('the axis \"list\" with an address');\n const list = this.#hoist(this.#listOf(base.list, ctx), hasLoop(base.list));\n const a = this.fresh(\"A\");\n const q = this.fresh(\"q\");\n const head = reverse ? `for (let ${q} = ${a}.length - 1; ${q} >= 0; ${q}--) {` : `for (let ${q} = 0; ${q} < ${a}.length; ${q}++) {`;\n const key = [`const ${j} = ${a}[${q}][0];`];\n const check = [`if (${a}[${q}][1] === E) ${this.use(\"F\")}();`];\n return { s: [...list.s, `const ${a} = ${list.v.code};`], j, head, key, check, skip: undefined, fixed: false, start: list.v.deps, startSafe: list.v.safe, tests, inner };\n }\n const s: string[] = [];\n let lo = \"0\";\n let hi = \"n\";\n let skip: string | undefined;\n // The targets of the axis all depend on no key, but its address can fail (V-051). The other axes start at their\n // address.\n let start: ReadonlySet<number> = NO_DEPS;\n const f = base.t === \"all\" && at.length === 0 ? undefined : this.fresh(\"f\");\n if (f !== undefined) {\n const values = this.#addressValues(at, ctx);\n start = this.#addressDeps(at, ctx, values);\n const parts = this.#inOrder(this.#settle(values, start), false);\n s.push(...stmtsOf(...parts), `const ${f} = ${this.#address(at, ctx, parts)};`);\n }\n const startSafe = at.every((m) => m.t === \"origin\");\n if (base.t === \"window\" && (!Number.isInteger(base.from) || !Number.isInteger(base.to))) throw new NotStandalone('the axis \"window\" with a bound that is not an integer');\n // In a tree space, the targets of a tree axis and of a window are a range of an array of positions.\n if (this.#tree && isTreeAxis(base)) {\n const range = this.#treeRange(base, f as string);\n const q = this.fresh(\"q\");\n return { s: [...s, ...range.s], j, head: forHead(q, range.lo, range.hi, reverse), key: [`const ${j} = ${range.a}[${q}];`], check: [], skip: range.skip, fixed: false, start, startSafe, tests, inner };\n }\n if (base.t === \"others\") skip = f;\n else if (base.t === \"window\") {\n const h = this.fresh(\"h\");\n lo = `Math.max(0, ${f as string} + Math.max(${base.from}, -n))`;\n s.push(`const ${h} = Math.min(n, ${f as string} + Math.min(${base.to}, n) + 1);`);\n hi = h;\n } else if (base.t !== \"all\") throw new NotStandalone(`the axis \"${base.t}\"`);\n return { s, j, head: forHead(j, lo, hi, reverse), key: [], check: [], skip, fixed: f === undefined, start, startSafe, tests, inner };\n }\n\n /**\n * This method gives the targets of an axis of a tree space at the position `f`. They are the positions `a[q]` for `q`\n * from `lo` up to `hi`, without the key that the loop skips. The axes come from AXIS.TREE, AXIS.GRAPH and AXIS.WINDOW.\n */\n #treeRange(base: TreeAxis, f: string): TreeRange {\n const a = this.fresh(\"A\");\n const all = (code: string, lo = \"0\", skip?: string): TreeRange => ({ s: [`const ${a} = ${code};`], a, lo, hi: `${a}.length`, skip });\n switch (base.t) {\n // In a tree, the edges go from a parent to its children.\n case \"children\":\n case \"successors\":\n return all(`${this.#part(\"children\", \"H\")}[${f}]`);\n case \"siblings\":\n return all(`${this.#part(\"siblings\", \"GP\")}[${f}]`, \"0\", f);\n case \"ancestors\":\n return all(`${this.use(\"AN\")}(P, ${f})`);\n case \"predecessors\":\n return all(`(P[${f}] < 0 ? [] : [P[${f}]])`);\n case \"reachable\":\n // The first key of the search is the focus, which is not a target.\n return all(`${this.use(\"BF\")}(${this.#part(\"children\", \"H\")}, ${f})`, \"1\");\n case \"descendants\": {\n // The descendants of a key are the keys after it in the order depth first, as many as its subtree has under it.\n const h = this.fresh(\"h\");\n return { s: [`const ${a} = ${this.#part(\"order\", \"PI\")}[${f}] + 1;`, `const ${h} = ${a} + SZ[${f}] - 1;`], a: \"PO\", lo: a, hi: h, skip: undefined };\n }\n case \"window\": {\n // The offsets among the siblings, from `from` to `to`. The bounds are integers (#targetLoop).\n const { from, to } = base;\n const l = this.fresh(\"h\");\n const h = this.fresh(\"h\");\n const s = [`const ${a} = ${this.#part(\"siblings\", \"GP\")}[${f}];`, `const ${l} = Math.max(0, SI[${f}] + ${String(from)});`, `const ${h} = Math.min(${a}.length, SI[${f}] + ${String(to)} + 1);`];\n return { s, a, lo: l, hi: h, skip: undefined };\n }\n }\n }\n\n #list(op: string, target: ExprOf<\"each\">, rest: readonly Expr[], ctx: Ctx): Code {\n const strict = this.#strict(op, rest);\n const at = target.at ?? [];\n const { s, j, head, key, check, skip, fixed, start, startSafe, tests, inner } = this.#targetLoop(target.axis, at, ctx);\n const { level } = inner;\n // Inside the loop, a constant of the run evaluates once, before the loop over the keys of the run.\n const testCodes = tests.map((t) => this.#hoist(this.expr(t, inner), hasLoop(t)));\n const body = this.#hoist(this.expr(target.body, inner), hasLoop(target.body));\n // A count of all the items, whose body cannot fail, is the count of the records. A safe body covers its statements.\n if (op === \"count\" && fixed && tests.length === 0 && body.v.safe) return bare(plainValue(\"n\", \"number\"));\n const deps = new Set([...start, ...[body, ...testCodes].flatMap((x) => [...x.v.deps])].filter((d) => d !== level));\n const r = this.#reduction(op, body.v.kind);\n const { v } = r;\n s.push(r.init);\n const item = [...check, ...testCodes.flatMap((t) => [...t.s, `if (!${this.#boolean(t.v)}) continue;`]), ...body.s];\n // An item whose tests and body cannot fail needs no try.\n const safeItem = check.length === 0 && body.v.safe && testCodes.every((t) => this.#safeBoolean(t.v));\n // The interpreter evaluates each item before the list op (COMPILE.MODULE.SHEET). When an item reads a cell, an error\n // of an item or of a step must not stop the reads of the next items. So the items go into an array first.\n if ([body, ...testCodes].some((x) => x.v.deps.has(CELLS)) && (strict || stepThrows(op, body.v.kind))) {\n const list = this.fresh(\"L\");\n const x = this.fresh(\"x\");\n const all = [...key, ...(skip === undefined ? [] : [`if (${j} === ${skip}) continue;`]), `let ${x};`, \"try {\", ...ind(item), ` ${x} = ${body.v.code};`, \"} catch {\", ` ${x} = E;`, \"}\", `${list}.push(${x});`];\n const reduce = [`for (const ${v} of ${list}) {`, ` if (${v} === E) ${strict ? `${this.use(\"F\")}();` : \"continue;\"}`, ` ${r.step}`, \"}\"];\n return { s: [...s, `const ${list} = [];`, head, ...ind(all), \"}\", ...reduce], v: { code: r.result, kind: listKind(op, body.v.kind), safe: false, deps } };\n }\n const loop = [\n ...key,\n ...(skip === undefined ? [] : [`if (${j} === ${skip}) continue;`]),\n ...(safeItem\n ? [...item, `const ${v} = ${body.v.code};`]\n : [`let ${v};`, \"try {\", ...ind(item), ` ${v} = ${body.v.code};`, \"} catch {\", strict ? ` ${this.use(\"F\")}();` : \" continue;\", \"}\"]),\n r.step,\n ];\n s.push(head, ...ind(loop), \"}\");\n // A count without strict, and any, all and none over booleans without strict, cannot fail. The address of the axis\n // can fail, except at the focus or at the origin.\n const safe = startSafe && !strict && (op === \"count\" || (BOOLEAN_LIST_OPS.has(op) && body.v.kind === \"boolean\"));\n return { s, v: { code: r.result, kind: listKind(op, body.v.kind), safe, deps } };\n }\n\n /**\n * This method gives the parts of a list op that reduces the values of its items. The parts are the variable `v` of\n * the value of an item, the first statement, the step and the result. A value of the wrong kind is an error of the op.\n */\n #reduction(op: string, kind: Kind | undefined): { readonly v: string; readonly init: string; readonly step: string; readonly result: string } {\n const a = this.fresh(\"a\");\n const n = this.fresh(\"n\");\n const v = this.fresh(\"x\");\n const num = kind === \"number\" ? v : `${this.use(\"U\")}(${v})`;\n const bool = kind === \"boolean\" ? v : `${this.use(\"B\")}(${v})`;\n const inits: Readonly<Record<string, string>> = {\n count: `let ${n} = 0;`,\n sum: `let ${a} = 0;`,\n mean: `let ${a} = 0, ${n} = 0;`,\n any: `let ${a} = false;`,\n none: `let ${a} = false;`,\n all: `let ${a} = true;`,\n };\n const steps: Readonly<Record<string, string>> = {\n count: `${n}++;`,\n sum: `${a} += ${num};`,\n mean: `${a} += ${num}; ${n}++;`,\n min: `${a} = ${n}++ === 0 ? ${num} : Math.min(${a}, ${num});`,\n max: `${a} = ${n}++ === 0 ? ${num} : Math.max(${a}, ${num});`,\n any: `if (${bool}) ${a} = true;`,\n none: `if (${bool}) ${a} = true;`,\n all: `if (!${bool}) ${a} = false;`,\n first: `if (${n}++ === 0) ${a} = ${v};`,\n };\n const F = this.use(\"F\");\n const results: Readonly<Record<string, string>> = {\n count: n,\n sum: this.#checked(\"number\", a),\n mean: `(${n} === 0 ? ${F}() : ${this.#checked(\"number\", `${a} / ${n}`)})`,\n any: a,\n all: a,\n none: `!${a}`,\n };\n return { v, init: inits[op] ?? `let ${a}, ${n} = 0;`, step: steps[op] as string, result: results[op] ?? `(${n} === 0 ? ${F}() : ${a})` };\n }\n\n /**\n * This method prints a list as an array (LIST.VALUE): a pair of the key and the value of each item. A test that\n * fails, a body that fails and an error item of the axis list give the error sentinel as the value.\n */\n #eachList(e: ExprOf<\"each\">, ctx: Ctx): Code {\n const at = e.at ?? [];\n const { s, j, head, key, check, skip, start, startSafe, tests, inner } = this.#targetLoop(e.axis, at, ctx);\n const testCodes = tests.map((t) => this.#hoist(this.expr(t, inner), hasLoop(t)));\n const body = this.#hoist(this.expr(e.body, inner), hasLoop(e.body));\n const deps = new Set([...start, ...[body, ...testCodes].flatMap((x) => [...x.v.deps])].filter((d) => d !== inner.level));\n const list = this.fresh(\"L\");\n const v = this.fresh(\"x\");\n const item = [...check, ...testCodes.flatMap((t) => [...t.s, `if (!${this.#boolean(t.v)}) continue;`]), ...body.s];\n const safeItem = check.length === 0 && body.v.safe && testCodes.every((t) => this.#safeBoolean(t.v));\n const loop = [\n ...key,\n ...(skip === undefined ? [] : [`if (${j} === ${skip}) continue;`]),\n ...(safeItem ? [...item, `${list}.push([${j}, ${body.v.code}]);`] : [`let ${v};`, \"try {\", ...ind(item), ` ${v} = ${body.v.code};`, \"} catch {\", ` ${v} = E;`, \"}\", `${list}.push([${j}, ${v}]);`]),\n ];\n return { s: [...s, `const ${list} = [];`, head, ...ind(loop), \"}\"], v: { code: list, kind: undefined, safe: startSafe, deps, list: { item: body.v.kind } } };\n }\n\n /**\n * This method prints sortBy and take (LIST.SORT, LIST.TAKE): a new array from the array of a list. An error item is\n * not in the new list, and with strict it is the error of the op.\n */\n #order(op: \"sortBy\" | \"take\", head: Expr, rest: readonly Expr[], ctx: Ctx): Code {\n const list = this.#listOf(head, ctx);\n // A missing count is the literal null, which is not a whole number, so take gives its error.\n const exprs = [head, ...(op === \"take\" ? [rest[0] ?? lit(null)] : [])];\n const strict = this.#strict(op, rest.slice(exprs.length - 1));\n const raw = [list, ...exprs.slice(1).map((x) => this.expr(x, ctx))];\n const deps = depsOf(...raw);\n const parts = this.#inOrder(this.#settle(raw, deps, exprs), true);\n const item = (list.v.list as ListInfo).item;\n return { s: stmtsOf(...parts), v: { code: `${this.use(op === \"sortBy\" ? \"SB\" : \"TK\")}(${[...parts.map((x) => x.v.code), String(strict)].join(\", \")})`, kind: undefined, safe: false, deps, list: { item } } };\n }\n\n /** This method prints a list op over a list that is not an each: a loop over its array, and nth (LIST.NTH). */\n #overList(op: string, head: Expr, rest: readonly Expr[], ctx: Ctx): Code {\n const list = this.#listOf(head, ctx);\n // A missing position is the literal null, which is not a whole number, so nth gives its error.\n const exprs = [head, ...(op === \"nth\" ? [rest[0] ?? lit(null)] : [])];\n const strict = this.#strict(op, rest.slice(exprs.length - 1));\n const raw = [list, ...exprs.slice(1).map((x) => this.expr(x, ctx))];\n const deps = depsOf(...raw);\n const parts = this.#inOrder(this.#settle(raw, deps, exprs), true);\n const [l] = parts as [Code];\n const item = (list.v.list as ListInfo).item;\n if (op === \"nth\") return { s: stmtsOf(...parts), v: { code: `${this.use(\"NT\")}(${[...parts.map((x) => x.v.code), String(strict)].join(\", \")})`, kind: item, safe: false, deps } };\n const r = this.#reduction(op, item);\n const { v } = r;\n const s = [...l.s, r.init, `for (const [, ${v}] of ${l.v.code}) {`, ` if (${v} === E) ${strict ? `${this.use(\"F\")}();` : \"continue;\"}`, ` ${r.step}`, \"}\"];\n return { s, v: { code: r.result, kind: listKind(op, item), safe: false, deps } };\n }\n\n /**\n * This method gives the names of a loop (LOOP.NAMES): a variable for each name of `init`, with its first value at the\n * node. Inside the loop, each name has the level `loop`. Thus a part that reads a name stays in the loop. A loop that\n * reads no key of the run is a constant of the run.\n */\n #loopNames(init: Names, ctx: Ctx, loop: number): { readonly s: string[]; readonly env: Map<string, Name>; readonly vars: ReadonlyMap<string, Name>; readonly deps: Set<number> } {\n const s: string[] = [];\n const env = new Map(ctx.env);\n const vars = new Map<string, Name>();\n const deps = new Set<number>();\n for (const [name, x] of Object.entries(init)) {\n const c = this.expr(x, ctx);\n if (c.v.kind === undefined) throw new NotStandalone(`the first value of the name \"${name}\" of a loop has no kind`);\n const v = this.fresh(\"l\");\n s.push(...c.s, `let ${v} = ${c.v.code};`);\n const read: Name = { code: v, kind: c.v.kind, lazy: false, deps: new Set([loop]) };\n env.set(name, read);\n vars.set(name, read);\n for (const d of c.v.deps) deps.add(d);\n }\n return { s, env, vars, deps };\n }\n\n /** This method gives the statements of one step of a loop: each new value first, and then each name gets its value. */\n #loopStep(step: Names, inner: Ctx, vars: ReadonlyMap<string, Name>): { readonly s: string[]; readonly deps: ReadonlySet<number> } {\n const s: string[] = [];\n const sets: string[] = [];\n const deps = new Set<number>();\n for (const [name, x] of Object.entries(step)) {\n const c = this.#hoist(this.expr(x, inner), hasLoop(x));\n const v = vars.get(name) as Name;\n if (c.v.kind !== v.kind) throw new NotStandalone(`a step of a loop changes the kind of the name \"${name}\"`);\n const t = this.fresh(\"t\");\n s.push(...c.s, `const ${t} = ${c.v.code};`);\n sets.push(`${v.code} = ${t};`);\n for (const d of c.v.deps) deps.add(d);\n }\n return { s: [...s, ...sets], deps };\n }\n\n /**\n * An iteration (ITERATE.LIMIT, ITERATE.UNTIL): a `for` loop with a variable for each name. An error of a value, of the\n * test or of the result throws, so it is the value of the iteration.\n */\n #iterate(e: ExprOf<\"iterate\">, ctx: Ctx): Code {\n // Stryker disable next-line UpdateOperator: a level of a loop is a name, so a count down gives other names, and the same code\n const loop = this.#loops++;\n const names = this.#loopNames(e.init, ctx, loop);\n const inner: Ctx = { ...ctx, env: names.env };\n const until = e.until === undefined ? undefined : this.expr(e.until, inner);\n const step = this.#loopStep(e.step, inner, names.vars);\n const result = this.expr(e.result, inner);\n const k = this.fresh(\"k\");\n const body = [\n ...(until === undefined ? [] : [...until.s, `if (${this.#boolean(until.v)}) break;`]),\n `if (${k} === ${String(e.limit)}) ${until === undefined ? \"break;\" : `${this.use(\"F\")}();`}`,\n ...step.s,\n ];\n const inside = [...(until?.v.deps ?? []), ...step.deps, ...result.v.deps].filter((d) => d !== loop);\n const deps = new Set([...names.deps, ...inside]);\n return { s: [...names.s, `for (let ${k} = 0; ; ${k}++) {`, ...ind(body), \"}\", ...result.s], v: { code: result.v.code, kind: result.v.kind, safe: false, deps } };\n }\n\n /**\n * A fold (FOLD.ORDER, FOLD.ERROR): the loop over the targets of an axis, with a variable for each name. The tests read\n * only the names outside the fold. An error throws, so it is the value of the fold.\n */\n #fold(e: ExprOf<\"fold\">, ctx: Ctx): Code {\n // Stryker disable next-line UpdateOperator: a level of a loop is a name, so a count down gives other names, and the same code\n const loop = this.#loops++;\n const names = this.#loopNames(e.init, ctx, loop);\n const t = this.#targetLoop(e.axis, e.at ?? [], ctx);\n const tests = t.tests.map((x) => this.#hoist(this.expr(x, t.inner), hasLoop(x)));\n // The interpreter evaluates the tests at each target before the first step, so a module of a sheet does not have them.\n if (tests.some((x) => x.v.deps.has(CELLS))) throw new NotStandalone(\"a test of the axis of a fold reads a cell\");\n const step = this.#loopStep(e.step, { ...t.inner, env: names.env }, names.vars);\n const result = this.expr(e.result, { ...ctx, env: names.env });\n const body = [\n ...t.key,\n ...(t.skip === undefined ? [] : [`if (${t.j} === ${t.skip}) continue;`]),\n ...t.check,\n ...tests.flatMap((c) => [...c.s, `if (!${this.#boolean(c.v)}) continue;`]),\n ...step.s,\n ];\n const inside = [...tests.flatMap((c) => [...c.v.deps]), ...step.deps].filter((d) => d !== loop && d !== t.inner.level);\n const deps = new Set([...names.deps, ...t.start, ...inside, ...[...result.v.deps].filter((d) => d !== loop)]);\n return { s: [...names.s, ...t.s, t.head, ...ind(body), \"}\", ...result.s], v: { code: result.v.code, kind: result.v.kind, safe: false, deps } };\n }\n\n /**\n * A node of the memo: one function of its keys for each structure, with an entry for each value of the keys. A key\n * that is a constant of the run is the variable of that constant, not a key of the function. A node with no other key\n * is a constant of the run itself.\n */\n #memoized(e: Expr, keys: readonly Expr[], ctx: Ctx): Code {\n const values = keys.map((k) => this.#hoist(this.expr(k, ctx)));\n const varying = keys.filter((_k, i) => (values[i] as Code).v.deps.size > 0);\n const params = varying.map(() => this.fresh(\"q\"));\n const names = new Map(\n keys.map((k, i): [Expr, Name] => {\n const x = (values[i] as Code).v;\n const p = varying.indexOf(k);\n return [k, p < 0 ? this.#nameOf(x) : { code: params[p] as string, kind: x.kind, lazy: true, deps: new Set([1]) }];\n }),\n );\n const outer = this.#inside;\n this.#inside = e;\n const bodyCtx: Ctx = { origin: undefined, focus: undefined, level: 1, originLevel: 1, env: new Map(), fns: new Map(), keys: names };\n if (varying.length === 0) {\n const body = this.#hoist(this.expr(e, bodyCtx));\n this.#inside = outer;\n return body;\n }\n // The kinds of the keys decide the ops in the node, so they are a part of the structure. Each key of the function\n // can hold the error sentinel, so the nodes with a safe key and the nodes without one share it.\n const tokens = new Map(keys.map((k, i): [Expr, object] => [k, varying.includes(k) ? { \"#\": varying.indexOf(k), kind: (values[i] as Code).v.kind } : { \"@\": (names.get(k) as Name).code }]));\n const structure = canonical(e, (x) => tokens.get(x as Expr));\n let fn = this.#structures.get(structure);\n if (fn === undefined) {\n fn = this.fresh(\"m\");\n this.#structures.set(structure, fn);\n this.memos = true;\n const cached = varying.length === 1 ? this.#cached(e, varying[0] as Expr, bodyCtx, fn) : undefined;\n if (cached !== undefined) {\n this.#kinds.set(fn, cached.kind);\n this.run.push(...cached.lines);\n } else {\n // The loop of the node gives statements.\n const body = this.expr(e, bodyCtx);\n this.#kinds.set(fn, body.v.kind);\n this.#lists.set(fn, body.v.list);\n this.run.push(`const ${fn} = ${this.use(params.length === 1 ? \"M1\" : \"M\")}((${params.join(\", \")}) => {`, ...ind(body.s), ` return ${body.v.code};`, \"});\");\n }\n }\n this.#inside = outer;\n // Each key of the function gets its value, or the error sentinel.\n const s: string[] = [];\n const args = varying.map((k) => {\n const c = values[keys.indexOf(k)] as Code;\n if (c.v.safe && c.s.length === 0) return c.v.code;\n if (c.s.length === 0 && c.v.held !== undefined) return c.v.held;\n const t = this.fresh(\"k\");\n s.push(...this.#store(t, c));\n return t;\n });\n return { s, v: { code: `${fn}(${args.join(\", \")})`, kind: this.#kinds.get(fn), safe: false, deps: depsOf(...values), list: this.#lists.get(fn) } };\n }\n\n /**\n * This method gives the code of a node of the memo whose key is only in one test of a list op: `test(T, key)`. Such a\n * node keeps its items in the helper `S`. One pass gives the tests before the test of the key and the value `T` of each\n * item. The rest of an item evaluates once, at the first key whose test is true.\n *\n * With the test `===`, each value `T` has a group of items. With `<` or `<=` and values `T` that do not decrease, the\n * items whose test is true are a prefix. Each prefix keeps its running value. The values add in the order of the items, so the result has the bits of the interpreter. An error before the test\n * of the key is an error of the item at each key. An error after it is an error at the keys whose test is true.\n */\n #cached(e: Expr, key: Expr, bodyCtx: Ctx, fn: string): { readonly lines: readonly string[]; readonly kind: Kind | undefined } | undefined {\n // Only an app has an op, and a node of the memo has a loop, so a list op has its target.\n const { op, args } = e as ExprOf<\"app\">;\n if (!LIST_OPS.has(op)) return undefined;\n const [target, ...rest] = args as [Expr, ...Expr[]];\n if (target.tag !== \"each\" || (target.at ?? []).length > 0) return undefined;\n const strict = this.#strict(op, rest);\n const kind = (bodyCtx.keys.get(key) as Name).kind;\n const { base, tests: raw } = testsOf(target.axis);\n const tests = raw.flatMap(partsOf);\n const at = tests.findIndex((t) => contains(t, key));\n const test = tests[at];\n if (base.t !== \"all\" || test?.tag !== \"app\" || test.args.length !== 2 || contains(target.body, key) || tests.some((t, i) => i !== at && contains(t, key))) return undefined;\n const [l, r] = test.args as [Expr, Expr];\n const keyFirst = l === key;\n const other = keyFirst ? r : l;\n if ((!keyFirst && r !== key) || contains(other, key)) return undefined;\n const j = this.fresh(\"j\");\n const loop: Ctx = { ...bodyCtx, focus: j, level: 2 };\n const t = this.#hoist(this.expr(other, loop));\n // The test of the key is an op whose inline form cannot fail: then the loop over the items needs no try.\n const site = this.#facts.staticSite(test.op, keyFirst ? [kind, t.v.kind] : [t.v.kind, kind]);\n if (site?.t !== \"fn\" || site.bad || site.returns !== \"boolean\" || this.check(\"boolean\") !== undefined) return undefined;\n // A static site of a domain has the function of the op of that domain.\n const form = inlineForm(Function.prototype.toString.call(((this.#domains[site.domain] as AnyDomain).ops[test.op] as { fn: (...a: never[]) => unknown }).fn));\n if (form?.params.length !== 2) return undefined;\n const before = tests.slice(0, at).map((x) => this.#hoist(this.expr(x, loop)));\n const after = tests.slice(at + 1).map((x) => this.#hoist(this.expr(x, loop)));\n const body = this.#hoist(this.expr(target.body, loop));\n const B = (v: Value): string => this.#boolean(v);\n // The kind of the test of the key: `===` gives the groups of equal values, and `<` or `<=` from T to the key gives\n // the prefixes of the items when T does not decrease. NaN satisfies neither test, so its item is in no group.\n const pattern = patternOf(form, (p) => (keyFirst ? 1 - p : p));\n const mode = pattern === \"#0===#1\" || pattern === \"#1===#0\" ? 1 : [\"#0<#1\", \"#0<=#1\", \"#1>#0\", \"#1>=#0\"].includes(pattern) ? 2 : 0;\n const testArgs = keyFirst ? [\"q\", \"t\"] : [\"t\", \"q\"];\n const keyTest = form.parts.map((p) => (typeof p === \"number\" ? `(${testArgs[p] as string})` : p)).join(\"\");\n if (mode === 1) this.features.add(\"group\");\n if (mode === 2) this.features.add(\"prefix\");\n if (strict) this.features.add(\"strict\");\n const F = this.use(\"F\");\n // A function of the index of an item, from its statements and its value.\n const arrow = (lines: readonly string[], code: string): readonly string[] => (lines.length === 0 ? [`(${j}) => ${code}`] : [`(${j}) => {`, ...ind(lines), ` return ${code};`, \"}\"]);\n const pre = before.length === 0 ? undefined : before.every((x) => x.s.length === 0) ? arrow([], before.map((x) => B(x.v)).join(\" && \")) : arrow(before.flatMap((x, i) => [...x.s, ...(i < before.length - 1 ? [`if (!${B(x.v)}) return false;`] : [])]), B((before.at(-1) as Code).v));\n // The value of an item: the tests after the test of the key, and the body. N is an item that a later test excludes,\n // and E is an error.\n const value =\n after.length === 0 && body.v.safe && body.s.length === 0\n ? arrow([], body.v.code)\n : [`(${j}) => {`, \" try {\", ...ind(ind([...after.flatMap((x) => [...x.s, `if (!${B(x.v)}) return N;`]), ...body.s])), ` return ${body.v.code};`, \" } catch {\", \" return E;\", \" }\", \"}\"];\n const [stepName, stepCode] = STEPS[op] as readonly [string, string];\n this.top.set(stepName, `const ${stepName} = ${stepCode};`);\n // A sum has the check of a number, and only a sum or a mean needs that check.\n const results: Readonly<Record<string, () => readonly [string, string]>> = {\n count: () => [\"r_count\", \"(a, c) => c\"],\n sum: () => [this.check(\"number\") ?? \"r_id\", \"(a) => a\"],\n mean: () => [\"r_mean\", `(a, c) => (c === 0 ? ${F}() : ${this.#checked(\"number\", \"a / c\")})`],\n any: () => [\"r_id\", \"(a) => a\"],\n all: () => [\"r_id\", \"(a) => a\"],\n none: () => [\"r_not\", \"(a) => !a\"],\n };\n const [resultName, resultCode] = results[op]?.() ?? [\"r_one\", `(a, c) => (c === 0 ? ${F}() : a)`];\n if (!this.top.has(resultName)) this.top.set(resultName, `const ${resultName} = ${resultCode};`);\n const a0 = op === \"sum\" || op === \"mean\" ? \"0\" : op === \"all\" ? \"true\" : BOOLEAN_LIST_OPS.has(op) ? \"false\" : \"undefined\";\n // The values of an op of numbers or of booleans have that kind, or the result is an error. Count takes each kind.\n const needs = op === \"count\" ? undefined : listKind(op, undefined);\n const ok = needs === undefined || body.v.kind === needs ? [] : [`(x) => typeof x === \"${needs}\"`];\n if (ok.length > 0) this.features.add(\"ok\");\n if (pre !== undefined) this.features.add(\"pre\");\n const fns = [arrow(t.s, t.v.code), value, [`(t, q) => ${keyTest}`], ...(pre === undefined && ok.length === 0 ? [] : [pre ?? [\"undefined\"]]), ...(ok.length === 0 ? [] : [ok])];\n const lines = fns.flatMap((x, i) => [...x.slice(0, -1), `${x.at(-1) ?? \"\"}${i < fns.length - 1 ? \",\" : \"\"}`]);\n return { lines: [`const ${fn} = ${this.use(\"S\")}(n, ${mode}, ${String(strict)}, ${a0}, ${stepName}, ${resultName},`, ...ind(lines), \");\"], kind: listKind(op, body.v.kind) };\n }\n\n /** This method gives the code of the program at the key of the run. A constant of the run evaluates once. */\n /** This method gives the code of a program at the key `o` of the run. A sheet has one program for each formula. */\n root(expr: Expr): Code {\n return this.#hoist(this.expr(expr, { origin: \"o\", focus: \"o\", level: 1, originLevel: 1, env: new Map(), fns: new Map(), keys: new Map() }));\n }\n\n /** This method removes the declarations that no code reads, after the last program. */\n finish(): void {\n // A function of an op with an inline form at each of its sites needs no declaration.\n for (const [name, form] of this.#forms) if (form !== undefined && !this.#called.has(name)) this.top.delete(name);\n }\n\n /**\n * This method gives a text that is the same for two expressions with the same structure and the same reads. A name\n * that the expression does not bind gives its variable in the code, and a key of the memo gives its variable too.\n */\n #constKey(e: Expr, ctx: Ctx): string {\n // A name gives its variable for each read, also for a read of a name that the expression binds. The variable depends\n // only on the name, so two expressions with the same text have the same value.\n return canonical(e, (x) => {\n const key = ctx.keys.get(x as Expr);\n if (key !== undefined) return { \"@\": key.code };\n const node = x as Expr | undefined;\n if (node?.tag === \"var\") return { $: ctx.env.get(node.name)?.code ?? node.name };\n // A call gives the number of the binding of its function, so two functions with one name give two keys.\n return node?.tag === \"call\" ? { \"()\": node.fn, of: ctx.fns.get(node.fn)?.id ?? null, args: node.args } : undefined;\n });\n }\n}\n\n/** This function gives the name of the function of a module, and its space, or the reason that the options are not valid. */\nfunction runOf(options: ModuleOptions): { readonly name: string; readonly tree: boolean } | { readonly reason: string } {\n const name = options.name ?? \"run\";\n if (!/^[A-Za-z_$][\\w$]*$/.test(name)) return { reason: `the name \"${name}\" is not a JavaScript name` };\n const tree = options.space === \"tree\";\n if (!tree && options.space !== undefined && options.space !== \"array\") return { reason: `the space \"${String(options.space)}\" is not \"array\" or \"tree\"` };\n return { name, tree };\n}\n\n/** This function gives the reason of an error of the printer. Another exception is a defect, so it goes to the caller. */\nfunction reasonOf(thrown: unknown): Emitted {\n if (!(thrown instanceof NotStandalone)) throw thrown;\n return { ok: false, reason: thrown.message };\n}\n\n/**\n * This function gives the text of a module: the declarations, the helpers, and the function of the run. The run checks\n * its input, computes the parts of the tree and the constants of the run, and then gives the statements `body`.\n */\nfunction printModule(p: Printer, options: ModuleOptions, run: { readonly name: string; readonly tree: boolean }, body: readonly string[]): Emitted {\n p.use(\"C\");\n const helpers = new Set<Helper>();\n // A helper comes after the helpers that it needs. A set keeps the first place of each helper.\n const add = (h: Helper): void => {\n for (const x of NEEDS[h]) add(x);\n helpers.add(h);\n };\n const fields = Object.entries(options.schema.fields ?? {});\n const vars = Object.entries(options.schema.vars ?? {});\n let fieldChecks: string;\n let varChecks: string;\n try {\n fieldChecks = fields.map(([f, k]) => ` || ${p.against(k, `r[${JSON.stringify(f)}]`)}`).join(\"\");\n varChecks = vars.map(([v, k]) => ` || ${p.against(k, `vars[${JSON.stringify(v)}]`)}`).join(\"\");\n } catch (thrown) {\n return reasonOf(thrown);\n }\n const { name, tree } = run;\n // A tree checks its parents, and it computes the parts that the program reads. The siblings and the order need the\n // children.\n if (tree) p.use(\"PT\");\n if (p.treeParts.size > 0) p.treeParts.add(\"children\");\n const parts = ([\"children\", \"siblings\", \"order\"] as const).filter((x) => p.treeParts.has(x));\n for (const x of parts) p.use(TREE_PARTS[x][0]);\n [...p.helpers].toSorted().forEach(add);\n // The names that this module declares at its top: the constants, the helpers and the declarations of the printer.\n const declared = new Set<string>([\"VexContractError\", \"VEX_ERROR\", \"E\", ...(p.memos ? [\"Z\"] : []), ...(helpers.has(\"S\") ? [\"N\", \"W\"] : []), ...helpers, ...p.top.keys()]);\n const bad = nameReason(name, declared);\n if (bad !== undefined) return { ok: false, reason: bad };\n const lines = [\n \"// Generated by @mark1russell7/vex-compiler from a Vex program. Do not edit.\",\n \"/** The error of a run whose input does not keep the schema of the program. */\",\n \"export class VexContractError extends Error {}\",\n \"/** The value of a key where the program gives an error of Vex. */\",\n \"export const VEX_ERROR = Object.freeze({ vexError: true });\",\n \"const E = {};\",\n ...(p.memos ? [\"const Z = {};\"] : []),\n // The values of an item of a node that keeps its items: excluded by a later test, and of the wrong kind.\n ...(helpers.has(\"S\") ? [\"const N = {}, W = {};\"] : []),\n ...[...helpers].map((h) => (h === \"S\" ? helperS(p.features) : HELPERS[h])),\n ...p.top.values(),\n `export function ${name}(records, vars${tree ? \", parents\" : \"\"}) {`,\n ' if (!Array.isArray(records)) C(\"the records are not an array\");',\n \" const R = records;\",\n \" const n = R.length;\",\n \" for (let i = 0; i < n; i++) {\",\n \" const r = R[i];\",\n ` if (typeof r !== \"object\" || r === null${fieldChecks}) C(\\`the record \\${i} does not keep the schema\\`);`,\n \" }\",\n ` if (typeof vars !== \"object\" || vars === null${varChecks}) C(\"the variables do not keep the schema\");`,\n ...(tree ? [\" const P = PT(parents, n);\", ...parts.map((x) => ` ${TREE_PARTS[x][1]}`)] : []),\n ...[...p.vars].map(([v, code]) => ` const ${code} = vars[${JSON.stringify(v)}];`),\n ...ind(p.run),\n ...ind(body),\n \"}\",\n \"\",\n ];\n return { ok: true, source: lines.join(\"\\n\") };\n}\n\n/**\n * This function prints a program as a standalone ES module. The module exports `VexContractError`, `VEX_ERROR` and a\n * function that takes the records and the variables and gives the value at each key. A module of a tree space takes\n * the parents too. The function is pure, so a build can use it. The program can be an expression or a document\n * (DOC.ENTRY).\n */\nexport function emitModule(source: Expr | Envelope, options: ModuleOptions): Emitted {\n const run = runOf(options);\n if (\"reason\" in run) return { ok: false, reason: run.reason };\n // DOC.ENTRY: a document gives its expression first, or the reason that it is not valid.\n const read = isDocument(source) ? fromDocument(source, options.domains) : { ok: true as const, value: source };\n if (!read.ok) return { ok: false, reason: read.error.message };\n const expr = read.value;\n // EVAL.SHAPE: a module of an expression that is not valid has no use, so the printer gives the reason.\n const shape = shapeError(expr);\n if (shape !== undefined) return { ok: false, reason: shape };\n const p = new Printer(expr, options);\n let value: Code;\n try {\n value = p.root(expr);\n p.finish();\n } catch (thrown) {\n return reasonOf(thrown);\n }\n const body = [\"const out = [];\", \"for (let o = 0; o < n; o++) {\", \" try {\", ...ind(ind(value.s)), ` out.push(${value.v.code});`, \" } catch {\", \" out.push(VEX_ERROR);\", \" }\", \"}\", \"return out;\"];\n return printModule(p, options, run, body);\n}\n\n/** The budget of the stack of the search of a run of a sheet, as `STACK_BUDGET` of `SheetRun`. */\nconst SHEET_BUDGET = 3000;\n\n/** A formula of a sheet: its column, the position of its cell (undefined for the formula of the column) and its expression. */\ninterface Formula {\n readonly column: string;\n readonly key: number | undefined;\n readonly expr: Expr;\n}\n\n/** This function gives the words for a formula in a reason: the formula of a column, or of one cell. */\nconst formulaText = (f: Formula): string => (f.key === undefined ? `the formula of the column \"${f.column}\"` : `the formula of the cell \"${f.column}\" at \"${String(f.key)}\"`);\n\n/** This function gives the words for a kind in a reason. */\nconst kindText = (k: Kind | undefined): string => k ?? \"that the printer does not know\";\n\n/**\n * This function prints the formula columns of a sheet as a standalone ES module (COMPILE.MODULE.SHEET). The function of\n * the module takes the records and the variables, and the parents for a tree. It gives an object with an array for\n * each column: the result of the column at each key, or `VEX_ERROR`. The results are the results of `SheetRun`.\n *\n * The run fills the columns in the order of `SheetRun.fill`. A read of a finished cell is the read of an array. A read\n * of a cell that is not finished starts the search of `SheetRun`, with the same budget of the stack. Each cell on a\n * cycle of reads gives `VEX_ERROR`.\n */\nexport function emitSheetModule(columns: ReadonlyMap<string, Expr>, options: SheetModuleOptions): Emitted {\n const run = runOf(options);\n if (\"reason\" in run) return { ok: false, reason: run.reason };\n const budget = options.budget ?? SHEET_BUDGET;\n if (!Number.isSafeInteger(budget) || budget < 0) return { ok: false, reason: `the budget ${String(budget)} is not a whole number of 0 or more` };\n const cells: CellFormulas = options.cells ?? new Map();\n const names = [...new Set([...columns.keys(), ...cells.keys()])];\n const order = columnOrder(columns, cells);\n // The formulas in the order of the columns. A key of a cell that is not the text of a position is not a key of the\n // space, so no read finds its formula.\n const formulas: Formula[] = order.flatMap((column): Formula[] => {\n const own = [...(cells.get(column) ?? [])].filter(([k]) => /^(0|[1-9]\\d*)$/.test(k) && Number.isSafeInteger(Number(k)));\n const formula = columns.get(column);\n return [...(formula === undefined ? [] : [{ column, key: undefined, expr: formula }]), ...own.map(([k, expr]) => ({ column, key: Number(k), expr }))];\n });\n for (const f of formulas) {\n // EVAL.SHAPE: the printer gives the reason for an expression that is not valid.\n const shape = shapeError(f.expr);\n if (shape !== undefined) return { ok: false, reason: `${formulaText(f)}: ${shape}` };\n }\n const kinds = new Map<string, Kind | undefined>(Object.entries(options.kinds ?? {}));\n const index = new Map(names.map((c, i) => [c, i]));\n // The memo of the printer covers each formula, so the formulas share their nodes of the memo.\n const p = new Printer(rec(Object.fromEntries(formulas.map((f, i) => [`f${String(i)}`, f.expr]))), options, { columns: index, kinds });\n const fns: string[] = [];\n const decls: string[] = [];\n try {\n for (const f of formulas) {\n const code = p.root(f.expr);\n const kind = code.v.kind;\n // The first formula of a column without a kind of the options gives the kind of the column.\n if (!kinds.has(f.column)) kinds.set(f.column, kind);\n else if (kinds.get(f.column) !== kind) throw new NotStandalone(`${formulaText(f)} gives a value of the kind ${kindText(kind)}, not of the kind ${kindText(kinds.get(f.column))} of its column`);\n const fn = p.fresh(\"cf\");\n fns.push(fn);\n decls.push(...(code.v.safe && code.s.length === 0 ? [`const ${fn} = (o) => ${code.v.code};`] : [`const ${fn} = (o) => {`, \" try {\", ...ind(ind(code.s)), ` return ${code.v.code};`, \" } catch {\", \" return E;\", \" }\", \"};\"]));\n }\n p.finish();\n } catch (thrown) {\n return reasonOf(thrown);\n }\n // The program of each column, and of each cell with its own formula, with its cost in estimated frames, as in SheetRun.\n const entry = (i: number): string => `[${fns[i] as string}, ${String(3 * nestingOf((formulas[i] as Formula).expr) + 16)}]`;\n const own = names.map((c) => {\n const at = formulas.flatMap((f, i) => (f.column === c && f.key !== undefined ? [`${String(f.key)}: ${entry(i)}`] : []));\n return at.length === 0 ? \"undefined\" : `{ ${at.join(\", \")} }`;\n });\n const cols = names.map((c) => {\n const i = formulas.findIndex((f) => f.column === c && f.key === undefined);\n return i < 0 ? \"undefined\" : entry(i);\n });\n p.use(\"SH\");\n // A tree gives the keys in the order of a fill with the helper KO, once for each order.\n const orders = new Map<string, string>();\n const fill = order.map((c) => {\n const { reverse, post, back } = keyOrderOf(readsOf(columns, cells, c).directions);\n const at = String(index.get(c));\n if (!run.tree) return reverse ? `for (let o = n - 1; o >= 0; o--) SS.f(${at}, o);` : `for (let o = 0; o < n; o++) SS.f(${at}, o);`;\n const args = `${p.use(\"KO\")}(H, RT, ${String(post)}, ${String(back)})`;\n let keys = orders.get(args);\n if (keys === undefined) {\n keys = p.fresh(\"K\");\n orders.set(args, keys);\n }\n return `for (const o of ${keys}) SS.f(${at}, o);`;\n });\n if (run.tree) p.treeParts.add(\"children\");\n const body = [\n ...decls,\n `const SS = SH(n, [${cols.join(\", \")}], [${own.join(\", \")}], ${String(budget)});`,\n `const ${READ_CELL} = SS.r;`,\n ...[...orders].map(([args, keys]) => `const ${keys} = ${args};`),\n ...fill,\n `return { ${names.map((c, i) => `${JSON.stringify(c)}: SS.o(${String(i)})`).join(\", \")} };`,\n ];\n return printModule(p, options, run, body);\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,YAAY;;;;;AAMzB,MAAM,4BAAiC,IAAI,IAAI;CAAC;CAAU;CAAQ;CAAO;CAAQ;CAAU;CAAQ;CAAW;AAAK,CAAC;;;;;;AAOpH,SAAgB,WAAW,MAAgC;CACzD,MAAM,OAAe,CAAC,IAAI;CAC1B,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,MAAM,KAAA,GAAW,IAAI,KAAK,IAAI,GAAG;EACxD,KAAK,EAAE,QAAQ,UAAU,EAAE,QAAQ,WAAW,OAAO,EAAE,IAAI,MAAM,KAAA,GAAW,OAAO;EAEnF,IAAI,EAAE,QAAQ,SAAS,UAAU,IAAI,EAAE,EAAE,GAAG,OAAO,gCAAgC,EAAE,GAAG;EACxF,IAAI,EAAE,QAAQ,SAAS,UAAU,EAAE,KAAK,GAAG,OAAO;EAClD,KAAK,KAAK,GAAG,SAAS,CAAC,CAAC;CAC1B;AAEF;;AAYA,MAAa,gBAAgB,MAAuB,EAAE,aAAa,UAAU,EAAE;;AAG/E,MAAa,eAAe,MAAoD,MAAM,YAAY,MAAM,YAAY,MAAM,YAAY,IAAI,KAAA;AA6B1I,MAAM,UAA2B,OAAO,OAAO,CAAC,CAAC;;AAGjD,SAAgB,QAAQ,QAAmB,MAAiC;CAC1E,IAAI,CAAC,SAAS,IAAI,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;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAGX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,IAAI;CAIJ,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAGX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb;;;;;AAMA,MAAa,iBA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,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,SAAS,KAAK,KAAK,KAAK,EAAE;EAC/D,GAAG;EACH,YAAY,MAAM,KAAK,GAAG,MAAM,GAAG,KAAK,UAAU,CAAC,EAAE,SAAS,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE;CAElD,CAAC;AAC1C"}
1
+ {"version":3,"file":"index.js","names":["FREE","call","eachUnderLets","join","call","NEGATIVE_ZERO","partsOf"],"sources":["../src/facts.ts","../src/loop.ts","../src/js.ts","../src/memo.ts","../src/lower.ts","../src/runtime.ts","../src/tiers.ts","../src/sheet-order.ts","../src/module.ts"],"sourcesContent":["/**\n * The facts of the options that the printer uses (docs/COMPILER.md §13.2). For each op site, they give the domain\n * whose op the interpreter takes first, and the kinds and the lifts of its parameters. The facts come from the op\n * tables, so the same options always give the same facts, and the same source.\n */\nimport { children, isListOp, isOpName, isVexList, liftsAt, listOf, type AnyDomain, type Expr, type ExtHandler, type FreeFn, type OpSpec, type ParamKind, type PrimitiveKind, type ReturnKind } from \"@mark1russell7/vex\";\n\n/**\n * The most bodies of functions that tier 2 puts at the calls of one program. A function that calls another function\n * twice doubles its body, so a chain of such functions grows fast. A module prints each function once.\n */\nexport const MAX_CALLS = 10_000;\n\n/**\n * The list ops that give a list, or read a position or a key of a list (LIST.SORT, LIST.TAKE, LIST.NTH, LIST.BUILD,\n * LIST.GET, LIST.INDEXOF, LIST.FILL).\n */\nconst ORDER_OPS: ReadonlySet<string> = new Set([\"sortBy\", \"take\", \"nth\", \"drop\", \"append\", \"flat\", \"without\", \"get\", \"indexOf\", \"fill\"]);\n\n/**\n * This function gives the reason that tier 2 cannot take a program with lists as values. The reason is the axis `list`,\n * an op on the order or the keys of a list, or a list literal. Tier 1 evaluates such a program. It uses a stack, not\n * recursion.\n */\nexport function listReason(expr: Expr): string | undefined {\n const todo: Expr[] = [expr];\n for (let x = todo.pop(); x !== undefined; x = todo.pop()) {\n if ((x.tag === \"each\" || x.tag === \"fold\") && listOf(x.axis) !== undefined) return 'the program has the axis \"list\", and tier 2 does not have lists as values yet';\n // Stryker disable next-line ConditionalExpression: a node that is not an app has no field op, so the set does not have it\n if (x.tag === \"app\" && ORDER_OPS.has(x.op)) return `the program has the list op \"${x.op}\", and tier 2 does not have lists as values yet`;\n if (x.tag === \"lit\" && isVexList(x.value)) return \"the program has a list literal, and tier 2 does not have lists as values yet\";\n todo.push(...children(x));\n }\n return undefined;\n}\n\n/** The function of an op of a domain, or a method. */\nexport type Method = (...args: unknown[]) => unknown;\n\n/**\n * The kind of a value that the compiler knows: a primitive type, or `domain:Name`. The second kind is for a value of\n * the domain `Name` without a primitive type (KIND.DOMAIN).\n */\nexport type Kind = PrimitiveKind | `domain:${string}`;\n\n/** This function gives the kind of the values of a domain. */\nexport const kindOfDomain = (d: AnyDomain): Kind => d.primitive ?? `domain:${d.name}`;\n\n/** This function gives a kind if it is a primitive type, else `undefined`. */\nexport const primitiveOf = (k: Kind | undefined): PrimitiveKind | undefined => (k === \"number\" || k === \"string\" || k === \"boolean\" ? k : undefined);\n\n/**\n * The kinds that a host declares (docs/COMPILER.md §3.2): the kind of each field of the records, and of each variable of\n * the run. A read of a declared field or variable checks the kind. When the check fails, tier 1 evaluates the program.\n */\nexport interface Schema {\n readonly fields?: Readonly<Record<string, Kind>>;\n readonly vars?: Readonly<Record<string, Kind>>;\n}\n\n/** The options of a program: the domains, the free functions and the extension handlers, and the schema of the host. */\nexport interface Options {\n readonly domains?: readonly AnyDomain[];\n readonly fns?: Readonly<Record<string, FreeFn>>;\n readonly extensions?: Readonly<Record<string, ExtHandler>>;\n readonly schema?: Schema;\n}\n\n/**\n * The op of one name in one domain, as `resolveOp` of the core finds it. It is the function of the spec, or else a\n * method of the receiver.\n */\nexport interface Entry {\n readonly domain: AnyDomain;\n readonly spec: OpSpec<unknown>;\n readonly fn: Method | undefined;\n}\n\nconst NO_SPEC: OpSpec<unknown> = Object.freeze({});\n\n/** This function gives the op of a name in a domain, or `undefined` for a domain without the op. */\nexport function entryOf(domain: AnyDomain, name: string): Entry | undefined {\n if (!isOpName(name)) return undefined;\n const declared = Object.hasOwn(domain.ops, name) ? (domain.ops[name] as OpSpec<unknown>) : undefined;\n if (declared === undefined) return domain.methods === \"all\" ? { domain, spec: NO_SPEC, fn: undefined } : undefined;\n return { domain, spec: declared, fn: declared.fn as Method | undefined };\n}\n\n/**\n * The facts of an op site:\n * - `op`: the op of the domain `domain` comes first. It is a method of the receiver, or else the function of the spec.\n * `params` are the kinds of the parameters, and `lift` lifts numbers (`liftScalar`, if the domain has `fromScalar`).\n * - `free`: no domain has the op, and a free function has the name.\n *\n * Without facts, the site uses the dispatch of the runtime only.\n */\nexport type SiteFacts =\n | {\n readonly t: \"op\";\n readonly domain: number;\n readonly method: boolean;\n readonly params: readonly ParamKind[] | undefined;\n readonly lift: OpSpec<unknown>[\"liftScalar\"];\n }\n | { readonly t: \"free\" };\n\nconst FREE: SiteFacts = Object.freeze({ t: \"free\" });\n\n/**\n * The op of a site whose values have known kinds (KIND.STATIC):\n * - `fn`: the function of the op of the domain `domain`. `bad` is true when an argument has a kind that the op does\n * not accept, so the interpreter gives an error. `returns` is the kind of the result, if the op declares it.\n * - `free`: no domain that accepts the receiver has the op, and a free function has the name.\n */\nexport type StaticSite =\n | { readonly t: \"fn\"; readonly domain: number; readonly bad: boolean; readonly returns: Kind | undefined }\n | { readonly t: \"free\" };\n\nconst STATIC_FREE: StaticSite = Object.freeze({ t: \"free\" });\n\n/** This function gives the kind of the result of an op of a domain, if the op declares it. */\nfunction returnsOf(domain: AnyDomain, kind: ReturnKind | undefined): Kind | undefined {\n if (kind === \"domain\") return kindOfDomain(domain);\n return kind === \"any\" ? undefined : kind;\n}\n\n/** This function tells if an argument of a kind fits a parameter, or `undefined` if the kind of the argument is unknown. */\nfunction fits(domain: AnyDomain, param: ParamKind | undefined, arg: Kind | undefined): boolean | undefined {\n if (param === undefined || param === \"any\") return true;\n if (arg === undefined) return undefined;\n return arg === (param === \"domain\" ? kindOfDomain(domain) : param);\n}\n\n/**\n * This function tells if a domain accepts a value of a kind. A domain with a primitive type accepts its type, and a\n * domain without one accepts the values of its kind. For another value, it gives `undefined`: its `is` can accept it.\n */\nfunction accepts(d: AnyDomain, kind: Kind): boolean | undefined {\n if (d.primitive !== undefined) return d.primitive === kind;\n return kind === kindOfDomain(d) ? true : undefined;\n}\n\n/** The facts of the options. */\nexport interface Facts {\n /** This function gives the facts of the site of the op `name` with `arity` values, the receiver first, if it has facts. */\n site(name: string, arity: number): SiteFacts | undefined;\n /**\n * The checks of the result of an op, as `#checkResult` of the interpreter: for each domain, `true` if it has `valid`.\n * The list ends at the last domain with `valid`, because the domains after it check nothing.\n */\n readonly checks: readonly boolean[];\n /**\n * This function gives the op of a site with the kinds of its values, the receiver first. When the kinds do not decide\n * the op, it gives `undefined`. Each domain before the op must declare a primitive type. Then the interpreter takes\n * the same op at each run.\n */\n staticSite(name: string, kinds: readonly (Kind | undefined)[]): StaticSite | undefined;\n /**\n * This function gives the index of the domain that checks a result of a kind. When no domain accepts such a value,\n * it gives -1. When a domain without a primitive type comes first, it gives `undefined`.\n */\n checkOf(kind: Kind): number | undefined;\n}\n\n/** This function gives the facts of a set of options. */\nexport function factsOf(options: Options): Facts {\n const domains = options.domains ?? [];\n const fns = options.fns;\n const last = domains.findLastIndex((d) => d.valid !== undefined);\n return {\n checks: domains.slice(0, last + 1).map((d) => d.valid !== undefined),\n staticSite(name, kinds) {\n const [self, ...args] = kinds;\n // A primitive value is not a list, so a list op name is an op of a domain here, as in the interpreter.\n if (self === undefined) return undefined;\n for (const [i, d] of domains.entries()) {\n const takes = accepts(d, self);\n if (takes === undefined) return undefined;\n const e = takes ? entryOf(d, name) : undefined;\n // A primitive value has no methods, so only the function of a spec is an op for it. The domain of a value without\n // a primitive type can have methods, and a later domain can accept the value too.\n if (e?.fn === undefined) {\n if (takes && d.primitive === undefined) return undefined;\n continue;\n }\n // A lifted number goes through fromScalar: the site keeps the dispatch of the runtime.\n if (d.fromScalar !== undefined && args.some((a, j) => a !== \"string\" && a !== \"boolean\" && liftsAt(e.spec.liftScalar, j))) return undefined;\n const ok = args.map((a, j) => fits(d, e.spec.params?.[j], a));\n if (ok.includes(undefined)) return undefined;\n return { t: \"fn\", domain: i, bad: ok.includes(false), returns: returnsOf(d, e.spec.returns) };\n }\n return fns !== undefined && Object.hasOwn(fns, name) ? STATIC_FREE : undefined;\n },\n checkOf(kind) {\n for (const [i, d] of domains.entries()) {\n const takes = accepts(d, kind);\n if (takes === undefined) return undefined;\n if (takes) return i;\n }\n return -1;\n },\n site(name, arity) {\n // Without values, the interpreter takes no op of a domain. A list op can have a list as its receiver.\n if (arity === 0 || isListOp(name)) return undefined;\n const index = domains.findIndex((d) => entryOf(d, name) !== undefined);\n if (index < 0) return fns !== undefined && Object.hasOwn(fns, name) ? FREE : undefined;\n const e = entryOf(domains[index] as AnyDomain, name) as Entry;\n return { t: \"op\", domain: index, method: e.fn === undefined, params: e.spec.params, lift: e.domain.fromScalar === undefined ? undefined : e.spec.liftScalar };\n },\n };\n}\n","import type { PrimitiveKind } from \"@mark1russell7/vex\";\n\n/**\n * The loop IR (docs/COMPILER.md §3.3): a small language of statements between the Vex IR and the back ends. It has\n * locals, loops over arrays, checks and the functions of the runtime. A back end reads only this IR.\n *\n * A check that fails stops the program with the value `FALLBACK`. Then tier 1 does the evaluation again, so the result\n * is the result of the interpreter (§4.1).\n */\n\n/** The fixed locals of each program: the space, the origin, the variables and the tables of the run. */\nexport const SPACE = 0;\nexport const ORIGIN = 1;\nexport const VARS = 2;\nexport const TABLES = 3;\n/** The number of fixed locals. */\nexport const FIXED_LOCALS = 4;\n\n/** The functions of the runtime that generated code calls. Each one gives `FALLBACK` for a value it cannot give. */\nexport type RuntimeFn =\n | \"has\" // has(space, key): boolean\n | \"addr\" // addr(space, origin, focus, address, values?): the key of an address, with the values of its computed moves\n | \"table\" // table(tables, name): the space of a table\n | \"keys\" // keys(space): the keys of a space\n | \"step\" // step(name, acc, value): one step of reduce\n | \"result\" // result(value): the checks of the value of an op\n | \"opts\" // opts(value): the read of the option strict of a list op\n | \"rec\" // rec(names, values): a frozen record\n | \"list\" // list(keys, values): a list of an axis\n | \"frozen\" // frozen(array): a frozen copy\n | \"ext\" // ext(kind, data, space, origin, focus, path): an extension\n | \"var\"; // var(vars, name): a variable of the run\n\n/** The primitive operations of the loop IR. They copy no arithmetic of a domain (§4.2). */\nexport type PrimOp =\n | \"+\" // the sum of a reduction, in the order of the interpreter\n | \"/\" // the mean of a reduction\n | \"===\"\n | \"!==\"\n | \"!\"\n | \"||\"\n | \"&&\"\n | \"min\" // Math.min, the minimum of a reduction\n | \"max\" // Math.max, the maximum of a reduction\n | \"isNumber\"\n | \"isBoolean\"\n | \"isString\"\n | \"isValue\" // not undefined and not null\n | \"isObject\" // an object or a function\n | \"get\" // get(space, key): the record of a key\n | \"member\" // member(object, name): the property of an object\n | \"records\" // records(space): the records of the space by index, or undefined (SPACE.RECORDS)\n | \"recordAt\" // recordAt(records, index, space, key): the record at an index, or else the record of the key\n | \"keysOf\" // keysOf(targets): the keys of the targets of an axis\n | \"idxOf\" // idxOf(targets): the index of each target in the keys of the space\n | \"memoGet\" // memoGet(memo, space, keys): the entry of a space and the values of its keys, or undefined\n | \"memoPut\" // memoPut(memo, space, keys, value, ok): the new entry of a space and the values of its keys\n | \"entryValue\" // entryValue(entry): the value of an entry of a memo\n | \"entryOk\"; // entryOk(entry): true if the entry has a value\n\n/** A value of the loop IR. */\nexport type LExpr =\n | { readonly t: \"const\"; readonly i: number }\n | { readonly t: \"local\"; readonly n: number }\n | { readonly t: \"num\"; readonly v: number }\n | { readonly t: \"bool\"; readonly v: boolean }\n | { readonly t: \"fallback\" }\n | { readonly t: \"array\"; readonly items: readonly LExpr[] }\n | { readonly t: \"prim\"; readonly op: PrimOp; readonly args: readonly LExpr[] }\n | { readonly t: \"call\"; readonly fn: RuntimeFn; readonly args: readonly LExpr[] }\n /**\n * The dispatch of the op whose name is the constant `name`, with the values of its arguments, the receiver first.\n * `kinds` are the kinds of the values that the lowering knows (KIND.STATIC).\n */\n | { readonly t: \"op\"; readonly name: number; readonly args: readonly LExpr[]; readonly kinds: readonly (PrimitiveKind | undefined)[] }\n /** The memo `id` of the program: the value of one node for each space (§7.2). */\n | { readonly t: \"memo\"; readonly id: number }\n /** The targets of the base axis that is the constant `axis`, at the space, the origin and the focus of `args`. */\n | { readonly t: \"targets\"; readonly axis: number; readonly args: readonly [LExpr, LExpr, LExpr] };\n\n/**\n * What a failed check does. The interpreter gives an error value at the node of the check, and the context of the node\n * decides what happens to that error:\n *\n * - `return`: the program stops with `FALLBACK`, and tier 1 evaluates it again.\n * - `continue`: the item of a list op is an error item. The list op skips it, as the interpreter does. With the option\n * `strict`, the list op fails instead, and `strict.else` tells what that failure does.\n * - `break`: the first argument of `ifError` failed, so the block ends, and the second argument gives the value.\n */\nexport type Fail =\n | { readonly t: \"return\" }\n | { readonly t: \"continue\"; readonly label: number; readonly strict?: { readonly cond: LExpr; readonly else: Fail } }\n | { readonly t: \"break\"; readonly label: number };\n\n/** A statement of the loop IR. */\nexport type LStmt =\n /** A new local with a value. */\n | { readonly t: \"let\"; readonly n: number; readonly value: LExpr }\n /** A new value of a local. */\n | { readonly t: \"set\"; readonly n: number; readonly value: LExpr }\n /** When `ok` is false, the statement does `fail`. The reason names the check. */\n | { readonly t: \"check\"; readonly ok: LExpr; readonly reason: string; readonly fail: Fail }\n /** A check that fails always: the interpreter always gives an error here. */\n | { readonly t: \"fail\"; readonly fail: Fail }\n | { readonly t: \"if\"; readonly cond: LExpr; readonly yes: readonly LStmt[]; readonly no: readonly LStmt[] }\n /**\n * A loop over the items of an array, in order. The local `array` holds the array, `index` the index, and `item` each\n * item. A `continue` with the label goes to the next item.\n */\n | { readonly t: \"loop\"; readonly label: number; readonly item: number; readonly index: number; readonly array: number; readonly over: LExpr; readonly body: readonly LStmt[] }\n /** A block with a label. A `break` with the label ends it. */\n | { readonly t: \"block\"; readonly label: number; readonly body: readonly LStmt[] }\n /** A loop with a label that repeats its body until a `break` with the label ends it. */\n | { readonly t: \"repeat\"; readonly label: number; readonly body: readonly LStmt[] }\n /** The next item of the innermost loop. */\n | { readonly t: \"next\" }\n /** A value at the end of an array. */\n | { readonly t: \"push\"; readonly n: number; readonly value: LExpr }\n | { readonly t: \"return\"; readonly value: LExpr };\n\n/** A program of the loop IR: its statements, the number of its locals and its constants. Each local is a name in the function. */\nexport interface LoopProgram {\n readonly body: readonly LStmt[];\n readonly locals: number;\n /** The constants, by index: literals, paths, addresses, axes and names. Generated code reads them by index (§5). */\n readonly constants: readonly unknown[];\n}\n\n// The constructors of the values of the loop IR.\nexport const local = (n: number): LExpr => ({ t: \"local\", n });\nexport const constant = (i: number): LExpr => ({ t: \"const\", i });\nexport const num = (v: number): LExpr => ({ t: \"num\", v });\nexport const bool = (v: boolean): LExpr => ({ t: \"bool\", v });\nexport const FALLBACK_EXPR: LExpr = { t: \"fallback\" };\nexport const RETURN: Fail = Object.freeze({ t: \"return\" });\nexport const array = (...items: LExpr[]): LExpr => ({ t: \"array\", items });\nexport const prim = (op: PrimOp, ...args: LExpr[]): LExpr => ({ t: \"prim\", op, args });\nexport const call = (fn: RuntimeFn, ...args: LExpr[]): LExpr => ({ t: \"call\", fn, args });\n","/**\n * The back end of JavaScript source (docs/COMPILER.md §3.4). It prints a program of the loop IR as the body of a\n * function with the parameters `K` (the constants) and `R` (the runtime).\n *\n * The source has no name and no literal of the program as text: it reads each one from `K`, by its index (§5). The\n * same program and the same facts always give the same source.\n *\n * With the facts of the options, each op site gets its fast path in the source (§13.2). Each site then has its own\n * inline caches in the engine, and a guard sends each other case to the dispatch of the runtime.\n */\nimport { liftsAt, type ParamKind } from \"@mark1russell7/vex\";\nimport { primitiveOf, type Facts, type SiteFacts, type StaticSite } from \"./facts.ts\";\nimport { constant, FIXED_LOCALS, type Fail, type LExpr, type LoopProgram, type LStmt, type RuntimeFn } from \"./loop.ts\";\n\ntype OpExpr = Extract<LExpr, { readonly t: \"op\" }>;\n\n/** This function gives the call of the dispatch of a site. With more than 3 values, the dispatch takes an array. */\nfunction generic(x: OpExpr, site: string, values: readonly string[]): string {\n return x.args.length <= 3 ? `${site}(${values.join(\", \")})` : `${site}([${values.join(\", \")}])`;\n}\n\n/** This function gives the check of an argument of the kind `kind`, for an op of the domain `d`. */\nfunction kindCheck(kind: ParamKind | undefined, a: string, d: string): readonly string[] {\n if (kind === \"domain\") return [`${d}.is(${a})`];\n if (kind === \"number\" || kind === \"boolean\" || kind === \"string\") return [`typeof ${a} === \"${kind}\"`];\n return [];\n}\n\nconst name = (n: number): string => `l${n}`;\n\n/** This function prints the source of a program. The body gives the function of the program. */\nexport function printJs(p: LoopProgram, facts: Facts): string {\n const used = new Set<RuntimeFn>();\n const constants = new Set<number>();\n const sites = new Map<string, string>();\n const domains = new Set<number>();\n // The functions of the ops of the static sites. They read the domains, so they come after them.\n const fns = new Map<string, string>();\n let threw = false;\n let siteLabels = 0;\n const expr = (x: LExpr): string => {\n switch (x.t) {\n case \"const\":\n constants.add(x.i);\n return `k${x.i}`;\n case \"local\":\n return name(x.n);\n case \"num\":\n case \"bool\":\n return String(x.v);\n case \"fallback\":\n return \"F\";\n case \"array\":\n return `[${x.items.map(expr).join(\", \")}]`;\n case \"call\":\n used.add(x.fn);\n return `${x.fn}_(${x.args.map(expr).join(\", \")})`;\n case \"op\":\n return generic(x, siteOf(x), x.args.map(expr));\n case \"memo\":\n sites.set(`mo${x.id}`, \"R.memo()\");\n return `mo${x.id}`;\n case \"targets\": {\n // An axis has one function of targets for each site, with its cache.\n const site = `a${x.axis}`;\n sites.set(site, `R.axis(${expr(constant(x.axis))})`);\n return `${site}(${x.args.map(expr).join(\", \")})`;\n }\n case \"prim\": {\n const [a, b, c, d, e] = x.args.map(expr);\n switch (x.op) {\n case \"!\":\n return `(!${a})`;\n case \"min\":\n case \"max\":\n return `Math.${x.op}(${a}, ${b})`;\n case \"isNumber\":\n return `(typeof ${a} === \"number\")`;\n case \"isBoolean\":\n return `(typeof ${a} === \"boolean\")`;\n case \"isString\":\n return `(typeof ${a} === \"string\")`;\n case \"isValue\":\n return `(${a} !== undefined && ${a} !== null)`;\n case \"isObject\":\n return `(typeof ${a} === \"object\" || typeof ${a} === \"function\")`;\n case \"get\":\n return `${a}.get(${b})`;\n case \"member\":\n return `${a}[${b}]`;\n case \"records\":\n return `${a}.records`;\n case \"recordAt\":\n return `(${a} !== undefined ? ${a}[${b}] : ${c}.get(${d}))`;\n case \"keysOf\":\n return `${a}.keys`;\n case \"idxOf\":\n return `${a}.idx`;\n case \"memoGet\":\n return `${a}.get(${b}, ${c})`;\n case \"memoPut\":\n return `${a}.put(${b}, ${c}, ${d}, ${e})`;\n case \"entryValue\":\n return `${a}.v`;\n case \"entryOk\":\n return `${a}.ok`;\n case \"+\":\n case \"/\":\n case \"===\":\n case \"!==\":\n case \"||\":\n case \"&&\":\n return `(${a} ${x.op} ${b})`;\n }\n }\n }\n };\n // An op has one dispatch for each name and number of arguments, and the function gets it when it loads.\n function siteOf(x: OpExpr): string {\n const site = `s${x.name}_${x.args.length}`;\n sites.set(site, `R.site(${expr(constant(x.name))}, ${x.args.length})`);\n return site;\n }\n const domain = (i: number): string => {\n domains.add(i);\n return `d${i}`;\n };\n // The checks of the result of an op, as `#checkResult` of the interpreter. A domain without `valid` stops the search.\n const resultChecks = (out: string, checks: readonly boolean[], indent: string): void => {\n lines.push(`${indent}if (${out} !== F) {`);\n lines.push(`${indent} if (${out} === undefined || ${out} === null || (typeof ${out} === \"number\" && !Number.isFinite(${out}))) ${out} = F;`);\n checks.forEach((valid, i) => {\n const d = domain(i);\n lines.push(valid ? `${indent} else if (${d}.is(${out})) { try { if (!${d}.valid(${out})) ${out} = F; } catch (e) { ${out} = threw_(e); } }` : `${indent} else if (${d}.is(${out})) {}`);\n });\n lines.push(`${indent}}`);\n };\n /**\n * The fast path of an op site that assigns the local `n`. A method site guards the method of the last receiver and\n * the domain of the receiver, and a site of a function guards the domain. Then the site checks the arguments, calls\n * the op in a `try`, and checks the result. A number that the op lifts, and each failed guard, go to the dispatch.\n */\n const siteBlock = (n: number, x: OpExpr, indent: string): boolean => {\n const attempt = (call: string, ind: string): void => {\n threw = true;\n lines.push(`${ind}try { ${name(n)} = ${call}; } catch (e) { ${name(n)} = threw_(e); }`);\n };\n const st = facts.staticSite(p.constants[x.name] as string, x.kinds);\n if (st !== undefined) {\n staticBlock(n, x, st, indent, attempt);\n return true;\n }\n const f = facts.site(p.constants[x.name] as string, x.args.length);\n switch (f?.t) {\n case undefined:\n return false;\n case \"free\": {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${x.args.map(expr).join(\", \")})`, indent);\n resultChecks(name(n), facts.checks, indent);\n return true;\n }\n case \"op\":\n opBlock(n, x, f, indent, attempt);\n return true;\n }\n };\n /**\n * The block of a static site (KIND.STATIC). The kinds of its values decide its op, so the site uses the function of the\n * op with no guard. A result of another kind breaks the declaration of the op. Then the program stops, and tier 1\n * evaluates it.\n */\n const staticBlock = (n: number, x: OpExpr, st: StaticSite, indent: string, attempt: (call: string, ind: string) => void): void => {\n const out = name(n);\n const values = x.args.map(expr);\n if (st.t === \"free\") {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${values.join(\", \")})`, indent);\n resultChecks(out, facts.checks, indent);\n return;\n }\n // An argument of a kind that the op does not accept: the interpreter gives an error.\n if (st.bad) {\n lines.push(`${indent}${out} = F;`);\n return;\n }\n const f = `f${x.name}_${st.domain}`;\n fns.set(f, `${domain(st.domain)}.ops[${expr(constant(x.name))}].fn`);\n attempt(`${f}(${values.join(\", \")})`, indent);\n // A local of tier 2 has a primitive kind or no kind (lower.ts). Thus a result of the kind of a domain gets the checks\n // of the interpreter, as a result of the kind any (V-059).\n const kind = primitiveOf(st.returns);\n if (kind === undefined) {\n resultChecks(out, facts.checks, indent);\n return;\n }\n lines.push(`${indent}if (${out} !== F && typeof ${out} !== \"${kind}\") return F; // the kind of the result`);\n if (kind === \"number\") lines.push(`${indent}if (${out} !== F && !Number.isFinite(${out})) ${out} = F;`);\n const check = facts.checkOf(kind);\n if (check === undefined) resultChecks(out, facts.checks, indent);\n else if (facts.checks[check] === true) {\n const d = domain(check);\n lines.push(`${indent}if (${out} !== F) { try { if (!${d}.valid(${out})) ${out} = F; } catch (e) { ${out} = threw_(e); } }`);\n }\n };\n const opBlock = (n: number, x: OpExpr, f: Extract<SiteFacts, { readonly t: \"op\" }>, indent: string, attempt: (call: string, ind: string) => void): void => {\n const site = siteOf(x);\n const values = x.args.map(expr);\n const out = name(n);\n const label = `S${siteLabels++}`;\n const [self, ...args] = values as [string, ...string[]];\n const d = domain(f.domain);\n lines.push(`${indent}${label}: {`);\n let inner: string;\n let call: string;\n if (f.method) {\n const m = `m${label}`;\n lines.push(`${indent} if (typeof ${self} === \"object\" && ${self} !== null) {`, `${indent} const ${m} = ${site}.m;`);\n lines.push(`${indent} if (${m} !== undefined && ${self}[${expr(constant(x.name))}] === ${m} && ${d}.is(${self})) {`);\n inner = `${indent} `;\n call = `${self}[${expr(constant(x.name))}](${args.join(\", \")})`;\n } else {\n sites.set(`${site}_f`, `${site}.fn`);\n lines.push(`${indent} if (${d}.is(${self})) {`);\n inner = `${indent} `;\n call = `${site}_f(${values.join(\", \")})`;\n }\n const lifted = args.filter((_a, i) => liftsAt(f.lift, i)).map((a) => `typeof ${a} === \"number\"`);\n if (lifted.length > 0) lines.push(`${inner}if (${lifted.join(\" || \")}) { ${out} = ${generic(x, site, values)}; break ${label}; }`);\n const kinds = args.flatMap((a, i) => kindCheck(f.params?.[i], a, d));\n if (kinds.length > 0) lines.push(`${inner}if (!(${kinds.join(\" && \")})) { ${out} = F; break ${label}; }`);\n attempt(call, inner);\n resultChecks(out, facts.checks, inner);\n lines.push(`${inner}break ${label};`);\n if (f.method) lines.push(`${indent} }`);\n lines.push(`${indent} }`, `${indent} ${out} = ${generic(x, site, values)};`, `${indent}}`);\n };\n // The statement of a failure (docs/COMPILER.md §4.1).\n const action = (f: Fail): string => {\n switch (f.t) {\n case \"return\":\n return \"return F;\";\n case \"break\":\n return `break L${f.label};`;\n case \"continue\":\n return f.strict === undefined ? `continue L${f.label};` : `{ if (${expr(f.strict.cond)}) ${action(f.strict.else)} continue L${f.label}; }`;\n }\n };\n const lines: string[] = [];\n const stmts = (ss: readonly LStmt[], indent: string): void => {\n for (const s of ss) stmt(s, indent);\n };\n const stmt = (s: LStmt, indent: string): void => {\n switch (s.t) {\n case \"let\":\n case \"set\":\n if (s.value.t === \"op\" && siteBlock(s.n, s.value, indent)) return;\n lines.push(`${indent}${name(s.n)} = ${expr(s.value)};`);\n return;\n case \"check\":\n lines.push(`${indent}if (!(${expr(s.ok)})) ${action(s.fail)} // ${s.reason}`);\n return;\n case \"fail\":\n lines.push(`${indent}${action(s.fail)}`);\n return;\n case \"if\":\n lines.push(`${indent}if (${expr(s.cond)}) {`);\n stmts(s.yes, `${indent} `);\n if (s.no.length > 0) {\n lines.push(`${indent}} else {`);\n stmts(s.no, `${indent} `);\n }\n lines.push(`${indent}}`);\n return;\n case \"loop\": {\n const [a, i] = [name(s.array), name(s.index)];\n lines.push(`${indent}${a} = ${expr(s.over)};`);\n lines.push(`${indent}L${s.label}: for (${i} = 0; ${i} < ${a}.length; ${i}++) {`);\n lines.push(`${indent} ${name(s.item)} = ${a}[${i}];`);\n stmts(s.body, `${indent} `);\n lines.push(`${indent}}`);\n return;\n }\n case \"block\":\n lines.push(`${indent}L${s.label}: {`);\n stmts(s.body, `${indent} `);\n lines.push(`${indent}}`);\n return;\n case \"repeat\":\n lines.push(`${indent}L${s.label}: for (;;) {`);\n stmts(s.body, `${indent} `);\n lines.push(`${indent}}`);\n return;\n case \"next\":\n lines.push(`${indent}continue;`);\n return;\n case \"push\":\n lines.push(`${indent}${name(s.n)}.push(${expr(s.value)});`);\n return;\n case \"return\":\n lines.push(`${indent}return ${expr(s.value)};`);\n return;\n }\n };\n stmts(p.body, \" \");\n const params = Array.from({ length: FIXED_LOCALS }, (_, n) => name(n));\n const locals = Array.from({ length: p.locals - FIXED_LOCALS }, (_, n) => name(n + FIXED_LOCALS));\n const head = [\n `\"use strict\";`,\n `const F = R.F;`,\n // The order is the order of the first use, so the same program gives the same source.\n ...[...used].map((fn) => `const ${fn}_ = R.${fn};`),\n ...[...constants].map((i) => `const k${i} = K[${i}];`),\n ...[...sites].map(([site, init]) => `const ${site} = ${init};`),\n ...[...domains].map((i) => `const d${i} = R.domain(${i});`),\n ...[...fns].map(([f, init]) => `const ${f} = ${init};`),\n ...(threw ? [`const threw_ = R.threw;`] : []),\n `return function vex(${params.join(\", \")}) {`,\n ...(locals.length > 0 ? [` let ${locals.join(\", \")};`] : []),\n ` try {`,\n ];\n const tail = [` } catch {`, ` return F;`, ` }`, `};`, ``];\n return [...head, ...lines, ...tail].join(\"\\n\");\n}\n","/**\n * The memo of a program (docs/COMPILER.md §7.2 and §7.3). The value of some nodes depends only on the space and on a\n * few values that the node reads from outside: its keys. A program keeps the value of such a node for each space and\n * each value of its keys. Thus a run at each key of a space evaluates the node once for each value of its keys.\n *\n * - `AVERAGE(all.Score)` has no keys, so it evaluates once for each space.\n * - \"The largest width in the column of the origin\" has one key, the column of the origin. It evaluates once for each\n * column, not once for each origin.\n *\n * A key reads the origin or a name from outside the node, and nothing that the node changes. Inside the node, the\n * value of the key replaces the key. Thus the value of the node depends only on the space and the values of the keys.\n */\nimport { addrExprs, isListOp, listOf, type Addr, type Axis, type Expr } from \"@mark1russell7/vex\";\n\n/** A read of the focus of the expression, outside its own loops. */\nconst FOCUS = 1;\n/** A move to the origin. */\nconst ORIGIN = 2;\n/** A name that the node does not bind: a variable of the run, or a binding outside the node. */\nconst FREE = 4;\n/** A name that the node binds, outside the expression. */\nconst INTERNAL = 8;\n/** An extension or an axis table. An extension can read each part of the evaluation, and a table is another space. */\nconst OPAQUE = 16;\n/** A move to the origin or a free name inside a loop of the expression. Such a loop is a part of a node, not a key. */\nconst DEEP = 32;\n\n/** This function gives the axis inside the `where` axes of an axis, and the tests of the `where` axes. */\nfunction parts(a: Axis): { readonly base: Exclude<Axis, { readonly t: \"where\" }>; readonly tests: readonly Expr[] } {\n // Stryker disable next-line ArrayDeclaration: a test that is not an expression reads nothing, and it has no keys\n const tests: Expr[] = [];\n let x: Axis = a;\n while (x.t === \"where\") {\n tests.push(x.test);\n x = x.axis;\n }\n return { base: x, tests };\n}\n\n/** This function adds `DEEP` to a read of the origin or of a free name inside a loop. */\nconst inLoop = (r: number, top: boolean): number => (top || (r & (ORIGIN | FREE)) === 0 ? r : r | DEEP);\n\n/**\n * This function gives the reads of an address: the focus at the top of the expression, or the origin, or nothing. A\n * move from the focus or the origin can fail, so the address reads its start also before a fixed key (V-052).\n */\nfunction addressReads(at: Addr | undefined, top: boolean): number {\n let start = top ? FOCUS : 0;\n let found = 0;\n at?.forEach((m) => {\n if (m.t === \"key\" || m.t === \"index\") start = 0;\n else if (m.t === \"origin\") start = ORIGIN;\n else found |= start;\n });\n return inLoop(found | start, top);\n}\n\n/**\n * This function gives the reads of `e`. `outer` has the names that the node binds outside `e`, and `inner` has the\n * names that `e` binds above this part. `top` is true outside the loops of `e`.\n */\nfunction reads(e: Expr, outer: ReadonlySet<string>, inner: ReadonlySet<string>, top: boolean): number {\n switch (e.tag) {\n // A missing case gives undefined, and a bitwise operation counts it as 0.\n // Stryker disable next-line StringLiteral: see the comment above\n case \"lit\":\n return 0;\n case \"var\":\n return inner.has(e.name) ? 0 : outer.has(e.name) ? INTERNAL : inLoop(FREE, top);\n case \"ext\":\n // A loop of names is not in the memo yet, so a node with one is not either. A call reads what its body reads, and a\n // function reads nothing where it is bound, but the memo does not follow them yet (FN.CALL).\n case \"fold\":\n case \"iterate\":\n // A let with a function and no call has the value of its body, and a call is opaque, so this case only keeps the\n // memo simple.\n // Stryker disable next-line StringLiteral: see the comment above\n case \"fn\":\n case \"call\":\n return OPAQUE;\n case \"ref\":\n // The expressions of computed moves evaluate at the position of the node (NAV.COMPUTED).\n return addrExprs(e.at).reduce((r, x) => r | reads(x, outer, inner, top), addressReads(e.at, top));\n case \"app\":\n return e.args.reduce((r, x) => r | reads(x, outer, inner, top), 0);\n case \"rec\":\n return Object.values(e.fields).reduce((r, x) => r | reads(x, outer, inner, top), 0);\n case \"let\": {\n const binds = Object.values(e.bind).reduce((r, x) => r | reads(x, outer, inner, top), 0);\n return binds | reads(e.body, outer, new Set([...inner, ...Object.keys(e.bind)]), top);\n }\n case \"each\": {\n const { base, tests } = parts(e.axis);\n // The targets of `all` do not depend on the focus, but its address can fail (V-051). Each other axis starts at its\n // address. The targets of the axis list are the items of a value, and the memo does not follow them yet (AXIS.LIST).\n const targets = base.t === \"table\" || listOf(e.axis) !== undefined ? OPAQUE : base.t === \"all\" && (e.at ?? []).length === 0 ? 0 : addressReads(e.at, top);\n const at = addrExprs(e.at).reduce((r, x) => r | reads(x, outer, inner, top), targets);\n return [e.body, ...tests].reduce((r, x) => r | reads(x, outer, inner, false), at);\n }\n }\n}\n\n/** This function joins the keys of the parts of an expression. A part that cannot be in the memo makes the expression the same. */\nfunction all(xs: readonly (readonly Expr[] | undefined)[]): readonly Expr[] | undefined {\n // Stryker disable next-line ArrayDeclaration: after the check, each part has its keys, so no one reads the default list\n return xs.every((x) => x !== undefined) ? xs.flatMap((x) => x ?? []) : undefined;\n}\n\n/**\n * This function gives the keys of the part `e` of a node, or `undefined` if the part cannot be in the memo. `top` is\n * true outside the loops of the node, and `outer` has the names that the node binds above `e`. The node itself (`root`)\n * is not a key of itself.\n */\nfunction keysOf(e: Expr, top: boolean, outer: ReadonlySet<string>, pure: Set<Expr>, root = false): readonly Expr[] | undefined {\n const r = reads(e, outer, new Set(), true);\n // In a loop of the node, the focus is a target of the node, and the node can read it. A part that depends only on\n // the space has a memo of its own, if it has a loop.\n if ((r & (ORIGIN | FREE | OPAQUE | (top ? FOCUS : 0))) === 0) {\n if (!root) pure.add(e);\n return [];\n }\n // A key evaluates once, outside the loops of the node. A loop that reads the origin is a part of the node, not a key.\n if (!root && (r & (FOCUS | INTERNAL | OPAQUE | DEEP)) === 0) return [e];\n switch (e.tag) {\n case \"app\":\n return all(e.args.map((x) => keysOf(x, top, outer, pure)));\n case \"rec\":\n return all(Object.values(e.fields).map((x) => keysOf(x, top, outer, pure)));\n case \"let\": {\n const inner = new Set([...outer, ...Object.keys(e.bind)]);\n return all([...Object.values(e.bind).map((x) => keysOf(x, top, outer, pure)), keysOf(e.body, top, inner, pure)]);\n }\n case \"each\": {\n const { base, tests } = parts(e.axis);\n // The targets of a loop must not depend on the origin: a set of targets is not a value of a key. The address of\n // `all` can fail, so it must not depend on the origin either. The targets of the axis list are the items of a\n // value, and the memo does not follow them yet (AXIS.LIST).\n if (base.t === \"table\" || listOf(e.axis) !== undefined || ((base.t !== \"all\" || (e.at ?? []).length > 0) && addressReads(e.at, top) !== 0)) return undefined;\n // The expressions of computed moves give the targets too, so they must read nothing.\n if (addrExprs(e.at).some((x) => reads(x, outer, new Set(), top) !== 0)) return undefined;\n return all([e.body, ...tests].map((x) => keysOf(x, false, outer, pure)));\n }\n // A leaf here reads the focus or a name of the node, so it is not a key, and the part cannot be in the memo. A\n // missing case gives undefined too.\n // Stryker disable StringLiteral,ConditionalExpression: see the comment above\n case \"lit\":\n case \"ref\":\n case \"var\":\n case \"ext\":\n case \"fold\":\n case \"iterate\":\n case \"fn\":\n case \"call\":\n return undefined;\n // Stryker restore StringLiteral,ConditionalExpression\n }\n}\n\n/** This function tells if an expression has a loop outside its keys and outside the parts that have a memo of their own. */\nfunction loopOutside(e: Expr, keys: ReadonlySet<Expr>): boolean {\n if (keys.has(e)) return false;\n switch (e.tag) {\n case \"each\":\n case \"fold\":\n case \"iterate\":\n return true;\n case \"app\":\n return e.args.some((x) => loopOutside(x, keys));\n case \"rec\":\n return Object.values(e.fields).some((x) => loopOutside(x, keys));\n case \"let\":\n return [...Object.values(e.bind), e.body].some((x) => loopOutside(x, keys));\n case \"ref\":\n return addrExprs(e.at).some((x) => loopOutside(x, keys));\n // A missing case gives undefined, which is false too.\n // Stryker disable StringLiteral,ConditionalExpression: see the comment above\n case \"lit\":\n case \"var\":\n case \"ext\":\n // A node with a function or a call is opaque (reads), so it is not a node of the memo.\n case \"fn\":\n case \"call\":\n return false;\n // Stryker restore StringLiteral,ConditionalExpression\n }\n}\n\n/** This function gives the `let` expressions above an `each`, and the `each`, or `undefined` for another expression. */\nfunction eachUnderLets(e: Expr | undefined): { readonly lets: readonly Extract<Expr, { readonly tag: \"let\" }>[]; readonly each: Extract<Expr, { readonly tag: \"each\" }> } | undefined {\n const lets: Extract<Expr, { readonly tag: \"let\" }>[] = [];\n let x = e;\n while (x?.tag === \"let\") {\n lets.push(x);\n x = x.body;\n }\n return x?.tag === \"each\" ? { lets, each: x } : undefined;\n}\n\n/**\n * This function gives the nodes of `expr` that a program keeps in its memo, each with its keys. Each such node has a\n * loop outside its keys. A node inside such a node can be in the memo too. Thus the first evaluation of the outer\n * node evaluates the inner node once.\n */\nexport function memoNodes(expr: Expr): ReadonlyMap<Expr, readonly Expr[]> {\n const out = new Map<Expr, readonly Expr[]>();\n const visit = (e: Expr): void => {\n const pure = new Set<Expr>();\n const keys = keysOf(e, true, new Set(), pure, true);\n if (keys !== undefined && loopOutside(e, new Set([...keys, ...pure]))) out.set(e, keys);\n if (e.tag === \"app\") {\n // A list op over an `each` under `let` expressions is one loop, so that `each` and those `let` expressions have\n // no value of their own. Their parts can be in the memo.\n const [first, ...rest] = e.args;\n const fused = isListOp(e.op) ? eachUnderLets(first) : undefined;\n if (fused === undefined) {\n if (first !== undefined) visit(first);\n } else {\n for (const l of fused.lets) Object.values(l.bind).forEach(visit);\n [fused.each.body, ...parts(fused.each.axis).tests, ...addrExprs(fused.each.at)].forEach(visit);\n }\n rest.forEach(visit);\n } else if (e.tag === \"rec\") {\n Object.values(e.fields).forEach(visit);\n } else if (e.tag === \"let\") {\n Object.values(e.bind).forEach(visit);\n visit(e.body);\n } else if (e.tag === \"each\") {\n [e.body, ...parts(e.axis).tests, ...addrExprs(e.at)].forEach(visit);\n } else if (e.tag === \"ref\") {\n addrExprs(e.at).forEach(visit);\n }\n };\n visit(expr);\n return out;\n}\n","/**\n * The lowering: a Vex expression becomes a program of the loop IR (docs/COMPILER.md §3.3). A list op over a direct\n * `each` becomes one loop with a running value, so it makes no list.\n *\n * Each value that the interpreter can give as an error has a check. The block of the check tells what a failure does\n * (`Fail`). A list op skips an error item, and an error in the first argument of `ifError` gives the second argument.\n * Each other error stops the program with `FALLBACK`.\n */\nimport { addrExprs, isFieldName, isListOp, MAX_NESTING, nestingOf, shapeError, type Addr, type Axis, type Expr, type ExprOf, type ListOp, type Names, type PrimitiveKind } from \"@mark1russell7/vex\";\nimport { factsOf, listReason, MAX_CALLS, primitiveOf, type Facts, type Schema } from \"./facts.ts\";\nimport { memoNodes } from \"./memo.ts\";\nimport {\n array,\n bool,\n call,\n constant,\n FALLBACK_EXPR,\n FIXED_LOCALS,\n local,\n num,\n ORIGIN,\n prim,\n RETURN,\n SPACE,\n TABLES,\n VARS,\n type Fail,\n type LExpr,\n type LoopProgram,\n type LStmt,\n} from \"./loop.ts\";\n\n/** The error of an expression that the compiler cannot lower. Then the program operates in tier 1. */\nexport class Unsupported extends Error {}\n\n/** A bound name: its value, and the flag that tells if its binding gave a value. Without a flag, it always does. */\ninterface Bound {\n readonly value: LExpr;\n readonly ok?: LExpr;\n}\n\n/** A bound function: its node, the path of its node, and the scope of its binding. */\ninterface BoundFn {\n readonly fn: ExprOf<\"fn\">;\n readonly path: readonly number[];\n readonly scope: Scope;\n}\n\n/** The facts of the lexical position of a node: its space, its origin, its focus and its bound names. */\ninterface Scope {\n readonly space: LExpr;\n readonly origin: LExpr;\n readonly focus: LExpr;\n readonly env: ReadonlyMap<string, Bound>;\n /** The bound functions (FN.BIND): a call puts the body of its function at the place of the call. */\n readonly fns: ReadonlyMap<string, BoundFn>;\n /** The record at the focus. In a loop, it reads the record by its index (SPACE.RECORDS). */\n readonly rec: LExpr;\n}\n\n/** A list of statements, and what a failed check in it does. */\ninterface Block {\n readonly stmts: LStmt[];\n readonly fail: Fail;\n}\n\nconst block = (fail: Fail): Block => ({ stmts: [], fail });\n\n/** This function gives the axis inside the `where` axes of an axis. */\nconst baseAxis = (a: Axis): Exclude<Axis, { readonly t: \"where\" }> => (a.t === \"where\" ? baseAxis(a.axis) : a);\n\n/** This function gives the tests of the `where` axes of an axis, from the inside out, as the interpreter applies them. */\nfunction whereTests(a: Axis): readonly Expr[] {\n const out: Expr[] = [];\n for (let x: Axis = a; x.t === \"where\"; x = x.axis) out.unshift(x.test);\n return out;\n}\n\n/** This function gives the `each` under the `let` expressions of a list argument, or `undefined`. */\nfunction eachUnderLets(e: Expr | undefined): ExprOf<\"each\"> | undefined {\n let x = e;\n while (x?.tag === \"let\") x = x.body;\n return x?.tag === \"each\" ? x : undefined;\n}\n\n/** The kinds of the values of the primitive operations that always give a boolean. */\nconst BOOLEAN_PRIMS: ReadonlySet<string> = new Set([\"!\", \"===\", \"!==\", \"isNumber\", \"isBoolean\", \"isString\", \"isValue\", \"isObject\"]);\n\n/** The checks of the kinds of a schema. */\nconst KIND_CHECKS = { number: \"isNumber\", string: \"isString\", boolean: \"isBoolean\" } as const;\n\n/** This function gives the kind of two values in the branches of a form, if they have the same kind. */\nconst join = (a: PrimitiveKind | undefined, b: PrimitiveKind | undefined): PrimitiveKind | undefined => (a === b ? a : undefined);\n\n/**\n * This function lowers an expression into a program of the loop IR. It throws `Unsupported` for an expression it cannot\n * lower. The facts of the options decide the op of a site whose values have known kinds (KIND.STATIC).\n */\nexport function lower(expr: Expr, facts: Facts = factsOf({}), schema: Schema = {}): LoopProgram {\n // EVAL.SHAPE and EVAL.NESTING: tier 1 gives the error of a program that is not valid or that is nested too deep.\n const shape = shapeError(expr);\n if (shape !== undefined) throw new Unsupported(shape);\n if (nestingOf(expr) > MAX_NESTING) throw new Unsupported(`the expression is nested deeper than ${MAX_NESTING} levels`);\n const lists = listReason(expr);\n if (lists !== undefined) throw new Unsupported(lists);\n const l = new Lowerer(memoNodes(expr), facts, schema);\n const b = block(RETURN);\n l.check(b, call(\"has\", local(SPACE), local(ORIGIN)), \"the origin is a key of the space\");\n const top: Scope = { space: local(SPACE), origin: local(ORIGIN), focus: local(ORIGIN), env: new Map(), fns: new Map(), rec: prim(\"get\", local(SPACE), local(ORIGIN)) };\n const value = l.expr(expr, top, [], b);\n b.stmts.push({ t: \"return\", value });\n return { body: b.stmts, locals: l.locals, constants: l.constants };\n}\n\nclass Lowerer {\n locals = FIXED_LOCALS;\n labels = 0;\n memos = 0;\n /** The number of bodies of functions that the lowering put at calls (MAX_CALLS). */\n #calls = 0;\n readonly #memo: ReadonlyMap<Expr, readonly Expr[]>;\n /** The keys of the nodes of the memo whose code the lowering makes, with their values. */\n #keys: ReadonlyMap<Expr, Bound> = new Map();\n readonly #facts: Facts;\n readonly #schema: Schema;\n /** The kind of each local whose kind the lowering knows. A local gets its kind where it gets its value. */\n readonly #kinds = new Map<number, PrimitiveKind>();\n\n constructor(memo: ReadonlyMap<Expr, readonly Expr[]>, facts: Facts, schema: Schema) {\n this.#memo = memo;\n this.#facts = facts;\n this.#schema = schema;\n }\n\n /** This method gives the kind of a value, if the lowering knows it. */\n kindOf(x: LExpr): PrimitiveKind | undefined {\n if (x.t === \"const\") {\n const t = typeof this.constants[x.i];\n return t === \"number\" || t === \"string\" || t === \"boolean\" ? t : undefined;\n }\n if (x.t === \"local\") return this.#kinds.get(x.n);\n // The other values have no kind that the lowering knows.\n return x.t === \"prim\" && BOOLEAN_PRIMS.has(x.op) ? \"boolean\" : undefined;\n }\n\n /** This method gives a local the kind `kind`. A value that is not a local keeps its kind. */\n #typed(x: LExpr, kind: PrimitiveKind | undefined): LExpr {\n if (x.t === \"local\" && kind !== undefined) this.#kinds.set(x.n, kind);\n return x;\n }\n\n /**\n * This method checks the kind that the schema declares for a value. A failure is no error of the interpreter, so it\n * stops the program, and tier 1 evaluates it.\n */\n #declared(b: Block, x: LExpr, kind: PrimitiveKind | undefined, reason: string): LExpr {\n if (kind === undefined) return x;\n b.stmts.push({ t: \"check\", ok: prim(KIND_CHECKS[kind], x), reason, fail: RETURN });\n return this.#typed(x, kind);\n }\n readonly constants: unknown[] = [];\n readonly #pool = new Map<unknown, number>();\n\n /** This method gives the index of the constant of a value. The same value has one constant. A map key does not tell 0 from -0, so -0 has its own. */\n index(value: unknown): number {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different constants\n const k = Object.is(value, -0) ? NEGATIVE_ZERO : value;\n let i = this.#pool.get(k);\n if (i === undefined) {\n i = this.constants.push(value) - 1;\n this.#pool.set(k, i);\n }\n return i;\n }\n\n /** This method gives the constant of a value. */\n constant(value: unknown): LExpr {\n return constant(this.index(value));\n }\n\n /** This method gives the number of a new local of a kind. */\n typedLocal(kind: PrimitiveKind): number {\n const n = this.locals++;\n this.#kinds.set(n, kind);\n return n;\n }\n\n /** This method gives a new local with a value. */\n value(b: Block, value: LExpr): LExpr {\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n return local(n);\n }\n\n check(b: Block, ok: LExpr, reason: string): void {\n b.stmts.push({ t: \"check\", ok, reason, fail: b.fail });\n }\n\n /** This method gives a new local with the value of a call of the runtime, and a check that the value is not `FALLBACK`. */\n checked(b: Block, value: LExpr, reason: string): LExpr {\n const x = this.value(b, value);\n this.check(b, prim(\"!==\", x, FALLBACK_EXPR), reason);\n return x;\n }\n\n /** This method adds a failure: the interpreter always gives an error here. */\n fail(b: Block): LExpr {\n b.stmts.push({ t: \"fail\", fail: b.fail });\n return FALLBACK_EXPR;\n }\n\n expr(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n // Inside a node of the memo, the value of a key replaces the key. An error of the key is an error at each place.\n const key = this.#keys.get(e);\n if (key !== undefined) {\n if (key.ok !== undefined) this.check(b, key.ok, \"a key with a value\");\n return key.value;\n }\n const keys = this.#memo.get(e);\n return keys === undefined ? this.#node(e, s, path, b) : this.#memoized(e, keys, s, path, b);\n }\n\n /** This method lowers a node itself, without the memo. */\n #node(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n switch (e.tag) {\n case \"lit\":\n return this.constant(e.value);\n case \"ref\":\n return this.#ref(e, s, path, b);\n case \"var\": {\n const bound = s.env.get(e.name);\n // A function is not a value (FN.VALUE): tier 1 gives the error. A name of a loop hides a function with its name.\n if (bound === undefined && s.fns.has(e.name)) return this.fail(b);\n if (bound === undefined) {\n const x = this.checked(b, call(\"var\", local(VARS), this.constant(e.name)), \"a variable\");\n return this.#declared(b, x, primitiveOf(this.#schema.vars?.[e.name]), \"a variable of the schema\");\n }\n if (bound.ok !== undefined) this.check(b, bound.ok, \"a binding with a value\");\n return bound.value;\n }\n case \"let\":\n return this.expr(e.body, { ...s, ...this.#bind(e, s, path, b) }, [...path, Object.keys(e.bind).length], b);\n // A function is only a binding of let, so the check of the shape stops this node first.\n // Stryker disable next-line all: see the comment above\n /* v8 ignore next -- @preserve */\n case \"fn\": return this.fail(b);\n case \"call\":\n return this.#call(e, s, path, b);\n case \"rec\": {\n const values = Object.values(e.fields).map((x, i) => this.expr(x, s, [...path, i], b));\n return this.value(b, call(\"rec\", this.constant(Object.keys(e.fields)), array(...values)));\n }\n case \"app\":\n return this.#app(e, s, path, b);\n case \"fold\":\n return this.#fold(e, s, path, b);\n case \"iterate\":\n return this.#iterate(e, s, path, b);\n case \"each\": {\n // A list keeps its error items, and generated code makes no error values. Thus an error item stops the program.\n const keys = this.locals++;\n const values = this.locals++;\n b.stmts.push({ t: \"let\", n: keys, value: array() }, { t: \"let\", n: values, value: array() });\n this.#loop(e, s, path, b, () => RETURN, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: keys, value: key }, { t: \"push\", n: values, value: v });\n });\n return this.value(b, call(\"list\", local(keys), local(values)));\n }\n case \"ext\": {\n // An extension can give the error #DEPTH!, which a list op does not skip. Thus an error of an extension stops the program.\n const x = this.value(b, call(\"ext\", this.constant(e.kind), this.constant(e.data), s.space, s.origin, s.focus, this.constant(path)));\n b.stmts.push({ t: \"check\", ok: prim(\"!==\", x, FALLBACK_EXPR), reason: \"an extension\", fail: RETURN });\n return x;\n }\n }\n }\n\n /**\n * This method gives the value of a node that depends only on the space (§7.2). The memo has an entry for each space.\n * Without the entry of the space, the node evaluates in a block, and an error of it makes an entry without a value.\n * An exception stops the program, so the memo gets no entry for it.\n */\n #memoized(e: Expr, keys: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const memo: LExpr = { t: \"memo\", id: this.memos++ };\n // Each key evaluates here, in a block of its own, as a binding does.\n const values = keys.map((k): Bound => this.#attempt(b, (inner) => this.expr(k, s, path, inner)));\n const tuple = array(...values.flatMap((k) => [k.value, flag(k)]));\n const h = this.locals++;\n const outer = this.#keys;\n this.#keys = new Map([...outer, ...keys.map((k, i): [Expr, Bound] => [k, values[i] as Bound])]);\n const compute = block(b.fail);\n const node = this.#attempt(compute, (inner) => this.#node(e, s, path, inner));\n this.#keys = outer;\n compute.stmts.push({ t: \"set\", n: h, value: prim(\"memoPut\", memo, s.space, tuple, node.value, flag(node)) });\n b.stmts.push({ t: \"let\", n: h, value: prim(\"memoGet\", memo, s.space, tuple) }, { t: \"if\", cond: prim(\"!\", prim(\"isValue\", local(h))), yes: compute.stmts, no: [] });\n this.check(b, prim(\"entryOk\", local(h)), \"a value of the memo\");\n // Each entry of the memo comes from the code of the node, so it has the kind of the value of the node.\n return this.#typed(this.value(b, prim(\"entryValue\", local(h))), this.kindOf(node.value));\n }\n\n /**\n * This method evaluates an expression in a block whose errors end the block, as a binding does. It gives the value\n * and the flag that tells if the value exists. Without statements, the expression always has a value, so it gets no flag.\n */\n #attempt(b: Block, make: (inner: Block) => LExpr): Bound {\n const label = this.labels++;\n const attempt = block({ t: \"break\", label });\n const value = make(attempt);\n if (attempt.stmts.length === 0) return { value };\n const v = this.locals++;\n const ok = this.locals++;\n this.#typed(local(v), this.kindOf(value));\n attempt.stmts.push({ t: \"set\", n: v, value }, { t: \"set\", n: ok, value: bool(true) });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts });\n return { value: local(v), ok: local(ok) };\n }\n\n /**\n * This method reads a field, as `ref` of the interpreter: the record of the key, and then each segment of the path.\n * A segment that cannot name a field always gives an error.\n */\n #ref(e: ExprOf<\"ref\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const record = e.at === undefined || e.at.length === 0 ? s.rec : prim(\"get\", s.space, this.#address(e.at, s, path, 0, b));\n if (!e.path.every(isFieldName)) return this.fail(b);\n const n = this.locals++;\n const x = local(n);\n b.stmts.push({ t: \"let\", n, value: record });\n this.check(b, prim(\"isValue\", x), \"a record\");\n for (const seg of e.path) {\n this.check(b, prim(\"isObject\", x), \"an object\");\n b.stmts.push({ t: \"set\", n, value: prim(\"member\", x, this.constant(seg)) });\n this.check(b, prim(\"isValue\", x), \"a field\");\n }\n const [field, ...more] = e.path;\n // Tier 2 knows only the primitive kinds. A value of a domain goes through the dispatch of the runtime.\n return field === undefined || more.length > 0 ? x : this.#declared(b, x, primitiveOf(this.#schema.fields?.[field]), \"a field of the schema\");\n }\n\n /**\n * This method binds the names of a `let`. The interpreter evaluates each binding in the scope outside the `let`. An\n * error of a binding is an error only where the body reads the name. Thus an error ends the block of the binding, and\n * a flag tells each read of the name that the binding has no value.\n */\n #bind(e: ExprOf<\"let\">, s: Scope, path: readonly number[], b: Block): Pick<Scope, \"env\" | \"fns\"> {\n const env = new Map(s.env);\n const fns = new Map(s.fns);\n Object.entries(e.bind).forEach(([name, x], i) => {\n // A function evaluates at each call. A binding sees the scope of the let, so a function cannot call itself.\n // A value hides a function of its name, because a read looks at the values first.\n if (x.tag === \"fn\") {\n fns.set(name, { fn: x, path: [...path, i], scope: s });\n env.delete(name);\n } else {\n env.set(name, this.#attempt(b, (inner) => this.expr(x, s, [...path, i], inner)));\n }\n });\n return { env, fns };\n }\n\n /**\n * This method lowers a call (FN.CALL). The body of the function goes at the place of the call, with the values of the\n * arguments for its parameters. The body sees the names of the place of its binding. A call that is not valid goes\n * to tier 1.\n */\n #call(e: ExprOf<\"call\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const bound = s.env.has(e.fn) ? undefined : s.fns.get(e.fn);\n if (bound?.fn.params.length !== e.args.length) return this.fail(b);\n if (++this.#calls > MAX_CALLS) throw new Unsupported(`the calls put the bodies of functions in more than ${String(MAX_CALLS)} places`);\n const env = new Map(bound.scope.env);\n bound.fn.params.forEach((p, i) => env.set(p, this.#attempt(b, (inner) => this.expr(e.args[i] as Expr, s, [...path, i], inner))));\n return this.expr(bound.fn.body, { ...s, env, fns: bound.scope.fns }, [...bound.path, 0], b);\n }\n\n #app(e: ExprOf<\"app\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const { op, args } = e;\n switch (op) {\n case \"if\":\n return this.#if(args, s, path, b);\n case \"and\":\n case \"or\":\n return args.length === 0 ? this.fail(b) : this.#andOr(op === \"or\", args, 0, s, path, b);\n case \"ifError\":\n return this.#ifError(args, s, path, b);\n }\n if (isListOp(op)) {\n const target = eachUnderLets(args[0]);\n if (target !== undefined) return this.#fused(op, e, target, s, path, b);\n }\n const values = args.map((x, i) => this.expr(x, s, [...path, i], b));\n const kinds = values.map((x) => this.kindOf(x));\n // A static site checks the kind of its result, so the result has the kind that the op declares (KIND.RETURNS).\n const site = this.#facts.staticSite(op, kinds);\n const x = this.checked(b, { t: \"op\", name: this.index(op), args: values, kinds }, \"an op\");\n return this.#typed(x, site?.t === \"fn\" ? primitiveOf(site.returns) : undefined);\n }\n\n /** The condition must be a boolean. Only the branch that the condition selects is evaluated. */\n #if(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [cond, yes, no] = args;\n if (cond === undefined) return this.fail(b);\n const c = this.#boolean(this.expr(cond, s, [...path, 0], b), b);\n const r = this.locals++;\n const kinds: (PrimitiveKind | undefined)[] = [];\n const branch = (x: Expr | undefined, i: number): LStmt[] => {\n const inner = block(b.fail);\n const value = x === undefined ? this.fail(inner) : this.expr(x, s, [...path, i], inner);\n kinds.push(this.kindOf(value));\n inner.stmts.push({ t: \"set\", n: r, value });\n return inner.stmts;\n };\n b.stmts.push({ t: \"if\", cond: c, yes: branch(yes, 1), no: branch(no, 2) });\n return this.#typed(local(r), join(kinds[0], kinds[1]));\n }\n\n /** `or` stops at the first `true`, and `and` at the first `false`. Each argument before the stop must be a boolean. */\n #andOr(isOr: boolean, args: readonly Expr[], i: number, s: Scope, path: readonly number[], b: Block, r = this.locals++): LExpr {\n const x = this.#boolean(this.expr(args[i] as Expr, s, [...path, i], b), b);\n this.#typed(local(r), \"boolean\");\n if (i === args.length - 1) {\n b.stmts.push({ t: \"set\", n: r, value: x });\n } else {\n const rest = block(b.fail);\n this.#andOr(isOr, args, i + 1, s, path, rest, r);\n const stop: LStmt[] = [{ t: \"set\", n: r, value: bool(isOr) }];\n b.stmts.push(isOr ? { t: \"if\", cond: x, yes: stop, no: rest.stmts } : { t: \"if\", cond: x, yes: rest.stmts, no: stop });\n }\n return local(r);\n }\n\n /**\n * The value of the first argument, or else the value of the second argument. An error of the first argument ends its\n * block. An exception, for example #DEPTH!, stops the program, so `ifError` does not hide it (EVAL.DEPTH).\n */\n #ifError(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [first, second] = args;\n if (first === undefined) return this.fail(b);\n const label = this.labels++;\n const r = this.locals++;\n const ok = this.locals++;\n const attempt = block({ t: \"break\", label });\n const value = this.expr(first, s, [...path, 0], attempt);\n attempt.stmts.push({ t: \"set\", n: r, value }, { t: \"set\", n: ok, value: bool(true) });\n const otherwise = block(b.fail);\n const fallback = second === undefined ? this.fail(otherwise) : this.expr(second, s, [...path, 1], otherwise);\n otherwise.stmts.push({ t: \"set\", n: r, value: fallback });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts }, { t: \"if\", cond: prim(\"!\", local(ok)), yes: otherwise.stmts, no: [] });\n return this.#typed(local(r), join(this.kindOf(value), this.kindOf(fallback)));\n }\n\n /** A value of a known kind needs no check. */\n #boolean(x: LExpr, b: Block): LExpr {\n if (this.kindOf(x) !== \"boolean\") this.check(b, prim(\"isBoolean\", x), \"a boolean\");\n return x;\n }\n\n #number(x: LExpr, b: Block): LExpr {\n if (this.kindOf(x) !== \"number\") this.check(b, prim(\"isNumber\", x), \"a number\");\n return x;\n }\n\n /**\n * This method lowers a list op over an `each` into one loop. Like the interpreter, the loop skips an error item, and\n * with the option `strict` the list op fails at an error item. `errors` gives the error values, so an error item of\n * `errors` stops the program.\n */\n #fused(op: ListOp, e: ExprOf<\"app\">, target: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block): LExpr {\n // The `let` expressions above the `each`, from the outside in.\n let inner = s;\n let at = [...path, 0];\n for (let x = e.args[0] as Expr; x.tag === \"let\"; x = x.body) {\n inner = { ...inner, ...this.#bind(x, inner, at, b) };\n at = [...at, Object.keys(x.bind).length];\n }\n const rest = e.args.slice(1).map((x, i) => this.expr(x, s, [...path, i + 1], b));\n const options = op === \"reduce\" ? rest[1] : rest[0];\n const strict = options === undefined ? undefined : this.value(b, prim(\"===\", call(\"opts\", options), bool(true)));\n const name = rest[0];\n if (op === \"reduce\") {\n if (name === undefined) return this.fail(b);\n this.check(b, prim(\"isString\", name), \"an op name\");\n }\n const items = (label: number): Fail => {\n if (op === \"errors\") return RETURN;\n return strict === undefined ? { t: \"continue\", label } : { t: \"continue\", label, strict: { cond: strict, else: b.fail } };\n };\n\n const acc = this.locals++;\n const n = this.typedLocal(\"number\");\n const init = (value: LExpr): void => {\n b.stmts.push({ t: \"let\", n: acc, value });\n };\n b.stmts.push({ t: \"let\", n, value: num(0) });\n const count = (body: Block): void => {\n body.stmts.push({ t: \"set\", n, value: prim(\"+\", local(n), num(1)) });\n };\n // A check of the list op itself is in the loop, but its failure is a failure of the list op.\n const opCheck = (body: Block): Block => ({ stmts: body.stmts, fail: b.fail });\n const firstThen = (body: Block, v: LExpr, then: (later: Block) => LExpr): void => {\n const later = block(b.fail);\n later.stmts.push({ t: \"set\", n: acc, value: then(later) });\n body.stmts.push({ t: \"if\", cond: prim(\"===\", local(n), num(0)), yes: [{ t: \"set\", n: acc, value: v }], no: later.stmts });\n };\n const nonEmpty = (): void => {\n this.check(b, prim(\"!==\", local(n), num(0)), \"a list that is not empty\");\n };\n\n switch (op) {\n case \"count\":\n this.#loop(target, inner, at, b, items, (body) => count(body));\n return local(n);\n case \"sum\":\n case \"mean\":\n init(num(0));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(\"+\", local(acc), this.#number(v, opCheck(body))) });\n count(body);\n });\n if (op === \"sum\") return this.#typed(this.checked(b, call(\"result\", local(acc)), \"a finite sum\"), \"number\");\n nonEmpty();\n return this.#typed(this.checked(b, call(\"result\", prim(\"/\", local(acc), local(n))), \"a finite mean\"), \"number\");\n case \"min\":\n case \"max\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n this.#number(v, opCheck(body));\n firstThen(body, v, () => prim(op, local(acc), v));\n count(body);\n });\n nonEmpty();\n return this.#typed(local(acc), \"number\");\n case \"any\":\n case \"all\":\n case \"none\":\n init(bool(op === \"all\"));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(op === \"all\" ? \"&&\" : \"||\", local(acc), this.#boolean(v, opCheck(body))) });\n });\n return op === \"none\" ? prim(\"!\", local(acc)) : this.#typed(local(acc), \"boolean\");\n case \"first\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, () => local(acc));\n count(body);\n });\n nonEmpty();\n return local(acc);\n case \"values\":\n case \"keys\":\n init(array());\n this.#loop(target, inner, at, b, items, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: acc, value: op === \"keys\" ? key : v });\n });\n return this.value(b, call(\"frozen\", local(acc)));\n case \"errors\":\n this.#loop(target, inner, at, b, items, () => undefined);\n return this.value(b, call(\"frozen\", array()));\n case \"reduce\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, (later) => this.checked(later, call(\"step\", name as LExpr, local(acc), v), \"a step of reduce\"));\n count(body);\n });\n nonEmpty();\n return local(acc);\n // listReason stops a program with these ops before the lowering, so this case is defensive.\n case \"sortBy\":\n case \"take\":\n case \"nth\":\n case \"drop\":\n case \"append\":\n case \"flat\":\n case \"without\":\n case \"get\":\n case \"indexOf\":\n /* v8 ignore next -- @preserve */\n // Stryker disable next-line all: listReason stops these ops before the lowering\n throw new Unsupported(`the list op \"${op}\"`);\n }\n }\n\n /**\n * This method lowers the loop over the targets of an axis. The tests of `where` and the body evaluate at each target\n * in a block whose failure is `items(label)`. Then `onItem` adds the statements for the value of the body.\n */\n /**\n * This method gives the key of an address. The expressions of its computed moves evaluate first, at the position of\n * the node, and their child indexes start at `first` (NAV.COMPUTED).\n */\n #address(at: Addr, s: Scope, path: readonly number[], first: number, b: Block): LExpr {\n const values = addrExprs(at).map((x, i) => this.expr(x, s, [...path, first + i], b));\n const args = [s.space, s.origin, s.focus, this.constant(at), ...(values.length === 0 ? [] : [array(...values)])];\n return this.checked(b, call(\"addr\", ...args), \"an address\");\n }\n\n #loop(e: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block, items: (label: number) => Fail, onItem: (body: Block, key: LExpr, value: LExpr) => void): void {\n this.#targetLoop(e.axis, e.at, s, path, 1, b, items, (body, key, at) => {\n onItem(body, key, this.expr(e.body, at, [...path, 0], body));\n });\n }\n\n /**\n * This method lowers the loop over the targets of an axis with the address `addr`. The tests of `where` have the child\n * indexes from `firstTest`, and the expressions of the address come after them. `each` adds the statements of a target.\n */\n #targetLoop(\n axis: Axis,\n addr: Addr | undefined,\n s: Scope,\n path: readonly number[],\n firstTest: number,\n b: Block,\n items: (label: number) => Fail,\n each: (body: Block, key: LExpr, at: Scope) => void,\n ): void {\n const from = addr === undefined || addr.length === 0 ? s.focus : this.#address(addr, s, path, firstTest + whereTests(axis).length, b);\n const base = baseAxis(axis);\n let space = s.space;\n let over: LExpr;\n let skip: LExpr | undefined;\n // The index of the record of each target: the index of the loop, or else the index that the axis gives.\n let idx: LExpr | undefined;\n if (base.t === \"table\") {\n // The axis table moves the evaluation to the space of its table, and there the origin is the target.\n space = this.checked(b, call(\"table\", local(TABLES), this.constant(base.name)), \"a table\");\n over = call(\"keys\", space);\n } else if (base.t === \"all\" || base.t === \"others\") {\n over = call(\"keys\", s.space);\n if (base.t === \"others\") skip = from;\n } else {\n const targets = this.checked(b, { t: \"targets\", axis: this.index(base), args: [s.space, s.origin, from] }, \"the targets of an axis\");\n over = prim(\"keysOf\", targets);\n idx = this.value(b, prim(\"idxOf\", targets));\n }\n const records = this.value(b, prim(\"records\", space));\n const label = this.labels++;\n const array_ = this.locals++;\n const index = this.locals++;\n const item = this.locals++;\n const key = local(item);\n const body = block(items(label));\n if (skip !== undefined) body.stmts.push({ t: \"if\", cond: prim(\"===\", key, skip), yes: [{ t: \"next\" }], no: [] });\n const slot = idx === undefined ? local(index) : prim(\"member\", idx, local(index));\n const at: Scope = { space, origin: base.t === \"table\" ? key : s.origin, focus: key, env: s.env, fns: s.fns, rec: prim(\"recordAt\", records, slot, space, key) };\n whereTests(axis).forEach((test, i) => {\n const ok = this.#boolean(this.expr(test, at, [...path, firstTest + i], body), body);\n body.stmts.push({ t: \"if\", cond: prim(\"!\", ok), yes: [{ t: \"next\" }], no: [] });\n });\n each(body, key, at);\n b.stmts.push({ t: \"loop\", label, item, index, array: array_, over, body: body.stmts });\n }\n\n /** This method gives a local for each name of a loop, with its first value at the node (LOOP.NAMES). */\n #loopNames(init: Names, s: Scope, path: readonly number[], b: Block): { readonly env: ReadonlyMap<string, Bound>; readonly locals: ReadonlyMap<string, number> } {\n const env = new Map(s.env);\n const locals = new Map<string, number>();\n Object.entries(init).forEach(([name, x], i) => {\n const value = this.expr(x, s, [...path, i], b);\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n this.#typed(local(n), this.kindOf(value));\n env.set(name, { value: local(n) });\n locals.set(name, n);\n });\n return { env, locals };\n }\n\n /**\n * This method lowers one step of a loop: each new value first, and then each name gets its value. A name keeps the\n * kind of its first value, so a new value of another kind stops the program, and tier 1 evaluates it.\n */\n #loopStep(step: Names, s: Scope, path: readonly number[], first: number, b: Block, locals: ReadonlyMap<string, number>): void {\n const values = Object.entries(step).map(([name, x], i): [number, LExpr] => {\n const n = locals.get(name) as number;\n const value = this.value(b, this.expr(x, s, [...path, first + i], b));\n return [n, this.#declared(b, value, this.kindOf(local(n)), \"a value of the kind of a name of a loop\")];\n });\n for (const [n, value] of values) b.stmts.push({ t: \"set\", n, value });\n }\n\n /** This method lowers an iteration (ITERATE.LIMIT, ITERATE.UNTIL): a repeated block with a count of its steps. */\n #iterate(e: ExprOf<\"iterate\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n const inner: Scope = { ...s, env };\n const label = this.labels++;\n const k = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n: k, value: num(0) });\n const body = block(b.fail);\n if (e.until !== undefined) {\n const stop = this.#boolean(this.expr(e.until, inner, [...path, tests], body), body);\n body.stmts.push({ t: \"check\", ok: prim(\"!\", stop), reason: \"the test until\", fail: { t: \"break\", label } });\n }\n // At the limit, an iteration without a test ends, and an iteration with a test fails.\n body.stmts.push({ t: \"check\", ok: prim(\"!==\", local(k), num(e.limit)), reason: \"the limit of iterate\", fail: e.until === undefined ? { t: \"break\", label } : b.fail });\n this.#loopStep(e.step, inner, path, first, body, locals);\n body.stmts.push({ t: \"set\", n: k, value: prim(\"+\", local(k), num(1)) });\n b.stmts.push({ t: \"repeat\", label, body: body.stmts });\n return this.expr(e.result, inner, [...path, tests + (e.until === undefined ? 0 : 1)], b);\n }\n\n /** This method lowers a fold (FOLD.ORDER): the loop over the targets, with a step at each target. */\n #fold(e: ExprOf<\"fold\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n // An error of a test or of a step is the error of the fold.\n this.#targetLoop(e.axis, e.at, s, path, tests, b, () => b.fail, (body, _key, at) => {\n this.#loopStep(e.step, { ...at, env }, path, first, body, locals);\n });\n return this.expr(e.result, { ...s, env }, [...path, tests + whereTests(e.axis).length + addrExprs(e.at).length], b);\n }\n}\n\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function gives the flag of a bound value: its local, or `true` for a value without a flag. */\n// Stryker disable next-line BooleanLiteral: a value without a flag always exists, so each constant gives the same entries\nconst flag = (b: Bound): LExpr => b.ok ?? bool(true);\n","/**\n * The runtime of generated code. Each function follows the rule of the interpreter of the core. Where the interpreter\n * gives an error value, the function gives `FALLBACK`, and tier 1 then does the evaluation again (docs/COMPILER.md §4.1).\n * Thus the runtime makes no error values and no `Result` objects.\n *\n * Generated code uses the runtime inside a `try`, and an exception gives `FALLBACK` for the whole program. A function\n * of the runtime catches an exception only where the interpreter makes a value of it. In an op, it is `#CALC!`, and in\n * `safeIs`, it is `false`. A full call stack is `#DEPTH!`, which no list op and no `ifError` hides, so it goes on to\n * the program.\n */\nimport {\n axisTargets,\n findMethod,\n isListOp,\n isStackOverflow,\n isVexList,\n liftsAt,\n matchesKind,\n fixAddr,\n resolveAddr,\n safeIs,\n vexList,\n type Addr,\n type AnyDomain,\n type Axis,\n type FixedMove,\n type FreeFn,\n type Space,\n} from \"@mark1russell7/vex\";\nimport { entryOf, type Entry, type Method, type Options } from \"./facts.ts\";\n\n/** The value of a program that stops at a failed check. */\nexport const FALLBACK: unique symbol = Symbol(\"vex.fallback\");\nexport type Fallback = typeof FALLBACK;\n\n/** The options that a runtime keeps: the domains, the free functions and the extension handlers. */\nexport type RuntimeOptions = Options;\n\n/**\n * The dispatch of one op name and one number of arguments. With up to 3 arguments, it takes the values themselves, the\n * receiver first. With more, it takes an array of the values. Generated code also reads its fields: the method of the\n * last receiver, the function of the op of the first domain, and the free function.\n */\nexport interface Site {\n (...values: never[]): unknown;\n m: Method | undefined;\n readonly fn: Method | undefined;\n readonly free: FreeFn | undefined;\n}\n\n/** A base axis: an axis that is not `where`. */\nexport type BaseAxis = Exclude<Axis, { readonly t: \"where\" }>;\n\n/** The targets of an axis at a focus: the keys, and the index of each key in `keys` of the space. */\nexport interface Targets {\n readonly keys: readonly string[];\n readonly idx: readonly (number | undefined)[];\n}\n\n/** An entry of a memo: the value of a node for one space, or no value after an error. */\nexport interface MemoEntry {\n readonly v: unknown;\n readonly ok: boolean;\n}\n\n/**\n * The memo of one node: an entry for each space and each value of the keys (docs/COMPILER.md §7.2 and §7.3). An entry\n * with an object or a function in its keys is not kept, because each run can make a new one.\n */\nexport interface Memo {\n get(s: Space, keys: readonly unknown[]): MemoEntry | undefined;\n put(s: Space, keys: readonly unknown[], v: unknown, ok: boolean): MemoEntry;\n}\n\n/** A level of a memo: the entry of the keys so far, and the levels of the next key. */\ninterface MemoLevel {\n entry?: MemoEntry;\n next?: Map<unknown, MemoLevel>;\n}\n\n/** A map key does not tell 0 from -0, but an op can. Thus -0 has its own key. */\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function tells if a memo keeps an entry with these keys: keys without objects and functions. */\nconst kept = (keys: readonly unknown[]): boolean => keys.every((k) => (typeof k !== \"object\" || k === null) && typeof k !== \"function\");\n\n/** The functions of the runtime. The names are the names of `RuntimeFn` in the loop IR. */\nexport interface Runtime {\n readonly F: Fallback;\n has(s: Space, key: string): boolean;\n /** This function gives the key of an address. `values` has the values of its computed moves (NAV.COMPUTED). */\n addr(s: Space, origin: string, focus: string, at: Addr, values?: readonly unknown[]): unknown;\n /**\n * This function gives the function of the targets of one base axis. A space does not change, so the targets stay in\n * a cache for each space and focus. Generated code gets it once, when it loads.\n */\n axis(axis: BaseAxis): (s: Space, origin: string, focus: string) => Targets | Fallback;\n table(tables: Readonly<Record<string, Space>> | undefined, name: string): unknown;\n keys(s: Space): readonly string[];\n /** This function gives the dispatch of an op name with `arity` arguments. Generated code gets it once, when it loads. */\n site(name: string, arity: number): Site;\n /** This function gives a new memo. Generated code gets one for each node of the memo, when it loads. */\n memo(): Memo;\n /** This function gives the domain at an index of the options. */\n domain(index: number): AnyDomain | undefined;\n /** An exception of an op is the error #CALC! of that op, so this function gives `FALLBACK`. A full call stack goes on. */\n threw(thrown: unknown): Fallback;\n step(name: string, acc: unknown, value: unknown): unknown;\n result(value: unknown): unknown;\n opts(value: unknown): unknown;\n rec(names: readonly string[], values: readonly unknown[]): unknown;\n list(keys: readonly string[], values: readonly unknown[]): unknown;\n frozen(values: readonly unknown[]): unknown;\n ext(kind: string, data: unknown, s: Space, origin: string, focus: string, path: readonly number[]): unknown;\n var(vars: Readonly<Record<string, unknown>> | undefined, name: string): unknown;\n}\n\n/** This function makes the runtime of one set of options. */\nexport function createRuntime(options: RuntimeOptions): Runtime {\n const domains = options.domains ?? [];\n const fns = options.fns;\n const extensions = options.extensions ?? {};\n const F: Fallback = FALLBACK;\n\n const threw = (thrown: unknown): Fallback => {\n if (isStackOverflow(thrown)) throw thrown;\n return F;\n };\n\n // The checks of the result of an op: a value, a finite number, and a valid value of its first domain.\n const checked = (value: unknown): unknown => {\n if (value === undefined || value === null) return F;\n if (typeof value === \"number\" && !Number.isFinite(value)) return F;\n for (const d of domains) {\n if (safeIs(d, value)) return d.valid === undefined || d.valid(value) ? value : F;\n }\n return value;\n };\n\n // The call of an op, as `#call` of the interpreter: the lift of numbers, the kinds of the parameters, the call, and\n // the checks of the result.\n const invoke = (e: Entry, call: (args: readonly unknown[]) => unknown, rest: readonly unknown[]): unknown => {\n try {\n const lift = e.spec.liftScalar;\n const from = e.domain.fromScalar;\n const args = lift && from !== undefined ? rest.map((a, i): unknown => (typeof a === \"number\" && liftsAt(lift, i) ? from(a) : a)) : rest;\n const params = e.spec.params;\n if (params !== undefined && !args.every((a, i) => matchesKind(params[i] ?? \"any\", a, e.domain))) return F;\n return checked(call(args));\n } catch (thrown) {\n return threw(thrown);\n }\n };\n\n // The op of a name for a receiver: the first domain that accepts the receiver and has the op. `undefined` is no op.\n // `seen` receives each method that the dispatch finds.\n const dispatch = (entries: readonly (Entry | undefined)[], name: string, values: readonly unknown[], seen?: (m: Method) => void): unknown => {\n const [self, ...rest] = values;\n for (const e of entries) {\n if (e === undefined || !safeIs(e.domain, self)) continue;\n const fn = e.fn;\n if (fn !== undefined) return invoke(e, (args) => fn(self, ...args), rest);\n const method = findMethod(self, name);\n if (method === undefined) continue;\n seen?.(method);\n return invoke(e, (args) => method.apply(self, [...args]), rest);\n }\n return undefined;\n };\n\n const entriesOf = (name: string): readonly (Entry | undefined)[] => domains.map((d) => entryOf(d, name));\n\n // The entries of the op names of reduce. A program can compute such a name, so the runtime keeps them by name.\n const stepEntries = new Map<string, readonly (Entry | undefined)[]>();\n\n // The index of each key of a space, for the targets of an axis. A miss of the cache only makes the map again.\n const indexes = new WeakMap<Space, ReadonlyMap<string, number>>();\n const indexOf = (s: Space): ReadonlyMap<string, number> => {\n let m = indexes.get(s);\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (m === undefined) {\n m = new Map(s.keys.map((k, i) => [k, i]));\n // Stryker disable next-line CallExpression: see the comment above\n indexes.set(s, m);\n }\n return m;\n };\n\n return {\n F,\n has: (s, key) => s.has(key),\n addr(s, origin, focus, at, values) {\n const pos = { origin, focus };\n // An address without computed moves has no values, and its moves are fixed.\n // Stryker disable next-line ConditionalExpression: fixAddr gives the same fixed moves, so the test only saves an array\n const fixed = values === undefined ? undefined : fixAddr(at, values, pos);\n if (fixed?.ok === false) return F;\n const r = resolveAddr(s, pos, fixed === undefined ? (at as readonly FixedMove[]) : fixed.value);\n return r.ok ? r.value : F;\n },\n axis(axis) {\n const cache = new WeakMap<Space, Map<string, Targets | Fallback>>();\n return (s, origin, focus) => {\n let byFocus = cache.get(s);\n if (byFocus === undefined) {\n byFocus = new Map();\n cache.set(s, byFocus);\n }\n let targets = byFocus.get(focus);\n if (targets === undefined) {\n const r = axisTargets(s, { origin, focus }, axis);\n const index = indexOf(s);\n targets = r.ok ? { keys: r.value, idx: r.value.map((k) => index.get(k)) } : F;\n byFocus.set(focus, targets);\n }\n return targets;\n };\n },\n table(tables, name) {\n const t = tables !== undefined && Object.hasOwn(tables, name) ? tables[name] : undefined;\n return t ?? F;\n },\n keys: (s) => s.keys,\n // The dispatch of `app` in the interpreter: the first domain that accepts the receiver and has the op, and else a\n // free function. Generated code has the fast path of each site, and it uses this dispatch for each other case.\n site(name, arity) {\n const entries = entriesOf(name);\n const listOp = isListOp(name);\n const fn = fns !== undefined && Object.hasOwn(fns, name) ? fns[name] : undefined;\n const generic = (values: readonly unknown[]): unknown => {\n // A list op on a list value is not an error, but tier 2 does not have it. The exception stops the program.\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (listOp && isVexList(values[0])) throw new Error(\"tier 1 gives a list op on a list value\");\n if (values.length > 0) {\n const r = dispatch(entries, name, values, (m) => {\n site.m = m;\n });\n if (r !== undefined) return r;\n }\n try {\n // Stryker disable next-line ConditionalExpression: a call of undefined throws, and the catch also gives F\n return fn === undefined ? F : checked(fn(...values));\n } catch (thrown) {\n return threw(thrown);\n }\n };\n const call = arity <= 3 ? (...values: unknown[]): unknown => generic(values) : generic;\n const site: Site = Object.assign(call, { m: undefined, fn: entries.find((e) => e !== undefined)?.fn, free: fn });\n return site;\n },\n memo() {\n const spaces = new WeakMap<Space, MemoLevel>();\n // The level of a space and some keys. With `make`, the function makes each missing level. A level that a read\n // makes only uses memory, so the checks of `make` have no other effect.\n const level = (s: Space, keys: readonly unknown[], make: boolean): MemoLevel | undefined => {\n let at: MemoLevel | undefined = spaces.get(s);\n if (at === undefined) {\n // A read comes before each write, so the level of the space exists for each write.\n // Stryker disable next-line ConditionalExpression,BooleanLiteral: see the comments above\n if (!make) return undefined;\n at = {};\n spaces.set(s, at);\n }\n for (const k of keys) {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different entries\n const slot = Object.is(k, -0) ? NEGATIVE_ZERO : k;\n let next: MemoLevel | undefined = at.next?.get(slot);\n if (next === undefined) {\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (!make) return undefined;\n next = {};\n (at.next ??= new Map()).set(slot, next);\n }\n at = next;\n }\n return at;\n };\n return {\n // Stryker disable next-line BooleanLiteral: a read that makes the levels only uses memory\n get: (s, keys) => level(s, keys, false)?.entry,\n put(s, keys, v, ok) {\n const e = { v, ok };\n if (kept(keys)) (level(s, keys, true) as MemoLevel).entry = e;\n return e;\n },\n };\n },\n domain: (index) => domains[index],\n threw,\n // One step of `reduce`: the first domain that accepts the accumulator and has the op. No free function.\n step(name, acc, value) {\n let entries = stepEntries.get(name);\n // A miss of the cache only reads the op tables again.\n // Stryker disable ConditionalExpression,BlockStatement,CallExpression\n if (entries === undefined) {\n entries = entriesOf(name);\n stepEntries.set(name, entries);\n }\n // Stryker restore ConditionalExpression,BlockStatement,CallExpression\n return dispatch(entries, name, [acc, value]) ?? F;\n },\n result(value) {\n try {\n return checked(value);\n } catch (thrown) {\n return threw(thrown);\n }\n },\n // A list op reads the option `strict` of its options. The read can throw, as in the interpreter.\n opts: (value) => (value as { readonly strict?: unknown } | null | undefined)?.strict,\n // Object.fromEntries gives an own field for each name, also for \"__proto__\" (V-062).\n rec: (names, values) => Object.freeze(Object.fromEntries(names.map((n, i) => [n, values[i]]))),\n list: (keys, values) => vexList(keys.map((key, i) => ({ key, result: { ok: true, value: values[i] } }))),\n frozen: (values) => Object.freeze([...values]),\n ext(kind, data, s, origin, focus, path) {\n const handler = Object.hasOwn(extensions, kind) ? extensions[kind] : undefined;\n // Stryker disable next-line ConditionalExpression: a call of undefined throws, and the program gives F for it too\n if (handler === undefined) return F;\n const r = handler(data, { space: s, position: { origin, focus }, path });\n return r.ok ? r.value : F;\n },\n // The interpreter reads the own enumerable properties of the variables, with `Object.entries`.\n var(vars, name) {\n return vars !== undefined && Object.prototype.propertyIsEnumerable.call(vars, name) ? vars[name] : F;\n },\n };\n}\n","/**\n * The tiers (docs/COMPILER.md §2.1). Tier 2 is generated JavaScript. Tier 1 is the closure compiler of the core, and it\n * gives each result that tier 2 cannot give. Thus a tiered program gives the results of the interpreter.\n */\nimport { compile, fromDocument, isDocument, ok, type CompileOptions, type Envelope, type Expr, type Program, type Space } from \"@mark1russell7/vex\";\nimport { factsOf, type Schema } from \"./facts.ts\";\n\n/** The options of the compiler: the options of `compile`, and the schema of the host (docs/COMPILER.md §3.2). */\nexport type GenerateOptions = CompileOptions & { readonly schema?: Schema };\nimport { printJs } from \"./js.ts\";\nimport type { LoopProgram } from \"./loop.ts\";\nimport { lower, Unsupported } from \"./lower.ts\";\nimport { createRuntime, FALLBACK } from \"./runtime.ts\";\n\n/**\n * The output of `generate`: the loop IR and the source of a program, and the options that the source is for. Or else\n * the reason that the compiler cannot lower the program.\n */\nexport type Generated =\n | { readonly ok: true; readonly program: LoopProgram; readonly source: string; readonly options: GenerateOptions }\n | { readonly ok: false; readonly reason: string };\n\n/** A function of tier 2. It gives the value of the program, or `FALLBACK`. */\nexport type Tier2 = (space: Space, origin: string, vars: Readonly<Record<string, unknown>> | undefined, tables: Readonly<Record<string, Space>> | undefined) => unknown;\n\n/**\n * This function lowers an expression or a document and prints its source for the options (DOC.ENTRY). The op tables of\n * the domains give the fast path of each op site. It is pure, so a build can use it.\n */\nexport function generate(source: Expr | Envelope, options: GenerateOptions = {}): Generated {\n // DOC.ENTRY: a document gives its expression first, or the reason that it is not valid.\n const read = isDocument(source) ? fromDocument(source, options.domains) : ok(source);\n if (!read.ok) return { ok: false, reason: read.error.message };\n try {\n const facts = factsOf(options);\n const program = lower(read.value, facts, options.schema);\n return { ok: true, program, source: printJs(program, facts), options };\n } catch (thrown) {\n // A stack overflow in the lowering of a deep expression also goes to tier 1.\n return { ok: false, reason: thrown instanceof Unsupported ? thrown.message : \"the lowering threw an exception\" };\n }\n}\n\n/**\n * This function makes the function of tier 2 with `new Function`, with the options of the source. It throws on a page\n * that does not permit `new Function`.\n */\nexport function load(generated: Extract<Generated, { readonly ok: true }>): Tier2 {\n // oxlint-disable-next-line typescript/no-implied-eval -- the source comes from printJs, and it reads each name and literal from K (§5).\n const make = new Function(\"K\", \"R\", generated.source) as (k: readonly unknown[], r: ReturnType<typeof createRuntime>) => Tier2;\n return make(generated.program.constants, createRuntime(generated.options));\n}\n\n/** The counts of the runs of a tiered program. */\nexport interface TierStats {\n /** The number of runs. */\n readonly runs: number;\n /** The number of runs where tier 2 gave `FALLBACK`, so tier 1 gave the result. */\n readonly fallbacks: number;\n}\n\n/** A program with tiers. It has the interface `Program` of the core, so it can replace a compiled program. */\nexport interface TieredProgram extends Program {\n /** The tier of the program: 2 when it has generated code, and else 1. */\n readonly tier: 1 | 2;\n /** The reason that the program has no generated code. */\n readonly reason?: string;\n readonly stats: TierStats;\n}\n\n/**\n * This function compiles an expression or a document into tier 2 if it can, and else into tier 1 (DOC.ENTRY). After a\n * failed check of tier 2, tier 1 does that evaluation again. A run with a trace and `explain` always use tier 1, because\n * tier 2 makes no trace.\n */\nexport function tiered(source: Expr | Envelope, options: GenerateOptions = {}): TieredProgram {\n const slow = compile(source, options);\n // The program of tier 1 has the expression of a document, so tier 2 does not read the document again.\n const { expr } = slow;\n const generated = generate(expr, options);\n let fast: Tier2 | undefined;\n let reason: string | undefined;\n if (generated.ok) {\n try {\n fast = load(generated);\n } catch {\n reason = \"the page does not permit new Function\";\n }\n } else {\n reason = generated.reason;\n }\n const stats = { runs: 0, fallbacks: 0 };\n return {\n expr,\n tier: fast === undefined ? 1 : 2,\n ...(reason === undefined ? {} : { reason }),\n stats,\n run(r) {\n stats.runs++;\n if (fast === undefined || r.trace !== undefined) return slow.run(r);\n const value = fast(r.space, r.origin, r.vars, r.tables);\n if (value !== FALLBACK) return ok(value);\n stats.fallbacks++;\n return slow.run(r);\n },\n explain: (r) => slow.explain(r),\n };\n}\n","/**\n * The static order of the cells of a sheet in a module (COMPILE.MODULE.SHEET). It is the order of `SheetRun.fill` in\n * `packages/core/src/sheet.ts` (SHEET.FILL). Each column comes after the columns that it reads. The keys of a column\n * follow its reads from itself. The order changes only the speed, not a result (SHEET.ORDER).\n */\nimport { addrExprs, CELL_KIND, children, isMove, listOf, moveExpr, shapeError, type Axis, type CellFormulas, type CellRef, type Expr, type Move } from \"@mark1russell7/vex\";\n\n/** A direction of the reads of a column from itself: to an earlier key, to a later key, or down a tree to the children. */\nexport type Direction = \"before\" | \"after\" | \"down\";\n\n/** This function tells if the data of an extension is a cell reference: a column, and an address of fixed moves. */\nexport const isCellRef = (u: unknown): u is CellRef =>\n typeof u === \"object\" &&\n u !== null &&\n typeof (u as { column?: unknown }).column === \"string\" &&\n Array.isArray((u as { at?: unknown }).at) &&\n (u as { at: readonly unknown[] }).at.every((m) => isMove(m) && moveExpr(m) === undefined);\n\n/** This function adds the direction of one move or one axis of a read of a column from itself. */\nfunction addDirection(d: Set<Direction>, m: Move | Axis): void {\n // The reverse order reads the same keys as its axis.\n if (m.t === \"reverse\") {\n addDirection(d, m.axis);\n return;\n }\n if (m.t === \"offset\" || m.t === \"window\") {\n // An offset moves by its first step that is not 0. A window reads the keys from `from` to `to`.\n const steps = m.t === \"offset\" ? [m.d.find((x) => x !== 0) ?? 0] : [m.from, m.to];\n // A step of 0 reads the cell itself, which is a cycle in each order.\n // Stryker disable next-line EqualityOperator: see the comment above\n if (steps.some((x) => x < 0)) d.add(\"before\");\n // Stryker disable next-line EqualityOperator: see the comment above\n if (steps.some((x) => x > 0)) d.add(\"after\");\n } else if (m.t === \"children\" || m.t === \"descendants\") d.add(\"down\");\n // The items of a list can be at each key, so the axis list gives no direction, and the other reads decide the order.\n}\n\n/** This function gives the base axis of an axis, and the tests of its `where` axes. */\nfunction partsOf(axis: Axis): { readonly base: Axis; readonly tests: readonly Expr[] } {\n const tests: Expr[] = [];\n let base = axis;\n while (base.t === \"where\") {\n tests.push(base.test);\n base = base.axis;\n }\n return { base, tests };\n}\n\n/**\n * This function gives the columns that the formulas of the column `self` read with a cell reference: its formula and\n * the formulas of its cells. It also gives the directions of their reads of the column itself. A read in the body or\n * in a test of an axis also has the direction of that axis.\n */\nexport function readsOf(columns: ReadonlyMap<string, Expr>, cells: CellFormulas, self: string): { readonly columns: ReadonlySet<string>; readonly directions: ReadonlySet<Direction> } {\n const read = new Set<string>();\n const directions = new Set<Direction>();\n const formula = columns.get(self);\n // An expression that is not valid reads no column. A module gives the reason for it.\n const todo: [Expr, Axis | undefined][] = [...(formula === undefined ? [] : [formula]), ...(cells.get(self)?.values() ?? [])].filter((e) => shapeError(e) === undefined).map((e) => [e, undefined]);\n for (let item = todo.pop(); item !== undefined; item = todo.pop()) {\n const [e, axis] = item;\n if (e.tag === \"each\" || e.tag === \"fold\") {\n const { base, tests } = partsOf(e.axis);\n for (const x of [...(e.tag === \"each\" ? [e.body] : Object.values(e.step)), ...tests]) todo.push([x, base]);\n // The values of init, the result of a fold, the list of the axis list and the expressions of the address evaluate\n // at the node, so they keep the outer direction.\n const list = listOf(e.axis);\n for (const x of [...(e.tag === \"fold\" ? [...Object.values(e.init), e.result] : []), ...addrExprs(e.at), ...(list === undefined ? [] : [list])]) todo.push([x, axis]);\n } else if (e.tag !== \"ext\") {\n for (const child of children(e)) todo.push([child, axis]);\n // The data of an extension of another kind can look like a cell reference. It only changes the order of a fill.\n // Stryker disable next-line ConditionalExpression,LogicalOperator: see the comment above\n } else if (e.kind === CELL_KIND && isCellRef(e.data)) {\n read.add(e.data.column);\n // The directions of the reads of another column only change the order, because that column comes first.\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (e.data.column === self) for (const m of [...(axis === undefined ? [] : [axis]), ...e.data.at]) addDirection(directions, m);\n }\n }\n return { columns: read, directions };\n}\n\n/**\n * This function gives the columns of a sheet in an order where each column comes after the columns that it reads. The\n * columns of a cycle keep their order. The columns with formulas of cells only come last.\n */\nexport function columnOrder(columns: ReadonlyMap<string, Expr>, cells: CellFormulas): readonly string[] {\n const names = new Set([...columns.keys(), ...cells.keys()]);\n let left = [...names].map((c) => ({ c, needs: [...readsOf(columns, cells, c).columns].filter((x) => x !== c && names.has(x)) }));\n const order: string[] = [];\n const placed = new Set<string>();\n // Each pass places each column whose reads are placed. A pass that places no column leaves a cycle, so it places\n // the first column that is left.\n while (left.length > 0) {\n const ready = left.filter((x) => x.needs.every((n) => placed.has(n)));\n for (const x of ready.length > 0 ? ready : left.slice(0, 1)) {\n order.push(x.c);\n placed.add(x.c);\n }\n left = left.filter((x) => !placed.has(x.c));\n }\n return order;\n}\n\n/**\n * The order of the keys of a column, from the directions of its reads from itself. `reverse` reverses the key order. In\n * a tree, `post` puts the children before their parent, and `back` reverses the order of the siblings.\n */\nexport interface KeyOrder {\n readonly reverse: boolean;\n readonly post: boolean;\n readonly back: boolean;\n}\n\n/**\n * This function gives the order of the keys of a column. A read of a later key reverses the order. In a tree, a read of\n * the children puts the children before their parent, as `keyOrder` of `SheetRun` does.\n */\nexport function keyOrderOf(d: ReadonlySet<Direction>): KeyOrder {\n const reverse = d.has(\"after\") && !d.has(\"before\");\n const post = d.has(\"down\");\n return { reverse, post, back: post !== reverse };\n}\n","/**\n * Standalone modules (docs/COMPILER.md §4.4 and §6). `emitModule` prints a program as an ES module that has no import of\n * Vex. A host that guarantees the kinds of its input uses it without the interpreter, for example ireko at build time.\n *\n * The module gives the results of the interpreter for each input that keeps the schema. It checks the schema once, at\n * the start of a run, and an input against the schema throws a `VexContractError`. An error of Vex is a value too:\n * the run gives `VEX_ERROR` at its key.\n *\n * The printer gives statements and loops, as a person writes them. A binding is a variable, and a list op is a `for`\n * loop with a running value. An error of Vex is a thrown sentinel. A binding, `ifError` and an item of a list op catch\n * it, as in the interpreter. A node of the memo and the key of the run catch it too. Each op is the function of its\n * domain, as text, so it has the bits of the interpreter (§4.2).\n *\n * A part of the program that depends on no key of the space is a constant of the run. The module evaluates it once,\n * before the loop over the keys. A node of the memo is one function of its other keys, with a map of its values. The\n * nodes with the same expression share the function.\n *\n * The printer takes a part of the language. It takes an array space or a tree space of records, and the fields and\n * the variables of the schema. It takes the axes `all`, `others` and `window`. A tree space also has the move `parent` and the\n * axes of a tree (COMPILE.MODULE.TREE). The kinds of each op site must decide its op. Another construct gives a\n * reason, not code.\n *\n * `emitSheetModule` prints the formula columns of a sheet as one module (COMPILE.MODULE.SHEET). Each column is an array\n * of results, and the run fills the arrays in the static order of `SheetRun.fill`. A read of a cell that is not finished\n * starts the search of `SheetRun`. Thus each cell on a cycle gives the error of Vex.\n */\nimport { addrExprs, CELL_KIND, children, fromDocument, isDocument, isFieldName, lit, moveExpr, nestingOf, rec, shapeError, type AnyDomain, type Axis, type CellFormulas, type Envelope, type Expr, type ExprOf, type Move, type Names, type PrimitiveKind } from \"@mark1russell7/vex\";\nimport { factsOf, kindOfDomain, primitiveOf, type Facts, type Kind, type Schema } from \"./facts.ts\";\nimport { memoNodes } from \"./memo.ts\";\nimport { columnOrder, isCellRef, keyOrderOf, readsOf } from \"./sheet-order.ts\";\n\n/** The options of a standalone module. */\nexport interface ModuleOptions {\n readonly domains?: readonly AnyDomain[];\n /** The kinds of the fields of the records and of the variables. A module reads only the names of its schema. */\n readonly schema: Schema;\n /**\n * The name of the function that the module exports. The default is `run`. A reserved word, a name that the module\n * declares and a global that a module reads (`MODULE_GLOBALS`) are not names of the run (V-060).\n */\n readonly name?: string;\n /**\n * The space of the records. In both spaces, the key of a record is the text of its position. The default `array`\n * has no parents. A `tree` takes the parents as the third argument of the run (COMPILE.MODULE.TREE). Each entry\n * is the position of the parent of its record, or -1 for a root.\n */\n readonly space?: \"array\" | \"tree\";\n}\n\n/** The options of a module of a sheet (COMPILE.MODULE.SHEET): the options of a module, and the parts of a sheet. */\nexport interface SheetModuleOptions extends ModuleOptions {\n /** The cells with their own formula (SHEET.CELL.FORMULA). The formula of a cell replaces the formula of its column at its key. */\n readonly cells?: CellFormulas;\n /**\n * The kind of the values of each column. The printer prints each column after the columns that it reads. A column\n * that a formula reads before its own formula prints needs its kind here, for example a column that reads itself.\n */\n readonly kinds?: Readonly<Record<string, Kind>>;\n /** The budget of the stack of the search of a run, in estimated frames, as in `SheetRun`. The default is 3000. */\n readonly budget?: number;\n}\n\n/** The source of a standalone module, or the reason that the program cannot be one. */\nexport type Emitted = { readonly ok: true; readonly source: string } | { readonly ok: false; readonly reason: string };\n\n/** The error of a construct that a standalone module does not have. */\nclass NotStandalone extends Error {}\n\n/**\n * A value of the printer: its code, its kind if the printer knows it, and true when its code cannot throw. A literal,\n * a variable of the schema and a field of the schema at the focus or at the origin cannot throw.\n */\ninterface Value {\n readonly code: string;\n readonly kind: Kind | undefined;\n readonly safe: boolean;\n /** For the read of a name that can hold the error sentinel: the name itself, which holds the value or the sentinel. */\n readonly held?: string;\n /**\n * The levels of the keys that the value depends on: 1 for the key of the run, and one more for each axis around it.\n * A value with no levels is a constant of the run.\n */\n readonly deps: ReadonlySet<number>;\n /** True for a literal and for the read of a name: a constant of the run with such code needs no variable of its own. */\n readonly plain?: boolean;\n /** For a list (LIST.VALUE): the kind of its items. The code is an array of pairs of a key and a value or the sentinel. */\n readonly list?: ListInfo | undefined;\n}\n\n/** The facts of a list of the code: the kind of the values of its items, if the printer knows it. */\ninterface ListInfo {\n readonly item: Kind | undefined;\n}\n\n/** The code of a node: the statements before its value, and its value. `safe` covers the statements too. */\ninterface Code {\n readonly s: readonly string[];\n readonly v: Value;\n}\n\n/** A name of the program in the code: its variable, its kind, true when it can hold the error sentinel, and its levels. */\ninterface Name {\n readonly code: string;\n readonly kind: Kind | undefined;\n readonly lazy: boolean;\n readonly deps: ReadonlySet<number>;\n readonly list?: ListInfo | undefined;\n}\n\n/** An argument of a call: its code, its kind and its levels. */\ninterface Arg {\n readonly code: string;\n readonly kind: Kind | undefined;\n readonly deps: ReadonlySet<number>;\n}\n\n/** The levels of a constant of the run. */\nconst NO_DEPS: ReadonlySet<number> = new Set();\n\n/**\n * The level of a read of a cell (COMPILE.MODULE.SHEET). The results of the cells change in a run. Thus a value that reads\n * a cell is not a constant or a column of the run. The level is far from the other levels.\n */\nconst CELLS = -1;\n\n/** The name of the function of a run of a sheet that reads a cell: its column and its position. */\nconst READ_CELL = \"RC\";\n\n/** This pattern finds a read of a cell in the code of a value: the read, or a printed function that can read a cell. */\nconst READS_IN_CODE = /\\b(RC|fn\\d+)\\(/;\n\n/** The columns of a sheet for the printer (COMPILE.MODULE.SHEET). */\ninterface SheetInfo {\n /** The position of each column in the arrays of the run. */\n readonly columns: ReadonlyMap<string, number>;\n /** The kind of each column that the printer knows: a kind of the options, or the kind of a printed formula. */\n readonly kinds: Map<string, Kind | undefined>;\n}\n\n/** This function gives the levels of some codes together. */\nconst depsOf = (...xs: readonly Code[]): ReadonlySet<number> => new Set(xs.flatMap((x) => [...x.v.deps]));\n\n/** This function gives the statements of some codes, in order. */\nconst stmtsOf = (...xs: readonly Code[]): string[] => xs.flatMap((x) => x.s);\n\n/** This function indents some statements by one level. */\nconst ind = (xs: readonly string[]): string[] => xs.map((x) => ` ${x}`);\n\n/**\n * The lexical position of a node: the code of the index of its origin and of its focus, and its names. It also has the\n * keys of its node of the memo. A node of the memo reads neither its origin nor its focus, so these are undefined there.\n */\ninterface Ctx {\n readonly origin: string | undefined;\n readonly focus: string | undefined;\n /** The level of the focus: 1 at the key of the run, and one more in each axis. */\n readonly level: number;\n /** The level of the origin: 1 at the key of the run, and the marker of the origin in the body of a function. */\n readonly originLevel: number;\n readonly env: ReadonlyMap<string, Name>;\n readonly keys: ReadonlyMap<Expr, Name>;\n /** The bound functions (FN.BIND), with the context of their binding. */\n readonly fns: ReadonlyMap<string, BoundFn>;\n}\n\n/**\n * A bound function of the printer (FN.BIND): its node and the context of its binding. It also has one printed\n * JavaScript function for each signature of the arguments of its calls.\n */\ninterface BoundFn {\n /** The number of the binding. Two functions with one name are two functions, so a key of a constant needs it. */\n readonly id: number;\n readonly fn: ExprOf<\"fn\">;\n readonly ctx: Ctx;\n /** The printed function for each signature: the kind of each argument. */\n readonly specs: Map<string, Spec>;\n /** The declarations of the printed functions that read names of the place of the binding. The let prints them. */\n readonly decls: string[];\n /** True when a printed function of the binding is at the place of the binding, not at the start of a run. */\n local: boolean;\n}\n\n/**\n * A function that the printer prints at this time. Its parameters, and the bindings at the root of its body, keep their\n * values for the whole call. Thus a part of a loop that reads only them and its target is a column of the call.\n */\ninterface CallScope {\n /** The marker of the parameters. */\n readonly param: number;\n /** The level of the focus of the function. A part at a higher level is in a loop of the function. */\n readonly focus: number;\n /** True when the body has a loop in a loop, so a call can read a part of a loop more than once. */\n readonly repeats: boolean;\n /** The variables that the start of the body can read: the parameters, and the bindings at the root of the body. */\n readonly names: Set<string>;\n /** The declarations of the columns of the call. The function prints them at the start of its body. */\n readonly decls: string[];\n /** The root of the body. A let at the root moves it to its body, because its bindings are at the start of the body. */\n root: Expr;\n}\n\n/**\n * A printed function. The levels of the value of its body have a marker for the origin, for the focus and for each\n * parameter. A call replaces each marker with the levels at the call.\n */\ninterface Spec {\n readonly name: string;\n readonly kind: Kind | undefined;\n readonly safe: boolean;\n readonly deps: ReadonlySet<number>;\n readonly origin: number;\n readonly focus: number;\n readonly param: number;\n /** True when the body reads only constants of the run, its parameters and its position, so it is at the start of a run. */\n readonly global: boolean;\n}\n\n/** The name of a helper of the generated code. */\ntype Helper = \"F\" | \"C\" | \"T\" | \"L\" | \"Q\" | \"G\" | \"B\" | \"U\" | \"X\" | \"I\" | \"K\" | \"M\" | \"M1\" | \"S\" | \"V\" | \"SB\" | \"TK\" | \"NT\" | TreeHelper | SheetHelper;\n\n/** The helpers of a tree space (COMPILE.MODULE.TREE). */\ntype TreeHelper = \"PT\" | \"CH\" | \"SG\" | \"PR\" | \"UP\" | \"SO\" | \"AN\" | \"BF\";\n\n/** The helpers of a sheet (COMPILE.MODULE.SHEET): the state of a run of a sheet, and the order of the keys of a tree. */\ntype SheetHelper = \"SH\" | \"KO\";\n\n/** The helpers of the generated code. A module has only the helpers that it uses. */\nconst HELPERS: Readonly<Record<Exclude<Helper, \"S\">, string>> = {\n F: \"function F() { throw E; }\",\n C: \"function C(m) { throw new VexContractError(m); }\",\n // An exception of an op is an error of Vex too, as in the interpreter. Only the checks of the contract throw a\n // VexContractError, and they come before the run, so each catch of the run gives the sentinel.\n T: \"function T(f) { try { return f(); } catch { return E; } }\",\n // A constant of the run with a loop evaluates on its first read, so a loop in a branch that no run takes costs nothing.\n L: \"function L(f) { let done = false, v; return () => { if (!done) { done = true; try { v = f(); } catch { v = E; } } return v; }; }\",\n // A column of the run: the value of an expression at each record, on its first read.\n Q: \"function Q(f) { const m = []; return (j) => { let v = m[j]; if (v === undefined) { try { v = f(j); } catch { v = E; } m[j] = v; } return v; }; }\",\n G: \"function G(x) { return x === E ? F() : x; }\",\n B: 'function B(x) { return typeof x === \"boolean\" ? x : F(); }',\n U: 'function U(x) { return typeof x === \"number\" ? x : F(); }',\n X: \"function X(t, n) { return t >= 0 && t < n ? t : F(); }\",\n // The index of a computed position, and of a computed key: a key of an array space is the text of its index.\n I: \"function I(t, n) { return Number.isInteger(t) && t >= 0 && t < n ? t : F(); }\",\n K: 'function K(k, n) { return typeof k === \"string\" && /^(0|[1-9]\\\\d*)$/.test(k) && +k < n ? +k : F(); }',\n // The ops on the order of a list (LIST.SORT, LIST.TAKE, LIST.NTH) work on the items with values. With strict, an\n // error item is the error of the op. A sort is stable, and the values are numbers without NaN or texts of one kind.\n V: \"function V(l, s) { if (s && l.some((x) => x[1] === E)) F(); return l.filter((x) => x[1] !== E); }\",\n SB: [\n \"function SB(l, s) {\",\n \" const o = V(l, s);\",\n \" const t = o.length > 0 ? typeof o[0][1] : \\\"number\\\";\",\n \" for (const [, v] of o) if (typeof v !== t || (t !== \\\"number\\\" && t !== \\\"string\\\") || v !== v) F();\",\n \" return o.sort((a, b) => (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0));\",\n \"}\",\n ].join(\"\\n\"),\n TK: \"function TK(l, n, s) { const o = V(l, s); return Number.isSafeInteger(n) && n >= 0 ? o.slice(0, n) : F(); }\",\n NT: \"function NT(l, i, s) { const o = V(l, s); return Number.isSafeInteger(i) && i >= 0 && i < o.length ? o[i][1] : F(); }\",\n // The parents of a tree space: the position of the parent of each record, or -1 for a root. A walk up from each record\n // marks its keys, so a walk that meets a key of the same walk finds a cycle. Each key is in one walk, so the check is linear.\n PT: [\n \"function PT(p, n) {\",\n ' if (!Array.isArray(p) || p.length !== n) C(\"the parents are not an array with one parent for each record\");',\n \" const P = new Int32Array(n), s = new Uint8Array(n);\",\n \" for (let i = 0; i < n; i++) {\",\n \" const x = p[i];\",\n \" if (x !== -1 && !(Number.isInteger(x) && x >= 0 && x < n)) C(`the parent of the record ${i} is not -1 or the position of a record`);\",\n \" P[i] = x;\",\n \" }\",\n \" for (let i = 0; i < n; i++) {\",\n \" let k = i;\",\n \" while (k >= 0 && s[k] === 0) {\",\n \" s[k] = 1;\",\n \" k = P[k];\",\n \" }\",\n \" if (k >= 0 && s[k] === 1) C(`the parents of the record ${i} make a cycle`);\",\n \" for (k = i; k >= 0 && s[k] === 1; k = P[k]) s[k] = 2;\",\n \" }\",\n \" return P;\",\n \"}\",\n ].join(\"\\n\"),\n // The children of each record and the roots, in key order.\n CH: [\n \"function CH(P, n) {\",\n \" const h = [], r = [];\",\n \" for (let i = 0; i < n; i++) h.push([]);\",\n \" for (let i = 0; i < n; i++) (P[i] < 0 ? r : h[P[i]]).push(i);\",\n \" return [h, r];\",\n \"}\",\n ].join(\"\\n\"),\n // The siblings of each record with the record itself, and its position among them. The roots are the siblings of a root.\n SG: [\n \"function SG(P, h, r, n) {\",\n \" const g = [], s = new Int32Array(n);\",\n \" for (let i = 0; i < n; i++) g.push(P[i] < 0 ? r : h[P[i]]);\",\n \" for (const x of [r, ...h]) for (let q = 0; q < x.length; q++) s[x[q]] = q;\",\n \" return [g, s];\",\n \"}\",\n ].join(\"\\n\"),\n // The keys depth first, with each parent before its children, and the position and the size of the subtree of each\n // record. Thus the descendants of a record are the keys after it, as many as its subtree has under it.\n PR: [\n \"function PR(h, r, n) {\",\n \" const o = [], at = new Int32Array(n), z = new Int32Array(n), st = [];\",\n \" for (let q = r.length - 1; q >= 0; q--) st.push(r[q]);\",\n \" while (st.length > 0) {\",\n \" const k = st.pop();\",\n \" at[k] = o.length;\",\n \" o.push(k);\",\n \" for (let q = h[k].length - 1; q >= 0; q--) st.push(h[k][q]);\",\n \" }\",\n \" for (let q = n - 1; q >= 0; q--) {\",\n \" const k = o[q];\",\n \" z[k] = 1;\",\n \" for (const c of h[k]) z[k] += z[c];\",\n \" }\",\n \" return [o, at, z];\",\n \"}\",\n ].join(\"\\n\"),\n UP: \"function UP(P, k) { const p = P[k]; return p < 0 ? F() : p; }\",\n SO: \"function SO(g, s, k, d) { const t = g[k][s[k] + d]; return t === undefined ? F() : t; }\",\n AN: \"function AN(P, k) { const o = []; for (let p = P[k]; p >= 0; p = P[p]) o.push(p); return o; }\",\n // The record and the keys under it, in the order of a breadth-first search. A tree has no cycle, so no key comes twice.\n BF: \"function BF(h, k) { const o = [k]; for (let i = 0; i < o.length; i++) for (const c of h[o[i]]) o.push(c); return o; }\",\n // The state of a run of a sheet (COMPILE.MODULE.SHEET), as in SheetRun: the result of each finished cell, the search\n // of Tarjan with its stack, and the budget of the stack. `r` reads a cell, `f` fills a cell, and `o` gives a column.\n // A cell without a formula has the error sentinel from the start, as the error of its read.\n SH: [\n \"function SH(n, cols, own, budget) {\",\n \" const pg = (c, k) => {\",\n \" const o = own[c];\",\n \" const g = o === undefined ? undefined : o[k];\",\n \" return g === undefined ? cols[c] : g;\",\n \" };\",\n \" const D = [];\",\n \" for (let c = 0; c < cols.length; c++) {\",\n \" const d = new Array(n);\",\n \" for (let k = 0; k < n; k++) if (pg(c, k) === undefined) d[k] = E;\",\n \" D.push(d);\",\n \" }\",\n \" const seen = new Map(), stack = [], FILL = {};\",\n \" let top = FILL, missed = false, next = 0, used = 0;\",\n \" const start = (c, k) => {\",\n \" const i = next++;\",\n \" const v = { id: c * n + k, c, k, i, low: i, re: false, r: E, p: false, need: undefined };\",\n \" seen.set(v.id, v);\",\n \" stack.push(v);\",\n \" return v;\",\n \" };\",\n \" const ev = (v, g) => {\",\n \" const caller = top;\",\n \" v.p = false;\",\n \" v.need = undefined;\",\n \" top = v;\",\n \" used += g[1];\",\n \" const x = g[0](v.k);\",\n \" used -= g[1];\",\n \" top = caller;\",\n \" if (!v.p) v.r = x;\",\n \" };\",\n \" const end = (v, caller) => {\",\n \" if (v.low === v.i) {\",\n \" const ms = stack.splice(stack.lastIndexOf(v));\",\n \" const cycle = ms.length > 1 || v.re;\",\n \" for (const m of ms) {\",\n \" seen.delete(m.id);\",\n \" D[m.c][m.k] = cycle ? E : m.r;\",\n \" }\",\n \" } else if (caller !== undefined) caller.low = Math.min(caller.low, v.low);\",\n \" };\",\n \" const r = (c, k) => {\",\n \" const d = D[c][k];\",\n \" if (d !== undefined) return d;\",\n \" const caller = top;\",\n \" if (caller === FILL) {\",\n \" missed = true;\",\n \" return E;\",\n \" }\",\n \" if (caller.p) return E;\",\n \" const s = seen.get(c * n + k);\",\n \" if (s !== undefined) {\",\n \" caller.low = Math.min(caller.low, s.i);\",\n \" s.re = true;\",\n \" return E;\",\n \" }\",\n \" const g = pg(c, k);\",\n \" const v = start(c, k);\",\n \" if (used + g[1] > budget) {\",\n \" caller.p = true;\",\n \" caller.need = v;\",\n \" return E;\",\n \" }\",\n \" ev(v, g);\",\n \" if (v.p) {\",\n \" caller.p = true;\",\n \" caller.need = v;\",\n \" return E;\",\n \" }\",\n \" end(v, caller);\",\n \" const x = D[c][k];\",\n \" return x === undefined ? E : x;\",\n \" };\",\n \" const drive = (c, k) => {\",\n \" const work = [start(c, k)];\",\n \" for (let v = work[0]; v !== undefined; v = work[work.length - 1]) {\",\n \" ev(v, pg(v.c, v.k));\",\n \" if (v.p) {\",\n \" for (let q = v.need; q !== undefined; q = q.need) work.push(q);\",\n \" continue;\",\n \" }\",\n \" work.pop();\",\n \" end(v, work[work.length - 1]);\",\n \" }\",\n \" };\",\n \" const f = (c, k) => {\",\n \" if (D[c][k] !== undefined) return;\",\n \" missed = false;\",\n \" const x = pg(c, k)[0](k);\",\n \" if (missed) drive(c, k);\",\n \" else D[c][k] = x;\",\n \" };\",\n \" const o = (c) => {\",\n \" const d = D[c], out = [];\",\n \" for (let k = 0; k < n; k++) out.push(d[k] === E ? VEX_ERROR : d[k]);\",\n \" return out;\",\n \" };\",\n \" return { r, f, o };\",\n \"}\",\n ].join(\"\\n\"),\n // The keys of a tree in the order of a fill (SHEET.FILL): each parent before its children, or after them with `post`.\n // `back` reverses the order of the siblings.\n KO: [\n \"function KO(h, r, post, back) {\",\n \" const o = [], st = [];\",\n \" const push = (x) => {\",\n \" if (back) for (let q = 0; q < x.length; q++) st.push(x[q]);\",\n \" else for (let q = x.length - 1; q >= 0; q--) st.push(x[q]);\",\n \" };\",\n \" push(r);\",\n \" while (st.length > 0) {\",\n \" const k = st.pop();\",\n \" o.push(k);\",\n \" push(h[k]);\",\n \" }\",\n \" return post ? o.reverse() : o;\",\n \"}\",\n ].join(\"\\n\"),\n // The memo of a function of one key, and of more keys. -0 has its own entry, because an op can tell it from 0.\n M1: [\n \"function M1(f) {\",\n \" const m = new Map();\",\n \" return (k) => {\",\n \" const s = Object.is(k, -0) ? Z : k;\",\n \" let r = m.get(s);\",\n \" if (r === undefined) {\",\n \" try { r = f(k); } catch { r = E; }\",\n \" m.set(s, r);\",\n \" }\",\n \" return G(r);\",\n \" };\",\n \"}\",\n ].join(\"\\n\"),\n M: [\n \"function M(f) {\",\n \" const root = new Map();\",\n \" return (...k) => {\",\n \" let m = root;\",\n \" for (const x of k.slice(0, -1)) {\",\n \" const s = Object.is(x, -0) ? Z : x;\",\n \" let c = m.get(s);\",\n \" if (c === undefined) m.set(s, (c = new Map()));\",\n \" m = c;\",\n \" }\",\n \" const last = k.at(-1);\",\n \" const s = Object.is(last, -0) ? Z : last;\",\n \" let r = m.get(s);\",\n \" if (r === undefined) {\",\n \" try { r = f(...k); } catch { r = E; }\",\n \" m.set(s, r);\",\n \" }\",\n \" return G(r);\",\n \" };\",\n \"}\",\n ].join(\"\\n\"),\n};\n\n/**\n * This list has the globals of JavaScript that the code of a module reads. This code is the helpers, the run and the\n * copies of the ops of the test domains. A test reads the text of the modules of the golden files and checks this list (V-060).\n */\nexport const MODULE_GLOBALS: ReadonlySet<string> = new Set(\"Array Error Int32Array Map Math Number Object Uint8Array undefined\".split(\" \"));\n\n/** A part of the helper S that only some nodes need (helperS). */\ntype Feature = \"group\" | \"prefix\" | \"strict\" | \"ok\" | \"pre\";\n\n/**\n * This function gives the code of the helper S, a node of the memo that keeps its items (Printer.#cached). The helper\n * has only the parts that the nodes of the module need:\n *\n * - `group`: the groups of the values of the key (mode 1).\n * - `prefix`: the prefixes of the items (mode 2).\n * - `strict`: the option strict of a list op.\n * - `ok`: the check of the kind of a value.\n * - `pre`: the tests before the test of the key.\n *\n * The node gives `key` for the value of each item, and `val` for the value of an item from its index. It gives `test`\n * for the test of the key.\n */\nconst helperS = (has: ReadonlySet<Feature>): string => {\n const on = (f: Feature, ...lines: readonly string[]): readonly string[] => (has.has(f) ? lines : []);\n const strict = has.has(\"strict\");\n const ok = has.has(\"ok\");\n // The items that end the lookup with an error, and the items that the lookup skips.\n const fails = [...(strict ? [\"x === E\"] : []), ...(ok ? [\"x === W\"] : [])].join(\" || \");\n const skips = strict ? \"x === N || (x === E && !strict)\" : \"x === N || x === E\";\n return [\n \"function S(n, mode, strict, a0, step, result, key, val, test, pre, ok) {\",\n \" let ts, js, xs, bad, reach, gs, mono, pa, pc, pe;\",\n \" const value = (i) => {\",\n \" let x = xs[i];\",\n \" if (x === undefined) {\",\n \" x = val(js[i]);\",\n ...on(\"ok\", \" if (ok && x !== E && x !== N && !ok(x)) x = W;\"),\n \" xs[i] = x;\",\n \" }\",\n \" return x;\",\n \" };\",\n \" return M1((q) => {\",\n \" if (ts === undefined) {\",\n \" ts = [];\",\n \" js = [];\",\n \" xs = [];\",\n ...on(\"strict\", \" bad = false;\", \" reach = 0;\"),\n \" for (let j = 0; j < n; j++) {\",\n \" try {\",\n ...on(\"pre\", \" if (pre && !pre(j)) continue;\"),\n ...on(\"strict\", \" reach++;\"),\n \" const t = key(j);\",\n // NaN satisfies no test of a group or of a prefix, so its item is in none.\n \" if (mode && t !== t) continue;\",\n \" ts.push(t);\",\n \" js.push(j);\",\n \" } catch {\",\n ...on(\"strict\", \" bad = true;\"),\n \" }\",\n \" }\",\n ...on(\"group\", \" if (mode === 1) {\", \" gs = new Map();\", \" for (let i = 0; i < ts.length; i++) {\", \" let g = gs.get(ts[i]);\", \" if (g === undefined) gs.set(ts[i], (g = []));\", \" g.push(i);\", \" }\", \" }\"),\n ...on(\"prefix\", \" if (mode === 2) {\", \" mono = true;\", \" for (let i = 1; i < ts.length; i++) if (!(ts[i - 1] <= ts[i])) mono = false;\", \" pa = [a0];\", \" pc = [0];\", \" pe = [false];\", \" }\"),\n \" }\",\n // A key with an error makes an error item of each item that reaches the test of the key.\n strict ? \" if (q === E) return strict && (bad || reach > 0) ? F() : result(a0, 0);\" : \" if (q === E) return result(a0, 0);\",\n ...on(\"strict\", \" if (strict && bad) F();\"),\n \" let a = a0, c = 0;\",\n \" const add = (i) => {\",\n \" const x = value(i);\",\n ` if (${skips}) return;`,\n ...(fails === \"\" ? [] : [` if (${fails}) F();`]),\n \" a = step(a, c, x);\",\n \" c++;\",\n \" };\",\n ...on(\"group\", \" if (mode === 1) {\", \" const g = gs.get(q);\", \" if (g !== undefined) for (const i of g) add(i);\", \" return result(a, c);\", \" }\"),\n // The values t do not decrease, so the items whose test is true are a prefix. Each prefix keeps its running value.\n ...on(\n \"prefix\",\n \" if (mode === 2 && mono) {\",\n \" let lo = 0, hi = ts.length;\",\n \" while (lo < hi) {\",\n \" const h = (lo + hi) >> 1;\",\n \" if (test(ts[h], q)) lo = h + 1;\",\n \" else hi = h;\",\n \" }\",\n \" for (let i = pa.length - 1; i < lo; i++) {\",\n \" let x = value(i), b = pa[i], d = pc[i], err = pe[i];\",\n ...(fails === \"\" ? [\" if (x !== N && x !== E) {\"] : [` if (${fails.replace(\"x === E\", \"(x === E && strict)\")}) err = true;`, \" else if (x !== N && x !== E) {\"]),\n \" b = step(b, d, x);\",\n \" d++;\",\n \" }\",\n \" pa.push(b);\",\n \" pc.push(d);\",\n \" pe.push(err);\",\n \" }\",\n \" if (pe[lo]) F();\",\n \" return result(pa[lo], pc[lo]);\",\n \" }\",\n ),\n \" for (let i = 0; i < ts.length; i++) if (test(ts[i], q)) add(i);\",\n \" return result(a, c);\",\n \" });\",\n \"}\",\n ].join(\"\\n\");\n};\n\n/** The step of the running value of first and of count: the name of its function in a module, and its code. */\nconst FIRST_STEP: readonly [string, string] = [\"s_first\", \"(a, c, x) => (c === 0 ? x : a)\"];\n\n/** The step of the running value of each list op: the name of its function in a module, and its code. */\nconst STEPS: Readonly<Record<string, readonly [string, string]>> = {\n count: FIRST_STEP,\n first: FIRST_STEP,\n sum: [\"s_add\", \"(a, c, x) => a + x\"],\n mean: [\"s_add\", \"(a, c, x) => a + x\"],\n min: [\"s_min\", \"(a, c, x) => (c === 0 ? x : Math.min(a, x))\"],\n max: [\"s_max\", \"(a, c, x) => (c === 0 ? x : Math.max(a, x))\"],\n any: [\"s_or\", \"(a, c, x) => a || x\"],\n none: [\"s_or\", \"(a, c, x) => a || x\"],\n all: [\"s_and\", \"(a, c, x) => a && x\"],\n};\n\n/** The helpers that each helper uses. */\nconst NEEDS: Readonly<Record<Helper, readonly Helper[]>> = {\n F: [], C: [], T: [], L: [], Q: [], G: [\"F\"], B: [\"F\"], U: [\"F\"], X: [\"F\"], I: [\"F\"], K: [\"F\"], M: [\"G\"], M1: [\"G\"], S: [\"M1\", \"F\"],\n // Only SB, TK and NT use V, and they need F too, so the need of V only completes the list.\n // Stryker disable next-line ArrayDeclaration: see the comment above\n V: [\"F\"],\n SB: [\"V\", \"F\"], TK: [\"V\", \"F\"], NT: [\"V\", \"F\"],\n // Each module has C, and each move uses F (#move), so these needs only complete the list.\n // Stryker disable next-line ArrayDeclaration: see the comment above\n PT: [\"C\"], UP: [\"F\"], SO: [\"F\"],\n CH: [], SG: [], PR: [], AN: [], BF: [],\n SH: [], KO: [],\n};\n\n/** The parts of a tree that a run computes before the loop over its keys, if the program needs them. */\ntype TreePart = \"children\" | \"siblings\" | \"order\";\n\n/** The statement of each part of a tree in a run, with the helper that computes it. */\nconst TREE_PARTS: Readonly<Record<TreePart, readonly [TreeHelper, string]>> = {\n children: [\"CH\", \"const [H, RT] = CH(P, n);\"],\n siblings: [\"SG\", \"const [GP, SI] = SG(P, H, RT, n);\"],\n order: [\"PR\", \"const [PO, PI, SZ] = PR(H, RT, n);\"],\n};\n\n/** An axis whose targets in a tree space are a range of an array of positions: an axis of a tree, or a window. */\ntype TreeAxis = Extract<Axis, { readonly t: \"children\" | \"ancestors\" | \"descendants\" | \"siblings\" | \"successors\" | \"predecessors\" | \"reachable\" | \"window\" }>;\n\n/** The axes of a tree space in a module, and the axes that a module of an array space does not have. */\nconst TREE_AXES: ReadonlySet<string> = new Set([\"children\", \"ancestors\", \"descendants\", \"siblings\", \"successors\", \"predecessors\", \"reachable\"]);\n\n/** This function tells if an axis has its targets in a range of an array of positions in a tree space. */\nconst isTreeAxis = (a: Axis): a is TreeAxis => a.t === \"window\" || TREE_AXES.has(a.t);\n\n/**\n * The targets of an axis of a tree space: the statements before the loop, and the positions `a[q]` for `q` from `lo` up\n * to `hi`. The loop skips the key `skip`.\n */\ninterface TreeRange {\n readonly s: readonly string[];\n readonly a: string;\n readonly lo: string;\n readonly hi: string;\n readonly skip: string | undefined;\n}\n\n/** The list ops of a standalone module. */\nconst LIST_OPS: ReadonlySet<string> = new Set([\"count\", \"sum\", \"mean\", \"min\", \"max\", \"any\", \"all\", \"none\", \"first\"]);\nconst NUMBER_LIST_OPS: ReadonlySet<string> = new Set([\"count\", \"sum\", \"mean\", \"min\", \"max\"]);\nconst BOOLEAN_LIST_OPS: ReadonlySet<string> = new Set([\"any\", \"all\", \"none\"]);\n/** The list ops that build a list from lists (LIST.BUILD), `get` (LIST.GET) and `indexOf` (LIST.INDEXOF). A module gives a reason for them. */\nconst BUILD_OPS: ReadonlySet<string> = new Set([\"drop\", \"append\", \"flat\", \"without\", \"get\", \"indexOf\"]);\n\n/** This function tells if the step of a list op throws for a value of the kind `kind`, which is the wrong kind. */\nconst stepThrows = (op: string, kind: Kind | undefined): boolean => (NUMBER_STEPS.has(op) && kind !== \"number\") || (BOOLEAN_LIST_OPS.has(op) && kind !== \"boolean\");\n\n/** The list ops whose step takes a number. */\nconst NUMBER_STEPS: ReadonlySet<string> = new Set([\"sum\", \"mean\", \"min\", \"max\"]);\n\n/** This function gives the kind of the result of a list op: first gives the kind of its items. */\nconst listKind = (op: string, item: Kind | undefined): Kind | undefined => (NUMBER_LIST_OPS.has(op) ? \"number\" : BOOLEAN_LIST_OPS.has(op) ? \"boolean\" : item);\n\nconst LOOPS = new WeakMap<Expr, boolean>();\n\n/** This function gives the names that an expression reads, also the names that it binds itself. */\nfunction namesOf(e: Expr, out = new Set<string>()): Set<string> {\n if (e.tag === \"var\") out.add(e.name);\n for (const x of children(e)) namesOf(x, out);\n return out;\n}\n\n/**\n * The smallest work of an expression in a column of the run. The work is the number of nodes. A node of the memo and a\n * constant of the run count as one node each. A part with less work costs less than the read of its column.\n */\nconst COLUMN_WORK = 10;\n\n/** This function gives the head of a loop over targets: from `lo` up to `hi`, or from `hi` down to `lo` in the reverse order. */\nconst forHead = (j: string, lo: string, hi: string, reverse: boolean): string => (reverse ? `for (let ${j} = ${hi} - 1; ${j} >= ${lo}; ${j}--) {` : `for (let ${j} = ${lo}; ${j} < ${hi}; ${j}++) {`);\n\n/** This function tells if an expression has a loop in a loop: an axis, a fold or an iteration in another one. */\nfunction nestsLoops(e: Expr, inLoop = false): boolean {\n const loop = e.tag === \"each\" || e.tag === \"fold\" || e.tag === \"iterate\";\n return (loop && inLoop) || children(e).some((x) => nestsLoops(x, inLoop || loop));\n}\n\n/** This function tells if an expression has a loop of names: a fold or an iteration. */\nfunction hasLoop(e: Expr): boolean {\n let found = LOOPS.get(e);\n if (found === undefined) {\n found = e.tag === \"fold\" || e.tag === \"iterate\" || children(e).some(hasLoop);\n LOOPS.set(e, found);\n }\n return found;\n}\n\n/**\n * This function tells if a node of the memo has a loop of its own. Such a loop is outside its keys and outside the nodes\n * of the memo in it. A node without one combines the values of other nodes, and a function of its own only costs time.\n */\nfunction ownLoop(e: Expr, root: Expr, memo: ReadonlyMap<Expr, readonly Expr[]>, keys: ReadonlySet<Expr>): boolean {\n if (e !== root && (memo.has(e) || keys.has(e))) return false;\n return e.tag === \"each\" || children(e).some((x) => ownLoop(x, root, memo, keys));\n}\n\n/** This function gives the nodes of the memo of an expression that have a loop of their own, with their keys. */\nfunction memoOf(expr: Expr): ReadonlyMap<Expr, readonly Expr[]> {\n const all = memoNodes(expr);\n return new Map([...all].filter(([e, keys]) => ownLoop(e, e, all, new Set(keys))));\n}\n\n/** This function tells if an expression contains the expression `x`, the same object. */\nfunction contains(e: Expr, x: Expr): boolean {\n return e === x || children(e).some((c) => contains(c, x));\n}\n\n/** This function gives the base of an axis and its tests in the order of evaluation. */\nfunction testsOf(axis: Axis): { readonly base: Axis; readonly tests: readonly Expr[] } {\n const tests: Expr[] = [];\n let base = axis;\n while (base.t === \"where\") {\n tests.unshift(base.test);\n base = base.axis;\n }\n return { base, tests };\n}\n\n/**\n * This function gives the parts of a test `and`, and of each part that is a test `and` too. `and` stops at the first\n * `false`, as a chain of tests does, and each part must be a boolean.\n */\nfunction partsOf(t: Expr): readonly Expr[] {\n return t.tag === \"app\" && t.op === \"and\" && t.args.length > 0 ? t.args.flatMap(partsOf) : [t];\n}\n\n/** This function gives the kind of two values in the branches of a form, if they have the same kind. */\nconst join = (a: Kind | undefined, b: Kind | undefined): Kind | undefined => (a === b ? a : undefined);\n\n/** This function gives a value that is a constant of the run, with plain code. */\nconst plainValue = (code: string, kind: Kind | undefined): Value => ({ code, kind, safe: true, deps: NO_DEPS, plain: true });\n\n/** This function gives the code of a value with no statements. */\nconst bare = (v: Value): Code => ({ s: [], v });\n\n/** This function gives the code of a literal. A value that is not a finite number, a text, a boolean or null has no code. */\nfunction literal(value: unknown): Value {\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) throw new NotStandalone(\"a literal is a number that is not finite\");\n return plainValue(Object.is(value, -0) ? \"-0\" : String(value), \"number\");\n }\n if (typeof value === \"string\") return plainValue(JSON.stringify(value), \"string\");\n if (typeof value === \"boolean\") return plainValue(String(value), \"boolean\");\n if (value === null) return plainValue(\"null\", undefined);\n throw new NotStandalone(\"a literal is not a number, a text, a boolean or null\");\n}\n\n/**\n * This function gives a text that is the same for two expressions with the same structure. -0 is not 0. A part with a\n * token gives the token, so the text does not depend on that part. A token is an object, and a literal of a module is\n * not, so a token is not the text of a literal.\n */\nfunction canonical(e: Expr, token: (x: unknown) => object | undefined): string {\n return JSON.stringify(e, (_name, x: unknown) => token(x) ?? (Object.is(x, -0) ? { \"-0\": 0 } : x));\n}\n\n/** The values of each kind that `copied` gives to a function and to its copy. */\nconst SAMPLES: Readonly<Record<PrimitiveKind, readonly unknown[]>> = {\n number: [0, 1, -1, 2.5, -0, 1e300, -7],\n string: [\"\", \"a\", \"ab c\"],\n boolean: [true, false],\n};\n\n/** This function gives each list of arguments with one sample of each parameter, from the samples of each parameter. */\nfunction samples(each: readonly (readonly unknown[])[]): readonly (readonly unknown[])[] {\n return each.reduce<readonly (readonly unknown[])[]>((acc, values) => acc.flatMap((xs) => values.map((x) => [...xs, x])), [[]]);\n}\n\n/** This function gives the text of plain data, with -0 apart from 0. */\nconst dataText = (x: unknown): string => canonical(x as Expr, () => undefined);\n\n/** This function tells if two values are the same: the same primitive, or plain data with the same structure. */\nfunction same(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (typeof a !== \"object\" || a === null || typeof b !== \"object\" || b === null || Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;\n return dataText(a) === dataText(b);\n}\n\n/** This function gives the value of a call, or that it threw. */\nfunction call(f: () => unknown): { readonly threw: boolean; readonly value?: unknown } {\n try {\n return { threw: false, value: f() };\n } catch {\n return { threw: true };\n }\n}\n\n/** This function tells if two calls give the same: the same value, or an exception in both. */\nfunction sameCall(a: () => unknown, b: () => unknown): boolean {\n const x = call(a);\n const y = call(b);\n return x.threw === y.threw && same(x.value, y.value);\n}\n\n/**\n * This function gives the source of a function of a domain, for a copy in a module. The source must be an expression:\n * the source of a native function or of a method does not compile as one. A copy must give the values of the function:\n * a function that reads a name outside itself gives an exception in the copy. Thus the copy and the function must give\n * the same for the samples of their kinds.\n */\nfunction copied(f: (...a: never[]) => unknown, each: readonly (readonly unknown[])[], what: string): string {\n const src = Function.prototype.toString.call(f);\n let copy: (...a: unknown[]) => unknown;\n try {\n // oxlint-disable-next-line typescript/no-implied-eval -- the source is the source of a function of a domain.\n const make = new Function(`\"use strict\"; return (${src});`) as () => (...a: unknown[]) => unknown;\n copy = make();\n } catch {\n throw new NotStandalone(`${what} has no source that a module can copy`);\n }\n const fn = f as (...a: unknown[]) => unknown;\n if (!samples(each).every((xs) => sameCall(() => fn(...xs), () => copy(...xs)))) throw new NotStandalone(`${what} reads a name outside itself, so a module cannot copy it`);\n return src;\n}\n\n/** The functions that an inline form can use. They do not throw for numbers. */\nconst CALLS: ReadonlySet<string> = new Set([\n \"Math.abs\",\n \"Math.ceil\",\n \"Math.floor\",\n \"Math.round\",\n \"Math.trunc\",\n \"Math.sign\",\n \"Math.sqrt\",\n \"Math.cbrt\",\n \"Math.exp\",\n \"Math.log\",\n \"Math.log10\",\n \"Math.log2\",\n \"Math.min\",\n \"Math.max\",\n \"Math.pow\",\n \"Math.hypot\",\n \"Math.sin\",\n \"Math.cos\",\n \"Math.tan\",\n \"Math.atan2\",\n \"Number.isFinite\",\n]);\n\n/** The inline form of a function of an op: its parameters, and its body with a hole for each use of a parameter. */\ninterface InlineForm {\n readonly params: readonly string[];\n /** The parts of the body, and between two parts the index of a parameter. */\n readonly parts: readonly (string | number)[];\n /** The number of uses of each parameter. */\n readonly uses: readonly number[];\n}\n\n/**\n * The tokens of the text between the names of an inline form: digits, spaces, operators and parentheses. The tokenizer\n * takes the first token that matches at each position, as the tokenizer of JavaScript takes the longest operator. So\n * `<<=`, `>>=` and `>>>=` leave a lone `=`, and an assignment stops the inline form (V-058).\n */\nconst TOKEN = /\\d|\\.\\d|\\s|===?|!==?|<<|>>>?|<=|>=|[+\\-*/%<>!?:(),&|^~]/y;\n\n/**\n * This function tells if a text is a sequence of tokens. It takes one token at each step, so its time is linear in the\n * length of the text. A repeated group of the tokens can split `!==` in two ways, and its time is exponential (V-057).\n */\nfunction isTokens(t: string): boolean {\n TOKEN.lastIndex = 0;\n while (TOKEN.lastIndex < t.length) if (!TOKEN.test(t)) return false;\n return true;\n}\n\n/**\n * This function gives the inline form of the source of an arrow function. The body of the function must be an\n * expression of operators, numbers, its parameters and the functions of `CALLS`. Such a body cannot throw for primitive\n * values (§7.1). The inline form is the text of the function itself, so it has its bits.\n */\nfunction inlineForm(src: string): InlineForm | undefined {\n const m = /^\\(?\\s*((?:[A-Za-z_$][\\w$]*\\s*,\\s*)*[A-Za-z_$][\\w$]*)\\s*\\)?\\s*=>\\s*([\\s\\S]*)/.exec(src);\n if (m === null) return undefined;\n const params = (m[1] as string).split(\",\").map((x) => x.trim());\n const parts: (string | number)[] = [];\n const uses = params.map(() => 0);\n let text = \"\";\n // The even parts are the text between the names: numbers, operators and parentheses. An assignment, a call of a value\n // and another character, for example a quote, stop the inline form.\n const split = (m[2] as string).split(/([A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)?)/);\n for (const [i, t] of split.entries()) {\n if (i % 2 === 0) {\n if (!isTokens(t) || /\\+\\+|--|\\)\\s*\\(/.test(t)) return undefined;\n text += t;\n } else if (CALLS.has(t)) text += t;\n else {\n const p = params.indexOf(t);\n if (p < 0 || /^\\s*\\(/.test(split[i + 1] as string)) return undefined;\n parts.push(text, p);\n text = \"\";\n uses[p] = (uses[p] as number) + 1;\n }\n }\n parts.push(text);\n return { params, parts, uses };\n}\n\n/** This function gives the text of an inline form without spaces, with `#i` for the parameter `at(i)`. */\nconst patternOf = (form: InlineForm, at: (p: number) => number): string => form.parts.map((p) => (typeof p === \"number\" ? `#${at(p)}` : p.replaceAll(/\\s/g, \"\"))).join(\"\");\n\n/** The reserved words of the strict code of a module, and the two names that strict code does not bind. */\nconst RESERVED: ReadonlySet<string> = new Set(\n \"await break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield arguments eval\".split(\" \"),\n);\n\n/**\n * This function gives the reason that a name cannot be the name of the run, or `undefined` for a good name (V-060). A\n * reserved word does not parse, and a second declaration of a name of the module does not parse. The function of the\n * run with the name of a global of `MODULE_GLOBALS` hides that global from the code of the module.\n */\nfunction nameReason(name: string, declared: ReadonlySet<string>): string | undefined {\n if (RESERVED.has(name)) return `the name \"${name}\" is a reserved word of JavaScript`;\n if (MODULE_GLOBALS.has(name)) return `the name \"${name}\" is a global that a module reads`;\n return declared.has(name) ? `the name \"${name}\" is a name of the module` : undefined;\n}\n\nclass Printer {\n readonly #facts: Facts;\n readonly #domains: readonly AnyDomain[];\n readonly #schema: Schema;\n readonly #memo: ReadonlyMap<Expr, readonly Expr[]>;\n readonly helpers = new Set<Helper>();\n /** The declarations at the top of the module: the functions of the domains and the checks of the results. */\n readonly top = new Map<string, string>();\n /** The statements at the start of a run: the constants of the run and the functions of the memo. */\n readonly run: string[] = [];\n /** The variables of the schema that the program reads. */\n readonly vars = new Map<string, string>();\n /** True when the module has a node of the memo, so it needs the key of -0. */\n memos = false;\n /** The parts of the helper S that the nodes of the memo that keep their items need (helperS). */\n readonly features = new Set<Feature>();\n /** True for a tree space, and the parts of the tree that the program reads (COMPILE.MODULE.TREE). */\n readonly #tree: boolean;\n readonly treeParts = new Set<TreePart>();\n /** The columns of a sheet, for a module of a sheet (COMPILE.MODULE.SHEET). */\n readonly #sheet: SheetInfo | undefined;\n #names = 0;\n /** The number of the next bound function, and of the next printed function. */\n #fnIds = 0;\n #printed = 0;\n /** The level of the names of the next loop. It is far above the levels of the axes, so the two do not meet. */\n #loops = 1_000_000;\n /** The node of the memo whose function the printer prints, so it prints the node itself. */\n #inside: Expr | undefined;\n readonly #structures = new Map<string, string>();\n readonly #kinds = new Map<string, Kind | undefined>();\n readonly #ops = new Map<string, number>();\n /** The inline form of each function of an op, or undefined for a function that the module calls. */\n readonly #forms = new Map<string, InlineForm | undefined>();\n /** The functions of ops that the module calls, not in an inline form. */\n readonly #called = new Set<string>();\n /** The key of the expression of each code that is a constant of the run, and the read of each hoisted constant by key. */\n readonly #keyOf = new WeakMap<Code, string>();\n readonly #constants = new Map<string, Code>();\n /** The columns of the run, by the structure of their expression. */\n readonly #columns = new Map<string, string>();\n /** The expressions whose code is the read of a column of the run. */\n readonly #columned = new WeakSet<Expr>();\n /** The lazy constants of the run, and the printed functions that have a loop: code that reads one waits for its read. */\n readonly #deferred = new Set<string>();\n /** The functions that the printer prints at this time, the innermost last. */\n // Stryker disable next-line ArrayDeclaration: a value that is not a scope has no field repeats or root, so it acts as no scope\n readonly #scopes: CallScope[] = [];\n /** The work of the body of each bound function, by the number of its binding. */\n readonly #fnWork = new Map<number, number>();\n /** The expressions whose code is a constant of the run. */\n readonly #constant = new WeakSet<Expr>();\n /** The expressions at a place that takes a list: a binding, the head of a list op and the list of an axis. */\n readonly #wantList = new WeakSet<Expr>();\n /** The facts of the list of each function of the memo whose value is a list. */\n readonly #lists = new Map<string, ListInfo | undefined>();\n\n constructor(expr: Expr, options: ModuleOptions, sheet?: SheetInfo) {\n this.#domains = options.domains ?? [];\n this.#facts = factsOf({ domains: this.#domains });\n this.#schema = options.schema;\n this.#memo = memoOf(expr);\n this.#tree = options.space === \"tree\";\n this.#sheet = sheet;\n }\n\n use(name: Helper): string {\n this.helpers.add(name);\n return name;\n }\n\n /** This method gives the name of a part of the tree, for example `H` for the children, and marks the part as read. */\n #part(part: TreePart, name: string): string {\n this.treeParts.add(part);\n return name;\n }\n\n /**\n * This method gives the check of a result of a kind, or undefined for a result that needs no check. A number must be\n * finite, and the domain of the kind can check the value with valid. The law checker of the test kit checks the\n * declaration `returns` of each op (KIND.RETURNS), so the module trusts the kind itself.\n */\n check(kind: Kind): string | undefined {\n const d = this.#facts.checkOf(kind);\n // The kind is primitive here. A static site on a value of a domain has no domain without a primitive type before it.\n if (d === undefined) throw new NotStandalone(`a domain without a primitive type comes before the domain of a ${kind}`);\n // The name of a domain can have each character. For a name that is not a JavaScript name, the check has the index\n // of its domain in its name (V-061).\n const plain = `k_${kind.replace(\":\", \"_\")}`;\n const name = /^[\\w$]+$/.test(plain) ? plain : `k_d${String(d)}`;\n // Stryker disable next-line ConditionalExpression: a check of a kind is always the same, so the map only saves time\n if (!this.top.has(name)) {\n const domain = this.#domains[d];\n const valid = domain?.valid === undefined ? undefined : this.#valid(d, domain.name, kind, domain.valid);\n const conds = [...(kind === \"number\" ? [\"Number.isFinite(x)\"] : []), ...(valid === undefined ? [] : [`${valid}(x)`])];\n if (conds.length === 0) return undefined;\n this.top.set(name, `const ${name} = (x) => (${conds.join(\" && \")} ? x : ${this.use(\"F\")}());`);\n }\n return name;\n }\n\n /** This method gives the code of a result with its check, if it needs one. */\n #checked(kind: Kind, code: string): string {\n const k = this.check(kind);\n return k === undefined ? code : `${k}(${code})`;\n }\n\n #valid(d: number, domain: string, kind: Kind, valid: (x: never) => boolean): string | undefined {\n const name = `v_${d}`;\n const src = copied(valid, [this.#samples(kind)], `the check \"valid\" of the domain ${domain}`);\n // A check that is Number.isFinite of a number adds nothing to the check of the result.\n const form = inlineForm(src);\n if (kind === \"number\" && form !== undefined && patternOf(form, (p) => p) === \"Number.isFinite(#0)\") return undefined;\n this.top.set(name, `const ${name} = ${src};`);\n return name;\n }\n\n /** This method gives the samples of a kind: the samples of a primitive type, or the samples of a domain (KIND.DOMAIN). */\n #samples(kind: Kind): readonly unknown[] {\n const primitive = primitiveOf(kind);\n if (primitive !== undefined) return SAMPLES[primitive];\n const d = this.#domains.find((x) => kindOfDomain(x) === kind) as AnyDomain;\n if (d.samples === undefined) throw new NotStandalone(`the domain ${d.name} gives no samples, so a module cannot check a copy of its op`);\n return d.samples();\n }\n\n /**\n * This method gives the code of a check of the kind of an input. The check is a test of its JavaScript type, or the\n * copy of `is` of a domain. The code is true for an input against the kind.\n */\n against(kind: Kind, input: string): string {\n const primitive = primitiveOf(kind);\n if (primitive !== undefined) return `typeof ${input} !== \"${primitive}\"`;\n const d = this.#domains.findIndex((x) => kindOfDomain(x) === kind);\n const domain = this.#domains[d];\n if (domain === undefined) throw new NotStandalone(`the schema has the kind ${kind}, and no domain has it`);\n const name = `is_${String(d)}`;\n if (!this.top.has(name)) {\n const src = copied(domain.is, [[...SAMPLES.number, ...SAMPLES.string, ...SAMPLES.boolean, null, {}, [], ...this.#samples(kind)]], `the test \"is\" of the domain ${domain.name}`);\n this.top.set(name, `const ${name} = ${src};`);\n }\n return `!${name}(${input})`;\n }\n\n /** This method gives a new name for the code. */\n fresh(prefix: string): string {\n return `${prefix}${this.#names++}`;\n }\n\n /** This method tells if code reads a lazy constant of the run, or calls a printed function that has a loop. */\n #defers(c: Code): boolean {\n return [c.v.code, ...c.s].some((line) => [...line.matchAll(/\\b(c\\d+|fn\\d+)\\(/g)].some((m) => this.#deferred.has(m[1] as string)));\n }\n\n /** This method gives the code of a name: a read that throws the error of its value, if it can hold an error. */\n #read(name: Name): Value {\n const base = { kind: name.kind, deps: name.deps, plain: true, list: name.list };\n return name.lazy ? { ...base, code: `${this.use(\"G\")}(${name.code})`, safe: false, held: name.code } : { ...base, code: name.code, safe: true };\n }\n\n /** This method gives the name of a constant of the run, from the read of its value. */\n #nameOf(v: Value): Name {\n return { code: v.held ?? v.code, kind: v.kind, lazy: v.held !== undefined, deps: NO_DEPS, list: v.list };\n }\n\n /**\n * This method gives the statements that put the value of a code, or the error sentinel, into a new variable `name`.\n * A constant of the run without statements uses the helper `T`: it evaluates once, so its closure costs little.\n */\n #store(name: string, c: Code, run = false): string[] {\n if (c.v.safe) return [...c.s, `const ${name} = ${c.v.code};`];\n if (c.s.length === 0 && c.v.held !== undefined) return [`const ${name} = ${c.v.held};`];\n if (run && c.s.length === 0) return [`const ${name} = ${this.use(\"T\")}(() => ${c.v.code});`];\n return [`let ${name};`, \"try {\", ...ind(c.s), ` ${name} = ${c.v.code};`, \"} catch {\", ` ${name} = E;`, \"}\"];\n }\n\n /**\n * This method evaluates a constant of the run once, before the loop over the keys, and gives the read of its value. A\n * constant with a loop (`lazy`) evaluates on its first read instead, as a branch of the interpreter does. So does a\n * constant that reads a lazy constant or calls a function with a loop. Else it starts that loop before the run.\n */\n #hoist(c: Code, lazy = false): Code {\n if (c.v.deps.size > 0 || (c.v.plain === true && c.s.length === 0)) return c;\n const key = this.#keyOf.get(c);\n const hit = key === undefined ? undefined : this.#constants.get(key);\n if (hit !== undefined) return hit;\n const name = this.fresh(\"c\");\n const deferred = lazy || this.#defers(c);\n if (deferred) {\n this.#deferred.add(name);\n this.run.push(`const ${name} = ${this.use(\"L\")}(() => {`, ...ind(c.s), ` return ${c.v.code};`, \"});\");\n } else this.run.push(...this.#store(name, c, true));\n const { list } = c.v;\n const read = bare(this.#read(deferred ? { code: `${name}()`, kind: c.v.kind, lazy: true, deps: NO_DEPS, list } : { code: name, kind: c.v.kind, lazy: !c.v.safe, deps: NO_DEPS, list }));\n if (key !== undefined) this.#constants.set(key, read);\n return read;\n }\n\n /**\n * This method gives the parts of a node with levels `deps`. When the node is not a constant of the run, each part that\n * is a constant evaluates once, before the loop. A node that is a constant keeps its parts, and its parent decides.\n */\n #settle(parts: readonly Code[], deps: ReadonlySet<number>, exprs: readonly Expr[] = []): readonly Code[] {\n return deps.size === 0 ? parts : parts.map((x, i) => this.#hoist(x, exprs[i] !== undefined && hasLoop(exprs[i])));\n }\n\n expr(e: Expr, ctx: Ctx): Code {\n const key = ctx.keys.get(e);\n if (key !== undefined) return bare(this.#read(key));\n const keys = this.#memo.get(e);\n const c = keys !== undefined && this.#inside !== e ? this.#memoized(e, keys, ctx) : this.#node(e, ctx);\n if (c.v.deps.size === 0) {\n // A constant of the run with the structure of an earlier one is that constant.\n this.#keyOf.set(c, this.#constKey(e, ctx));\n this.#constant.add(e);\n }\n // A list is a value only at a place that takes a list. A result, an argument and a field take no list.\n if (c.v.list !== undefined && !this.#wantList.has(e)) throw new NotStandalone(\"a list is a value of the program\");\n return this.#columnar(e, c, ctx) ? this.#column(e, c, ctx) : c;\n }\n\n /** This method gives the code of a list at a place that takes a list (LIST.VALUE): an each, a name, sortBy or take. */\n #listOf(e: Expr, ctx: Ctx): Code {\n this.#wantList.add(e);\n const c = this.expr(e, ctx);\n if (c.v.list === undefined) throw new NotStandalone(\"a list op on a value that is not a list\");\n return c;\n }\n\n /** This method tells if an expression gives a list at a place that takes one: an each, sortBy, take or a name of a list. */\n #isList(e: Expr, ctx: Ctx): boolean {\n if (e.tag === \"each\") return true;\n if (e.tag === \"app\") return e.op === \"sortBy\" || e.op === \"take\";\n return e.tag === \"var\" && ctx.env.get(e.name)?.list !== undefined;\n }\n\n /**\n * This method tells if a part of a loop over the targets is a column of the run. Its value depends only on the\n * target and on the constants of the run, so each run computes it once for each record. Each name that it reads\n * from outside is a constant of the run, so its code can be outside the loop.\n */\n #columnar(e: Expr, c: Code, ctx: Ctx): boolean {\n // A node of the memo has the level 1, so a column has a focus. The results of the cells change in a run, so a part\n // that reads a cell is not a column.\n if (ctx.level < 2 || c.v.deps.has(CELLS) || !c.v.deps.has(ctx.level) || this.#work(e, ctx.fns) < COLUMN_WORK) return false;\n const scope = this.#callScope(c, ctx);\n if (c.v.deps.size !== 1 && scope === undefined) return false;\n // A node of the memo with keys keeps its costly part for each value of its keys already.\n if (this.#keyed(e)) return false;\n const visible = (name: string): boolean => {\n const bound = ctx.env.get(name);\n return (bound?.deps.size ?? 0) === 0 || (scope?.names.has((bound as Name).code) ?? false);\n };\n return [...namesOf(e)].every(visible) && !this.#callsLocal(e, ctx);\n }\n\n /**\n * This method gives the function whose call can hold a column of a part. The part is in a loop of the function, and it\n * reads a parameter. The body of the function has a loop in a loop, so a call can read the part more than once. Each\n * name that the part reads is a parameter, a binding at the root of the body or a constant (`#columnar`). So the\n * part depends only on its target and on values that one call does not change. These are the parameters, the focus\n * and the origin. The levels in a node of the memo start at 1, far below the focus of a function. So a node of the\n * memo holds no column of a call.\n */\n #callScope(c: Code, ctx: Ctx): CallScope | undefined {\n const scope = this.#scopes.at(-1);\n // A part that reads a parameter reads a variable of this function, so its structure gives no column of another function.\n return scope !== undefined && scope.repeats && ctx.level > scope.focus && c.v.deps.has(scope.param) ? scope : undefined;\n }\n\n /** This method tells if an expression calls a function that is at the place of its binding, not at the start of a run. */\n #callsLocal(e: Expr, ctx: Ctx): boolean {\n // Stryker disable next-line ConditionalExpression: a node that is not a call has no field fn, so the map gives undefined\n if (e.tag === \"call\" && ctx.fns.get(e.fn)?.local === true) return true;\n return children(e).some((x) => this.#callsLocal(x, ctx));\n }\n\n /** This method tells if an expression has a node of the memo with keys in it. */\n #keyed(e: Expr): boolean {\n return (this.#memo.get(e)?.length ?? 0) > 0 || children(e).some((x) => this.#keyed(x));\n }\n\n /**\n * This method gives the work of an expression: a node of the memo and a constant of the run are one read each. A call\n * adds the work of the body of its function, because the body evaluates at each call.\n */\n #work(e: Expr, fns: ReadonlyMap<string, BoundFn>): number {\n if (this.#memo.has(e) || this.#constant.has(e)) return 1;\n // Stryker disable next-line ConditionalExpression: a node that is not a call has no field fn, so the map gives undefined\n const body = e.tag === \"call\" ? this.#bodyWork(fns.get(e.fn)) : 0;\n return children(e).reduce((sum, x) => sum + this.#work(x, fns), 1 + body);\n }\n\n /**\n * This method gives the work of the body of a function, once for each function. Thus a chain of calls costs no more\n * than its functions. A body that is a column of the run is one read. A body sees the functions of the place of its\n * binding, and no function calls itself (FN.TOTAL).\n */\n #bodyWork(bound: BoundFn | undefined): number {\n if (bound === undefined) return 0;\n let work = this.#fnWork.get(bound.id);\n if (work === undefined) {\n work = this.#columned.has(bound.fn.body) ? 1 : this.#work(bound.fn.body, bound.ctx.fns);\n this.#fnWork.set(bound.id, work);\n }\n return work;\n }\n\n /** This method gives the read of a column of the run. Two parts with the same structure share one column. */\n #column(e: Expr, c: Code, ctx: Ctx): Code {\n const key = this.#constKey(e, ctx);\n let name = this.#columns.get(key);\n if (name === undefined) {\n name = this.fresh(\"col\");\n // A column of a call is at the start of the body of its function, so each call has its own.\n const scope = this.#callScope(c, ctx);\n (scope?.decls ?? this.run).push(`const ${name} = ${this.use(\"Q\")}((${ctx.focus as string}) => {`, ...ind(c.s), ` return ${c.v.code};`, \"});\");\n this.#columns.set(key, name);\n }\n this.#columned.add(e);\n return bare({ code: `${this.use(\"G\")}(${name}(${ctx.focus as string}))`, kind: c.v.kind, safe: false, deps: c.v.deps, list: c.v.list });\n }\n\n #node(e: Expr, ctx: Ctx): Code {\n switch (e.tag) {\n case \"lit\":\n return bare(literal(e.value));\n case \"ref\":\n return this.#ref(e, ctx);\n case \"var\":\n return bare(this.#var(e.name, ctx));\n case \"let\":\n return this.#let(e, ctx);\n // A function is only a binding of let, so the check of the shape stops this node first.\n // Stryker disable next-line all: see the comment above\n /* v8 ignore next -- @preserve */\n case \"fn\": throw new NotStandalone(\"a function outside the bindings of a let\");\n case \"call\":\n return this.#call(e, ctx);\n case \"rec\": {\n const names = Object.keys(e.fields);\n const raw = Object.values(e.fields).map((x) => this.expr(x, ctx));\n const deps = depsOf(...raw);\n // The interpreter evaluates each field, also after an error.\n const fields = this.#inOrder(this.#settle(raw, deps, Object.values(e.fields)), true);\n // A record of a module is a new object, so it needs no freeze.\n const code = `({ ${fields.map((x, i) => `${names[i] === \"__proto__\" ? '[\"__proto__\"]' : JSON.stringify(names[i])}: ${x.v.code}`).join(\", \")} })`;\n return { s: stmtsOf(...fields), v: { code, kind: undefined, safe: fields.every((x) => x.v.safe), deps } };\n }\n case \"app\":\n return this.#app(e, ctx);\n case \"each\":\n return this.#eachList(e, ctx);\n case \"fold\":\n return this.#fold(e, ctx);\n case \"iterate\":\n return this.#iterate(e, ctx);\n case \"ext\":\n return this.#cell(e, ctx);\n }\n }\n\n /**\n * This method gives the code of a read of a cell in a module of a sheet (COMPILE.MODULE.SHEET). The value is the result\n * of the cell, which can be the error sentinel, so the read throws its error. A read that is not a cell reference, or\n * of a column that the sheet does not have, gives an error, as in `SheetRun`.\n */\n #cell(e: ExprOf<\"ext\">, ctx: Ctx): Code {\n const sheet = this.#sheet;\n if (sheet === undefined || e.kind !== CELL_KIND) throw new NotStandalone(`the extension \"${e.kind}\"`);\n const F = this.use(\"F\");\n if (!isCellRef(e.data)) return bare({ code: `${F}()`, kind: undefined, safe: false, deps: new Set([CELLS]) });\n const { column, at } = e.data;\n const deps = new Set([...this.#addressDeps(at, ctx, []), CELLS]);\n const index = sheet.columns.get(column);\n // The read of a column that the sheet does not have is an error. A kind of the options lets an op take it.\n if (index === undefined) return bare({ code: `${F}()`, kind: sheet.kinds.get(column), safe: false, deps });\n if (!sheet.kinds.has(column)) throw new NotStandalone(`a formula reads the column \"${column}\" before its formula, so the column needs its kind in the option kinds`);\n const read = `${READ_CELL}(${String(index)}, ${this.#address(at, ctx, [])})`;\n const v = { code: `${this.use(\"G\")}(${read})`, kind: sheet.kinds.get(column), safe: false, deps };\n // The read itself gives the result or the error sentinel. A move of the address can throw, so then the read is not\n // a value that holds the sentinel.\n return bare(at.every((m) => m.t === \"origin\") ? { ...v, held: read } : v);\n }\n\n /**\n * This method gives the parts of a node in the order of the interpreter, when a part reads a cell (COMPILE.MODULE.SHEET).\n * A read of a cell can start the search of the run, and the search decides the cycles. So the module must read each\n * cell that the interpreter reads. With `all`, the interpreter evaluates each part also after an error, so each part\n * goes into a variable that can hold the error. Else the first error stops the parts, so each part goes into a\n * variable before the next part starts.\n *\n * The statements of the parts come before the code of their values. The last part that reads a cell keeps its place\n * only if no statement after it can throw. Also, with `all`, a value before it must not throw, or the code of its value\n * must read no cell.\n */\n #inOrder(parts: readonly Code[], all: boolean): readonly Code[] {\n const last = parts.findLastIndex((x) => x.v.deps.has(CELLS));\n const after = parts.slice(last + 1).every((x) => x.s.length === 0 || x.v.safe);\n const before = !all || parts.slice(0, Math.max(last, 0)).every((x) => x.v.safe) || !READS_IN_CODE.test((parts[last] as Code).v.code);\n return parts.map((x, i) => {\n // A part after the last read of a cell cannot stop a read. A part that cannot throw and reads no cell cannot either.\n if (i > last || (x.v.safe && !x.v.deps.has(CELLS)) || (i === last && after && before)) return x;\n const b = this.fresh(\"b\");\n if (all && !x.v.safe) return { s: this.#store(b, x), v: { ...x.v, code: `${this.use(\"G\")}(${b})`, held: b, plain: false } };\n return { s: [...x.s, `const ${b} = ${x.v.code};`], v: { kind: x.v.kind, deps: x.v.deps, list: x.v.list, code: b, safe: true, plain: true } };\n });\n }\n\n /**\n * This method gives the code of the index of an address from the focus. `values` has the code of the value of each\n * computed move, in order (NAV.COMPUTED).\n */\n #address(at: readonly Move[], ctx: Ctx, values: readonly Code[]): string {\n let index = ctx.focus;\n let next = 0;\n // A move that can fail keeps its check when a later fixed key, index or origin replaces its index (V-052). The focus\n // and the origin cannot fail, and the code of a move from an index has the code of that index in it. In a tree,\n // the move parent is a move from an index.\n let fails = false;\n const checks: string[] = [];\n for (const m of at) {\n if (fails && index !== undefined && m.t !== \"offset\" && m.t !== \"other\" && (m.t !== \"parent\" || !this.#tree)) checks.push(index);\n index = moveExpr(m) === undefined ? this.#move(m, index, ctx.origin) : this.#computed(m, values[next++] as Code);\n fails = m.t !== \"origin\";\n }\n // A node of the memo reads neither its origin nor its focus (memo.ts), so the guards of this method do not fail.\n // Stryker disable next-line ConditionalExpression,StringLiteral: see the comment above\n /* v8 ignore next -- @preserve */\n if (index === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n return checks.length === 0 ? index : `(${[...checks, index].join(\", \")})`;\n }\n\n /** This method gives the code of the index of a computed move, from the code of its value. */\n #computed(m: Move, value: Code): string {\n return `${this.use(m.t === \"key\" ? \"K\" : \"I\")}(${value.v.code}, n)`;\n }\n\n #move(m: Move, focus: string | undefined, origin: string | undefined): string {\n const F = this.use(\"F\");\n switch (m.t) {\n case \"origin\":\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (origin === undefined) throw new NotStandalone(\"a node of the memo reads its origin\");\n return origin;\n case \"key\":\n // A key of an array space is the text of its index.\n return typeof m.key === \"string\" && /^(0|[1-9]\\d*)$/.test(m.key) ? `(${m.key} < n ? ${m.key} : ${F}())` : `${F}()`;\n case \"index\":\n return typeof m.i === \"number\" && Number.isInteger(m.i) && m.i >= 0 ? `(${m.i} < n ? ${m.i} : ${F}())` : `${F}()`;\n case \"offset\": {\n const [d, ...more] = m.d;\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (focus === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n if (d === undefined || more.length > 0 || !Number.isInteger(d)) return `${F}()`;\n // In a tree space, an offset goes among the siblings (NAV.OFFSET.TREE).\n if (this.#tree) return `${this.use(\"SO\")}(${this.#part(\"siblings\", \"GP\")}, SI, ${focus}, ${d})`;\n return `${this.use(\"X\")}(${focus} + ${d}, n)`;\n }\n case \"other\":\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (focus === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n return `(n === 2 ? 1 - ${focus} : ${F}())`;\n case \"parent\":\n // Only a tree space has parents (NAV.PARENT).\n if (!this.#tree) return `${F}()`;\n // Stryker disable next-line ConditionalExpression,StringLiteral: see #address\n /* v8 ignore next -- @preserve */\n if (focus === undefined) throw new NotStandalone(\"a node of the memo reads its focus\");\n return `${this.use(\"UP\")}(P, ${focus})`;\n }\n }\n\n #ref(e: ExprOf<\"ref\">, ctx: Ctx): Code {\n const [field, ...more] = e.path;\n const kind = field === undefined ? undefined : this.#schema.fields?.[field];\n if (field === undefined || more.length > 0 || !isFieldName(field) || kind === undefined) throw new NotStandalone(`a read of a field that is not in the schema: \"${e.path.join(\".\")}\"`);\n // A move to the origin cannot fail, and the schema has the field in each record.\n const at = e.at ?? [];\n const safe = at.every((m) => m.t === \"origin\");\n const values = this.#addressValues(at, ctx);\n const deps = this.#addressDeps(at, ctx, values);\n // The interpreter evaluates the expressions of the address before its moves, and the first error stops them.\n const parts = this.#inOrder(this.#settle(values, deps), false);\n return { s: stmtsOf(...parts), v: { code: `R[${this.#address(at, ctx, parts)}][${JSON.stringify(field)}]`, kind, safe, deps } };\n }\n\n /** This method gives the code of the expressions of the computed moves of an address. They evaluate at the node. */\n #addressValues(at: readonly Move[], ctx: Ctx): readonly Code[] {\n return addrExprs(at).map((x) => this.expr(x, ctx));\n }\n\n /**\n * This method gives the levels of the key of an address. The focus and the origin have their level, and a fixed key\n * has no level. A computed move has the levels of its value.\n */\n #addressDeps(at: readonly Move[], ctx: Ctx, values: readonly Code[]): ReadonlySet<number> {\n let deps: ReadonlySet<number> = new Set([ctx.level]);\n let next = 0;\n // A move that can fail keeps the levels of its index when a later move replaces the index (V-052). An offset and\n // other keep the index, so their levels stay.\n let fails = false;\n const kept = new Set<number>();\n for (const m of at) {\n if (fails) for (const d of deps) kept.add(d);\n if (moveExpr(m) !== undefined) deps = (values[next++] as Code).v.deps;\n else if (m.t === \"origin\") deps = new Set([ctx.originLevel]);\n // The parent of a key of a tree depends on the key. Outside a tree, the move fails at each key.\n else if (m.t === \"key\" || m.t === \"index\" || (m.t === \"parent\" && !this.#tree)) deps = NO_DEPS;\n fails = m.t !== \"origin\";\n }\n return new Set([...deps, ...kept]);\n }\n\n #var(name: string, ctx: Ctx): Value {\n const bound = ctx.env.get(name);\n if (bound !== undefined) return this.#read(bound);\n // A name of a loop hides a function with its name, so this check comes after the names of the scope.\n if (ctx.fns.has(name)) throw new NotStandalone(`the name \"${name}\" is a function, not a value`);\n const kind = this.#schema.vars?.[name];\n if (kind === undefined) throw new NotStandalone(`a variable that is not in the schema: \"${name}\"`);\n let code = this.vars.get(name);\n if (code === undefined) {\n code = `v${this.vars.size}`;\n this.vars.set(name, code);\n }\n return plainValue(code, kind);\n }\n\n /**\n * A binding is a variable. A binding with an error is an error only where the body reads its name, so the variable\n * can hold the sentinel. A binding that is a constant of the run is the variable of that constant.\n */\n #let(e: ExprOf<\"let\">, ctx: Ctx): Code {\n const env = new Map(ctx.env);\n const fns = new Map(ctx.fns);\n const s: string[] = [];\n let deps = new Set<number>();\n const bound: BoundFn[] = [];\n // The bindings of a let at the root of the body of a function are at the start of the body, so a column of the\n // call can read them. A let at the root that is a node of the memo binds variables of its function of the memo, but\n // the memo holds no column of a call (`#callScope`), so these names have no reader.\n const scope = this.#scopes.at(-1);\n const root = scope !== undefined && scope.root === e ? scope : undefined;\n for (const [name, x] of Object.entries(e.bind)) {\n // A binding sees the context of the let, so a function cannot call itself.\n if (x.tag === \"fn\") {\n // Stryker disable next-line UpdateOperator: the numbers of the bindings only need to be distinct\n const b: BoundFn = { id: this.#fnIds++, fn: x, ctx, specs: new Map(), decls: [], local: false };\n bound.push(b);\n fns.set(name, b);\n env.delete(name);\n continue;\n }\n // A binding takes a list (LIST.VALUE). A value hides a function of its name, because a read looks at the values first.\n this.#wantList.add(x);\n const c = this.#hoist(this.expr(x, ctx), hasLoop(x));\n if (c.v.deps.size === 0) {\n env.set(name, this.#nameOf(c.v));\n continue;\n }\n const b = this.fresh(\"b\");\n s.push(...this.#store(b, c));\n env.set(name, { code: b, kind: c.v.kind, lazy: !c.v.safe, deps: c.v.deps, list: c.v.list });\n root?.names.add(b);\n // The statements of the binding read its keys, so the let is not a constant of the run.\n deps = new Set([...deps, ...c.v.deps]);\n }\n if (root !== undefined) root.root = e.body;\n const body = this.expr(e.body, { ...ctx, env, fns });\n // A function that reads names of the place of the binding comes after them, before the body.\n return { s: [...s, ...bound.flatMap((b) => b.decls), ...body.s], v: { ...body.v, deps: new Set([...deps, ...body.v.deps]) } };\n }\n\n /**\n * This method prints a call (FN.CALL). Each argument evaluates at the place of the call, as a binding of a let. The\n * call goes to the printed function of the signature of its arguments, with the focus and the origin if it reads them.\n */\n #call(e: ExprOf<\"call\">, ctx: Ctx): Code {\n const bound = ctx.env.has(e.fn) ? undefined : ctx.fns.get(e.fn);\n if (bound === undefined) throw new NotStandalone(`a call of \"${e.fn}\", which is not a function`);\n if (bound.fn.params.length !== e.args.length) throw new NotStandalone(`a call of \"${e.fn}\" with ${String(e.args.length)} arguments, not ${String(bound.fn.params.length)}`);\n const s: string[] = [];\n const args = e.args.map((x): Arg => {\n const c = this.#hoist(this.expr(x, ctx), hasLoop(x));\n // A value that cannot throw is the argument itself. A read of a name that can hold the error passes the name.\n if (c.v.safe) {\n s.push(...c.s);\n return { code: c.v.code, kind: c.v.kind, deps: c.v.deps };\n }\n // Stryker disable next-line ConditionalExpression: the statements with a read of a name bind other names and do not throw, so the read alone has the same value\n if (c.s.length === 0 && c.v.held !== undefined) return { code: c.v.held, kind: c.v.kind, deps: c.v.deps };\n const b = this.fresh(\"b\");\n s.push(...this.#store(b, c));\n return { code: b, kind: c.v.kind, deps: c.v.deps };\n });\n // Each parameter can hold the error of its argument, so one function serves the arguments of one kind.\n const sig = JSON.stringify(args.map((a) => a.kind ?? null));\n const spec = bound.specs.get(sig) ?? this.#printFn(bound, args, sig);\n // Each marker becomes the levels at the call. The levels of the arguments count for each call, because their\n // statements read their keys, so the marker of the parameters gives no level.\n const levels = (d: number): readonly number[] => (d === spec.origin ? [ctx.originLevel] : d === spec.focus ? [ctx.level] : d === spec.param ? [] : [d]);\n const deps = new Set([...args.flatMap((a) => [...a.deps]), ...[...spec.deps].flatMap(levels)]);\n const position = spec.deps.has(spec.origin) ? [ctx.focus, ctx.origin] : spec.deps.has(spec.focus) ? [ctx.focus] : [];\n return { s, v: { code: `${spec.name}(${[...args.map((a) => a.code), ...position].join(\", \")})`, kind: spec.kind, safe: spec.safe, deps } };\n }\n\n /**\n * This method prints a bound function for one signature of its arguments, as one JavaScript function. Its parameters\n * are the arguments, then the focus and the origin, if the body reads them. A function that reads a name of the place\n * of its binding is at that place. Each other function is at the start of a run, so a constant of the run can call it.\n */\n #printFn(bound: BoundFn, args: readonly Arg[], sig: string): Spec {\n // The markers are far from the levels of the axes and of the loops, so they do not meet them. They only need to be\n // distinct.\n // Stryker disable next-line ArithmeticOperator,UpdateOperator: see the comment above\n const origin = 2_000_000 + 1000 * this.#printed++;\n const focus = origin + 1;\n const param = -origin;\n const names = args.map(() => this.fresh(\"p\"));\n const k = this.fresh(\"k\");\n const o = this.fresh(\"o\");\n const env = new Map(bound.ctx.env);\n // A parameter hides a function of its name, because a read looks at the values first.\n bound.fn.params.forEach((p, i) => env.set(p, { code: names[i] as string, kind: (args[i] as Arg).kind, lazy: true, deps: new Set([param]) }));\n const scope: CallScope = { param, focus, repeats: nestsLoops(bound.fn.body), names: new Set(names), decls: [], root: bound.fn.body };\n this.#scopes.push(scope);\n const body = this.expr(bound.fn.body, { origin: o, focus: k, level: focus, originLevel: origin, env, fns: bound.ctx.fns, keys: new Map() });\n this.#scopes.pop();\n const markers = new Set([origin, focus, param]);\n const global = [...body.v.deps].every((d) => markers.has(d));\n const name = this.fresh(\"fn\");\n if (hasLoop(bound.fn.body) || this.#defers(body)) this.#deferred.add(name);\n const position = body.v.deps.has(origin) ? [k, o] : body.v.deps.has(focus) ? [k] : [];\n const head = `const ${name} = (${[...names, ...position].join(\", \")}) =>`;\n // The columns of the call come first. Each one reads a binding of the root only after the binding has its value.\n const s = [...scope.decls, ...body.s];\n const decl = s.length === 0 ? [`${head} ${body.v.code};`] : [`${head} {`, ...ind(s), ` return ${body.v.code};`, \"};\"];\n (global ? this.run : bound.decls).push(...decl);\n if (!global) bound.local = true;\n const spec: Spec = { name, kind: body.v.kind, safe: body.v.safe, deps: body.v.deps, origin, focus, param, global };\n bound.specs.set(sig, spec);\n return spec;\n }\n\n #boolean(v: Value): string {\n return v.kind === \"boolean\" ? v.code : `${this.use(\"B\")}(${v.code})`;\n }\n\n /** A condition is safe when it is a safe boolean. */\n #safeBoolean(v: Value): boolean {\n return v.safe && v.kind === \"boolean\";\n }\n\n #app(e: ExprOf<\"app\">, ctx: Ctx): Code {\n const { op, args } = e;\n if (op === \"if\") return this.#if(args, ctx);\n if (op === \"and\" || op === \"or\") return this.#andOr(op === \"and\", args, ctx);\n if (op === \"ifError\") return this.#ifError(args, ctx);\n const [head] = args;\n if (LIST_OPS.has(op) && head?.tag === \"each\") return this.#list(op, head, args.slice(1), ctx);\n if (head !== undefined && (op === \"sortBy\" || op === \"take\")) return this.#order(op, head, args.slice(1), ctx);\n // LIST.BUILD and LIST.GET: a module does not have the ops that build a list, or get, yet. The interpreter evaluates them.\n if (head !== undefined && BUILD_OPS.has(op) && this.#isList(head, ctx)) throw new NotStandalone(`the list op \"${op}\" is not in a module yet`);\n if (head !== undefined && (LIST_OPS.has(op) || op === \"nth\") && this.#isList(head, ctx)) return this.#overList(op, head, args.slice(1), ctx);\n const raw = args.map((x) => this.expr(x, ctx));\n const deps = depsOf(...raw);\n // The interpreter evaluates each argument, also after an error.\n const values = this.#inOrder(this.#settle(raw, deps, args), true);\n const site = this.#facts.staticSite(op, values.map((x) => x.v.kind));\n if (site?.t !== \"fn\") throw new NotStandalone(`the kinds of the values of \"${op}\" do not decide its op`);\n if (site.bad) return { s: stmtsOf(...values), v: { code: `${this.use(\"F\")}()`, kind: site.returns, safe: false, deps } };\n if (site.returns === undefined) throw new NotStandalone(`the op \"${op}\" does not declare the kind of its result`);\n const d = this.#domains[site.domain] as AnyDomain;\n const name = `op_${site.domain}_${this.#opIndex(op)}`;\n // Stryker disable next-line ConditionalExpression: the form of an op is always the same, so the map only saves time\n if (!this.#forms.has(name)) {\n // A static site of a domain has the function of the op of that domain.\n const fn = (d.ops[op] as { fn: (...a: never[]) => unknown }).fn;\n const kinds = values.map((x) => x.v.kind).filter((k): k is Kind => k !== undefined);\n const src = copied(fn, kinds.map((k) => this.#samples(k)), `the op \"${op}\" of the domain ${d.name}`);\n // An inline form cannot throw for primitive values only.\n this.#forms.set(name, kinds.every((k) => primitiveOf(k) !== undefined) ? inlineForm(src) : undefined);\n this.top.set(name, `const ${name} = ${src};`);\n }\n const form = this.#forms.get(name);\n // An inline form takes each argument once, or a plain argument more often, so each argument evaluates once.\n const inline = form !== undefined && form.params.length === values.length && values.every((x, i) => form.uses[i] === 1 || (x.v.plain === true && x.v.safe && (form.uses[i] as number) > 0));\n if (inline) {\n const text = form.parts.map((x) => (typeof x === \"number\" ? `(${(values[x] as Code).v.code})` : x)).join(\"\");\n const checked = this.check(site.returns);\n const code = checked === undefined ? `(${text})` : `${checked}(${text})`;\n return { s: stmtsOf(...values), v: { code, kind: site.returns, safe: checked === undefined && values.every((x) => x.v.safe), deps } };\n }\n this.#called.add(name);\n // An exception of the op is an error of Vex: the boundary around the op catches it.\n const code = this.#checked(site.returns, `${name}(${values.map((x) => x.v.code).join(\", \")})`);\n return { s: stmtsOf(...values), v: { code, kind: site.returns, safe: false, deps } };\n }\n\n /** The condition must be a boolean. Only the branch that the condition selects is evaluated. */\n #if(args: readonly Expr[], ctx: Ctx): Code {\n if (args.length !== 3) throw new NotStandalone(\"an if without three arguments\");\n const [c, a, b] = args as [Expr, Expr, Expr];\n const raw = [this.expr(c, ctx), this.expr(a, ctx), this.expr(b, ctx)];\n const deps = depsOf(...raw);\n const [cond, yes, no] = this.#settle(raw, deps, [c, a, b]) as [Code, Code, Code];\n const v = { kind: join(yes.v.kind, no.v.kind), safe: this.#safeBoolean(cond.v) && yes.v.safe && no.v.safe, deps };\n if (yes.s.length === 0 && no.s.length === 0) return { s: cond.s, v: { ...v, code: `(${this.#boolean(cond.v)} ? ${yes.v.code} : ${no.v.code})` } };\n const t = this.fresh(\"t\");\n const s = [...cond.s, `let ${t};`, `if (${this.#boolean(cond.v)}) {`, ...ind(yes.s), ` ${t} = ${yes.v.code};`, \"} else {\", ...ind(no.s), ` ${t} = ${no.v.code};`, \"}\"];\n return { s, v: { ...v, code: t } };\n }\n\n /** `and` stops at the first `false`, and `or` at the first `true`. Each argument before the stop must be a boolean. */\n #andOr(and: boolean, args: readonly Expr[], ctx: Ctx): Code {\n if (args.length === 0) throw new NotStandalone(`an ${and ? \"and\" : \"or\"} without arguments`);\n const raw = args.map((x) => this.expr(x, ctx));\n const deps = depsOf(...raw);\n const parts = this.#settle(raw, deps, args);\n const v = { kind: \"boolean\" as const, safe: parts.every((x) => this.#safeBoolean(x.v)), deps };\n const [first, ...rest] = parts as [Code, ...Code[]];\n if (rest.every((x) => x.s.length === 0)) return { s: first.s, v: { ...v, code: `(${parts.map((x) => this.#boolean(x.v)).join(and ? \" && \" : \" || \")})` } };\n const t = this.fresh(\"t\");\n const s = [...first.s, `let ${t} = ${this.#boolean(first.v)};`];\n for (const x of rest) s.push(`if (${and ? \"\" : \"!\"}${t}) {`, ...ind(x.s), ` ${t} = ${this.#boolean(x.v)};`, \"}\");\n return { s, v: { ...v, code: t } };\n }\n\n /** The value of the first argument, or else the value of the second argument. */\n #ifError(args: readonly Expr[], ctx: Ctx): Code {\n if (args.length !== 2) throw new NotStandalone(\"an ifError without two arguments\");\n const [a, b] = args as [Expr, Expr];\n const raw = [this.expr(a, ctx), this.expr(b, ctx)];\n const deps = depsOf(...raw);\n const [first, second] = this.#settle(raw, deps, [a, b]) as [Code, Code];\n if (first.v.safe) return first;\n const t = this.fresh(\"t\");\n const s = [`let ${t};`, \"try {\", ...ind(first.s), ` ${t} = ${first.v.code};`, \"} catch {\", ...ind(second.s), ` ${t} = ${second.v.code};`, \"}\"];\n return { s, v: { code: t, kind: join(first.v.kind, second.v.kind), safe: second.v.safe, deps } };\n }\n\n #opIndex(op: string): number {\n let i = this.#ops.get(op);\n if (i === undefined) {\n i = this.#ops.size;\n this.#ops.set(op, i);\n }\n return i;\n }\n\n /**\n * This method gives the option strict of a list op. The options must be one literal with only strict. Only a literal\n * has a value, so another expression gives the reason too.\n */\n #strict(op: string, rest: readonly Expr[]): boolean {\n const [options, ...more] = rest;\n if (more.length > 0) throw new NotStandalone(`\"${op}\" with more than one option`);\n if (options === undefined) return false;\n const opts = (options as { readonly value?: unknown }).value;\n if (typeof opts !== \"object\" || opts === null || Object.keys(opts).some((k) => k !== \"strict\")) throw new NotStandalone(`the options of \"${op}\" are not a literal with strict`);\n return (opts as { readonly strict?: unknown }).strict === true;\n }\n\n /**\n * A list op over an axis: one `for` loop with a running value. An item with an error is skipped, and with `strict` it\n * is an error of the list op. A value of the wrong kind is an error of the list op, as in the interpreter.\n */\n /**\n * This method gives the loop over the targets of an axis: the statements before it, its bounds and the key that it\n * skips. `start` has the levels of the address, and `inner` is the position at a target. The axes all, others,\n * window and list have a loop. In a tree space, the axes of a tree have a loop too.\n */\n #targetLoop(axis: Axis, at: readonly Move[], ctx: Ctx): {\n readonly s: string[];\n readonly j: string;\n /** The head of the loop, and the statements at the start of each item before the try and inside it. */\n readonly head: string;\n readonly key: readonly string[];\n readonly check: readonly string[];\n readonly skip: string | undefined;\n readonly fixed: boolean;\n readonly start: ReadonlySet<number>;\n /** True when the statements before the loop cannot throw. */\n readonly startSafe: boolean;\n readonly tests: readonly Expr[];\n readonly inner: Ctx;\n } {\n const { base: outer, tests } = testsOf(axis);\n // The reverse order of an axis is a loop from its end (AXIS.REVERSE). The validation keeps a base axis inside.\n const reverse = outer.t === \"reverse\";\n const base = outer.t === \"reverse\" ? outer.axis : outer;\n const j = this.fresh(\"j\");\n const inner: Ctx = { ...ctx, focus: j, level: ctx.level + 1 };\n // The axis list goes over the array of its list (AXIS.LIST). The list evaluates at the node, before the loop, and an\n // error item is an item that fails.\n if (base.t === \"list\") {\n if (at.length > 0) throw new NotStandalone('the axis \"list\" with an address');\n const list = this.#hoist(this.#listOf(base.list, ctx), hasLoop(base.list));\n const a = this.fresh(\"A\");\n const q = this.fresh(\"q\");\n const head = reverse ? `for (let ${q} = ${a}.length - 1; ${q} >= 0; ${q}--) {` : `for (let ${q} = 0; ${q} < ${a}.length; ${q}++) {`;\n const key = [`const ${j} = ${a}[${q}][0];`];\n const check = [`if (${a}[${q}][1] === E) ${this.use(\"F\")}();`];\n return { s: [...list.s, `const ${a} = ${list.v.code};`], j, head, key, check, skip: undefined, fixed: false, start: list.v.deps, startSafe: list.v.safe, tests, inner };\n }\n const s: string[] = [];\n let lo = \"0\";\n let hi = \"n\";\n let skip: string | undefined;\n // The targets of the axis all depend on no key, but its address can fail (V-051). The other axes start at their\n // address.\n let start: ReadonlySet<number> = NO_DEPS;\n const f = base.t === \"all\" && at.length === 0 ? undefined : this.fresh(\"f\");\n if (f !== undefined) {\n const values = this.#addressValues(at, ctx);\n start = this.#addressDeps(at, ctx, values);\n const parts = this.#inOrder(this.#settle(values, start), false);\n s.push(...stmtsOf(...parts), `const ${f} = ${this.#address(at, ctx, parts)};`);\n }\n const startSafe = at.every((m) => m.t === \"origin\");\n if (base.t === \"window\" && (!Number.isInteger(base.from) || !Number.isInteger(base.to))) throw new NotStandalone('the axis \"window\" with a bound that is not an integer');\n // In a tree space, the targets of a tree axis and of a window are a range of an array of positions.\n if (this.#tree && isTreeAxis(base)) {\n const range = this.#treeRange(base, f as string);\n const q = this.fresh(\"q\");\n return { s: [...s, ...range.s], j, head: forHead(q, range.lo, range.hi, reverse), key: [`const ${j} = ${range.a}[${q}];`], check: [], skip: range.skip, fixed: false, start, startSafe, tests, inner };\n }\n if (base.t === \"others\") skip = f;\n else if (base.t === \"window\") {\n const h = this.fresh(\"h\");\n lo = `Math.max(0, ${f as string} + Math.max(${base.from}, -n))`;\n s.push(`const ${h} = Math.min(n, ${f as string} + Math.min(${base.to}, n) + 1);`);\n hi = h;\n } else if (base.t !== \"all\") throw new NotStandalone(`the axis \"${base.t}\"`);\n return { s, j, head: forHead(j, lo, hi, reverse), key: [], check: [], skip, fixed: f === undefined, start, startSafe, tests, inner };\n }\n\n /**\n * This method gives the targets of an axis of a tree space at the position `f`. They are the positions `a[q]` for `q`\n * from `lo` up to `hi`, without the key that the loop skips. The axes come from AXIS.TREE, AXIS.GRAPH and AXIS.WINDOW.\n */\n #treeRange(base: TreeAxis, f: string): TreeRange {\n const a = this.fresh(\"A\");\n const all = (code: string, lo = \"0\", skip?: string): TreeRange => ({ s: [`const ${a} = ${code};`], a, lo, hi: `${a}.length`, skip });\n switch (base.t) {\n // In a tree, the edges go from a parent to its children.\n case \"children\":\n case \"successors\":\n return all(`${this.#part(\"children\", \"H\")}[${f}]`);\n case \"siblings\":\n return all(`${this.#part(\"siblings\", \"GP\")}[${f}]`, \"0\", f);\n case \"ancestors\":\n return all(`${this.use(\"AN\")}(P, ${f})`);\n case \"predecessors\":\n return all(`(P[${f}] < 0 ? [] : [P[${f}]])`);\n case \"reachable\":\n // The first key of the search is the focus, which is not a target.\n return all(`${this.use(\"BF\")}(${this.#part(\"children\", \"H\")}, ${f})`, \"1\");\n case \"descendants\": {\n // The descendants of a key are the keys after it in the order depth first, as many as its subtree has under it.\n const h = this.fresh(\"h\");\n return { s: [`const ${a} = ${this.#part(\"order\", \"PI\")}[${f}] + 1;`, `const ${h} = ${a} + SZ[${f}] - 1;`], a: \"PO\", lo: a, hi: h, skip: undefined };\n }\n case \"window\": {\n // The offsets among the siblings, from `from` to `to`. The bounds are integers (#targetLoop).\n const { from, to } = base;\n const l = this.fresh(\"h\");\n const h = this.fresh(\"h\");\n const s = [`const ${a} = ${this.#part(\"siblings\", \"GP\")}[${f}];`, `const ${l} = Math.max(0, SI[${f}] + ${String(from)});`, `const ${h} = Math.min(${a}.length, SI[${f}] + ${String(to)} + 1);`];\n return { s, a, lo: l, hi: h, skip: undefined };\n }\n }\n }\n\n #list(op: string, target: ExprOf<\"each\">, rest: readonly Expr[], ctx: Ctx): Code {\n const strict = this.#strict(op, rest);\n const at = target.at ?? [];\n const { s, j, head, key, check, skip, fixed, start, startSafe, tests, inner } = this.#targetLoop(target.axis, at, ctx);\n const { level } = inner;\n // Inside the loop, a constant of the run evaluates once, before the loop over the keys of the run.\n const testCodes = tests.map((t) => this.#hoist(this.expr(t, inner), hasLoop(t)));\n const body = this.#hoist(this.expr(target.body, inner), hasLoop(target.body));\n // A count of all the items, whose body cannot fail, is the count of the records. A safe body covers its statements.\n // V-063: a body that reads a cell keeps its loop. The search of the run must see each read, so a cell that reads\n // itself gives `#CYCLE!`.\n if (op === \"count\" && fixed && tests.length === 0 && body.v.safe && !body.v.deps.has(CELLS)) return bare(plainValue(\"n\", \"number\"));\n const deps = new Set([...start, ...[body, ...testCodes].flatMap((x) => [...x.v.deps])].filter((d) => d !== level));\n const r = this.#reduction(op, body.v.kind);\n const { v } = r;\n s.push(r.init);\n const item = [...check, ...testCodes.flatMap((t) => [...t.s, `if (!${this.#boolean(t.v)}) continue;`]), ...body.s];\n // An item whose tests and body cannot fail needs no try.\n const safeItem = check.length === 0 && body.v.safe && testCodes.every((t) => this.#safeBoolean(t.v));\n // The interpreter evaluates each item before the list op (COMPILE.MODULE.SHEET). When an item reads a cell, an error\n // of an item or of a step must not stop the reads of the next items. So the items go into an array first.\n if ([body, ...testCodes].some((x) => x.v.deps.has(CELLS)) && (strict || stepThrows(op, body.v.kind))) {\n const list = this.fresh(\"L\");\n const x = this.fresh(\"x\");\n const all = [...key, ...(skip === undefined ? [] : [`if (${j} === ${skip}) continue;`]), `let ${x};`, \"try {\", ...ind(item), ` ${x} = ${body.v.code};`, \"} catch {\", ` ${x} = E;`, \"}\", `${list}.push(${x});`];\n const reduce = [`for (const ${v} of ${list}) {`, ` if (${v} === E) ${strict ? `${this.use(\"F\")}();` : \"continue;\"}`, ` ${r.step}`, \"}\"];\n return { s: [...s, `const ${list} = [];`, head, ...ind(all), \"}\", ...reduce], v: { code: r.result, kind: listKind(op, body.v.kind), safe: false, deps } };\n }\n const loop = [\n ...key,\n ...(skip === undefined ? [] : [`if (${j} === ${skip}) continue;`]),\n ...(safeItem\n ? [...item, `const ${v} = ${body.v.code};`]\n : [`let ${v};`, \"try {\", ...ind(item), ` ${v} = ${body.v.code};`, \"} catch {\", strict ? ` ${this.use(\"F\")}();` : \" continue;\", \"}\"]),\n r.step,\n ];\n s.push(head, ...ind(loop), \"}\");\n // A count without strict, and any, all and none over booleans without strict, cannot fail. The address of the axis\n // can fail, except at the focus or at the origin.\n const safe = startSafe && !strict && (op === \"count\" || (BOOLEAN_LIST_OPS.has(op) && body.v.kind === \"boolean\"));\n return { s, v: { code: r.result, kind: listKind(op, body.v.kind), safe, deps } };\n }\n\n /**\n * This method gives the parts of a list op that reduces the values of its items. The parts are the variable `v` of\n * the value of an item, the first statement, the step and the result. A value of the wrong kind is an error of the op.\n */\n #reduction(op: string, kind: Kind | undefined): { readonly v: string; readonly init: string; readonly step: string; readonly result: string } {\n const a = this.fresh(\"a\");\n const n = this.fresh(\"n\");\n const v = this.fresh(\"x\");\n const num = kind === \"number\" ? v : `${this.use(\"U\")}(${v})`;\n const bool = kind === \"boolean\" ? v : `${this.use(\"B\")}(${v})`;\n const inits: Readonly<Record<string, string>> = {\n count: `let ${n} = 0;`,\n sum: `let ${a} = 0;`,\n mean: `let ${a} = 0, ${n} = 0;`,\n any: `let ${a} = false;`,\n none: `let ${a} = false;`,\n all: `let ${a} = true;`,\n };\n const steps: Readonly<Record<string, string>> = {\n count: `${n}++;`,\n sum: `${a} += ${num};`,\n mean: `${a} += ${num}; ${n}++;`,\n min: `${a} = ${n}++ === 0 ? ${num} : Math.min(${a}, ${num});`,\n max: `${a} = ${n}++ === 0 ? ${num} : Math.max(${a}, ${num});`,\n any: `if (${bool}) ${a} = true;`,\n none: `if (${bool}) ${a} = true;`,\n all: `if (!${bool}) ${a} = false;`,\n first: `if (${n}++ === 0) ${a} = ${v};`,\n };\n const F = this.use(\"F\");\n const results: Readonly<Record<string, string>> = {\n count: n,\n sum: this.#checked(\"number\", a),\n mean: `(${n} === 0 ? ${F}() : ${this.#checked(\"number\", `${a} / ${n}`)})`,\n any: a,\n all: a,\n none: `!${a}`,\n };\n return { v, init: inits[op] ?? `let ${a}, ${n} = 0;`, step: steps[op] as string, result: results[op] ?? `(${n} === 0 ? ${F}() : ${a})` };\n }\n\n /**\n * This method prints a list as an array (LIST.VALUE): a pair of the key and the value of each item. A test that\n * fails, a body that fails and an error item of the axis list give the error sentinel as the value.\n */\n #eachList(e: ExprOf<\"each\">, ctx: Ctx): Code {\n const at = e.at ?? [];\n const { s, j, head, key, check, skip, start, startSafe, tests, inner } = this.#targetLoop(e.axis, at, ctx);\n const testCodes = tests.map((t) => this.#hoist(this.expr(t, inner), hasLoop(t)));\n const body = this.#hoist(this.expr(e.body, inner), hasLoop(e.body));\n const deps = new Set([...start, ...[body, ...testCodes].flatMap((x) => [...x.v.deps])].filter((d) => d !== inner.level));\n const list = this.fresh(\"L\");\n const v = this.fresh(\"x\");\n const item = [...check, ...testCodes.flatMap((t) => [...t.s, `if (!${this.#boolean(t.v)}) continue;`]), ...body.s];\n const safeItem = check.length === 0 && body.v.safe && testCodes.every((t) => this.#safeBoolean(t.v));\n const loop = [\n ...key,\n ...(skip === undefined ? [] : [`if (${j} === ${skip}) continue;`]),\n ...(safeItem ? [...item, `${list}.push([${j}, ${body.v.code}]);`] : [`let ${v};`, \"try {\", ...ind(item), ` ${v} = ${body.v.code};`, \"} catch {\", ` ${v} = E;`, \"}\", `${list}.push([${j}, ${v}]);`]),\n ];\n return { s: [...s, `const ${list} = [];`, head, ...ind(loop), \"}\"], v: { code: list, kind: undefined, safe: startSafe, deps, list: { item: body.v.kind } } };\n }\n\n /**\n * This method prints sortBy and take (LIST.SORT, LIST.TAKE): a new array from the array of a list. An error item is\n * not in the new list, and with strict it is the error of the op.\n */\n #order(op: \"sortBy\" | \"take\", head: Expr, rest: readonly Expr[], ctx: Ctx): Code {\n const list = this.#listOf(head, ctx);\n // A missing count is the literal null, which is not a whole number, so take gives its error.\n const exprs = [head, ...(op === \"take\" ? [rest[0] ?? lit(null)] : [])];\n const strict = this.#strict(op, rest.slice(exprs.length - 1));\n const raw = [list, ...exprs.slice(1).map((x) => this.expr(x, ctx))];\n const deps = depsOf(...raw);\n const parts = this.#inOrder(this.#settle(raw, deps, exprs), true);\n const item = (list.v.list as ListInfo).item;\n return { s: stmtsOf(...parts), v: { code: `${this.use(op === \"sortBy\" ? \"SB\" : \"TK\")}(${[...parts.map((x) => x.v.code), String(strict)].join(\", \")})`, kind: undefined, safe: false, deps, list: { item } } };\n }\n\n /** This method prints a list op over a list that is not an each: a loop over its array, and nth (LIST.NTH). */\n #overList(op: string, head: Expr, rest: readonly Expr[], ctx: Ctx): Code {\n const list = this.#listOf(head, ctx);\n // A missing position is the literal null, which is not a whole number, so nth gives its error.\n const exprs = [head, ...(op === \"nth\" ? [rest[0] ?? lit(null)] : [])];\n const strict = this.#strict(op, rest.slice(exprs.length - 1));\n const raw = [list, ...exprs.slice(1).map((x) => this.expr(x, ctx))];\n const deps = depsOf(...raw);\n const parts = this.#inOrder(this.#settle(raw, deps, exprs), true);\n const [l] = parts as [Code];\n const item = (list.v.list as ListInfo).item;\n if (op === \"nth\") return { s: stmtsOf(...parts), v: { code: `${this.use(\"NT\")}(${[...parts.map((x) => x.v.code), String(strict)].join(\", \")})`, kind: item, safe: false, deps } };\n const r = this.#reduction(op, item);\n const { v } = r;\n const s = [...l.s, r.init, `for (const [, ${v}] of ${l.v.code}) {`, ` if (${v} === E) ${strict ? `${this.use(\"F\")}();` : \"continue;\"}`, ` ${r.step}`, \"}\"];\n return { s, v: { code: r.result, kind: listKind(op, item), safe: false, deps } };\n }\n\n /**\n * This method gives the names of a loop (LOOP.NAMES): a variable for each name of `init`, with its first value at the\n * node. Inside the loop, each name has the level `loop`. Thus a part that reads a name stays in the loop. A loop that\n * reads no key of the run is a constant of the run.\n */\n #loopNames(init: Names, ctx: Ctx, loop: number): { readonly s: string[]; readonly env: Map<string, Name>; readonly vars: ReadonlyMap<string, Name>; readonly deps: Set<number> } {\n const s: string[] = [];\n const env = new Map(ctx.env);\n const vars = new Map<string, Name>();\n const deps = new Set<number>();\n for (const [name, x] of Object.entries(init)) {\n const c = this.expr(x, ctx);\n if (c.v.kind === undefined) throw new NotStandalone(`the first value of the name \"${name}\" of a loop has no kind`);\n const v = this.fresh(\"l\");\n s.push(...c.s, `let ${v} = ${c.v.code};`);\n const read: Name = { code: v, kind: c.v.kind, lazy: false, deps: new Set([loop]) };\n env.set(name, read);\n vars.set(name, read);\n for (const d of c.v.deps) deps.add(d);\n }\n return { s, env, vars, deps };\n }\n\n /** This method gives the statements of one step of a loop: each new value first, and then each name gets its value. */\n #loopStep(step: Names, inner: Ctx, vars: ReadonlyMap<string, Name>): { readonly s: string[]; readonly deps: ReadonlySet<number> } {\n const s: string[] = [];\n const sets: string[] = [];\n const deps = new Set<number>();\n for (const [name, x] of Object.entries(step)) {\n const c = this.#hoist(this.expr(x, inner), hasLoop(x));\n const v = vars.get(name) as Name;\n if (c.v.kind !== v.kind) throw new NotStandalone(`a step of a loop changes the kind of the name \"${name}\"`);\n const t = this.fresh(\"t\");\n s.push(...c.s, `const ${t} = ${c.v.code};`);\n sets.push(`${v.code} = ${t};`);\n for (const d of c.v.deps) deps.add(d);\n }\n return { s: [...s, ...sets], deps };\n }\n\n /**\n * An iteration (ITERATE.LIMIT, ITERATE.UNTIL): a `for` loop with a variable for each name. An error of a value, of the\n * test or of the result throws, so it is the value of the iteration.\n */\n #iterate(e: ExprOf<\"iterate\">, ctx: Ctx): Code {\n // Stryker disable next-line UpdateOperator: a level of a loop is a name, so a count down gives other names, and the same code\n const loop = this.#loops++;\n const names = this.#loopNames(e.init, ctx, loop);\n const inner: Ctx = { ...ctx, env: names.env };\n const until = e.until === undefined ? undefined : this.expr(e.until, inner);\n const step = this.#loopStep(e.step, inner, names.vars);\n const result = this.expr(e.result, inner);\n const k = this.fresh(\"k\");\n const body = [\n ...(until === undefined ? [] : [...until.s, `if (${this.#boolean(until.v)}) break;`]),\n `if (${k} === ${String(e.limit)}) ${until === undefined ? \"break;\" : `${this.use(\"F\")}();`}`,\n ...step.s,\n ];\n const inside = [...(until?.v.deps ?? []), ...step.deps, ...result.v.deps].filter((d) => d !== loop);\n const deps = new Set([...names.deps, ...inside]);\n return { s: [...names.s, `for (let ${k} = 0; ; ${k}++) {`, ...ind(body), \"}\", ...result.s], v: { code: result.v.code, kind: result.v.kind, safe: false, deps } };\n }\n\n /**\n * A fold (FOLD.ORDER, FOLD.ERROR): the loop over the targets of an axis, with a variable for each name. The tests read\n * only the names outside the fold. An error throws, so it is the value of the fold.\n */\n #fold(e: ExprOf<\"fold\">, ctx: Ctx): Code {\n // Stryker disable next-line UpdateOperator: a level of a loop is a name, so a count down gives other names, and the same code\n const loop = this.#loops++;\n const names = this.#loopNames(e.init, ctx, loop);\n const t = this.#targetLoop(e.axis, e.at ?? [], ctx);\n const tests = t.tests.map((x) => this.#hoist(this.expr(x, t.inner), hasLoop(x)));\n // The interpreter evaluates the tests at each target before the first step, so a module of a sheet does not have them.\n if (tests.some((x) => x.v.deps.has(CELLS))) throw new NotStandalone(\"a test of the axis of a fold reads a cell\");\n const step = this.#loopStep(e.step, { ...t.inner, env: names.env }, names.vars);\n const result = this.expr(e.result, { ...ctx, env: names.env });\n const body = [\n ...t.key,\n ...(t.skip === undefined ? [] : [`if (${t.j} === ${t.skip}) continue;`]),\n ...t.check,\n ...tests.flatMap((c) => [...c.s, `if (!${this.#boolean(c.v)}) continue;`]),\n ...step.s,\n ];\n const inside = [...tests.flatMap((c) => [...c.v.deps]), ...step.deps].filter((d) => d !== loop && d !== t.inner.level);\n const deps = new Set([...names.deps, ...t.start, ...inside, ...[...result.v.deps].filter((d) => d !== loop)]);\n return { s: [...names.s, ...t.s, t.head, ...ind(body), \"}\", ...result.s], v: { code: result.v.code, kind: result.v.kind, safe: false, deps } };\n }\n\n /**\n * A node of the memo: one function of its keys for each structure, with an entry for each value of the keys. A key\n * that is a constant of the run is the variable of that constant, not a key of the function. A node with no other key\n * is a constant of the run itself.\n */\n #memoized(e: Expr, keys: readonly Expr[], ctx: Ctx): Code {\n const values = keys.map((k) => this.#hoist(this.expr(k, ctx)));\n const varying = keys.filter((_k, i) => (values[i] as Code).v.deps.size > 0);\n const params = varying.map(() => this.fresh(\"q\"));\n const names = new Map(\n keys.map((k, i): [Expr, Name] => {\n const x = (values[i] as Code).v;\n const p = varying.indexOf(k);\n return [k, p < 0 ? this.#nameOf(x) : { code: params[p] as string, kind: x.kind, lazy: true, deps: new Set([1]) }];\n }),\n );\n const outer = this.#inside;\n this.#inside = e;\n const bodyCtx: Ctx = { origin: undefined, focus: undefined, level: 1, originLevel: 1, env: new Map(), fns: new Map(), keys: names };\n if (varying.length === 0) {\n const body = this.#hoist(this.expr(e, bodyCtx));\n this.#inside = outer;\n return body;\n }\n // The kinds of the keys decide the ops in the node, so they are a part of the structure. Each key of the function\n // can hold the error sentinel, so the nodes with a safe key and the nodes without one share it.\n const tokens = new Map(keys.map((k, i): [Expr, object] => [k, varying.includes(k) ? { \"#\": varying.indexOf(k), kind: (values[i] as Code).v.kind } : { \"@\": (names.get(k) as Name).code }]));\n const structure = canonical(e, (x) => tokens.get(x as Expr));\n let fn = this.#structures.get(structure);\n if (fn === undefined) {\n fn = this.fresh(\"m\");\n this.#structures.set(structure, fn);\n this.memos = true;\n const cached = varying.length === 1 ? this.#cached(e, varying[0] as Expr, bodyCtx, fn) : undefined;\n if (cached !== undefined) {\n this.#kinds.set(fn, cached.kind);\n this.run.push(...cached.lines);\n } else {\n // The loop of the node gives statements.\n const body = this.expr(e, bodyCtx);\n this.#kinds.set(fn, body.v.kind);\n this.#lists.set(fn, body.v.list);\n this.run.push(`const ${fn} = ${this.use(params.length === 1 ? \"M1\" : \"M\")}((${params.join(\", \")}) => {`, ...ind(body.s), ` return ${body.v.code};`, \"});\");\n }\n }\n this.#inside = outer;\n // Each key of the function gets its value, or the error sentinel.\n const s: string[] = [];\n const args = varying.map((k) => {\n const c = values[keys.indexOf(k)] as Code;\n if (c.v.safe && c.s.length === 0) return c.v.code;\n if (c.s.length === 0 && c.v.held !== undefined) return c.v.held;\n const t = this.fresh(\"k\");\n s.push(...this.#store(t, c));\n return t;\n });\n return { s, v: { code: `${fn}(${args.join(\", \")})`, kind: this.#kinds.get(fn), safe: false, deps: depsOf(...values), list: this.#lists.get(fn) } };\n }\n\n /**\n * This method gives the code of a node of the memo whose key is only in one test of a list op: `test(T, key)`. Such a\n * node keeps its items in the helper `S`. One pass gives the tests before the test of the key and the value `T` of each\n * item. The rest of an item evaluates once, at the first key whose test is true.\n *\n * With the test `===`, each value `T` has a group of items. With `<` or `<=` and values `T` that do not decrease, the\n * items whose test is true are a prefix. Each prefix keeps its running value. The values add in the order of the items, so the result has the bits of the interpreter. An error before the test\n * of the key is an error of the item at each key. An error after it is an error at the keys whose test is true.\n */\n #cached(e: Expr, key: Expr, bodyCtx: Ctx, fn: string): { readonly lines: readonly string[]; readonly kind: Kind | undefined } | undefined {\n // Only an app has an op, and a node of the memo has a loop, so a list op has its target.\n const { op, args } = e as ExprOf<\"app\">;\n if (!LIST_OPS.has(op)) return undefined;\n const [target, ...rest] = args as [Expr, ...Expr[]];\n if (target.tag !== \"each\" || (target.at ?? []).length > 0) return undefined;\n const strict = this.#strict(op, rest);\n const kind = (bodyCtx.keys.get(key) as Name).kind;\n const { base, tests: raw } = testsOf(target.axis);\n const tests = raw.flatMap(partsOf);\n const at = tests.findIndex((t) => contains(t, key));\n const test = tests[at];\n if (base.t !== \"all\" || test?.tag !== \"app\" || test.args.length !== 2 || contains(target.body, key) || tests.some((t, i) => i !== at && contains(t, key))) return undefined;\n const [l, r] = test.args as [Expr, Expr];\n const keyFirst = l === key;\n const other = keyFirst ? r : l;\n if ((!keyFirst && r !== key) || contains(other, key)) return undefined;\n const j = this.fresh(\"j\");\n const loop: Ctx = { ...bodyCtx, focus: j, level: 2 };\n const t = this.#hoist(this.expr(other, loop));\n // The test of the key is an op whose inline form cannot fail: then the loop over the items needs no try.\n const site = this.#facts.staticSite(test.op, keyFirst ? [kind, t.v.kind] : [t.v.kind, kind]);\n if (site?.t !== \"fn\" || site.bad || site.returns !== \"boolean\" || this.check(\"boolean\") !== undefined) return undefined;\n // A static site of a domain has the function of the op of that domain.\n const form = inlineForm(Function.prototype.toString.call(((this.#domains[site.domain] as AnyDomain).ops[test.op] as { fn: (...a: never[]) => unknown }).fn));\n if (form?.params.length !== 2) return undefined;\n const before = tests.slice(0, at).map((x) => this.#hoist(this.expr(x, loop)));\n const after = tests.slice(at + 1).map((x) => this.#hoist(this.expr(x, loop)));\n const body = this.#hoist(this.expr(target.body, loop));\n const B = (v: Value): string => this.#boolean(v);\n // The kind of the test of the key: `===` gives the groups of equal values, and `<` or `<=` from T to the key gives\n // the prefixes of the items when T does not decrease. NaN satisfies neither test, so its item is in no group.\n const pattern = patternOf(form, (p) => (keyFirst ? 1 - p : p));\n const mode = pattern === \"#0===#1\" || pattern === \"#1===#0\" ? 1 : [\"#0<#1\", \"#0<=#1\", \"#1>#0\", \"#1>=#0\"].includes(pattern) ? 2 : 0;\n const testArgs = keyFirst ? [\"q\", \"t\"] : [\"t\", \"q\"];\n const keyTest = form.parts.map((p) => (typeof p === \"number\" ? `(${testArgs[p] as string})` : p)).join(\"\");\n if (mode === 1) this.features.add(\"group\");\n if (mode === 2) this.features.add(\"prefix\");\n if (strict) this.features.add(\"strict\");\n const F = this.use(\"F\");\n // A function of the index of an item, from its statements and its value.\n const arrow = (lines: readonly string[], code: string): readonly string[] => (lines.length === 0 ? [`(${j}) => ${code}`] : [`(${j}) => {`, ...ind(lines), ` return ${code};`, \"}\"]);\n const pre = before.length === 0 ? undefined : before.every((x) => x.s.length === 0) ? arrow([], before.map((x) => B(x.v)).join(\" && \")) : arrow(before.flatMap((x, i) => [...x.s, ...(i < before.length - 1 ? [`if (!${B(x.v)}) return false;`] : [])]), B((before.at(-1) as Code).v));\n // The value of an item: the tests after the test of the key, and the body. N is an item that a later test excludes,\n // and E is an error.\n const value =\n after.length === 0 && body.v.safe && body.s.length === 0\n ? arrow([], body.v.code)\n : [`(${j}) => {`, \" try {\", ...ind(ind([...after.flatMap((x) => [...x.s, `if (!${B(x.v)}) return N;`]), ...body.s])), ` return ${body.v.code};`, \" } catch {\", \" return E;\", \" }\", \"}\"];\n const [stepName, stepCode] = STEPS[op] as readonly [string, string];\n this.top.set(stepName, `const ${stepName} = ${stepCode};`);\n // A sum has the check of a number, and only a sum or a mean needs that check.\n const results: Readonly<Record<string, () => readonly [string, string]>> = {\n count: () => [\"r_count\", \"(a, c) => c\"],\n sum: () => [this.check(\"number\") ?? \"r_id\", \"(a) => a\"],\n mean: () => [\"r_mean\", `(a, c) => (c === 0 ? ${F}() : ${this.#checked(\"number\", \"a / c\")})`],\n any: () => [\"r_id\", \"(a) => a\"],\n all: () => [\"r_id\", \"(a) => a\"],\n none: () => [\"r_not\", \"(a) => !a\"],\n };\n const [resultName, resultCode] = results[op]?.() ?? [\"r_one\", `(a, c) => (c === 0 ? ${F}() : a)`];\n if (!this.top.has(resultName)) this.top.set(resultName, `const ${resultName} = ${resultCode};`);\n const a0 = op === \"sum\" || op === \"mean\" ? \"0\" : op === \"all\" ? \"true\" : BOOLEAN_LIST_OPS.has(op) ? \"false\" : \"undefined\";\n // The values of an op of numbers or of booleans have that kind, or the result is an error. Count takes each kind.\n const needs = op === \"count\" ? undefined : listKind(op, undefined);\n const ok = needs === undefined || body.v.kind === needs ? [] : [`(x) => typeof x === \"${needs}\"`];\n if (ok.length > 0) this.features.add(\"ok\");\n if (pre !== undefined) this.features.add(\"pre\");\n const fns = [arrow(t.s, t.v.code), value, [`(t, q) => ${keyTest}`], ...(pre === undefined && ok.length === 0 ? [] : [pre ?? [\"undefined\"]]), ...(ok.length === 0 ? [] : [ok])];\n const lines = fns.flatMap((x, i) => [...x.slice(0, -1), `${x.at(-1) ?? \"\"}${i < fns.length - 1 ? \",\" : \"\"}`]);\n return { lines: [`const ${fn} = ${this.use(\"S\")}(n, ${mode}, ${String(strict)}, ${a0}, ${stepName}, ${resultName},`, ...ind(lines), \");\"], kind: listKind(op, body.v.kind) };\n }\n\n /** This method gives the code of the program at the key of the run. A constant of the run evaluates once. */\n /** This method gives the code of a program at the key `o` of the run. A sheet has one program for each formula. */\n root(expr: Expr): Code {\n return this.#hoist(this.expr(expr, { origin: \"o\", focus: \"o\", level: 1, originLevel: 1, env: new Map(), fns: new Map(), keys: new Map() }));\n }\n\n /** This method removes the declarations that no code reads, after the last program. */\n finish(): void {\n // A function of an op with an inline form at each of its sites needs no declaration.\n for (const [name, form] of this.#forms) if (form !== undefined && !this.#called.has(name)) this.top.delete(name);\n }\n\n /**\n * This method gives a text that is the same for two expressions with the same structure and the same reads. A name\n * that the expression does not bind gives its variable in the code, and a key of the memo gives its variable too.\n */\n #constKey(e: Expr, ctx: Ctx): string {\n // A name gives its variable for each read, also for a read of a name that the expression binds. The variable depends\n // only on the name, so two expressions with the same text have the same value.\n return canonical(e, (x) => {\n const key = ctx.keys.get(x as Expr);\n if (key !== undefined) return { \"@\": key.code };\n const node = x as Expr | undefined;\n if (node?.tag === \"var\") return { $: ctx.env.get(node.name)?.code ?? node.name };\n // A call gives the number of the binding of its function, so two functions with one name give two keys.\n return node?.tag === \"call\" ? { \"()\": node.fn, of: ctx.fns.get(node.fn)?.id ?? null, args: node.args } : undefined;\n });\n }\n}\n\n/** This function gives the name of the function of a module, and its space, or the reason that the options are not valid. */\nfunction runOf(options: ModuleOptions): { readonly name: string; readonly tree: boolean } | { readonly reason: string } {\n const name = options.name ?? \"run\";\n if (!/^[A-Za-z_$][\\w$]*$/.test(name)) return { reason: `the name \"${name}\" is not a JavaScript name` };\n const tree = options.space === \"tree\";\n if (!tree && options.space !== undefined && options.space !== \"array\") return { reason: `the space \"${String(options.space)}\" is not \"array\" or \"tree\"` };\n return { name, tree };\n}\n\n/** This function gives the reason of an error of the printer. Another exception is a defect, so it goes to the caller. */\nfunction reasonOf(thrown: unknown): Emitted {\n if (!(thrown instanceof NotStandalone)) throw thrown;\n return { ok: false, reason: thrown.message };\n}\n\n/**\n * This function gives the text of a module: the declarations, the helpers, and the function of the run. The run checks\n * its input, computes the parts of the tree and the constants of the run, and then gives the statements `body`.\n */\nfunction printModule(p: Printer, options: ModuleOptions, run: { readonly name: string; readonly tree: boolean }, body: readonly string[]): Emitted {\n p.use(\"C\");\n const helpers = new Set<Helper>();\n // A helper comes after the helpers that it needs. A set keeps the first place of each helper.\n const add = (h: Helper): void => {\n for (const x of NEEDS[h]) add(x);\n helpers.add(h);\n };\n const fields = Object.entries(options.schema.fields ?? {});\n const vars = Object.entries(options.schema.vars ?? {});\n let fieldChecks: string;\n let varChecks: string;\n try {\n fieldChecks = fields.map(([f, k]) => ` || ${p.against(k, `r[${JSON.stringify(f)}]`)}`).join(\"\");\n varChecks = vars.map(([v, k]) => ` || ${p.against(k, `vars[${JSON.stringify(v)}]`)}`).join(\"\");\n } catch (thrown) {\n return reasonOf(thrown);\n }\n const { name, tree } = run;\n // A tree checks its parents, and it computes the parts that the program reads. The siblings and the order need the\n // children.\n if (tree) p.use(\"PT\");\n if (p.treeParts.size > 0) p.treeParts.add(\"children\");\n const parts = ([\"children\", \"siblings\", \"order\"] as const).filter((x) => p.treeParts.has(x));\n for (const x of parts) p.use(TREE_PARTS[x][0]);\n [...p.helpers].toSorted().forEach(add);\n // The names that this module declares at its top: the constants, the helpers and the declarations of the printer.\n const declared = new Set<string>([\"VexContractError\", \"VEX_ERROR\", \"E\", ...(p.memos ? [\"Z\"] : []), ...(helpers.has(\"S\") ? [\"N\", \"W\"] : []), ...helpers, ...p.top.keys()]);\n const bad = nameReason(name, declared);\n if (bad !== undefined) return { ok: false, reason: bad };\n const lines = [\n \"// Generated by @mark1russell7/vex-compiler from a Vex program. Do not edit.\",\n \"/** The error of a run whose input does not keep the schema of the program. */\",\n \"export class VexContractError extends Error {}\",\n \"/** The value of a key where the program gives an error of Vex. */\",\n \"export const VEX_ERROR = Object.freeze({ vexError: true });\",\n \"const E = {};\",\n ...(p.memos ? [\"const Z = {};\"] : []),\n // The values of an item of a node that keeps its items: excluded by a later test, and of the wrong kind.\n ...(helpers.has(\"S\") ? [\"const N = {}, W = {};\"] : []),\n ...[...helpers].map((h) => (h === \"S\" ? helperS(p.features) : HELPERS[h])),\n ...p.top.values(),\n `export function ${name}(records, vars${tree ? \", parents\" : \"\"}) {`,\n ' if (!Array.isArray(records)) C(\"the records are not an array\");',\n \" const R = records;\",\n \" const n = R.length;\",\n \" for (let i = 0; i < n; i++) {\",\n \" const r = R[i];\",\n ` if (typeof r !== \"object\" || r === null${fieldChecks}) C(\\`the record \\${i} does not keep the schema\\`);`,\n \" }\",\n ` if (typeof vars !== \"object\" || vars === null${varChecks}) C(\"the variables do not keep the schema\");`,\n ...(tree ? [\" const P = PT(parents, n);\", ...parts.map((x) => ` ${TREE_PARTS[x][1]}`)] : []),\n ...[...p.vars].map(([v, code]) => ` const ${code} = vars[${JSON.stringify(v)}];`),\n ...ind(p.run),\n ...ind(body),\n \"}\",\n \"\",\n ];\n return { ok: true, source: lines.join(\"\\n\") };\n}\n\n/**\n * This function prints a program as a standalone ES module. The module exports `VexContractError`, `VEX_ERROR` and a\n * function that takes the records and the variables and gives the value at each key. A module of a tree space takes\n * the parents too. The function is pure, so a build can use it. The program can be an expression or a document\n * (DOC.ENTRY).\n */\nexport function emitModule(source: Expr | Envelope, options: ModuleOptions): Emitted {\n const run = runOf(options);\n if (\"reason\" in run) return { ok: false, reason: run.reason };\n // DOC.ENTRY: a document gives its expression first, or the reason that it is not valid.\n const read = isDocument(source) ? fromDocument(source, options.domains) : { ok: true as const, value: source };\n if (!read.ok) return { ok: false, reason: read.error.message };\n const expr = read.value;\n // EVAL.SHAPE: a module of an expression that is not valid has no use, so the printer gives the reason.\n const shape = shapeError(expr);\n if (shape !== undefined) return { ok: false, reason: shape };\n const p = new Printer(expr, options);\n let value: Code;\n try {\n value = p.root(expr);\n p.finish();\n } catch (thrown) {\n return reasonOf(thrown);\n }\n const body = [\"const out = [];\", \"for (let o = 0; o < n; o++) {\", \" try {\", ...ind(ind(value.s)), ` out.push(${value.v.code});`, \" } catch {\", \" out.push(VEX_ERROR);\", \" }\", \"}\", \"return out;\"];\n return printModule(p, options, run, body);\n}\n\n/** The budget of the stack of the search of a run of a sheet, as `STACK_BUDGET` of `SheetRun`. */\nconst SHEET_BUDGET = 3000;\n\n/** A formula of a sheet: its column, the position of its cell (undefined for the formula of the column) and its expression. */\ninterface Formula {\n readonly column: string;\n readonly key: number | undefined;\n readonly expr: Expr;\n}\n\n/** This function gives the words for a formula in a reason: the formula of a column, or of one cell. */\nconst formulaText = (f: Formula): string => (f.key === undefined ? `the formula of the column \"${f.column}\"` : `the formula of the cell \"${f.column}\" at \"${String(f.key)}\"`);\n\n/** This function gives the words for a kind in a reason. */\nconst kindText = (k: Kind | undefined): string => k ?? \"that the printer does not know\";\n\n/**\n * This function prints the formula columns of a sheet as a standalone ES module (COMPILE.MODULE.SHEET). The function of\n * the module takes the records and the variables, and the parents for a tree. It gives an object with an array for\n * each column: the result of the column at each key, or `VEX_ERROR`. The results are the results of `SheetRun`.\n *\n * The run fills the columns in the order of `SheetRun.fill`. A read of a finished cell is the read of an array. A read\n * of a cell that is not finished starts the search of `SheetRun`, with the same budget of the stack. Each cell on a\n * cycle of reads gives `VEX_ERROR`.\n */\nexport function emitSheetModule(columns: ReadonlyMap<string, Expr>, options: SheetModuleOptions): Emitted {\n const run = runOf(options);\n if (\"reason\" in run) return { ok: false, reason: run.reason };\n const budget = options.budget ?? SHEET_BUDGET;\n if (!Number.isSafeInteger(budget) || budget < 0) return { ok: false, reason: `the budget ${String(budget)} is not a whole number of 0 or more` };\n const cells: CellFormulas = options.cells ?? new Map();\n const names = [...new Set([...columns.keys(), ...cells.keys()])];\n const order = columnOrder(columns, cells);\n // The formulas in the order of the columns. A key of a cell that is not the text of a position is not a key of the\n // space, so no read finds its formula.\n const formulas: Formula[] = order.flatMap((column): Formula[] => {\n const own = [...(cells.get(column) ?? [])].filter(([k]) => /^(0|[1-9]\\d*)$/.test(k) && Number.isSafeInteger(Number(k)));\n const formula = columns.get(column);\n return [...(formula === undefined ? [] : [{ column, key: undefined, expr: formula }]), ...own.map(([k, expr]) => ({ column, key: Number(k), expr }))];\n });\n for (const f of formulas) {\n // EVAL.SHAPE: the printer gives the reason for an expression that is not valid.\n const shape = shapeError(f.expr);\n if (shape !== undefined) return { ok: false, reason: `${formulaText(f)}: ${shape}` };\n }\n const kinds = new Map<string, Kind | undefined>(Object.entries(options.kinds ?? {}));\n const index = new Map(names.map((c, i) => [c, i]));\n // The memo of the printer covers each formula, so the formulas share their nodes of the memo.\n const p = new Printer(rec(Object.fromEntries(formulas.map((f, i) => [`f${String(i)}`, f.expr]))), options, { columns: index, kinds });\n const fns: string[] = [];\n const decls: string[] = [];\n try {\n for (const f of formulas) {\n const code = p.root(f.expr);\n const kind = code.v.kind;\n // The first formula of a column without a kind of the options gives the kind of the column.\n if (!kinds.has(f.column)) kinds.set(f.column, kind);\n else if (kinds.get(f.column) !== kind) throw new NotStandalone(`${formulaText(f)} gives a value of the kind ${kindText(kind)}, not of the kind ${kindText(kinds.get(f.column))} of its column`);\n const fn = p.fresh(\"cf\");\n fns.push(fn);\n decls.push(...(code.v.safe && code.s.length === 0 ? [`const ${fn} = (o) => ${code.v.code};`] : [`const ${fn} = (o) => {`, \" try {\", ...ind(ind(code.s)), ` return ${code.v.code};`, \" } catch {\", \" return E;\", \" }\", \"};\"]));\n }\n p.finish();\n } catch (thrown) {\n return reasonOf(thrown);\n }\n // The program of each column, and of each cell with its own formula, with its cost in estimated frames, as in SheetRun.\n const entry = (i: number): string => `[${fns[i] as string}, ${String(3 * nestingOf((formulas[i] as Formula).expr) + 16)}]`;\n const own = names.map((c) => {\n const at = formulas.flatMap((f, i) => (f.column === c && f.key !== undefined ? [`${String(f.key)}: ${entry(i)}`] : []));\n return at.length === 0 ? \"undefined\" : `{ ${at.join(\", \")} }`;\n });\n const cols = names.map((c) => {\n const i = formulas.findIndex((f) => f.column === c && f.key === undefined);\n return i < 0 ? \"undefined\" : entry(i);\n });\n p.use(\"SH\");\n // A tree gives the keys in the order of a fill with the helper KO, once for each order.\n const orders = new Map<string, string>();\n const fill = order.map((c) => {\n const { reverse, post, back } = keyOrderOf(readsOf(columns, cells, c).directions);\n const at = String(index.get(c));\n if (!run.tree) return reverse ? `for (let o = n - 1; o >= 0; o--) SS.f(${at}, o);` : `for (let o = 0; o < n; o++) SS.f(${at}, o);`;\n const args = `${p.use(\"KO\")}(H, RT, ${String(post)}, ${String(back)})`;\n let keys = orders.get(args);\n if (keys === undefined) {\n keys = p.fresh(\"K\");\n orders.set(args, keys);\n }\n return `for (const o of ${keys}) SS.f(${at}, o);`;\n });\n if (run.tree) p.treeParts.add(\"children\");\n const body = [\n ...decls,\n `const SS = SH(n, [${cols.join(\", \")}], [${own.join(\", \")}], ${String(budget)});`,\n `const ${READ_CELL} = SS.r;`,\n ...[...orders].map(([args, keys]) => `const ${keys} = ${args};`),\n ...fill,\n `return { ${names.map((c, i) => `${JSON.stringify(c)}: SS.o(${String(i)})`).join(\", \")} };`,\n ];\n return printModule(p, options, run, body);\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,YAAY;;;;;AAMzB,MAAM,4BAAiC,IAAI,IAAI;CAAC;CAAU;CAAQ;CAAO;CAAQ;CAAU;CAAQ;CAAW;CAAO;CAAW;AAAM,CAAC;;;;;;AAOvI,SAAgB,WAAW,MAAgC;CACzD,MAAM,OAAe,CAAC,IAAI;CAC1B,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,MAAM,KAAA,GAAW,IAAI,KAAK,IAAI,GAAG;EACxD,KAAK,EAAE,QAAQ,UAAU,EAAE,QAAQ,WAAW,OAAO,EAAE,IAAI,MAAM,KAAA,GAAW,OAAO;EAEnF,IAAI,EAAE,QAAQ,SAAS,UAAU,IAAI,EAAE,EAAE,GAAG,OAAO,gCAAgC,EAAE,GAAG;EACxF,IAAI,EAAE,QAAQ,SAAS,UAAU,EAAE,KAAK,GAAG,OAAO;EAClD,K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GH,GAAG;CAEH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CAGH,GAAG;CACH,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,IAAI;CACJ,IAAI;CAGJ,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAGX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,IAAI;CAIJ,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAGX,IAAI;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;E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