import type { BanlistEntry, Erratum, Rule, Ruling } from "../../corpus/types.ts"; import { type Classification } from "./static-classify.ts"; /** One printed card the gazetteer proves exists. */ export type CardMatch = { key: string; card: string; pngUri: string | null; }; /** * Everything a static legality answer reads. * * `banlistOk` and `errataOk` are separate from the rows for one reason: a list * that loaded and holds nothing proves nothing about any card. Asserting "not * banned" from an empty list would call a banned card legal, so the flags gate * the claim rather than the rows gating it. */ export type StaticData = { /** Every printed name. The proof a card exists. */ cards: Map; banlist: Map; errata: Map; /** Rulings by the folded name of every piece each one names. */ rulings: Map; banlistOk: boolean; errataOk: boolean; rulingsOk: boolean; /** The newest date on the banned list, which every verdict is stamped with. */ asOf: string | null; errataAsOf: string | null; }; export type RenderConfig = { /** The URL scheme a card link uses, without the colon. Empty means plain text. */ linkScheme: string; }; /** * A card name as a link, or bold when there is no usable image path. * * The image path comes from imported data, so it is not trusted: a value holding * a bracket or a parenthesis would close the link early and let the rest of the * answer render as markup. */ export declare function cardLink(name: string, pngUri: string | null | undefined, config: RenderConfig): string; /** * Every printed card a key names, in gazetteer order. * * The leading-run scan is wide on purpose, and `filedUnder` then keeps only the * printings the key really owns. Without that second half, a one-word key lists * every card starting with that word as though they were printings of it, and a * single banned row on the longer name turns that list into a ban verdict about * a card the reader never named. */ export declare function resolveCards(cardKey: string, data: StaticData): CardMatch[]; /** * Resolve the card a question named, narrowing the key only when the literal key * finds nothing. * * Without the narrowing, one adverb sends a banned card to a model: "Is X still * banned?" captures the key "x still", which no index holds, so the answer was * null and something else answered a ban question from nothing. * * A question naming TWO cards resolves both. Answering about the first alone is * worse than declining, because a verdict that silently covers one reads as a * verdict that covers both. */ export declare function resolveNamedCard(cardKey: string, data: StaticData): { key: string; matches: CardMatch[]; names: string[]; }; export declare function renderRule(rule: Rule, sectionTitle?: string | null): string; /** * A ban verdict, plus the printings of the same name that carry no row. * * A reader who asks about a character means every printing of it, and often only * one is banned. An answer naming the banned printing alone reads as "this * character is banned", and the reader then leaves the legal ones out of a deck. * Naming the rest is the difference between a true answer and a true sentence. */ export declare function renderBan(entries: BanlistEntry[], unlisted: CardMatch[], names: string[], config: RenderConfig): string; export declare function renderWholeBanlist(banlist: Map, asOf: string, config: RenderConfig): string; export declare function renderNotBanned(label: string, asOf: string | null, matches: CardMatch[], names: string[], config: RenderConfig): string; export declare function renderErrata(entries: Erratum[], config: RenderConfig): string; export declare function renderNoErrata(label: string, asOf: string | null, matches: CardMatch[], names: string[], config: RenderConfig): string; /** * The published rulings on one card. * * Every ruling states who published it and whether it is official, because a * reader weighs those two facts before the answer itself. `is_official` is false * unless the corpus says otherwise, so an unlabelled ruling reads as unofficial * rather than as the publisher's word. * * The rule numbers come out as a plain list, not as quoted rule text. This stage * reads no rules, and printing a number a reader can look up is honest where * paraphrasing the rule behind it would not be. */ export declare function renderRulings(rulings: Ruling[], config: RenderConfig): string; export declare function renderNoRulings(label: string, matches: CardMatch[], names: string[], config: RenderConfig): string; export type StaticAnswer = { text: string; citations: Record[]; source: string; }; /** * Render the card half of a static answer, or null to fall through. * * Pure. Every "no row exists" claim below is gated on three things: the list * loaded, it carries a date to stamp the claim with, and the gazetteer proves * the card is real. Reading existence off the same index the question is about * would be circular. */ export declare function renderCardAnswer(c: Classification, data: StaticData, config: RenderConfig): StaticAnswer | null; /** Build the lookup indexes one static answer reads. */ export declare function indexStaticData(input: { cardNames: { id: string; name: string; png_uri: string | null; }[]; banlist: BanlistEntry[]; errata: Erratum[]; rulings: Ruling[]; banlistLoaded: boolean; errataLoaded: boolean; rulingsLoaded: boolean; }): StaticData; //# sourceMappingURL=static-render.d.ts.map