@adoptai/genui-components 0.1.67 → 0.1.69

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.
Files changed (32) hide show
  1. package/dist/composites/document-preview/PdfViewer.d.ts +2 -1
  2. package/dist/composites/document-preview/PdfViewer.d.ts.map +1 -1
  3. package/dist/composites/document-preview/resolver.cjs +90 -11
  4. package/dist/composites/document-preview/resolver.cjs.map +1 -1
  5. package/dist/composites/document-preview/resolver.d.ts.map +1 -1
  6. package/dist/composites/document-preview/resolver.js +90 -11
  7. package/dist/composites/document-preview/resolver.js.map +1 -1
  8. package/dist/composites/download-card/resolver.cjs +244 -69
  9. package/dist/composites/download-card/resolver.cjs.map +1 -1
  10. package/dist/composites/download-card/resolver.js +189 -14
  11. package/dist/composites/download-card/resolver.js.map +1 -1
  12. package/dist/index.cjs +472 -289
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.js +265 -82
  15. package/dist/index.js.map +1 -1
  16. package/dist/renderer.cjs +404 -221
  17. package/dist/renderer.cjs.map +1 -1
  18. package/dist/renderer.js +259 -76
  19. package/dist/renderer.js.map +1 -1
  20. package/dist/resolver.cjs +403 -220
  21. package/dist/resolver.cjs.map +1 -1
  22. package/dist/resolver.js +259 -76
  23. package/dist/resolver.js.map +1 -1
  24. package/dist/shared/fileType.d.ts +1 -1
  25. package/dist/shared/fileType.d.ts.map +1 -1
  26. package/dist/shared/viewers/HtmlViewer.d.ts +12 -0
  27. package/dist/shared/viewers/HtmlViewer.d.ts.map +1 -0
  28. package/dist/shared/viewers/PreviewHost.d.ts.map +1 -1
  29. package/dist/shared/viewers/pdfWorkerProbe.d.ts +31 -0
  30. package/dist/shared/viewers/pdfWorkerProbe.d.ts.map +1 -0
  31. package/dist/tool-definitions.json +2 -2
  32. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React45, { lazy, createContext, useMemo, useContext, useState, useCallback, useEffect, useRef, useLayoutEffect, Suspense } from 'react';
2
+ import React46, { lazy, createContext, useMemo, useContext, useState, useCallback, useEffect, useRef, useLayoutEffect, Suspense } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import dagre from '@dagrejs/dagre';
5
5
  import { createPortal } from 'react-dom';
@@ -1271,13 +1271,74 @@ var init_FlowGraph = __esm({
1271
1271
  renderSeq = 0;
1272
1272
  }
1273
1273
  });
