// Synthetic byte fixtures for the parser adapters (Epic #189, Issue #266). Pure strings
// only — no FS, no shell, no network. Kept in a `*-fixtures.ts` (NOT `_support`) file so the
// architecture rules treat it as production source but the trust-8 rule still excludes it
// from publication when callers stick to the `parsers/index.ts` barrel.
import { Buffer } from "node:buffer";
export const FIXTURE_DOCUMENT_ID = "doc-fixture";
export function encode(text) {
    return new TextEncoder().encode(text);
}
export function selectionFromText(text, overrides = {}) {
    const base = {
        documentId: FIXTURE_DOCUMENT_ID,
        bytes: encode(text),
        extension: overrides.extension ?? "txt",
        mediaType: overrides.mediaType ?? "text/plain",
    };
    return overrides.languageHint !== undefined
        ? { ...base, languageHint: overrides.languageHint }
        : base;
}
export function selectionFromBytes(bytes, overrides = {}) {
    const base = {
        documentId: FIXTURE_DOCUMENT_ID,
        bytes,
        extension: overrides.extension ?? "",
        mediaType: overrides.mediaType ?? "",
    };
    return overrides.languageHint !== undefined
        ? { ...base, languageHint: overrides.languageHint }
        : base;
}
// ─── Format fixtures ─────────────────────────────────────────────────────────
export const TEXT_PLAIN = "Hello, world.\nSecond paragraph here.\n";
export const MARKDOWN_DOC = [
    "# Title",
    "",
    "Intro paragraph.",
    "",
    "## Subhead A",
    "",
    "Body of A.",
    "",
    "### Deep heading",
    "",
    "Deep body.",
    "",
    "## Subhead B",
    "",
    "Body of B.",
    "",
].join("\n");
export const JSON_FLAT = '{"name":"alpha","count":3,"active":true}';
export const JSON_NESTED = JSON.stringify({
    meta: { id: "doc-1", version: 2 },
    items: [
        { sku: "A1", price: 10 },
        { sku: "B2", price: 20 },
    ],
});
export const CSV_SIMPLE = "a,b,c\n1,2,3\n4,5,6\n";
// RFC 4180 adversarial fixture — quoted comma, embedded quote escape, embedded newline.
export const CSV_QUOTED = 'a,b,c\n"x,1","y""2","z\n3"\n';
export const TSV_SIMPLE = "a\tb\tc\n1\t2\t3\n";
export const HTML_HEADINGS = [
    "<!DOCTYPE html>",
    "<html><body>",
    "<h1>Top</h1>",
    "<p>Intro text.</p>",
    "<h2>Sub</h2>",
    "<p>Sub body.</p>",
    "<h3>Deeper</h3>",
    "<p>Deeper body.</p>",
    "</body></html>",
].join("\n");
export const HTML_DANGEROUS = [
    "<html><body>",
    "<h1>Safe</h1>",
    "<script>alert('pwn');</script>",
    "<style>body{display:none}</style>",
    "<noscript>fallback</noscript>",
    "<p>After script.</p>",
    "</body></html>",
].join("\n");
// Synthetic PDF marker — only the leading magic bytes are required for sniffing.
export const PDF_MAGIC = encode("%PDF-1.4\n%binary marker\n");
export const PDF_TEXT_LAYER = encode(`%PDF-1.4
1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj
2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> endobj
3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >> endobj
4 0 obj << /Length 44 >> stream
BT /F1 24 Tf 72 72 Td (Hello PDF) Tj ET
endstream endobj
5 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> endobj
xref
0 6
0000000000 65535 f 
0000000010 00000 n 
0000000063 00000 n 
0000000122 00000 n 
0000000248 00000 n 
0000000342 00000 n 
trailer << /Root 1 0 R /Size 6 >>
startxref
412
%%EOF`);
export const PDF_NO_TEXT_LAYER = encode(`%PDF-1.4
1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj
2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> endobj
3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R >> endobj
4 0 obj << /Length 0 >> stream

endstream endobj
xref
0 5
0000000000 65535 f
0000000010 00000 n
0000000063 00000 n
0000000122 00000 n
0000000210 00000 n
trailer << /Root 1 0 R /Size 5 >>
startxref
260
%%EOF`);
export const DOCX_SIMPLE_BASE64 = "UEsDBBQAAAAIAC28xFzXeYTq8QAAALgBAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbH2QzU7DMBCE730Ky9cqccoBIZSkB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Y3VtZW50LnhtbFVUCQADp/ohaqf6IWp1eAsAAQT1AQAABBQAAAB1kE1PwzAMhu/7FZHvLN0OCFVtd0PsNgn4ASYxbaUkjpyw0n9PsvEhJLi8Vuwnrz+6w7t36kySZg497LYNKAqG7RzGHp6f7m/uQKWMwaLjQD2slOAwbLqltWzePIWsikNI7dLDlHNstU5mIo9py5FCqb2yeMzlKaNeWGwUNpRSaeCd3jfNrfY4BxiK5QvbtcZYRark4RiysIooOArGqdM1WVUuGr/5eLr8iI95daSW9oyuhwfCusoO9JW+Mp/WJ3azWf93/IWpOtwfrP4aW/+cZNh8AFBLAQIeAxQAAAAIANACxVxn4XsRxAAAAHcBAAATABgAAAAAAAEAAACkgQAAAABbQ29udGVudF9UeXBlc10ueG1sVVQFAAOn+iFqdXgLAAEE9QEAAAQUAAAAUEsBAh4DCgAAAAAA0ALFXAAAAAAAAAAAAAAAAAYAGAAAAAAAAAAQAO1BEQEAAF9yZWxzL1VUBQADp/ohanV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIANACxVwmeCEIiwAAAPMAAAALABgAAAAAAAEAAACkgVEBAABfcmVscy8ucmVsc1VUBQADp/ohanV4CwABBPUBAAAEFAAAAFBLAQIeAwoAAAAAANACxVwAAAAAAAAAAAAAAAAFABgAAAAAAAAAEADtQSECAAB3b3JkL1VUBQADp/ohanV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIANACxVzTjeyh1AAAAFgBAAARABgAAAAAAAEAAACkgWACAAB3b3JkL2RvY3VtZW50LnhtbFVUBQADp/ohanV4CwABBPUBAAAEFAAAAFBLBQYAAAAABQAFAJgBAAB/AwAAAAA=";
export const DOCX_WITH_PREAMBLE = Uint8Array.from(Buffer.from(DOCX_WITH_PREAMBLE_BASE64, "base64"));
// Synthetic zip marker — PK\x03\x04 prefix. We never decompress this.
export const ZIP_MAGIC = new Uint8Array([
    0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00,
]);
// Synthetic gzip marker — 0x1f 0x8b prefix.
export const GZIP_MAGIC = new Uint8Array([0x1f, 0x8b, 0x08, 0x00]);
// Synthetic PNG marker.
export const PNG_MAGIC = new Uint8Array([
    0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
]);
