/** * A QR encoder, so `bitmagic publish` can hand the creator's phone the URL it just printed. * * The Creator does this server-side already — `PublishController.generateQRCode` calls the `qrcode` * package and the publish dialog shows the PNG. The CLI cannot follow it there: `qrcode` drags in * `dijkstrajs`, `pngjs` and `yargs@15`, and `@bitmagic/cli` is a published package with four * deliberately-chosen runtime dependencies. So the encoder lives here instead, cut down to exactly * what a published-game URL needs: * * - **Byte mode only.** A URL is bytes. Numeric, alphanumeric and kanji modes would encode it * smaller in theory and never in practice, because `https://` alone rules out alphanumeric. * - **Error correction level M only**, matching the Creator's `errorCorrectionLevel: 'M'` — a code * scanned from this terminal and one scanned from the publish dialog then behave identically. * - **Versions 1-9 only.** The character-count indicator is 8 bits up to version 9 and 16 bits * from version 10, so stopping here removes a branch and four tables. Version 9 holds 180 bytes; * the longest URL this ever sees is the dev portal's, around 60. Anything longer returns null * rather than growing the tables — see `encodeQr`. * * Structure follows ISO/IEC 18004. Every table below is a literal with the spec's own name for it, * and `__tests__/qr.test.ts` checks each one against fixtures generated by the `qrcode` package, so * a transposed digit fails loudly instead of producing a code that scans as garbage. */ /** * The spec's four penalty rules (8.8.2), summed. Lower is better. * * Scored over the entire symbol including function patterns, as the spec requires — the finders' * own 1:1:3:1:1 ratio is exactly what rule 3 hunts for elsewhere, and excluding them would let a * mask hide a false finder against a real one. */ export declare function maskPenalty(matrix: boolean[][]): number; /** * Encode `text` with an explicitly chosen mask. * * Exported for the fixture tests, which pin the mask so they compare structure — codewords, ECC, * interleaving, function patterns, format bits — rather than a mask heuristic. Callers outside the * tests want `encodeQr`. */ export declare function encodeQrWithMask(text: string, mask: number): boolean[][] | null; /** * Encode `text` as a matrix of modules, row-major, true meaning dark. Null when it does not fit. * * The mask is chosen by the spec's penalty rules. That choice is a legibility heuristic and not a * correctness property — all eight masks produce a valid, scannable symbol, and a decoder reads the * chosen one out of the format information either way. * * There is no quiet zone here: it belongs to whatever draws the symbol, which knows what it is * drawing onto. `qr-terminal.ts` paints its own. */ export declare function encodeQr(text: string): boolean[][] | null; /** The longest text this encoder can hold, in bytes. Exported so a caller can explain a refusal. */ export declare const MAX_BYTES: number;