{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "docx-viewer-demo",
  "title": "DOCX Viewer Demo",
  "description": "A worked example of DOCX Viewer: Renders a Word document as elements built through an allowlist, so a file you did not write cannot bring its own scripts or links.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/docx-viewer.json"
  ],
  "files": [
    {
      "path": "components/demos/docx-viewer-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { SAMPLE_DOCX } from \"@/components/demos/document-fixtures\"\nimport { DocxViewer } from \"@/registry/default/docx-viewer/docx-viewer\"\n\nexport function DocxViewerDemo() {\n  const [file, setFile] = React.useState<ArrayBuffer>()\n\n  React.useEffect(() => {\n    const controller = new AbortController()\n\n    void fetch(SAMPLE_DOCX, { signal: controller.signal })\n      .then((response) => response.arrayBuffer())\n      .then((buffer) => setFile(buffer))\n      .catch(() => undefined)\n\n    return () => controller.abort()\n  }, [])\n\n  return <DocxViewer className=\"w-full max-w-2xl\" source={file} />\n}\n",
      "type": "registry:example"
    },
    {
      "path": "components/demos/document-fixtures.ts",
      "content": "/** Generated from public/demo/documents/master-services-agreement.pdf. */\nexport const SAMPLE_PDF = \"/demo/documents/master-services-agreement.pdf\"\nexport const SAMPLE_DOCX = \"/demo/documents/master-services-agreement.docx\"\nexport const SAMPLE_CSV = \"/demo/documents/invoices.csv\"\nexport const PDF_WORKER = \"/demo/pdf.worker.min.mjs\"\n\nexport const PAGE_COUNT = 3\n\nexport const samplePages = Array.from({ length: PAGE_COUNT }, (_, index) => ({\n  number: index + 1,\n  src: `/demo/documents/page-${index + 1}.png`,\n}))\n\nexport const pageImage = samplePages[0]!.src\n\n/**\n * Read out of the PDF text layer and checked by drawing them back onto the\n * exported page, so every region sits on the value it names.\n */\nexport const invoiceBoxes = [\n  {\n    id: \"customer\",\n    label: \"Customer\",\n    x: 0.2979,\n    y: 0.1893,\n    width: 0.1397,\n    height: 0.022,\n  },\n  {\n    id: \"agreement-no\",\n    label: \"Agreement number\",\n    x: 0.2979,\n    y: 0.2484,\n    width: 0.125,\n    height: 0.022,\n    tone: \"accent\" as const,\n  },\n  {\n    id: \"net30\",\n    label: \"Payment window\",\n    x: 0.3247,\n    y: 0.6301,\n    width: 0.0553,\n    height: 0.0214,\n  },\n  {\n    id: \"late-fee\",\n    label: \"Late payment\",\n    x: 0.3247,\n    y: 0.6876,\n    width: 0.1011,\n    height: 0.0214,\n    tone: \"warning\" as const,\n  },\n]\n\nexport const customerRegion = {\n  x: 0.2979,\n  y: 0.1893,\n  width: 0.1397,\n  height: 0.022,\n}\nexport const agreementRegion = {\n  x: 0.2979,\n  y: 0.2484,\n  width: 0.125,\n  height: 0.022,\n}\nexport const paymentRegion = {\n  x: 0.3247,\n  y: 0.6301,\n  width: 0.0553,\n  height: 0.0214,\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}