@ai-matrx/media 0.5.9 → 0.5.11

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/dist/viewers.cjs CHANGED
@@ -430,7 +430,10 @@ function latch() {
430
430
  }
431
431
  function failureMediaIdentity(ref, src) {
432
432
  if (ref && typeof ref === "object" && ref.file_id) return `file:${ref.file_id}`;
433
- const raw = typeof ref === "string" ? ref : (ref && typeof ref === "object" ? ref.url ?? null : null) ?? src ?? null;
433
+ let raw;
434
+ if (typeof ref === "string") raw = ref;
435
+ else if (ref && typeof ref === "object" && ref.url) raw = ref.url;
436
+ else raw = src;
434
437
  if (!raw) return "<unknown-media>";
435
438
  if (raw.startsWith("blob:")) return "blob:object-url";
436
439
  try {
@@ -1330,6 +1333,7 @@ function SvgSourceView({ source, maxBytes = 1024 * 1024 }) {
1330
1333
  }
1331
1334
 
1332
1335
  // src/viewers/text-viewer.tsx
1336
+ var import_format3 = require("@ai-matrx/kit/format");
1333
1337
  var import_jsx_runtime9 = require("react/jsx-runtime");
1334
1338
  function TextViewer({
1335
1339
  source,
@@ -1347,7 +1351,7 @@ function TextViewer({
1347
1351
  className: cn("flex h-full w-full flex-col overflow-hidden", className),
1348
1352
  children: [
1349
1353
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ViewerToolbar, { children: [
1350
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: truncated ? `Preview ${truncationNote(maxBytes)}.` : `${text.length.toLocaleString()} characters` }),
1354
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: truncated ? `Preview ${truncationNote(maxBytes)}.` : `${(0, import_format3.formatCount)(text.length)} characters` }),
1351
1355
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ViewerCopyButton, { text })
1352
1356
  ] }),
1353
1357
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { className: "flex-1 overflow-auto bg-background p-3 font-mono text-xs leading-5 break-words whitespace-pre-wrap", children: text })