import type { JudgingAssignment } from "./judging.types.ts"; /** What a name and an ID were set as. */ export interface CardFit { name: string[]; nameSize: number; /** The ID's lines (with its label), or none. */ id: string[]; idSize: number; /** The width of the widest line and the height of the whole, in the box's units. */ width: number; height: number; } /** What to fit, and how. Sizes and the box are in the same units. */ export interface CardAsk { name: string; id: string; /** The word before an ID (`ID`). */ idLabel: string; width: number; height: number; /** The biggest and the smallest size of the name; the ID is set at 0.62 of the name's size and no smaller than 0.75 of the least. */ max: number; min: number; /** The most lines the name may take. */ maxLines: number; /** Whether a word wider than the box may be broken inside (the chart), or the card does not fit (a seat). */ breakWords: boolean; } /** The lines a text is wrapped in at a size, no line wider than `width`, or undefined when a word is wider and breaking is not allowed. */ export declare function wrapText(text: string, width: number, size: number, breakWords: boolean, measure?: (text: string) => number): string[] | undefined; /** * Set a name, and an ID under it, in the biggest size that fits the box. Returns undefined when nothing from `max` down to `min` fits (for a card in a seat, that is "does not fit"); with `breakWords` and `maxLines` set * as large as it takes, it always returns something, which may be taller than the box (the chart grows). */ export declare function fitCard(ask: CardAsk): CardFit | undefined; /** * What the chart does: the biggest size at which the name takes three lines at most with no word broken, shrinking to the floor; then, at the floor, as many lines as it takes and a word wider than the row broken inside. * It always fits, whatever the text, because the row grows. */ export declare function fitChart(ask: Omit): CardFit; /** The box a card gives a seat's name and ID, and the biggest size its name may be set in. */ export interface SeatBox { width: number; height: number; max: number; } /** * Fit the name and ID of every seat of a mat into its card, as one size for all of them, so that the row of cards reads evenly: each seat that has a name is fitted alone, the smallest size any of them needs is taken, and * each is fitted again at that size. A seat whose name does not fit at the floor, or that has nobody in it, has no card (undefined). `boxes` has the card box of each seat, in order. */ export declare function fitSeats(seats: readonly JudgingAssignment[], boxes: readonly SeatBox[], limits: { min: number; idLabel: string; }): (CardFit | undefined)[];