1274
+ function resolvePdfWorkerSrc(pdfjs2) {
1275
+ const override = typeof window !== "undefined" ? window.__GENUI_PDF_WORKER_SRC__ : void 0;
1276
+ const current = pdfjs2.GlobalWorkerOptions.workerSrc;
1277
+ const isConfigured = !!current && current !== "pdf.worker.mjs";
1278
+ if (override) {
1279
+ pdfjs2.GlobalWorkerOptions.workerSrc = override;
1280
+ } else if (!isConfigured) {
1281
+ pdfjs2.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${pdfjs2.version}/build/pdf.worker.min.mjs`;
1282
+ }
1283
+ return pdfjs2.GlobalWorkerOptions.workerSrc;
1284
+ }
1285
+ function probePdfWorker() {
1286
+ if (probe) return probe;
1287
+ probe = (async () => {
1288
+ if (typeof window === "undefined") return false;
1289
+ try {
1290
+ const { pdfjs: pdfjs2 } = await import('react-pdf');
1291
+ resolvePdfWorkerSrc(pdfjs2);
1292
+ const task = pdfjs2.getDocument({ data: new TextEncoder().encode(TINY_PDF) });
1293
+ const doc = await Promise.race([
1294
+ task.promise,
1295
+ new Promise(
1296
+ (_, reject) => setTimeout(() => reject(new Error("pdf worker probe timed out")), PROBE_TIMEOUT_MS)
1297
+ )
1298
+ ]);
1299
+ await doc.destroy();
1300
+ return true;
1301
+ } catch (e) {
1302
+ probe = null;
1303
+ return false;
1304
+ }
1305
+ })();
1306
+ return probe;
1307
+ }
1308
+ function usePdfWorkerReady(enabled) {
1309
+ const [ready, setReady] = useState(null);
1310
+ useEffect(() => {
1311
+ if (!enabled) return;
1312
+ let cancelled = false;
1313
+ probePdfWorker().then((ok) => {
1314
+ if (!cancelled) setReady(ok);
1315
+ });
1316
+ return () => {
1317
+ cancelled = true;
1318
+ };
1319
+ }, [enabled]);
1320
+ return enabled ? ready : null;
1321
+ }
1322
+ var TINY_PDF, PROBE_TIMEOUT_MS, probe;
1323
+ var init_pdfWorkerProbe = __esm({
1324
+ "src/shared/viewers/pdfWorkerProbe.ts"() {
1325
+ "use client";
1326
+ TINY_PDF = `%PDF-1.1
1327
+ 1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj
1328
+ 2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj
1329
+ 3 0 obj<</Type/Page/Parent 2 0 R/MediaBox[0 0 3 3]>>endobj
1330
+ trailer<</Root 1 0 R>>`;
1331
+ PROBE_TIMEOUT_MS = 5e3;
1332
+ probe = null;
1333
+ }
1334
+ });
1274
1335
 
1275
1336
  // src/composites/document-preview/PdfViewer.tsx
1276
1337
  var PdfViewer_exports = {};
1277
1338
  __export(PdfViewer_exports, {
1278
1339
  PdfViewer: () => PdfViewer
1279
1340
  });
1280
- function PdfViewer({ url, base64, onLoadSuccess }) {
1341
+ function PdfViewer({ url, base64, onLoadSuccess, onLoadError }) {
1281
1342
  const { BORDER: BORDER3, MUTED: MUTED2, SURFACE: SURFACE2 } = useTheme();
1282
1343
  const [numPages, setNumPages] = useState(0);
1283
1344
  const [currentPage, setCurrentPage] = useState(1);
@@ -1357,23 +1418,34 @@ function PdfViewer({ url, base64, onLoadSuccess }) {
1357
1418
  ] }),
1358
1419
  /* @__PURE__ */ jsxs("div", { style: { overflow: "auto", width: "100%", display: "flex", justifyContent: "center", padding: "16px" }, children: [
1359
1420
  loading && /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "200px", color: MUTED2, fontSize: "13px" }, children: "Loading PDF..." }),
1360
- /* @__PURE__ */ jsx(Document, { file: base64 ? `data:application/pdf;base64,${base64}` : url, onLoadSuccess: handleLoad, loading: "", children: /* @__PURE__ */ jsx(
1361
- Page,
1421
+ /* @__PURE__ */ jsx(
1422
+ Document,
1362
1423
  {
1363
- pageNumber: currentPage,
1364
- width: 540,
1365
- renderTextLayer: true,
1366
- renderAnnotationLayer: true
1424
+ file: base64 ? `data:application/pdf;base64,${base64}` : url,
1425
+ onLoadSuccess: handleLoad,
1426
+ onLoadError,
1427
+ loading: "",
1428
+ error: "",
1429
+ children: /* @__PURE__ */ jsx(
1430
+ Page,
1431
+ {
1432
+ pageNumber: currentPage,
1433
+ width: 540,
1434
+ renderTextLayer: true,
1435
+ renderAnnotationLayer: true
1436
+ }
1437
+ )
1367
1438
  }
1368
- ) })
1439
+ )
1369
1440
  ] })
1370
1441
  ] });
1371
1442
  }
1372
1443
  var init_PdfViewer = __esm({
1373
1444
  "src/composites/document-preview/PdfViewer.tsx"() {
1374
1445
  "use client";
1446
+ init_pdfWorkerProbe();
1375
1447
  init_ThemeContext();
1376
- pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
1448
+ resolvePdfWorkerSrc(pdfjs);
1377
1449
  }
1378
1450
  });
1379
1451
 
@@ -1880,6 +1952,89 @@ var init_DocxViewer = __esm({
1880
1952
  }
1881
1953
  });
1882
1954
 
1955
+ // src/shared/viewers/HtmlViewer.tsx
1956
+ var HtmlViewer_exports = {};
1957
+ __export(HtmlViewer_exports, {
1958
+ HtmlViewer: () => HtmlViewer
1959
+ });
1960
+ function HtmlViewer({ url, base64, height = 480 }) {
1961
+ const { MUTED: MUTED2 } = useTheme();
1962
+ const [html, setHtml] = useState("");
1963
+ const [loading, setLoading] = useState(true);
1964
+ const [error, setError] = useState(null);
1965
+ useEffect(() => {
1966
+ let cancelled = false;
1967
+ setLoading(true);
1968
+ setError(null);
1969
+ if (base64) {
1970
+ try {
1971
+ if (!cancelled) {
1972
+ setHtml(base64ToText(base64));
1973
+ setLoading(false);
1974
+ }
1975
+ } catch (e) {
1976
+ if (!cancelled) {
1977
+ setError(e instanceof Error ? e.message : "Failed to decode HTML");
1978
+ setLoading(false);
1979
+ }
1980
+ }
1981
+ return () => {
1982
+ cancelled = true;
1983
+ };
1984
+ }
1985
+ if (!url) {
1986
+ setError("No file source provided");
1987
+ setLoading(false);
1988
+ return () => {
1989
+ cancelled = true;
1990
+ };
1991
+ }
1992
+ fetch(url).then((r) => {
1993
+ if (!r.ok) throw new Error(`Failed to fetch: ${r.status}`);
1994
+ return r.text();
1995
+ }).then((t) => {
1996
+ if (cancelled) return;
1997
+ setHtml(t);
1998
+ setLoading(false);
1999
+ }).catch((e) => {
2000
+ if (cancelled) return;
2001
+ setError(e.message);
2002
+ setLoading(false);
2003
+ });
2004
+ return () => {
2005
+ cancelled = true;
2006
+ };
2007
+ }, [url, base64]);
2008
+ if (loading) {
2009
+ return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: MUTED2, fontSize: "13px", textAlign: "center" }, children: "Loading\u2026" });
2010
+ }
2011
+ if (error) {
2012
+ return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: "#dc2626", fontSize: "13px", textAlign: "center" }, children: error });
2013
+ }
2014
+ return /* @__PURE__ */ jsx(
2015
+ "iframe",
2016
+ {
2017
+ title: "HTML preview",
2018
+ sandbox: "",
2019
+ srcDoc: html,
2020
+ style: {
2021
+ width: "100%",
2022
+ height: `${height}px`,
2023
+ border: "none",
2024
+ background: "white",
2025
+ display: "block"
2026
+ }
2027
+ }
2028
+ );
2029
+ }
2030
+ var init_HtmlViewer = __esm({
2031
+ "src/shared/viewers/HtmlViewer.tsx"() {
2032
+ "use client";
2033
+ init_ThemeContext();
2034
+ init_decode();
2035
+ }
2036
+ });
2037
+
1883
2038
  // src/index.ts
1884
2039
  init_ThemeContext();
1885
2040
  var dataTableSchema = z.object({
@@ -7369,7 +7524,7 @@ function WaterfallChartResolver(p) {
7369
7524
  }
7370
7525
  init_ThemeContext();
7371
7526
  init_theme();
7372
- var FlowGraph2 = React45.lazy(
7527
+ var FlowGraph2 = React46.lazy(
7373
7528
  () => Promise.resolve().then(() => (init_FlowGraph(), FlowGraph_exports)).then((m) => ({ default: m.FlowGraph }))
7374
7529
  );
7375
7530
  function FlowCanvasRenderer({
@@ -7645,7 +7800,7 @@ function TrialBalanceResolver(p) {
7645
7800
  gDebit += a.debit;
7646
7801
  gCredit += a.credit;
7647
7802
  });
7648
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
7803
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
7649
7804
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 4, style: {
7650
7805
  padding: "8px 12px",
7651
7806
  fontSize: "12px",
@@ -9036,10 +9191,11 @@ function useFullscreen(ref) {
9036
9191
  // src/composites/document-preview/resolver.tsx
9037
9192
  init_theme();
9038
9193
  init_ThemeContext();
9039
- var PdfViewer2 = React45.lazy(
9194
+ init_pdfWorkerProbe();
9195
+ var PdfViewer2 = React46.lazy(
9040
9196
  () => Promise.resolve().then(() => (init_PdfViewer(), PdfViewer_exports)).then((m) => ({ default: m.PdfViewer }))
9041
9197
  );
9042
- var ExcelViewer2 = React45.lazy(
9198
+ var ExcelViewer2 = React46.lazy(
9043
9199
  () => Promise.resolve().then(() => (init_ExcelViewer(), ExcelViewer_exports)).then((m) => ({ default: m.ExcelViewer }))
9044
9200
  );
9045
9201
  var highlightColors = {
@@ -9099,8 +9255,14 @@ function DocumentPreviewResolver(p) {
9099
9255
  const totalPages = ((_c = p.pages) != null ? _c : []).length;
9100
9256
  const page = p.pages[currentPage];
9101
9257
  const pageHighlights = ((_d = p.highlights) != null ? _d : []).filter((h) => h.pageIndex === currentPage);
9258
+ const [pdfFailed, setPdfFailed] = useState(false);
9259
+ const pdfWorkerReady = usePdfWorkerReady(hasRealFile && isPdf);
9260
+ const pdfReady = pdfFailed ? false : pdfWorkerReady;
9261
+ const showPdfViewer = hasRealFile && isPdf && pdfReady === true;
9262
+ const pdfPending = hasRealFile && isPdf && pdfReady === null;
9102
9263
  const handlePdfLoad = useCallback(() => {
9103
9264
  }, []);
9265
+ const handlePdfError = useCallback(() => setPdfFailed(true), []);
9104
9266
  const handleExcelLoad = useCallback(() => {
9105
9267
  }, []);
9106
9268
  return /* @__PURE__ */ jsx(ComponentActions, { filename: (_e = p.title) != null ? _e : "document-preview", children: /* @__PURE__ */ jsxs(
@@ -9194,7 +9356,7 @@ function DocumentPreviewResolver(p) {
9194
9356
  children: pg.label
9195
9357
  },
9196
9358
  i
9197
- )) }) : !hasRealFile && totalPages > 1 && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "6px 14px", borderLeft: `1px solid ${BORDER3}`, borderRight: `1px solid ${BORDER3}`, background: SURFACE2 }, children: [
9359
+ )) }) : (!hasRealFile || pdfReady === false) && totalPages > 1 && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "6px 14px", borderLeft: `1px solid ${BORDER3}`, borderRight: `1px solid ${BORDER3}`, background: SURFACE2 }, children: [
9198
9360
  /* @__PURE__ */ jsx("button", { onClick: () => setCurrentPage(Math.max(0, currentPage - 1)), disabled: currentPage === 0, style: { border: `1px solid ${BORDER3}`, borderRadius: "4px", padding: "2px 8px", background: SURFACE2, cursor: "pointer", fontSize: "12px", color: currentPage === 0 ? BORDER3 : MUTED2 }, children: "\u2190" }),
9199
9361
  /* @__PURE__ */ jsxs("span", { style: { fontSize: "12px", color: MUTED2 }, children: [
9200
9362
  currentPage + 1,
@@ -9214,7 +9376,7 @@ function DocumentPreviewResolver(p) {
9214
9376
  display: "flex",
9215
9377
  flexDirection: "column"
9216
9378
  }, children: [
9217
- hasRealFile && isPdf ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(PdfViewer2, { url: (_q = p.source) == null ? void 0 : _q.url, base64: (_r = p.source) == null ? void 0 : _r.base64, onLoadSuccess: handlePdfLoad }) }) : hasRealFile && isExcel ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ExcelViewer2, { url: (_s = p.source) == null ? void 0 : _s.url, base64: (_t = p.source) == null ? void 0 : _t.base64, onLoadSuccess: handleExcelLoad }) }) : (page == null ? void 0 : page.imageUrl) ? /* @__PURE__ */ jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsx("img", { src: page.imageUrl, alt: page.label, style: { maxWidth: "100%", borderRadius: "4px" } }) }) : (page == null ? void 0 : page.content) ? /* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontSize: "13px", color: "var(--foreground)", lineHeight: 1.6, margin: 0, padding: "20px" }, children: /* @__PURE__ */ jsx(Markdown, { content: page.content }) }) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "120px", color: MUTED2, fontSize: "13px" }, children: [
9379
+ showPdfViewer ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(PdfViewer2, { url: (_q = p.source) == null ? void 0 : _q.url, base64: (_r = p.source) == null ? void 0 : _r.base64, onLoadSuccess: handlePdfLoad, onLoadError: handlePdfError }) }) : pdfPending ? /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "200px", color: MUTED2, fontSize: "13px" }, children: "Loading preview\u2026" }) : hasRealFile && isExcel ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ExcelViewer2, { url: (_s = p.source) == null ? void 0 : _s.url, base64: (_t = p.source) == null ? void 0 : _t.base64, onLoadSuccess: handleExcelLoad }) }) : (page == null ? void 0 : page.imageUrl) ? /* @__PURE__ */ jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsx("img", { src: page.imageUrl, alt: page.label, style: { maxWidth: "100%", borderRadius: "4px" } }) }) : (page == null ? void 0 : page.content) ? /* @__PURE__ */ jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontSize: "13px", color: "var(--foreground)", lineHeight: 1.6, margin: 0, padding: "20px" }, children: /* @__PURE__ */ jsx(Markdown, { content: page.content }) }) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "120px", color: MUTED2, fontSize: "13px" }, children: [
9218
9380
  "No content available for ",
9219
9381
  (_u = page == null ? void 0 : page.label) != null ? _u : "this page"
9220
9382
  ] }),
@@ -10002,7 +10164,7 @@ function EngagementPipelineResolver(p) {
10002
10164
  const color = (_a3 = statusColor2[phase.status]) != null ? _a3 : "#d6d3d1";
10003
10165
  const isCurrent = i === activeIdx;
10004
10166
  const size = isCurrent ? 28 : 20;
10005
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
10167
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
10006
10168
  i > 0 && /* @__PURE__ */ jsx(
10007
10169
  "div",
10008
10170
  {
@@ -11722,7 +11884,7 @@ init_theme();
11722
11884
  var FAMILIES = [
11723
11885
  { exts: ["csv", "tsv", "xls", "xlsx", "numbers"], fg: SEMANTIC.success.color, bg: SEMANTIC.success.bg },
11724
11886
  { exts: ["pdf"], fg: SEMANTIC.error.color, bg: SEMANTIC.error.bg },
11725
- { exts: ["doc", "docx", "txt", "md", "rtf", "pages"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg },
11887
+ { exts: ["doc", "docx", "txt", "md", "rtf", "pages", "html", "htm"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg },
11726
11888
  { exts: ["json", "yaml", "yml", "xml", "toml"], fg: SEMANTIC.purple.color, bg: SEMANTIC.purple.bg },
11727
11889
  { exts: ["zip", "tar", "gz", "rar", "7z"], fg: SEMANTIC.warning.color, bg: SEMANTIC.warning.bg },
11728
11890
  { exts: ["png", "jpg", "jpeg", "gif", "svg", "webp", "bmp"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg }
@@ -11749,7 +11911,9 @@ var PREVIEW_EXTS = {
11749
11911
  txt: "text",
11750
11912
  log: "text",
11751
11913
  text: "text",
11752
- docx: "docx"
11914
+ docx: "docx",
11915
+ html: "html",
11916
+ htm: "html"
11753
11917
  };
11754
11918
  function extOf(fileType, filename) {
11755
11919
  var _a2;
@@ -11760,6 +11924,7 @@ function extOf(fileType, filename) {
11760
11924
  if (mime.includes("csv")) return "csv";
11761
11925
  if (mime.includes("markdown")) return "md";
11762
11926
  if (mime.includes("wordprocessing") || mime.includes("msword")) return "docx";
11927
+ if (mime.includes("html")) return "html";
11763
11928
  if (mime.startsWith("text/")) return "txt";
11764
11929
  } else if (fileType) {
11765
11930
  const t = fileType.toLowerCase().replace(/[^a-z0-9]/g, "");
@@ -11796,6 +11961,7 @@ function isExpirySoon(expiresAt) {
11796
11961
 
11797
11962
  // src/shared/viewers/PreviewHost.tsx
11798
11963
  init_ThemeContext();
11964
+ init_pdfWorkerProbe();
11799
11965
  var PdfViewer3 = lazy(
11800
11966
  () => Promise.resolve().then(() => (init_PdfViewer(), PdfViewer_exports)).then((m) => ({ default: m.PdfViewer }))
11801
11967
  );
@@ -11805,8 +11971,22 @@ var ExcelViewer3 = lazy(
11805
11971
  var CsvViewer2 = lazy(() => Promise.resolve().then(() => (init_CsvViewer(), CsvViewer_exports)).then((m) => ({ default: m.CsvViewer })));
11806
11972
  var TextViewer2 = lazy(() => Promise.resolve().then(() => (init_TextViewer(), TextViewer_exports)).then((m) => ({ default: m.TextViewer })));
11807
11973
  var DocxViewer2 = lazy(() => Promise.resolve().then(() => (init_DocxViewer(), DocxViewer_exports)).then((m) => ({ default: m.DocxViewer })));
11974
+ var HtmlViewer2 = lazy(() => Promise.resolve().then(() => (init_HtmlViewer(), HtmlViewer_exports)).then((m) => ({ default: m.HtmlViewer })));
11808
11975
  var PEEK_ROWS = 20;
11809
11976
  var PEEK_LINES = 40;
11977
+ function GatedPdfViewer({ source }) {
11978
+ const { MUTED: MUTED2 } = useTheme();
11979
+ const [failed, setFailed] = useState(false);
11980
+ const workerReady = usePdfWorkerReady(true);
11981
+ const ready = failed ? false : workerReady;
11982
+ if (ready === null) {
11983
+ return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: MUTED2, fontSize: "13px", textAlign: "center" }, children: "Loading preview\u2026" });
11984
+ }
11985
+ if (ready === false) {
11986
+ return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: MUTED2, fontSize: "13px", textAlign: "center" }, children: "Preview unavailable \u2014 download the file to view it." });
11987
+ }
11988
+ return /* @__PURE__ */ jsx(PdfViewer3, { url: source.url, base64: source.base64, onLoadError: () => setFailed(true) });
11989
+ }
11810
11990
  function PreviewHost({ kind, source, mode = "full" }) {
11811
11991
  const { MUTED: MUTED2 } = useTheme();
11812
11992
  const peek = mode === "peek";
@@ -11814,7 +11994,7 @@ function PreviewHost({ kind, source, mode = "full" }) {
11814
11994
  let viewer = null;
11815
11995
  switch (kind) {
11816
11996
  case "pdf":
11817
- viewer = /* @__PURE__ */ jsx(PdfViewer3, { url: source.url, base64: source.base64 });
11997
+ viewer = /* @__PURE__ */ jsx(GatedPdfViewer, { source });
11818
11998
  break;
11819
11999
  case "excel":
11820
12000
  viewer = /* @__PURE__ */ jsx(ExcelViewer3, { url: source.url, base64: source.base64 });
@@ -11831,6 +12011,9 @@ function PreviewHost({ kind, source, mode = "full" }) {
11831
12011
  case "docx":
11832
12012
  viewer = /* @__PURE__ */ jsx(DocxViewer2, { url: source.url, base64: source.base64 });
11833
12013
  break;
12014
+ case "html":
12015
+ viewer = /* @__PURE__ */ jsx(HtmlViewer2, { url: source.url, base64: source.base64, height: peek ? 240 : 480 });
12016
+ break;
11834
12017
  default:
11835
12018
  return null;
11836
12019
  }
@@ -12182,7 +12365,7 @@ function FileCard({
12182
12365
  whiteSpace: "nowrap"
12183
12366
  },
12184
12367
  children: [
12185
- metaTokens.map((t, i) => /* @__PURE__ */ jsxs(React45.Fragment, { children: [
12368
+ metaTokens.map((t, i) => /* @__PURE__ */ jsxs(React46.Fragment, { children: [
12186
12369
  i > 0 && /* @__PURE__ */ jsx("span", { style: { color: MUTED2 }, children: "\xB7" }),
12187
12370
  /* @__PURE__ */ jsx("span", { children: t })
12188
12371
  ] }, i)),
@@ -12761,7 +12944,7 @@ function KeyValueListResolver(p) {
12761
12944
  var _a4;
12762
12945
  return sum + ((_a4 = g.items) != null ? _a4 : []).length;
12763
12946
  }, 0);
12764
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
12947
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
12765
12948
  /* @__PURE__ */ jsxs(
12766
12949
  "div",
12767
12950
  {
@@ -12939,7 +13122,7 @@ function BalanceSheetResolver(p) {
12939
13122
  /* @__PURE__ */ jsxs("tbody", { children: [
12940
13123
  ((_p = p.sections) != null ? _p : []).map((section) => {
12941
13124
  var _a3;
12942
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13125
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
12943
13126
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
12944
13127
  padding: "8px 12px",
12945
13128
  fontSize: "12px",
@@ -12952,7 +13135,7 @@ function BalanceSheetResolver(p) {
12952
13135
  }, children: (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category }) }),
12953
13136
  section.subsections.map((sub, si) => {
12954
13137
  var _a4;
12955
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13138
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
12956
13139
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
12957
13140
  padding: "6px 10px 6px 24px",
12958
13141
  fontSize: "12px",
@@ -13128,7 +13311,7 @@ function IncomeStatementResolver(p) {
13128
13311
  textAlign: "left",
13129
13312
  whiteSpace: "nowrap"
13130
13313
  }, children: "\xA0" }),
13131
- periods.map((period) => /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13314
+ periods.map((period) => /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13132
13315
  /* @__PURE__ */ jsx("th", { style: {
13133
13316
  fontSize: "11px",
13134
13317
  fontWeight: 500,
@@ -13159,7 +13342,7 @@ function IncomeStatementResolver(p) {
13159
13342
  sections.map((section, si) => {
13160
13343
  var _a3;
13161
13344
  const isSubtotal = section.sectionType === "subtotal";
13162
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13345
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13163
13346
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, style: {
13164
13347
  padding: "8px 12px",
13165
13348
  fontSize: "12px",
@@ -13190,7 +13373,7 @@ function IncomeStatementResolver(p) {
13190
13373
  var _a5;
13191
13374
  const val = (_a5 = amounts[pi]) != null ? _a5 : 0;
13192
13375
  const isNeg = val < 0;
13193
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13376
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13194
13377
  /* @__PURE__ */ jsx("td", { style: {
13195
13378
  padding: "6px 10px",
13196
13379
  fontSize: "13px",
@@ -13225,7 +13408,7 @@ function IncomeStatementResolver(p) {
13225
13408
  var _a3;
13226
13409
  const val = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
13227
13410
  const isNeg = val < 0;
13228
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13411
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13229
13412
  /* @__PURE__ */ jsx("td", { style: {
13230
13413
  padding: "8px 10px",
13231
13414
  fontSize: "12px",
@@ -13260,7 +13443,7 @@ function IncomeStatementResolver(p) {
13260
13443
  var _a3;
13261
13444
  const val = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
13262
13445
  const isNeg = val < 0;
13263
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13446
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13264
13447
  /* @__PURE__ */ jsx("td", { style: {
13265
13448
  padding: "8px 10px",
13266
13449
  fontSize: "12px",
@@ -13294,7 +13477,7 @@ function IncomeStatementResolver(p) {
13294
13477
  var _a3;
13295
13478
  const val = (_a3 = netIncome[pi]) != null ? _a3 : 0;
13296
13479
  const isNeg = val < 0;
13297
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13480
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13298
13481
  /* @__PURE__ */ jsx("td", { style: {
13299
13482
  padding: "10px 10px",
13300
13483
  fontSize: "13px",
@@ -13514,7 +13697,7 @@ function CashFlowStatementResolver(p) {
13514
13697
  /* @__PURE__ */ jsxs("tbody", { children: [
13515
13698
  activities.map((activity, ai) => {
13516
13699
  var _a3, _b2, _c2;
13517
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
13700
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
13518
13701
  ai > 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
13519
13702
  "td",
13520
13703
  {
@@ -18054,8 +18237,8 @@ var CARD_MIN = 132;
18054
18237
  var CARD_GAP = 16;
18055
18238
  var AUTO_COMPACT_BELOW = 360;
18056
18239
  function useContainerWidth(ref) {
18057
- const [w, setW] = React45.useState(0);
18058
- React45.useLayoutEffect(() => {
18240
+ const [w, setW] = React46.useState(0);
18241
+ React46.useLayoutEffect(() => {
18059
18242
  const el = ref.current;
18060
18243
  if (!el || typeof ResizeObserver === "undefined") return;
18061
18244
  const ro = new ResizeObserver((entries) => {
@@ -18158,15 +18341,15 @@ function WorkflowStepperRenderer({
18158
18341
  const interactive = typeof onSelectStep === "function";
18159
18342
  const statusColor3 = (s) => s === "active" || s === "running" ? ACCENT2 : STATUS_COLORS3[s];
18160
18343
  const doneCount = steps.filter((s) => s.status === "done").length;
18161
- const rootRef = React45.useRef(null);
18344
+ const rootRef = React46.useRef(null);
18162
18345
  const containerW = useContainerWidth(rootRef);
18163
18346
  let resolved = density === "auto" ? "full" : density;
18164
18347
  if (density === "auto" && containerW > 0) {
18165
18348
  const needed = steps.length * CARD_MIN + Math.max(0, steps.length - 1) * CARD_GAP;
18166
18349
  resolved = containerW < AUTO_COMPACT_BELOW || needed > containerW * 1.6 ? "compact" : "full";
18167
18350
  }
18168
- const scrollerRef = React45.useRef(null);
18169
- React45.useEffect(() => {
18351
+ const scrollerRef = React46.useRef(null);
18352
+ React46.useEffect(() => {
18170
18353
  if (resolved !== "full" || loading) return;
18171
18354
  const sc = scrollerRef.current;
18172
18355
  if (!sc) return;
@@ -18177,11 +18360,11 @@ function WorkflowStepperRenderer({
18177
18360
  el.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
18178
18361
  }
18179
18362
  }, [resolved, loading, selectedStep, activeStepId]);
18180
- const [edges, setEdges] = React45.useState({
18363
+ const [edges, setEdges] = React46.useState({
18181
18364
  left: false,
18182
18365
  right: false
18183
18366
  });
18184
- const updateEdges = React45.useCallback(() => {
18367
+ const updateEdges = React46.useCallback(() => {
18185
18368
  const sc = scrollerRef.current;
18186
18369
  if (!sc) return;
18187
18370
  const max = sc.scrollWidth - sc.clientWidth;
@@ -18190,7 +18373,7 @@ function WorkflowStepperRenderer({
18190
18373
  const right = sl < max - 1;
18191
18374
  setEdges((prev) => prev.left === left && prev.right === right ? prev : { left, right });
18192
18375
  }, []);
18193
- React45.useLayoutEffect(() => {
18376
+ React46.useLayoutEffect(() => {
18194
18377
  if (resolved !== "full" || loading) return;
18195
18378
  updateEdges();
18196
18379
  const sc = scrollerRef.current;
@@ -18246,7 +18429,7 @@ function WorkflowStepperRenderer({
18246
18429
  const reached = s.status !== "pending";
18247
18430
  const clickable = interactive && reached;
18248
18431
  const size = act ? 11 : done ? 9 : 8;
18249
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
18432
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
18250
18433
  i > 0 && /* @__PURE__ */ jsx(
18251
18434
  "span",
18252
18435
  {
@@ -18390,7 +18573,7 @@ function WorkflowStepperRenderer({
18390
18573
  const color = statusColor3(step.status);
18391
18574
  const humans = ((_a3 = step.assignees) != null ? _a3 : []).filter((a) => a.kind === "human");
18392
18575
  const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
18393
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
18576
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
18394
18577
  i > 0 && /* @__PURE__ */ jsx(
18395
18578
  "div",
18396
18579
  {
@@ -18756,11 +18939,11 @@ function FieldDetail({
18756
18939
  }) {
18757
18940
  var _a2, _b, _c, _d;
18758
18941
  const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2, SURFACE: SURFACE2, ACCENT: ACCENT2 } = useTheme();
18759
- const [editing, setEditing] = React45.useState(false);
18760
- const [draft, setDraft] = React45.useState("");
18761
- const [saving, setSaving] = React45.useState(false);
18762
- const [saveError, setSaveError] = React45.useState(null);
18763
- const textareaRef = React45.useRef(null);
18942
+ const [editing, setEditing] = React46.useState(false);
18943
+ const [draft, setDraft] = React46.useState("");
18944
+ const [saving, setSaving] = React46.useState(false);
18945
+ const [saveError, setSaveError] = React46.useState(null);
18946
+ const textareaRef = React46.useRef(null);
18764
18947
  const color = fieldColor(field, SECONDARY2);
18765
18948
  const corrected = field.state === "corrected";
18766
18949
  const startEdit = (e) => {
@@ -19270,7 +19453,7 @@ function FieldDetails({
19270
19453
  },
19271
19454
  children: facts.map((f) => {
19272
19455
  var _a3;
19273
- return /* @__PURE__ */ jsxs(React45.Fragment, { children: [
19456
+ return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
19274
19457
  /* @__PURE__ */ jsx("dt", { style: { fontSize: "12px", color: MUTED2 }, children: f.label }),
19275
19458
  /* @__PURE__ */ jsxs(
19276
19459
  "dd",
@@ -19369,7 +19552,7 @@ function FieldAuditLog({
19369
19552
  fields = []
19370
19553
  }) {
19371
19554
  const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
19372
- const fieldLabelMap = React45.useMemo(() => {
19555
+ const fieldLabelMap = React46.useMemo(() => {
19373
19556
  var _a2;
19374
19557
  const map = {};
19375
19558
  for (const f of fields) map[f.field_key] = (_a2 = f.label) != null ? _a2 : f.field_key;
@@ -19568,10 +19751,10 @@ function PageOverlay({
19568
19751
  secondary
19569
19752
  }) {
19570
19753
  const { PAPER: PAPER2, MUTED: MUTED2 } = useTheme();
19571
- const imgRef = React45.useRef(null);
19572
- const selectedBoxRef = React45.useRef(null);
19573
- const [px, setPx] = React45.useState(null);
19574
- React45.useEffect(() => {
19754
+ const imgRef = React46.useRef(null);
19755
+ const selectedBoxRef = React46.useRef(null);
19756
+ const [px, setPx] = React46.useState(null);
19757
+ React46.useEffect(() => {
19575
19758
  const el = imgRef.current;
19576
19759
  if (!el) return;
19577
19760
  const measure = () => {
@@ -19585,7 +19768,7 @@ function PageOverlay({
19585
19768
  ro.observe(el);
19586
19769
  return () => ro.disconnect();
19587
19770
  }, [page.imageUrl]);
19588
- React45.useEffect(() => {
19771
+ React46.useEffect(() => {
19589
19772
  if (!selectedKey) return;
19590
19773
  if (!fields.some((f) => f.field_key === selectedKey && f.bbox)) return;
19591
19774
  const el = selectedBoxRef.current;
@@ -19687,8 +19870,8 @@ function ExtractionDetail({
19687
19870
  auditLoading
19688
19871
  }) {
19689
19872
  const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
19690
- const selectedCardRef = React45.useRef(null);
19691
- React45.useEffect(() => {
19873
+ const selectedCardRef = React46.useRef(null);
19874
+ React46.useEffect(() => {
19692
19875
  if (!selectedKey || tab !== "fields") return;
19693
19876
  const el = selectedCardRef.current;
19694
19877
  if (el && typeof el.scrollIntoView === "function") {
@@ -19859,7 +20042,7 @@ function ExtractionModal({
19859
20042
  children
19860
20043
  }) {
19861
20044
  const { BORDER: BORDER3, MUTED: MUTED2, SURFACE: SURFACE2, FOREGROUND: FOREGROUND2, SCRIM: SCRIM2 } = useTheme();
19862
- React45.useEffect(() => {
20045
+ React46.useEffect(() => {
19863
20046
  if (!open) return;
19864
20047
  const onKey = (e) => {
19865
20048
  if (e.key === "Escape") onClose();
@@ -19988,19 +20171,19 @@ function ExtractionModal({
19988
20171
  function DocumentFieldExtractionResolver(p) {
19989
20172
  var _a2, _b;
19990
20173
  const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SURFACE: SURFACE2, SHADOW: SHADOW2, ACCENT: ACCENT2 } = useTheme();
19991
- const [selectedKey, setSelectedKey] = React45.useState(null);
19992
- const [open, setOpen] = React45.useState(false);
19993
- const [tab, setTab] = React45.useState("fields");
20174
+ const [selectedKey, setSelectedKey] = React46.useState(null);
20175
+ const [open, setOpen] = React46.useState(false);
20176
+ const [tab, setTab] = React46.useState("fields");
19994
20177
  const pages = (_a2 = p.pages) != null ? _a2 : [];
19995
20178
  const fields = (_b = p.fields) != null ? _b : [];
19996
20179
  const editable = typeof p.onFieldSave === "function";
19997
20180
  const onLoadAudit = p.onLoadAudit;
19998
- React45.useEffect(() => {
20181
+ React46.useEffect(() => {
19999
20182
  if (tab === "audit" && onLoadAudit) {
20000
20183
  onLoadAudit();
20001
20184
  }
20002
20185
  }, [tab, onLoadAudit]);
20003
- const correctionCounts = React45.useMemo(() => {
20186
+ const correctionCounts = React46.useMemo(() => {
20004
20187
  var _a3, _b2;
20005
20188
  const counts = {};
20006
20189
  for (const ev of (_a3 = p.auditEvents) != null ? _a3 : []) {
@@ -20357,8 +20540,8 @@ function formatAmount2(amount, currency = "USD") {
20357
20540
  return `${sign}${symbol}${body}`;
20358
20541
  }
20359
20542
  function useContainerWidth2(ref) {
20360
- const [w, setW] = React45.useState(0);
20361
- React45.useLayoutEffect(() => {
20543
+ const [w, setW] = React46.useState(0);
20544
+ React46.useLayoutEffect(() => {
20362
20545
  const el = ref.current;
20363
20546
  if (!el || typeof ResizeObserver === "undefined") return;
20364
20547
  const ro = new ResizeObserver((entries) => {
@@ -20453,8 +20636,8 @@ function ValueAdjuster({
20453
20636
  const { SURFACE_MUTED: SURFACE_MUTED2 } = useTheme();
20454
20637
  const adjust = option.adjust;
20455
20638
  const suggested = clampToRange((_a2 = option.value) != null ? _a2 : adjust.min, adjust);
20456
- const [value, setValue] = React45.useState(suggested);
20457
- const [text, setText] = React45.useState(String(suggested));
20639
+ const [value, setValue] = React46.useState(suggested);
20640
+ const [text, setText] = React46.useState(String(suggested));
20458
20641
  const step = (_b = adjust.step) != null ? _b : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
20459
20642
  const pct = adjust.max > adjust.min ? (value - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
20460
20643
  const suggestedPct = adjust.max > adjust.min ? (suggested - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
@@ -20660,10 +20843,10 @@ function DecisionCardRenderer({
20660
20843
  }) {
20661
20844
  var _a2, _b, _c;
20662
20845
  const { BORDER: BORDER3, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2, SURFACE: SURFACE2, SURFACE_MUTED: SURFACE_MUTED2, SHADOW: SHADOW2 } = useTheme();
20663
- const rootRef = React45.useRef(null);
20846
+ const rootRef = React46.useRef(null);
20664
20847
  const width = useContainerWidth2(rootRef);
20665
20848
  const stacked = width > 0 && width < STACK_BELOW;
20666
- const [adjustingIdx, setAdjustingIdx] = React45.useState(null);
20849
+ const [adjustingIdx, setAdjustingIdx] = React46.useState(null);
20667
20850
  const options = (_a2 = data.options) != null ? _a2 : [];
20668
20851
  const recommendedIdx = Math.max(
20669
20852
  0,
@@ -20964,8 +21147,8 @@ function DecisionCardResolver(p) {
20964
21147
  const decisionId = (_a2 = p.id) != null ? _a2 : p.title;
20965
21148
  const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
20966
21149
  const initial = hostResolved != null ? hostResolved : p.resolved ? composeResolution(p, p.resolved.option, p.resolved.value) : null;
20967
- const [localResolved, setLocalResolved] = React45.useState(initial);
20968
- React45.useEffect(() => {
21150
+ const [localResolved, setLocalResolved] = React46.useState(initial);
21151
+ React46.useEffect(() => {
20969
21152
  if (hostResolved !== void 0) setLocalResolved(hostResolved);
20970
21153
  }, [hostResolved]);
20971
21154
  const resolved = hostResolved != null ? hostResolved : localResolved;
@@ -21039,11 +21222,11 @@ function DecisionQueueRenderer({
21039
21222
  var _a2;
21040
21223
  const { BORDER: BORDER3, MUTED: MUTED2, ACCENT: ACCENT2, SURFACE: SURFACE2, SURFACE_MUTED: SURFACE_MUTED2, BORDER_SOFT: BORDER_SOFT2, PAPER: PAPER2, SHADOW: SHADOW2 } = useTheme();
21041
21224
  const items = (_a2 = data.items) != null ? _a2 : [];
21042
- const [decisions, setDecisions] = React45.useState(
21225
+ const [decisions, setDecisions] = React46.useState(
21043
21226
  () => items.map(() => void 0)
21044
21227
  );
21045
21228
  const firstUndecided = decisions.findIndex((d) => !d);
21046
- const [focusIdx, setFocusIdx] = React45.useState(firstUndecided >= 0 ? firstUndecided : null);
21229
+ const [focusIdx, setFocusIdx] = React46.useState(firstUndecided >= 0 ? firstUndecided : null);
21047
21230
  const isSubmitted = submitted != null;
21048
21231
  const shown = isSubmitted ? items.map(
21049
21232
  (item, i) => {
@@ -21068,16 +21251,16 @@ function DecisionQueueRenderer({
21068
21251
  const final = decisions;
21069
21252
  onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
21070
21253
  };
21071
- const onReadyRef = React45.useRef(onReady);
21072
- React45.useEffect(() => {
21254
+ const onReadyRef = React46.useRef(onReady);
21255
+ React46.useEffect(() => {
21073
21256
  onReadyRef.current = onReady;
21074
21257
  });
21075
- React45.useEffect(() => {
21258
+ React46.useEffect(() => {
21076
21259
  if (!onReadyRef.current) return;
21077
21260
  const msg = allDecided ? composeQueueMessage(items, decisions) : null;
21078
21261
  onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
21079
21262
  }, [decisions, allDecided, isSubmitted]);
21080
- React45.useEffect(() => {
21263
+ React46.useEffect(() => {
21081
21264
  if (!submitRef) return;
21082
21265
  submitRef.current = handleSubmit;
21083
21266
  return () => {
@@ -21302,7 +21485,7 @@ function DecisionQueueResolver(p) {
21302
21485
  const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
21303
21486
  const queueId = (_b = (_a2 = p.id) != null ? _a2 : p.title) != null ? _b : "decision-queue";
21304
21487
  const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
21305
- const [localSubmitted, setLocalSubmitted] = React45.useState(null);
21488
+ const [localSubmitted, setLocalSubmitted] = React46.useState(null);
21306
21489
  const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
21307
21490
  const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
21308
21491
  const handleSubmit = (decisions, message) => {
@@ -22138,7 +22321,7 @@ function DocGlyph({ color }) {
22138
22321
  }
22139
22322
  function FileUploadField({ field, value, onChange, disabled, onFileUpload, error, dense }) {
22140
22323
  const { MUTED: MUTED2, ACCENT: ACCENT2, BORDER: BORDER3, PAPER: PAPER2, SURFACE: SURFACE2 } = useTheme();
22141
- const keyRef = React45.useRef(0);
22324
+ const keyRef = React46.useRef(0);
22142
22325
  const [entries, setEntries] = useState(() => {
22143
22326
  const arr = Array.isArray(value) ? value : value && typeof value === "object" ? [value] : [];
22144
22327
  return arr.map((item) => {
@@ -22147,11 +22330,11 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
22147
22330
  return { key: keyRef.current += 1, name: (_b = (_a2 = r.filename) != null ? _a2 : r.name) != null ? _b : "file", size: r.size, status: "done", result: r };
22148
22331
  });
22149
22332
  });
22150
- const entriesRef = React45.useRef(entries);
22333
+ const entriesRef = React46.useRef(entries);
22151
22334
  entriesRef.current = entries;
22152
22335
  const [dragOver, setDragOver] = useState(false);
22153
- const inputRef = React45.useRef(null);
22154
- React45.useEffect(() => {
22336
+ const inputRef = React46.useRef(null);
22337
+ React46.useEffect(() => {
22155
22338
  ensureFileUploadKeyframes();
22156
22339
  }, []);
22157
22340
  const interactive = !disabled;
@@ -22758,7 +22941,7 @@ function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload,
22758
22941
  ] });
22759
22942
  }
22760
22943
  init_ThemeContext();
22761
- var SlotErrorBoundary = class extends React45.Component {
22944
+ var SlotErrorBoundary = class extends React46.Component {
22762
22945
  constructor(props) {
22763
22946
  super(props);
22764
22947
  this.state = { hasError: false };
@@ -23625,7 +23808,7 @@ function BuilderFormResolver({
23625
23808
  }
23626
23809
  }
23627
23810
  function resolveBuilder(payload, callbacks) {
23628
- return React45.createElement(BuilderFormResolver, __spreadValues({
23811
+ return React46.createElement(BuilderFormResolver, __spreadValues({
23629
23812
  builder: payload
23630
23813
  }, callbacks));
23631
23814
  }