import { D as Delimiter, I as Input, c as InspectResult, a as CheckRules, R as RulesV2, b as Rules, C as CheckResult, d as IssueCode, e as Issue, V as ValidateResult, f as CellIssue } from './types-OoUNo2KB.js'; export { B as BlankPolicy, g as CheckReport, h as ColumnRule, i as ColumnType, j as ColumnValueType, k as CompareOp, l as CsvInfo, F as FileInfo, m as FileMeta, n as Format, o as FormulaInjectionPolicy, H as HeaderColumn, N as NormalizedColumn, P as PhoneKind, p as PiiKind, q as RowRule, S as Severity, r as SheetInfo, s as StandardResult, t as SummaryItem } from './types-OoUNo2KB.js'; import { M as Messages } from './i18n-Po8vpptn.js'; export { r as registerLocale } from './i18n-Po8vpptn.js'; declare const VERSION = "0.2.0"; interface InspectOptions { /** 1-based header row. Default 1. */ headerRow?: number; /** Data rows kept in each sheet's preview. Default 5. */ previewRows?: number; locale?: string; telemetry?: boolean; /** CSV delimiter; detected when omitted. */ delimiter?: Delimiter; /** Cap on the total decompressed bytes of an xlsx. Default 200 MB. */ maxUncompressedSize?: number; } /** Describe every sheet of a workbook. Never throws for unreadable files. */ declare function inspect(input: Input, opts?: InspectOptions): Promise; /** * Validate the first (or chosen) sheet against `rules`, collecting every problem. With v2 rules * (`columns` array) the cells are checked too and the result has `summary`, `report` and `columns`. */ declare function check(input: Input, rules?: CheckRules | RulesV2 | Rules): Promise; interface ReadRowsOptions { /** Sheet name, or 0-based index. Default: the first sheet. */ sheet?: string | number; /** 1-based header row. Default 1. */ headerRow?: number; /** Locale for readRows() issue messages. Default 'en'. */ locale?: string; /** CSV delimiter; detected when omitted. */ delimiter?: Delimiter; /** Cap on the total decompressed bytes of an xlsx. Default 200 MB. */ maxUncompressedSize?: number; /** Cap on data rows × column width in the output. Default 2,000,000. */ maxCells?: number; /** v2 rules (`columns` array): rows keyed by column key with `$row`, cleaned by validate(). */ rules?: RulesV2 | Rules; /** With rules: message templates by issue code (override rules.messages). */ messages?: Partial>; /** With rules: the values before cleanup (what check() hands to validate()). */ raw?: boolean; } interface ReadRowsResult { rows: Record[]; columns: string[]; issues: Issue[]; } /** * Read one sheet as `{header: value}` objects. Unreadable files give issues, not a throw. * With v2 `rules`: rows keyed by column key with `$row`, cleaned (or `raw`), and the check's issues. */ declare function readRows(input: Input, opts?: ReadRowsOptions): Promise; /** Build `{ headers, columns }` rules from a template file's header row. */ declare function rulesFromTemplate(input: Input, opts?: ReadRowsOptions): Promise<{ headers: string[]; columns: number; }>; interface TemplateOptions { /** Put an example row that passes the rules under the header. Default false. */ example?: boolean; /** Sheet name. Default: the rules' `sheet` when it is a name, else 'Sheet1'. */ sheetName?: string; /** Language of the header notes and the text example. Default: the rules' `locale`, else 'en'. */ locale?: string; /** The "today" of date examples (local time). Default: now. */ now?: Date; } type Format = 'csv' | 'xlsx'; /** Build a blank template (header row only) as a CSV or XLSX Blob. */ declare function makeTemplate(headers: string[], format: Format, sheetName?: string): Blob; /** * Build a template from v2 rules: header notes describing each column's rule, enum dropdowns, text and date * cell formats, and with `example: true` a second row that passes the rules. CSV gets the header and example only. * A string third argument is the sheet name. Enum lists over 255 characters (or with a comma in a value) go to a * second, visible sheet named per locale ('Lists' / '목록'). Examples follow column rules only (not rowRules); * `pattern` columns without `enum` get none. Enum values are compared with the normalized value as is, so a * numeric enum on a text-type column (written as text) does not match. */ declare function makeTemplate(rules: RulesV2 | Rules, format: Format, opts?: TemplateOptions | string): Blob; /** Error report for a check()/validate() result. Issues are already masked; this never unmasks. */ declare function makeErrorReport(result: CheckResult | ValidateResult, format: 'csv', opts?: { locale?: string; }): Blob; /** * A JS row hook (spec J `rowRule(fn)`), called with the cleaned result row (do not mutate it). Missing * issue fields default to row = this row, severity 'error', rule 'rowRule', the locale message. * Servers must implement the same hook themselves. */ type RowRuleHook = (row: Record) => CellIssue[] | void; interface ValidateOptions { /** Message locale; defaults to rules.locale, then 'en'. */ locale?: string; /** Global message overrides by code (a column's `message` wins over these). */ messages?: Messages; /** Column letter per key, used to fill `col` (check() passes the header mapping). */ columnLetters?: Readonly>; /** Called for every non-blank row with the cleaned row. */ rowRules?: RowRuleHook[]; } type Obj = Record; /** * Check and clean key-based row objects against v2 rules (spec §5, contract §5 P). Pure, synchronous and * deterministic: no DOM, files or time. Rows are numbered by `$row`, else index + headerRow + 1. * Keys not in `columns` are ignored and left out of the result rows. All-empty rows follow `rows.blank`; * blank rows after the last data row are dropped silently. */ declare function validate(rows: readonly Obj[], rulesInput: Rules | object, opts?: ValidateOptions): ValidateResult; /** * `defineRules()` with the Standard Schema `~standard.validate` hook connected. This is the public entry; the * engine uses the plain one in define.ts, so define → engine never forms an import cycle. */ declare function defineRules(json: unknown): Rules; /** Lowercase hex SHA-256 of `bytes`: Web Crypto when available, otherwise a plain-JS fallback. */ declare function sha256(bytes: Uint8Array): Promise; /** `sha256:` of the rules' canonical JSON (UTF-8). */ declare function rulesHash(rules: unknown): Promise; export { CellIssue, CheckResult, CheckRules, Delimiter, Input, type InspectOptions, InspectResult, Issue, IssueCode, Messages, type ReadRowsOptions, type ReadRowsResult, type RowRuleHook, Rules, RulesV2, VERSION, type ValidateOptions, ValidateResult, check, defineRules, inspect, makeErrorReport, makeTemplate, readRows, rulesFromTemplate, rulesHash, sha256, validate };