efficient-shell 4.127.0 → 4.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +938 -5
- package/dist/{Browser-F5TKMP4K.js → Browser-XPVJ2K7B.js} +13 -10
- package/dist/Browser-XPVJ2K7B.js.map +1 -0
- package/dist/{Calculator-T3XG7S73.js → Calculator-ZXJPXG7F.js} +12 -9
- package/dist/Calculator-ZXJPXG7F.js.map +1 -0
- package/dist/ConfirmDialog-MTC7QMUJ.js +4 -0
- package/dist/{ConfirmDialog-LJXMB45A.js.map → ConfirmDialog-MTC7QMUJ.js.map} +1 -1
- package/dist/{CurrencyConverter-CASQMKLO.js → CurrencyConverter-WSJ2BBSX.js} +12 -9
- package/dist/CurrencyConverter-WSJ2BBSX.js.map +1 -0
- package/dist/{Documents-YX67YTZS.js → Documents-ONGSXUJI.js} +14 -11
- package/dist/Documents-ONGSXUJI.js.map +1 -0
- package/dist/{Files-QB63GO6J.js → Files-GQZMFWXQ.js} +17 -14
- package/dist/Files-GQZMFWXQ.js.map +1 -0
- package/dist/{Notepad-3SUD5XUE.js → Notepad-HM73XAM4.js} +15 -12
- package/dist/Notepad-HM73XAM4.js.map +1 -0
- package/dist/PdfViewer-M2YGZIYX.js +5 -0
- package/dist/{PdfViewer-LSP3YNFC.js.map → PdfViewer-M2YGZIYX.js.map} +1 -1
- package/dist/{PomodoroTimer-4EHD2QC4.js → PomodoroTimer-DG3LI5CX.js} +14 -11
- package/dist/PomodoroTimer-DG3LI5CX.js.map +1 -0
- package/dist/{Preview-4ZHR4SKP.js → Preview-TUSV4UMO.js} +16 -13
- package/dist/Preview-TUSV4UMO.js.map +1 -0
- package/dist/{Sidebar-J76PV4QF.js → Sidebar-BPU7RCZP.js} +5 -4
- package/dist/Sidebar-BPU7RCZP.js.map +1 -0
- package/dist/{Spreadsheet-G3SC7XJ5.js → Spreadsheet-3WTXCHYQ.js} +14 -11
- package/dist/Spreadsheet-3WTXCHYQ.js.map +1 -0
- package/dist/{Stock-TLT4VN2R.js → Stock-YMPOMUAW.js} +12 -9
- package/dist/Stock-YMPOMUAW.js.map +1 -0
- package/dist/{Weather-FRKX3DAK.js → Weather-NZO3CWLH.js} +12 -9
- package/dist/Weather-NZO3CWLH.js.map +1 -0
- package/dist/{WorldClock-GKCITO3M.js → WorldClock-HUC6D3AD.js} +12 -9
- package/dist/WorldClock-HUC6D3AD.js.map +1 -0
- package/dist/apps/index.js +26 -22
- package/dist/apps/index.js.map +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-7IN7YZAL.js +547 -0
- package/dist/chunk-7IN7YZAL.js.map +1 -0
- package/dist/{chunk-YNGPTOL6.js → chunk-7MA5XBWD.js} +3 -3
- package/dist/{chunk-YNGPTOL6.js.map → chunk-7MA5XBWD.js.map} +1 -1
- package/dist/{chunk-WK7FV7VV.js → chunk-BJ34QOR3.js} +827 -625
- package/dist/chunk-BJ34QOR3.js.map +1 -0
- package/dist/{chunk-HNH7FOYB.js → chunk-CGXMWHQW.js} +7 -6
- package/dist/chunk-CGXMWHQW.js.map +1 -0
- package/dist/{chunk-XUCIYMN7.js → chunk-CJYO4RVV.js} +4 -4
- package/dist/{chunk-XUCIYMN7.js.map → chunk-CJYO4RVV.js.map} +1 -1
- package/dist/{chunk-N3CG5HG5.js → chunk-CLGNTGC5.js} +12 -11
- package/dist/chunk-CLGNTGC5.js.map +1 -0
- package/dist/chunk-D276EMXS.js +57 -0
- package/dist/chunk-D276EMXS.js.map +1 -0
- package/dist/{chunk-7KIOEKHS.js → chunk-E3TWIN7Z.js} +21 -135
- package/dist/chunk-E3TWIN7Z.js.map +1 -0
- package/dist/{chunk-2VM2FRZJ.js → chunk-EENVXIVU.js} +47 -67
- package/dist/chunk-EENVXIVU.js.map +1 -0
- package/dist/{chunk-YG45DAUT.js → chunk-FONEQRBH.js} +17 -11
- package/dist/chunk-FONEQRBH.js.map +1 -0
- package/dist/chunk-IPXN646P.js +14 -0
- package/dist/chunk-IPXN646P.js.map +1 -0
- package/dist/chunk-IRWSRJ4K.js +48 -0
- package/dist/chunk-IRWSRJ4K.js.map +1 -0
- package/dist/chunk-JMKYYPOF.js +7 -0
- package/dist/{chunk-CJZXR7MG.js.map → chunk-JMKYYPOF.js.map} +1 -1
- package/dist/{chunk-JFQGPY7W.js → chunk-KWEX4ZAF.js} +20 -17
- package/dist/chunk-KWEX4ZAF.js.map +1 -0
- package/dist/{chunk-OKEFO6TI.js → chunk-LQTVTOSY.js} +10 -10
- package/dist/chunk-LQTVTOSY.js.map +1 -0
- package/dist/{chunk-G4KA3SAX.js → chunk-MQPX6ERJ.js} +4 -4
- package/dist/{chunk-G4KA3SAX.js.map → chunk-MQPX6ERJ.js.map} +1 -1
- package/dist/{chunk-FQB24B42.js → chunk-SEWF4O3H.js} +3 -3
- package/dist/{chunk-FQB24B42.js.map → chunk-SEWF4O3H.js.map} +1 -1
- package/dist/{chunk-AXWC3332.js → chunk-TFXJRHJV.js} +3 -3
- package/dist/{chunk-AXWC3332.js.map → chunk-TFXJRHJV.js.map} +1 -1
- package/dist/{chunk-G3HQLQYZ.js → chunk-TQURTLK2.js} +59 -34
- package/dist/chunk-TQURTLK2.js.map +1 -0
- package/dist/{chunk-6XQHH7D2.js → chunk-TRCWINHF.js} +5 -5
- package/dist/{chunk-6XQHH7D2.js.map → chunk-TRCWINHF.js.map} +1 -1
- package/dist/{chunk-NPJCMM6V.js → chunk-VWZIGZFF.js} +4 -4
- package/dist/{chunk-NPJCMM6V.js.map → chunk-VWZIGZFF.js.map} +1 -1
- package/dist/{chunk-HYZ5QMVO.js → chunk-XH3ELPQZ.js} +22 -19
- package/dist/chunk-XH3ELPQZ.js.map +1 -0
- package/dist/{chunk-PPUZJFCI.js → chunk-ZKHD4J73.js} +8 -7
- package/dist/chunk-ZKHD4J73.js.map +1 -0
- package/dist/file-intake/index.js +3 -1
- package/dist/file-intake/index.js.map +1 -1
- package/dist/{index-dQia6NpB.d.ts → index-COwksV6G.d.ts} +699 -199
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -32
- package/dist/index.js.map +1 -1
- package/dist/map/index.js +5 -3
- package/dist/map/index.js.map +1 -1
- package/dist/markdown/index.js +4 -3
- package/dist/markdown/index.js.map +1 -1
- package/dist/page-tabs/index.js +12 -8
- package/dist/page-tabs/index.js.map +1 -1
- package/dist/shell.css +17 -17
- package/dist/themes.css +15 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +17 -13
- package/dist/ui/index.js.map +1 -1
- package/dist/ui.css +691 -283
- package/package.json +1 -1
- package/dist/Browser-F5TKMP4K.js.map +0 -1
- package/dist/Calculator-T3XG7S73.js.map +0 -1
- package/dist/ConfirmDialog-LJXMB45A.js +0 -3
- package/dist/CurrencyConverter-CASQMKLO.js.map +0 -1
- package/dist/Documents-YX67YTZS.js.map +0 -1
- package/dist/Files-QB63GO6J.js.map +0 -1
- package/dist/Notepad-3SUD5XUE.js.map +0 -1
- package/dist/PdfViewer-LSP3YNFC.js +0 -4
- package/dist/PomodoroTimer-4EHD2QC4.js.map +0 -1
- package/dist/Preview-4ZHR4SKP.js.map +0 -1
- package/dist/Sidebar-J76PV4QF.js.map +0 -1
- package/dist/Spreadsheet-G3SC7XJ5.js.map +0 -1
- package/dist/Stock-TLT4VN2R.js.map +0 -1
- package/dist/Weather-FRKX3DAK.js.map +0 -1
- package/dist/WorldClock-GKCITO3M.js.map +0 -1
- package/dist/chunk-2VM2FRZJ.js.map +0 -1
- package/dist/chunk-3CUSBZWG.js +0 -59
- package/dist/chunk-3CUSBZWG.js.map +0 -1
- package/dist/chunk-7KIOEKHS.js.map +0 -1
- package/dist/chunk-CJZXR7MG.js +0 -7
- package/dist/chunk-G3HQLQYZ.js.map +0 -1
- package/dist/chunk-HNH7FOYB.js.map +0 -1
- package/dist/chunk-HYZ5QMVO.js.map +0 -1
- package/dist/chunk-JFQGPY7W.js.map +0 -1
- package/dist/chunk-N3CG5HG5.js.map +0 -1
- package/dist/chunk-OKEFO6TI.js.map +0 -1
- package/dist/chunk-PPUZJFCI.js.map +0 -1
- package/dist/chunk-WK7FV7VV.js.map +0 -1
- package/dist/chunk-YG45DAUT.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/_wasmBytes.ts","../src/apps/_panelActions.tsx","../src/apps/PdfViewer.tsx"],"names":["jsx"],"mappings":";;;;;;;AAoBO,SAAS,gBAAgB,KAAA,EAA4B;AAC1D,EAAA,OACE,MAAM,MAAA,IAAU,CAAA,IAChB,KAAA,CAAM,CAAC,MAAM,CAAA,IACb,KAAA,CAAM,CAAC,CAAA,KAAM,MACb,KAAA,CAAM,CAAC,MAAM,GAAA,IACb,KAAA,CAAM,CAAC,CAAA,KAAM,GAAA;AAEjB;AAMO,SAAS,gBAAgB,KAAA,EAA2B;AACzD,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,CAAA,EAAG,OAAO,mBAAA;AAC/B,EAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,KAAA,CAAM,SAAS,CAAA,EAAG,EAAE,CAAC,CAAA,CAC1C,GAAA,CAAI,CAAA,CAAA,KAAM,KAAK,EAAA,IAAQ,CAAA,GAAI,MAAO,MAAA,CAAO,YAAA,CAAa,CAAC,CAAA,GAAI,GAAI,CAAA,CAC/D,IAAA,CAAK,EAAE,CAAA;AACV,EAAA,OAAO,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,iBAAA,EAAoB,IAAI,CAAA,CAAA,CAAA;AAChD;AAKO,SAAS,cAAA,CAAe,IAAA,EAAc,QAAA,EAAkB,KAAA,EAA0B;AACvF,EAAA,OAAO,IAAI,KAAA;AAAA,IACT,oBAAoB,IAAI,CAAA,kCAAA,EACnB,gBAAgB,KAAK,CAAC,gCAAgC,QAAQ,CAAA,+JAAA;AAAA,GAIrE;AACF;ACnCO,IAAM,kBAAA,GAAqB,cAAkC,IAAI;AAEjE,SAAS,YAAA,CAAa,EAAE,QAAA,EAAS,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,EACb,QAAA,EAAA;AAAA,4BAAAA,GAAAA,CAAC,QAAA,EAAA,EAAO,GAAA,EAAK,SAAA,EAAW,WAAU,eAAA,EAAgB,CAAA;AAAA,4BAClDA,GAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,GAAA,EAAK,YAAA;AAAA,gBACL,SAAA,EAAU,uBAAA;AAAA,gBACV,eAAe,CAAA,CAAA,KAAK,CAAA,CAAE,aAAA,CAAc,SAAA,CAAU,IAAI,WAAW;AAAA;AAAA;AAC/D,WAAA,EACF;AAAA,SAAA,EACF;AAAA;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ","file":"chunk-FQB24B42.js","sourcesContent":["/**\n * Is what came back over the wire actually a WebAssembly module?\n *\n * `Preview`'s wasm factory used to accept any `res.ok` response. That is not\n * enough on a single-page app: an SPA host answers a path its router does not\n * recognise with its own index.html under HTTP 200, so a build that failed to\n * emit a decoder returns a PAGE rather than a 404 (confirmed against the live\n * console on 2026-08-30 — both `/assets/jbig2.wasm` and a made-up asset path\n * answered 200 with `content-type: text/html`). pdf.js then instantiates the\n * page inside a `try` that only warns before dropping to its JS fallback, which\n * is the same quiet degrading the factory was added to remove — except now\n * nothing in the console points at the emit as the cause.\n *\n * This module is deliberately free of React and of pdfjs-dist so it can be\n * driven directly from a spec. Importing `Preview.tsx` in a Node test is not\n * possible: pdfjs builds a `new DOMMatrix()` at module scope and throws.\n */\n\n/** Every WebAssembly module opens with the four bytes `\\0asm`. Anything else —\n * an HTML fallback page, most often — is not one. */\nexport function hasWasmPreamble(bytes: Uint8Array): boolean {\n return (\n bytes.length >= 4 &&\n bytes[0] === 0x00 &&\n bytes[1] === 0x61 &&\n bytes[2] === 0x73 &&\n bytes[3] === 0x6d\n );\n}\n\n/** A short, safe description of what arrived instead, for the error message.\n * The opening bytes of an HTML page name the problem far better than a length\n * does, so they are worth quoting; the cap keeps a stray binary out of the\n * console. */\nexport function describeNonWasm(bytes: Uint8Array): string {\n if (bytes.length === 0) return 'an empty response';\n const head = Array.from(bytes.subarray(0, 24))\n .map(b => (b >= 0x20 && b < 0x7f ? String.fromCharCode(b) : '.'))\n .join('');\n return `${bytes.length} bytes starting \"${head}\"`;\n}\n\n/** The message a developer reads when the emit went missing. It has to name the\n * emit, because the symptom they are looking at is a preview that renders\n * everything except the scanned page, with a silent console. */\nexport function wasmBytesError(href: string, filename: string, bytes: Uint8Array): Error {\n return new Error(\n `The response for ${href} is not a WebAssembly module (got ` +\n `${describeNonWasm(bytes)}). The bundler did not emit \"${filename}\" as ` +\n `an asset, and the host answered with a fallback page instead of a 404. ` +\n `Serve pdfjs-dist/wasm/ yourself and point ` +\n `window.__REACT_OS_SHELL_PDF_WASM__ at it.`,\n );\n}\n","/**\n * Where a format panel's toolbar buttons go.\n *\n * Inside the Preview window there is one toolbar row — Open, the filename,\n * then a slot at its right end — and each panel (PDF, DXF, 3D, image) portals\n * its own page nav / zoom / layer / download buttons into that slot rather\n * than stacking a second row under it. `ToolbarSlotContext` carries the slot\n * element down.\n *\n * Outside Preview there is no slot, and there is no outer toolbar to merge\n * with either: an embedded `PdfViewer` is the whole widget. So the fallback\n * renders the buttons in place as the panel's own toolbar. It used to return\n * `null`, which was right while every panel lived in a window and wrong the\n * moment one did not — an embedded viewer with no page nav and no zoom.\n */\nimport { createContext, useContext } from 'react';\nimport { createPortal } from 'react-dom';\n\nexport const ToolbarSlotContext = createContext<HTMLElement | null>(null);\n\nexport function PanelActions({ children }: { children: React.ReactNode }) {\n const slot = useContext(ToolbarSlotContext);\n if (slot) return createPortal(children, slot);\n return (\n <div className=\"flex shrink-0 items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs\">\n {children}\n </div>\n );\n}\n","/**\n * PdfViewer — the pdf.js reader, on its own so it can be embedded.\n *\n * It was the Preview window's private `PdfPanel` until a consumer needed a PDF\n * inside a dialog rather than in a window of its own. The two consumers that\n * needed one had each reached for `<iframe src={blobUrl}>`, which hands the\n * page to the BROWSER's built-in plugin: its own toolbar, a ~250px thumbnail\n * rail, and its own idea of the zoom — roughly a third of an already small\n * pane spent on chrome nobody asked for, and a portrait page cropped at the\n * fold. Nothing about that is themeable or testable, and it is not this\n * package's viewer.\n *\n * Import it lazily (`react-os-shell/apps` exports it wrapped in `lazy`, like\n * the other document apps) and render it inside a `<Suspense>`: the static\n * `pdfjs-dist` import below must not reach a host's startup bundle. Give it a\n * parent with a resolved height — it fills its container and scrolls inside.\n */\nimport { useState, useEffect, useRef } from 'react';\nimport * as pdfjsLib from 'pdfjs-dist';\nimport toast from '../shell/toast';\nimport { hasWasmPreamble, wasmBytesError } from './_wasmBytes';\nimport { PanelActions } from './_panelActions';\n\n// Default the worker to the matching unpkg build (mirrors the consumer's\n// installed npm version exactly). Consumers can override by setting\n// pdfjsLib.GlobalWorkerOptions.workerSrc themselves before this module loads.\nif (typeof window !== 'undefined' && !pdfjsLib.GlobalWorkerOptions.workerSrc) {\n pdfjsLib.GlobalWorkerOptions.workerSrc =\n `https://unpkg.com/pdfjs-dist@${pdfjsLib.version}/build/pdf.worker.min.mjs`;\n}\n\n// pdf.js does not ship its JBIG2 and JPEG 2000 decoders as JavaScript any\n// more: both are WebAssembly modules it loads at decode time, and it will only\n// load them from a location the caller supplies. With neither `wasmUrl` nor a\n// `BinaryDataFactory` configured — this package's state until now — the\n// decoder asks for one, pdf.js's own base factory throws \"Ensure that the\n// `wasmUrl` API parameter is provided\", and the worker swallows that as a\n// `warn()`. The page still renders; the scanned or JPEG-2000 image on it is\n// just missing. Nothing reaches the user, which is why it went unnoticed.\n//\n// The fix follows the mechanism the admin portal already uses for the pdf\n// WORKER (`import ... from 'pdfjs-dist/build/pdf.worker.min.mjs?url'`, which\n// Vite emits as /assets/pdf.worker.min-<hash>.mjs): let the CONSUMER'S bundler\n// emit the file and hand pdf.js the URL it produced. `new URL(spec,\n// import.meta.url)` is the bundler-neutral spelling of that — Vite resolves\n// the bare specifier and emits the binary as its own hashed asset (verified on\n// Vite 5 and 7), and a bundler that does not understand the form leaves it\n// alone and lands back on today's warn-and-degrade rather than on an error.\n//\n// The specifier points at the CONSUMER'S installed `pdfjs-dist`, not at a copy\n// vendored into this package. That is deliberate: these binaries are built\n// alongside the worker that instantiates them, and a vendored copy would pin\n// them to THIS package's devDependency instead of to the peer they actually\n// run against.\nconst PDF_WASM_MODULES: Record<string, string> = {\n 'jbig2.wasm': new URL('pdfjs-dist/wasm/jbig2.wasm', import.meta.url).href,\n 'openjpeg.wasm': new URL('pdfjs-dist/wasm/openjpeg.wasm', import.meta.url).href,\n};\n\n/** pdf.js instantiates this itself (it is passed to `getDocument` as a class,\n * not an instance) and calls `fetch` once per binary it needs.\n *\n * Only the `wasmUrl` kind is served. cMap and standard-font data are the other\n * two kinds pdf.js can ask for, and this package has never configured a URL\n * for either — so those keep the exact message pdf.js's own base factory\n * raises for an unconfigured URL, and behave as they always have. */\nclass BundledPdfWasmFactory {\n async fetch({ kind, filename }: { kind: string; filename: string }): Promise<Uint8Array> {\n if (kind !== 'wasmUrl') {\n throw new Error(`Ensure that the \\`${kind}\\` API parameter is provided.`);\n }\n const href = PDF_WASM_MODULES[filename];\n if (!href) {\n throw new Error(`No bundled pdf.js wasm module for \"${filename}\".`);\n }\n const res = await fetch(href);\n if (!res.ok) {\n throw new Error(`Unable to load wasm data at: ${href}`);\n }\n // A 200 is not proof the bundler emitted the binary — see _wasmBytes.ts.\n const bytes = new Uint8Array(await res.arrayBuffer());\n if (!hasWasmPreamble(bytes)) {\n throw wasmBytesError(href, filename, bytes);\n }\n return bytes;\n }\n}\n\n/** The `getDocument` parameters that give pdf.js somewhere to load its wasm\n * decoders from.\n *\n * A consumer that serves the whole `pdfjs-dist/wasm/` directory itself (copied\n * into `public/`, say, or on an air-gapped host) points us at it with\n * `window.__REACT_OS_SHELL_PDF_WASM__` — same escape hatch as\n * `__REACT_OS_SHELL_O3DV_LIBS__` below. pdf.js requires a trailing slash on\n * that value and throws \"Invalid factory url\" without one, so add it here\n * rather than making every consumer remember. Everyone else gets the\n * bundler-emitted modules and configures nothing. */\nfunction pdfWasmParams(): { wasmUrl?: string; BinaryDataFactory?: object } {\n const dir = typeof window !== 'undefined'\n ? (window as unknown as { __REACT_OS_SHELL_PDF_WASM__?: unknown }).__REACT_OS_SHELL_PDF_WASM__\n : undefined;\n if (typeof dir === 'string' && dir) {\n return { wasmUrl: dir.endsWith('/') ? dir : `${dir}/` };\n }\n return { BinaryDataFactory: BundledPdfWasmFactory };\n}\n\nexport interface PdfViewerProps {\n /** Object URL or remote URL of the PDF. */\n url: string;\n /** Display name — also the filename the built-in Download uses. */\n filename: string;\n /**\n * What the auto-fit scale tracks until the reader picks a manual zoom.\n *\n * `'width'` fills the container's width and lets a tall page scroll — right\n * for a viewer that owns a whole window, and what the Preview app uses.\n * `'page'` fits the WHOLE page, which is what an embedded preview pane\n * wants: someone checking a document before sending it needs to see that it\n * is the right document, and a page cropped at the fold reads as broken.\n */\n fit?: 'width' | 'page';\n /** Replaces the built-in \"save `url` as `filename`\" download. */\n onDownload?: () => void;\n /** An Email button joins the toolbar only when this is supplied. */\n onEmail?: () => void;\n}\n\nconst ZOOM_PRESETS = [50, 75, 100, 125, 150, 200, 300, 400];\n\n/** The `p-4` gutter the page sits in, on both axes. */\nconst PAGE_GUTTER = 40;\nconst MIN_SCALE = 0.3;\nconst MAX_SCALE = 4;\n\n/**\n * The scale auto-fit lands on.\n *\n * @internal Exported for the spec. The effect that calls it needs a rendered\n * document and a laid-out container to reach, and the wrong answer here does\n * not throw — it crops the page at the fold, which reads as a broken preview\n * rather than as a bug in a formula.\n */\nexport function fitScale(\n fit: 'width' | 'page',\n container: { width: number; height: number },\n page: { width: number; height: number },\n): number {\n const byWidth = (container.width - PAGE_GUTTER) / page.width;\n // Fitting the PAGE means neither axis may overflow, so take whichever\n // constraint binds first. Width alone is what crops a portrait page in a\n // pane wider than it is tall.\n const wanted = fit === 'page'\n ? Math.min(byWidth, (container.height - PAGE_GUTTER) / page.height)\n : byWidth;\n return Math.min(Math.max(wanted, MIN_SCALE), MAX_SCALE);\n}\n\n// Trimmed copy of pdf.js's text-layer rules (pdf_viewer.css), under our own\n// class name so a consumer that loads the full viewer CSS doesn't\n// double-apply. The layer is a sheet of transparent spans positioned over\n// the canvas glyphs — that's what makes the rendered page selectable. Span\n// positions are % of page size; font-size derives from\n// --total-scale-factor, which the render effect sets to the viewport scale.\n// The .endOfContent sentinel plus the .selecting toggle keep a\n// drag-selection alive between lines and past the last line (same trick as\n// pdf.js's own TextLayerBuilder).\nconst TEXT_LAYER_CSS = `\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role=\"img\"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n`;\n\nexport default function PdfViewer({ url, filename, fit = 'width', onDownload, onEmail }: PdfViewerProps) {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const textLayerRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const [pdf, setPdf] = useState<pdfjsLib.PDFDocumentProxy | null>(null);\n const [page, setPage] = useState(1);\n const [totalPages, setTotalPages] = useState(0);\n const [scale, setScale] = useState(1);\n // Fit mode is the default — scale stays auto-tracking the container width\n // until the user picks a manual zoom (− / + / dropdown). Re-armed by the\n // Fit toolbar button.\n const [fitMode, setFitMode] = useState(true);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n let cancelled = false;\n setLoading(true);\n // A new document starts at its first page. The page number belongs to the\n // document being read, not to the viewer, and it used to survive a change\n // of `url`: sitting on page 3 and being handed a one-page document asked\n // pdf.js for a page that does not exist, and the canvas went blank with\n // nothing thrown. The Preview window never saw it because it keys its\n // panels by url, but an embedder that re-renders one viewer with a new\n // document — a preview pane next to the options that regenerate it — is\n // exactly the shape this component was extracted for.\n //\n // Reset before the fetch, not in its `.then`: the manual page controls are\n // live while a document loads, and a reset that landed afterwards would\n // undo a page the reader had already picked.\n //\n // Zoom is deliberately NOT reset. It is the reader's own preference for\n // how large they want text, and it holds across documents the way it does\n // in every reader; only the page is a fact about the file.\n setPage(1);\n // Parameter-object form, not the bare string: pdfjs-dist 6.x removed the\n // string overload (\"expected either `data`, `range`, or `url` parameter\"),\n // so a consumer on 6.x had every preview die on this line. The object form\n // works on 5.x too. tests/pdfjsContract.test.ts fails if it reverts.\n pdfjsLib.getDocument({ url, ...pdfWasmParams() }).promise.then(doc => {\n if (cancelled) return;\n setPdf(doc);\n setTotalPages(doc.numPages);\n setLoading(false);\n }).catch(() => {\n if (!cancelled) { toast.error('Failed to load PDF'); setLoading(false); }\n });\n return () => { cancelled = true; };\n }, [url]);\n\n // Auto-fit: re-compute scale from the container whenever fit mode is on, the\n // document changes, the page changes, or the container resizes. Window\n // resize and Modal drag-resize both trigger ResizeObserver. Manual zoom\n // turns this off until the user clicks Fit again.\n useEffect(() => {\n if (!pdf || !fitMode || !containerRef.current) return;\n const recompute = () => {\n const el = containerRef.current;\n if (!el) return;\n pdf.getPage(page).then(p => {\n if (!containerRef.current) return;\n const viewport = p.getViewport({ scale: 1 });\n const next = fitScale(\n fit,\n { width: el.clientWidth, height: el.clientHeight },\n { width: viewport.width, height: viewport.height },\n );\n setScale(prev => (Math.abs(prev - next) < 0.005 ? prev : next));\n });\n };\n recompute();\n const ro = new ResizeObserver(recompute);\n ro.observe(containerRef.current);\n return () => ro.disconnect();\n }, [pdf, page, fitMode, fit]);\n\n useEffect(() => {\n if (!pdf || !canvasRef.current) return;\n let cancelled = false;\n let task: { cancel: () => void; promise: Promise<void> } | null = null;\n let textLayer: pdfjsLib.TextLayer | null = null;\n pdf.getPage(page).then(p => {\n if (cancelled || !canvasRef.current) return;\n const viewport = p.getViewport({ scale });\n const canvas = canvasRef.current;\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n // Lock the displayed (CSS) size to the viewport. pdf.js stamps inline\n // style.width/height on render and inline values stick across re-renders\n // even when canvas.width shrinks — without this, zoom changes only\n // affect resolution, not visible size.\n canvas.style.width = `${viewport.width}px`;\n canvas.style.height = `${viewport.height}px`;\n const ctx = canvas.getContext('2d')!;\n task = p.render({ canvas, canvasContext: ctx, viewport });\n task.promise.catch(() => {});\n // Selectable text layer — transparent spans over the canvas glyphs.\n // Rebuilt per page/zoom render; pdf.js reads --total-scale-factor for\n // span font-size and the container's own width/height.\n const textEl = textLayerRef.current;\n if (textEl) {\n textEl.replaceChildren();\n textEl.style.setProperty('--total-scale-factor', String(viewport.scale));\n textLayer = new pdfjsLib.TextLayer({\n textContentSource: p.streamTextContent(),\n container: textEl,\n viewport,\n });\n textLayer.render().then(() => {\n if (cancelled) return;\n const end = document.createElement('div');\n end.className = 'endOfContent';\n textEl.append(end);\n }).catch(() => {});\n }\n });\n return () => {\n cancelled = true;\n task?.cancel();\n textLayer?.cancel();\n };\n }, [pdf, page, scale]);\n\n // End a selection drag wherever the pointer is released — the .selecting\n // class is added on pointerdown in the layer itself (see JSX below).\n useEffect(() => {\n const up = () => textLayerRef.current?.classList.remove('selecting');\n window.addEventListener('pointerup', up);\n return () => window.removeEventListener('pointerup', up);\n }, []);\n\n const handlePrint = () => {\n if (!pdf) return;\n const win = window.open('', '_blank');\n if (!win) { toast.error('Allow popups to print'); return; }\n const promises: Promise<string>[] = [];\n for (let i = 1; i <= totalPages; i++) {\n promises.push(pdf.getPage(i).then(p => {\n const vp = p.getViewport({ scale: 2 });\n const c = document.createElement('canvas');\n c.width = vp.width; c.height = vp.height;\n return p.render({ canvas: c, canvasContext: c.getContext('2d')!, viewport: vp }).promise.then(() => c.toDataURL());\n }));\n }\n Promise.all(promises).then(images => {\n win.document.write(`<html><head><title>${filename}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`);\n win.document.write(images.map(src => `<img src=\"${src}\"/>`).join(''));\n win.document.write('</body></html>');\n win.document.close();\n setTimeout(() => { win.print(); win.close(); }, 300);\n });\n };\n\n const handleDefaultDownload = () => {\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n a.click();\n };\n\n // Re-arm fit mode. The auto-fit effect picks the new scale on its next\n // tick once `fitMode` flips to true.\n const reFit = () => setFitMode(true);\n const fitLabel = fit === 'page' ? 'Fit page' : 'Fit width';\n\n // Wheel and keyboard page navigation. Only takes the wheel event when\n // the container is at the top/bottom edge — otherwise normal scroll\n // moves through a tall page first, matching native PDF readers.\n const onWheelPage = (e: React.WheelEvent<HTMLDivElement>) => {\n if (!pdf) return;\n if (e.ctrlKey || e.metaKey) return; // browser-zoom shortcut, leave alone\n const el = containerRef.current;\n if (!el) return;\n const atTop = el.scrollTop <= 0;\n const atBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - 1;\n if (e.deltaY > 0 && atBottom && page < totalPages) {\n e.preventDefault();\n setPage(p => Math.min(totalPages, p + 1));\n // Land at the top of the next page so wheel-down keeps reading\n // forward. requestAnimationFrame so the canvas has a tick to\n // resize before we scroll.\n requestAnimationFrame(() => { if (containerRef.current) containerRef.current.scrollTop = 0; });\n } else if (e.deltaY < 0 && atTop && page > 1) {\n e.preventDefault();\n setPage(p => Math.max(1, p - 1));\n requestAnimationFrame(() => {\n if (containerRef.current) containerRef.current.scrollTop = containerRef.current.scrollHeight;\n });\n }\n };\n const onKeyPage = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!pdf) return;\n // Ignore keyboard nav when an input/textarea has focus.\n const tag = (document.activeElement?.tagName || '').toLowerCase();\n if (tag === 'input' || tag === 'textarea' || (document.activeElement as HTMLElement)?.isContentEditable) return;\n if (e.key === 'PageDown' || e.key === 'ArrowRight') {\n if (page < totalPages) { e.preventDefault(); setPage(p => Math.min(totalPages, p + 1)); }\n } else if (e.key === 'PageUp' || e.key === 'ArrowLeft') {\n if (page > 1) { e.preventDefault(); setPage(p => Math.max(1, p - 1)); }\n } else if (e.key === 'Home') {\n e.preventDefault(); setPage(1);\n } else if (e.key === 'End') {\n e.preventDefault(); setPage(totalPages);\n }\n };\n\n const btn = 'px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1';\n\n return (\n <div className=\"flex flex-col h-full\">\n <PanelActions>\n <button aria-label=\"Previous page\" onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page <= 1} className=\"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600\">\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M15.75 19.5L8.25 12l7.5-7.5\" /></svg>\n </button>\n <span className=\"text-gray-600 font-medium tabular-nums\">{page} / {totalPages}</span>\n <button aria-label=\"Next page\" onClick={() => setPage(p => Math.min(totalPages, p + 1))} disabled={page >= totalPages} className=\"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600\">\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8.25 4.5l7.5 7.5-7.5 7.5\" /></svg>\n </button>\n <div className=\"h-4 w-px bg-gray-300 mx-1\" />\n <button\n onClick={() => { setFitMode(false); setScale(s => Math.max(0.3, Math.round((s - 0.25) * 100) / 100)); }}\n className={btn}\n >−</button>\n <select\n value={fitMode ? 'fit' : (ZOOM_PRESETS.includes(Math.round(scale * 100)) ? Math.round(scale * 100) : 'custom')}\n onChange={e => {\n const v = e.target.value;\n if (v === 'fit') { setFitMode(true); return; }\n if (v !== 'custom') { setFitMode(false); setScale(Number(v) / 100); }\n }}\n className=\"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400\"\n title=\"Zoom\"\n >\n <option value=\"fit\">{fitLabel}</option>\n {!fitMode && !ZOOM_PRESETS.includes(Math.round(scale * 100)) && (\n <option value=\"custom\">{Math.round(scale * 100)}%</option>\n )}\n {ZOOM_PRESETS.map(p => <option key={p} value={p}>{p}%</option>)}\n </select>\n <button\n onClick={() => { setFitMode(false); setScale(s => Math.min(4, Math.round((s + 0.25) * 100) / 100)); }}\n className={btn}\n >+</button>\n <button\n onClick={reFit}\n className={btn + (fitMode ? ' bg-gray-200 text-gray-900' : '')}\n title={`${fitLabel} — auto-tracks the container size until you zoom manually`}\n >Fit</button>\n <div className=\"h-4 w-px bg-gray-300 mx-1\" />\n <button onClick={handlePrint} className={btn}>\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z\" /></svg>\n Print\n </button>\n <button onClick={onDownload ?? handleDefaultDownload} className={btn}>\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3\" /></svg>\n Download\n </button>\n {onEmail && (\n <button onClick={onEmail} className={btn}>\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75\" /></svg>\n Email\n </button>\n )}\n </PanelActions>\n\n <div\n ref={containerRef}\n className=\"flex-1 overflow-auto bg-gray-100 outline-none\"\n // tabIndex makes the scroll container itself focusable so PageUp /\n // PageDown / Arrow keys are captured even when no inner element\n // has focus (e.g. right after the panel mounts). Wheel handler\n // page-flips when the user reaches the top/bottom of a long page.\n tabIndex={0}\n onWheel={onWheelPage}\n onKeyDown={onKeyPage}\n >\n {loading ? (\n <div className=\"flex items-center justify-center h-full text-gray-400 text-sm\">Loading PDF...</div>\n ) : (\n <div className=\"min-h-full flex items-center justify-center p-4\">\n <style>{TEXT_LAYER_CSS}</style>\n <div className=\"relative shadow-lg rounded\">\n <canvas ref={canvasRef} className=\"block rounded\" />\n <div\n ref={textLayerRef}\n className=\"preview-pdf-textlayer\"\n onPointerDown={e => e.currentTarget.classList.add('selecting')}\n />\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/apps/_wasmBytes.ts","../src/apps/_panelActions.tsx","../src/apps/PdfViewer.tsx"],"names":["jsx"],"mappings":";;;;;;;AAoBO,SAAS,gBAAgB,KAAA,EAA4B;AAC1D,EAAA,OACE,MAAM,MAAA,IAAU,CAAA,IAChB,KAAA,CAAM,CAAC,MAAM,CAAA,IACb,KAAA,CAAM,CAAC,CAAA,KAAM,MACb,KAAA,CAAM,CAAC,MAAM,GAAA,IACb,KAAA,CAAM,CAAC,CAAA,KAAM,GAAA;AAEjB;AAMO,SAAS,gBAAgB,KAAA,EAA2B;AACzD,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,CAAA,EAAG,OAAO,mBAAA;AAC/B,EAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,KAAA,CAAM,SAAS,CAAA,EAAG,EAAE,CAAC,CAAA,CAC1C,GAAA,CAAI,CAAA,CAAA,KAAM,KAAK,EAAA,IAAQ,CAAA,GAAI,MAAO,MAAA,CAAO,YAAA,CAAa,CAAC,CAAA,GAAI,GAAI,CAAA,CAC/D,IAAA,CAAK,EAAE,CAAA;AACV,EAAA,OAAO,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,iBAAA,EAAoB,IAAI,CAAA,CAAA,CAAA;AAChD;AAKO,SAAS,cAAA,CAAe,IAAA,EAAc,QAAA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U,+DAAA,EAAgE,QAAA,EAAA,gBAAA,EAAc,CAAA,mBAE7F,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,iDAAA,EACb,QAAA,EAAA;AAAA,0BAAAA,GAAAA,CAAC,WAAO,QAAA,EAAA,cAAA,EAAe,CAAA;AAAA,0BACvB,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4BAAA,EACb,QAAA,EAAA;AAAA,4BAAAA,GAAAA,CAAC,QAAA,EAAA,EAAO,GAAA,EAAK,SAAA,EAAW,WAAU,eAAA,EAAgB,CAAA;AAAA,4BAClDA,GAAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,GAAA,EAAK,YAAA;AAAA,gBACL,SAAA,EAAU,uBAAA;AAAA,gBACV,eAAe,CAAA,CAAA,KAAK,CAAA,CAAE,aAAA,CAAc,SAAA,CAAU,IAAI,WAAW;AAAA;AAAA;AAC/D,WAAA,EACF;AAAA,SAAA,EACF;AAAA;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ","file":"chunk-SEWF4O3H.js","sourcesContent":["/**\n * Is what came back over the wire actually a WebAssembly module?\n *\n * `Preview`'s wasm factory used to accept any `res.ok` response. That is not\n * enough on a single-page app: an SPA host answers a path its router does not\n * recognise with its own index.html under HTTP 200, so a build that failed to\n * emit a decoder returns a PAGE rather than a 404 (confirmed against the live\n * console on 2026-08-30 — both `/assets/jbig2.wasm` and a made-up asset path\n * answered 200 with `content-type: text/html`). pdf.js then instantiates the\n * page inside a `try` that only warns before dropping to its JS fallback, which\n * is the same quiet degrading the factory was added to remove — except now\n * nothing in the console points at the emit as the cause.\n *\n * This module is deliberately free of React and of pdfjs-dist so it can be\n * driven directly from a spec. Importing `Preview.tsx` in a Node test is not\n * possible: pdfjs builds a `new DOMMatrix()` at module scope and throws.\n */\n\n/** Every WebAssembly module opens with the four bytes `\\0asm`. Anything else —\n * an HTML fallback page, most often — is not one. */\nexport function hasWasmPreamble(bytes: Uint8Array): boolean {\n return (\n bytes.length >= 4 &&\n bytes[0] === 0x00 &&\n bytes[1] === 0x61 &&\n bytes[2] === 0x73 &&\n bytes[3] === 0x6d\n );\n}\n\n/** A short, safe description of what arrived instead, for the error message.\n * The opening bytes of an HTML page name the problem far better than a length\n * does, so they are worth quoting; the cap keeps a stray binary out of the\n * console. */\nexport function describeNonWasm(bytes: Uint8Array): string {\n if (bytes.length === 0) return 'an empty response';\n const head = Array.from(bytes.subarray(0, 24))\n .map(b => (b >= 0x20 && b < 0x7f ? String.fromCharCode(b) : '.'))\n .join('');\n return `${bytes.length} bytes starting \"${head}\"`;\n}\n\n/** The message a developer reads when the emit went missing. It has to name the\n * emit, because the symptom they are looking at is a preview that renders\n * everything except the scanned page, with a silent console. */\nexport function wasmBytesError(href: string, filename: string, bytes: Uint8Array): Error {\n return new Error(\n `The response for ${href} is not a WebAssembly module (got ` +\n `${describeNonWasm(bytes)}). The bundler did not emit \"${filename}\" as ` +\n `an asset, and the host answered with a fallback page instead of a 404. ` +\n `Serve pdfjs-dist/wasm/ yourself and point ` +\n `window.__REACT_OS_SHELL_PDF_WASM__ at it.`,\n );\n}\n","/**\n * Where a format panel's toolbar buttons go.\n *\n * Inside the Preview window there is one toolbar row — Open, the filename,\n * then a slot at its right end — and each panel (PDF, DXF, 3D, image) portals\n * its own page nav / zoom / layer / download buttons into that slot rather\n * than stacking a second row under it. `ToolbarSlotContext` carries the slot\n * element down.\n *\n * Outside Preview there is no slot, and there is no outer toolbar to merge\n * with either: an embedded `PdfViewer` is the whole widget. So the fallback\n * renders the buttons in place as the panel's own toolbar. It used to return\n * `null`, which was right while every panel lived in a window and wrong the\n * moment one did not — an embedded viewer with no page nav and no zoom.\n */\nimport { createContext, useContext } from 'react';\nimport { createPortal } from 'react-dom';\n\nexport const ToolbarSlotContext = createContext<HTMLElement | null>(null);\n\nexport function PanelActions({ children }: { children: React.ReactNode }) {\n const slot = useContext(ToolbarSlotContext);\n if (slot) return createPortal(children, slot);\n return (\n <div className=\"flex shrink-0 items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs\">\n {children}\n </div>\n );\n}\n","/**\n * PdfViewer — the pdf.js reader, on its own so it can be embedded.\n *\n * It was the Preview window's private `PdfPanel` until a consumer needed a PDF\n * inside a dialog rather than in a window of its own. The two consumers that\n * needed one had each reached for `<iframe src={blobUrl}>`, which hands the\n * page to the BROWSER's built-in plugin: its own toolbar, a ~250px thumbnail\n * rail, and its own idea of the zoom — roughly a third of an already small\n * pane spent on chrome nobody asked for, and a portrait page cropped at the\n * fold. Nothing about that is themeable or testable, and it is not this\n * package's viewer.\n *\n * Import it lazily (`react-os-shell/apps` exports it wrapped in `lazy`, like\n * the other document apps) and render it inside a `<Suspense>`: the static\n * `pdfjs-dist` import below must not reach a host's startup bundle. Give it a\n * parent with a resolved height — it fills its container and scrolls inside.\n */\nimport { useState, useEffect, useRef } from 'react';\nimport * as pdfjsLib from 'pdfjs-dist';\nimport toast from '../shell/toast';\nimport { hasWasmPreamble, wasmBytesError } from './_wasmBytes';\nimport { PanelActions } from './_panelActions';\n\n// Default the worker to the matching unpkg build (mirrors the consumer's\n// installed npm version exactly). Consumers can override by setting\n// pdfjsLib.GlobalWorkerOptions.workerSrc themselves before this module loads.\nif (typeof window !== 'undefined' && !pdfjsLib.GlobalWorkerOptions.workerSrc) {\n pdfjsLib.GlobalWorkerOptions.workerSrc =\n `https://unpkg.com/pdfjs-dist@${pdfjsLib.version}/build/pdf.worker.min.mjs`;\n}\n\n// pdf.js does not ship its JBIG2 and JPEG 2000 decoders as JavaScript any\n// more: both are WebAssembly modules it loads at decode time, and it will only\n// load them from a location the caller supplies. With neither `wasmUrl` nor a\n// `BinaryDataFactory` configured — this package's state until now — the\n// decoder asks for one, pdf.js's own base factory throws \"Ensure that the\n// `wasmUrl` API parameter is provided\", and the worker swallows that as a\n// `warn()`. The page still renders; the scanned or JPEG-2000 image on it is\n// just missing. Nothing reaches the user, which is why it went unnoticed.\n//\n// The fix follows the mechanism the admin portal already uses for the pdf\n// WORKER (`import ... from 'pdfjs-dist/build/pdf.worker.min.mjs?url'`, which\n// Vite emits as /assets/pdf.worker.min-<hash>.mjs): let the CONSUMER'S bundler\n// emit the file and hand pdf.js the URL it produced. `new URL(spec,\n// import.meta.url)` is the bundler-neutral spelling of that — Vite resolves\n// the bare specifier and emits the binary as its own hashed asset (verified on\n// Vite 5 and 7), and a bundler that does not understand the form leaves it\n// alone and lands back on today's warn-and-degrade rather than on an error.\n//\n// The specifier points at the CONSUMER'S installed `pdfjs-dist`, not at a copy\n// vendored into this package. That is deliberate: these binaries are built\n// alongside the worker that instantiates them, and a vendored copy would pin\n// them to THIS package's devDependency instead of to the peer they actually\n// run against.\nconst PDF_WASM_MODULES: Record<string, string> = {\n 'jbig2.wasm': new URL('pdfjs-dist/wasm/jbig2.wasm', import.meta.url).href,\n 'openjpeg.wasm': new URL('pdfjs-dist/wasm/openjpeg.wasm', import.meta.url).href,\n};\n\n/** pdf.js instantiates this itself (it is passed to `getDocument` as a class,\n * not an instance) and calls `fetch` once per binary it needs.\n *\n * Only the `wasmUrl` kind is served. cMap and standard-font data are the other\n * two kinds pdf.js can ask for, and this package has never configured a URL\n * for either — so those keep the exact message pdf.js's own base factory\n * raises for an unconfigured URL, and behave as they always have. */\nclass BundledPdfWasmFactory {\n async fetch({ kind, filename }: { kind: string; filename: string }): Promise<Uint8Array> {\n if (kind !== 'wasmUrl') {\n throw new Error(`Ensure that the \\`${kind}\\` API parameter is provided.`);\n }\n const href = PDF_WASM_MODULES[filename];\n if (!href) {\n throw new Error(`No bundled pdf.js wasm module for \"${filename}\".`);\n }\n const res = await fetch(href);\n if (!res.ok) {\n throw new Error(`Unable to load wasm data at: ${href}`);\n }\n // A 200 is not proof the bundler emitted the binary — see _wasmBytes.ts.\n const bytes = new Uint8Array(await res.arrayBuffer());\n if (!hasWasmPreamble(bytes)) {\n throw wasmBytesError(href, filename, bytes);\n }\n return bytes;\n }\n}\n\n/** The `getDocument` parameters that give pdf.js somewhere to load its wasm\n * decoders from.\n *\n * A consumer that serves the whole `pdfjs-dist/wasm/` directory itself (copied\n * into `public/`, say, or on an air-gapped host) points us at it with\n * `window.__REACT_OS_SHELL_PDF_WASM__` — same escape hatch as\n * `__REACT_OS_SHELL_O3DV_LIBS__` below. pdf.js requires a trailing slash on\n * that value and throws \"Invalid factory url\" without one, so add it here\n * rather than making every consumer remember. Everyone else gets the\n * bundler-emitted modules and configures nothing. */\nfunction pdfWasmParams(): { wasmUrl?: string; BinaryDataFactory?: object } {\n const dir = typeof window !== 'undefined'\n ? (window as unknown as { __REACT_OS_SHELL_PDF_WASM__?: unknown }).__REACT_OS_SHELL_PDF_WASM__\n : undefined;\n if (typeof dir === 'string' && dir) {\n return { wasmUrl: dir.endsWith('/') ? dir : `${dir}/` };\n }\n return { BinaryDataFactory: BundledPdfWasmFactory };\n}\n\nexport interface PdfViewerProps {\n /** Object URL or remote URL of the PDF. */\n url: string;\n /** Display name — also the filename the built-in Download uses. */\n filename: string;\n /**\n * What the auto-fit scale tracks until the reader picks a manual zoom.\n *\n * `'width'` fills the container's width and lets a tall page scroll — right\n * for a viewer that owns a whole window, and what the Preview app uses.\n * `'page'` fits the WHOLE page, which is what an embedded preview pane\n * wants: someone checking a document before sending it needs to see that it\n * is the right document, and a page cropped at the fold reads as broken.\n */\n fit?: 'width' | 'page';\n /** Replaces the built-in \"save `url` as `filename`\" download. */\n onDownload?: () => void;\n /** An Email button joins the toolbar only when this is supplied. */\n onEmail?: () => void;\n}\n\nconst ZOOM_PRESETS = [50, 75, 100, 125, 150, 200, 300, 400];\n\n/** The `p-4` gutter the page sits in, on both axes. */\nconst PAGE_GUTTER = 40;\nconst MIN_SCALE = 0.3;\nconst MAX_SCALE = 4;\n\n/**\n * The scale auto-fit lands on.\n *\n * @internal Exported for the spec. The effect that calls it needs a rendered\n * document and a laid-out container to reach, and the wrong answer here does\n * not throw — it crops the page at the fold, which reads as a broken preview\n * rather than as a bug in a formula.\n */\nexport function fitScale(\n fit: 'width' | 'page',\n container: { width: number; height: number },\n page: { width: number; height: number },\n): number {\n const byWidth = (container.width - PAGE_GUTTER) / page.width;\n // Fitting the PAGE means neither axis may overflow, so take whichever\n // constraint binds first. Width alone is what crops a portrait page in a\n // pane wider than it is tall.\n const wanted = fit === 'page'\n ? Math.min(byWidth, (container.height - PAGE_GUTTER) / page.height)\n : byWidth;\n return Math.min(Math.max(wanted, MIN_SCALE), MAX_SCALE);\n}\n\n// Trimmed copy of pdf.js's text-layer rules (pdf_viewer.css), under our own\n// class name so a consumer that loads the full viewer CSS doesn't\n// double-apply. The layer is a sheet of transparent spans positioned over\n// the canvas glyphs — that's what makes the rendered page selectable. Span\n// positions are % of page size; font-size derives from\n// --total-scale-factor, which the render effect sets to the viewport scale.\n// The .endOfContent sentinel plus the .selecting toggle keep a\n// drag-selection alive between lines and past the last line (same trick as\n// pdf.js's own TextLayerBuilder).\nconst TEXT_LAYER_CSS = `\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role=\"img\"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n`;\n\nexport default function PdfViewer({ url, filename, fit = 'width', onDownload, onEmail }: PdfViewerProps) {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const textLayerRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const [pdf, setPdf] = useState<pdfjsLib.PDFDocumentProxy | null>(null);\n const [page, setPage] = useState(1);\n const [totalPages, setTotalPages] = useState(0);\n const [scale, setScale] = useState(1);\n // Fit mode is the default — scale stays auto-tracking the container width\n // until the user picks a manual zoom (− / + / dropdown). Re-armed by the\n // Fit toolbar button.\n const [fitMode, setFitMode] = useState(true);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n let cancelled = false;\n setLoading(true);\n // A new document starts at its first page. The page number belongs to the\n // document being read, not to the viewer, and it used to survive a change\n // of `url`: sitting on page 3 and being handed a one-page document asked\n // pdf.js for a page that does not exist, and the canvas went blank with\n // nothing thrown. The Preview window never saw it because it keys its\n // panels by url, but an embedder that re-renders one viewer with a new\n // document — a preview pane next to the options that regenerate it — is\n // exactly the shape this component was extracted for.\n //\n // Reset before the fetch, not in its `.then`: the manual page controls are\n // live while a document loads, and a reset that landed afterwards would\n // undo a page the reader had already picked.\n //\n // Zoom is deliberately NOT reset. It is the reader's own preference for\n // how large they want text, and it holds across documents the way it does\n // in every reader; only the page is a fact about the file.\n setPage(1);\n // Parameter-object form, not the bare string: pdfjs-dist 6.x removed the\n // string overload (\"expected either `data`, `range`, or `url` parameter\"),\n // so a consumer on 6.x had every preview die on this line. The object form\n // works on 5.x too. tests/pdfjsContract.test.ts fails if it reverts.\n pdfjsLib.getDocument({ url, ...pdfWasmParams() }).promise.then(doc => {\n if (cancelled) return;\n setPdf(doc);\n setTotalPages(doc.numPages);\n setLoading(false);\n }).catch(() => {\n if (!cancelled) { toast.error('Failed to load PDF'); setLoading(false); }\n });\n return () => { cancelled = true; };\n }, [url]);\n\n // Auto-fit: re-compute scale from the container whenever fit mode is on, the\n // document changes, the page changes, or the container resizes. Window\n // resize and Modal drag-resize both trigger ResizeObserver. Manual zoom\n // turns this off until the user clicks Fit again.\n useEffect(() => {\n if (!pdf || !fitMode || !containerRef.current) return;\n const recompute = () => {\n const el = containerRef.current;\n if (!el) return;\n pdf.getPage(page).then(p => {\n if (!containerRef.current) return;\n const viewport = p.getViewport({ scale: 1 });\n const next = fitScale(\n fit,\n { width: el.clientWidth, height: el.clientHeight },\n { width: viewport.width, height: viewport.height },\n );\n setScale(prev => (Math.abs(prev - next) < 0.005 ? prev : next));\n });\n };\n recompute();\n const ro = new ResizeObserver(recompute);\n ro.observe(containerRef.current);\n return () => ro.disconnect();\n }, [pdf, page, fitMode, fit]);\n\n useEffect(() => {\n if (!pdf || !canvasRef.current) return;\n let cancelled = false;\n let task: { cancel: () => void; promise: Promise<void> } | null = null;\n let textLayer: pdfjsLib.TextLayer | null = null;\n pdf.getPage(page).then(p => {\n if (cancelled || !canvasRef.current) return;\n const viewport = p.getViewport({ scale });\n const canvas = canvasRef.current;\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n // Lock the displayed (CSS) size to the viewport. pdf.js stamps inline\n // style.width/height on render and inline values stick across re-renders\n // even when canvas.width shrinks — without this, zoom changes only\n // affect resolution, not visible size.\n canvas.style.width = `${viewport.width}px`;\n canvas.style.height = `${viewport.height}px`;\n const ctx = canvas.getContext('2d')!;\n task = p.render({ canvas, canvasContext: ctx, viewport });\n task.promise.catch(() => {});\n // Selectable text layer — transparent spans over the canvas glyphs.\n // Rebuilt per page/zoom render; pdf.js reads --total-scale-factor for\n // span font-size and the container's own width/height.\n const textEl = textLayerRef.current;\n if (textEl) {\n textEl.replaceChildren();\n textEl.style.setProperty('--total-scale-factor', String(viewport.scale));\n textLayer = new pdfjsLib.TextLayer({\n textContentSource: p.streamTextContent(),\n container: textEl,\n viewport,\n });\n textLayer.render().then(() => {\n if (cancelled) return;\n const end = document.createElement('div');\n end.className = 'endOfContent';\n textEl.append(end);\n }).catch(() => {});\n }\n });\n return () => {\n cancelled = true;\n task?.cancel();\n textLayer?.cancel();\n };\n }, [pdf, page, scale]);\n\n // End a selection drag wherever the pointer is released — the .selecting\n // class is added on pointerdown in the layer itself (see JSX below).\n useEffect(() => {\n const up = () => textLayerRef.current?.classList.remove('selecting');\n window.addEventListener('pointerup', up);\n return () => window.removeEventListener('pointerup', up);\n }, []);\n\n const handlePrint = () => {\n if (!pdf) return;\n const win = window.open('', '_blank');\n if (!win) { toast.error('Allow popups to print'); return; }\n const promises: Promise<string>[] = [];\n for (let i = 1; i <= totalPages; i++) {\n promises.push(pdf.getPage(i).then(p => {\n const vp = p.getViewport({ scale: 2 });\n const c = document.createElement('canvas');\n c.width = vp.width; c.height = vp.height;\n return p.render({ canvas: c, canvasContext: c.getContext('2d')!, viewport: vp }).promise.then(() => c.toDataURL());\n }));\n }\n Promise.all(promises).then(images => {\n win.document.write(`<html><head><title>${filename}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`);\n win.document.write(images.map(src => `<img src=\"${src}\"/>`).join(''));\n win.document.write('</body></html>');\n win.document.close();\n setTimeout(() => { win.print(); win.close(); }, 300);\n });\n };\n\n const handleDefaultDownload = () => {\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n a.click();\n };\n\n // Re-arm fit mode. The auto-fit effect picks the new scale on its next\n // tick once `fitMode` flips to true.\n const reFit = () => setFitMode(true);\n const fitLabel = fit === 'page' ? 'Fit page' : 'Fit width';\n\n // Wheel and keyboard page navigation. Only takes the wheel event when\n // the container is at the top/bottom edge — otherwise normal scroll\n // moves through a tall page first, matching native PDF readers.\n const onWheelPage = (e: React.WheelEvent<HTMLDivElement>) => {\n if (!pdf) return;\n if (e.ctrlKey || e.metaKey) return; // browser-zoom shortcut, leave alone\n const el = containerRef.current;\n if (!el) return;\n const atTop = el.scrollTop <= 0;\n const atBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - 1;\n if (e.deltaY > 0 && atBottom && page < totalPages) {\n e.preventDefault();\n setPage(p => Math.min(totalPages, p + 1));\n // Land at the top of the next page so wheel-down keeps reading\n // forward. requestAnimationFrame so the canvas has a tick to\n // resize before we scroll.\n requestAnimationFrame(() => { if (containerRef.current) containerRef.current.scrollTop = 0; });\n } else if (e.deltaY < 0 && atTop && page > 1) {\n e.preventDefault();\n setPage(p => Math.max(1, p - 1));\n requestAnimationFrame(() => {\n if (containerRef.current) containerRef.current.scrollTop = containerRef.current.scrollHeight;\n });\n }\n };\n const onKeyPage = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!pdf) return;\n // Ignore keyboard nav when an input/textarea has focus.\n const tag = (document.activeElement?.tagName || '').toLowerCase();\n if (tag === 'input' || tag === 'textarea' || (document.activeElement as HTMLElement)?.isContentEditable) return;\n if (e.key === 'PageDown' || e.key === 'ArrowRight') {\n if (page < totalPages) { e.preventDefault(); setPage(p => Math.min(totalPages, p + 1)); }\n } else if (e.key === 'PageUp' || e.key === 'ArrowLeft') {\n if (page > 1) { e.preventDefault(); setPage(p => Math.max(1, p - 1)); }\n } else if (e.key === 'Home') {\n e.preventDefault(); setPage(1);\n } else if (e.key === 'End') {\n e.preventDefault(); setPage(totalPages);\n }\n };\n\n const btn = 'px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1';\n\n return (\n <div className=\"flex flex-col h-full\">\n <PanelActions>\n <button aria-label=\"Previous page\" onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page <= 1} className=\"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600\">\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M15.75 19.5L8.25 12l7.5-7.5\" /></svg>\n </button>\n <span className=\"text-gray-600 font-medium tabular-nums\">{page} / {totalPages}</span>\n <button aria-label=\"Next page\" onClick={() => setPage(p => Math.min(totalPages, p + 1))} disabled={page >= totalPages} className=\"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600\">\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8.25 4.5l7.5 7.5-7.5 7.5\" /></svg>\n </button>\n <div className=\"h-4 w-px bg-gray-300 mx-1\" />\n <button\n onClick={() => { setFitMode(false); setScale(s => Math.max(0.3, Math.round((s - 0.25) * 100) / 100)); }}\n className={btn}\n >−</button>\n <select\n value={fitMode ? 'fit' : (ZOOM_PRESETS.includes(Math.round(scale * 100)) ? Math.round(scale * 100) : 'custom')}\n onChange={e => {\n const v = e.target.value;\n if (v === 'fit') { setFitMode(true); return; }\n if (v !== 'custom') { setFitMode(false); setScale(Number(v) / 100); }\n }}\n className=\"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400\"\n title=\"Zoom\"\n >\n <option value=\"fit\">{fitLabel}</option>\n {!fitMode && !ZOOM_PRESETS.includes(Math.round(scale * 100)) && (\n <option value=\"custom\">{Math.round(scale * 100)}%</option>\n )}\n {ZOOM_PRESETS.map(p => <option key={p} value={p}>{p}%</option>)}\n </select>\n <button\n onClick={() => { setFitMode(false); setScale(s => Math.min(4, Math.round((s + 0.25) * 100) / 100)); }}\n className={btn}\n >+</button>\n <button\n onClick={reFit}\n className={btn + (fitMode ? ' bg-gray-200 text-gray-900' : '')}\n title={`${fitLabel} — auto-tracks the container size until you zoom manually`}\n >Fit</button>\n <div className=\"h-4 w-px bg-gray-300 mx-1\" />\n <button onClick={handlePrint} className={btn}>\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z\" /></svg>\n Print\n </button>\n <button onClick={onDownload ?? handleDefaultDownload} className={btn}>\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3\" /></svg>\n Download\n </button>\n {onEmail && (\n <button onClick={onEmail} className={btn}>\n <svg className=\"h-3.5 w-3.5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75\" /></svg>\n Email\n </button>\n )}\n </PanelActions>\n\n <div\n ref={containerRef}\n className=\"flex-1 overflow-auto bg-gray-100 outline-none\"\n // tabIndex makes the scroll container itself focusable so PageUp /\n // PageDown / Arrow keys are captured even when no inner element\n // has focus (e.g. right after the panel mounts). Wheel handler\n // page-flips when the user reaches the top/bottom of a long page.\n tabIndex={0}\n onWheel={onWheelPage}\n onKeyDown={onKeyPage}\n >\n {loading ? (\n <div className=\"flex items-center justify-center h-full text-gray-400 text-sm\">Loading PDF...</div>\n ) : (\n <div className=\"min-h-full flex items-center justify-center p-4\">\n <style>{TEXT_LAYER_CSS}</style>\n <div className=\"relative shadow-lg rounded\">\n <canvas ref={canvasRef} className=\"block rounded\" />\n <div\n ref={textLayerRef}\n className=\"preview-pdf-textlayer\"\n onPointerDown={e => e.currentTarget.classList.add('selecting')}\n />\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toast_default } from './chunk-
|
|
1
|
+
import { toast_default } from './chunk-EENVXIVU.js';
|
|
2
2
|
import { forwardRef, useRef, useState, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -1099,5 +1099,5 @@ function applyMosaic(ctx, rect) {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
|
|
1101
1101
|
export { ImageAnnotator_default };
|
|
1102
|
-
//# sourceMappingURL=chunk-
|
|
1103
|
-
//# sourceMappingURL=chunk-
|
|
1102
|
+
//# sourceMappingURL=chunk-TFXJRHJV.js.map
|
|
1103
|
+
//# sourceMappingURL=chunk-TFXJRHJV.js.map
|