@ai-matrx/media 0.12.0 → 0.14.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/CHANGELOG.md +23 -0
- package/dist/files/engine/db-types.d.ts +3 -50128
- package/dist/files/engine/filesDb.d.ts +168 -168
- package/dist/files/engine/host/supabase.d.ts +231 -214
- package/dist/react.cjs +120 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +26 -2
- package/dist/react.d.ts +26 -2
- package/dist/react.js +120 -0
- package/dist/react.js.map +1 -1
- package/dist/voices.cjs +481 -0
- package/dist/voices.cjs.map +1 -1
- package/dist/voices.d.cts +116 -1
- package/dist/voices.d.ts +116 -1
- package/dist/voices.js +489 -0
- package/dist/voices.js.map +1 -1
- package/package.json +5 -3
package/dist/react.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react.ts","../src/react/cn.ts","../src/react/icons.tsx","../src/core/file-kind.ts","../src/react/file-icon.tsx","../src/react/inline-media-ref.tsx","../src/core/context.ts","../src/core/diagnostics.ts","../src/core/use-media-blob.ts","../src/core/ref-key.ts","../src/core/use-media-blob-load-recovery.ts","../src/core/use-media-load-recovery.ts","../src/types.ts","../src/core/use-media-resolution.ts","../src/react/media-thumbnail.tsx","../src/core/use-thumbnail-source.ts","../src/react/use-media-dropzone.ts","../src/react/file-upload-dropzone.tsx","../src/core/use-media-upload.ts","../src/react/upload-progress-list.tsx","../src/react/media-action-toolbar.tsx","../src/core/use-media-actions.ts","../src/react/media-lightbox.tsx"],"sourcesContent":["/**\n * @ai-matrx/media/react — the DOM bindings.\n *\n * Components take durable refs ONLY (no `src` props exist in this package);\n * everything resolves through the injected MediaClient. Tailwind v4 hosts\n * register this package as a Tailwind source (the design-system precedent)\n * so the utility classes used here are generated.\n */\n\nexport { cn } from \"./react/cn\";\nexport * from \"./react/icons\";\nexport { FileIcon, type FileIconProps } from \"./react/file-icon\";\nexport {\n InlineMediaRef,\n type InlineMediaRefFit,\n type InlineMediaRefProps,\n type InlineMediaRefSize,\n} from \"./react/inline-media-ref\";\nexport {\n MediaThumbnail,\n type MediaThumbnailProps,\n} from \"./react/media-thumbnail\";\nexport {\n useMediaDropzone,\n type MediaDropzoneOptions,\n type MediaDropzoneState,\n} from \"./react/use-media-dropzone\";\nexport {\n FileUploadDropzone,\n type FileUploadDropzoneActions,\n type FileUploadDropzoneProps,\n} from \"./react/file-upload-dropzone\";\n// `formatFileSize` is NO LONGER exported here — it moved to\n// `@ai-matrx/kit/format` (census H1). See the CHANGELOG's\n// \"Consumer action (C28)\".\nexport {\n UploadProgressList,\n type UploadProgressListProps,\n} from \"./react/upload-progress-list\";\nexport {\n MediaActionToolbar,\n type MediaActionToolbarProps,\n} from \"./react/media-action-toolbar\";\nexport {\n MediaLightbox,\n type MediaLightboxProps,\n} from \"./react/media-lightbox\";\n","/**\n * src/react/cn.ts — conditional class join with last-wins Tailwind conflict\n * merging. The originals used the app's `cn` (clsx + tailwind-merge); public\n * `className` overrides depend on last-wins class-conflict merging, so a\n * naive join would be a behavior divergence (the kit `./confirm` precedent —\n * this is why `tailwind-merge` is a sanctioned runtime dep of `/react`).\n */\n\nimport { twMerge } from \"tailwind-merge\";\n\nexport type ClassValue = string | false | null | undefined | 0;\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(inputs.filter(Boolean).join(\" \"));\n}\n","/**\n * src/react/icons.tsx — the package's OWN inlined SVG icons.\n *\n * Per campaign ruling C19 (2026-08-29): no icon-library dependency, ever.\n * Every glyph below is copied from lucide-react v1.22.0 (ISC license) exactly,\n * following the @ai-matrx/tap-target precedent. Add a new icon by copying the\n * lucide __iconNode data — never by adding a lucide peer.\n *\n * Internal module: icons are exported for the package's own components and for\n * hosts that want visual parity in slots, but they are not the product.\n */\n\nimport type { SVGProps } from \"react\";\n\nexport type MediaIconProps = SVGProps<SVGSVGElement>;\n\nfunction svgProps(props: MediaIconProps): MediaIconProps {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n width: 24,\n height: 24,\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n// lucide: archive\nexport function ArchiveIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\n </svg>\n );\n}\n\n// lucide: braces\nexport function BracesIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\" />\n <path d=\"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\" />\n </svg>\n );\n}\n\n// lucide: check\nexport function CheckIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n// lucide: code\nexport function CodeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"m16 18 6-6-6-6\" />\n <path d=\"m8 6-6 6 6 6\" />\n </svg>\n );\n}\n\n// lucide: copy\nexport function CopyIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n );\n}\n\n// lucide: database\nexport function DatabaseIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" />\n <path d=\"M3 5V19A9 3 0 0 0 21 19V5\" />\n <path d=\"M3 12A9 3 0 0 0 21 12\" />\n </svg>\n );\n}\n\n// lucide: download\nexport function DownloadIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M12 15V3\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" />\n </svg>\n );\n}\n\n// lucide: externalLink\nexport function ExternalLinkIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n// lucide: file\nexport function FileIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n </svg>\n );\n}\n\n// lucide: fileAudio\nexport function FileAudioIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0\" />\n </svg>\n );\n}\n\n// lucide: fileCode\nexport function FileCodeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12.5 8 15l2 2.5\" />\n <path d=\"m14 12.5 2 2.5-2 2.5\" />\n </svg>\n );\n}\n\n// lucide: fileJson\nexport function FileJsonIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1\" />\n <path d=\"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1\" />\n </svg>\n );\n}\n\n// lucide: fileSpreadsheet\nexport function FileSpreadsheetIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M8 13h2\" />\n <path d=\"M14 13h2\" />\n <path d=\"M8 17h2\" />\n <path d=\"M14 17h2\" />\n </svg>\n );\n}\n\n// lucide: fileText\nexport function FileTextIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 9H8\" />\n <path d=\"M16 13H8\" />\n <path d=\"M16 17H8\" />\n </svg>\n );\n}\n\n// lucide: fileType\nexport function FileTypeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M11 18h2\" />\n <path d=\"M12 12v6\" />\n <path d=\"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5\" />\n </svg>\n );\n}\n\n// lucide: fileVideo\nexport function FileVideoIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z\" />\n </svg>\n );\n}\n\n// lucide: folder\nexport function FolderIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />\n </svg>\n );\n}\n\n// lucide: folderOpen\nexport function FolderOpenIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n// lucide: image\nexport function ImageIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" />\n </svg>\n );\n}\n\n// lucide: imageOff\nexport function ImageOffIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <line x1=\"2\" x2=\"22\" y1=\"2\" y2=\"22\" />\n <path d=\"M10.41 10.41a2 2 0 1 1-2.83-2.83\" />\n <line x1=\"13.5\" x2=\"6\" y1=\"13.5\" y2=\"21\" />\n <line x1=\"18\" x2=\"21\" y1=\"12\" y2=\"15\" />\n <path d=\"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59\" />\n <path d=\"M21 15V5a2 2 0 0 0-2-2H9\" />\n </svg>\n );\n}\n\n// lucide: music\nexport function MusicIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M9 18V5l12-2v13\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" />\n <circle cx=\"18\" cy=\"16\" r=\"3\" />\n </svg>\n );\n}\n\n// lucide: packageBox\nexport function PackageBoxIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z\" />\n <path d=\"M12 22V12\" />\n <polyline points=\"3.29 7 12 12 20.71 7\" />\n <path d=\"m7.5 4.27 9 5.15\" />\n </svg>\n );\n}\n\n// lucide: penTool\nexport function PenToolIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z\" />\n <path d=\"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18\" />\n <path d=\"m2.3 2.3 7.286 7.286\" />\n <circle cx=\"11\" cy=\"11\" r=\"2\" />\n </svg>\n );\n}\n\n// lucide: share2\nexport function Share2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"18\" cy=\"5\" r=\"3\" />\n <circle cx=\"6\" cy=\"12\" r=\"3\" />\n <circle cx=\"18\" cy=\"19\" r=\"3\" />\n <line x1=\"8.59\" x2=\"15.42\" y1=\"13.51\" y2=\"17.49\" />\n <line x1=\"15.41\" x2=\"8.59\" y1=\"6.51\" y2=\"10.49\" />\n </svg>\n );\n}\n\n// lucide: subtitles\nexport function SubtitlesIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"18\" height=\"14\" x=\"3\" y=\"5\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 15h4M15 15h2M7 11h2M13 11h4\" />\n </svg>\n );\n}\n\n// lucide: upload\nexport function UploadIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M12 3v12\" />\n <path d=\"m17 8-5-5-5 5\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n </svg>\n );\n}\n\n// lucide: video\nexport function VideoIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5\" />\n <rect x=\"2\" y=\"6\" width=\"14\" height=\"12\" rx=\"2\" />\n </svg>\n );\n}\n\n// lucide: videoOff\nexport function VideoOffIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196\" />\n <path d=\"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n// lucide: volumeX\nexport function VolumeXIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n <line x1=\"22\" x2=\"16\" y1=\"9\" y2=\"15\" />\n <line x1=\"16\" x2=\"22\" y1=\"9\" y2=\"15\" />\n </svg>\n );\n}\n\n// lucide: x\nexport function XIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n// lucide: alertCircle\nexport function AlertCircleIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n// lucide: checkCircle2\nexport function CheckCircle2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n </svg>\n );\n}\n\n// lucide: globe\nexport function GlobeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\n </svg>\n );\n}\n\n// lucide: link-2\nexport function Link2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M9 17H7A5 5 0 0 1 7 7h2\" />\n <path d=\"M15 7h2a5 5 0 1 1 0 10h-2\" />\n <line x1=\"8\" x2=\"16\" y1=\"12\" y2=\"12\" />\n </svg>\n );\n}\n\n// lucide: settings-2\nexport function Settings2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M20 7h-9\" />\n <path d=\"M14 17H5\" />\n <circle cx=\"17\" cy=\"17\" r=\"3\" />\n <circle cx=\"7\" cy=\"7\" r=\"3\" />\n </svg>\n );\n}\n\n// lucide: loader-circle (a.k.a. Loader2)\nexport function SpinnerIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n// lucide: plus\nexport function PlusIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n// lucide: search\nexport function SearchIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n );\n}\n\n// lucide: pause (lucide-react v1.48.0)\nexport function PauseIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n <rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n </svg>\n );\n}\n\n// lucide: play (lucide-react v1.48.0)\nexport function PlayIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />\n </svg>\n );\n}\n","/**\n * src/core/file-kind.ts — filename/MIME → category, icon name, color.\n *\n * Condensed port of the icon-relevant slice of matrx-frontend\n * `features/files/utils/file-types.ts` (the FILE_TYPES registry): every\n * extension→{category,icon,color,displayName} row is preserved; the\n * preview/thumbnail/size-cap columns stay in the app (C8 — they belong to\n * the previewer world, not the media kit). MIME-prefix fallback, the\n * dotfile-looks-like-text heuristic, folder details and the unknown default\n * are ported verbatim in behavior.\n *\n * Platform-free: icon NAMES only — `/react` maps names to its inlined SVGs;\n * a future `/react-native` binding maps the same names to its own glyphs.\n */\n\nexport type FileCategory =\n | \"CODE\"\n | \"DOCUMENT\"\n | \"AUDIO\"\n | \"IMAGE\"\n | \"VIDEO\"\n | \"ARCHIVE\"\n | \"DATA\"\n | \"NOTEBOOK\"\n | \"SUBTITLES\"\n | \"EMAIL\"\n | \"EBOOK\"\n | \"MODEL_3D\"\n | \"UNKNOWN\"\n | \"FOLDER\";\n\nexport type FileIconName =\n | \"image\"\n | \"pen-tool\"\n | \"video\"\n | \"music\"\n | \"file-type\"\n | \"file-text\"\n | \"code\"\n | \"braces\"\n | \"subtitles\"\n | \"file-code\"\n | \"file-json\"\n | \"file-spreadsheet\"\n | \"database\"\n | \"package\"\n | \"archive\"\n | \"folder\"\n | \"folder-open\"\n | \"file\"\n | \"file-audio\"\n | \"file-video\";\n\nexport interface FileKindDetails {\n category: FileCategory;\n displayName: string;\n /** Tailwind text color token, matching the original registry exactly. */\n colorClass: string;\n icon: FileIconName;\n}\n\ntype Row = [\n extensions: string[],\n category: FileCategory,\n colorClass: string,\n icon: FileIconName,\n displayName: string,\n];\n\n// Rows ported from the FILE_TYPES registry (icon-relevant columns), grouped\n// exactly as the original's icon/color assignments group them.\nconst ROWS: Row[] = [\n [[\"jpg\", \"jpeg\", \"png\", \"gif\", \"webp\", \"avif\", \"heic\", \"heif\", \"bmp\", \"tif\", \"tiff\", \"ico\"], \"IMAGE\", \"text-emerald-500\", \"image\", \"Image\"],\n [[\"svg\"], \"IMAGE\", \"text-amber-500\", \"pen-tool\", \"SVG image\"],\n [[\"mp4\", \"mov\", \"webm\", \"mkv\", \"avi\", \"m4v\"], \"VIDEO\", \"text-purple-500\", \"video\", \"Video\"],\n [[\"mp3\", \"wav\", \"ogg\", \"m4a\", \"aac\", \"flac\", \"opus\"], \"AUDIO\", \"text-pink-500\", \"music\", \"Audio\"],\n [[\"pdf\"], \"DOCUMENT\", \"text-red-500\", \"file-type\", \"PDF Document\"],\n [[\"md\", \"markdown\", \"mdx\", \"rst\", \"adoc\", \"asciidoc\", \"org\"], \"DOCUMENT\", \"text-slate-400\", \"file-text\", \"Markdown\"],\n [[\"txt\", \"text\", \"asc\", \"me\", \"log\", \"out\", \"err\"], \"DOCUMENT\", \"text-muted-foreground\", \"file-text\", \"Text\"],\n [[\"dockerfile\", \"containerfile\", \"lua\"], \"CODE\", \"text-blue-500\", \"code\", \"Code\"],\n [[\"mk\", \"make\", \"swift\", \"ml\", \"mli\", \"fs\", \"fsi\", \"fsx\", \"svelte\"], \"CODE\", \"text-orange-500\", \"code\", \"Code\"],\n [[\"diff\", \"patch\", \"pem\", \"csr\", \"crt\", \"cer\", \"der\", \"key\", \"pub\", \"p7b\", \"p7c\", \"pfx\", \"p12\"], \"CODE\", \"text-amber-500\", \"file-text\", \"Text\"],\n [[\"ini\", \"cfg\", \"conf\", \"config\", \"properties\", \"prefs\"], \"CODE\", \"text-amber-400\", \"braces\", \"Config\"],\n [[\"tex\", \"latex\", \"ltx\", \"sty\", \"cls\", \"bib\"], \"CODE\", \"text-emerald-500\", \"file-text\", \"LaTeX\"],\n [[\"srt\", \"vtt\"], \"SUBTITLES\", \"text-cyan-500\", \"subtitles\", \"Subtitles\"],\n [[\"js\", \"mjs\", \"cjs\", \"jsx\"], \"CODE\", \"text-yellow-500\", \"file-code\", \"JavaScript\"],\n [[\"ts\", \"tsx\"], \"CODE\", \"text-blue-500\", \"file-code\", \"TypeScript\"],\n [[\"py\", \"clj\", \"cljs\", \"cljc\", \"edn\", \"vue\", \"styl\", \"stylus\"], \"CODE\", \"text-emerald-500\", \"code\", \"Code\"],\n [[\"rb\", \"rbw\", \"rake\", \"ru\", \"gemspec\", \"scala\", \"sbt\"], \"CODE\", \"text-red-500\", \"code\", \"Code\"],\n [[\"go\", \"dart\"], \"CODE\", \"text-cyan-500\", \"code\", \"Code\"],\n [[\"rs\"], \"CODE\", \"text-orange-600\", \"code\", \"Rust\"],\n [[\"java\"], \"CODE\", \"text-red-600\", \"code\", \"Java\"],\n [[\"c\", \"h\"], \"CODE\", \"text-blue-600\", \"code\", \"C\"],\n [[\"cpp\", \"cc\", \"cxx\", \"hpp\"], \"CODE\", \"text-blue-700\", \"code\", \"C++\"],\n [[\"cs\"], \"CODE\", \"text-purple-600\", \"code\", \"C#\"],\n [[\"html\", \"htm\", \"kt\", \"kts\"], \"CODE\", \"text-orange-400\", \"code\", \"Code\"],\n [[\"css\"], \"CODE\", \"text-sky-400\", \"code\", \"CSS\"],\n [[\"scss\"], \"CODE\", \"text-pink-400\", \"code\", \"SCSS\"],\n [[\"sh\", \"bash\", \"zsh\", \"fish\", \"ksh\", \"ash\", \"bat\", \"cmd\", \"twig\", \"jinja\", \"j2\", \"njk\"], \"CODE\", \"text-emerald-400\", \"code\", \"Script\"],\n [[\"sql\"], \"CODE\", \"text-amber-400\", \"code\", \"SQL\"],\n [[\"pl\", \"pm\"], \"CODE\", \"text-indigo-400\", \"code\", \"Perl\"],\n [[\"r\", \"rmd\", \"proto\", \"ps1\", \"psm1\", \"psd1\", \"less\"], \"CODE\", \"text-blue-400\", \"code\", \"Code\"],\n [[\"ex\", \"exs\"], \"CODE\", \"text-purple-400\", \"code\", \"Elixir\"],\n [[\"erl\", \"hrl\"], \"CODE\", \"text-rose-500\", \"code\", \"Erlang\"],\n [[\"hs\", \"lhs\"], \"CODE\", \"text-violet-500\", \"code\", \"Haskell\"],\n [[\"zig\"], \"CODE\", \"text-yellow-500\", \"code\", \"Zig\"],\n [[\"nim\", \"nims\"], \"CODE\", \"text-yellow-400\", \"code\", \"Nim\"],\n [[\"jl\"], \"CODE\", \"text-purple-500\", \"code\", \"Julia\"],\n [[\"astro\"], \"CODE\", \"text-fuchsia-500\", \"code\", \"Astro\"],\n [[\"graphql\", \"gql\", \"graphqls\"], \"CODE\", \"text-pink-500\", \"code\", \"GraphQL\"],\n [[\"sol\"], \"CODE\", \"text-slate-400\", \"code\", \"Solidity\"],\n [[\"php\", \"phtml\", \"phps\"], \"CODE\", \"text-indigo-500\", \"code\", \"PHP\"],\n [[\"hbs\", \"handlebars\", \"mustache\", \"ejs\", \"liquid\"], \"CODE\", \"text-amber-500\", \"code\", \"Template\"],\n [[\"json\", \"jsonc\", \"json5\", \"har\", \"geojson\", \"topojson\"], \"DATA\", \"text-amber-500\", \"file-json\", \"JSON\"],\n [[\"yaml\", \"yml\", \"toml\"], \"CODE\", \"text-amber-500\", \"braces\", \"Config\"],\n [[\"xml\"], \"DATA\", \"text-amber-500\", \"braces\", \"XML\"],\n [[\"csv\", \"tsv\"], \"DATA\", \"text-orange-500\", \"file-spreadsheet\", \"Spreadsheet data\"],\n [[\"sqlite\", \"sqlite3\", \"db\"], \"DATA\", \"text-blue-400\", \"database\", \"Database\"],\n [[\"ttl\", \"n3\", \"nt\", \"nq\", \"trig\"], \"DATA\", \"text-fuchsia-400\", \"braces\", \"RDF data\"],\n [[\"xlsx\", \"xls\"], \"DOCUMENT\", \"text-emerald-600\", \"file-spreadsheet\", \"Excel workbook\"],\n [[\"doc\", \"docx\"], \"DOCUMENT\", \"text-blue-500\", \"file-text\", \"Word document\"],\n [[\"ppt\", \"pptx\"], \"DOCUMENT\", \"text-orange-600\", \"file-type\", \"Presentation\"],\n [[\"ipynb\"], \"NOTEBOOK\", \"text-orange-400\", \"file-json\", \"Notebook\"],\n [[\"epub\"], \"EBOOK\", \"text-indigo-500\", \"file-text\", \"eBook\"],\n [[\"eml\"], \"EMAIL\", \"text-blue-400\", \"file-text\", \"Email\"],\n [[\"glb\", \"gltf\", \"stl\", \"obj\", \"fbx\"], \"MODEL_3D\", \"text-violet-400\", \"package\", \"3D model\"],\n [[\"zip\", \"rar\", \"7z\"], \"ARCHIVE\", \"text-amber-600\", \"archive\", \"Archive\"],\n [[\"tar\", \"gz\", \"tgz\"], \"ARCHIVE\", \"text-amber-600\", \"package\", \"Archive\"],\n];\n\nconst BY_EXTENSION = new Map<string, FileKindDetails>();\nfor (const [extensions, category, colorClass, icon, displayName] of ROWS) {\n for (const ext of extensions) {\n BY_EXTENSION.set(ext, { category, colorClass, icon, displayName });\n }\n}\n\nconst UNKNOWN_DETAILS: FileKindDetails = {\n category: \"UNKNOWN\",\n displayName: \"File\",\n colorClass: \"text-muted-foreground\",\n icon: \"file\",\n};\n\nconst ASSUMED_TEXT_DETAILS: FileKindDetails = {\n category: \"DOCUMENT\",\n displayName: \"Text\",\n colorClass: \"text-muted-foreground\",\n icon: \"file-text\",\n};\n\nconst FOLDER_DETAILS: FileKindDetails = {\n category: \"FOLDER\",\n displayName: \"Folder\",\n colorClass: \"text-sky-500\",\n icon: \"folder\",\n};\n\nconst IMAGE_DETAILS = BY_EXTENSION.get(\"png\") as FileKindDetails;\nconst VIDEO_DETAILS = BY_EXTENSION.get(\"mp4\") as FileKindDetails;\nconst AUDIO_DETAILS = BY_EXTENSION.get(\"mp3\") as FileKindDetails;\nconst PDF_DETAILS = BY_EXTENSION.get(\"pdf\") as FileKindDetails;\nconst SVG_DETAILS = BY_EXTENSION.get(\"svg\") as FileKindDetails;\n\nfunction basenameOf(path: string): string {\n const idx = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"));\n return idx >= 0 ? path.slice(idx + 1) : path;\n}\n\nfunction extOf(name: string): string | null {\n const idx = name.lastIndexOf(\".\");\n if (idx <= 0 || idx === name.length - 1) return null;\n return name.slice(idx + 1).toLowerCase();\n}\n\n/**\n * Dotfile heuristic (ported): unrecognized dotfiles are almost always text —\n * bias toward the text profile instead of the binary \"File\" default.\n */\nfunction dotfileLooksLikeText(filename: string): boolean {\n const name = basenameOf(filename);\n if (!name.startsWith(\".\")) return false;\n for (let i = 1; i < name.length; i++) {\n const c = name.charCodeAt(i);\n if (\n (c >= 48 && c <= 57) ||\n (c >= 65 && c <= 90) ||\n (c >= 97 && c <= 122) ||\n c === 95 ||\n c === 45\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Strip MIME parameters (`;codecs=opus`, etc.). */\nfunction canonicalMimeBase(raw: string): string {\n return raw.split(\";\")[0]?.trim().toLowerCase() ?? raw;\n}\n\n/**\n * Resolve icon details from a filename and (optionally) the server MIME.\n * MIME-prefix override handles \"the browser knows `image/avif` but the\n * extension table doesn't\" — and disambiguates audio/webm vs video/webm.\n */\nexport function getFileKindDetails(\n fileName: string,\n mimeType?: string | null,\n): FileKindDetails {\n const name = basenameOf(fileName);\n const lower = name.toLowerCase();\n const ext = lower === \"dockerfile\" || lower === \"containerfile\" ? lower : extOf(name);\n const fromExt = ext ? BY_EXTENSION.get(ext) : undefined;\n\n const mime = mimeType ? canonicalMimeBase(mimeType) : null;\n if (mime) {\n if (mime === \"image/svg+xml\") return fromExt ?? SVG_DETAILS;\n if (mime.startsWith(\"image/\")) return fromExt?.category === \"IMAGE\" ? fromExt : IMAGE_DETAILS;\n if (mime.startsWith(\"video/\")) return fromExt?.category === \"VIDEO\" ? fromExt : VIDEO_DETAILS;\n if (mime.startsWith(\"audio/\")) return fromExt?.category === \"AUDIO\" ? fromExt : AUDIO_DETAILS;\n if (mime === \"application/pdf\") return PDF_DETAILS;\n }\n\n if (fromExt) return fromExt;\n if (dotfileLooksLikeText(fileName)) return ASSUMED_TEXT_DETAILS;\n return UNKNOWN_DETAILS;\n}\n\n/** Folder icon details (open picks the open-folder glyph). */\nexport function getFolderKindDetails(open = false): FileKindDetails {\n return open ? { ...FOLDER_DETAILS, icon: \"folder-open\" } : FOLDER_DETAILS;\n}\n","/**\n * src/react/file-icon.tsx — icon tile for any file or folder.\n *\n * Verbatim port of matrx-frontend `components/core/FileIcon/FileIcon.tsx`\n * with two seam inversions: the registry lookup is the package's own\n * `getFileKindDetails` (`/core`), and the glyphs are the package's own\n * inlined SVGs (C19 — no lucide peer).\n */\n\nimport type { CSSProperties } from \"react\";\nimport {\n getFileKindDetails,\n getFolderKindDetails,\n type FileIconName,\n} from \"../core/file-kind\";\nimport { cn } from \"./cn\";\nimport {\n ArchiveIcon,\n BracesIcon,\n CodeIcon,\n DatabaseIcon,\n FileAudioIcon,\n FileCodeIcon,\n FileIcon as FileGlyph,\n FileJsonIcon,\n FileSpreadsheetIcon,\n FileTextIcon,\n FileTypeIcon,\n FileVideoIcon,\n FolderIcon,\n FolderOpenIcon,\n ImageIcon,\n MusicIcon,\n PackageBoxIcon,\n PenToolIcon,\n SubtitlesIcon,\n VideoIcon,\n type MediaIconProps,\n} from \"./icons\";\n\nconst ICONS: Record<FileIconName, (props: MediaIconProps) => ReturnType<typeof FileGlyph>> = {\n image: ImageIcon,\n \"pen-tool\": PenToolIcon,\n video: VideoIcon,\n music: MusicIcon,\n \"file-type\": FileTypeIcon,\n \"file-text\": FileTextIcon,\n code: CodeIcon,\n braces: BracesIcon,\n subtitles: SubtitlesIcon,\n \"file-code\": FileCodeIcon,\n \"file-json\": FileJsonIcon,\n \"file-spreadsheet\": FileSpreadsheetIcon,\n database: DatabaseIcon,\n package: PackageBoxIcon,\n archive: ArchiveIcon,\n folder: FolderIcon,\n \"folder-open\": FolderOpenIcon,\n file: FileGlyph,\n \"file-audio\": FileAudioIcon,\n \"file-video\": FileVideoIcon,\n};\n\nexport interface FileIconProps {\n /** Either the filename (for files) or omitted for folders. */\n fileName?: string | undefined;\n /** Server MIME — when set, resolves audio/webm vs video/webm correctly. */\n mimeType?: string | null | undefined;\n /** If true, renders a folder icon. `open` picks the open-folder glyph. */\n isFolder?: boolean | undefined;\n open?: boolean | undefined;\n /** Override the mapped color (useful for selected states). */\n colorClass?: string | undefined;\n className?: string | undefined;\n size?: number | undefined;\n}\n\nexport function FileIcon({\n fileName,\n mimeType = null,\n isFolder,\n open,\n colorClass,\n className,\n size = 16,\n}: FileIconProps) {\n const details = isFolder\n ? getFolderKindDetails(open)\n : getFileKindDetails(fileName ?? \"\", mimeType);\n const Icon = ICONS[details.icon];\n const style: CSSProperties = {\n width: `${size}px`,\n height: `${size}px`,\n minWidth: `${size}px`,\n };\n return (\n <Icon\n style={style}\n className={cn(\"shrink-0\", colorClass ?? details.colorClass, className)}\n aria-hidden=\"true\"\n />\n );\n}\n","/**\n * src/react/inline-media-ref.tsx — the canonical inline media renderer.\n *\n * Verbatim behavior port of matrx-frontend\n * `features/files/components/inline/InlineMediaRef.tsx` (849 LOC, 116\n * importers) with only the coupling seams inverted:\n *\n * - URL resolution / public-CDN detection / auth-transport choice →\n * `MediaClient.resolve` (`transport: \"blob\"` is the private-pixels lane;\n * the Redux `useEnsureCloudFile`/`selectFileById` hydration lives behind\n * the client now)\n * - bearer-authenticated bytes → `MediaClient.getBlob` via `useMediaBlob`\n * - session-refresh retry → `MediaClient.recoverLoadError` via\n * `useMediaLoadRecovery`\n * - `next/image` → the injected `MediaHostPorts.ImageComponent` (plain\n * `<img>` default)\n * - audio output sink + exclusive-playback join → the injected\n * `MediaHostPorts.playbackSession` (inert default)\n * - lucide icons → the package's own inlined SVGs (C19)\n *\n * Pass a `MediaRef` (or a fileId / EXTERNAL public URL string), get back a\n * correctly-sized `<img>` / `<video>` / `<audio>`. There is NO `src` prop —\n * durable refs are the only identity this component accepts (law 2/3).\n */\n\n\"use client\";\n\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n} from \"react\";\nimport type {\n DurableSrc,\n MediaFailurePhase,\n MediaImageComponentProps,\n MediaRef,\n MediaRefLike,\n PlaybackSessionPort,\n} from \"../types\";\nimport { useMediaHostPorts } from \"../core/context\";\nimport {\n failureMediaIdentity,\n useMediaFailureCapture,\n} from \"../core/diagnostics\";\nimport { useMediaBlob } from \"../core/use-media-blob\";\nimport { useMediaBlobLoadRecovery } from \"../core/use-media-blob-load-recovery\";\nimport { useMediaLoadRecovery } from \"../core/use-media-load-recovery\";\nimport { useMediaResolution } from \"../core/use-media-resolution\";\nimport { cn } from \"./cn\";\nimport {\n CheckIcon,\n CopyIcon,\n FileAudioIcon,\n FileIcon as FileGlyph,\n FileVideoIcon,\n ImageIcon,\n ImageOffIcon,\n VideoOffIcon,\n VolumeXIcon,\n} from \"./icons\";\n\nexport type InlineMediaRefSize =\n | \"xs\" // 24×24\n | \"sm\" // 32×32\n | \"md\" // 64×64\n | \"lg\" // 128×128\n | \"xl\" // 256×256\n | \"fill\" // parent-controlled — media fills its container via w-full h-full\n | { width: number; height: number };\n\nexport type InlineMediaRefFit = \"cover\" | \"contain\" | \"fill\";\n\nexport interface InlineMediaRefProps {\n /**\n * Reference to the media: a {@link MediaRef}, a bare fileId string, an\n * EXTERNAL public URL string, or null/undefined (renders the fallback).\n *\n * Named `ref` as a CONTENT prop, exactly like the original (React 19\n * treats ref as a regular prop on function components) — the 116 existing\n * call sites pass `ref={mediaRef}` and must keep working at the C9 swap.\n * Use `mediaElementRef` for imperative access to the DOM node.\n */\n ref?: MediaRefLike | null | undefined;\n /** Square dimension preset or explicit width/height. Default `\"md\"` (64×64). */\n size?: InlineMediaRefSize | undefined;\n /** CSS object-fit. Default `\"cover\"`. */\n fit?: InlineMediaRefFit | undefined;\n /** Rendered when the ref can't be resolved to a URL at all. Default `\"icon\"`. */\n fallback?: \"icon\" | \"skeleton\" | null | undefined;\n /** Override the icon shown in `fallback=\"icon\"`. */\n fallbackIcon?: React.ReactNode | undefined;\n /**\n * Rendered when the URL *was* resolved but the media element failed to\n * load. Default `\"info\"` — an informative destructive-tinted panel with\n * URL + copy button + alt text; compacts to icon-only below ~64px.\n */\n errorFallback?: \"info\" | \"icon\" | \"skeleton\" | null | undefined;\n /** Alt text for `<img>`. Defaults to \"\" (decorative). */\n alt?: string | undefined;\n /** Force the media element type. Default: infer from `mime_type` / resolution. */\n as?: \"img\" | \"video\" | \"audio\" | undefined;\n controls?: boolean | undefined;\n autoPlay?: boolean | undefined;\n loop?: boolean | undefined;\n muted?: boolean | undefined;\n playsInline?: boolean | undefined;\n preload?: \"none\" | \"metadata\" | \"auto\" | undefined;\n /** Space-separated native controls to hide — forwarded to `<video controlsList>`. */\n controlsList?: string | undefined;\n /**\n * Poster frame forwarded to `<video poster>`. Takes the branded\n * {@link DurableSrc} only (law 3) — the host resolves/mints it, exactly\n * like the element `src`; there is no raw-string lane.\n */\n poster?: DurableSrc | undefined;\n /**\n * Label reported to the host's playback-session port while this element\n * plays (e.g. \"Video (fullscreen)\" in a lightbox). Default: `alt`, then\n * \"Media file\".\n */\n playbackLabel?: string | undefined;\n rounded?: \"none\" | \"sm\" | \"md\" | \"lg\" | \"full\" | undefined;\n /** Click handler — wires up cursor + role + keyboard activation. */\n onClick?: ((event: React.MouseEvent | React.KeyboardEvent) => void) | undefined;\n /**\n * Fires after the client's ONE recovery attempt is exhausted (or the\n * failure was unrecoverable). The internal error fallback still renders\n * unless `errorFallback={null}`.\n */\n onError?:\n | ((\n event: React.SyntheticEvent<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >,\n ) => void)\n | undefined;\n onLoad?:\n | ((\n event: React.SyntheticEvent<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >,\n ) => void)\n | undefined;\n /**\n * Forwarded to the underlying element for imperative DOM access. Not a\n * React `forwardRef` — pass any ref-like value here instead. When\n * supplied, the ImageComponent branch is skipped so the ref attaches to\n * the real DOM node.\n */\n mediaElementRef?:\n | React.Ref<HTMLImageElement | HTMLVideoElement | HTMLAudioElement>\n | undefined;\n /**\n * Canvas pixel reads: `crossOrigin` consumers route through the\n * bearer-authenticated blob lane unless the resolution is a CORS-safe\n * public CDN URL.\n */\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined;\n border?: \"none\" | \"subtle\" | undefined;\n className?: string | undefined;\n}\n\nconst SIZE_PX: Record<\n Exclude<InlineMediaRefSize, \"fill\" | { width: number; height: number }>,\n number\n> = {\n xs: 24,\n sm: 32,\n md: 64,\n lg: 128,\n xl: 256,\n};\n\nconst ROUNDED_CLASS: Record<\n NonNullable<InlineMediaRefProps[\"rounded\"]>,\n string\n> = {\n none: \"\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n full: \"rounded-full\",\n};\n\nfunction resolveDimensions(\n size: InlineMediaRefSize,\n): { width: number; height: number } | \"fill\" {\n if (typeof size === \"object\") return size;\n if (size === \"fill\") return \"fill\";\n const px = SIZE_PX[size];\n return { width: px, height: px };\n}\n\nfunction inferElementType(\n ref: MediaRefLike | null | undefined,\n resolutionKind: \"image\" | \"video\" | \"audio\" | \"file\" | undefined,\n override?: InlineMediaRefProps[\"as\"],\n): \"img\" | \"video\" | \"audio\" {\n if (override) return override;\n if (ref && typeof ref === \"object\" && ref.mime_type) {\n if (ref.mime_type.startsWith(\"video/\")) return \"video\";\n if (ref.mime_type.startsWith(\"audio/\")) return \"audio\";\n }\n if (resolutionKind === \"video\") return \"video\";\n if (resolutionKind === \"audio\") return \"audio\";\n return \"img\";\n}\n\n/**\n * Best-effort URL prettifier for the informative error panel. Parsing for\n * DISPLAY only — never construction (law 5).\n */\nfunction prettifyUrl(url: string): { host: string | null; tail: string } {\n try {\n const u = new URL(url);\n const tail = `${u.pathname}${u.search}`;\n return { host: u.host, tail: tail === \"/\" ? \"\" : tail };\n } catch {\n return { host: null, tail: url };\n }\n}\n\nconst INERT_PLAYBACK: PlaybackSessionPort = {\n useMediaElementSink(forward) {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- stable inert implementation, called as a hook\n return useCallback(\n (node: unknown) => {\n if (!forward) return;\n if (typeof forward === \"function\") forward(node);\n else forward.current = node;\n },\n [forward],\n );\n },\n usePlaybackSession() {\n // inert\n },\n};\n\nfunction FallbackVisual({\n kind,\n dimensions,\n rounded,\n border,\n className,\n icon,\n}: {\n kind: \"icon\" | \"skeleton\";\n dimensions: { width: number; height: number } | \"fill\";\n rounded: NonNullable<InlineMediaRefProps[\"rounded\"]>;\n border: NonNullable<InlineMediaRefProps[\"border\"]>;\n className?: string | undefined;\n icon: React.ReactNode;\n}) {\n const isFill = dimensions === \"fill\";\n const wrapperCls = cn(\n \"flex items-center justify-center bg-muted/60 text-muted-foreground\",\n ROUNDED_CLASS[rounded],\n border === \"subtle\" && \"border border-border\",\n kind === \"skeleton\" && \"animate-pulse\",\n isFill && \"w-full h-full\",\n className,\n );\n return (\n <div\n className={wrapperCls}\n style={\n isFill\n ? undefined\n : { width: dimensions.width, height: dimensions.height }\n }\n aria-hidden={kind === \"skeleton\"}\n >\n {kind === \"icon\" ? icon : null}\n </div>\n );\n}\n\nfunction InformativeErrorFallback({\n url,\n alt,\n elementType,\n mediaRef,\n failurePhase,\n dimensions,\n rounded,\n className,\n}: {\n url: string;\n alt: string;\n elementType: \"img\" | \"video\" | \"audio\";\n mediaRef: MediaRefLike | null | undefined;\n /** Which pipeline phase put this panel on screen (diagnostics backstop). */\n failurePhase: MediaFailurePhase;\n dimensions: { width: number; height: number } | \"fill\";\n rounded: NonNullable<InlineMediaRefProps[\"rounded\"]>;\n className?: string | undefined;\n}) {\n // THE BACKSTOP (2026-08-30 outage rule): if this panel is on screen, a\n // terminal media failure happened — and it MUST have been captured. The\n // upstream hooks normally already did (the per-identity latch dedupes this\n // to zero extra rows); if any path ever misses, this mount screams.\n const capture = useMediaFailureCapture();\n const identity = failureMediaIdentity(mediaRef ?? null, url);\n useEffect(() => {\n capture({\n phase: failurePhase,\n mediaRef: identity,\n terminal: true,\n message: `media unavailable panel rendered for ${elementType} (${failurePhase} failure)`,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [identity, failurePhase]);\n const shortAxis =\n dimensions === \"fill\"\n ? Number.POSITIVE_INFINITY\n : Math.min(dimensions.width, dimensions.height);\n const isCompact = dimensions !== \"fill\" && shortAxis < 64;\n const isMidsize = shortAxis < 140;\n\n const fileId =\n mediaRef && typeof mediaRef === \"object\" && \"file_id\" in mediaRef\n ? (mediaRef.file_id ?? null)\n : null;\n\n const FailIcon =\n elementType === \"video\"\n ? VideoOffIcon\n : elementType === \"audio\"\n ? VolumeXIcon\n : ImageOffIcon;\n\n const tooltip = [\n `Failed to load ${elementType}`,\n alt && `alt: ${alt}`,\n `url: ${url}`,\n fileId && `file_id: ${fileId}`,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n if (isCompact) {\n return (\n <div\n className={cn(\n \"flex items-center justify-center bg-destructive/5 text-destructive border border-destructive/40 border-dashed\",\n ROUNDED_CLASS[rounded],\n className,\n )}\n style={{ width: dimensions.width, height: dimensions.height }}\n role=\"img\"\n aria-label={`Failed to load ${elementType}${alt ? `: ${alt}` : \"\"}`}\n title={tooltip}\n >\n <FailIcon className=\"h-1/2 w-1/2 max-h-5 max-w-5\" />\n </div>\n );\n }\n\n return (\n <InformativeErrorPanel\n url={url}\n alt={alt}\n elementType={elementType}\n fileId={fileId}\n dimensions={dimensions}\n rounded={rounded}\n className={className}\n compact={isMidsize}\n icon={<FailIcon className=\"h-3.5 w-3.5 shrink-0\" />}\n tooltip={tooltip}\n />\n );\n}\n\nfunction InformativeErrorPanel({\n url,\n alt,\n elementType,\n fileId,\n dimensions,\n rounded,\n className,\n compact,\n icon,\n tooltip,\n}: {\n url: string;\n alt: string;\n elementType: \"img\" | \"video\" | \"audio\";\n fileId: string | null;\n dimensions: { width: number; height: number } | \"fill\";\n rounded: NonNullable<InlineMediaRefProps[\"rounded\"]>;\n className?: string | undefined;\n compact: boolean;\n icon: React.ReactNode;\n tooltip: string;\n}) {\n const [copied, setCopied] = useState(false);\n const isFill = dimensions === \"fill\";\n const { host, tail } = prettifyUrl(url);\n\n const handleCopy = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n event.preventDefault();\n // A refused copy (non-HTTPS / permission denied) leaves the button\n // un-flipped; the tooltip + selectable text still give the URL.\n void copyText(url).then((landed) => {\n if (!landed) return;\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n });\n },\n [url],\n );\n\n return (\n <div\n className={cn(\n \"flex flex-col bg-destructive/5 text-foreground border border-destructive/40 border-dashed overflow-hidden\",\n ROUNDED_CLASS[rounded],\n compact ? \"p-1.5 gap-0.5\" : \"p-2 gap-1\",\n isFill ? \"w-full h-full\" : \"\",\n className,\n )}\n style={\n isFill\n ? undefined\n : { width: dimensions.width, height: dimensions.height }\n }\n role=\"img\"\n aria-label={`Failed to load ${elementType}${alt ? `: ${alt}` : \"\"}`}\n title={tooltip}\n >\n <div\n className={cn(\n \"flex items-center gap-1.5 text-destructive font-medium leading-tight\",\n compact ? \"text-[10px]\" : \"text-xs\",\n )}\n >\n {icon}\n <span className=\"truncate\">\n {elementType === \"img\"\n ? \"Image failed to load\"\n : elementType === \"video\"\n ? \"Video failed to load\"\n : \"Audio failed to load\"}\n </span>\n </div>\n\n {alt && !compact && (\n <div\n className=\"text-[11px] text-muted-foreground italic line-clamp-1\"\n title={alt}\n >\n {alt}\n </div>\n )}\n\n <div\n className={cn(\n \"flex items-end gap-1 mt-auto min-w-0\",\n compact ? \"text-[9px]\" : \"text-[10px]\",\n )}\n >\n <div className=\"font-mono text-muted-foreground truncate flex-1 min-w-0\">\n {host ? (\n <>\n <span className=\"text-foreground/80\">{host}</span>\n {tail && <span className=\"opacity-70\">{tail}</span>}\n </>\n ) : (\n <span>{tail}</span>\n )}\n </div>\n <button\n type=\"button\"\n onClick={handleCopy}\n className={cn(\n \"shrink-0 p-0.5 rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors focus:outline-none focus:ring-1 focus:ring-destructive/40\",\n copied && \"text-emerald-600 dark:text-emerald-500\",\n )}\n aria-label={copied ? \"URL copied\" : \"Copy URL\"}\n title={copied ? \"URL copied\" : \"Copy URL\"}\n >\n {copied ? (\n <CheckIcon className=\"h-3 w-3\" width={12} height={12} />\n ) : (\n <CopyIcon className=\"h-3 w-3\" width={12} height={12} />\n )}\n </button>\n </div>\n\n {fileId && !compact && (\n <div className=\"text-[9px] font-mono text-muted-foreground/70 truncate\">\n {fileId}\n </div>\n )}\n </div>\n );\n}\n\nexport function InlineMediaRef({\n ref: mediaRef,\n size = \"md\",\n fit = \"cover\",\n fallback = \"icon\",\n fallbackIcon,\n errorFallback = \"info\",\n alt = \"\",\n as,\n controls = true,\n autoPlay,\n loop,\n muted,\n playsInline,\n preload,\n controlsList,\n poster,\n playbackLabel,\n rounded = \"md\",\n onClick,\n onError,\n onLoad,\n mediaElementRef,\n crossOrigin,\n border = \"none\",\n className,\n}: InlineMediaRefProps) {\n const ports = useMediaHostPorts();\n const { resolution, status, reason } = useMediaResolution(mediaRef);\n const elementType = inferElementType(mediaRef, resolution?.kind, as);\n\n // Private pixels ride the bearer-authenticated blob lane; a verified\n // public CDN URL is the sole direct-url exception for crossOrigin\n // consumers. This is automatic: callers never select auth transport.\n const needsBlob = Boolean(\n resolution &&\n (resolution.transport === \"blob\" ||\n (crossOrigin && resolution.isCdn !== true)),\n );\n const blob = useMediaBlob(needsBlob ? mediaRef : null);\n const resolvedUrl = needsBlob ? blob.url : (resolution?.src ?? null);\n\n const terminalCallback = (event?: unknown) =>\n onError?.(\n event as React.SyntheticEvent<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >,\n );\n\n const recovery = useMediaLoadRecovery(resolvedUrl, {\n recoverable: resolution?.recoverable !== false,\n failureRef: mediaRef,\n onTerminal: terminalCallback,\n });\n // The heal ladder's object URL (bearer lane) replaces a dead element src —\n // the user sees the media; the incident row is still written.\n const url = recovery.healedSrc ?? resolvedUrl;\n const blobRecovery = useMediaBlobLoadRecovery(\n needsBlob ? mediaRef : null,\n needsBlob ? url : null,\n {\n onRetry: blob.retry,\n onTerminal: terminalCallback,\n },\n );\n\n // Host audio system: output-sink routing + exclusive-playback join.\n const playback = ports.playbackSession ?? INERT_PLAYBACK;\n const sessionElRef = useRef<unknown>(null);\n const [isMediaPlaying, setIsMediaPlaying] = useState(false);\n const portSinkRef = playback.useMediaElementSink(\n mediaElementRef as ((node: unknown) => void) | { current: unknown } | null | undefined,\n );\n const sinkRef = (node: HTMLVideoElement | HTMLAudioElement | null) => {\n sessionElRef.current = node;\n portSinkRef(node);\n };\n const trackKey = useMemo(() => {\n if (mediaRef && typeof mediaRef === \"object\" && mediaRef.file_id) {\n return mediaRef.file_id;\n }\n return typeof mediaRef === \"string\" ? mediaRef : undefined;\n }, [mediaRef]);\n playback.usePlaybackSession(\n {\n isPlaying: isMediaPlaying,\n source: \"file-media\",\n label: playbackLabel ?? (alt || \"Media file\"),\n trackKey,\n },\n sessionElRef,\n );\n const mediaSessionEvents = {\n onPlay: () => setIsMediaPlaying(true),\n onPause: () => setIsMediaPlaying(false),\n onEnded: () => setIsMediaPlaying(false),\n };\n\n const mediaResolutionError =\n status === \"unavailable\" ? (reason ?? \"unknown\") : (blob.error ?? null);\n const dimensions = resolveDimensions(size);\n const isFill = dimensions === \"fill\";\n const activeRecovery = needsBlob ? blobRecovery : recovery;\n const retryKey = needsBlob ? 0 : recovery.retryKey;\n const hasLoadError = activeRecovery.failed;\n const handleLoadError = activeRecovery.onLoadError as React.ReactEventHandler<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >;\n\n const defaultIcon =\n elementType === \"video\" ? (\n <FileVideoIcon className=\"h-1/2 w-1/2\" />\n ) : elementType === \"audio\" ? (\n <FileAudioIcon className=\"h-1/2 w-1/2\" />\n ) : mediaRef ? (\n <ImageIcon className=\"h-1/2 w-1/2\" />\n ) : (\n <FileGlyph className=\"h-1/2 w-1/2\" />\n );\n\n const unresolvedDisplayUrl =\n mediaRef && typeof mediaRef === \"object\" && mediaRef.file_id\n ? `file:${mediaRef.file_id}`\n : \"unresolved-media\";\n\n if (!url) {\n if (mediaResolutionError) {\n if (errorFallback === null) return null;\n if (errorFallback === \"info\") {\n return (\n <InformativeErrorFallback\n url={unresolvedDisplayUrl}\n alt={alt}\n elementType={elementType}\n mediaRef={mediaRef}\n failurePhase={status === \"unavailable\" ? \"resolve\" : \"blob\"}\n dimensions={dimensions}\n rounded={rounded}\n className={className}\n />\n );\n }\n return (\n <FallbackVisual\n kind={errorFallback}\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={fallbackIcon ?? defaultIcon}\n />\n );\n }\n if (needsBlob && blob.loading) {\n return (\n <FallbackVisual\n kind=\"skeleton\"\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={null}\n />\n );\n }\n if (!fallback) return null;\n return (\n <FallbackVisual\n kind={fallback}\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={fallbackIcon ?? defaultIcon}\n />\n );\n }\n\n // URL resolved but the remote fetch failed — render the informative (or\n // caller-overridden) error fallback. Keeps the original dimensions so\n // layouts don't jump.\n if (hasLoadError) {\n if (errorFallback === null) return null;\n if (errorFallback === \"info\") {\n return (\n <InformativeErrorFallback\n url={url}\n alt={alt}\n elementType={elementType}\n mediaRef={mediaRef}\n failurePhase=\"element-load\"\n dimensions={dimensions}\n rounded={rounded}\n className={className}\n />\n );\n }\n return (\n <FallbackVisual\n kind={errorFallback}\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={fallbackIcon ?? defaultIcon}\n />\n );\n }\n\n const interactiveProps = onClick\n ? {\n onClick,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n onClick(event);\n }\n },\n role: \"button\" as const,\n tabIndex: 0,\n className: cn(\n \"cursor-pointer\",\n \"focus:outline-none focus:ring-2 focus:ring-primary/50\",\n ),\n }\n : {};\n\n const baseCls = cn(\n \"block\",\n isFill && \"w-full h-full\",\n ROUNDED_CLASS[rounded],\n border === \"subtle\" && \"border border-border\",\n onClick && \"cursor-pointer\",\n interactiveProps.className,\n className,\n );\n\n const objectFitClass =\n fit === \"cover\"\n ? \"object-cover\"\n : fit === \"contain\"\n ? \"object-contain\"\n : \"object-fill\";\n\n const sizeAttrs = isFill\n ? {}\n : { width: dimensions.width, height: dimensions.height };\n\n if (elementType === \"video\") {\n return (\n <video\n key={retryKey}\n ref={sinkRef}\n src={url}\n {...sizeAttrs}\n className={cn(baseCls, objectFitClass)}\n controls={controls}\n autoPlay={autoPlay}\n loop={loop}\n muted={muted}\n playsInline={playsInline}\n preload={preload}\n controlsList={controlsList}\n poster={poster}\n onLoadedData={\n onLoad as React.ReactEventHandler<HTMLVideoElement> | undefined\n }\n onError={handleLoadError as React.ReactEventHandler<HTMLVideoElement>}\n crossOrigin={crossOrigin}\n {...mediaSessionEvents}\n {...interactiveProps}\n />\n );\n }\n if (elementType === \"audio\") {\n return (\n <audio\n key={retryKey}\n ref={sinkRef}\n src={url}\n className={cn(baseCls)}\n controls={controls}\n autoPlay={autoPlay}\n loop={loop}\n muted={muted}\n preload={preload}\n {...mediaSessionEvents}\n onLoadedData={\n onLoad as React.ReactEventHandler<HTMLAudioElement> | undefined\n }\n onError={handleLoadError as React.ReactEventHandler<HTMLAudioElement>}\n crossOrigin={crossOrigin}\n {...interactiveProps}\n />\n );\n }\n\n // Bail to plain <img> when the caller needs an event-target escape hatch\n // (onLoad / element ref / crossOrigin) — the native events must reach the\n // caller with the original SyntheticEvent shape.\n const needsPlainImg = !!onLoad || !!mediaElementRef || !!crossOrigin;\n\n // Use the host's ImageComponent (e.g. a next/image adapter) for our own\n // CDN-hosted URLs — better lazy-loading + DPR handling; arbitrary external\n // URLs may not be on the host's remotePatterns list, so they fall back to\n // a plain <img>.\n const isCdnUrl =\n resolution?.isCdn ??\n (url.startsWith(\"https://cdn.\") || url.includes(\"/cdn/\"));\n const HostImage = ports.ImageComponent as\n | ComponentType<MediaImageComponentProps>\n | undefined;\n if (HostImage && isCdnUrl && !isFill && !needsPlainImg && !needsBlob) {\n return (\n <HostImage\n key={retryKey}\n src={url}\n alt={alt}\n width={dimensions.width}\n height={dimensions.height}\n className={cn(baseCls, objectFitClass)}\n onError={handleLoadError as (event: unknown) => void}\n {...(interactiveProps as Partial<MediaImageComponentProps>)}\n />\n );\n }\n return (\n <img\n key={retryKey}\n ref={mediaElementRef as React.Ref<HTMLImageElement> | undefined}\n src={url}\n alt={alt}\n {...sizeAttrs}\n className={cn(baseCls, objectFitClass)}\n onLoad={onLoad as React.ReactEventHandler<HTMLImageElement> | undefined}\n onError={handleLoadError}\n crossOrigin={crossOrigin}\n {...interactiveProps}\n />\n );\n}\n\nexport default InlineMediaRef;\n","/**\n * src/core/context.ts — the MediaClient / host-ports React contexts.\n *\n * The context OBJECTS live on `globalThis` under `Symbol.for` slots — NOT at\n * module level. With `splitting: false` this module is duplicated into the\n * `/core` and `/react` bundles, and CJS/ESM each instantiate their own module\n * graph; a module-level `createContext` would silently produce two different\n * contexts (a Provider from one graph invisible to a consumer from the\n * other) — the kit tap-target/link-registry lesson. Never \"clean this up\".\n */\n\nimport {\n createContext,\n createElement,\n useContext,\n type Context,\n type ReactNode,\n} from \"react\";\nimport type { MediaClient, MediaHostPorts } from \"../types\";\n\nconst CLIENT_SLOT = Symbol.for(\"ai-matrx.media.client-context\");\nconst PORTS_SLOT = Symbol.for(\"ai-matrx.media.host-ports-context\");\n\ntype SlotHost = typeof globalThis & {\n [CLIENT_SLOT]?: Context<MediaClient | null>;\n [PORTS_SLOT]?: Context<MediaHostPorts>;\n};\n\nfunction clientContext(): Context<MediaClient | null> {\n const host = globalThis as SlotHost;\n host[CLIENT_SLOT] ??= createContext<MediaClient | null>(null);\n return host[CLIENT_SLOT];\n}\n\nconst INERT_PORTS: MediaHostPorts = {};\n\nfunction portsContext(): Context<MediaHostPorts> {\n const host = globalThis as SlotHost;\n host[PORTS_SLOT] ??= createContext<MediaHostPorts>(INERT_PORTS);\n return host[PORTS_SLOT];\n}\n\nexport interface MediaProviderProps {\n client: MediaClient;\n /**\n * Optional host ports (playback session, actions, ImageComponent). Must be\n * referentially stable — the playback port members are hooks.\n */\n ports?: MediaHostPorts | undefined;\n children?: ReactNode;\n}\n\n/** Wire the injected MediaClient (and optional host ports) into the tree. */\nexport function MediaProvider({ client, ports, children }: MediaProviderProps) {\n const ClientCtx = clientContext();\n const PortsCtx = portsContext();\n return createElement(\n ClientCtx.Provider,\n { value: client },\n createElement(PortsCtx.Provider, { value: ports ?? INERT_PORTS }, children),\n );\n}\n\n/** The injected MediaClient. Throws when no MediaProvider is mounted. */\nexport function useMediaClient(): MediaClient {\n const client = useContext(clientContext());\n if (!client) {\n throw new Error(\n \"@ai-matrx/media: no MediaClient. Mount <MediaProvider client={...}> \" +\n \"above every media surface (canonically wired to @ai-matrx/data/files).\",\n );\n }\n return client;\n}\n\n/** The injected host ports; inert defaults when none were provided. */\nexport function useMediaHostPorts(): MediaHostPorts {\n return useContext(portsContext());\n}\n","/**\n * src/core/diagnostics.ts — the terminal-failure capture machinery.\n *\n * Born from the 2026-08-30 prod outage: server-side cookie-secret drift\n * killed every private image, the package rendered its honest \"unavailable\"\n * panel — and nothing reached the host's Error Inspector or error DB,\n * because the package had no diagnostics port and the host cannot capture\n * what it never learns about. Per ruling C22 the capture logic lives HERE,\n * so every consuming repo inherits it.\n *\n * The contract:\n *\n * - every terminal failure path emits exactly ONE {@link MediaFailureInfo}\n * per media identity (latched — re-renders, remounts and the unavailable\n * panel backstop never spam);\n * - a bound `MediaHostPorts.diagnostics.capture` receives the payload;\n * WITHOUT one (or if it throws) the package `console.error`s the same\n * structured payload — the loud default. A media failure is NEVER silent;\n * - the payload never carries a signed URL: identity is the file id or a\n * query-stripped URL key ({@link failureMediaIdentity}).\n *\n * The latch lives on `globalThis` under a `Symbol.for` slot (same reason as\n * context.ts: with `splitting: false` + dual formats, module-level state\n * silently duplicates across bundle/loader graphs).\n */\n\nimport { useCallback, useRef } from \"react\";\nimport type { MediaFailureInfo, MediaRefLike } from \"../types\";\nimport { useMediaHostPorts } from \"./context\";\n\nconst LATCH_SLOT = Symbol.for(\"ai-matrx.media.failure-latch\");\n\ntype SlotHost = typeof globalThis & {\n [LATCH_SLOT]?: Set<string>;\n};\n\nfunction latch(): Set<string> {\n const host = globalThis as SlotHost;\n host[LATCH_SLOT] ??= new Set<string>();\n return host[LATCH_SLOT];\n}\n\n/**\n * Clear the once-per-failure latch. For tests, and for hosts at auth\n * boundaries (a sign-in can genuinely fix a previously-terminal failure, and\n * a recurrence after it deserves a fresh capture).\n */\nexport function resetMediaFailureLatch(): void {\n latch().clear();\n}\n\n/**\n * Durable diagnostics identity for a media reference. NEVER a signed URL:\n * file ids win, and any URL is stripped to origin + path (signatures ride\n * query strings).\n */\nexport function failureMediaIdentity(\n ref: MediaRefLike | null | undefined,\n src?: string | null,\n): string {\n if (ref && typeof ref === \"object\" && ref.file_id) return `file:${ref.file_id}`;\n let raw: string | null | undefined;\n if (typeof ref === \"string\") raw = ref;\n else if (ref && typeof ref === \"object\" && ref.url) raw = ref.url;\n else raw = src;\n if (!raw) return \"<unknown-media>\";\n if (raw.startsWith(\"blob:\")) return \"blob:object-url\";\n try {\n const u = new URL(raw);\n return `url:${u.origin}${u.pathname}`;\n } catch {\n // A bare fileId string, or an unparseable fragment — still strip any query.\n const clean = raw.split(/[?#]/, 1)[0] ?? raw;\n return `ref:${clean}`;\n }\n}\n\n/**\n * Emit one media-failure capture through the host sink, or the loud\n * console.error default when no sink is bound (or the sink throws).\n * Latched per (terminal|warning, mediaRef) — one capture per failure,\n * however many renders, hooks, or backstops observe it.\n */\nexport function emitMediaFailure(\n capture: ((info: MediaFailureInfo) => void) | undefined,\n info: MediaFailureInfo,\n): void {\n const key = `${info.terminal ? \"terminal\" : \"warning\"}|${info.mediaRef}`;\n const seen = latch();\n if (seen.has(key)) return;\n seen.add(key);\n if (capture) {\n try {\n capture(info);\n return;\n } catch {\n // A broken sink must not re-silence the failure — fall through.\n }\n }\n console.error(\n \"[@ai-matrx/media] media failure (no diagnostics sink captured it — \" +\n \"bind MediaHostPorts.diagnostics.capture to your error system)\",\n info,\n );\n}\n\n/**\n * Hook form: a stable capture function wired to the host ports. Every core\n * hook and the unavailable-panel backstop route through this — the phase\n * vocabulary and the latch stay in ONE place.\n */\nexport function useMediaFailureCapture(): (\n info: Omit<MediaFailureInfo, \"source\">,\n) => void {\n const ports = useMediaHostPorts();\n const capture = ports.diagnostics?.capture;\n // The latest sink without invalidating effect deps in the calling hooks —\n // the port object is referentially stable by contract, but a fresh binding\n // (e.g. tests swapping providers) must not capture stale.\n const captureRef = useRef(capture);\n captureRef.current = capture;\n return useCallback((info: Omit<MediaFailureInfo, \"source\">) => {\n emitMediaFailure(captureRef.current, { source: \"media\", ...info });\n }, []);\n}\n","/**\n * src/core/use-media-blob.ts — bytes for canvas/crossOrigin/private-pixel\n * consumers, as state.\n *\n * The behavior contract is ported from matrx-frontend `hooks/useFileBlob.ts`;\n * the byte machinery (auth, caching, in-flight dedup, IDB tiers, progress) is\n * the CLIENT's (C10 persistence-injected — the package owns no cache). The\n * hook owns only the React lifecycle: load on mount/ref change, release the\n * handle on unmount, expose a retry.\n */\n\nimport { useEffect, useState } from \"react\";\nimport type { MediaRefLike } from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\nimport { stableRefKey } from \"./ref-key\";\n\n/** Structural HTTP status probe for client errors (never a validation). */\nfunction statusOf(err: unknown): number | undefined {\n if (err && typeof err === \"object\") {\n const candidate =\n (err as { status?: unknown }).status ??\n (err as { statusCode?: unknown }).statusCode;\n if (typeof candidate === \"number\") return candidate;\n }\n return undefined;\n}\n\nexport interface MediaBlobState {\n /** `blob:` object URL safe to feed into any browser API. `null` until ready. */\n url: string | null;\n blob: Blob | null;\n loading: boolean;\n error: string | null;\n /** Force a fresh byte read (the client decides whether to drop its cache). */\n retry: () => void;\n}\n\nexport function useMediaBlob(\n ref: MediaRefLike | null | undefined,\n): MediaBlobState {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const refKey = stableRefKey(ref);\n const [state, setState] = useState<{\n url: string | null;\n blob: Blob | null;\n loading: boolean;\n error: string | null;\n }>({ url: null, blob: null, loading: !!ref, error: null });\n const [retryToken, setRetryToken] = useState(0);\n\n useEffect(() => {\n if (!ref) {\n setState({ url: null, blob: null, loading: false, error: null });\n return undefined;\n }\n let cancelled = false;\n let release: (() => void) | null = null;\n setState({ url: null, blob: null, loading: true, error: null });\n client.getBlob(ref).then(\n (handle) => {\n if (cancelled) {\n handle.release();\n return;\n }\n release = handle.release;\n setState({ url: handle.url, blob: handle.blob, loading: false, error: null });\n },\n (err: unknown) => {\n if (cancelled) return;\n const message =\n err instanceof Error ? err.message : String(err ?? \"Failed to load file\");\n setState({ url: null, blob: null, loading: false, error: message });\n // Terminal-failure capture (phase \"blob\"): the private-pixels bytes\n // never arrived. Latched per media identity by the machinery.\n const status = statusOf(err);\n capture({\n phase: \"blob\",\n mediaRef: failureMediaIdentity(ref),\n terminal: true,\n message: `getBlob() failed: ${message}`,\n ...(status !== undefined ? { status } : {}),\n });\n },\n );\n return () => {\n cancelled = true;\n release?.();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client, refKey, retryToken]);\n\n return {\n ...state,\n retry: () => setRetryToken((t) => t + 1),\n };\n}\n","/**\n * src/core/ref-key.ts — stable identity key for a MediaRefLike.\n *\n * Callers routinely pass fresh object literals every render; hooks key their\n * effects/memos on this string instead of object identity. Ported from the\n * original `stableSourceKey` (matrx-frontend `handler/hooks/useFileAs.ts`).\n */\n\nimport type { MediaRefLike } from \"../types\";\n\nexport function stableRefKey(ref: MediaRefLike | null | undefined): string {\n if (!ref) return \"<none>\";\n if (typeof ref === \"string\") return `s:${ref}`;\n if (ref.file_id) return `id:${ref.file_id}:${ref.mime_type ?? \"\"}`;\n if (ref.url) return `url:${ref.url}:${ref.mime_type ?? \"\"}`;\n return \"<empty-ref>\";\n}\n","/**\n * Element-load recovery for a blob/object URL.\n *\n * Object URLs are disposable transports, never identity. A concurrent\n * version/realtime invalidation can revoke one after getBlob() resolves but\n * before the media element consumes it. The client owns the retry policy and\n * cache eviction; this hook only obeys its verdict and asks useMediaBlob to\n * re-read the durable ref.\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { MediaRefLike } from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\nimport { stableRefKey } from \"./ref-key\";\n\nexport interface MediaBlobLoadRecovery {\n onLoadError: (event?: unknown) => void;\n failed: boolean;\n}\n\nexport function useMediaBlobLoadRecovery(\n ref: MediaRefLike | null | undefined,\n source: string | null,\n options: {\n onRetry: () => void;\n onTerminal?: ((event?: unknown) => void) | undefined;\n },\n): MediaBlobLoadRecovery {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const refKey = stableRefKey(ref);\n const [failed, setFailed] = useState(false);\n const attemptRef = useRef(0);\n const generationRef = useRef(0);\n const recoveryInFlightRef = useRef(false);\n const onRetry = options.onRetry;\n const onTerminal = options.onTerminal;\n\n useEffect(() => {\n generationRef.current += 1;\n attemptRef.current = 0;\n recoveryInFlightRef.current = false;\n setFailed(false);\n return () => { generationRef.current += 1; };\n }, [refKey]);\n\n // A policy-approved re-read first clears the source, then supplies the new\n // object URL. Only that source transition releases duplicate-error gating;\n // the durable ref keeps its single retry allowance throughout.\n useEffect(() => {\n recoveryInFlightRef.current = false;\n }, [source]);\n\n const finishTerminal = useCallback(\n (event: unknown, attempt: number, message: string) => {\n setFailed(true);\n capture({\n phase: \"element-load\",\n mediaRef: failureMediaIdentity(ref ?? null, source),\n terminal: true,\n retryOutcome: attempt > 1 ? \"retried\" : \"not-attempted\",\n message,\n });\n onTerminal?.(event);\n },\n [capture, onTerminal, ref, source],\n );\n\n const onLoadError = useCallback(\n (event?: unknown) => {\n if (recoveryInFlightRef.current || !source) return;\n recoveryInFlightRef.current = true;\n attemptRef.current += 1;\n const attempt = attemptRef.current;\n const generation = generationRef.current;\n const recover = client.recoverBlobLoadError;\n if (!ref || !recover) {\n finishTerminal(\n event,\n attempt,\n \"blob-backed media element failed to load and the client exposes no object-URL recovery policy\",\n );\n return;\n }\n recover(ref, attempt).then(\n (verdict) => {\n if (generation !== generationRef.current) return;\n if (verdict === \"retry\") {\n setFailed(false);\n onRetry();\n return;\n }\n finishTerminal(\n event,\n attempt,\n attempt > 1\n ? \"blob-backed media element failed after the client-approved re-read\"\n : \"blob-backed media recovery was declined on the first attempt\",\n );\n },\n (err: unknown) => {\n if (generation !== generationRef.current) return;\n finishTerminal(\n event,\n attempt,\n `blob-backed media recovery failed: ${\n err instanceof Error ? err.message : String(err ?? \"unknown error\")\n }`,\n );\n },\n );\n },\n [client, finishTerminal, onRetry, ref, source],\n );\n\n return { onLoadError, failed };\n}\n","/**\n * src/core/use-media-load-recovery.ts — the durable-URL load-error machine.\n *\n * Ported from matrx-frontend `handler/hooks/useDurableSrc.ts`, with the\n * recovery POLICY inverted onto `MediaClient.recoverLoadError` (session\n * refresh → same-URL retry → terminal; the package may not implement a retry\n * of its own — that invariant is what killed the divergent\n * useUnifiedImageUrl/useUnifiedVideoUrl copies).\n *\n * `recoverable: false` resolutions (foreign URLs, blob: object URLs) skip the\n * client and fail straight through — a session refresh can't resurrect\n * someone else's link rot.\n *\n * Every terminal outcome emits exactly one `MediaFailureInfo` through the\n * diagnostics machinery (the 2026-08-30 outage rule):\n *\n * - element error, recovery impossible → phase \"element-load\",\n * retryOutcome \"not-attempted\"\n * - terminal verdict after a granted retry → phase \"element-load\",\n * retryOutcome \"retried\"\n * - terminal verdict on the FIRST attempt → phase \"recovery\",\n * retryOutcome \"not-attempted\"\n * (the recovery machinery itself declined — usually the session mint\n * came back unusable)\n * - `recoverLoadError` rejected → phase \"session\",\n * retryOutcome \"recovery-failed\"\n *\n * A structured `MediaRecoveryReport` verdict may additionally carry the\n * `/files/session` mint's `secret_source`; `\"ephemeral\"` emits a NON-terminal\n * warning (\"private renders will break across restarts/instances\") the moment\n * the client sees it — before the outage, not after. The bare string verdict\n * stays fully supported; the field is tolerated absent.\n */\n\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n mintDurableSrc,\n type DurableSrc,\n type MediaHealAttempt,\n type MediaHealResult,\n type MediaRecoveryReport,\n type MediaRecoveryVerdict,\n type MediaRefLike,\n} from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\n\nexport interface MediaLoadRecovery {\n /**\n * Bump this into the media element's `key` (or otherwise force a remount)\n * so a retry actually re-fires the network request for the same src.\n */\n retryKey: number;\n /** Wire to the media element's `onError`. */\n onLoadError: (event?: unknown) => void;\n /** True once recovery AND the heal ladder are exhausted (or never possible). */\n failed: boolean;\n /**\n * A renderable source produced by the heal ladder after the primary lane\n * died (a `blob:` object URL from the bearer lane). Bind it INSTEAD of the\n * original src when set — the user sees the media; the row is still logged.\n */\n healedSrc: string | null;\n}\n\nfunction normalizeOutcome(\n outcome: MediaRecoveryVerdict | MediaRecoveryReport,\n): MediaRecoveryReport {\n return typeof outcome === \"string\" ? { verdict: outcome } : outcome;\n}\n\n/** The app-wide latch identity for the ephemeral-secret warning. */\nconst EPHEMERAL_SECRET_IDENTITY = \"server:files-session-secret\";\n\nexport function useMediaLoadRecovery(\n src: DurableSrc | string | null,\n options?: {\n recoverable?: boolean | undefined;\n /** Fires once recovery is exhausted, with the original element event. */\n onTerminal?: ((event?: unknown) => void) | undefined;\n /**\n * Durable identity of the media being recovered, for diagnostics —\n * failures are reported against the file id / ref key, never the URL.\n * Falls back to the query-stripped src when absent.\n */\n failureRef?: MediaRefLike | null | undefined;\n },\n): MediaLoadRecovery {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const recoverable = options?.recoverable !== false;\n const onTerminal = options?.onTerminal;\n const failureRef = options?.failureRef;\n const [result, setResult] = useState<{\n source: string | null;\n retryKey: number;\n failed: boolean;\n healedSrc: string | null;\n }>({ source: src, retryKey: 0, failed: false, healedSrc: null });\n const attemptRef = useRef(0);\n const recoveryInFlightRef = useRef(false);\n\n // A different URL deserves a fresh recovery allowance. The visible state is\n // keyed by source below, so this effect only resets the attempt counter.\n useEffect(() => {\n attemptRef.current = 0;\n recoveryInFlightRef.current = false;\n }, [src]);\n\n // A granted retry is not complete until React has committed the remounted\n // element. Browsers can dispatch duplicate error events from the failing\n // element while the async session refresh is still settling; treating that\n // duplicate as attempt two falsely exhausts recovery before the retried\n // request exists.\n useLayoutEffect(() => {\n recoveryInFlightRef.current = false;\n }, [result.retryKey]);\n\n const identity = () => failureMediaIdentity(failureRef ?? null, src);\n\n const onLoadError = (event?: unknown) => {\n if (recoveryInFlightRef.current) return;\n if (!src || !recoverable) {\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n if (src) {\n capture({\n phase: \"element-load\",\n mediaRef: identity(),\n terminal: true,\n retryOutcome: \"not-attempted\",\n message:\n \"media element failed to load and the source is unrecoverable \" +\n \"(foreign/object URL — a session refresh cannot fix it)\",\n });\n }\n onTerminal?.(event);\n return;\n }\n recoveryInFlightRef.current = true;\n attemptRef.current += 1;\n const attempt = attemptRef.current;\n // Re-branding is sound here: only resolution srcs reach the recoverable\n // lane (blob:/foreign URLs come in with `recoverable: false`).\n client.recoverLoadError(mintDurableSrc(src), attempt).then(\n (outcome) => {\n const report = normalizeOutcome(outcome);\n if (report.secretSource === \"ephemeral\") {\n // The server signs the files-session cookie with a boot-generated\n // secret. Warn NOW — this is the exact drift that silently killed\n // every private render on 2026-08-30.\n capture({\n phase: \"session\",\n mediaRef: EPHEMERAL_SECRET_IDENTITY,\n terminal: false,\n message:\n \"server cookie secret is ephemeral — private renders will \" +\n \"break across restarts/instances (set a persistent \" +\n \"files-session secret on the server)\",\n });\n }\n if (report.verdict === \"retry\") {\n setResult((current) => ({\n source: src,\n retryKey: current.source === src ? current.retryKey + 1 : 1,\n failed: false,\n healedSrc: null,\n }));\n return;\n }\n // The ONE retry is exhausted. Before declaring the render dead, run\n // the client's heal ladder — the lanes that do not depend on the\n // cookie (bearer byte fetch, alternate host). The user is never\n // denied while any lane works; the row is written either way.\n const lane1: MediaHealAttempt = {\n lane: \"session-refresh-retry\",\n outcome: attempt > 1 ? \"http-error\" : \"unavailable\",\n ms: 0,\n ...(report.status !== undefined ? { status: report.status } : {}),\n detail:\n attempt > 1\n ? \"cookie re-minted, same durable URL retried in the element, element errored again\"\n : \"recovery declined on the first attempt (no usable session)\",\n };\n if (!failureRef || !client.healLoadError) {\n // No ladder to run (older client, or no durable ref to heal by):\n // the ONE retry's verdict is the terminal verdict, reported in the\n // pre-ladder vocabulary so existing telemetry keeps its meaning.\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: attempt > 1 ? \"element-load\" : \"recovery\",\n mediaRef: identity(),\n terminal: true,\n retryOutcome: attempt > 1 ? \"retried\" : \"not-attempted\",\n message:\n (attempt > 1\n ? \"media element failed to load after the session-refresh retry\"\n : \"media load recovery declined on the first attempt \" +\n \"(session refresh did not produce a usable session)\") +\n (failureRef\n ? \" — no heal ladder on this client (healLoadError not implemented)\"\n : \" — no durable ref supplied, so no heal lane could run\"),\n ...(report.status !== undefined ? { status: report.status } : {}),\n });\n onTerminal?.(event);\n return;\n }\n const heal: Promise<MediaHealResult> = client.healLoadError(failureRef, {\n src: mintDurableSrc(src),\n attempts: [lane1],\n });\n heal.then(\n (verdict) => {\n if (verdict.src) {\n setResult({\n source: src,\n retryKey: 0,\n failed: false,\n healedSrc: verdict.src,\n });\n capture({\n phase: \"heal\",\n mediaRef: identity(),\n terminal: false,\n healed: true,\n healedBy: verdict.healedBy,\n attempts: verdict.attempts,\n diagnosis: verdict.diagnosis,\n retryOutcome: \"retried\",\n message: `HEALED (${verdict.healedBy ?? \"unknown lane\"}): ${verdict.summary}`,\n ...(report.status !== undefined ? { status: report.status } : {}),\n });\n return;\n }\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: \"heal\",\n mediaRef: identity(),\n terminal: true,\n healed: false,\n attempts: verdict.attempts,\n diagnosis: verdict.diagnosis,\n retryOutcome: \"retried\",\n message: `DEAD after ${verdict.attempts.length} lane(s): ${verdict.summary}`,\n ...(report.status !== undefined ? { status: report.status } : {}),\n });\n onTerminal?.(event);\n },\n (err: unknown) => {\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: \"heal\",\n mediaRef: identity(),\n terminal: true,\n healed: false,\n attempts: [lane1],\n diagnosis: \"unknown\",\n retryOutcome: \"recovery-failed\",\n message: `heal ladder threw: ${\n err instanceof Error ? err.message : String(err ?? \"unknown error\")\n }`,\n });\n onTerminal?.(event);\n },\n );\n },\n (err: unknown) => {\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: \"session\",\n mediaRef: identity(),\n terminal: true,\n retryOutcome: \"recovery-failed\",\n message: `session recovery failed: ${\n err instanceof Error ? err.message : String(err ?? \"unknown error\")\n }`,\n });\n onTerminal?.(event);\n },\n );\n };\n\n return {\n retryKey: result.source === src ? result.retryKey : 0,\n onLoadError,\n failed: result.source === src ? result.failed : false,\n healedSrc: result.source === src ? result.healedSrc : null,\n };\n}\n","/**\n * @ai-matrx/media — the root types: the MediaClient port and the host ports.\n *\n * The package renders Matrx durable media; it NEVER talks to a network.\n * Everything data-shaped arrives through the injected {@link MediaClient}\n * (canonically implemented by `@ai-matrx/data/files`; any structural\n * implementation works — the strangler step wires it over an app's existing\n * file handler). The five file-handling laws are enforced here at the type\n * level:\n *\n * 1. Never fetch a media URL yourself — the package contains zero network\n * primitives; bytes exist only via {@link MediaClient.getBlob}.\n * 2. Off-boundary code resolves media itself — every component takes a\n * {@link MediaRefLike} and calls `resolve()` unconditionally. There is\n * NO `src` prop on any component in this package.\n * 3. A signed URL is a handoff, never an identity — the only string that\n * reaches a media element is the branded {@link DurableSrc}, which only\n * a MediaClient implementation can mint (via {@link mintDurableSrc}).\n * 4. Public-facing media is persisted public, never signed —\n * {@link MediaClient.shareableUrl} fails closed (`null` → the action\n * renders disabled).\n * 5. One URL contract; the engine builds URLs — zero URL construction in\n * this package; `resolve()` is the only door.\n */\n\n// ---------------------------------------------------------------------------\n// Identity\n// ---------------------------------------------------------------------------\n\n/** The canonical durable media reference. `file_id` is the identity. */\nexport interface MediaRef {\n file_id?: string | null;\n url?: string | null;\n mime_type?: string | null;\n metadata?: Record<string, unknown> | null;\n}\n\n/**\n * Identity in. A raw string is a fileId or an EXTERNAL public URL — never a\n * signed URL (the client's `resolve()` classifies and screams on one).\n */\nexport type MediaRefLike = MediaRef | string;\n\ndeclare const durable: unique symbol;\n\n/**\n * A URL that has passed through `MediaClient.resolve()` — the only string\n * type any media element in this package will bind. A caller cannot pass an\n * expiring URL through the package's types without an explicit unsafe cast.\n */\nexport type DurableSrc = string & { readonly [durable]: true };\n\n/**\n * Brand a URL as durable. FOR MediaClient IMPLEMENTATIONS ONLY — the\n * implementation must classify the URL first (the ONE signed-URL classifier\n * lives with the platform's files layer; never re-implement it here or in a\n * host). Calling this on an unclassified string defeats law 3.\n */\nexport function mintDurableSrc(url: string): DurableSrc {\n return url as DurableSrc;\n}\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\nexport type MediaKind = \"image\" | \"video\" | \"audio\" | \"file\";\n\nexport interface MediaResolution {\n src: DurableSrc;\n /** RN auth lane (`<Image source={{uri, headers}}>`); absent on web (cookie session). */\n headers?: Record<string, string> | undefined;\n mimeType?: string | undefined;\n kind: MediaKind;\n /**\n * How pixels must travel. `\"element\"` (default): bind `src` directly to the\n * media element. `\"blob\"`: the bytes require bearer auth the element cannot\n * attach — consumers go through {@link MediaClient.getBlob} and render the\n * returned object URL (the private-image lane).\n */\n transport?: \"element\" | \"blob\" | undefined;\n /**\n * A server-rendered thumbnail for this file, when the client knows one\n * (Matrx: `FileRecord.thumbnail_url` / asset variants). Consumed by the\n * thumbnail tier machine.\n */\n thumbnailSrc?: DurableSrc | undefined;\n /**\n * True when this is a permanent public CDN URL — lets a host-supplied\n * `ImageComponent` (e.g. a next/image adapter) take the render, and marks\n * the URL CORS-safe for element-level `crossOrigin`.\n */\n isCdn?: boolean | undefined;\n /**\n * Whether a load error can be recovered by the client's ONE retry policy\n * (session-refresh → same-URL retry). False for foreign/external URLs —\n * a session refresh can't resurrect someone else's link rot. Default true.\n */\n recoverable?: boolean | undefined;\n}\n\n/** Typed unavailable states — render-as-state, never thrown as incidents. */\nexport type MediaUnavailableReason =\n | \"access_denied\"\n | \"not_found\"\n | \"deleted\"\n | \"unknown\";\n\n// ---------------------------------------------------------------------------\n// Diagnostics — the terminal-failure capture contract (the 2026-08-30 outage\n// class: every private image failed, the honest unavailable panel rendered,\n// and NOTHING reached the host's error system because the package had no\n// diagnostics port). Per C22 the capture logic lives IN the package; a host\n// binds only a sink. Absent sink → the package console.errors the same\n// structured payload once per failure — a media failure is NEVER silent.\n// ---------------------------------------------------------------------------\n\n/** Where in the pipeline a media failure surfaced. */\nexport type MediaFailurePhase =\n /** `MediaClient.resolve()` refused the ref (threw). */\n | \"resolve\"\n /** The client's session bootstrap/mint failed (`recoverLoadError` rejected),\n * or the server reported an ephemeral cookie secret (warning). */\n | \"session\"\n /** `MediaClient.getBlob()` rejected — private-pixels bytes never arrived. */\n | \"blob\"\n /** The media element errored and recovery was exhausted or impossible. */\n | \"element-load\"\n /** The client's recovery machinery declined to retry on the first attempt. */\n | \"recovery\"\n /**\n * The heal ladder ran after the ONE retry failed. Non-terminal when a lane\n * healed the render (the user saw the media); terminal when every lane\n * died. Either way the row carries `attempts` + `diagnosis`.\n */\n | \"heal\";\n\n/** What the ONE retry policy did before the failure went terminal. */\nexport type MediaRetryOutcome =\n /** Recovery was impossible (unrecoverable source) or was never reached. */\n | \"not-attempted\"\n /** The client granted a session-refresh retry and the retry ALSO failed. */\n | \"retried\"\n /** The recovery call itself threw/rejected. */\n | \"recovery-failed\";\n\n/**\n * The strictly-typed structural payload every terminal media failure emits.\n * `mediaRef` is DURABLE IDENTITY ONLY — a `file:<id>` / query-stripped URL\n * key, NEVER a signed URL (signatures live in query strings, which\n * {@link failureMediaIdentity} removes).\n */\nexport interface MediaFailureInfo {\n source: \"media\";\n phase: MediaFailurePhase;\n /** File id / ref key identity — never a signed URL. */\n mediaRef: string;\n /** HTTP status when known (e.g. from a structured client error). */\n status?: number | undefined;\n /** Outcome of the client's ONE retry policy, when the phase reached it. */\n retryOutcome?: MediaRetryOutcome | undefined;\n /** True for a dead render; false for a captured warning (ephemeral secret)\n * or a HEALED render (`healed: true`). */\n terminal: boolean;\n message: string;\n /**\n * True when the heal ladder produced a renderable source after the primary\n * lane died. A healed render is NEVER silent: hosts persist it exactly like\n * a dead one so \"errors that fix themselves\" stay visible and countable.\n */\n healed?: boolean | undefined;\n /** The lane that healed the render (`MediaHealLane`). */\n healedBy?: MediaHealLane | undefined;\n /** Every lane the ladder tried, in order, with its outcome. */\n attempts?: MediaHealAttempt[] | undefined;\n /** The client's root-cause reading of the attempt pattern. */\n diagnosis?: MediaHealDiagnosis | undefined;\n}\n\n/** The lanes a render can be healed through, in ladder order. */\nexport type MediaHealLane =\n /** Re-mint the files-session cookie, retry the SAME durable URL in the element. */\n | \"session-refresh-retry\"\n /** Bearer-authenticated byte fetch on the primary files host → object URL. */\n | \"bearer-blob\"\n /** Bearer-authenticated byte fetch on the OTHER configured files host. */\n | \"bearer-blob-alternate-host\";\n\nexport interface MediaHealAttempt {\n lane: MediaHealLane;\n /** \"ok\" healed it; anything else is why it did not. */\n outcome: \"ok\" | \"http-error\" | \"network-error\" | \"unavailable\" | \"skipped\";\n /** HTTP status when the lane got an answer. */\n status?: number | undefined;\n /** Wall-clock the lane took. */\n ms: number;\n /** Which host answered (origin only — never a signed URL). */\n host?: string | undefined;\n /** Free-text detail for the row (error class, refusal reason). */\n detail?: string | undefined;\n}\n\n/**\n * What the attempt pattern says about the ROOT CAUSE. Named so a row in the\n * error catcher reads as a diagnosis, not a symptom.\n */\nexport type MediaHealDiagnosis =\n /** Cookie mint answered 200, the element still 401'd, the bearer lane\n * worked: the browser is not sending the files-session cookie cross-site\n * (third-party cookies blocked — Chrome setting / Incognito / Safari / Brave). */\n | \"cookie-not-sent-by-browser\"\n /** The cookie mint itself failed (status carried on the attempt). */\n | \"cookie-mint-failed\"\n /** The bearer token was refused (401): the sign-in is stale on this tab. */\n | \"bearer-rejected\"\n /** 403 on the bytes: this identity may not read this file. */\n | \"access-denied\"\n /** 404 on the bytes: the file row/object is gone. */\n | \"file-missing\"\n /** 5xx from the files host. */\n | \"files-host-error\"\n /** No host answered at all (DNS/network/CORS). */\n | \"files-host-unreachable\"\n /** Primary host dead, the alternate host served the bytes. */\n | \"primary-host-down-alternate-served\"\n /** Nothing in the pattern matches a known cause. */\n | \"unknown\";\n\n/** The client's heal verdict — the lanes it ran and what it concluded. */\nexport interface MediaHealResult {\n /** Renderable `blob:`/durable source when healed; null when every lane died. */\n src: string | null;\n healedBy?: MediaHealLane | undefined;\n attempts: MediaHealAttempt[];\n diagnosis: MediaHealDiagnosis;\n /** Plain-English root cause + what served the user — the log line. */\n summary: string;\n}\n\n/**\n * The host's error-capture sink. Bind `capture` to the app's error system\n * (matrx-frontend: `captureError` in lib/diagnostics/errorCaptureStore).\n * When absent, the package console.errors the same payload once per failure\n * (the loud default) — it never downgrades to silence.\n */\nexport interface MediaDiagnosticsPort {\n capture?: ((info: MediaFailureInfo) => void) | undefined;\n}\n\n/** String verdicts of the ONE retry policy. */\nexport type MediaRecoveryVerdict = \"retry\" | \"terminal\";\n\n/**\n * Structured `recoverLoadError` result — optional; the bare string verdict\n * remains fully supported. Lets the client surface what it learned during the\n * session bootstrap without a second channel:\n *\n * - `status` — HTTP status of the failed mint/probe, forwarded into the\n * terminal {@link MediaFailureInfo};\n * - `secretSource` — the `/files/session` mint response's `secret_source`\n * when the server sends one (a matrx-connect field). `\"ephemeral\"` means\n * the server signs cookies with a boot-generated secret: private renders\n * WILL break across restarts/instances, and the package captures a\n * non-terminal warning immediately instead of waiting for the outage.\n */\nexport interface MediaRecoveryReport {\n verdict: MediaRecoveryVerdict;\n status?: number | undefined;\n secretSource?: string | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Bytes / upload\n// ---------------------------------------------------------------------------\n\nexport interface MediaBlobHandle {\n /** `blob:` object URL safe for any browser API. */\n url: string;\n blob: Blob;\n /** Release the handle. Implementations backed by a shared cache may no-op. */\n release(): void;\n}\n\nexport interface MediaUploadOptions {\n onProgress?: ((loaded: number, total: number) => void) | undefined;\n fileName?: string | undefined;\n mimeType?: string | undefined;\n /** Publish the upload to the web (the only anonymous lane; access ladder T-13). */\n publishedToWeb?: boolean | undefined;\n /** The \"Shown to\" list filter (`only_me` | `my_team` | `everyone` | `everyone_on_ai_matrx`). */\n shownTo?: \"only_me\" | \"my_team\" | \"everyone\" | \"everyone_on_ai_matrx\" | undefined;\n /** The retiring level word, passed through structurally until hosts take the two words. */\n visibility?: string | undefined; // T-13 transitional wire input\n parentFolderId?: string | null | undefined;\n metadata?: Record<string, unknown> | undefined;\n}\n\n/** Upload → durable identity. `fileId` is required at compile time and runtime. */\nexport interface MediaUploadResult {\n fileId: string;\n ref: MediaRef;\n}\n\nexport interface MediaMultiUploadResult {\n /** File ids for every successful upload. */\n uploaded: string[];\n /** Per-file failure with the real backend error message. */\n failed: Array<{ name: string; error: string }>;\n /** True when the host's pre-flight (e.g. a duplicate dialog) cancelled the batch. */\n cancelled: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// THE port — one structural interface, owned by this package, implemented by\n// the data layer (canonically `@ai-matrx/data/files`).\n// ---------------------------------------------------------------------------\n\nexport interface MediaClient {\n /**\n * Synchronous durable-URL build + classification. Returns `null` when the\n * ref carries no usable identity (components render their fallback).\n * THROWS (and screams via its own diagnostics sink) on a signed/expiring\n * URL — the D108 guard lives behind this door.\n */\n resolve(ref: MediaRefLike): MediaResolution | null;\n /** Bytes for canvas/crossOrigin/private-pixel consumers. */\n getBlob(ref: MediaRefLike): Promise<MediaBlobHandle>;\n /**\n * Session bootstrap + the ONE retry policy: refresh-then-same-URL-retry,\n * second failure terminal. Called by the package's onError path, never\n * re-implemented.\n */\n recoverLoadError(\n src: DurableSrc,\n attempt: number,\n ): Promise<MediaRecoveryVerdict | MediaRecoveryReport>;\n /**\n * Optional object-URL recovery policy for private blob-backed media.\n * The client decides whether the durable ref should be re-read; older\n * clients may omit this and fail terminally.\n */\n recoverBlobLoadError?(\n ref: MediaRefLike,\n attempt: number,\n ): Promise<MediaRecoveryVerdict>;\n /**\n * The heal ladder — runs AFTER the ONE retry policy is exhausted. Tries\n * every lane the client owns (bearer byte fetch on the primary host, then\n * the alternate host), records each attempt, and names the root cause. The\n * package renders `src` when present and captures the result either way:\n * a healed render is logged as loudly as a dead one. Clients that omit it\n * fall back to the terminal verdict.\n */\n healLoadError?(\n ref: MediaRefLike,\n context: { src: DurableSrc; attempts: MediaHealAttempt[] },\n ): Promise<MediaHealResult>;\n /** Upload → durable identity. */\n upload(file: File | Blob, opts?: MediaUploadOptions): Promise<MediaUploadResult>;\n /**\n * Optional batch upload with host pre-flight (dedup dialogs etc.). When\n * absent, `useMediaUpload().uploadMany` falls back to sequential `upload`.\n */\n uploadMany?(files: File[], opts?: MediaUploadOptions): Promise<MediaMultiUploadResult>;\n /** Share affordances — fails closed (null), never emits a signed URL. */\n shareableUrl(ref: MediaRefLike): Promise<string | null>;\n /** Typed unavailable states — render-as-state, never thrown as incidents. */\n classifyError(err: unknown): MediaUnavailableReason;\n}\n\n// ---------------------------------------------------------------------------\n// Host ports — all optional, all defaulting to inert.\n// ---------------------------------------------------------------------------\n\n/**\n * Structural component slot. `(props) => unknown` keeps the root entry free\n * of React type imports; any React function component satisfies it.\n */\nexport type MediaSlotComponent<P> = (props: P) => unknown;\n\nexport interface MediaImageComponentProps {\n src: string;\n alt: string;\n width: number;\n height: number;\n className?: string | undefined;\n onError?: ((event: unknown) => void) | undefined;\n onClick?: ((event: unknown) => void) | undefined;\n onKeyDown?: ((event: unknown) => void) | undefined;\n role?: string | undefined;\n tabIndex?: number | undefined;\n}\n\nexport interface PlaybackSessionRegistration {\n isPlaying: boolean;\n source: string;\n label: string;\n trackKey?: string | undefined;\n}\n\n/**\n * The host's audio system (exclusive-playback lock, output-sink routing).\n * Both members are HOOKS — the package calls them unconditionally on every\n * render of a media element, so implementations must obey the Rules of Hooks\n * and the port object must be referentially stable.\n */\nexport interface PlaybackSessionPort {\n /**\n * Returns a ref callback for the underlying media element (routes audio\n * output / setSinkId on hosts that support it) and forwards to the caller's\n * own element ref.\n */\n useMediaElementSink(\n forward:\n | ((node: unknown) => void)\n | { current: unknown }\n | null\n | undefined,\n ): (node: unknown) => void;\n /** Joins the host's unified playback session for the element. */\n usePlaybackSession(\n registration: PlaybackSessionRegistration,\n elementRef: { current: unknown },\n ): void;\n}\n\n// ---------------------------------------------------------------------------\n// THE SHARE MANDATE (C19) — the complete headless media-actions contract.\n//\n// v0.1 ships this contract plus toolbar/lightbox shells wired to it, typed so\n// the associations/sharing package can plug in WITHOUT a media release: it\n// implements MediaActionsPort (handlers and/or the SharePopover body) and the\n// host injects it through MediaHostPorts. Nothing here may change shape in a\n// breaking way for that wave.\n// ---------------------------------------------------------------------------\n\nexport type MediaActionKind = \"share\" | \"download\" | \"copy\" | \"open\";\n\nexport interface MediaActionContext {\n ref: MediaRefLike;\n resolution: MediaResolution | null;\n fileName?: string | undefined;\n alt?: string | undefined;\n}\n\nexport interface MediaSharePopoverProps {\n context: MediaActionContext;\n onClose: () => void;\n}\n\nexport type MediaActionHandler = (ctx: MediaActionContext) => Promise<void>;\n\nexport interface MediaActionsPort {\n /**\n * Quick-share handler (copy a share link, open the native share sheet…).\n * Implementations obtain URLs ONLY via `MediaClient.shareableUrl` /\n * durable identities — never a signed URL (law 4).\n */\n share?: MediaActionHandler | undefined;\n download?: MediaActionHandler | undefined;\n copy?: MediaActionHandler | undefined;\n open?: MediaActionHandler | undefined;\n /**\n * Rich share UI body — the slot the associations package fills. When\n * present, the shells open it instead of (or on top of) the `share`\n * handler. Receives {@link MediaSharePopoverProps}.\n */\n SharePopover?: MediaSlotComponent<MediaSharePopoverProps> | undefined;\n}\n\nexport interface MediaHostPorts {\n playbackSession?: PlaybackSessionPort | undefined;\n actions?: MediaActionsPort | undefined;\n /** Web host may pass a next/image adapter; default is a plain `<img>`. */\n ImageComponent?: MediaSlotComponent<MediaImageComponentProps> | undefined;\n /**\n * Error-capture sink for terminal media failures (and the ephemeral-secret\n * warning). Bind to the host's error system; absent → loud console.error\n * default. See {@link MediaDiagnosticsPort}.\n */\n diagnostics?: MediaDiagnosticsPort | undefined;\n}\n","/**\n * src/core/use-media-resolution.ts — ref → durable resolution, as state.\n *\n * Law 2: every consumer resolves media through the client, unconditionally —\n * even a caller-supplied URL string is classified, never trusted. Law 15 of\n * the handler (unavailable is a rendered state): a throwing `resolve()` is\n * classified via `classifyError` and returned as typed state — never\n * re-thrown. It IS however a terminal failure, so it also emits exactly one\n * `MediaFailureInfo` (phase \"resolve\") through the diagnostics machinery —\n * the 2026-08-30 outage rule: an unavailable render is honest to the USER but\n * must never be silent to the SYSTEM.\n */\n\nimport { useEffect, useMemo } from \"react\";\nimport type {\n MediaRefLike,\n MediaResolution,\n MediaUnavailableReason,\n} from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\nimport { stableRefKey } from \"./ref-key\";\n\nexport interface MediaResolutionState {\n resolution: MediaResolution | null;\n /**\n * \"empty\" — no ref, or a ref with no usable identity (render fallback)\n * \"ready\" — resolution available\n * \"unavailable\" — resolve() refused (signed URL, access denied…); render\n * the typed unavailable state, never an incident\n */\n status: \"empty\" | \"ready\" | \"unavailable\";\n reason: MediaUnavailableReason | null;\n}\n\nexport function useMediaResolution(\n ref: MediaRefLike | null | undefined,\n): MediaResolutionState {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const refKey = stableRefKey(ref);\n const { state, failureMessage } = useMemo<{\n state: MediaResolutionState;\n failureMessage: string | null;\n }>(() => {\n if (!ref) {\n return {\n state: { resolution: null, status: \"empty\", reason: null },\n failureMessage: null,\n };\n }\n try {\n const resolution = client.resolve(ref);\n if (!resolution) {\n return {\n state: { resolution: null, status: \"empty\", reason: null },\n failureMessage: null,\n };\n }\n return {\n state: { resolution, status: \"ready\", reason: null },\n failureMessage: null,\n };\n } catch (err) {\n return {\n state: {\n resolution: null,\n status: \"unavailable\",\n reason: client.classifyError(err),\n },\n failureMessage:\n err instanceof Error ? err.message : String(err ?? \"resolve() failed\"),\n };\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client, refKey]);\n\n // Terminal-failure capture (phase \"resolve\") — an effect, never a render\n // side effect; latched per media identity by the diagnostics machinery.\n useEffect(() => {\n if (state.status !== \"unavailable\") return;\n capture({\n phase: \"resolve\",\n mediaRef: failureMediaIdentity(ref ?? null),\n terminal: true,\n message: `resolve() refused (${state.reason ?? \"unknown\"}): ${\n failureMessage ?? \"no error message\"\n }`,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [refKey, state.status]);\n\n return state;\n}\n","/**\n * src/react/media-thumbnail.tsx — the single thumbnail renderer.\n *\n * Behavior port of matrx-frontend\n * `features/files/components/core/MediaThumbnail/MediaThumbnail.tsx` with\n * the tier machine inverted onto `/core`'s `useThumbnailSource` (the asset\n * variant lookup, public/private lanes and blob cache now live behind\n * `MediaClient.resolve` / `getBlob`):\n *\n * 1. server-rendered thumbnail (`thumbnailUrl` prop / resolution metadata)\n * 2. live source render — `<img>` for images, `<video preload=\"metadata\">`\n * poster frame for videos (the window between upload and variant render)\n * 3. category icon fallback\n *\n * Load failures self-heal through the client's ONE recovery policy before\n * falling to the icon — a user's own file never just \"expires\".\n */\n\n\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport type { MediaRefLike } from \"../types\";\nimport {\n useMediaBlobLoadRecovery,\n type MediaBlobLoadRecovery,\n} from \"../core/use-media-blob-load-recovery\";\nimport { useMediaLoadRecovery } from \"../core/use-media-load-recovery\";\nimport { useThumbnailSource } from \"../core/use-thumbnail-source\";\nimport { cn } from \"./cn\";\nimport { FileIcon } from \"./file-icon\";\n\nexport interface MediaThumbnailProps {\n /** The file's durable ref (a MediaRef or bare fileId). */\n mediaRef: MediaRefLike;\n /** Display name — drives the icon fallback and alt text. */\n fileName: string;\n /** Server MIME, when known. */\n mimeType?: string | null | undefined;\n /** A known server-rendered thumbnail URL (`FileRecord.thumbnail_url`). */\n thumbnailUrl?: string | null | undefined;\n /** Pixel size for the icon fallback. Image/video fill their container. */\n iconSize?: number | undefined;\n /** Aspect ratio classes applied to the container, e.g. \"aspect-[4/3]\". */\n className?: string | undefined;\n /** Override the rounded corners of the container. */\n rounded?: string | undefined;\n /**\n * Whether to fall back to a source-file URL when no rendered thumbnail is\n * available. Disable in dense pickers to avoid a byte request per row.\n */\n allowSourceFallback?: boolean | undefined;\n}\n\nexport function MediaThumbnail({\n mediaRef,\n fileName,\n mimeType = null,\n thumbnailUrl,\n iconSize = 48,\n className,\n rounded,\n allowSourceFallback = true,\n}: MediaThumbnailProps) {\n const source = useThumbnailSource(mediaRef, {\n thumbnailUrl,\n allowSourceFallback,\n });\n // Keep the retry budget above the transient blob-loading branch. A retry\n // deliberately clears `source.src` while fresh bytes are read; mounting\n // recovery inside ImageThumb/VideoPosterThumb reset attempt 2 to attempt 1\n // when the new object URL arrived and could create an unbounded retry loop.\n const blobRecovery = useMediaBlobLoadRecovery(\n source.blobBacked ? mediaRef : null,\n source.blobBacked ? source.src : null,\n { onRetry: source.retryBlob },\n );\n\n const fallback = (\n <div className=\"flex h-full w-full items-center justify-center bg-muted/40\">\n <FileIcon fileName={fileName} mimeType={mimeType} size={iconSize} />\n </div>\n );\n\n let body: ReactNode = source.loading ? (\n <div className=\"h-full w-full animate-pulse bg-muted\" />\n ) : (\n fallback\n );\n\n if (source.src) {\n if (source.mode === \"live-video-poster\") {\n body = (\n <VideoPosterThumb\n url={source.src}\n mediaRef={mediaRef}\n recoverable={source.recoverable}\n blobBacked={source.blobBacked}\n blobRecovery={blobRecovery}\n fallback={fallback}\n />\n );\n } else {\n body = (\n <ImageThumb\n url={source.src}\n alt={fileName}\n mediaRef={mediaRef}\n recoverable={source.recoverable}\n blobBacked={source.blobBacked}\n blobRecovery={blobRecovery}\n fallback={fallback}\n />\n );\n }\n }\n\n return (\n <div\n className={cn(\"relative overflow-hidden bg-muted/40\", rounded, className)}\n >\n {body}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Internals\n// ---------------------------------------------------------------------------\n\nfunction ImageThumb({\n url,\n alt,\n mediaRef,\n recoverable,\n blobBacked,\n blobRecovery,\n fallback,\n}: {\n url: string;\n alt: string;\n mediaRef: MediaRefLike;\n recoverable: boolean;\n blobBacked: boolean;\n blobRecovery: MediaBlobLoadRecovery;\n fallback: ReactNode;\n}) {\n // Media durability: a load failure routes through the client's ONE\n // recovery (session refresh → same durable URL) before falling to the\n // icon. Foreign/blob URLs pass through untouched.\n const { retryKey, onLoadError, failed, healedSrc } = useMediaLoadRecovery(url, {\n recoverable,\n failureRef: mediaRef,\n });\n const activeRecovery = blobBacked\n ? { retryKey: 0, ...blobRecovery }\n : { retryKey, onLoadError, failed };\n // A healed (bearer-lane) object URL replaces the dead element src.\n const renderUrl = (!blobBacked && healedSrc) || url;\n\n if (activeRecovery.failed) return <>{fallback}</>;\n return (\n <img\n key={activeRecovery.retryKey}\n src={renderUrl}\n alt={alt}\n // Lazy-load NETWORK thumbnails only. A blob: object URL means the bytes\n // were already downloaded and sit in memory — deferring the render buys\n // nothing, and `loading=\"lazy\"` never fires in hidden documents (agent\n // browser panes, background tabs) or offscreen scroll cells, which\n // stalled grids/chat silently forever (F3/F4). Local bytes render NOW.\n loading={renderUrl.startsWith(\"blob:\") ? \"eager\" : \"lazy\"}\n className=\"h-full w-full object-cover\"\n onError={activeRecovery.onLoadError}\n />\n );\n}\n\nfunction VideoPosterThumb({\n url,\n mediaRef,\n recoverable,\n blobBacked,\n blobRecovery,\n fallback,\n}: {\n url: string;\n mediaRef: MediaRefLike;\n recoverable: boolean;\n blobBacked: boolean;\n blobRecovery: MediaBlobLoadRecovery;\n fallback: ReactNode;\n}) {\n // Same self-heal contract as ImageThumb.\n const { retryKey, onLoadError, failed, healedSrc } = useMediaLoadRecovery(url, {\n recoverable,\n failureRef: mediaRef,\n });\n const activeRecovery = blobBacked\n ? { retryKey: 0, ...blobRecovery }\n : { retryKey, onLoadError, failed };\n const renderUrl = (!blobBacked && healedSrc) || url;\n const ref = useRef<HTMLVideoElement | null>(null);\n\n // Some browsers refuse to render a frame until they explicitly know how to\n // seek. Setting `currentTime = 0` after metadata loads ensures the first\n // frame is decoded and displayed.\n useEffect(() => {\n const v = ref.current;\n if (!v) return undefined;\n const onMeta = () => {\n try {\n v.currentTime = 0;\n } catch {\n /* ignore — some streams don't support setting currentTime */\n }\n };\n v.addEventListener(\"loadedmetadata\", onMeta);\n return () => v.removeEventListener(\"loadedmetadata\", onMeta);\n }, []);\n\n if (activeRecovery.failed) return <>{fallback}</>;\n return (\n <video\n key={activeRecovery.retryKey}\n ref={ref}\n src={renderUrl}\n className=\"h-full w-full object-cover pointer-events-none\"\n preload=\"metadata\"\n muted\n playsInline\n onError={activeRecovery.onLoadError}\n />\n );\n}\n\nexport default MediaThumbnail;\n","/**\n * src/core/use-thumbnail-source.ts — the thumbnail tier machine.\n *\n * Ported from matrx-frontend `MediaThumbnail.tsx`'s source-priority logic\n * with the data seams inverted onto the MediaClient:\n *\n * 1. Caller-supplied `thumbnailUrl` (`FileRecord.thumbnail_url`) —\n * CLASSIFIED through `resolve()` like every string (law 2), never\n * trusted raw.\n * 2. `resolution.thumbnailSrc` — the client's asset-variant lookup\n * (rides `MediaClient.resolve` metadata).\n * 3. Live source render — the master itself, `<img>` for images or\n * `<video preload=\"metadata\">` for a video poster frame; the private\n * bearer-auth lane (`transport: \"blob\"`) goes through `getBlob`.\n * 4. Icon fallback (`src: null`).\n */\n\nimport { useMemo } from \"react\";\nimport type { DurableSrc, MediaRefLike, MediaResolution } from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { useMediaBlob } from \"./use-media-blob\";\nimport { useMediaResolution } from \"./use-media-resolution\";\n\nexport type ThumbnailMode =\n | \"thumbnail\"\n | \"live-image\"\n | \"live-video-poster\"\n | \"icon\";\n\nexport interface ThumbnailSourceState {\n /** URL to render, or null → render the icon fallback. */\n src: DurableSrc | string | null;\n mode: ThumbnailMode;\n /** True while the private-pixels blob lane is still loading. */\n loading: boolean;\n resolution: MediaResolution | null;\n /** False for blob object URLs — wire into useMediaLoadRecovery. */\n recoverable: boolean;\n /** True when src is a disposable object URL backed by the durable ref. */\n blobBacked: boolean;\n /** Re-read the durable ref after client-approved object-URL recovery. */\n retryBlob: () => void;\n}\n\nexport interface UseThumbnailSourceOptions {\n /** A known server-rendered thumbnail URL (e.g. `FileRecord.thumbnail_url`). */\n thumbnailUrl?: string | null | undefined;\n /**\n * Whether to fall back to the source file itself when no rendered\n * thumbnail exists. Disable in dense pickers to avoid per-row byte loads.\n */\n allowSourceFallback?: boolean | undefined;\n}\n\nexport function useThumbnailSource(\n ref: MediaRefLike | null | undefined,\n options: UseThumbnailSourceOptions = {},\n): ThumbnailSourceState {\n const { thumbnailUrl, allowSourceFallback = true } = options;\n const client = useMediaClient();\n const { resolution } = useMediaResolution(ref);\n\n // Tier 1 — caller-supplied thumbnail URL, classified like everything else.\n const explicitThumb = useMemo(() => {\n if (!thumbnailUrl) return null;\n try {\n return client.resolve(thumbnailUrl);\n } catch {\n // A refused thumbnail URL (signed, foreign junk) falls to lower tiers.\n return null;\n }\n }, [client, thumbnailUrl]);\n\n // Tier 3 blob lane — only engaged when we would actually render the source,\n // which (matching the non-blob branch below and the original MediaThumbnail\n // `needsBytes` gate) means image/video kinds ONLY. Without the kind gate a\n // private markdown/PDF/archive file downloads its ENTIRE bytes just to feed\n // an <img> that can never decode them (the F3 defect class).\n const needsBlob =\n allowSourceFallback &&\n !explicitThumb &&\n !resolution?.thumbnailSrc &&\n resolution?.transport === \"blob\" &&\n (resolution.kind === \"image\" || resolution.kind === \"video\");\n const blob = useMediaBlob(needsBlob ? ref : null);\n\n if (explicitThumb) {\n return {\n src: explicitThumb.src,\n mode: \"thumbnail\",\n loading: false,\n resolution,\n recoverable: explicitThumb.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n if (resolution?.thumbnailSrc) {\n return {\n src: resolution.thumbnailSrc,\n mode: \"thumbnail\",\n loading: false,\n resolution,\n recoverable: resolution.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n if (allowSourceFallback && resolution) {\n if (needsBlob) {\n return {\n src: blob.url,\n mode: blob.url\n ? resolution.kind === \"video\"\n ? \"live-video-poster\"\n : \"live-image\"\n : \"icon\",\n loading: blob.loading,\n resolution,\n recoverable: false,\n blobBacked: true,\n retryBlob: blob.retry,\n };\n }\n if (resolution.kind === \"image\") {\n return {\n src: resolution.src,\n mode: \"live-image\",\n loading: false,\n resolution,\n recoverable: resolution.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n if (resolution.kind === \"video\") {\n return {\n src: resolution.src,\n mode: \"live-video-poster\",\n loading: false,\n resolution,\n recoverable: resolution.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n }\n return {\n src: null,\n mode: \"icon\",\n loading: false,\n resolution,\n recoverable: false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n}\n","/**\n * src/react/use-media-dropzone.ts — headless drag + paste + picker intake.\n *\n * Replaces the original's `react-dropzone` dependency with native DOM events\n * (the package's `/react` entry carries no UI-library deps). The behavior\n * contract is the original FileUploadDropzone's: drag-over highlight, hidden\n * input picker (`openPicker`), clipboard paste of images with a brief\n * highlight pulse, an optional window event that opens the picker, and\n * accept/maxSize filtering (UI-only; the server enforces its own caps).\n */\n\n\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type DragEvent,\n type HTMLAttributes,\n type InputHTMLAttributes,\n} from \"react\";\n\nexport interface MediaDropzoneOptions {\n /** Receives every accepted batch (drop, paste, or picker). */\n onFiles: (files: File[]) => void;\n /** Restrict accepted types, e.g. [\"image/*\", \"application/pdf\", \".csv\"]. */\n accept?: string[] | undefined;\n /** Max size per file in bytes (UI-only filter). */\n maxSize?: number | undefined;\n /** Fires for files filtered out by accept/maxSize. */\n onRejected?: ((rejected: Array<{ file: File; reason: \"type\" | \"size\" }>) => void) | undefined;\n /** Enable clipboard paste (images only). Defaults true. */\n enablePaste?: boolean | undefined;\n /** Optional window event name that opens the native file picker. */\n pickerEventName?: string | undefined;\n disabled?: boolean | undefined;\n multiple?: boolean | undefined;\n}\n\nexport interface MediaDropzoneState {\n /** Spread onto the drop surface element. */\n getRootProps: () => HTMLAttributes<HTMLElement>;\n /** Spread onto a hidden `<input type=\"file\">`. */\n getInputProps: () => InputHTMLAttributes<HTMLInputElement> & {\n ref: (node: HTMLInputElement | null) => void;\n };\n isDragActive: boolean;\n /** Brief pulse after a successful clipboard paste. */\n pasteHighlight: boolean;\n openPicker: () => void;\n}\n\nfunction matchesAccept(file: File, accept: string[] | undefined): boolean {\n if (!accept || accept.length === 0) return true;\n const name = file.name.toLowerCase();\n const mime = file.type.toLowerCase();\n return accept.some((pattern) => {\n const p = pattern.trim().toLowerCase();\n if (!p) return false;\n if (p.startsWith(\".\")) return name.endsWith(p);\n if (p.endsWith(\"/*\")) return mime.startsWith(p.slice(0, -1));\n return mime === p;\n });\n}\n\nexport function useMediaDropzone(options: MediaDropzoneOptions): MediaDropzoneState {\n const {\n onFiles,\n accept,\n maxSize,\n onRejected,\n enablePaste = true,\n pickerEventName,\n disabled = false,\n multiple = true,\n } = options;\n\n const [isDragActive, setIsDragActive] = useState(false);\n const [pasteHighlight, setPasteHighlight] = useState(false);\n const dragDepth = useRef(0);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Latest-callback refs so the window listeners never go stale.\n const onFilesRef = useRef(onFiles);\n onFilesRef.current = onFiles;\n const onRejectedRef = useRef(onRejected);\n onRejectedRef.current = onRejected;\n\n const acceptKey = accept?.join(\",\") ?? \"\";\n\n const filterFiles = useCallback(\n (files: File[]): File[] => {\n const accepted: File[] = [];\n const rejected: Array<{ file: File; reason: \"type\" | \"size\" }> = [];\n for (const file of files) {\n if (!matchesAccept(file, acceptKey ? acceptKey.split(\",\") : undefined)) {\n rejected.push({ file, reason: \"type\" });\n } else if (maxSize != null && file.size > maxSize) {\n rejected.push({ file, reason: \"size\" });\n } else {\n accepted.push(file);\n }\n }\n if (rejected.length) onRejectedRef.current?.(rejected);\n return accepted;\n },\n [acceptKey, maxSize],\n );\n\n const emit = useCallback(\n (files: File[]) => {\n const accepted = filterFiles(files);\n if (accepted.length) onFilesRef.current(accepted);\n },\n [filterFiles],\n );\n\n const openPicker = useCallback(() => {\n if (!disabled) inputRef.current?.click();\n }, [disabled]);\n\n // Optional window event that opens the native file picker.\n useEffect(() => {\n if (!pickerEventName || typeof window === \"undefined\") return undefined;\n const handler = () => openPicker();\n window.addEventListener(pickerEventName, handler);\n return () => window.removeEventListener(pickerEventName, handler);\n }, [openPicker, pickerEventName]);\n\n // Clipboard paste — images only (the original's contract).\n useEffect(() => {\n if (!enablePaste || disabled || typeof window === \"undefined\") {\n return undefined;\n }\n const handler = (event: ClipboardEvent) => {\n if (!event.clipboardData?.items) return;\n const images: File[] = [];\n for (const item of Array.from(event.clipboardData.items)) {\n if (item.type.startsWith(\"image/\")) {\n const blob = item.getAsFile();\n if (!blob) continue;\n const ext = blob.type.split(\"/\")[1] ?? \"png\";\n const name = `pasted-${Date.now()}.${ext}`;\n images.push(new File([blob], name, { type: blob.type }));\n }\n }\n if (images.length > 0) {\n event.preventDefault();\n setPasteHighlight(true);\n setTimeout(() => setPasteHighlight(false), 400);\n emit(images);\n }\n };\n window.addEventListener(\"paste\", handler);\n return () => window.removeEventListener(\"paste\", handler);\n }, [enablePaste, disabled, emit]);\n\n const getRootProps = useCallback(\n (): HTMLAttributes<HTMLElement> => ({\n onDragEnter: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n dragDepth.current += 1;\n setIsDragActive(true);\n },\n onDragOver: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n },\n onDragLeave: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n dragDepth.current = Math.max(0, dragDepth.current - 1);\n if (dragDepth.current === 0) setIsDragActive(false);\n },\n onDrop: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n dragDepth.current = 0;\n setIsDragActive(false);\n const files = Array.from(event.dataTransfer?.files ?? []);\n if (files.length) emit(multiple ? files : files.slice(0, 1));\n },\n }),\n [disabled, emit, multiple],\n );\n\n const inputAccept = useMemo(\n () => (acceptKey.length ? acceptKey : undefined),\n [acceptKey],\n );\n\n const getInputProps = useCallback(\n () => ({\n ref: (node: HTMLInputElement | null) => {\n inputRef.current = node;\n },\n type: \"file\" as const,\n multiple,\n accept: inputAccept,\n tabIndex: -1,\n style: { display: \"none\" } as const,\n onChange: (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files ?? []);\n // Allow re-selecting the same file.\n event.target.value = \"\";\n if (files.length) emit(files);\n },\n }),\n [emit, inputAccept, multiple],\n );\n\n return { getRootProps, getInputProps, isDragActive, pasteHighlight, openPicker };\n}\n","/**\n * src/react/file-upload-dropzone.tsx — drag + paste + picker uploader.\n *\n * Behavior port of matrx-frontend\n * `FileUploadDropzone/FileUploadDropzone.tsx` with the seams inverted:\n * `react-dropzone` → the package's own `useMediaDropzone`; the Redux\n * `selectVisibleUploads` tray → `useMediaUpload().entries`; the app-shaped\n * acquisition sources (Google Drive, local folder, \"choose existing\") → the\n * `actions` render slot. Renders as a full-surface overlay (`mode=\"overlay\"`)\n * or an inline block with visible affordance (`mode=\"inline\"`).\n */\n\n\"use client\";\n\nimport { useCallback, type ReactNode } from \"react\";\nimport type { MediaUploadOptions } from \"../types\";\nimport { useMediaUpload } from \"../core/use-media-upload\";\nimport { cn } from \"./cn\";\nimport { UploadIcon } from \"./icons\";\nimport { UploadProgressList } from \"./upload-progress-list\";\nimport { useMediaDropzone } from \"./use-media-dropzone\";\n\nexport interface FileUploadDropzoneActions {\n openLocalPicker: () => void;\n uploadFiles: (files: File[]) => Promise<void>;\n}\n\nexport interface FileUploadDropzoneProps {\n /** Upload options forwarded to the client (published to the web, shown to, folder, metadata…). */\n uploadOptions?: MediaUploadOptions | undefined;\n /** Restrict accepted types (e.g. [\"image/*\"]). */\n accept?: string[] | undefined;\n /** Max size per file in bytes (UI-only; server enforces its own cap). */\n maxSize?: number | undefined;\n /** Enable paste from clipboard (images only). Defaults true. */\n enablePaste?: boolean | undefined;\n /** Rendering mode. */\n mode?: \"overlay\" | \"inline\" | undefined;\n /** Children render inside the drop surface. */\n children?:\n | ReactNode\n | ((actions: FileUploadDropzoneActions) => ReactNode)\n | undefined;\n className?: string | undefined;\n /** Host-shaped acquisition sources (Drive, local folder, existing files…). */\n actions?: ReactNode | undefined;\n /** Fires the moment an upload batch STARTS (before any network completes). */\n onUploadStart?: ((files: File[]) => void) | undefined;\n onUploaded?: ((fileIds: string[]) => void) | undefined;\n onError?: ((message: string) => void) | undefined;\n /** Reveal a finished file from the upload tray. */\n onOpenFile?: ((fileId: string) => void) | undefined;\n /** Optional window event name that opens the native file picker. */\n pickerEventName?: string | undefined;\n}\n\nexport function FileUploadDropzone({\n uploadOptions,\n accept,\n maxSize,\n enablePaste = true,\n mode = \"overlay\",\n children,\n className,\n actions,\n onUploadStart,\n onUploaded,\n onError,\n onOpenFile,\n pickerEventName,\n}: FileUploadDropzoneProps) {\n const { uploadMany, entries, clearEntry } = useMediaUpload();\n\n const handleUpload = useCallback(\n async (files: File[]) => {\n if (!files.length) return;\n try {\n onUploadStart?.(files);\n const { uploaded, failed } = await uploadMany(files, uploadOptions);\n if (uploaded.length && onUploaded) onUploaded(uploaded);\n if (failed.length && onError) {\n // Surface BOTH the file and the real backend reason — joining\n // objects rendered \"[object Object]\" to the user, hiding every\n // actual failure cause (CORS, 413, 401…).\n const message = failed.map((f) => `${f.name}: ${f.error}`).join(\"; \");\n onError(message);\n }\n } catch (err) {\n onError?.(err instanceof Error ? err.message : String(err));\n }\n },\n [uploadMany, uploadOptions, onUploadStart, onUploaded, onError],\n );\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n pasteHighlight,\n openPicker,\n } = useMediaDropzone({\n onFiles: (files) => void handleUpload(files),\n accept,\n maxSize,\n enablePaste,\n pickerEventName,\n });\n\n const highlighted = isDragActive || pasteHighlight;\n const renderedChildren =\n typeof children === \"function\"\n ? children({ openLocalPicker: openPicker, uploadFiles: handleUpload })\n : children;\n\n if (mode === \"inline\") {\n return (\n <div\n {...getRootProps()}\n className={cn(\n \"flex flex-col items-center justify-center gap-3 rounded-md border-2 border-dashed p-6\",\n \"text-sm text-muted-foreground\",\n highlighted ? \"border-primary bg-primary/5\" : \"border-border\",\n className,\n )}\n >\n <input {...getInputProps()} />\n <UploadIcon className=\"h-8 w-8\" width={32} height={32} aria-hidden=\"true\" />\n <div className=\"text-center\">\n <p>Drag & drop files here.</p>\n {enablePaste ? (\n <p className=\"text-xs mt-1 opacity-75\">\n You can also paste an image with ⌘V.\n </p>\n ) : null}\n </div>\n <button\n type=\"button\"\n onClick={openPicker}\n className=\"rounded-md border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent\"\n >\n Browse files\n </button>\n {actions}\n {entries.length > 0 ? (\n <UploadProgressList\n uploads={entries}\n onDismiss={clearEntry}\n onOpenFile={onOpenFile}\n className=\"w-full\"\n />\n ) : null}\n </div>\n );\n }\n\n return (\n <div\n {...getRootProps()}\n className={cn(\"relative h-full w-full\", className)}\n data-drop-active={highlighted ? \"true\" : undefined}\n >\n <input {...getInputProps()} />\n {renderedChildren}\n {highlighted ? (\n <div\n className=\"pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-md border-2 border-dashed border-primary bg-primary/10\"\n aria-live=\"polite\"\n >\n <div className=\"flex flex-col items-center gap-2 text-primary\">\n <UploadIcon className=\"h-10 w-10\" width={40} height={40} aria-hidden=\"true\" />\n <span className=\"font-medium\">Drop to upload</span>\n </div>\n </div>\n ) : null}\n {entries.length > 0 ? (\n <div className=\"absolute bottom-3 right-3 z-20 w-80 max-w-[90%]\">\n <UploadProgressList\n uploads={entries}\n onDismiss={clearEntry}\n onOpenFile={onOpenFile}\n />\n </div>\n ) : null}\n </div>\n );\n}\n","/**\n * src/core/use-media-upload.ts — the React-side upload primitive.\n *\n * Ported from matrx-frontend `handler/hooks/useFileUpload.ts` with two seam\n * inversions: the transport is `MediaClient.upload` (never touched directly),\n * and the multi-file pre-flight (SHA-256 dedup dialog) is the client's\n * optional `uploadMany` — when absent, the batch runs sequentially through\n * `upload` with per-file results.\n *\n * Additionally exposes a per-file `entries` tray state (name, size, bytes,\n * status) so the dropzone's UploadProgressList works without any app store —\n * the Redux `selectVisibleUploads` coupling of the original, inverted.\n */\n\nimport { useCallback, useRef, useState } from \"react\";\nimport type {\n MediaMultiUploadResult,\n MediaUploadOptions,\n MediaUploadResult,\n} from \"../types\";\nimport { useMediaClient } from \"./context\";\n\nexport interface MediaUploadProgress {\n loaded: number;\n total: number;\n ratio: number;\n}\n\nexport type MediaUploadEntryStatus = \"uploading\" | \"success\" | \"error\";\n\nexport interface MediaUploadEntry {\n id: string;\n fileName: string;\n fileSize: number;\n bytesUploaded: number;\n status: MediaUploadEntryStatus;\n error: string | null;\n fileId: string | null;\n completedAt: number | null;\n}\n\nexport interface UseMediaUploadResult {\n /** Upload one file/blob. Returns the durable identity. */\n upload: (\n file: File | Blob,\n opts?: MediaUploadOptions,\n ) => Promise<MediaUploadResult>;\n /**\n * Upload many files. Uses the client's `uploadMany` (host pre-flight /\n * dedup dialog) when implemented; otherwise a sequential per-file loop with\n * real per-file error messages.\n */\n uploadMany: (\n files: File[],\n opts?: MediaUploadOptions,\n ) => Promise<MediaMultiUploadResult>;\n uploading: boolean;\n progress: MediaUploadProgress | null;\n result: MediaUploadResult | null;\n error: Error | null;\n /** Live per-file tray entries for progress UI. */\n entries: MediaUploadEntry[];\n clearEntry: (id: string) => void;\n reset: () => void;\n}\n\nlet entrySeq = 0;\n\nexport function useMediaUpload(): UseMediaUploadResult {\n const client = useMediaClient();\n const [uploading, setUploading] = useState(false);\n const [progress, setProgress] = useState<MediaUploadProgress | null>(null);\n const [result, setResult] = useState<MediaUploadResult | null>(null);\n const [error, setError] = useState<Error | null>(null);\n const [entries, setEntries] = useState<MediaUploadEntry[]>([]);\n const activeCount = useRef(0);\n\n const patchEntry = useCallback(\n (id: string, patch: Partial<MediaUploadEntry>) => {\n setEntries((current) =>\n current.map((e) => (e.id === id ? { ...e, ...patch } : e)),\n );\n },\n [],\n );\n\n const upload = useCallback(\n async (\n file: File | Blob,\n opts: MediaUploadOptions = {},\n ): Promise<MediaUploadResult> => {\n const id = `up-${++entrySeq}`;\n const fileName =\n opts.fileName ?? (file instanceof File ? file.name : \"file\");\n setEntries((current) => [\n ...current,\n {\n id,\n fileName,\n fileSize: file.size,\n bytesUploaded: 0,\n status: \"uploading\",\n error: null,\n fileId: null,\n completedAt: null,\n },\n ]);\n activeCount.current += 1;\n setUploading(true);\n setError(null);\n setProgress(null);\n try {\n const uploaded = await client.upload(file, {\n ...opts,\n onProgress: (loaded, total) => {\n setProgress({ loaded, total, ratio: total > 0 ? loaded / total : 0 });\n patchEntry(id, { bytesUploaded: loaded });\n opts.onProgress?.(loaded, total);\n },\n });\n setResult(uploaded);\n patchEntry(id, {\n status: \"success\",\n fileId: uploaded.fileId,\n bytesUploaded: file.size,\n completedAt: Date.now(),\n });\n return uploaded;\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setError(e);\n patchEntry(id, {\n status: \"error\",\n error: e.message,\n completedAt: Date.now(),\n });\n throw e;\n } finally {\n activeCount.current -= 1;\n if (activeCount.current <= 0) setUploading(false);\n }\n },\n [client, patchEntry],\n );\n\n const uploadMany = useCallback(\n async (\n files: File[],\n opts: MediaUploadOptions = {},\n ): Promise<MediaMultiUploadResult> => {\n if (client.uploadMany) {\n activeCount.current += 1;\n setUploading(true);\n try {\n return await client.uploadMany(files, opts);\n } finally {\n activeCount.current -= 1;\n if (activeCount.current <= 0) setUploading(false);\n }\n }\n const uploaded: string[] = [];\n const failed: Array<{ name: string; error: string }> = [];\n for (const file of files) {\n try {\n const one = await upload(file, opts);\n uploaded.push(one.fileId);\n } catch (err) {\n // Surface BOTH the file and the real backend reason — joining\n // objects rendered \"[object Object]\" to the user in the original.\n failed.push({\n name: file.name,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n return { uploaded, failed, cancelled: false };\n },\n [client, upload],\n );\n\n const clearEntry = useCallback((id: string) => {\n setEntries((current) => current.filter((e) => e.id !== id));\n }, []);\n\n const reset = useCallback(() => {\n setResult(null);\n setError(null);\n setProgress(null);\n setEntries([]);\n }, []);\n\n return {\n upload,\n uploadMany,\n uploading,\n progress,\n result,\n error,\n entries,\n clearEntry,\n reset,\n };\n}\n","/**\n * src/react/upload-progress-list.tsx — the live upload tray.\n *\n * Verbatim behavior port of matrx-frontend\n * `FileUploadDropzone/UploadProgressList.tsx` with the Redux seams inverted:\n * entries come from `useMediaUpload().entries` (or any structurally equal\n * list) and dismissal is the injected `onDismiss` instead of a dispatched\n * `clearUpload`.\n *\n * Behavior: in-flight entries show a live progress bar + percentage;\n * successful entries persist with an \"Open\" affordance and auto-dismiss\n * after 10s — the timer pauses while the pointer is over the tray; failed\n * entries persist until manually dismissed.\n */\n\n\"use client\";\n\nimport { memo, useEffect, useRef, useState } from \"react\";\n// `formatFileSize` moved to `@ai-matrx/kit/format` on 2026-09-07 (duplication\n// census H1): it was hiding inside this React component, so six host twins\n// could only reach it by depending on the media React bundle to print a byte\n// count. Nothing is re-exported from here — import `@ai-matrx/kit/format`.\nimport { formatFileSize } from \"@ai-matrx/kit/format\";\nimport type { MediaUploadEntry } from \"../core/use-media-upload\";\nimport { cn } from \"./cn\";\nimport { FileIcon } from \"./file-icon\";\nimport {\n AlertCircleIcon,\n CheckCircle2Icon,\n ExternalLinkIcon,\n XIcon,\n} from \"./icons\";\n\n/** How long a successful upload lingers in the tray before auto-dismissing. */\nconst AUTO_DISMISS_MS = 10_000;\n\nexport interface UploadProgressListProps {\n uploads: MediaUploadEntry[];\n /** Remove an entry from the tray (wire to `useMediaUpload().clearEntry`). */\n onDismiss: (id: string) => void;\n /**\n * Reveal a finished file — opens the preview pane / scrolls the row.\n * When omitted, the \"Open\" affordance is hidden.\n */\n onOpenFile?: ((fileId: string) => void) | undefined;\n className?: string | undefined;\n}\n\nfunction UploadProgressListImpl({\n uploads,\n onDismiss,\n onOpenFile,\n className,\n}: UploadProgressListProps) {\n const [hovered, setHovered] = useState(false);\n\n const activeCount = uploads.filter((u) => u.status === \"uploading\").length;\n const successCount = uploads.filter((u) => u.status === \"success\").length;\n const errorCount = uploads.filter((u) => u.status === \"error\").length;\n\n // Auto-dismiss successful entries. The timer is paused (cleared) while the\n // pointer is over the tray so a user reaching for \"Open\" is never cut off.\n const timersRef = useRef<Map<string, ReturnType<typeof setTimeout>>>(\n new Map(),\n );\n const onDismissRef = useRef(onDismiss);\n onDismissRef.current = onDismiss;\n useEffect(() => {\n const timers = timersRef.current;\n if (hovered) {\n timers.forEach((t) => clearTimeout(t));\n timers.clear();\n return;\n }\n for (const u of uploads) {\n if (u.status !== \"success\") continue;\n if (timers.has(u.id)) continue;\n const elapsed = u.completedAt ? Date.now() - u.completedAt : 0;\n const remaining = Math.max(0, AUTO_DISMISS_MS - elapsed);\n const handle = setTimeout(() => {\n timers.delete(u.id);\n onDismissRef.current(u.id);\n }, remaining);\n timers.set(u.id, handle);\n }\n const liveSuccessIds = new Set(\n uploads.filter((u) => u.status === \"success\").map((u) => u.id),\n );\n for (const [id, handle] of timers) {\n if (!liveSuccessIds.has(id)) {\n clearTimeout(handle);\n timers.delete(id);\n }\n }\n }, [uploads, hovered]);\n\n useEffect(() => {\n const timers = timersRef.current;\n return () => {\n timers.forEach((t) => clearTimeout(t));\n timers.clear();\n };\n }, []);\n\n if (uploads.length === 0) return null;\n\n const headerLabel =\n activeCount > 0\n ? `Uploading ${activeCount} file${activeCount === 1 ? \"\" : \"s\"}…`\n : errorCount > 0 && successCount === 0\n ? `${errorCount} upload${errorCount === 1 ? \"\" : \"s\"} failed`\n : `Uploaded ${successCount} file${successCount === 1 ? \"\" : \"s\"}`;\n\n const completedIds = uploads\n .filter((u) => u.status === \"success\" || u.status === \"error\")\n .map((u) => u.id);\n\n return (\n <div\n className={cn(\n \"overflow-hidden rounded-lg border bg-background/95 shadow-lg backdrop-blur\",\n className,\n )}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n aria-label=\"Uploads\"\n >\n <div className=\"flex items-center justify-between gap-2 border-b bg-muted/40 px-3 py-1.5\">\n <span className=\"truncate text-xs font-medium text-foreground\">\n {headerLabel}\n </span>\n {completedIds.length > 0 ? (\n <button\n type=\"button\"\n onClick={() => {\n for (const id of completedIds) onDismiss(id);\n }}\n className=\"shrink-0 rounded px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n Clear\n </button>\n ) : null}\n </div>\n\n <ul className=\"max-h-72 space-y-1 overflow-y-auto p-2\">\n {uploads.map((u) => {\n const percent =\n u.fileSize > 0\n ? Math.min(100, Math.round((u.bytesUploaded / u.fileSize) * 100))\n : 0;\n const done = u.status === \"success\";\n const failed = u.status === \"error\";\n const canOpen = done && !!u.fileId && !!onOpenFile;\n return (\n <li\n key={u.id}\n className={cn(\n \"flex items-center gap-2 rounded-md px-2 py-1.5 text-xs\",\n canOpen && \"cursor-pointer hover:bg-accent/60\",\n )}\n onClick={\n canOpen ? () => onOpenFile(u.fileId as string) : undefined\n }\n >\n <FileIcon fileName={u.fileName} size={18} className=\"shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate font-medium text-foreground\">\n {u.fileName}\n </span>\n <span className=\"shrink-0 tabular-nums text-muted-foreground\">\n {failed ? \"Failed\" : done ? \"Done\" : `${percent}%`}\n </span>\n </div>\n {done ? null : (\n <div className=\"mt-1 h-1 w-full rounded bg-muted\">\n <div\n className={cn(\n \"h-1 rounded transition-all\",\n failed ? \"bg-destructive\" : \"bg-primary\",\n )}\n style={{ width: failed ? \"100%\" : `${percent}%` }}\n />\n </div>\n )}\n {failed && u.error ? (\n <p className=\"mt-0.5 truncate text-[10px] text-destructive\">\n {u.error}\n </p>\n ) : !done ? (\n <p className=\"mt-0.5 text-[10px] text-muted-foreground\">\n {formatFileSize(u.bytesUploaded)} /{\" \"}\n {formatFileSize(u.fileSize)}\n </p>\n ) : null}\n </div>\n\n {canOpen ? (\n <span className=\"flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-primary\">\n <ExternalLinkIcon className=\"h-3 w-3\" width={12} height={12} />\n Open\n </span>\n ) : done ? (\n <CheckCircle2Icon\n className=\"h-4 w-4 shrink-0 text-emerald-500\"\n width={16}\n height={16}\n />\n ) : failed ? (\n <AlertCircleIcon\n className=\"h-4 w-4 shrink-0 text-destructive\"\n width={16}\n height={16}\n />\n ) : null}\n\n {done || failed ? (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onDismiss(u.id);\n }}\n aria-label=\"Dismiss\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <XIcon className=\"h-3 w-3\" width={12} height={12} />\n </button>\n ) : null}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n\nexport const UploadProgressList = memo(UploadProgressListImpl);\n","/**\n * src/react/media-action-toolbar.tsx — THE SHARE MANDATE's toolbar shell.\n *\n * A headless-driven action strip (share / download / copy / open) wired to\n * the host's injected {@link MediaActionsPort} through `useMediaActions`.\n * FAILS CLOSED: an action without a handler renders disabled (or hidden with\n * `hideUnavailable`); nothing here mints a URL.\n *\n * The share action opens the injected `SharePopover` body when the port\n * provides one (the slot the associations package fills — mandated wave),\n * otherwise it runs the port's quick `share` handler.\n */\n\n\"use client\";\n\nimport { useState, type ComponentType } from \"react\";\nimport type {\n MediaActionKind,\n MediaRefLike,\n MediaSharePopoverProps,\n} from \"../types\";\nimport { useMediaActions } from \"../core/use-media-actions\";\nimport { cn } from \"./cn\";\nimport {\n CopyIcon,\n DownloadIcon,\n ExternalLinkIcon,\n Share2Icon,\n type MediaIconProps,\n} from \"./icons\";\n\nconst ACTION_META: Record<\n MediaActionKind,\n { label: string; Icon: (props: MediaIconProps) => ReturnType<typeof CopyIcon> }\n> = {\n share: { label: \"Share\", Icon: Share2Icon },\n download: { label: \"Download\", Icon: DownloadIcon },\n copy: { label: \"Copy\", Icon: CopyIcon },\n open: { label: \"Open\", Icon: ExternalLinkIcon },\n};\n\nconst DEFAULT_ORDER: MediaActionKind[] = [\"share\", \"download\", \"copy\", \"open\"];\n\nexport interface MediaActionToolbarProps {\n mediaRef: MediaRefLike | null | undefined;\n fileName?: string | undefined;\n alt?: string | undefined;\n /** Which actions to render, in order. Default: share, download, copy, open. */\n actions?: MediaActionKind[] | undefined;\n /** Hide unavailable actions instead of rendering them disabled. */\n hideUnavailable?: boolean | undefined;\n className?: string | undefined;\n buttonClassName?: string | undefined;\n}\n\nexport function MediaActionToolbar({\n mediaRef,\n fileName,\n alt,\n actions = DEFAULT_ORDER,\n hideUnavailable = false,\n className,\n buttonClassName,\n}: MediaActionToolbarProps) {\n const state = useMediaActions(mediaRef, { fileName, alt });\n const [shareOpen, setShareOpen] = useState(false);\n\n const SharePopover = state.SharePopover as\n | ComponentType<MediaSharePopoverProps>\n | null;\n\n const visible = hideUnavailable\n ? actions.filter((kind) => state.isAvailable(kind))\n : actions;\n\n if (visible.length === 0) return null;\n\n return (\n <div className={cn(\"relative inline-flex items-center gap-1\", className)}>\n {visible.map((kind) => {\n const { label, Icon } = ACTION_META[kind];\n const available = state.isAvailable(kind);\n const busy = state.busy === kind;\n return (\n <button\n key={kind}\n type=\"button\"\n aria-label={label}\n title={label}\n disabled={!available || busy}\n onClick={() => {\n if (kind === \"share\" && SharePopover) {\n setShareOpen((open) => !open);\n return;\n }\n void state.run(kind);\n }}\n className={cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors\",\n available\n ? \"hover:bg-accent hover:text-foreground\"\n : \"opacity-40 cursor-not-allowed\",\n busy && \"animate-pulse\",\n buttonClassName,\n )}\n >\n <Icon className=\"h-4 w-4\" width={16} height={16} />\n </button>\n );\n })}\n {state.lastError ? (\n <span\n role=\"status\"\n className=\"ml-1 max-w-48 truncate text-[11px] text-destructive\"\n title={state.lastError.message}\n >\n {ACTION_META[state.lastError.kind].label} failed\n </span>\n ) : null}\n {shareOpen && SharePopover && state.context ? (\n <div className=\"absolute right-0 top-full z-30 mt-1\">\n <SharePopover\n context={state.context}\n onClose={() => setShareOpen(false)}\n />\n </div>\n ) : null}\n </div>\n );\n}\n","/**\n * src/core/use-media-actions.ts — THE SHARE MANDATE's headless engine.\n *\n * Wires a MediaRefLike to the host's injected {@link MediaActionsPort}\n * (share / download / copy / open + the SharePopover slot the associations\n * package fills). FAILS CLOSED: with no port — or no handler for a given\n * action — the action reports unavailable and the shells render it disabled.\n * Nothing here mints URLs; handlers reach bytes/links only through the\n * MediaClient they close over.\n */\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport type {\n MediaActionContext,\n MediaActionKind,\n MediaRefLike,\n MediaSharePopoverProps,\n MediaSlotComponent,\n} from \"../types\";\nimport { useMediaHostPorts } from \"./context\";\nimport { useMediaResolution } from \"./use-media-resolution\";\n\nexport interface UseMediaActionsOptions {\n fileName?: string | undefined;\n alt?: string | undefined;\n}\n\nexport interface MediaActionsState {\n /** Null when no ref was supplied. */\n context: MediaActionContext | null;\n /** True when the host wired a handler for this action (share also counts the popover). */\n isAvailable: (kind: MediaActionKind) => boolean;\n /** Run an action. No-op (resolved) when unavailable. */\n run: (kind: MediaActionKind) => Promise<void>;\n /** The action currently executing, or null. */\n busy: MediaActionKind | null;\n /** Last handler failure, surfaced as state for the shell to render. */\n lastError: { kind: MediaActionKind; message: string } | null;\n /** The rich share body slot (associations package), when injected. */\n SharePopover: MediaSlotComponent<MediaSharePopoverProps> | null;\n}\n\nexport function useMediaActions(\n ref: MediaRefLike | null | undefined,\n options: UseMediaActionsOptions = {},\n): MediaActionsState {\n const ports = useMediaHostPorts();\n const { resolution } = useMediaResolution(ref);\n const [busy, setBusy] = useState<MediaActionKind | null>(null);\n const [lastError, setLastError] = useState<{\n kind: MediaActionKind;\n message: string;\n } | null>(null);\n\n const actions = ports.actions;\n const { fileName, alt } = options;\n\n const context = useMemo<MediaActionContext | null>(() => {\n if (!ref) return null;\n return { ref, resolution, fileName, alt };\n }, [ref, resolution, fileName, alt]);\n\n const isAvailable = useCallback(\n (kind: MediaActionKind): boolean => {\n if (!context || !actions) return false;\n if (kind === \"share\") return Boolean(actions.share || actions.SharePopover);\n return Boolean(actions[kind]);\n },\n [context, actions],\n );\n\n const run = useCallback(\n async (kind: MediaActionKind): Promise<void> => {\n if (!context || !actions) return;\n const handler = actions[kind];\n if (!handler) return;\n setBusy(kind);\n setLastError(null);\n try {\n await handler(context);\n } catch (err) {\n setLastError({\n kind,\n message: err instanceof Error ? err.message : String(err),\n });\n } finally {\n setBusy(null);\n }\n },\n [context, actions],\n );\n\n return {\n context,\n isAvailable,\n run,\n busy,\n lastError,\n SharePopover: actions?.SharePopover ?? null,\n };\n}\n","/**\n * src/react/media-lightbox.tsx — THE SHARE MANDATE's lightbox shell.\n *\n * Full-viewport media viewer: backdrop, Escape/backdrop-click close, the\n * media rendered through `InlineMediaRef` (durable refs only — no `src`\n * lane exists), and the `MediaActionToolbar` wired to the host's injected\n * actions port. The rich share body arrives through the same\n * `SharePopover` slot (associations package — mandated wave); until a host\n * injects handlers, every action renders disabled (fails closed).\n */\n\n\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport type { DurableSrc, MediaActionKind, MediaRefLike } from \"../types\";\nimport { cn } from \"./cn\";\nimport { InlineMediaRef } from \"./inline-media-ref\";\nimport { MediaActionToolbar } from \"./media-action-toolbar\";\nimport { XIcon } from \"./icons\";\n\nexport interface MediaLightboxProps {\n open: boolean;\n onClose: () => void;\n mediaRef: MediaRefLike | null | undefined;\n fileName?: string | undefined;\n alt?: string | undefined;\n /** Force the media element type (default: inferred from the resolution). */\n as?: \"img\" | \"video\" | \"audio\" | undefined;\n /** Start video/audio playback on open — forwarded to the media element. */\n autoPlay?: boolean | undefined;\n /** Inline (non-fullscreen-hijack) playback on iOS — forwarded to `<video>`. */\n playsInline?: boolean | undefined;\n /**\n * Poster frame for video — the branded {@link DurableSrc} only (law 3),\n * resolved/minted by the host exactly like the element src.\n */\n poster?: DurableSrc | undefined;\n /**\n * Playback-session label reported to the host's `playbackSession` port\n * while the media plays (e.g. \"Video (fullscreen)\"). Rides the existing\n * port — no new playback lane.\n */\n playbackLabel?: string | undefined;\n /** Toolbar actions to offer. Default: share, download, copy, open. */\n actions?: MediaActionKind[] | undefined;\n /** Hide unavailable toolbar actions instead of disabling them. */\n hideUnavailableActions?: boolean | undefined;\n /** Extra chrome rendered in the header row (left of the toolbar). */\n headerExtra?: ReactNode | undefined;\n className?: string | undefined;\n}\n\nexport function MediaLightbox({\n open,\n onClose,\n mediaRef,\n fileName,\n alt,\n as,\n autoPlay,\n playsInline,\n poster,\n playbackLabel,\n actions,\n hideUnavailableActions = false,\n headerExtra,\n className,\n}: MediaLightboxProps) {\n useEffect(() => {\n if (!open || typeof window === \"undefined\") return undefined;\n const handler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n onClose();\n }\n };\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n }, [open, onClose]);\n\n if (!open) return null;\n\n return (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={fileName ?? alt ?? \"Media viewer\"}\n className={cn(\n \"fixed inset-0 z-50 flex flex-col bg-black/80 backdrop-blur-sm\",\n className,\n )}\n onClick={onClose}\n >\n <div\n className=\"flex items-center justify-between gap-2 p-3\"\n onClick={(event) => event.stopPropagation()}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"truncate text-sm font-medium text-white/90\">\n {fileName ?? alt ?? \"\"}\n </span>\n {headerExtra}\n </div>\n <div className=\"flex items-center gap-1\">\n <MediaActionToolbar\n mediaRef={mediaRef}\n fileName={fileName}\n alt={alt}\n actions={actions}\n hideUnavailable={hideUnavailableActions}\n buttonClassName=\"text-white/80 hover:bg-white/10 hover:text-white\"\n />\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 transition-colors hover:bg-white/10 hover:text-white\"\n >\n <XIcon className=\"h-4 w-4\" width={16} height={16} />\n </button>\n </div>\n </div>\n <div\n className=\"flex min-h-0 flex-1 items-center justify-center p-4\"\n onClick={(event) => event.stopPropagation()}\n >\n <div className=\"h-full w-full\">\n <InlineMediaRef\n ref={mediaRef}\n size=\"fill\"\n fit=\"contain\"\n rounded=\"none\"\n alt={alt ?? fileName ?? \"\"}\n as={as}\n autoPlay={autoPlay}\n playsInline={playsInline}\n poster={poster}\n playbackLabel={playbackLabel}\n />\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQA,4BAAwB;AAIjB,SAAS,MAAM,QAA8B;AAClD,aAA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A,oBACjB,iBAAgB;AAAA;AAAA,gBAClB;AAAA,gBACA;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAK;AAAA,oBACL,cAAW;AAAA,oBACX,SAAS;AAAA,oBACT,WAAU;AAAA,oBAEV,uDAAC,SAAM,WAAU,WAAU,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,gBACpD;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS,CAAC,UAAU,MAAM,gBAAgB;AAAA,YAE1C,uDAAC,SAAI,WAAU,iBACb;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,MAAK;AAAA,gBACL,KAAI;AAAA,gBACJ,SAAQ;AAAA,gBACR,KAAK,OAAO,YAAY;AAAA,gBACxB;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA,YACF,GACF;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["FileIcon","import_jsx_runtime","FileIcon","import_react","import_react","import_react","import_react","import_react","import_react","import_jsx_runtime","import_react","import_react","import_jsx_runtime","FileIcon","import_react","import_react","import_react","import_react","import_jsx_runtime","FileIcon","import_jsx_runtime","import_react","import_react","import_jsx_runtime","import_react","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../src/react.ts","../src/react/cn.ts","../src/react/icons.tsx","../src/core/file-kind.ts","../src/react/file-icon.tsx","../src/react/inline-media-ref.tsx","../src/core/context.ts","../src/core/diagnostics.ts","../src/core/use-media-blob.ts","../src/core/ref-key.ts","../src/core/use-media-blob-load-recovery.ts","../src/core/use-media-load-recovery.ts","../src/types.ts","../src/core/use-media-resolution.ts","../src/react/media-thumbnail.tsx","../src/core/use-thumbnail-source.ts","../src/react/use-media-dropzone.ts","../src/react/file-upload-dropzone.tsx","../src/core/use-media-upload.ts","../src/react/upload-progress-list.tsx","../src/react/media-action-toolbar.tsx","../src/core/use-media-actions.ts","../src/react/media-lightbox.tsx","../src/react/read-aloud-button.tsx","../src/react/read-aloud-language-picker.tsx","../src/voices/read-aloud-languages.ts"],"sourcesContent":["/**\n * @ai-matrx/media/react — the DOM bindings.\n *\n * Components take durable refs ONLY (no `src` props exist in this package);\n * everything resolves through the injected MediaClient. Tailwind v4 hosts\n * register this package as a Tailwind source (the design-system precedent)\n * so the utility classes used here are generated.\n */\n\nexport { cn } from \"./react/cn\";\nexport * from \"./react/icons\";\nexport { FileIcon, type FileIconProps } from \"./react/file-icon\";\nexport {\n InlineMediaRef,\n type InlineMediaRefFit,\n type InlineMediaRefProps,\n type InlineMediaRefSize,\n} from \"./react/inline-media-ref\";\nexport {\n MediaThumbnail,\n type MediaThumbnailProps,\n} from \"./react/media-thumbnail\";\nexport {\n useMediaDropzone,\n type MediaDropzoneOptions,\n type MediaDropzoneState,\n} from \"./react/use-media-dropzone\";\nexport {\n FileUploadDropzone,\n type FileUploadDropzoneActions,\n type FileUploadDropzoneProps,\n} from \"./react/file-upload-dropzone\";\n// `formatFileSize` is NO LONGER exported here — it moved to\n// `@ai-matrx/kit/format` (census H1). See the CHANGELOG's\n// \"Consumer action (C28)\".\nexport {\n UploadProgressList,\n type UploadProgressListProps,\n} from \"./react/upload-progress-list\";\nexport {\n MediaActionToolbar,\n type MediaActionToolbarProps,\n} from \"./react/media-action-toolbar\";\nexport {\n MediaLightbox,\n type MediaLightboxProps,\n} from \"./react/media-lightbox\";\nexport {\n ReadAloudButton,\n type ReadAloudButtonProps,\n type ReadAloudStatus,\n} from \"./react/read-aloud-button\";\nexport {\n ReadAloudLanguagePicker,\n type ReadAloudLanguagePickerProps,\n} from \"./react/read-aloud-language-picker\";\n","/**\n * src/react/cn.ts — conditional class join with last-wins Tailwind conflict\n * merging. The originals used the app's `cn` (clsx + tailwind-merge); public\n * `className` overrides depend on last-wins class-conflict merging, so a\n * naive join would be a behavior divergence (the kit `./confirm` precedent —\n * this is why `tailwind-merge` is a sanctioned runtime dep of `/react`).\n */\n\nimport { twMerge } from \"tailwind-merge\";\n\nexport type ClassValue = string | false | null | undefined | 0;\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(inputs.filter(Boolean).join(\" \"));\n}\n","/**\n * src/react/icons.tsx — the package's OWN inlined SVG icons.\n *\n * Per campaign ruling C19 (2026-08-29): no icon-library dependency, ever.\n * Every glyph below is copied from lucide-react v1.22.0 (ISC license) exactly,\n * following the @ai-matrx/tap-target precedent. Add a new icon by copying the\n * lucide __iconNode data — never by adding a lucide peer.\n *\n * Internal module: icons are exported for the package's own components and for\n * hosts that want visual parity in slots, but they are not the product.\n */\n\nimport type { SVGProps } from \"react\";\n\nexport type MediaIconProps = SVGProps<SVGSVGElement>;\n\nfunction svgProps(props: MediaIconProps): MediaIconProps {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n width: 24,\n height: 24,\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n// lucide: archive\nexport function ArchiveIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\n </svg>\n );\n}\n\n// lucide: braces\nexport function BracesIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\" />\n <path d=\"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\" />\n </svg>\n );\n}\n\n// lucide: check\nexport function CheckIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n// lucide: code\nexport function CodeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"m16 18 6-6-6-6\" />\n <path d=\"m8 6-6 6 6 6\" />\n </svg>\n );\n}\n\n// lucide: copy\nexport function CopyIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n );\n}\n\n// lucide: database\nexport function DatabaseIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" />\n <path d=\"M3 5V19A9 3 0 0 0 21 19V5\" />\n <path d=\"M3 12A9 3 0 0 0 21 12\" />\n </svg>\n );\n}\n\n// lucide: download\nexport function DownloadIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M12 15V3\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" />\n </svg>\n );\n}\n\n// lucide: externalLink\nexport function ExternalLinkIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n// lucide: file\nexport function FileIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n </svg>\n );\n}\n\n// lucide: fileAudio\nexport function FileAudioIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0\" />\n </svg>\n );\n}\n\n// lucide: fileCode\nexport function FileCodeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12.5 8 15l2 2.5\" />\n <path d=\"m14 12.5 2 2.5-2 2.5\" />\n </svg>\n );\n}\n\n// lucide: fileJson\nexport function FileJsonIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1\" />\n <path d=\"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1\" />\n </svg>\n );\n}\n\n// lucide: fileSpreadsheet\nexport function FileSpreadsheetIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M8 13h2\" />\n <path d=\"M14 13h2\" />\n <path d=\"M8 17h2\" />\n <path d=\"M14 17h2\" />\n </svg>\n );\n}\n\n// lucide: fileText\nexport function FileTextIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 9H8\" />\n <path d=\"M16 13H8\" />\n <path d=\"M16 17H8\" />\n </svg>\n );\n}\n\n// lucide: fileType\nexport function FileTypeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M11 18h2\" />\n <path d=\"M12 12v6\" />\n <path d=\"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5\" />\n </svg>\n );\n}\n\n// lucide: fileVideo\nexport function FileVideoIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z\" />\n </svg>\n );\n}\n\n// lucide: folder\nexport function FolderIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />\n </svg>\n );\n}\n\n// lucide: folderOpen\nexport function FolderOpenIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n// lucide: image\nexport function ImageIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" />\n </svg>\n );\n}\n\n// lucide: imageOff\nexport function ImageOffIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <line x1=\"2\" x2=\"22\" y1=\"2\" y2=\"22\" />\n <path d=\"M10.41 10.41a2 2 0 1 1-2.83-2.83\" />\n <line x1=\"13.5\" x2=\"6\" y1=\"13.5\" y2=\"21\" />\n <line x1=\"18\" x2=\"21\" y1=\"12\" y2=\"15\" />\n <path d=\"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59\" />\n <path d=\"M21 15V5a2 2 0 0 0-2-2H9\" />\n </svg>\n );\n}\n\n// lucide: music\nexport function MusicIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M9 18V5l12-2v13\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" />\n <circle cx=\"18\" cy=\"16\" r=\"3\" />\n </svg>\n );\n}\n\n// lucide: packageBox\nexport function PackageBoxIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z\" />\n <path d=\"M12 22V12\" />\n <polyline points=\"3.29 7 12 12 20.71 7\" />\n <path d=\"m7.5 4.27 9 5.15\" />\n </svg>\n );\n}\n\n// lucide: penTool\nexport function PenToolIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z\" />\n <path d=\"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18\" />\n <path d=\"m2.3 2.3 7.286 7.286\" />\n <circle cx=\"11\" cy=\"11\" r=\"2\" />\n </svg>\n );\n}\n\n// lucide: share2\nexport function Share2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"18\" cy=\"5\" r=\"3\" />\n <circle cx=\"6\" cy=\"12\" r=\"3\" />\n <circle cx=\"18\" cy=\"19\" r=\"3\" />\n <line x1=\"8.59\" x2=\"15.42\" y1=\"13.51\" y2=\"17.49\" />\n <line x1=\"15.41\" x2=\"8.59\" y1=\"6.51\" y2=\"10.49\" />\n </svg>\n );\n}\n\n// lucide: subtitles\nexport function SubtitlesIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect width=\"18\" height=\"14\" x=\"3\" y=\"5\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 15h4M15 15h2M7 11h2M13 11h4\" />\n </svg>\n );\n}\n\n// lucide: upload\nexport function UploadIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M12 3v12\" />\n <path d=\"m17 8-5-5-5 5\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n </svg>\n );\n}\n\n// lucide: video\nexport function VideoIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5\" />\n <rect x=\"2\" y=\"6\" width=\"14\" height=\"12\" rx=\"2\" />\n </svg>\n );\n}\n\n// lucide: videoOff\nexport function VideoOffIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196\" />\n <path d=\"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n// lucide: volumeX\nexport function VolumeXIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n <line x1=\"22\" x2=\"16\" y1=\"9\" y2=\"15\" />\n <line x1=\"16\" x2=\"22\" y1=\"9\" y2=\"15\" />\n </svg>\n );\n}\n\n// lucide: x\nexport function XIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n// lucide: alertCircle\nexport function AlertCircleIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n// lucide: checkCircle2\nexport function CheckCircle2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n </svg>\n );\n}\n\n// lucide: globe\nexport function GlobeIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\n </svg>\n );\n}\n\n// lucide: link-2\nexport function Link2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M9 17H7A5 5 0 0 1 7 7h2\" />\n <path d=\"M15 7h2a5 5 0 1 1 0 10h-2\" />\n <line x1=\"8\" x2=\"16\" y1=\"12\" y2=\"12\" />\n </svg>\n );\n}\n\n// lucide: settings-2\nexport function Settings2Icon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M20 7h-9\" />\n <path d=\"M14 17H5\" />\n <circle cx=\"17\" cy=\"17\" r=\"3\" />\n <circle cx=\"7\" cy=\"7\" r=\"3\" />\n </svg>\n );\n}\n\n// lucide: loader-circle (a.k.a. Loader2)\nexport function SpinnerIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n// lucide: plus\nexport function PlusIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n// lucide: search\nexport function SearchIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n );\n}\n\n// lucide: pause (lucide-react v1.48.0)\nexport function PauseIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n <rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n </svg>\n );\n}\n\n// lucide: play (lucide-react v1.48.0)\nexport function PlayIcon(props: MediaIconProps) {\n return (\n <svg {...svgProps(props)}>\n <path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />\n </svg>\n );\n}\n","/**\n * src/core/file-kind.ts — filename/MIME → category, icon name, color.\n *\n * Condensed port of the icon-relevant slice of matrx-frontend\n * `features/files/utils/file-types.ts` (the FILE_TYPES registry): every\n * extension→{category,icon,color,displayName} row is preserved; the\n * preview/thumbnail/size-cap columns stay in the app (C8 — they belong to\n * the previewer world, not the media kit). MIME-prefix fallback, the\n * dotfile-looks-like-text heuristic, folder details and the unknown default\n * are ported verbatim in behavior.\n *\n * Platform-free: icon NAMES only — `/react` maps names to its inlined SVGs;\n * a future `/react-native` binding maps the same names to its own glyphs.\n */\n\nexport type FileCategory =\n | \"CODE\"\n | \"DOCUMENT\"\n | \"AUDIO\"\n | \"IMAGE\"\n | \"VIDEO\"\n | \"ARCHIVE\"\n | \"DATA\"\n | \"NOTEBOOK\"\n | \"SUBTITLES\"\n | \"EMAIL\"\n | \"EBOOK\"\n | \"MODEL_3D\"\n | \"UNKNOWN\"\n | \"FOLDER\";\n\nexport type FileIconName =\n | \"image\"\n | \"pen-tool\"\n | \"video\"\n | \"music\"\n | \"file-type\"\n | \"file-text\"\n | \"code\"\n | \"braces\"\n | \"subtitles\"\n | \"file-code\"\n | \"file-json\"\n | \"file-spreadsheet\"\n | \"database\"\n | \"package\"\n | \"archive\"\n | \"folder\"\n | \"folder-open\"\n | \"file\"\n | \"file-audio\"\n | \"file-video\";\n\nexport interface FileKindDetails {\n category: FileCategory;\n displayName: string;\n /** Tailwind text color token, matching the original registry exactly. */\n colorClass: string;\n icon: FileIconName;\n}\n\ntype Row = [\n extensions: string[],\n category: FileCategory,\n colorClass: string,\n icon: FileIconName,\n displayName: string,\n];\n\n// Rows ported from the FILE_TYPES registry (icon-relevant columns), grouped\n// exactly as the original's icon/color assignments group them.\nconst ROWS: Row[] = [\n [[\"jpg\", \"jpeg\", \"png\", \"gif\", \"webp\", \"avif\", \"heic\", \"heif\", \"bmp\", \"tif\", \"tiff\", \"ico\"], \"IMAGE\", \"text-emerald-500\", \"image\", \"Image\"],\n [[\"svg\"], \"IMAGE\", \"text-amber-500\", \"pen-tool\", \"SVG image\"],\n [[\"mp4\", \"mov\", \"webm\", \"mkv\", \"avi\", \"m4v\"], \"VIDEO\", \"text-purple-500\", \"video\", \"Video\"],\n [[\"mp3\", \"wav\", \"ogg\", \"m4a\", \"aac\", \"flac\", \"opus\"], \"AUDIO\", \"text-pink-500\", \"music\", \"Audio\"],\n [[\"pdf\"], \"DOCUMENT\", \"text-red-500\", \"file-type\", \"PDF Document\"],\n [[\"md\", \"markdown\", \"mdx\", \"rst\", \"adoc\", \"asciidoc\", \"org\"], \"DOCUMENT\", \"text-slate-400\", \"file-text\", \"Markdown\"],\n [[\"txt\", \"text\", \"asc\", \"me\", \"log\", \"out\", \"err\"], \"DOCUMENT\", \"text-muted-foreground\", \"file-text\", \"Text\"],\n [[\"dockerfile\", \"containerfile\", \"lua\"], \"CODE\", \"text-blue-500\", \"code\", \"Code\"],\n [[\"mk\", \"make\", \"swift\", \"ml\", \"mli\", \"fs\", \"fsi\", \"fsx\", \"svelte\"], \"CODE\", \"text-orange-500\", \"code\", \"Code\"],\n [[\"diff\", \"patch\", \"pem\", \"csr\", \"crt\", \"cer\", \"der\", \"key\", \"pub\", \"p7b\", \"p7c\", \"pfx\", \"p12\"], \"CODE\", \"text-amber-500\", \"file-text\", \"Text\"],\n [[\"ini\", \"cfg\", \"conf\", \"config\", \"properties\", \"prefs\"], \"CODE\", \"text-amber-400\", \"braces\", \"Config\"],\n [[\"tex\", \"latex\", \"ltx\", \"sty\", \"cls\", \"bib\"], \"CODE\", \"text-emerald-500\", \"file-text\", \"LaTeX\"],\n [[\"srt\", \"vtt\"], \"SUBTITLES\", \"text-cyan-500\", \"subtitles\", \"Subtitles\"],\n [[\"js\", \"mjs\", \"cjs\", \"jsx\"], \"CODE\", \"text-yellow-500\", \"file-code\", \"JavaScript\"],\n [[\"ts\", \"tsx\"], \"CODE\", \"text-blue-500\", \"file-code\", \"TypeScript\"],\n [[\"py\", \"clj\", \"cljs\", \"cljc\", \"edn\", \"vue\", \"styl\", \"stylus\"], \"CODE\", \"text-emerald-500\", \"code\", \"Code\"],\n [[\"rb\", \"rbw\", \"rake\", \"ru\", \"gemspec\", \"scala\", \"sbt\"], \"CODE\", \"text-red-500\", \"code\", \"Code\"],\n [[\"go\", \"dart\"], \"CODE\", \"text-cyan-500\", \"code\", \"Code\"],\n [[\"rs\"], \"CODE\", \"text-orange-600\", \"code\", \"Rust\"],\n [[\"java\"], \"CODE\", \"text-red-600\", \"code\", \"Java\"],\n [[\"c\", \"h\"], \"CODE\", \"text-blue-600\", \"code\", \"C\"],\n [[\"cpp\", \"cc\", \"cxx\", \"hpp\"], \"CODE\", \"text-blue-700\", \"code\", \"C++\"],\n [[\"cs\"], \"CODE\", \"text-purple-600\", \"code\", \"C#\"],\n [[\"html\", \"htm\", \"kt\", \"kts\"], \"CODE\", \"text-orange-400\", \"code\", \"Code\"],\n [[\"css\"], \"CODE\", \"text-sky-400\", \"code\", \"CSS\"],\n [[\"scss\"], \"CODE\", \"text-pink-400\", \"code\", \"SCSS\"],\n [[\"sh\", \"bash\", \"zsh\", \"fish\", \"ksh\", \"ash\", \"bat\", \"cmd\", \"twig\", \"jinja\", \"j2\", \"njk\"], \"CODE\", \"text-emerald-400\", \"code\", \"Script\"],\n [[\"sql\"], \"CODE\", \"text-amber-400\", \"code\", \"SQL\"],\n [[\"pl\", \"pm\"], \"CODE\", \"text-indigo-400\", \"code\", \"Perl\"],\n [[\"r\", \"rmd\", \"proto\", \"ps1\", \"psm1\", \"psd1\", \"less\"], \"CODE\", \"text-blue-400\", \"code\", \"Code\"],\n [[\"ex\", \"exs\"], \"CODE\", \"text-purple-400\", \"code\", \"Elixir\"],\n [[\"erl\", \"hrl\"], \"CODE\", \"text-rose-500\", \"code\", \"Erlang\"],\n [[\"hs\", \"lhs\"], \"CODE\", \"text-violet-500\", \"code\", \"Haskell\"],\n [[\"zig\"], \"CODE\", \"text-yellow-500\", \"code\", \"Zig\"],\n [[\"nim\", \"nims\"], \"CODE\", \"text-yellow-400\", \"code\", \"Nim\"],\n [[\"jl\"], \"CODE\", \"text-purple-500\", \"code\", \"Julia\"],\n [[\"astro\"], \"CODE\", \"text-fuchsia-500\", \"code\", \"Astro\"],\n [[\"graphql\", \"gql\", \"graphqls\"], \"CODE\", \"text-pink-500\", \"code\", \"GraphQL\"],\n [[\"sol\"], \"CODE\", \"text-slate-400\", \"code\", \"Solidity\"],\n [[\"php\", \"phtml\", \"phps\"], \"CODE\", \"text-indigo-500\", \"code\", \"PHP\"],\n [[\"hbs\", \"handlebars\", \"mustache\", \"ejs\", \"liquid\"], \"CODE\", \"text-amber-500\", \"code\", \"Template\"],\n [[\"json\", \"jsonc\", \"json5\", \"har\", \"geojson\", \"topojson\"], \"DATA\", \"text-amber-500\", \"file-json\", \"JSON\"],\n [[\"yaml\", \"yml\", \"toml\"], \"CODE\", \"text-amber-500\", \"braces\", \"Config\"],\n [[\"xml\"], \"DATA\", \"text-amber-500\", \"braces\", \"XML\"],\n [[\"csv\", \"tsv\"], \"DATA\", \"text-orange-500\", \"file-spreadsheet\", \"Spreadsheet data\"],\n [[\"sqlite\", \"sqlite3\", \"db\"], \"DATA\", \"text-blue-400\", \"database\", \"Database\"],\n [[\"ttl\", \"n3\", \"nt\", \"nq\", \"trig\"], \"DATA\", \"text-fuchsia-400\", \"braces\", \"RDF data\"],\n [[\"xlsx\", \"xls\"], \"DOCUMENT\", \"text-emerald-600\", \"file-spreadsheet\", \"Excel workbook\"],\n [[\"doc\", \"docx\"], \"DOCUMENT\", \"text-blue-500\", \"file-text\", \"Word document\"],\n [[\"ppt\", \"pptx\"], \"DOCUMENT\", \"text-orange-600\", \"file-type\", \"Presentation\"],\n [[\"ipynb\"], \"NOTEBOOK\", \"text-orange-400\", \"file-json\", \"Notebook\"],\n [[\"epub\"], \"EBOOK\", \"text-indigo-500\", \"file-text\", \"eBook\"],\n [[\"eml\"], \"EMAIL\", \"text-blue-400\", \"file-text\", \"Email\"],\n [[\"glb\", \"gltf\", \"stl\", \"obj\", \"fbx\"], \"MODEL_3D\", \"text-violet-400\", \"package\", \"3D model\"],\n [[\"zip\", \"rar\", \"7z\"], \"ARCHIVE\", \"text-amber-600\", \"archive\", \"Archive\"],\n [[\"tar\", \"gz\", \"tgz\"], \"ARCHIVE\", \"text-amber-600\", \"package\", \"Archive\"],\n];\n\nconst BY_EXTENSION = new Map<string, FileKindDetails>();\nfor (const [extensions, category, colorClass, icon, displayName] of ROWS) {\n for (const ext of extensions) {\n BY_EXTENSION.set(ext, { category, colorClass, icon, displayName });\n }\n}\n\nconst UNKNOWN_DETAILS: FileKindDetails = {\n category: \"UNKNOWN\",\n displayName: \"File\",\n colorClass: \"text-muted-foreground\",\n icon: \"file\",\n};\n\nconst ASSUMED_TEXT_DETAILS: FileKindDetails = {\n category: \"DOCUMENT\",\n displayName: \"Text\",\n colorClass: \"text-muted-foreground\",\n icon: \"file-text\",\n};\n\nconst FOLDER_DETAILS: FileKindDetails = {\n category: \"FOLDER\",\n displayName: \"Folder\",\n colorClass: \"text-sky-500\",\n icon: \"folder\",\n};\n\nconst IMAGE_DETAILS = BY_EXTENSION.get(\"png\") as FileKindDetails;\nconst VIDEO_DETAILS = BY_EXTENSION.get(\"mp4\") as FileKindDetails;\nconst AUDIO_DETAILS = BY_EXTENSION.get(\"mp3\") as FileKindDetails;\nconst PDF_DETAILS = BY_EXTENSION.get(\"pdf\") as FileKindDetails;\nconst SVG_DETAILS = BY_EXTENSION.get(\"svg\") as FileKindDetails;\n\nfunction basenameOf(path: string): string {\n const idx = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"));\n return idx >= 0 ? path.slice(idx + 1) : path;\n}\n\nfunction extOf(name: string): string | null {\n const idx = name.lastIndexOf(\".\");\n if (idx <= 0 || idx === name.length - 1) return null;\n return name.slice(idx + 1).toLowerCase();\n}\n\n/**\n * Dotfile heuristic (ported): unrecognized dotfiles are almost always text —\n * bias toward the text profile instead of the binary \"File\" default.\n */\nfunction dotfileLooksLikeText(filename: string): boolean {\n const name = basenameOf(filename);\n if (!name.startsWith(\".\")) return false;\n for (let i = 1; i < name.length; i++) {\n const c = name.charCodeAt(i);\n if (\n (c >= 48 && c <= 57) ||\n (c >= 65 && c <= 90) ||\n (c >= 97 && c <= 122) ||\n c === 95 ||\n c === 45\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Strip MIME parameters (`;codecs=opus`, etc.). */\nfunction canonicalMimeBase(raw: string): string {\n return raw.split(\";\")[0]?.trim().toLowerCase() ?? raw;\n}\n\n/**\n * Resolve icon details from a filename and (optionally) the server MIME.\n * MIME-prefix override handles \"the browser knows `image/avif` but the\n * extension table doesn't\" — and disambiguates audio/webm vs video/webm.\n */\nexport function getFileKindDetails(\n fileName: string,\n mimeType?: string | null,\n): FileKindDetails {\n const name = basenameOf(fileName);\n const lower = name.toLowerCase();\n const ext = lower === \"dockerfile\" || lower === \"containerfile\" ? lower : extOf(name);\n const fromExt = ext ? BY_EXTENSION.get(ext) : undefined;\n\n const mime = mimeType ? canonicalMimeBase(mimeType) : null;\n if (mime) {\n if (mime === \"image/svg+xml\") return fromExt ?? SVG_DETAILS;\n if (mime.startsWith(\"image/\")) return fromExt?.category === \"IMAGE\" ? fromExt : IMAGE_DETAILS;\n if (mime.startsWith(\"video/\")) return fromExt?.category === \"VIDEO\" ? fromExt : VIDEO_DETAILS;\n if (mime.startsWith(\"audio/\")) return fromExt?.category === \"AUDIO\" ? fromExt : AUDIO_DETAILS;\n if (mime === \"application/pdf\") return PDF_DETAILS;\n }\n\n if (fromExt) return fromExt;\n if (dotfileLooksLikeText(fileName)) return ASSUMED_TEXT_DETAILS;\n return UNKNOWN_DETAILS;\n}\n\n/** Folder icon details (open picks the open-folder glyph). */\nexport function getFolderKindDetails(open = false): FileKindDetails {\n return open ? { ...FOLDER_DETAILS, icon: \"folder-open\" } : FOLDER_DETAILS;\n}\n","/**\n * src/react/file-icon.tsx — icon tile for any file or folder.\n *\n * Verbatim port of matrx-frontend `components/core/FileIcon/FileIcon.tsx`\n * with two seam inversions: the registry lookup is the package's own\n * `getFileKindDetails` (`/core`), and the glyphs are the package's own\n * inlined SVGs (C19 — no lucide peer).\n */\n\nimport type { CSSProperties } from \"react\";\nimport {\n getFileKindDetails,\n getFolderKindDetails,\n type FileIconName,\n} from \"../core/file-kind\";\nimport { cn } from \"./cn\";\nimport {\n ArchiveIcon,\n BracesIcon,\n CodeIcon,\n DatabaseIcon,\n FileAudioIcon,\n FileCodeIcon,\n FileIcon as FileGlyph,\n FileJsonIcon,\n FileSpreadsheetIcon,\n FileTextIcon,\n FileTypeIcon,\n FileVideoIcon,\n FolderIcon,\n FolderOpenIcon,\n ImageIcon,\n MusicIcon,\n PackageBoxIcon,\n PenToolIcon,\n SubtitlesIcon,\n VideoIcon,\n type MediaIconProps,\n} from \"./icons\";\n\nconst ICONS: Record<FileIconName, (props: MediaIconProps) => ReturnType<typeof FileGlyph>> = {\n image: ImageIcon,\n \"pen-tool\": PenToolIcon,\n video: VideoIcon,\n music: MusicIcon,\n \"file-type\": FileTypeIcon,\n \"file-text\": FileTextIcon,\n code: CodeIcon,\n braces: BracesIcon,\n subtitles: SubtitlesIcon,\n \"file-code\": FileCodeIcon,\n \"file-json\": FileJsonIcon,\n \"file-spreadsheet\": FileSpreadsheetIcon,\n database: DatabaseIcon,\n package: PackageBoxIcon,\n archive: ArchiveIcon,\n folder: FolderIcon,\n \"folder-open\": FolderOpenIcon,\n file: FileGlyph,\n \"file-audio\": FileAudioIcon,\n \"file-video\": FileVideoIcon,\n};\n\nexport interface FileIconProps {\n /** Either the filename (for files) or omitted for folders. */\n fileName?: string | undefined;\n /** Server MIME — when set, resolves audio/webm vs video/webm correctly. */\n mimeType?: string | null | undefined;\n /** If true, renders a folder icon. `open` picks the open-folder glyph. */\n isFolder?: boolean | undefined;\n open?: boolean | undefined;\n /** Override the mapped color (useful for selected states). */\n colorClass?: string | undefined;\n className?: string | undefined;\n size?: number | undefined;\n}\n\nexport function FileIcon({\n fileName,\n mimeType = null,\n isFolder,\n open,\n colorClass,\n className,\n size = 16,\n}: FileIconProps) {\n const details = isFolder\n ? getFolderKindDetails(open)\n : getFileKindDetails(fileName ?? \"\", mimeType);\n const Icon = ICONS[details.icon];\n const style: CSSProperties = {\n width: `${size}px`,\n height: `${size}px`,\n minWidth: `${size}px`,\n };\n return (\n <Icon\n style={style}\n className={cn(\"shrink-0\", colorClass ?? details.colorClass, className)}\n aria-hidden=\"true\"\n />\n );\n}\n","/**\n * src/react/inline-media-ref.tsx — the canonical inline media renderer.\n *\n * Verbatim behavior port of matrx-frontend\n * `features/files/components/inline/InlineMediaRef.tsx` (849 LOC, 116\n * importers) with only the coupling seams inverted:\n *\n * - URL resolution / public-CDN detection / auth-transport choice →\n * `MediaClient.resolve` (`transport: \"blob\"` is the private-pixels lane;\n * the Redux `useEnsureCloudFile`/`selectFileById` hydration lives behind\n * the client now)\n * - bearer-authenticated bytes → `MediaClient.getBlob` via `useMediaBlob`\n * - session-refresh retry → `MediaClient.recoverLoadError` via\n * `useMediaLoadRecovery`\n * - `next/image` → the injected `MediaHostPorts.ImageComponent` (plain\n * `<img>` default)\n * - audio output sink + exclusive-playback join → the injected\n * `MediaHostPorts.playbackSession` (inert default)\n * - lucide icons → the package's own inlined SVGs (C19)\n *\n * Pass a `MediaRef` (or a fileId / EXTERNAL public URL string), get back a\n * correctly-sized `<img>` / `<video>` / `<audio>`. There is NO `src` prop —\n * durable refs are the only identity this component accepts (law 2/3).\n */\n\n\"use client\";\n\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n} from \"react\";\nimport type {\n DurableSrc,\n MediaFailurePhase,\n MediaImageComponentProps,\n MediaRef,\n MediaRefLike,\n PlaybackSessionPort,\n} from \"../types\";\nimport { useMediaHostPorts } from \"../core/context\";\nimport {\n failureMediaIdentity,\n useMediaFailureCapture,\n} from \"../core/diagnostics\";\nimport { useMediaBlob } from \"../core/use-media-blob\";\nimport { useMediaBlobLoadRecovery } from \"../core/use-media-blob-load-recovery\";\nimport { useMediaLoadRecovery } from \"../core/use-media-load-recovery\";\nimport { useMediaResolution } from \"../core/use-media-resolution\";\nimport { cn } from \"./cn\";\nimport {\n CheckIcon,\n CopyIcon,\n FileAudioIcon,\n FileIcon as FileGlyph,\n FileVideoIcon,\n ImageIcon,\n ImageOffIcon,\n VideoOffIcon,\n VolumeXIcon,\n} from \"./icons\";\n\nexport type InlineMediaRefSize =\n | \"xs\" // 24×24\n | \"sm\" // 32×32\n | \"md\" // 64×64\n | \"lg\" // 128×128\n | \"xl\" // 256×256\n | \"fill\" // parent-controlled — media fills its container via w-full h-full\n | { width: number; height: number };\n\nexport type InlineMediaRefFit = \"cover\" | \"contain\" | \"fill\";\n\nexport interface InlineMediaRefProps {\n /**\n * Reference to the media: a {@link MediaRef}, a bare fileId string, an\n * EXTERNAL public URL string, or null/undefined (renders the fallback).\n *\n * Named `ref` as a CONTENT prop, exactly like the original (React 19\n * treats ref as a regular prop on function components) — the 116 existing\n * call sites pass `ref={mediaRef}` and must keep working at the C9 swap.\n * Use `mediaElementRef` for imperative access to the DOM node.\n */\n ref?: MediaRefLike | null | undefined;\n /** Square dimension preset or explicit width/height. Default `\"md\"` (64×64). */\n size?: InlineMediaRefSize | undefined;\n /** CSS object-fit. Default `\"cover\"`. */\n fit?: InlineMediaRefFit | undefined;\n /** Rendered when the ref can't be resolved to a URL at all. Default `\"icon\"`. */\n fallback?: \"icon\" | \"skeleton\" | null | undefined;\n /** Override the icon shown in `fallback=\"icon\"`. */\n fallbackIcon?: React.ReactNode | undefined;\n /**\n * Rendered when the URL *was* resolved but the media element failed to\n * load. Default `\"info\"` — an informative destructive-tinted panel with\n * URL + copy button + alt text; compacts to icon-only below ~64px.\n */\n errorFallback?: \"info\" | \"icon\" | \"skeleton\" | null | undefined;\n /** Alt text for `<img>`. Defaults to \"\" (decorative). */\n alt?: string | undefined;\n /** Force the media element type. Default: infer from `mime_type` / resolution. */\n as?: \"img\" | \"video\" | \"audio\" | undefined;\n controls?: boolean | undefined;\n autoPlay?: boolean | undefined;\n loop?: boolean | undefined;\n muted?: boolean | undefined;\n playsInline?: boolean | undefined;\n preload?: \"none\" | \"metadata\" | \"auto\" | undefined;\n /** Space-separated native controls to hide — forwarded to `<video controlsList>`. */\n controlsList?: string | undefined;\n /**\n * Poster frame forwarded to `<video poster>`. Takes the branded\n * {@link DurableSrc} only (law 3) — the host resolves/mints it, exactly\n * like the element `src`; there is no raw-string lane.\n */\n poster?: DurableSrc | undefined;\n /**\n * Label reported to the host's playback-session port while this element\n * plays (e.g. \"Video (fullscreen)\" in a lightbox). Default: `alt`, then\n * \"Media file\".\n */\n playbackLabel?: string | undefined;\n rounded?: \"none\" | \"sm\" | \"md\" | \"lg\" | \"full\" | undefined;\n /** Click handler — wires up cursor + role + keyboard activation. */\n onClick?: ((event: React.MouseEvent | React.KeyboardEvent) => void) | undefined;\n /**\n * Fires after the client's ONE recovery attempt is exhausted (or the\n * failure was unrecoverable). The internal error fallback still renders\n * unless `errorFallback={null}`.\n */\n onError?:\n | ((\n event: React.SyntheticEvent<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >,\n ) => void)\n | undefined;\n onLoad?:\n | ((\n event: React.SyntheticEvent<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >,\n ) => void)\n | undefined;\n /**\n * Forwarded to the underlying element for imperative DOM access. Not a\n * React `forwardRef` — pass any ref-like value here instead. When\n * supplied, the ImageComponent branch is skipped so the ref attaches to\n * the real DOM node.\n */\n mediaElementRef?:\n | React.Ref<HTMLImageElement | HTMLVideoElement | HTMLAudioElement>\n | undefined;\n /**\n * Canvas pixel reads: `crossOrigin` consumers route through the\n * bearer-authenticated blob lane unless the resolution is a CORS-safe\n * public CDN URL.\n */\n crossOrigin?: \"anonymous\" | \"use-credentials\" | undefined;\n border?: \"none\" | \"subtle\" | undefined;\n className?: string | undefined;\n}\n\nconst SIZE_PX: Record<\n Exclude<InlineMediaRefSize, \"fill\" | { width: number; height: number }>,\n number\n> = {\n xs: 24,\n sm: 32,\n md: 64,\n lg: 128,\n xl: 256,\n};\n\nconst ROUNDED_CLASS: Record<\n NonNullable<InlineMediaRefProps[\"rounded\"]>,\n string\n> = {\n none: \"\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n full: \"rounded-full\",\n};\n\nfunction resolveDimensions(\n size: InlineMediaRefSize,\n): { width: number; height: number } | \"fill\" {\n if (typeof size === \"object\") return size;\n if (size === \"fill\") return \"fill\";\n const px = SIZE_PX[size];\n return { width: px, height: px };\n}\n\nfunction inferElementType(\n ref: MediaRefLike | null | undefined,\n resolutionKind: \"image\" | \"video\" | \"audio\" | \"file\" | undefined,\n override?: InlineMediaRefProps[\"as\"],\n): \"img\" | \"video\" | \"audio\" {\n if (override) return override;\n if (ref && typeof ref === \"object\" && ref.mime_type) {\n if (ref.mime_type.startsWith(\"video/\")) return \"video\";\n if (ref.mime_type.startsWith(\"audio/\")) return \"audio\";\n }\n if (resolutionKind === \"video\") return \"video\";\n if (resolutionKind === \"audio\") return \"audio\";\n return \"img\";\n}\n\n/**\n * Best-effort URL prettifier for the informative error panel. Parsing for\n * DISPLAY only — never construction (law 5).\n */\nfunction prettifyUrl(url: string): { host: string | null; tail: string } {\n try {\n const u = new URL(url);\n const tail = `${u.pathname}${u.search}`;\n return { host: u.host, tail: tail === \"/\" ? \"\" : tail };\n } catch {\n return { host: null, tail: url };\n }\n}\n\nconst INERT_PLAYBACK: PlaybackSessionPort = {\n useMediaElementSink(forward) {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- stable inert implementation, called as a hook\n return useCallback(\n (node: unknown) => {\n if (!forward) return;\n if (typeof forward === \"function\") forward(node);\n else forward.current = node;\n },\n [forward],\n );\n },\n usePlaybackSession() {\n // inert\n },\n};\n\nfunction FallbackVisual({\n kind,\n dimensions,\n rounded,\n border,\n className,\n icon,\n}: {\n kind: \"icon\" | \"skeleton\";\n dimensions: { width: number; height: number } | \"fill\";\n rounded: NonNullable<InlineMediaRefProps[\"rounded\"]>;\n border: NonNullable<InlineMediaRefProps[\"border\"]>;\n className?: string | undefined;\n icon: React.ReactNode;\n}) {\n const isFill = dimensions === \"fill\";\n const wrapperCls = cn(\n \"flex items-center justify-center bg-muted/60 text-muted-foreground\",\n ROUNDED_CLASS[rounded],\n border === \"subtle\" && \"border border-border\",\n kind === \"skeleton\" && \"animate-pulse\",\n isFill && \"w-full h-full\",\n className,\n );\n return (\n <div\n className={wrapperCls}\n style={\n isFill\n ? undefined\n : { width: dimensions.width, height: dimensions.height }\n }\n aria-hidden={kind === \"skeleton\"}\n >\n {kind === \"icon\" ? icon : null}\n </div>\n );\n}\n\nfunction InformativeErrorFallback({\n url,\n alt,\n elementType,\n mediaRef,\n failurePhase,\n dimensions,\n rounded,\n className,\n}: {\n url: string;\n alt: string;\n elementType: \"img\" | \"video\" | \"audio\";\n mediaRef: MediaRefLike | null | undefined;\n /** Which pipeline phase put this panel on screen (diagnostics backstop). */\n failurePhase: MediaFailurePhase;\n dimensions: { width: number; height: number } | \"fill\";\n rounded: NonNullable<InlineMediaRefProps[\"rounded\"]>;\n className?: string | undefined;\n}) {\n // THE BACKSTOP (2026-08-30 outage rule): if this panel is on screen, a\n // terminal media failure happened — and it MUST have been captured. The\n // upstream hooks normally already did (the per-identity latch dedupes this\n // to zero extra rows); if any path ever misses, this mount screams.\n const capture = useMediaFailureCapture();\n const identity = failureMediaIdentity(mediaRef ?? null, url);\n useEffect(() => {\n capture({\n phase: failurePhase,\n mediaRef: identity,\n terminal: true,\n message: `media unavailable panel rendered for ${elementType} (${failurePhase} failure)`,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [identity, failurePhase]);\n const shortAxis =\n dimensions === \"fill\"\n ? Number.POSITIVE_INFINITY\n : Math.min(dimensions.width, dimensions.height);\n const isCompact = dimensions !== \"fill\" && shortAxis < 64;\n const isMidsize = shortAxis < 140;\n\n const fileId =\n mediaRef && typeof mediaRef === \"object\" && \"file_id\" in mediaRef\n ? (mediaRef.file_id ?? null)\n : null;\n\n const FailIcon =\n elementType === \"video\"\n ? VideoOffIcon\n : elementType === \"audio\"\n ? VolumeXIcon\n : ImageOffIcon;\n\n const tooltip = [\n `Failed to load ${elementType}`,\n alt && `alt: ${alt}`,\n `url: ${url}`,\n fileId && `file_id: ${fileId}`,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n if (isCompact) {\n return (\n <div\n className={cn(\n \"flex items-center justify-center bg-destructive/5 text-destructive border border-destructive/40 border-dashed\",\n ROUNDED_CLASS[rounded],\n className,\n )}\n style={{ width: dimensions.width, height: dimensions.height }}\n role=\"img\"\n aria-label={`Failed to load ${elementType}${alt ? `: ${alt}` : \"\"}`}\n title={tooltip}\n >\n <FailIcon className=\"h-1/2 w-1/2 max-h-5 max-w-5\" />\n </div>\n );\n }\n\n return (\n <InformativeErrorPanel\n url={url}\n alt={alt}\n elementType={elementType}\n fileId={fileId}\n dimensions={dimensions}\n rounded={rounded}\n className={className}\n compact={isMidsize}\n icon={<FailIcon className=\"h-3.5 w-3.5 shrink-0\" />}\n tooltip={tooltip}\n />\n );\n}\n\nfunction InformativeErrorPanel({\n url,\n alt,\n elementType,\n fileId,\n dimensions,\n rounded,\n className,\n compact,\n icon,\n tooltip,\n}: {\n url: string;\n alt: string;\n elementType: \"img\" | \"video\" | \"audio\";\n fileId: string | null;\n dimensions: { width: number; height: number } | \"fill\";\n rounded: NonNullable<InlineMediaRefProps[\"rounded\"]>;\n className?: string | undefined;\n compact: boolean;\n icon: React.ReactNode;\n tooltip: string;\n}) {\n const [copied, setCopied] = useState(false);\n const isFill = dimensions === \"fill\";\n const { host, tail } = prettifyUrl(url);\n\n const handleCopy = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n event.preventDefault();\n // A refused copy (non-HTTPS / permission denied) leaves the button\n // un-flipped; the tooltip + selectable text still give the URL.\n void copyText(url).then((landed) => {\n if (!landed) return;\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n });\n },\n [url],\n );\n\n return (\n <div\n className={cn(\n \"flex flex-col bg-destructive/5 text-foreground border border-destructive/40 border-dashed overflow-hidden\",\n ROUNDED_CLASS[rounded],\n compact ? \"p-1.5 gap-0.5\" : \"p-2 gap-1\",\n isFill ? \"w-full h-full\" : \"\",\n className,\n )}\n style={\n isFill\n ? undefined\n : { width: dimensions.width, height: dimensions.height }\n }\n role=\"img\"\n aria-label={`Failed to load ${elementType}${alt ? `: ${alt}` : \"\"}`}\n title={tooltip}\n >\n <div\n className={cn(\n \"flex items-center gap-1.5 text-destructive font-medium leading-tight\",\n compact ? \"text-[10px]\" : \"text-xs\",\n )}\n >\n {icon}\n <span className=\"truncate\">\n {elementType === \"img\"\n ? \"Image failed to load\"\n : elementType === \"video\"\n ? \"Video failed to load\"\n : \"Audio failed to load\"}\n </span>\n </div>\n\n {alt && !compact && (\n <div\n className=\"text-[11px] text-muted-foreground italic line-clamp-1\"\n title={alt}\n >\n {alt}\n </div>\n )}\n\n <div\n className={cn(\n \"flex items-end gap-1 mt-auto min-w-0\",\n compact ? \"text-[9px]\" : \"text-[10px]\",\n )}\n >\n <div className=\"font-mono text-muted-foreground truncate flex-1 min-w-0\">\n {host ? (\n <>\n <span className=\"text-foreground/80\">{host}</span>\n {tail && <span className=\"opacity-70\">{tail}</span>}\n </>\n ) : (\n <span>{tail}</span>\n )}\n </div>\n <button\n type=\"button\"\n onClick={handleCopy}\n className={cn(\n \"shrink-0 p-0.5 rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors focus:outline-none focus:ring-1 focus:ring-destructive/40\",\n copied && \"text-emerald-600 dark:text-emerald-500\",\n )}\n aria-label={copied ? \"URL copied\" : \"Copy URL\"}\n title={copied ? \"URL copied\" : \"Copy URL\"}\n >\n {copied ? (\n <CheckIcon className=\"h-3 w-3\" width={12} height={12} />\n ) : (\n <CopyIcon className=\"h-3 w-3\" width={12} height={12} />\n )}\n </button>\n </div>\n\n {fileId && !compact && (\n <div className=\"text-[9px] font-mono text-muted-foreground/70 truncate\">\n {fileId}\n </div>\n )}\n </div>\n );\n}\n\nexport function InlineMediaRef({\n ref: mediaRef,\n size = \"md\",\n fit = \"cover\",\n fallback = \"icon\",\n fallbackIcon,\n errorFallback = \"info\",\n alt = \"\",\n as,\n controls = true,\n autoPlay,\n loop,\n muted,\n playsInline,\n preload,\n controlsList,\n poster,\n playbackLabel,\n rounded = \"md\",\n onClick,\n onError,\n onLoad,\n mediaElementRef,\n crossOrigin,\n border = \"none\",\n className,\n}: InlineMediaRefProps) {\n const ports = useMediaHostPorts();\n const { resolution, status, reason } = useMediaResolution(mediaRef);\n const elementType = inferElementType(mediaRef, resolution?.kind, as);\n\n // Private pixels ride the bearer-authenticated blob lane; a verified\n // public CDN URL is the sole direct-url exception for crossOrigin\n // consumers. This is automatic: callers never select auth transport.\n const needsBlob = Boolean(\n resolution &&\n (resolution.transport === \"blob\" ||\n (crossOrigin && resolution.isCdn !== true)),\n );\n const blob = useMediaBlob(needsBlob ? mediaRef : null);\n const resolvedUrl = needsBlob ? blob.url : (resolution?.src ?? null);\n\n const terminalCallback = (event?: unknown) =>\n onError?.(\n event as React.SyntheticEvent<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >,\n );\n\n const recovery = useMediaLoadRecovery(resolvedUrl, {\n recoverable: resolution?.recoverable !== false,\n failureRef: mediaRef,\n onTerminal: terminalCallback,\n });\n // The heal ladder's object URL (bearer lane) replaces a dead element src —\n // the user sees the media; the incident row is still written.\n const url = recovery.healedSrc ?? resolvedUrl;\n const blobRecovery = useMediaBlobLoadRecovery(\n needsBlob ? mediaRef : null,\n needsBlob ? url : null,\n {\n onRetry: blob.retry,\n onTerminal: terminalCallback,\n },\n );\n\n // Host audio system: output-sink routing + exclusive-playback join.\n const playback = ports.playbackSession ?? INERT_PLAYBACK;\n const sessionElRef = useRef<unknown>(null);\n const [isMediaPlaying, setIsMediaPlaying] = useState(false);\n const portSinkRef = playback.useMediaElementSink(\n mediaElementRef as ((node: unknown) => void) | { current: unknown } | null | undefined,\n );\n const sinkRef = (node: HTMLVideoElement | HTMLAudioElement | null) => {\n sessionElRef.current = node;\n portSinkRef(node);\n };\n const trackKey = useMemo(() => {\n if (mediaRef && typeof mediaRef === \"object\" && mediaRef.file_id) {\n return mediaRef.file_id;\n }\n return typeof mediaRef === \"string\" ? mediaRef : undefined;\n }, [mediaRef]);\n playback.usePlaybackSession(\n {\n isPlaying: isMediaPlaying,\n source: \"file-media\",\n label: playbackLabel ?? (alt || \"Media file\"),\n trackKey,\n },\n sessionElRef,\n );\n const mediaSessionEvents = {\n onPlay: () => setIsMediaPlaying(true),\n onPause: () => setIsMediaPlaying(false),\n onEnded: () => setIsMediaPlaying(false),\n };\n\n const mediaResolutionError =\n status === \"unavailable\" ? (reason ?? \"unknown\") : (blob.error ?? null);\n const dimensions = resolveDimensions(size);\n const isFill = dimensions === \"fill\";\n const activeRecovery = needsBlob ? blobRecovery : recovery;\n const retryKey = needsBlob ? 0 : recovery.retryKey;\n const hasLoadError = activeRecovery.failed;\n const handleLoadError = activeRecovery.onLoadError as React.ReactEventHandler<\n HTMLImageElement | HTMLVideoElement | HTMLAudioElement\n >;\n\n const defaultIcon =\n elementType === \"video\" ? (\n <FileVideoIcon className=\"h-1/2 w-1/2\" />\n ) : elementType === \"audio\" ? (\n <FileAudioIcon className=\"h-1/2 w-1/2\" />\n ) : mediaRef ? (\n <ImageIcon className=\"h-1/2 w-1/2\" />\n ) : (\n <FileGlyph className=\"h-1/2 w-1/2\" />\n );\n\n const unresolvedDisplayUrl =\n mediaRef && typeof mediaRef === \"object\" && mediaRef.file_id\n ? `file:${mediaRef.file_id}`\n : \"unresolved-media\";\n\n if (!url) {\n if (mediaResolutionError) {\n if (errorFallback === null) return null;\n if (errorFallback === \"info\") {\n return (\n <InformativeErrorFallback\n url={unresolvedDisplayUrl}\n alt={alt}\n elementType={elementType}\n mediaRef={mediaRef}\n failurePhase={status === \"unavailable\" ? \"resolve\" : \"blob\"}\n dimensions={dimensions}\n rounded={rounded}\n className={className}\n />\n );\n }\n return (\n <FallbackVisual\n kind={errorFallback}\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={fallbackIcon ?? defaultIcon}\n />\n );\n }\n if (needsBlob && blob.loading) {\n return (\n <FallbackVisual\n kind=\"skeleton\"\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={null}\n />\n );\n }\n if (!fallback) return null;\n return (\n <FallbackVisual\n kind={fallback}\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={fallbackIcon ?? defaultIcon}\n />\n );\n }\n\n // URL resolved but the remote fetch failed — render the informative (or\n // caller-overridden) error fallback. Keeps the original dimensions so\n // layouts don't jump.\n if (hasLoadError) {\n if (errorFallback === null) return null;\n if (errorFallback === \"info\") {\n return (\n <InformativeErrorFallback\n url={url}\n alt={alt}\n elementType={elementType}\n mediaRef={mediaRef}\n failurePhase=\"element-load\"\n dimensions={dimensions}\n rounded={rounded}\n className={className}\n />\n );\n }\n return (\n <FallbackVisual\n kind={errorFallback}\n dimensions={dimensions}\n rounded={rounded}\n border={border}\n className={className}\n icon={fallbackIcon ?? defaultIcon}\n />\n );\n }\n\n const interactiveProps = onClick\n ? {\n onClick,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n onClick(event);\n }\n },\n role: \"button\" as const,\n tabIndex: 0,\n className: cn(\n \"cursor-pointer\",\n \"focus:outline-none focus:ring-2 focus:ring-primary/50\",\n ),\n }\n : {};\n\n const baseCls = cn(\n \"block\",\n isFill && \"w-full h-full\",\n ROUNDED_CLASS[rounded],\n border === \"subtle\" && \"border border-border\",\n onClick && \"cursor-pointer\",\n interactiveProps.className,\n className,\n );\n\n const objectFitClass =\n fit === \"cover\"\n ? \"object-cover\"\n : fit === \"contain\"\n ? \"object-contain\"\n : \"object-fill\";\n\n const sizeAttrs = isFill\n ? {}\n : { width: dimensions.width, height: dimensions.height };\n\n if (elementType === \"video\") {\n return (\n <video\n key={retryKey}\n ref={sinkRef}\n src={url}\n {...sizeAttrs}\n className={cn(baseCls, objectFitClass)}\n controls={controls}\n autoPlay={autoPlay}\n loop={loop}\n muted={muted}\n playsInline={playsInline}\n preload={preload}\n controlsList={controlsList}\n poster={poster}\n onLoadedData={\n onLoad as React.ReactEventHandler<HTMLVideoElement> | undefined\n }\n onError={handleLoadError as React.ReactEventHandler<HTMLVideoElement>}\n crossOrigin={crossOrigin}\n {...mediaSessionEvents}\n {...interactiveProps}\n />\n );\n }\n if (elementType === \"audio\") {\n return (\n <audio\n key={retryKey}\n ref={sinkRef}\n src={url}\n className={cn(baseCls)}\n controls={controls}\n autoPlay={autoPlay}\n loop={loop}\n muted={muted}\n preload={preload}\n {...mediaSessionEvents}\n onLoadedData={\n onLoad as React.ReactEventHandler<HTMLAudioElement> | undefined\n }\n onError={handleLoadError as React.ReactEventHandler<HTMLAudioElement>}\n crossOrigin={crossOrigin}\n {...interactiveProps}\n />\n );\n }\n\n // Bail to plain <img> when the caller needs an event-target escape hatch\n // (onLoad / element ref / crossOrigin) — the native events must reach the\n // caller with the original SyntheticEvent shape.\n const needsPlainImg = !!onLoad || !!mediaElementRef || !!crossOrigin;\n\n // Use the host's ImageComponent (e.g. a next/image adapter) for our own\n // CDN-hosted URLs — better lazy-loading + DPR handling; arbitrary external\n // URLs may not be on the host's remotePatterns list, so they fall back to\n // a plain <img>.\n const isCdnUrl =\n resolution?.isCdn ??\n (url.startsWith(\"https://cdn.\") || url.includes(\"/cdn/\"));\n const HostImage = ports.ImageComponent as\n | ComponentType<MediaImageComponentProps>\n | undefined;\n if (HostImage && isCdnUrl && !isFill && !needsPlainImg && !needsBlob) {\n return (\n <HostImage\n key={retryKey}\n src={url}\n alt={alt}\n width={dimensions.width}\n height={dimensions.height}\n className={cn(baseCls, objectFitClass)}\n onError={handleLoadError as (event: unknown) => void}\n {...(interactiveProps as Partial<MediaImageComponentProps>)}\n />\n );\n }\n return (\n <img\n key={retryKey}\n ref={mediaElementRef as React.Ref<HTMLImageElement> | undefined}\n src={url}\n alt={alt}\n {...sizeAttrs}\n className={cn(baseCls, objectFitClass)}\n onLoad={onLoad as React.ReactEventHandler<HTMLImageElement> | undefined}\n onError={handleLoadError}\n crossOrigin={crossOrigin}\n {...interactiveProps}\n />\n );\n}\n\nexport default InlineMediaRef;\n","/**\n * src/core/context.ts — the MediaClient / host-ports React contexts.\n *\n * The context OBJECTS live on `globalThis` under `Symbol.for` slots — NOT at\n * module level. With `splitting: false` this module is duplicated into the\n * `/core` and `/react` bundles, and CJS/ESM each instantiate their own module\n * graph; a module-level `createContext` would silently produce two different\n * contexts (a Provider from one graph invisible to a consumer from the\n * other) — the kit tap-target/link-registry lesson. Never \"clean this up\".\n */\n\nimport {\n createContext,\n createElement,\n useContext,\n type Context,\n type ReactNode,\n} from \"react\";\nimport type { MediaClient, MediaHostPorts } from \"../types\";\n\nconst CLIENT_SLOT = Symbol.for(\"ai-matrx.media.client-context\");\nconst PORTS_SLOT = Symbol.for(\"ai-matrx.media.host-ports-context\");\n\ntype SlotHost = typeof globalThis & {\n [CLIENT_SLOT]?: Context<MediaClient | null>;\n [PORTS_SLOT]?: Context<MediaHostPorts>;\n};\n\nfunction clientContext(): Context<MediaClient | null> {\n const host = globalThis as SlotHost;\n host[CLIENT_SLOT] ??= createContext<MediaClient | null>(null);\n return host[CLIENT_SLOT];\n}\n\nconst INERT_PORTS: MediaHostPorts = {};\n\nfunction portsContext(): Context<MediaHostPorts> {\n const host = globalThis as SlotHost;\n host[PORTS_SLOT] ??= createContext<MediaHostPorts>(INERT_PORTS);\n return host[PORTS_SLOT];\n}\n\nexport interface MediaProviderProps {\n client: MediaClient;\n /**\n * Optional host ports (playback session, actions, ImageComponent). Must be\n * referentially stable — the playback port members are hooks.\n */\n ports?: MediaHostPorts | undefined;\n children?: ReactNode;\n}\n\n/** Wire the injected MediaClient (and optional host ports) into the tree. */\nexport function MediaProvider({ client, ports, children }: MediaProviderProps) {\n const ClientCtx = clientContext();\n const PortsCtx = portsContext();\n return createElement(\n ClientCtx.Provider,\n { value: client },\n createElement(PortsCtx.Provider, { value: ports ?? INERT_PORTS }, children),\n );\n}\n\n/** The injected MediaClient. Throws when no MediaProvider is mounted. */\nexport function useMediaClient(): MediaClient {\n const client = useContext(clientContext());\n if (!client) {\n throw new Error(\n \"@ai-matrx/media: no MediaClient. Mount <MediaProvider client={...}> \" +\n \"above every media surface (canonically wired to @ai-matrx/data/files).\",\n );\n }\n return client;\n}\n\n/** The injected host ports; inert defaults when none were provided. */\nexport function useMediaHostPorts(): MediaHostPorts {\n return useContext(portsContext());\n}\n","/**\n * src/core/diagnostics.ts — the terminal-failure capture machinery.\n *\n * Born from the 2026-08-30 prod outage: server-side cookie-secret drift\n * killed every private image, the package rendered its honest \"unavailable\"\n * panel — and nothing reached the host's Error Inspector or error DB,\n * because the package had no diagnostics port and the host cannot capture\n * what it never learns about. Per ruling C22 the capture logic lives HERE,\n * so every consuming repo inherits it.\n *\n * The contract:\n *\n * - every terminal failure path emits exactly ONE {@link MediaFailureInfo}\n * per media identity (latched — re-renders, remounts and the unavailable\n * panel backstop never spam);\n * - a bound `MediaHostPorts.diagnostics.capture` receives the payload;\n * WITHOUT one (or if it throws) the package `console.error`s the same\n * structured payload — the loud default. A media failure is NEVER silent;\n * - the payload never carries a signed URL: identity is the file id or a\n * query-stripped URL key ({@link failureMediaIdentity}).\n *\n * The latch lives on `globalThis` under a `Symbol.for` slot (same reason as\n * context.ts: with `splitting: false` + dual formats, module-level state\n * silently duplicates across bundle/loader graphs).\n */\n\nimport { useCallback, useRef } from \"react\";\nimport type { MediaFailureInfo, MediaRefLike } from \"../types\";\nimport { useMediaHostPorts } from \"./context\";\n\nconst LATCH_SLOT = Symbol.for(\"ai-matrx.media.failure-latch\");\n\ntype SlotHost = typeof globalThis & {\n [LATCH_SLOT]?: Set<string>;\n};\n\nfunction latch(): Set<string> {\n const host = globalThis as SlotHost;\n host[LATCH_SLOT] ??= new Set<string>();\n return host[LATCH_SLOT];\n}\n\n/**\n * Clear the once-per-failure latch. For tests, and for hosts at auth\n * boundaries (a sign-in can genuinely fix a previously-terminal failure, and\n * a recurrence after it deserves a fresh capture).\n */\nexport function resetMediaFailureLatch(): void {\n latch().clear();\n}\n\n/**\n * Durable diagnostics identity for a media reference. NEVER a signed URL:\n * file ids win, and any URL is stripped to origin + path (signatures ride\n * query strings).\n */\nexport function failureMediaIdentity(\n ref: MediaRefLike | null | undefined,\n src?: string | null,\n): string {\n if (ref && typeof ref === \"object\" && ref.file_id) return `file:${ref.file_id}`;\n let raw: string | null | undefined;\n if (typeof ref === \"string\") raw = ref;\n else if (ref && typeof ref === \"object\" && ref.url) raw = ref.url;\n else raw = src;\n if (!raw) return \"<unknown-media>\";\n if (raw.startsWith(\"blob:\")) return \"blob:object-url\";\n try {\n const u = new URL(raw);\n return `url:${u.origin}${u.pathname}`;\n } catch {\n // A bare fileId string, or an unparseable fragment — still strip any query.\n const clean = raw.split(/[?#]/, 1)[0] ?? raw;\n return `ref:${clean}`;\n }\n}\n\n/**\n * Emit one media-failure capture through the host sink, or the loud\n * console.error default when no sink is bound (or the sink throws).\n * Latched per (terminal|warning, mediaRef) — one capture per failure,\n * however many renders, hooks, or backstops observe it.\n */\nexport function emitMediaFailure(\n capture: ((info: MediaFailureInfo) => void) | undefined,\n info: MediaFailureInfo,\n): void {\n const key = `${info.terminal ? \"terminal\" : \"warning\"}|${info.mediaRef}`;\n const seen = latch();\n if (seen.has(key)) return;\n seen.add(key);\n if (capture) {\n try {\n capture(info);\n return;\n } catch {\n // A broken sink must not re-silence the failure — fall through.\n }\n }\n console.error(\n \"[@ai-matrx/media] media failure (no diagnostics sink captured it — \" +\n \"bind MediaHostPorts.diagnostics.capture to your error system)\",\n info,\n );\n}\n\n/**\n * Hook form: a stable capture function wired to the host ports. Every core\n * hook and the unavailable-panel backstop route through this — the phase\n * vocabulary and the latch stay in ONE place.\n */\nexport function useMediaFailureCapture(): (\n info: Omit<MediaFailureInfo, \"source\">,\n) => void {\n const ports = useMediaHostPorts();\n const capture = ports.diagnostics?.capture;\n // The latest sink without invalidating effect deps in the calling hooks —\n // the port object is referentially stable by contract, but a fresh binding\n // (e.g. tests swapping providers) must not capture stale.\n const captureRef = useRef(capture);\n captureRef.current = capture;\n return useCallback((info: Omit<MediaFailureInfo, \"source\">) => {\n emitMediaFailure(captureRef.current, { source: \"media\", ...info });\n }, []);\n}\n","/**\n * src/core/use-media-blob.ts — bytes for canvas/crossOrigin/private-pixel\n * consumers, as state.\n *\n * The behavior contract is ported from matrx-frontend `hooks/useFileBlob.ts`;\n * the byte machinery (auth, caching, in-flight dedup, IDB tiers, progress) is\n * the CLIENT's (C10 persistence-injected — the package owns no cache). The\n * hook owns only the React lifecycle: load on mount/ref change, release the\n * handle on unmount, expose a retry.\n */\n\nimport { useEffect, useState } from \"react\";\nimport type { MediaRefLike } from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\nimport { stableRefKey } from \"./ref-key\";\n\n/** Structural HTTP status probe for client errors (never a validation). */\nfunction statusOf(err: unknown): number | undefined {\n if (err && typeof err === \"object\") {\n const candidate =\n (err as { status?: unknown }).status ??\n (err as { statusCode?: unknown }).statusCode;\n if (typeof candidate === \"number\") return candidate;\n }\n return undefined;\n}\n\nexport interface MediaBlobState {\n /** `blob:` object URL safe to feed into any browser API. `null` until ready. */\n url: string | null;\n blob: Blob | null;\n loading: boolean;\n error: string | null;\n /** Force a fresh byte read (the client decides whether to drop its cache). */\n retry: () => void;\n}\n\nexport function useMediaBlob(\n ref: MediaRefLike | null | undefined,\n): MediaBlobState {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const refKey = stableRefKey(ref);\n const [state, setState] = useState<{\n url: string | null;\n blob: Blob | null;\n loading: boolean;\n error: string | null;\n }>({ url: null, blob: null, loading: !!ref, error: null });\n const [retryToken, setRetryToken] = useState(0);\n\n useEffect(() => {\n if (!ref) {\n setState({ url: null, blob: null, loading: false, error: null });\n return undefined;\n }\n let cancelled = false;\n let release: (() => void) | null = null;\n setState({ url: null, blob: null, loading: true, error: null });\n client.getBlob(ref).then(\n (handle) => {\n if (cancelled) {\n handle.release();\n return;\n }\n release = handle.release;\n setState({ url: handle.url, blob: handle.blob, loading: false, error: null });\n },\n (err: unknown) => {\n if (cancelled) return;\n const message =\n err instanceof Error ? err.message : String(err ?? \"Failed to load file\");\n setState({ url: null, blob: null, loading: false, error: message });\n // Terminal-failure capture (phase \"blob\"): the private-pixels bytes\n // never arrived. Latched per media identity by the machinery.\n const status = statusOf(err);\n capture({\n phase: \"blob\",\n mediaRef: failureMediaIdentity(ref),\n terminal: true,\n message: `getBlob() failed: ${message}`,\n ...(status !== undefined ? { status } : {}),\n });\n },\n );\n return () => {\n cancelled = true;\n release?.();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client, refKey, retryToken]);\n\n return {\n ...state,\n retry: () => setRetryToken((t) => t + 1),\n };\n}\n","/**\n * src/core/ref-key.ts — stable identity key for a MediaRefLike.\n *\n * Callers routinely pass fresh object literals every render; hooks key their\n * effects/memos on this string instead of object identity. Ported from the\n * original `stableSourceKey` (matrx-frontend `handler/hooks/useFileAs.ts`).\n */\n\nimport type { MediaRefLike } from \"../types\";\n\nexport function stableRefKey(ref: MediaRefLike | null | undefined): string {\n if (!ref) return \"<none>\";\n if (typeof ref === \"string\") return `s:${ref}`;\n if (ref.file_id) return `id:${ref.file_id}:${ref.mime_type ?? \"\"}`;\n if (ref.url) return `url:${ref.url}:${ref.mime_type ?? \"\"}`;\n return \"<empty-ref>\";\n}\n","/**\n * Element-load recovery for a blob/object URL.\n *\n * Object URLs are disposable transports, never identity. A concurrent\n * version/realtime invalidation can revoke one after getBlob() resolves but\n * before the media element consumes it. The client owns the retry policy and\n * cache eviction; this hook only obeys its verdict and asks useMediaBlob to\n * re-read the durable ref.\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { MediaRefLike } from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\nimport { stableRefKey } from \"./ref-key\";\n\nexport interface MediaBlobLoadRecovery {\n onLoadError: (event?: unknown) => void;\n failed: boolean;\n}\n\nexport function useMediaBlobLoadRecovery(\n ref: MediaRefLike | null | undefined,\n source: string | null,\n options: {\n onRetry: () => void;\n onTerminal?: ((event?: unknown) => void) | undefined;\n },\n): MediaBlobLoadRecovery {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const refKey = stableRefKey(ref);\n const [failed, setFailed] = useState(false);\n const attemptRef = useRef(0);\n const generationRef = useRef(0);\n const recoveryInFlightRef = useRef(false);\n const onRetry = options.onRetry;\n const onTerminal = options.onTerminal;\n\n useEffect(() => {\n generationRef.current += 1;\n attemptRef.current = 0;\n recoveryInFlightRef.current = false;\n setFailed(false);\n return () => { generationRef.current += 1; };\n }, [refKey]);\n\n // A policy-approved re-read first clears the source, then supplies the new\n // object URL. Only that source transition releases duplicate-error gating;\n // the durable ref keeps its single retry allowance throughout.\n useEffect(() => {\n recoveryInFlightRef.current = false;\n }, [source]);\n\n const finishTerminal = useCallback(\n (event: unknown, attempt: number, message: string) => {\n setFailed(true);\n capture({\n phase: \"element-load\",\n mediaRef: failureMediaIdentity(ref ?? null, source),\n terminal: true,\n retryOutcome: attempt > 1 ? \"retried\" : \"not-attempted\",\n message,\n });\n onTerminal?.(event);\n },\n [capture, onTerminal, ref, source],\n );\n\n const onLoadError = useCallback(\n (event?: unknown) => {\n if (recoveryInFlightRef.current || !source) return;\n recoveryInFlightRef.current = true;\n attemptRef.current += 1;\n const attempt = attemptRef.current;\n const generation = generationRef.current;\n const recover = client.recoverBlobLoadError;\n if (!ref || !recover) {\n finishTerminal(\n event,\n attempt,\n \"blob-backed media element failed to load and the client exposes no object-URL recovery policy\",\n );\n return;\n }\n recover(ref, attempt).then(\n (verdict) => {\n if (generation !== generationRef.current) return;\n if (verdict === \"retry\") {\n setFailed(false);\n onRetry();\n return;\n }\n finishTerminal(\n event,\n attempt,\n attempt > 1\n ? \"blob-backed media element failed after the client-approved re-read\"\n : \"blob-backed media recovery was declined on the first attempt\",\n );\n },\n (err: unknown) => {\n if (generation !== generationRef.current) return;\n finishTerminal(\n event,\n attempt,\n `blob-backed media recovery failed: ${\n err instanceof Error ? err.message : String(err ?? \"unknown error\")\n }`,\n );\n },\n );\n },\n [client, finishTerminal, onRetry, ref, source],\n );\n\n return { onLoadError, failed };\n}\n","/**\n * src/core/use-media-load-recovery.ts — the durable-URL load-error machine.\n *\n * Ported from matrx-frontend `handler/hooks/useDurableSrc.ts`, with the\n * recovery POLICY inverted onto `MediaClient.recoverLoadError` (session\n * refresh → same-URL retry → terminal; the package may not implement a retry\n * of its own — that invariant is what killed the divergent\n * useUnifiedImageUrl/useUnifiedVideoUrl copies).\n *\n * `recoverable: false` resolutions (foreign URLs, blob: object URLs) skip the\n * client and fail straight through — a session refresh can't resurrect\n * someone else's link rot.\n *\n * Every terminal outcome emits exactly one `MediaFailureInfo` through the\n * diagnostics machinery (the 2026-08-30 outage rule):\n *\n * - element error, recovery impossible → phase \"element-load\",\n * retryOutcome \"not-attempted\"\n * - terminal verdict after a granted retry → phase \"element-load\",\n * retryOutcome \"retried\"\n * - terminal verdict on the FIRST attempt → phase \"recovery\",\n * retryOutcome \"not-attempted\"\n * (the recovery machinery itself declined — usually the session mint\n * came back unusable)\n * - `recoverLoadError` rejected → phase \"session\",\n * retryOutcome \"recovery-failed\"\n *\n * A structured `MediaRecoveryReport` verdict may additionally carry the\n * `/files/session` mint's `secret_source`; `\"ephemeral\"` emits a NON-terminal\n * warning (\"private renders will break across restarts/instances\") the moment\n * the client sees it — before the outage, not after. The bare string verdict\n * stays fully supported; the field is tolerated absent.\n */\n\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n mintDurableSrc,\n type DurableSrc,\n type MediaHealAttempt,\n type MediaHealResult,\n type MediaRecoveryReport,\n type MediaRecoveryVerdict,\n type MediaRefLike,\n} from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\n\nexport interface MediaLoadRecovery {\n /**\n * Bump this into the media element's `key` (or otherwise force a remount)\n * so a retry actually re-fires the network request for the same src.\n */\n retryKey: number;\n /** Wire to the media element's `onError`. */\n onLoadError: (event?: unknown) => void;\n /** True once recovery AND the heal ladder are exhausted (or never possible). */\n failed: boolean;\n /**\n * A renderable source produced by the heal ladder after the primary lane\n * died (a `blob:` object URL from the bearer lane). Bind it INSTEAD of the\n * original src when set — the user sees the media; the row is still logged.\n */\n healedSrc: string | null;\n}\n\nfunction normalizeOutcome(\n outcome: MediaRecoveryVerdict | MediaRecoveryReport,\n): MediaRecoveryReport {\n return typeof outcome === \"string\" ? { verdict: outcome } : outcome;\n}\n\n/** The app-wide latch identity for the ephemeral-secret warning. */\nconst EPHEMERAL_SECRET_IDENTITY = \"server:files-session-secret\";\n\nexport function useMediaLoadRecovery(\n src: DurableSrc | string | null,\n options?: {\n recoverable?: boolean | undefined;\n /** Fires once recovery is exhausted, with the original element event. */\n onTerminal?: ((event?: unknown) => void) | undefined;\n /**\n * Durable identity of the media being recovered, for diagnostics —\n * failures are reported against the file id / ref key, never the URL.\n * Falls back to the query-stripped src when absent.\n */\n failureRef?: MediaRefLike | null | undefined;\n },\n): MediaLoadRecovery {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const recoverable = options?.recoverable !== false;\n const onTerminal = options?.onTerminal;\n const failureRef = options?.failureRef;\n const [result, setResult] = useState<{\n source: string | null;\n retryKey: number;\n failed: boolean;\n healedSrc: string | null;\n }>({ source: src, retryKey: 0, failed: false, healedSrc: null });\n const attemptRef = useRef(0);\n const recoveryInFlightRef = useRef(false);\n\n // A different URL deserves a fresh recovery allowance. The visible state is\n // keyed by source below, so this effect only resets the attempt counter.\n useEffect(() => {\n attemptRef.current = 0;\n recoveryInFlightRef.current = false;\n }, [src]);\n\n // A granted retry is not complete until React has committed the remounted\n // element. Browsers can dispatch duplicate error events from the failing\n // element while the async session refresh is still settling; treating that\n // duplicate as attempt two falsely exhausts recovery before the retried\n // request exists.\n useLayoutEffect(() => {\n recoveryInFlightRef.current = false;\n }, [result.retryKey]);\n\n const identity = () => failureMediaIdentity(failureRef ?? null, src);\n\n const onLoadError = (event?: unknown) => {\n if (recoveryInFlightRef.current) return;\n if (!src || !recoverable) {\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n if (src) {\n capture({\n phase: \"element-load\",\n mediaRef: identity(),\n terminal: true,\n retryOutcome: \"not-attempted\",\n message:\n \"media element failed to load and the source is unrecoverable \" +\n \"(foreign/object URL — a session refresh cannot fix it)\",\n });\n }\n onTerminal?.(event);\n return;\n }\n recoveryInFlightRef.current = true;\n attemptRef.current += 1;\n const attempt = attemptRef.current;\n // Re-branding is sound here: only resolution srcs reach the recoverable\n // lane (blob:/foreign URLs come in with `recoverable: false`).\n client.recoverLoadError(mintDurableSrc(src), attempt).then(\n (outcome) => {\n const report = normalizeOutcome(outcome);\n if (report.secretSource === \"ephemeral\") {\n // The server signs the files-session cookie with a boot-generated\n // secret. Warn NOW — this is the exact drift that silently killed\n // every private render on 2026-08-30.\n capture({\n phase: \"session\",\n mediaRef: EPHEMERAL_SECRET_IDENTITY,\n terminal: false,\n message:\n \"server cookie secret is ephemeral — private renders will \" +\n \"break across restarts/instances (set a persistent \" +\n \"files-session secret on the server)\",\n });\n }\n if (report.verdict === \"retry\") {\n setResult((current) => ({\n source: src,\n retryKey: current.source === src ? current.retryKey + 1 : 1,\n failed: false,\n healedSrc: null,\n }));\n return;\n }\n // The ONE retry is exhausted. Before declaring the render dead, run\n // the client's heal ladder — the lanes that do not depend on the\n // cookie (bearer byte fetch, alternate host). The user is never\n // denied while any lane works; the row is written either way.\n const lane1: MediaHealAttempt = {\n lane: \"session-refresh-retry\",\n outcome: attempt > 1 ? \"http-error\" : \"unavailable\",\n ms: 0,\n ...(report.status !== undefined ? { status: report.status } : {}),\n detail:\n attempt > 1\n ? \"cookie re-minted, same durable URL retried in the element, element errored again\"\n : \"recovery declined on the first attempt (no usable session)\",\n };\n if (!failureRef || !client.healLoadError) {\n // No ladder to run (older client, or no durable ref to heal by):\n // the ONE retry's verdict is the terminal verdict, reported in the\n // pre-ladder vocabulary so existing telemetry keeps its meaning.\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: attempt > 1 ? \"element-load\" : \"recovery\",\n mediaRef: identity(),\n terminal: true,\n retryOutcome: attempt > 1 ? \"retried\" : \"not-attempted\",\n message:\n (attempt > 1\n ? \"media element failed to load after the session-refresh retry\"\n : \"media load recovery declined on the first attempt \" +\n \"(session refresh did not produce a usable session)\") +\n (failureRef\n ? \" — no heal ladder on this client (healLoadError not implemented)\"\n : \" — no durable ref supplied, so no heal lane could run\"),\n ...(report.status !== undefined ? { status: report.status } : {}),\n });\n onTerminal?.(event);\n return;\n }\n const heal: Promise<MediaHealResult> = client.healLoadError(failureRef, {\n src: mintDurableSrc(src),\n attempts: [lane1],\n });\n heal.then(\n (verdict) => {\n if (verdict.src) {\n setResult({\n source: src,\n retryKey: 0,\n failed: false,\n healedSrc: verdict.src,\n });\n capture({\n phase: \"heal\",\n mediaRef: identity(),\n terminal: false,\n healed: true,\n healedBy: verdict.healedBy,\n attempts: verdict.attempts,\n diagnosis: verdict.diagnosis,\n retryOutcome: \"retried\",\n message: `HEALED (${verdict.healedBy ?? \"unknown lane\"}): ${verdict.summary}`,\n ...(report.status !== undefined ? { status: report.status } : {}),\n });\n return;\n }\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: \"heal\",\n mediaRef: identity(),\n terminal: true,\n healed: false,\n attempts: verdict.attempts,\n diagnosis: verdict.diagnosis,\n retryOutcome: \"retried\",\n message: `DEAD after ${verdict.attempts.length} lane(s): ${verdict.summary}`,\n ...(report.status !== undefined ? { status: report.status } : {}),\n });\n onTerminal?.(event);\n },\n (err: unknown) => {\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: \"heal\",\n mediaRef: identity(),\n terminal: true,\n healed: false,\n attempts: [lane1],\n diagnosis: \"unknown\",\n retryOutcome: \"recovery-failed\",\n message: `heal ladder threw: ${\n err instanceof Error ? err.message : String(err ?? \"unknown error\")\n }`,\n });\n onTerminal?.(event);\n },\n );\n },\n (err: unknown) => {\n setResult({ source: src, retryKey: 0, failed: true, healedSrc: null });\n capture({\n phase: \"session\",\n mediaRef: identity(),\n terminal: true,\n retryOutcome: \"recovery-failed\",\n message: `session recovery failed: ${\n err instanceof Error ? err.message : String(err ?? \"unknown error\")\n }`,\n });\n onTerminal?.(event);\n },\n );\n };\n\n return {\n retryKey: result.source === src ? result.retryKey : 0,\n onLoadError,\n failed: result.source === src ? result.failed : false,\n healedSrc: result.source === src ? result.healedSrc : null,\n };\n}\n","/**\n * @ai-matrx/media — the root types: the MediaClient port and the host ports.\n *\n * The package renders Matrx durable media; it NEVER talks to a network.\n * Everything data-shaped arrives through the injected {@link MediaClient}\n * (canonically implemented by `@ai-matrx/data/files`; any structural\n * implementation works — the strangler step wires it over an app's existing\n * file handler). The five file-handling laws are enforced here at the type\n * level:\n *\n * 1. Never fetch a media URL yourself — the package contains zero network\n * primitives; bytes exist only via {@link MediaClient.getBlob}.\n * 2. Off-boundary code resolves media itself — every component takes a\n * {@link MediaRefLike} and calls `resolve()` unconditionally. There is\n * NO `src` prop on any component in this package.\n * 3. A signed URL is a handoff, never an identity — the only string that\n * reaches a media element is the branded {@link DurableSrc}, which only\n * a MediaClient implementation can mint (via {@link mintDurableSrc}).\n * 4. Public-facing media is persisted public, never signed —\n * {@link MediaClient.shareableUrl} fails closed (`null` → the action\n * renders disabled).\n * 5. One URL contract; the engine builds URLs — zero URL construction in\n * this package; `resolve()` is the only door.\n */\n\n// ---------------------------------------------------------------------------\n// Identity\n// ---------------------------------------------------------------------------\n\n/** The canonical durable media reference. `file_id` is the identity. */\nexport interface MediaRef {\n file_id?: string | null;\n url?: string | null;\n mime_type?: string | null;\n metadata?: Record<string, unknown> | null;\n}\n\n/**\n * Identity in. A raw string is a fileId or an EXTERNAL public URL — never a\n * signed URL (the client's `resolve()` classifies and screams on one).\n */\nexport type MediaRefLike = MediaRef | string;\n\ndeclare const durable: unique symbol;\n\n/**\n * A URL that has passed through `MediaClient.resolve()` — the only string\n * type any media element in this package will bind. A caller cannot pass an\n * expiring URL through the package's types without an explicit unsafe cast.\n */\nexport type DurableSrc = string & { readonly [durable]: true };\n\n/**\n * Brand a URL as durable. FOR MediaClient IMPLEMENTATIONS ONLY — the\n * implementation must classify the URL first (the ONE signed-URL classifier\n * lives with the platform's files layer; never re-implement it here or in a\n * host). Calling this on an unclassified string defeats law 3.\n */\nexport function mintDurableSrc(url: string): DurableSrc {\n return url as DurableSrc;\n}\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\nexport type MediaKind = \"image\" | \"video\" | \"audio\" | \"file\";\n\nexport interface MediaResolution {\n src: DurableSrc;\n /** RN auth lane (`<Image source={{uri, headers}}>`); absent on web (cookie session). */\n headers?: Record<string, string> | undefined;\n mimeType?: string | undefined;\n kind: MediaKind;\n /**\n * How pixels must travel. `\"element\"` (default): bind `src` directly to the\n * media element. `\"blob\"`: the bytes require bearer auth the element cannot\n * attach — consumers go through {@link MediaClient.getBlob} and render the\n * returned object URL (the private-image lane).\n */\n transport?: \"element\" | \"blob\" | undefined;\n /**\n * A server-rendered thumbnail for this file, when the client knows one\n * (Matrx: `FileRecord.thumbnail_url` / asset variants). Consumed by the\n * thumbnail tier machine.\n */\n thumbnailSrc?: DurableSrc | undefined;\n /**\n * True when this is a permanent public CDN URL — lets a host-supplied\n * `ImageComponent` (e.g. a next/image adapter) take the render, and marks\n * the URL CORS-safe for element-level `crossOrigin`.\n */\n isCdn?: boolean | undefined;\n /**\n * Whether a load error can be recovered by the client's ONE retry policy\n * (session-refresh → same-URL retry). False for foreign/external URLs —\n * a session refresh can't resurrect someone else's link rot. Default true.\n */\n recoverable?: boolean | undefined;\n}\n\n/** Typed unavailable states — render-as-state, never thrown as incidents. */\nexport type MediaUnavailableReason =\n | \"access_denied\"\n | \"not_found\"\n | \"deleted\"\n | \"unknown\";\n\n// ---------------------------------------------------------------------------\n// Diagnostics — the terminal-failure capture contract (the 2026-08-30 outage\n// class: every private image failed, the honest unavailable panel rendered,\n// and NOTHING reached the host's error system because the package had no\n// diagnostics port). Per C22 the capture logic lives IN the package; a host\n// binds only a sink. Absent sink → the package console.errors the same\n// structured payload once per failure — a media failure is NEVER silent.\n// ---------------------------------------------------------------------------\n\n/** Where in the pipeline a media failure surfaced. */\nexport type MediaFailurePhase =\n /** `MediaClient.resolve()` refused the ref (threw). */\n | \"resolve\"\n /** The client's session bootstrap/mint failed (`recoverLoadError` rejected),\n * or the server reported an ephemeral cookie secret (warning). */\n | \"session\"\n /** `MediaClient.getBlob()` rejected — private-pixels bytes never arrived. */\n | \"blob\"\n /** The media element errored and recovery was exhausted or impossible. */\n | \"element-load\"\n /** The client's recovery machinery declined to retry on the first attempt. */\n | \"recovery\"\n /**\n * The heal ladder ran after the ONE retry failed. Non-terminal when a lane\n * healed the render (the user saw the media); terminal when every lane\n * died. Either way the row carries `attempts` + `diagnosis`.\n */\n | \"heal\";\n\n/** What the ONE retry policy did before the failure went terminal. */\nexport type MediaRetryOutcome =\n /** Recovery was impossible (unrecoverable source) or was never reached. */\n | \"not-attempted\"\n /** The client granted a session-refresh retry and the retry ALSO failed. */\n | \"retried\"\n /** The recovery call itself threw/rejected. */\n | \"recovery-failed\";\n\n/**\n * The strictly-typed structural payload every terminal media failure emits.\n * `mediaRef` is DURABLE IDENTITY ONLY — a `file:<id>` / query-stripped URL\n * key, NEVER a signed URL (signatures live in query strings, which\n * {@link failureMediaIdentity} removes).\n */\nexport interface MediaFailureInfo {\n source: \"media\";\n phase: MediaFailurePhase;\n /** File id / ref key identity — never a signed URL. */\n mediaRef: string;\n /** HTTP status when known (e.g. from a structured client error). */\n status?: number | undefined;\n /** Outcome of the client's ONE retry policy, when the phase reached it. */\n retryOutcome?: MediaRetryOutcome | undefined;\n /** True for a dead render; false for a captured warning (ephemeral secret)\n * or a HEALED render (`healed: true`). */\n terminal: boolean;\n message: string;\n /**\n * True when the heal ladder produced a renderable source after the primary\n * lane died. A healed render is NEVER silent: hosts persist it exactly like\n * a dead one so \"errors that fix themselves\" stay visible and countable.\n */\n healed?: boolean | undefined;\n /** The lane that healed the render (`MediaHealLane`). */\n healedBy?: MediaHealLane | undefined;\n /** Every lane the ladder tried, in order, with its outcome. */\n attempts?: MediaHealAttempt[] | undefined;\n /** The client's root-cause reading of the attempt pattern. */\n diagnosis?: MediaHealDiagnosis | undefined;\n}\n\n/** The lanes a render can be healed through, in ladder order. */\nexport type MediaHealLane =\n /** Re-mint the files-session cookie, retry the SAME durable URL in the element. */\n | \"session-refresh-retry\"\n /** Bearer-authenticated byte fetch on the primary files host → object URL. */\n | \"bearer-blob\"\n /** Bearer-authenticated byte fetch on the OTHER configured files host. */\n | \"bearer-blob-alternate-host\";\n\nexport interface MediaHealAttempt {\n lane: MediaHealLane;\n /** \"ok\" healed it; anything else is why it did not. */\n outcome: \"ok\" | \"http-error\" | \"network-error\" | \"unavailable\" | \"skipped\";\n /** HTTP status when the lane got an answer. */\n status?: number | undefined;\n /** Wall-clock the lane took. */\n ms: number;\n /** Which host answered (origin only — never a signed URL). */\n host?: string | undefined;\n /** Free-text detail for the row (error class, refusal reason). */\n detail?: string | undefined;\n}\n\n/**\n * What the attempt pattern says about the ROOT CAUSE. Named so a row in the\n * error catcher reads as a diagnosis, not a symptom.\n */\nexport type MediaHealDiagnosis =\n /** Cookie mint answered 200, the element still 401'd, the bearer lane\n * worked: the browser is not sending the files-session cookie cross-site\n * (third-party cookies blocked — Chrome setting / Incognito / Safari / Brave). */\n | \"cookie-not-sent-by-browser\"\n /** The cookie mint itself failed (status carried on the attempt). */\n | \"cookie-mint-failed\"\n /** The bearer token was refused (401): the sign-in is stale on this tab. */\n | \"bearer-rejected\"\n /** 403 on the bytes: this identity may not read this file. */\n | \"access-denied\"\n /** 404 on the bytes: the file row/object is gone. */\n | \"file-missing\"\n /** 5xx from the files host. */\n | \"files-host-error\"\n /** No host answered at all (DNS/network/CORS). */\n | \"files-host-unreachable\"\n /** Primary host dead, the alternate host served the bytes. */\n | \"primary-host-down-alternate-served\"\n /** Nothing in the pattern matches a known cause. */\n | \"unknown\";\n\n/** The client's heal verdict — the lanes it ran and what it concluded. */\nexport interface MediaHealResult {\n /** Renderable `blob:`/durable source when healed; null when every lane died. */\n src: string | null;\n healedBy?: MediaHealLane | undefined;\n attempts: MediaHealAttempt[];\n diagnosis: MediaHealDiagnosis;\n /** Plain-English root cause + what served the user — the log line. */\n summary: string;\n}\n\n/**\n * The host's error-capture sink. Bind `capture` to the app's error system\n * (matrx-frontend: `captureError` in lib/diagnostics/errorCaptureStore).\n * When absent, the package console.errors the same payload once per failure\n * (the loud default) — it never downgrades to silence.\n */\nexport interface MediaDiagnosticsPort {\n capture?: ((info: MediaFailureInfo) => void) | undefined;\n}\n\n/** String verdicts of the ONE retry policy. */\nexport type MediaRecoveryVerdict = \"retry\" | \"terminal\";\n\n/**\n * Structured `recoverLoadError` result — optional; the bare string verdict\n * remains fully supported. Lets the client surface what it learned during the\n * session bootstrap without a second channel:\n *\n * - `status` — HTTP status of the failed mint/probe, forwarded into the\n * terminal {@link MediaFailureInfo};\n * - `secretSource` — the `/files/session` mint response's `secret_source`\n * when the server sends one (a matrx-connect field). `\"ephemeral\"` means\n * the server signs cookies with a boot-generated secret: private renders\n * WILL break across restarts/instances, and the package captures a\n * non-terminal warning immediately instead of waiting for the outage.\n */\nexport interface MediaRecoveryReport {\n verdict: MediaRecoveryVerdict;\n status?: number | undefined;\n secretSource?: string | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Bytes / upload\n// ---------------------------------------------------------------------------\n\nexport interface MediaBlobHandle {\n /** `blob:` object URL safe for any browser API. */\n url: string;\n blob: Blob;\n /** Release the handle. Implementations backed by a shared cache may no-op. */\n release(): void;\n}\n\nexport interface MediaUploadOptions {\n onProgress?: ((loaded: number, total: number) => void) | undefined;\n fileName?: string | undefined;\n mimeType?: string | undefined;\n /** Publish the upload to the web (the only anonymous lane; access ladder T-13). */\n publishedToWeb?: boolean | undefined;\n /** The \"Shown to\" list filter (`only_me` | `my_team` | `everyone` | `everyone_on_ai_matrx`). */\n shownTo?: \"only_me\" | \"my_team\" | \"everyone\" | \"everyone_on_ai_matrx\" | undefined;\n /** The retiring level word, passed through structurally until hosts take the two words. */\n visibility?: string | undefined; // T-13 transitional wire input\n parentFolderId?: string | null | undefined;\n metadata?: Record<string, unknown> | undefined;\n}\n\n/** Upload → durable identity. `fileId` is required at compile time and runtime. */\nexport interface MediaUploadResult {\n fileId: string;\n ref: MediaRef;\n}\n\nexport interface MediaMultiUploadResult {\n /** File ids for every successful upload. */\n uploaded: string[];\n /** Per-file failure with the real backend error message. */\n failed: Array<{ name: string; error: string }>;\n /** True when the host's pre-flight (e.g. a duplicate dialog) cancelled the batch. */\n cancelled: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// THE port — one structural interface, owned by this package, implemented by\n// the data layer (canonically `@ai-matrx/data/files`).\n// ---------------------------------------------------------------------------\n\nexport interface MediaClient {\n /**\n * Synchronous durable-URL build + classification. Returns `null` when the\n * ref carries no usable identity (components render their fallback).\n * THROWS (and screams via its own diagnostics sink) on a signed/expiring\n * URL — the D108 guard lives behind this door.\n */\n resolve(ref: MediaRefLike): MediaResolution | null;\n /** Bytes for canvas/crossOrigin/private-pixel consumers. */\n getBlob(ref: MediaRefLike): Promise<MediaBlobHandle>;\n /**\n * Session bootstrap + the ONE retry policy: refresh-then-same-URL-retry,\n * second failure terminal. Called by the package's onError path, never\n * re-implemented.\n */\n recoverLoadError(\n src: DurableSrc,\n attempt: number,\n ): Promise<MediaRecoveryVerdict | MediaRecoveryReport>;\n /**\n * Optional object-URL recovery policy for private blob-backed media.\n * The client decides whether the durable ref should be re-read; older\n * clients may omit this and fail terminally.\n */\n recoverBlobLoadError?(\n ref: MediaRefLike,\n attempt: number,\n ): Promise<MediaRecoveryVerdict>;\n /**\n * The heal ladder — runs AFTER the ONE retry policy is exhausted. Tries\n * every lane the client owns (bearer byte fetch on the primary host, then\n * the alternate host), records each attempt, and names the root cause. The\n * package renders `src` when present and captures the result either way:\n * a healed render is logged as loudly as a dead one. Clients that omit it\n * fall back to the terminal verdict.\n */\n healLoadError?(\n ref: MediaRefLike,\n context: { src: DurableSrc; attempts: MediaHealAttempt[] },\n ): Promise<MediaHealResult>;\n /** Upload → durable identity. */\n upload(file: File | Blob, opts?: MediaUploadOptions): Promise<MediaUploadResult>;\n /**\n * Optional batch upload with host pre-flight (dedup dialogs etc.). When\n * absent, `useMediaUpload().uploadMany` falls back to sequential `upload`.\n */\n uploadMany?(files: File[], opts?: MediaUploadOptions): Promise<MediaMultiUploadResult>;\n /** Share affordances — fails closed (null), never emits a signed URL. */\n shareableUrl(ref: MediaRefLike): Promise<string | null>;\n /** Typed unavailable states — render-as-state, never thrown as incidents. */\n classifyError(err: unknown): MediaUnavailableReason;\n}\n\n// ---------------------------------------------------------------------------\n// Host ports — all optional, all defaulting to inert.\n// ---------------------------------------------------------------------------\n\n/**\n * Structural component slot. `(props) => unknown` keeps the root entry free\n * of React type imports; any React function component satisfies it.\n */\nexport type MediaSlotComponent<P> = (props: P) => unknown;\n\nexport interface MediaImageComponentProps {\n src: string;\n alt: string;\n width: number;\n height: number;\n className?: string | undefined;\n onError?: ((event: unknown) => void) | undefined;\n onClick?: ((event: unknown) => void) | undefined;\n onKeyDown?: ((event: unknown) => void) | undefined;\n role?: string | undefined;\n tabIndex?: number | undefined;\n}\n\nexport interface PlaybackSessionRegistration {\n isPlaying: boolean;\n source: string;\n label: string;\n trackKey?: string | undefined;\n}\n\n/**\n * The host's audio system (exclusive-playback lock, output-sink routing).\n * Both members are HOOKS — the package calls them unconditionally on every\n * render of a media element, so implementations must obey the Rules of Hooks\n * and the port object must be referentially stable.\n */\nexport interface PlaybackSessionPort {\n /**\n * Returns a ref callback for the underlying media element (routes audio\n * output / setSinkId on hosts that support it) and forwards to the caller's\n * own element ref.\n */\n useMediaElementSink(\n forward:\n | ((node: unknown) => void)\n | { current: unknown }\n | null\n | undefined,\n ): (node: unknown) => void;\n /** Joins the host's unified playback session for the element. */\n usePlaybackSession(\n registration: PlaybackSessionRegistration,\n elementRef: { current: unknown },\n ): void;\n}\n\n// ---------------------------------------------------------------------------\n// THE SHARE MANDATE (C19) — the complete headless media-actions contract.\n//\n// v0.1 ships this contract plus toolbar/lightbox shells wired to it, typed so\n// the associations/sharing package can plug in WITHOUT a media release: it\n// implements MediaActionsPort (handlers and/or the SharePopover body) and the\n// host injects it through MediaHostPorts. Nothing here may change shape in a\n// breaking way for that wave.\n// ---------------------------------------------------------------------------\n\nexport type MediaActionKind = \"share\" | \"download\" | \"copy\" | \"open\";\n\nexport interface MediaActionContext {\n ref: MediaRefLike;\n resolution: MediaResolution | null;\n fileName?: string | undefined;\n alt?: string | undefined;\n}\n\nexport interface MediaSharePopoverProps {\n context: MediaActionContext;\n onClose: () => void;\n}\n\nexport type MediaActionHandler = (ctx: MediaActionContext) => Promise<void>;\n\nexport interface MediaActionsPort {\n /**\n * Quick-share handler (copy a share link, open the native share sheet…).\n * Implementations obtain URLs ONLY via `MediaClient.shareableUrl` /\n * durable identities — never a signed URL (law 4).\n */\n share?: MediaActionHandler | undefined;\n download?: MediaActionHandler | undefined;\n copy?: MediaActionHandler | undefined;\n open?: MediaActionHandler | undefined;\n /**\n * Rich share UI body — the slot the associations package fills. When\n * present, the shells open it instead of (or on top of) the `share`\n * handler. Receives {@link MediaSharePopoverProps}.\n */\n SharePopover?: MediaSlotComponent<MediaSharePopoverProps> | undefined;\n}\n\nexport interface MediaHostPorts {\n playbackSession?: PlaybackSessionPort | undefined;\n actions?: MediaActionsPort | undefined;\n /** Web host may pass a next/image adapter; default is a plain `<img>`. */\n ImageComponent?: MediaSlotComponent<MediaImageComponentProps> | undefined;\n /**\n * Error-capture sink for terminal media failures (and the ephemeral-secret\n * warning). Bind to the host's error system; absent → loud console.error\n * default. See {@link MediaDiagnosticsPort}.\n */\n diagnostics?: MediaDiagnosticsPort | undefined;\n}\n","/**\n * src/core/use-media-resolution.ts — ref → durable resolution, as state.\n *\n * Law 2: every consumer resolves media through the client, unconditionally —\n * even a caller-supplied URL string is classified, never trusted. Law 15 of\n * the handler (unavailable is a rendered state): a throwing `resolve()` is\n * classified via `classifyError` and returned as typed state — never\n * re-thrown. It IS however a terminal failure, so it also emits exactly one\n * `MediaFailureInfo` (phase \"resolve\") through the diagnostics machinery —\n * the 2026-08-30 outage rule: an unavailable render is honest to the USER but\n * must never be silent to the SYSTEM.\n */\n\nimport { useEffect, useMemo } from \"react\";\nimport type {\n MediaRefLike,\n MediaResolution,\n MediaUnavailableReason,\n} from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { failureMediaIdentity, useMediaFailureCapture } from \"./diagnostics\";\nimport { stableRefKey } from \"./ref-key\";\n\nexport interface MediaResolutionState {\n resolution: MediaResolution | null;\n /**\n * \"empty\" — no ref, or a ref with no usable identity (render fallback)\n * \"ready\" — resolution available\n * \"unavailable\" — resolve() refused (signed URL, access denied…); render\n * the typed unavailable state, never an incident\n */\n status: \"empty\" | \"ready\" | \"unavailable\";\n reason: MediaUnavailableReason | null;\n}\n\nexport function useMediaResolution(\n ref: MediaRefLike | null | undefined,\n): MediaResolutionState {\n const client = useMediaClient();\n const capture = useMediaFailureCapture();\n const refKey = stableRefKey(ref);\n const { state, failureMessage } = useMemo<{\n state: MediaResolutionState;\n failureMessage: string | null;\n }>(() => {\n if (!ref) {\n return {\n state: { resolution: null, status: \"empty\", reason: null },\n failureMessage: null,\n };\n }\n try {\n const resolution = client.resolve(ref);\n if (!resolution) {\n return {\n state: { resolution: null, status: \"empty\", reason: null },\n failureMessage: null,\n };\n }\n return {\n state: { resolution, status: \"ready\", reason: null },\n failureMessage: null,\n };\n } catch (err) {\n return {\n state: {\n resolution: null,\n status: \"unavailable\",\n reason: client.classifyError(err),\n },\n failureMessage:\n err instanceof Error ? err.message : String(err ?? \"resolve() failed\"),\n };\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client, refKey]);\n\n // Terminal-failure capture (phase \"resolve\") — an effect, never a render\n // side effect; latched per media identity by the diagnostics machinery.\n useEffect(() => {\n if (state.status !== \"unavailable\") return;\n capture({\n phase: \"resolve\",\n mediaRef: failureMediaIdentity(ref ?? null),\n terminal: true,\n message: `resolve() refused (${state.reason ?? \"unknown\"}): ${\n failureMessage ?? \"no error message\"\n }`,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [refKey, state.status]);\n\n return state;\n}\n","/**\n * src/react/media-thumbnail.tsx — the single thumbnail renderer.\n *\n * Behavior port of matrx-frontend\n * `features/files/components/core/MediaThumbnail/MediaThumbnail.tsx` with\n * the tier machine inverted onto `/core`'s `useThumbnailSource` (the asset\n * variant lookup, public/private lanes and blob cache now live behind\n * `MediaClient.resolve` / `getBlob`):\n *\n * 1. server-rendered thumbnail (`thumbnailUrl` prop / resolution metadata)\n * 2. live source render — `<img>` for images, `<video preload=\"metadata\">`\n * poster frame for videos (the window between upload and variant render)\n * 3. category icon fallback\n *\n * Load failures self-heal through the client's ONE recovery policy before\n * falling to the icon — a user's own file never just \"expires\".\n */\n\n\"use client\";\n\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport type { MediaRefLike } from \"../types\";\nimport {\n useMediaBlobLoadRecovery,\n type MediaBlobLoadRecovery,\n} from \"../core/use-media-blob-load-recovery\";\nimport { useMediaLoadRecovery } from \"../core/use-media-load-recovery\";\nimport { useThumbnailSource } from \"../core/use-thumbnail-source\";\nimport { cn } from \"./cn\";\nimport { FileIcon } from \"./file-icon\";\n\nexport interface MediaThumbnailProps {\n /** The file's durable ref (a MediaRef or bare fileId). */\n mediaRef: MediaRefLike;\n /** Display name — drives the icon fallback and alt text. */\n fileName: string;\n /** Server MIME, when known. */\n mimeType?: string | null | undefined;\n /** A known server-rendered thumbnail URL (`FileRecord.thumbnail_url`). */\n thumbnailUrl?: string | null | undefined;\n /** Pixel size for the icon fallback. Image/video fill their container. */\n iconSize?: number | undefined;\n /** Aspect ratio classes applied to the container, e.g. \"aspect-[4/3]\". */\n className?: string | undefined;\n /** Override the rounded corners of the container. */\n rounded?: string | undefined;\n /**\n * Whether to fall back to a source-file URL when no rendered thumbnail is\n * available. Disable in dense pickers to avoid a byte request per row.\n */\n allowSourceFallback?: boolean | undefined;\n}\n\nexport function MediaThumbnail({\n mediaRef,\n fileName,\n mimeType = null,\n thumbnailUrl,\n iconSize = 48,\n className,\n rounded,\n allowSourceFallback = true,\n}: MediaThumbnailProps) {\n const source = useThumbnailSource(mediaRef, {\n thumbnailUrl,\n allowSourceFallback,\n });\n // Keep the retry budget above the transient blob-loading branch. A retry\n // deliberately clears `source.src` while fresh bytes are read; mounting\n // recovery inside ImageThumb/VideoPosterThumb reset attempt 2 to attempt 1\n // when the new object URL arrived and could create an unbounded retry loop.\n const blobRecovery = useMediaBlobLoadRecovery(\n source.blobBacked ? mediaRef : null,\n source.blobBacked ? source.src : null,\n { onRetry: source.retryBlob },\n );\n\n const fallback = (\n <div className=\"flex h-full w-full items-center justify-center bg-muted/40\">\n <FileIcon fileName={fileName} mimeType={mimeType} size={iconSize} />\n </div>\n );\n\n let body: ReactNode = source.loading ? (\n <div className=\"h-full w-full animate-pulse bg-muted\" />\n ) : (\n fallback\n );\n\n if (source.src) {\n if (source.mode === \"live-video-poster\") {\n body = (\n <VideoPosterThumb\n url={source.src}\n mediaRef={mediaRef}\n recoverable={source.recoverable}\n blobBacked={source.blobBacked}\n blobRecovery={blobRecovery}\n fallback={fallback}\n />\n );\n } else {\n body = (\n <ImageThumb\n url={source.src}\n alt={fileName}\n mediaRef={mediaRef}\n recoverable={source.recoverable}\n blobBacked={source.blobBacked}\n blobRecovery={blobRecovery}\n fallback={fallback}\n />\n );\n }\n }\n\n return (\n <div\n className={cn(\"relative overflow-hidden bg-muted/40\", rounded, className)}\n >\n {body}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Internals\n// ---------------------------------------------------------------------------\n\nfunction ImageThumb({\n url,\n alt,\n mediaRef,\n recoverable,\n blobBacked,\n blobRecovery,\n fallback,\n}: {\n url: string;\n alt: string;\n mediaRef: MediaRefLike;\n recoverable: boolean;\n blobBacked: boolean;\n blobRecovery: MediaBlobLoadRecovery;\n fallback: ReactNode;\n}) {\n // Media durability: a load failure routes through the client's ONE\n // recovery (session refresh → same durable URL) before falling to the\n // icon. Foreign/blob URLs pass through untouched.\n const { retryKey, onLoadError, failed, healedSrc } = useMediaLoadRecovery(url, {\n recoverable,\n failureRef: mediaRef,\n });\n const activeRecovery = blobBacked\n ? { retryKey: 0, ...blobRecovery }\n : { retryKey, onLoadError, failed };\n // A healed (bearer-lane) object URL replaces the dead element src.\n const renderUrl = (!blobBacked && healedSrc) || url;\n\n if (activeRecovery.failed) return <>{fallback}</>;\n return (\n <img\n key={activeRecovery.retryKey}\n src={renderUrl}\n alt={alt}\n // Lazy-load NETWORK thumbnails only. A blob: object URL means the bytes\n // were already downloaded and sit in memory — deferring the render buys\n // nothing, and `loading=\"lazy\"` never fires in hidden documents (agent\n // browser panes, background tabs) or offscreen scroll cells, which\n // stalled grids/chat silently forever (F3/F4). Local bytes render NOW.\n loading={renderUrl.startsWith(\"blob:\") ? \"eager\" : \"lazy\"}\n className=\"h-full w-full object-cover\"\n onError={activeRecovery.onLoadError}\n />\n );\n}\n\nfunction VideoPosterThumb({\n url,\n mediaRef,\n recoverable,\n blobBacked,\n blobRecovery,\n fallback,\n}: {\n url: string;\n mediaRef: MediaRefLike;\n recoverable: boolean;\n blobBacked: boolean;\n blobRecovery: MediaBlobLoadRecovery;\n fallback: ReactNode;\n}) {\n // Same self-heal contract as ImageThumb.\n const { retryKey, onLoadError, failed, healedSrc } = useMediaLoadRecovery(url, {\n recoverable,\n failureRef: mediaRef,\n });\n const activeRecovery = blobBacked\n ? { retryKey: 0, ...blobRecovery }\n : { retryKey, onLoadError, failed };\n const renderUrl = (!blobBacked && healedSrc) || url;\n const ref = useRef<HTMLVideoElement | null>(null);\n\n // Some browsers refuse to render a frame until they explicitly know how to\n // seek. Setting `currentTime = 0` after metadata loads ensures the first\n // frame is decoded and displayed.\n useEffect(() => {\n const v = ref.current;\n if (!v) return undefined;\n const onMeta = () => {\n try {\n v.currentTime = 0;\n } catch {\n /* ignore — some streams don't support setting currentTime */\n }\n };\n v.addEventListener(\"loadedmetadata\", onMeta);\n return () => v.removeEventListener(\"loadedmetadata\", onMeta);\n }, []);\n\n if (activeRecovery.failed) return <>{fallback}</>;\n return (\n <video\n key={activeRecovery.retryKey}\n ref={ref}\n src={renderUrl}\n className=\"h-full w-full object-cover pointer-events-none\"\n preload=\"metadata\"\n muted\n playsInline\n onError={activeRecovery.onLoadError}\n />\n );\n}\n\nexport default MediaThumbnail;\n","/**\n * src/core/use-thumbnail-source.ts — the thumbnail tier machine.\n *\n * Ported from matrx-frontend `MediaThumbnail.tsx`'s source-priority logic\n * with the data seams inverted onto the MediaClient:\n *\n * 1. Caller-supplied `thumbnailUrl` (`FileRecord.thumbnail_url`) —\n * CLASSIFIED through `resolve()` like every string (law 2), never\n * trusted raw.\n * 2. `resolution.thumbnailSrc` — the client's asset-variant lookup\n * (rides `MediaClient.resolve` metadata).\n * 3. Live source render — the master itself, `<img>` for images or\n * `<video preload=\"metadata\">` for a video poster frame; the private\n * bearer-auth lane (`transport: \"blob\"`) goes through `getBlob`.\n * 4. Icon fallback (`src: null`).\n */\n\nimport { useMemo } from \"react\";\nimport type { DurableSrc, MediaRefLike, MediaResolution } from \"../types\";\nimport { useMediaClient } from \"./context\";\nimport { useMediaBlob } from \"./use-media-blob\";\nimport { useMediaResolution } from \"./use-media-resolution\";\n\nexport type ThumbnailMode =\n | \"thumbnail\"\n | \"live-image\"\n | \"live-video-poster\"\n | \"icon\";\n\nexport interface ThumbnailSourceState {\n /** URL to render, or null → render the icon fallback. */\n src: DurableSrc | string | null;\n mode: ThumbnailMode;\n /** True while the private-pixels blob lane is still loading. */\n loading: boolean;\n resolution: MediaResolution | null;\n /** False for blob object URLs — wire into useMediaLoadRecovery. */\n recoverable: boolean;\n /** True when src is a disposable object URL backed by the durable ref. */\n blobBacked: boolean;\n /** Re-read the durable ref after client-approved object-URL recovery. */\n retryBlob: () => void;\n}\n\nexport interface UseThumbnailSourceOptions {\n /** A known server-rendered thumbnail URL (e.g. `FileRecord.thumbnail_url`). */\n thumbnailUrl?: string | null | undefined;\n /**\n * Whether to fall back to the source file itself when no rendered\n * thumbnail exists. Disable in dense pickers to avoid per-row byte loads.\n */\n allowSourceFallback?: boolean | undefined;\n}\n\nexport function useThumbnailSource(\n ref: MediaRefLike | null | undefined,\n options: UseThumbnailSourceOptions = {},\n): ThumbnailSourceState {\n const { thumbnailUrl, allowSourceFallback = true } = options;\n const client = useMediaClient();\n const { resolution } = useMediaResolution(ref);\n\n // Tier 1 — caller-supplied thumbnail URL, classified like everything else.\n const explicitThumb = useMemo(() => {\n if (!thumbnailUrl) return null;\n try {\n return client.resolve(thumbnailUrl);\n } catch {\n // A refused thumbnail URL (signed, foreign junk) falls to lower tiers.\n return null;\n }\n }, [client, thumbnailUrl]);\n\n // Tier 3 blob lane — only engaged when we would actually render the source,\n // which (matching the non-blob branch below and the original MediaThumbnail\n // `needsBytes` gate) means image/video kinds ONLY. Without the kind gate a\n // private markdown/PDF/archive file downloads its ENTIRE bytes just to feed\n // an <img> that can never decode them (the F3 defect class).\n const needsBlob =\n allowSourceFallback &&\n !explicitThumb &&\n !resolution?.thumbnailSrc &&\n resolution?.transport === \"blob\" &&\n (resolution.kind === \"image\" || resolution.kind === \"video\");\n const blob = useMediaBlob(needsBlob ? ref : null);\n\n if (explicitThumb) {\n return {\n src: explicitThumb.src,\n mode: \"thumbnail\",\n loading: false,\n resolution,\n recoverable: explicitThumb.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n if (resolution?.thumbnailSrc) {\n return {\n src: resolution.thumbnailSrc,\n mode: \"thumbnail\",\n loading: false,\n resolution,\n recoverable: resolution.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n if (allowSourceFallback && resolution) {\n if (needsBlob) {\n return {\n src: blob.url,\n mode: blob.url\n ? resolution.kind === \"video\"\n ? \"live-video-poster\"\n : \"live-image\"\n : \"icon\",\n loading: blob.loading,\n resolution,\n recoverable: false,\n blobBacked: true,\n retryBlob: blob.retry,\n };\n }\n if (resolution.kind === \"image\") {\n return {\n src: resolution.src,\n mode: \"live-image\",\n loading: false,\n resolution,\n recoverable: resolution.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n if (resolution.kind === \"video\") {\n return {\n src: resolution.src,\n mode: \"live-video-poster\",\n loading: false,\n resolution,\n recoverable: resolution.recoverable !== false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n }\n }\n return {\n src: null,\n mode: \"icon\",\n loading: false,\n resolution,\n recoverable: false,\n blobBacked: false,\n retryBlob: blob.retry,\n };\n}\n","/**\n * src/react/use-media-dropzone.ts — headless drag + paste + picker intake.\n *\n * Replaces the original's `react-dropzone` dependency with native DOM events\n * (the package's `/react` entry carries no UI-library deps). The behavior\n * contract is the original FileUploadDropzone's: drag-over highlight, hidden\n * input picker (`openPicker`), clipboard paste of images with a brief\n * highlight pulse, an optional window event that opens the picker, and\n * accept/maxSize filtering (UI-only; the server enforces its own caps).\n */\n\n\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type DragEvent,\n type HTMLAttributes,\n type InputHTMLAttributes,\n} from \"react\";\n\nexport interface MediaDropzoneOptions {\n /** Receives every accepted batch (drop, paste, or picker). */\n onFiles: (files: File[]) => void;\n /** Restrict accepted types, e.g. [\"image/*\", \"application/pdf\", \".csv\"]. */\n accept?: string[] | undefined;\n /** Max size per file in bytes (UI-only filter). */\n maxSize?: number | undefined;\n /** Fires for files filtered out by accept/maxSize. */\n onRejected?: ((rejected: Array<{ file: File; reason: \"type\" | \"size\" }>) => void) | undefined;\n /** Enable clipboard paste (images only). Defaults true. */\n enablePaste?: boolean | undefined;\n /** Optional window event name that opens the native file picker. */\n pickerEventName?: string | undefined;\n disabled?: boolean | undefined;\n multiple?: boolean | undefined;\n}\n\nexport interface MediaDropzoneState {\n /** Spread onto the drop surface element. */\n getRootProps: () => HTMLAttributes<HTMLElement>;\n /** Spread onto a hidden `<input type=\"file\">`. */\n getInputProps: () => InputHTMLAttributes<HTMLInputElement> & {\n ref: (node: HTMLInputElement | null) => void;\n };\n isDragActive: boolean;\n /** Brief pulse after a successful clipboard paste. */\n pasteHighlight: boolean;\n openPicker: () => void;\n}\n\nfunction matchesAccept(file: File, accept: string[] | undefined): boolean {\n if (!accept || accept.length === 0) return true;\n const name = file.name.toLowerCase();\n const mime = file.type.toLowerCase();\n return accept.some((pattern) => {\n const p = pattern.trim().toLowerCase();\n if (!p) return false;\n if (p.startsWith(\".\")) return name.endsWith(p);\n if (p.endsWith(\"/*\")) return mime.startsWith(p.slice(0, -1));\n return mime === p;\n });\n}\n\nexport function useMediaDropzone(options: MediaDropzoneOptions): MediaDropzoneState {\n const {\n onFiles,\n accept,\n maxSize,\n onRejected,\n enablePaste = true,\n pickerEventName,\n disabled = false,\n multiple = true,\n } = options;\n\n const [isDragActive, setIsDragActive] = useState(false);\n const [pasteHighlight, setPasteHighlight] = useState(false);\n const dragDepth = useRef(0);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Latest-callback refs so the window listeners never go stale.\n const onFilesRef = useRef(onFiles);\n onFilesRef.current = onFiles;\n const onRejectedRef = useRef(onRejected);\n onRejectedRef.current = onRejected;\n\n const acceptKey = accept?.join(\",\") ?? \"\";\n\n const filterFiles = useCallback(\n (files: File[]): File[] => {\n const accepted: File[] = [];\n const rejected: Array<{ file: File; reason: \"type\" | \"size\" }> = [];\n for (const file of files) {\n if (!matchesAccept(file, acceptKey ? acceptKey.split(\",\") : undefined)) {\n rejected.push({ file, reason: \"type\" });\n } else if (maxSize != null && file.size > maxSize) {\n rejected.push({ file, reason: \"size\" });\n } else {\n accepted.push(file);\n }\n }\n if (rejected.length) onRejectedRef.current?.(rejected);\n return accepted;\n },\n [acceptKey, maxSize],\n );\n\n const emit = useCallback(\n (files: File[]) => {\n const accepted = filterFiles(files);\n if (accepted.length) onFilesRef.current(accepted);\n },\n [filterFiles],\n );\n\n const openPicker = useCallback(() => {\n if (!disabled) inputRef.current?.click();\n }, [disabled]);\n\n // Optional window event that opens the native file picker.\n useEffect(() => {\n if (!pickerEventName || typeof window === \"undefined\") return undefined;\n const handler = () => openPicker();\n window.addEventListener(pickerEventName, handler);\n return () => window.removeEventListener(pickerEventName, handler);\n }, [openPicker, pickerEventName]);\n\n // Clipboard paste — images only (the original's contract).\n useEffect(() => {\n if (!enablePaste || disabled || typeof window === \"undefined\") {\n return undefined;\n }\n const handler = (event: ClipboardEvent) => {\n if (!event.clipboardData?.items) return;\n const images: File[] = [];\n for (const item of Array.from(event.clipboardData.items)) {\n if (item.type.startsWith(\"image/\")) {\n const blob = item.getAsFile();\n if (!blob) continue;\n const ext = blob.type.split(\"/\")[1] ?? \"png\";\n const name = `pasted-${Date.now()}.${ext}`;\n images.push(new File([blob], name, { type: blob.type }));\n }\n }\n if (images.length > 0) {\n event.preventDefault();\n setPasteHighlight(true);\n setTimeout(() => setPasteHighlight(false), 400);\n emit(images);\n }\n };\n window.addEventListener(\"paste\", handler);\n return () => window.removeEventListener(\"paste\", handler);\n }, [enablePaste, disabled, emit]);\n\n const getRootProps = useCallback(\n (): HTMLAttributes<HTMLElement> => ({\n onDragEnter: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n dragDepth.current += 1;\n setIsDragActive(true);\n },\n onDragOver: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n },\n onDragLeave: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n dragDepth.current = Math.max(0, dragDepth.current - 1);\n if (dragDepth.current === 0) setIsDragActive(false);\n },\n onDrop: (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n dragDepth.current = 0;\n setIsDragActive(false);\n const files = Array.from(event.dataTransfer?.files ?? []);\n if (files.length) emit(multiple ? files : files.slice(0, 1));\n },\n }),\n [disabled, emit, multiple],\n );\n\n const inputAccept = useMemo(\n () => (acceptKey.length ? acceptKey : undefined),\n [acceptKey],\n );\n\n const getInputProps = useCallback(\n () => ({\n ref: (node: HTMLInputElement | null) => {\n inputRef.current = node;\n },\n type: \"file\" as const,\n multiple,\n accept: inputAccept,\n tabIndex: -1,\n style: { display: \"none\" } as const,\n onChange: (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files ?? []);\n // Allow re-selecting the same file.\n event.target.value = \"\";\n if (files.length) emit(files);\n },\n }),\n [emit, inputAccept, multiple],\n );\n\n return { getRootProps, getInputProps, isDragActive, pasteHighlight, openPicker };\n}\n","/**\n * src/react/file-upload-dropzone.tsx — drag + paste + picker uploader.\n *\n * Behavior port of matrx-frontend\n * `FileUploadDropzone/FileUploadDropzone.tsx` with the seams inverted:\n * `react-dropzone` → the package's own `useMediaDropzone`; the Redux\n * `selectVisibleUploads` tray → `useMediaUpload().entries`; the app-shaped\n * acquisition sources (Google Drive, local folder, \"choose existing\") → the\n * `actions` render slot. Renders as a full-surface overlay (`mode=\"overlay\"`)\n * or an inline block with visible affordance (`mode=\"inline\"`).\n */\n\n\"use client\";\n\nimport { useCallback, type ReactNode } from \"react\";\nimport type { MediaUploadOptions } from \"../types\";\nimport { useMediaUpload } from \"../core/use-media-upload\";\nimport { cn } from \"./cn\";\nimport { UploadIcon } from \"./icons\";\nimport { UploadProgressList } from \"./upload-progress-list\";\nimport { useMediaDropzone } from \"./use-media-dropzone\";\n\nexport interface FileUploadDropzoneActions {\n openLocalPicker: () => void;\n uploadFiles: (files: File[]) => Promise<void>;\n}\n\nexport interface FileUploadDropzoneProps {\n /** Upload options forwarded to the client (published to the web, shown to, folder, metadata…). */\n uploadOptions?: MediaUploadOptions | undefined;\n /** Restrict accepted types (e.g. [\"image/*\"]). */\n accept?: string[] | undefined;\n /** Max size per file in bytes (UI-only; server enforces its own cap). */\n maxSize?: number | undefined;\n /** Enable paste from clipboard (images only). Defaults true. */\n enablePaste?: boolean | undefined;\n /** Rendering mode. */\n mode?: \"overlay\" | \"inline\" | undefined;\n /** Children render inside the drop surface. */\n children?:\n | ReactNode\n | ((actions: FileUploadDropzoneActions) => ReactNode)\n | undefined;\n className?: string | undefined;\n /** Host-shaped acquisition sources (Drive, local folder, existing files…). */\n actions?: ReactNode | undefined;\n /** Fires the moment an upload batch STARTS (before any network completes). */\n onUploadStart?: ((files: File[]) => void) | undefined;\n onUploaded?: ((fileIds: string[]) => void) | undefined;\n onError?: ((message: string) => void) | undefined;\n /** Reveal a finished file from the upload tray. */\n onOpenFile?: ((fileId: string) => void) | undefined;\n /** Optional window event name that opens the native file picker. */\n pickerEventName?: string | undefined;\n}\n\nexport function FileUploadDropzone({\n uploadOptions,\n accept,\n maxSize,\n enablePaste = true,\n mode = \"overlay\",\n children,\n className,\n actions,\n onUploadStart,\n onUploaded,\n onError,\n onOpenFile,\n pickerEventName,\n}: FileUploadDropzoneProps) {\n const { uploadMany, entries, clearEntry } = useMediaUpload();\n\n const handleUpload = useCallback(\n async (files: File[]) => {\n if (!files.length) return;\n try {\n onUploadStart?.(files);\n const { uploaded, failed } = await uploadMany(files, uploadOptions);\n if (uploaded.length && onUploaded) onUploaded(uploaded);\n if (failed.length && onError) {\n // Surface BOTH the file and the real backend reason — joining\n // objects rendered \"[object Object]\" to the user, hiding every\n // actual failure cause (CORS, 413, 401…).\n const message = failed.map((f) => `${f.name}: ${f.error}`).join(\"; \");\n onError(message);\n }\n } catch (err) {\n onError?.(err instanceof Error ? err.message : String(err));\n }\n },\n [uploadMany, uploadOptions, onUploadStart, onUploaded, onError],\n );\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n pasteHighlight,\n openPicker,\n } = useMediaDropzone({\n onFiles: (files) => void handleUpload(files),\n accept,\n maxSize,\n enablePaste,\n pickerEventName,\n });\n\n const highlighted = isDragActive || pasteHighlight;\n const renderedChildren =\n typeof children === \"function\"\n ? children({ openLocalPicker: openPicker, uploadFiles: handleUpload })\n : children;\n\n if (mode === \"inline\") {\n return (\n <div\n {...getRootProps()}\n className={cn(\n \"flex flex-col items-center justify-center gap-3 rounded-md border-2 border-dashed p-6\",\n \"text-sm text-muted-foreground\",\n highlighted ? \"border-primary bg-primary/5\" : \"border-border\",\n className,\n )}\n >\n <input {...getInputProps()} />\n <UploadIcon className=\"h-8 w-8\" width={32} height={32} aria-hidden=\"true\" />\n <div className=\"text-center\">\n <p>Drag & drop files here.</p>\n {enablePaste ? (\n <p className=\"text-xs mt-1 opacity-75\">\n You can also paste an image with ⌘V.\n </p>\n ) : null}\n </div>\n <button\n type=\"button\"\n onClick={openPicker}\n className=\"rounded-md border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent\"\n >\n Browse files\n </button>\n {actions}\n {entries.length > 0 ? (\n <UploadProgressList\n uploads={entries}\n onDismiss={clearEntry}\n onOpenFile={onOpenFile}\n className=\"w-full\"\n />\n ) : null}\n </div>\n );\n }\n\n return (\n <div\n {...getRootProps()}\n className={cn(\"relative h-full w-full\", className)}\n data-drop-active={highlighted ? \"true\" : undefined}\n >\n <input {...getInputProps()} />\n {renderedChildren}\n {highlighted ? (\n <div\n className=\"pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-md border-2 border-dashed border-primary bg-primary/10\"\n aria-live=\"polite\"\n >\n <div className=\"flex flex-col items-center gap-2 text-primary\">\n <UploadIcon className=\"h-10 w-10\" width={40} height={40} aria-hidden=\"true\" />\n <span className=\"font-medium\">Drop to upload</span>\n </div>\n </div>\n ) : null}\n {entries.length > 0 ? (\n <div className=\"absolute bottom-3 right-3 z-20 w-80 max-w-[90%]\">\n <UploadProgressList\n uploads={entries}\n onDismiss={clearEntry}\n onOpenFile={onOpenFile}\n />\n </div>\n ) : null}\n </div>\n );\n}\n","/**\n * src/core/use-media-upload.ts — the React-side upload primitive.\n *\n * Ported from matrx-frontend `handler/hooks/useFileUpload.ts` with two seam\n * inversions: the transport is `MediaClient.upload` (never touched directly),\n * and the multi-file pre-flight (SHA-256 dedup dialog) is the client's\n * optional `uploadMany` — when absent, the batch runs sequentially through\n * `upload` with per-file results.\n *\n * Additionally exposes a per-file `entries` tray state (name, size, bytes,\n * status) so the dropzone's UploadProgressList works without any app store —\n * the Redux `selectVisibleUploads` coupling of the original, inverted.\n */\n\nimport { useCallback, useRef, useState } from \"react\";\nimport type {\n MediaMultiUploadResult,\n MediaUploadOptions,\n MediaUploadResult,\n} from \"../types\";\nimport { useMediaClient } from \"./context\";\n\nexport interface MediaUploadProgress {\n loaded: number;\n total: number;\n ratio: number;\n}\n\nexport type MediaUploadEntryStatus = \"uploading\" | \"success\" | \"error\";\n\nexport interface MediaUploadEntry {\n id: string;\n fileName: string;\n fileSize: number;\n bytesUploaded: number;\n status: MediaUploadEntryStatus;\n error: string | null;\n fileId: string | null;\n completedAt: number | null;\n}\n\nexport interface UseMediaUploadResult {\n /** Upload one file/blob. Returns the durable identity. */\n upload: (\n file: File | Blob,\n opts?: MediaUploadOptions,\n ) => Promise<MediaUploadResult>;\n /**\n * Upload many files. Uses the client's `uploadMany` (host pre-flight /\n * dedup dialog) when implemented; otherwise a sequential per-file loop with\n * real per-file error messages.\n */\n uploadMany: (\n files: File[],\n opts?: MediaUploadOptions,\n ) => Promise<MediaMultiUploadResult>;\n uploading: boolean;\n progress: MediaUploadProgress | null;\n result: MediaUploadResult | null;\n error: Error | null;\n /** Live per-file tray entries for progress UI. */\n entries: MediaUploadEntry[];\n clearEntry: (id: string) => void;\n reset: () => void;\n}\n\nlet entrySeq = 0;\n\nexport function useMediaUpload(): UseMediaUploadResult {\n const client = useMediaClient();\n const [uploading, setUploading] = useState(false);\n const [progress, setProgress] = useState<MediaUploadProgress | null>(null);\n const [result, setResult] = useState<MediaUploadResult | null>(null);\n const [error, setError] = useState<Error | null>(null);\n const [entries, setEntries] = useState<MediaUploadEntry[]>([]);\n const activeCount = useRef(0);\n\n const patchEntry = useCallback(\n (id: string, patch: Partial<MediaUploadEntry>) => {\n setEntries((current) =>\n current.map((e) => (e.id === id ? { ...e, ...patch } : e)),\n );\n },\n [],\n );\n\n const upload = useCallback(\n async (\n file: File | Blob,\n opts: MediaUploadOptions = {},\n ): Promise<MediaUploadResult> => {\n const id = `up-${++entrySeq}`;\n const fileName =\n opts.fileName ?? (file instanceof File ? file.name : \"file\");\n setEntries((current) => [\n ...current,\n {\n id,\n fileName,\n fileSize: file.size,\n bytesUploaded: 0,\n status: \"uploading\",\n error: null,\n fileId: null,\n completedAt: null,\n },\n ]);\n activeCount.current += 1;\n setUploading(true);\n setError(null);\n setProgress(null);\n try {\n const uploaded = await client.upload(file, {\n ...opts,\n onProgress: (loaded, total) => {\n setProgress({ loaded, total, ratio: total > 0 ? loaded / total : 0 });\n patchEntry(id, { bytesUploaded: loaded });\n opts.onProgress?.(loaded, total);\n },\n });\n setResult(uploaded);\n patchEntry(id, {\n status: \"success\",\n fileId: uploaded.fileId,\n bytesUploaded: file.size,\n completedAt: Date.now(),\n });\n return uploaded;\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setError(e);\n patchEntry(id, {\n status: \"error\",\n error: e.message,\n completedAt: Date.now(),\n });\n throw e;\n } finally {\n activeCount.current -= 1;\n if (activeCount.current <= 0) setUploading(false);\n }\n },\n [client, patchEntry],\n );\n\n const uploadMany = useCallback(\n async (\n files: File[],\n opts: MediaUploadOptions = {},\n ): Promise<MediaMultiUploadResult> => {\n if (client.uploadMany) {\n activeCount.current += 1;\n setUploading(true);\n try {\n return await client.uploadMany(files, opts);\n } finally {\n activeCount.current -= 1;\n if (activeCount.current <= 0) setUploading(false);\n }\n }\n const uploaded: string[] = [];\n const failed: Array<{ name: string; error: string }> = [];\n for (const file of files) {\n try {\n const one = await upload(file, opts);\n uploaded.push(one.fileId);\n } catch (err) {\n // Surface BOTH the file and the real backend reason — joining\n // objects rendered \"[object Object]\" to the user in the original.\n failed.push({\n name: file.name,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n return { uploaded, failed, cancelled: false };\n },\n [client, upload],\n );\n\n const clearEntry = useCallback((id: string) => {\n setEntries((current) => current.filter((e) => e.id !== id));\n }, []);\n\n const reset = useCallback(() => {\n setResult(null);\n setError(null);\n setProgress(null);\n setEntries([]);\n }, []);\n\n return {\n upload,\n uploadMany,\n uploading,\n progress,\n result,\n error,\n entries,\n clearEntry,\n reset,\n };\n}\n","/**\n * src/react/upload-progress-list.tsx — the live upload tray.\n *\n * Verbatim behavior port of matrx-frontend\n * `FileUploadDropzone/UploadProgressList.tsx` with the Redux seams inverted:\n * entries come from `useMediaUpload().entries` (or any structurally equal\n * list) and dismissal is the injected `onDismiss` instead of a dispatched\n * `clearUpload`.\n *\n * Behavior: in-flight entries show a live progress bar + percentage;\n * successful entries persist with an \"Open\" affordance and auto-dismiss\n * after 10s — the timer pauses while the pointer is over the tray; failed\n * entries persist until manually dismissed.\n */\n\n\"use client\";\n\nimport { memo, useEffect, useRef, useState } from \"react\";\n// `formatFileSize` moved to `@ai-matrx/kit/format` on 2026-09-07 (duplication\n// census H1): it was hiding inside this React component, so six host twins\n// could only reach it by depending on the media React bundle to print a byte\n// count. Nothing is re-exported from here — import `@ai-matrx/kit/format`.\nimport { formatFileSize } from \"@ai-matrx/kit/format\";\nimport type { MediaUploadEntry } from \"../core/use-media-upload\";\nimport { cn } from \"./cn\";\nimport { FileIcon } from \"./file-icon\";\nimport {\n AlertCircleIcon,\n CheckCircle2Icon,\n ExternalLinkIcon,\n XIcon,\n} from \"./icons\";\n\n/** How long a successful upload lingers in the tray before auto-dismissing. */\nconst AUTO_DISMISS_MS = 10_000;\n\nexport interface UploadProgressListProps {\n uploads: MediaUploadEntry[];\n /** Remove an entry from the tray (wire to `useMediaUpload().clearEntry`). */\n onDismiss: (id: string) => void;\n /**\n * Reveal a finished file — opens the preview pane / scrolls the row.\n * When omitted, the \"Open\" affordance is hidden.\n */\n onOpenFile?: ((fileId: string) => void) | undefined;\n className?: string | undefined;\n}\n\nfunction UploadProgressListImpl({\n uploads,\n onDismiss,\n onOpenFile,\n className,\n}: UploadProgressListProps) {\n const [hovered, setHovered] = useState(false);\n\n const activeCount = uploads.filter((u) => u.status === \"uploading\").length;\n const successCount = uploads.filter((u) => u.status === \"success\").length;\n const errorCount = uploads.filter((u) => u.status === \"error\").length;\n\n // Auto-dismiss successful entries. The timer is paused (cleared) while the\n // pointer is over the tray so a user reaching for \"Open\" is never cut off.\n const timersRef = useRef<Map<string, ReturnType<typeof setTimeout>>>(\n new Map(),\n );\n const onDismissRef = useRef(onDismiss);\n onDismissRef.current = onDismiss;\n useEffect(() => {\n const timers = timersRef.current;\n if (hovered) {\n timers.forEach((t) => clearTimeout(t));\n timers.clear();\n return;\n }\n for (const u of uploads) {\n if (u.status !== \"success\") continue;\n if (timers.has(u.id)) continue;\n const elapsed = u.completedAt ? Date.now() - u.completedAt : 0;\n const remaining = Math.max(0, AUTO_DISMISS_MS - elapsed);\n const handle = setTimeout(() => {\n timers.delete(u.id);\n onDismissRef.current(u.id);\n }, remaining);\n timers.set(u.id, handle);\n }\n const liveSuccessIds = new Set(\n uploads.filter((u) => u.status === \"success\").map((u) => u.id),\n );\n for (const [id, handle] of timers) {\n if (!liveSuccessIds.has(id)) {\n clearTimeout(handle);\n timers.delete(id);\n }\n }\n }, [uploads, hovered]);\n\n useEffect(() => {\n const timers = timersRef.current;\n return () => {\n timers.forEach((t) => clearTimeout(t));\n timers.clear();\n };\n }, []);\n\n if (uploads.length === 0) return null;\n\n const headerLabel =\n activeCount > 0\n ? `Uploading ${activeCount} file${activeCount === 1 ? \"\" : \"s\"}…`\n : errorCount > 0 && successCount === 0\n ? `${errorCount} upload${errorCount === 1 ? \"\" : \"s\"} failed`\n : `Uploaded ${successCount} file${successCount === 1 ? \"\" : \"s\"}`;\n\n const completedIds = uploads\n .filter((u) => u.status === \"success\" || u.status === \"error\")\n .map((u) => u.id);\n\n return (\n <div\n className={cn(\n \"overflow-hidden rounded-lg border bg-background/95 shadow-lg backdrop-blur\",\n className,\n )}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n aria-label=\"Uploads\"\n >\n <div className=\"flex items-center justify-between gap-2 border-b bg-muted/40 px-3 py-1.5\">\n <span className=\"truncate text-xs font-medium text-foreground\">\n {headerLabel}\n </span>\n {completedIds.length > 0 ? (\n <button\n type=\"button\"\n onClick={() => {\n for (const id of completedIds) onDismiss(id);\n }}\n className=\"shrink-0 rounded px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n Clear\n </button>\n ) : null}\n </div>\n\n <ul className=\"max-h-72 space-y-1 overflow-y-auto p-2\">\n {uploads.map((u) => {\n const percent =\n u.fileSize > 0\n ? Math.min(100, Math.round((u.bytesUploaded / u.fileSize) * 100))\n : 0;\n const done = u.status === \"success\";\n const failed = u.status === \"error\";\n const canOpen = done && !!u.fileId && !!onOpenFile;\n return (\n <li\n key={u.id}\n className={cn(\n \"flex items-center gap-2 rounded-md px-2 py-1.5 text-xs\",\n canOpen && \"cursor-pointer hover:bg-accent/60\",\n )}\n onClick={\n canOpen ? () => onOpenFile(u.fileId as string) : undefined\n }\n >\n <FileIcon fileName={u.fileName} size={18} className=\"shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate font-medium text-foreground\">\n {u.fileName}\n </span>\n <span className=\"shrink-0 tabular-nums text-muted-foreground\">\n {failed ? \"Failed\" : done ? \"Done\" : `${percent}%`}\n </span>\n </div>\n {done ? null : (\n <div className=\"mt-1 h-1 w-full rounded bg-muted\">\n <div\n className={cn(\n \"h-1 rounded transition-all\",\n failed ? \"bg-destructive\" : \"bg-primary\",\n )}\n style={{ width: failed ? \"100%\" : `${percent}%` }}\n />\n </div>\n )}\n {failed && u.error ? (\n <p className=\"mt-0.5 truncate text-[10px] text-destructive\">\n {u.error}\n </p>\n ) : !done ? (\n <p className=\"mt-0.5 text-[10px] text-muted-foreground\">\n {formatFileSize(u.bytesUploaded)} /{\" \"}\n {formatFileSize(u.fileSize)}\n </p>\n ) : null}\n </div>\n\n {canOpen ? (\n <span className=\"flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-primary\">\n <ExternalLinkIcon className=\"h-3 w-3\" width={12} height={12} />\n Open\n </span>\n ) : done ? (\n <CheckCircle2Icon\n className=\"h-4 w-4 shrink-0 text-emerald-500\"\n width={16}\n height={16}\n />\n ) : failed ? (\n <AlertCircleIcon\n className=\"h-4 w-4 shrink-0 text-destructive\"\n width={16}\n height={16}\n />\n ) : null}\n\n {done || failed ? (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onDismiss(u.id);\n }}\n aria-label=\"Dismiss\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <XIcon className=\"h-3 w-3\" width={12} height={12} />\n </button>\n ) : null}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n\nexport const UploadProgressList = memo(UploadProgressListImpl);\n","/**\n * src/react/media-action-toolbar.tsx — THE SHARE MANDATE's toolbar shell.\n *\n * A headless-driven action strip (share / download / copy / open) wired to\n * the host's injected {@link MediaActionsPort} through `useMediaActions`.\n * FAILS CLOSED: an action without a handler renders disabled (or hidden with\n * `hideUnavailable`); nothing here mints a URL.\n *\n * The share action opens the injected `SharePopover` body when the port\n * provides one (the slot the associations package fills — mandated wave),\n * otherwise it runs the port's quick `share` handler.\n */\n\n\"use client\";\n\nimport { useState, type ComponentType } from \"react\";\nimport type {\n MediaActionKind,\n MediaRefLike,\n MediaSharePopoverProps,\n} from \"../types\";\nimport { useMediaActions } from \"../core/use-media-actions\";\nimport { cn } from \"./cn\";\nimport {\n CopyIcon,\n DownloadIcon,\n ExternalLinkIcon,\n Share2Icon,\n type MediaIconProps,\n} from \"./icons\";\n\nconst ACTION_META: Record<\n MediaActionKind,\n { label: string; Icon: (props: MediaIconProps) => ReturnType<typeof CopyIcon> }\n> = {\n share: { label: \"Share\", Icon: Share2Icon },\n download: { label: \"Download\", Icon: DownloadIcon },\n copy: { label: \"Copy\", Icon: CopyIcon },\n open: { label: \"Open\", Icon: ExternalLinkIcon },\n};\n\nconst DEFAULT_ORDER: MediaActionKind[] = [\"share\", \"download\", \"copy\", \"open\"];\n\nexport interface MediaActionToolbarProps {\n mediaRef: MediaRefLike | null | undefined;\n fileName?: string | undefined;\n alt?: string | undefined;\n /** Which actions to render, in order. Default: share, download, copy, open. */\n actions?: MediaActionKind[] | undefined;\n /** Hide unavailable actions instead of rendering them disabled. */\n hideUnavailable?: boolean | undefined;\n className?: string | undefined;\n buttonClassName?: string | undefined;\n}\n\nexport function MediaActionToolbar({\n mediaRef,\n fileName,\n alt,\n actions = DEFAULT_ORDER,\n hideUnavailable = false,\n className,\n buttonClassName,\n}: MediaActionToolbarProps) {\n const state = useMediaActions(mediaRef, { fileName, alt });\n const [shareOpen, setShareOpen] = useState(false);\n\n const SharePopover = state.SharePopover as\n | ComponentType<MediaSharePopoverProps>\n | null;\n\n const visible = hideUnavailable\n ? actions.filter((kind) => state.isAvailable(kind))\n : actions;\n\n if (visible.length === 0) return null;\n\n return (\n <div className={cn(\"relative inline-flex items-center gap-1\", className)}>\n {visible.map((kind) => {\n const { label, Icon } = ACTION_META[kind];\n const available = state.isAvailable(kind);\n const busy = state.busy === kind;\n return (\n <button\n key={kind}\n type=\"button\"\n aria-label={label}\n title={label}\n disabled={!available || busy}\n onClick={() => {\n if (kind === \"share\" && SharePopover) {\n setShareOpen((open) => !open);\n return;\n }\n void state.run(kind);\n }}\n className={cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors\",\n available\n ? \"hover:bg-accent hover:text-foreground\"\n : \"opacity-40 cursor-not-allowed\",\n busy && \"animate-pulse\",\n buttonClassName,\n )}\n >\n <Icon className=\"h-4 w-4\" width={16} height={16} />\n </button>\n );\n })}\n {state.lastError ? (\n <span\n role=\"status\"\n className=\"ml-1 max-w-48 truncate text-[11px] text-destructive\"\n title={state.lastError.message}\n >\n {ACTION_META[state.lastError.kind].label} failed\n </span>\n ) : null}\n {shareOpen && SharePopover && state.context ? (\n <div className=\"absolute right-0 top-full z-30 mt-1\">\n <SharePopover\n context={state.context}\n onClose={() => setShareOpen(false)}\n />\n </div>\n ) : null}\n </div>\n );\n}\n","/**\n * src/core/use-media-actions.ts — THE SHARE MANDATE's headless engine.\n *\n * Wires a MediaRefLike to the host's injected {@link MediaActionsPort}\n * (share / download / copy / open + the SharePopover slot the associations\n * package fills). FAILS CLOSED: with no port — or no handler for a given\n * action — the action reports unavailable and the shells render it disabled.\n * Nothing here mints URLs; handlers reach bytes/links only through the\n * MediaClient they close over.\n */\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport type {\n MediaActionContext,\n MediaActionKind,\n MediaRefLike,\n MediaSharePopoverProps,\n MediaSlotComponent,\n} from \"../types\";\nimport { useMediaHostPorts } from \"./context\";\nimport { useMediaResolution } from \"./use-media-resolution\";\n\nexport interface UseMediaActionsOptions {\n fileName?: string | undefined;\n alt?: string | undefined;\n}\n\nexport interface MediaActionsState {\n /** Null when no ref was supplied. */\n context: MediaActionContext | null;\n /** True when the host wired a handler for this action (share also counts the popover). */\n isAvailable: (kind: MediaActionKind) => boolean;\n /** Run an action. No-op (resolved) when unavailable. */\n run: (kind: MediaActionKind) => Promise<void>;\n /** The action currently executing, or null. */\n busy: MediaActionKind | null;\n /** Last handler failure, surfaced as state for the shell to render. */\n lastError: { kind: MediaActionKind; message: string } | null;\n /** The rich share body slot (associations package), when injected. */\n SharePopover: MediaSlotComponent<MediaSharePopoverProps> | null;\n}\n\nexport function useMediaActions(\n ref: MediaRefLike | null | undefined,\n options: UseMediaActionsOptions = {},\n): MediaActionsState {\n const ports = useMediaHostPorts();\n const { resolution } = useMediaResolution(ref);\n const [busy, setBusy] = useState<MediaActionKind | null>(null);\n const [lastError, setLastError] = useState<{\n kind: MediaActionKind;\n message: string;\n } | null>(null);\n\n const actions = ports.actions;\n const { fileName, alt } = options;\n\n const context = useMemo<MediaActionContext | null>(() => {\n if (!ref) return null;\n return { ref, resolution, fileName, alt };\n }, [ref, resolution, fileName, alt]);\n\n const isAvailable = useCallback(\n (kind: MediaActionKind): boolean => {\n if (!context || !actions) return false;\n if (kind === \"share\") return Boolean(actions.share || actions.SharePopover);\n return Boolean(actions[kind]);\n },\n [context, actions],\n );\n\n const run = useCallback(\n async (kind: MediaActionKind): Promise<void> => {\n if (!context || !actions) return;\n const handler = actions[kind];\n if (!handler) return;\n setBusy(kind);\n setLastError(null);\n try {\n await handler(context);\n } catch (err) {\n setLastError({\n kind,\n message: err instanceof Error ? err.message : String(err),\n });\n } finally {\n setBusy(null);\n }\n },\n [context, actions],\n );\n\n return {\n context,\n isAvailable,\n run,\n busy,\n lastError,\n SharePopover: actions?.SharePopover ?? null,\n };\n}\n","/**\n * src/react/media-lightbox.tsx — THE SHARE MANDATE's lightbox shell.\n *\n * Full-viewport media viewer: backdrop, Escape/backdrop-click close, the\n * media rendered through `InlineMediaRef` (durable refs only — no `src`\n * lane exists), and the `MediaActionToolbar` wired to the host's injected\n * actions port. The rich share body arrives through the same\n * `SharePopover` slot (associations package — mandated wave); until a host\n * injects handlers, every action renders disabled (fails closed).\n */\n\n\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport type { DurableSrc, MediaActionKind, MediaRefLike } from \"../types\";\nimport { cn } from \"./cn\";\nimport { InlineMediaRef } from \"./inline-media-ref\";\nimport { MediaActionToolbar } from \"./media-action-toolbar\";\nimport { XIcon } from \"./icons\";\n\nexport interface MediaLightboxProps {\n open: boolean;\n onClose: () => void;\n mediaRef: MediaRefLike | null | undefined;\n fileName?: string | undefined;\n alt?: string | undefined;\n /** Force the media element type (default: inferred from the resolution). */\n as?: \"img\" | \"video\" | \"audio\" | undefined;\n /** Start video/audio playback on open — forwarded to the media element. */\n autoPlay?: boolean | undefined;\n /** Inline (non-fullscreen-hijack) playback on iOS — forwarded to `<video>`. */\n playsInline?: boolean | undefined;\n /**\n * Poster frame for video — the branded {@link DurableSrc} only (law 3),\n * resolved/minted by the host exactly like the element src.\n */\n poster?: DurableSrc | undefined;\n /**\n * Playback-session label reported to the host's `playbackSession` port\n * while the media plays (e.g. \"Video (fullscreen)\"). Rides the existing\n * port — no new playback lane.\n */\n playbackLabel?: string | undefined;\n /** Toolbar actions to offer. Default: share, download, copy, open. */\n actions?: MediaActionKind[] | undefined;\n /** Hide unavailable toolbar actions instead of disabling them. */\n hideUnavailableActions?: boolean | undefined;\n /** Extra chrome rendered in the header row (left of the toolbar). */\n headerExtra?: ReactNode | undefined;\n className?: string | undefined;\n}\n\nexport function MediaLightbox({\n open,\n onClose,\n mediaRef,\n fileName,\n alt,\n as,\n autoPlay,\n playsInline,\n poster,\n playbackLabel,\n actions,\n hideUnavailableActions = false,\n headerExtra,\n className,\n}: MediaLightboxProps) {\n useEffect(() => {\n if (!open || typeof window === \"undefined\") return undefined;\n const handler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n onClose();\n }\n };\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n }, [open, onClose]);\n\n if (!open) return null;\n\n return (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={fileName ?? alt ?? \"Media viewer\"}\n className={cn(\n \"fixed inset-0 z-50 flex flex-col bg-black/80 backdrop-blur-sm\",\n className,\n )}\n onClick={onClose}\n >\n <div\n className=\"flex items-center justify-between gap-2 p-3\"\n onClick={(event) => event.stopPropagation()}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"truncate text-sm font-medium text-white/90\">\n {fileName ?? alt ?? \"\"}\n </span>\n {headerExtra}\n </div>\n <div className=\"flex items-center gap-1\">\n <MediaActionToolbar\n mediaRef={mediaRef}\n fileName={fileName}\n alt={alt}\n actions={actions}\n hideUnavailable={hideUnavailableActions}\n buttonClassName=\"text-white/80 hover:bg-white/10 hover:text-white\"\n />\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 transition-colors hover:bg-white/10 hover:text-white\"\n >\n <XIcon className=\"h-4 w-4\" width={16} height={16} />\n </button>\n </div>\n </div>\n <div\n className=\"flex min-h-0 flex-1 items-center justify-center p-4\"\n onClick={(event) => event.stopPropagation()}\n >\n <div className=\"h-full w-full\">\n <InlineMediaRef\n ref={mediaRef}\n size=\"fill\"\n fit=\"contain\"\n rounded=\"none\"\n alt={alt ?? fileName ?? \"\"}\n as={as}\n autoPlay={autoPlay}\n playsInline={playsInline}\n poster={poster}\n playbackLabel={playbackLabel}\n />\n </div>\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * ReadAloudButton — THE read-aloud (speaker) control for every client. Presentational: the host's\n * speech engine owns the audio and reports `status`; this draws the one look for each state and\n * calls `onPress` (the host maps it to speak / pause / resume / stop).\n *\n * States: idle → speaker · loading → speaker, disabled, \"Connecting…\" · playing → pause ·\n * paused → speaker, \"Resume\" · error → warning, the host's sentence as its label (cleared by the\n * host on the next press).\n */\n\nimport { PauseTapButton, TriangleAlertTapButton, Volume2TapButton } from \"@ai-matrx/tap-target/buttons\";\nimport type { ComponentProps } from \"react\";\n\nexport type ReadAloudStatus = \"idle\" | \"loading\" | \"playing\" | \"paused\" | \"error\";\n\ntype TapVariant = ComponentProps<typeof Volume2TapButton>[\"variant\"];\n\nexport interface ReadAloudButtonProps {\n status: ReadAloudStatus;\n onPress: () => void;\n /** The host's sentence for the person when `status` is \"error\". */\n error?: string | null;\n /** Nothing to read (empty text) or the host forbids it right now. */\n disabled?: boolean;\n variant?: TapVariant;\n className?: string;\n /** Label for the idle state. Default \"Read aloud\". */\n label?: string;\n}\n\nexport function ReadAloudButton({\n status,\n onPress,\n error,\n disabled = false,\n variant,\n className,\n label = \"Read aloud\",\n}: ReadAloudButtonProps) {\n if (status === \"playing\") {\n return <PauseTapButton variant={variant} onClick={onPress} disabled={disabled} ariaLabel=\"Pause\" className={className} />;\n }\n if (status === \"error\") {\n return (\n <TriangleAlertTapButton\n variant={variant}\n onClick={onPress}\n disabled={disabled}\n ariaLabel={error || \"Read aloud failed. Press to try again.\"}\n className={className}\n />\n );\n }\n const loading = status === \"loading\";\n return (\n <Volume2TapButton\n variant={variant}\n onClick={onPress}\n disabled={disabled || loading}\n ariaLabel={loading ? \"Connecting…\" : status === \"paused\" ? \"Resume\" : label}\n className={className}\n />\n );\n}\n","\"use client\";\n\n/**\n * ReadAloudLanguagePicker — the quick \"which language should the voice speak\" control\n * (icon button → list in each language's own name). Controlled: the host stores the choice.\n */\n\nimport { Button, Popover, PopoverContent, PopoverTrigger } from \"@ai-matrx/design-system\";\nimport { Check, Languages } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { READ_ALOUD_LANGUAGES, readAloudLanguage } from \"../voices/read-aloud-languages\";\nimport { cn } from \"./cn\";\n\nexport interface ReadAloudLanguagePickerProps {\n value: string;\n onChange: (code: string) => void;\n className?: string;\n}\n\nexport function ReadAloudLanguagePicker({ value, onChange, className }: ReadAloudLanguagePickerProps) {\n const [open, setOpen] = useState(false);\n const selected = readAloudLanguage(value);\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-7 text-muted-foreground\", className)}\n title={`Voice language: ${selected.englishName}`}\n aria-label={`Voice language, currently ${selected.englishName}`}\n >\n <Languages className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"max-h-80 w-56 overflow-y-auto p-1\" align=\"end\">\n <div className=\"px-2.5 py-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n Voice language\n </div>\n {READ_ALOUD_LANGUAGES.map((option) => {\n const isSelected = option.code === selected.code;\n return (\n <button\n key={option.code}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={isSelected}\n onClick={() => {\n onChange(option.code);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-accent\",\n isSelected && \"bg-accent\",\n )}\n >\n <span className=\"min-w-0 flex-1\">\n <span className=\"block text-sm\">{option.nativeName}</span>\n {option.nativeName !== option.englishName ? (\n <span className=\"block text-[11px] text-muted-foreground\">{option.englishName}</span>\n ) : null}\n </span>\n {isSelected ? <Check className=\"size-3.5 shrink-0 text-primary\" /> : null}\n </button>\n );\n })}\n </PopoverContent>\n </Popover>\n );\n}\n","/**\n * The languages read-aloud offers, with each language's own name — the union of the website's\n * voice-language setting and the extension's quick picker (which added Persian).\n */\nexport interface ReadAloudLanguage {\n code: string;\n englishName: string;\n nativeName: string;\n}\n\nexport const READ_ALOUD_LANGUAGES: readonly ReadAloudLanguage[] = [\n { code: \"en\", englishName: \"English\", nativeName: \"English\" },\n { code: \"es\", englishName: \"Spanish\", nativeName: \"Español\" },\n { code: \"fr\", englishName: \"French\", nativeName: \"Français\" },\n { code: \"de\", englishName: \"German\", nativeName: \"Deutsch\" },\n { code: \"it\", englishName: \"Italian\", nativeName: \"Italiano\" },\n { code: \"pt\", englishName: \"Portuguese\", nativeName: \"Português\" },\n { code: \"zh\", englishName: \"Chinese\", nativeName: \"中文\" },\n { code: \"ja\", englishName: \"Japanese\", nativeName: \"日本語\" },\n { code: \"ko\", englishName: \"Korean\", nativeName: \"한국어\" },\n { code: \"ru\", englishName: \"Russian\", nativeName: \"Русский\" },\n { code: \"hi\", englishName: \"Hindi\", nativeName: \"हिन्दी\" },\n { code: \"nl\", englishName: \"Dutch\", nativeName: \"Nederlands\" },\n { code: \"pl\", englishName: \"Polish\", nativeName: \"Polski\" },\n { code: \"sv\", englishName: \"Swedish\", nativeName: \"Svenska\" },\n { code: \"tr\", englishName: \"Turkish\", nativeName: \"Türkçe\" },\n { code: \"fa\", englishName: \"Persian\", nativeName: \"فارسی\" },\n];\n\n/** The language for `code`, or English when the code is not offered. */\nexport function readAloudLanguage(code: string | null | undefined): ReadAloudLanguage {\n return READ_ALOUD_LANGUAGES.find((l) => l.code === code) ?? READ_ALOUD_LANGUAGES[0]!;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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jsx_runtime","FileIcon","import_react","import_react","import_react","import_react","import_react","import_react","import_jsx_runtime","import_react","import_react","import_jsx_runtime","FileIcon","import_react","import_react","import_react","import_react","import_jsx_runtime","FileIcon","import_jsx_runtime","import_react","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime"]}
|