@adoptai/genui-components 0.1.68 → 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.
- package/dist/composites/download-card/resolver.cjs +152 -62
- package/dist/composites/download-card/resolver.cjs.map +1 -1
- package/dist/composites/download-card/resolver.js +94 -4
- package/dist/composites/download-card/resolver.js.map +1 -1
- package/dist/index.cjs +373 -283
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +160 -70
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +305 -215
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +154 -64
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +304 -214
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.js +154 -64
- package/dist/resolver.js.map +1 -1
- package/dist/shared/fileType.d.ts +1 -1
- package/dist/shared/fileType.d.ts.map +1 -1
- package/dist/shared/viewers/HtmlViewer.d.ts +12 -0
- package/dist/shared/viewers/HtmlViewer.d.ts.map +1 -0
- package/dist/shared/viewers/PreviewHost.d.ts.map +1 -1
- package/dist/tool-definitions.json +2 -2
- package/package.json +1 -1
package/dist/resolver.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import React46, { lazy, createContext, useState, useCallback, useEffect, useRef, useMemo, useContext, Suspense, useLayoutEffect } 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';
|
|
@@ -1944,6 +1944,89 @@ var init_DocxViewer = __esm({
|
|
|
1944
1944
|
init_decode();
|
|
1945
1945
|
}
|
|
1946
1946
|
});
|
|
1947
|
+
|
|
1948
|
+
// src/shared/viewers/HtmlViewer.tsx
|
|
1949
|
+
var HtmlViewer_exports = {};
|
|
1950
|
+
__export(HtmlViewer_exports, {
|
|
1951
|
+
HtmlViewer: () => HtmlViewer
|
|
1952
|
+
});
|
|
1953
|
+
function HtmlViewer({ url, base64, height = 480 }) {
|
|
1954
|
+
const { MUTED: MUTED2 } = useTheme();
|
|
1955
|
+
const [html, setHtml] = useState("");
|
|
1956
|
+
const [loading, setLoading] = useState(true);
|
|
1957
|
+
const [error, setError] = useState(null);
|
|
1958
|
+
useEffect(() => {
|
|
1959
|
+
let cancelled = false;
|
|
1960
|
+
setLoading(true);
|
|
1961
|
+
setError(null);
|
|
1962
|
+
if (base64) {
|
|
1963
|
+
try {
|
|
1964
|
+
if (!cancelled) {
|
|
1965
|
+
setHtml(base64ToText(base64));
|
|
1966
|
+
setLoading(false);
|
|
1967
|
+
}
|
|
1968
|
+
} catch (e) {
|
|
1969
|
+
if (!cancelled) {
|
|
1970
|
+
setError(e instanceof Error ? e.message : "Failed to decode HTML");
|
|
1971
|
+
setLoading(false);
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
return () => {
|
|
1975
|
+
cancelled = true;
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
if (!url) {
|
|
1979
|
+
setError("No file source provided");
|
|
1980
|
+
setLoading(false);
|
|
1981
|
+
return () => {
|
|
1982
|
+
cancelled = true;
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
fetch(url).then((r) => {
|
|
1986
|
+
if (!r.ok) throw new Error(`Failed to fetch: ${r.status}`);
|
|
1987
|
+
return r.text();
|
|
1988
|
+
}).then((t) => {
|
|
1989
|
+
if (cancelled) return;
|
|
1990
|
+
setHtml(t);
|
|
1991
|
+
setLoading(false);
|
|
1992
|
+
}).catch((e) => {
|
|
1993
|
+
if (cancelled) return;
|
|
1994
|
+
setError(e.message);
|
|
1995
|
+
setLoading(false);
|
|
1996
|
+
});
|
|
1997
|
+
return () => {
|
|
1998
|
+
cancelled = true;
|
|
1999
|
+
};
|
|
2000
|
+
}, [url, base64]);
|
|
2001
|
+
if (loading) {
|
|
2002
|
+
return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: MUTED2, fontSize: "13px", textAlign: "center" }, children: "Loading\u2026" });
|
|
2003
|
+
}
|
|
2004
|
+
if (error) {
|
|
2005
|
+
return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: "#dc2626", fontSize: "13px", textAlign: "center" }, children: error });
|
|
2006
|
+
}
|
|
2007
|
+
return /* @__PURE__ */ jsx(
|
|
2008
|
+
"iframe",
|
|
2009
|
+
{
|
|
2010
|
+
title: "HTML preview",
|
|
2011
|
+
sandbox: "",
|
|
2012
|
+
srcDoc: html,
|
|
2013
|
+
style: {
|
|
2014
|
+
width: "100%",
|
|
2015
|
+
height: `${height}px`,
|
|
2016
|
+
border: "none",
|
|
2017
|
+
background: "white",
|
|
2018
|
+
display: "block"
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
2023
|
+
var init_HtmlViewer = __esm({
|
|
2024
|
+
"src/shared/viewers/HtmlViewer.tsx"() {
|
|
2025
|
+
"use client";
|
|
2026
|
+
init_ThemeContext();
|
|
2027
|
+
init_decode();
|
|
2028
|
+
}
|
|
2029
|
+
});
|
|
1947
2030
|
var dataTableSchema = z.object({
|
|
1948
2031
|
type: z.literal("data-table"),
|
|
1949
2032
|
title: z.string().optional(),
|
|
@@ -7397,7 +7480,7 @@ function WaterfallChartResolver(p) {
|
|
|
7397
7480
|
}
|
|
7398
7481
|
init_ThemeContext();
|
|
7399
7482
|
init_theme();
|
|
7400
|
-
var FlowGraph2 =
|
|
7483
|
+
var FlowGraph2 = React46.lazy(
|
|
7401
7484
|
() => Promise.resolve().then(() => (init_FlowGraph(), FlowGraph_exports)).then((m) => ({ default: m.FlowGraph }))
|
|
7402
7485
|
);
|
|
7403
7486
|
function FlowCanvasRenderer({
|
|
@@ -7673,7 +7756,7 @@ function TrialBalanceResolver(p) {
|
|
|
7673
7756
|
gDebit += a.debit;
|
|
7674
7757
|
gCredit += a.credit;
|
|
7675
7758
|
});
|
|
7676
|
-
return /* @__PURE__ */ jsxs(
|
|
7759
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
7677
7760
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 4, style: {
|
|
7678
7761
|
padding: "8px 12px",
|
|
7679
7762
|
fontSize: "12px",
|
|
@@ -9065,10 +9148,10 @@ function useFullscreen(ref) {
|
|
|
9065
9148
|
init_theme();
|
|
9066
9149
|
init_ThemeContext();
|
|
9067
9150
|
init_pdfWorkerProbe();
|
|
9068
|
-
var PdfViewer2 =
|
|
9151
|
+
var PdfViewer2 = React46.lazy(
|
|
9069
9152
|
() => Promise.resolve().then(() => (init_PdfViewer(), PdfViewer_exports)).then((m) => ({ default: m.PdfViewer }))
|
|
9070
9153
|
);
|
|
9071
|
-
var ExcelViewer2 =
|
|
9154
|
+
var ExcelViewer2 = React46.lazy(
|
|
9072
9155
|
() => Promise.resolve().then(() => (init_ExcelViewer(), ExcelViewer_exports)).then((m) => ({ default: m.ExcelViewer }))
|
|
9073
9156
|
);
|
|
9074
9157
|
var highlightColors = {
|
|
@@ -10037,7 +10120,7 @@ function EngagementPipelineResolver(p) {
|
|
|
10037
10120
|
const color = (_a2 = statusColor2[phase.status]) != null ? _a2 : "#d6d3d1";
|
|
10038
10121
|
const isCurrent = i === activeIdx;
|
|
10039
10122
|
const size = isCurrent ? 28 : 20;
|
|
10040
|
-
return /* @__PURE__ */ jsxs(
|
|
10123
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
10041
10124
|
i > 0 && /* @__PURE__ */ jsx(
|
|
10042
10125
|
"div",
|
|
10043
10126
|
{
|
|
@@ -11757,7 +11840,7 @@ init_theme();
|
|
|
11757
11840
|
var FAMILIES = [
|
|
11758
11841
|
{ exts: ["csv", "tsv", "xls", "xlsx", "numbers"], fg: SEMANTIC.success.color, bg: SEMANTIC.success.bg },
|
|
11759
11842
|
{ exts: ["pdf"], fg: SEMANTIC.error.color, bg: SEMANTIC.error.bg },
|
|
11760
|
-
{ exts: ["doc", "docx", "txt", "md", "rtf", "pages"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg },
|
|
11843
|
+
{ exts: ["doc", "docx", "txt", "md", "rtf", "pages", "html", "htm"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg },
|
|
11761
11844
|
{ exts: ["json", "yaml", "yml", "xml", "toml"], fg: SEMANTIC.purple.color, bg: SEMANTIC.purple.bg },
|
|
11762
11845
|
{ exts: ["zip", "tar", "gz", "rar", "7z"], fg: SEMANTIC.warning.color, bg: SEMANTIC.warning.bg },
|
|
11763
11846
|
{ exts: ["png", "jpg", "jpeg", "gif", "svg", "webp", "bmp"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg }
|
|
@@ -11784,7 +11867,9 @@ var PREVIEW_EXTS = {
|
|
|
11784
11867
|
txt: "text",
|
|
11785
11868
|
log: "text",
|
|
11786
11869
|
text: "text",
|
|
11787
|
-
docx: "docx"
|
|
11870
|
+
docx: "docx",
|
|
11871
|
+
html: "html",
|
|
11872
|
+
htm: "html"
|
|
11788
11873
|
};
|
|
11789
11874
|
function extOf(fileType, filename) {
|
|
11790
11875
|
var _a;
|
|
@@ -11795,6 +11880,7 @@ function extOf(fileType, filename) {
|
|
|
11795
11880
|
if (mime.includes("csv")) return "csv";
|
|
11796
11881
|
if (mime.includes("markdown")) return "md";
|
|
11797
11882
|
if (mime.includes("wordprocessing") || mime.includes("msword")) return "docx";
|
|
11883
|
+
if (mime.includes("html")) return "html";
|
|
11798
11884
|
if (mime.startsWith("text/")) return "txt";
|
|
11799
11885
|
} else if (fileType) {
|
|
11800
11886
|
const t = fileType.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -11838,6 +11924,7 @@ var ExcelViewer3 = lazy(
|
|
|
11838
11924
|
var CsvViewer2 = lazy(() => Promise.resolve().then(() => (init_CsvViewer(), CsvViewer_exports)).then((m) => ({ default: m.CsvViewer })));
|
|
11839
11925
|
var TextViewer2 = lazy(() => Promise.resolve().then(() => (init_TextViewer(), TextViewer_exports)).then((m) => ({ default: m.TextViewer })));
|
|
11840
11926
|
var DocxViewer2 = lazy(() => Promise.resolve().then(() => (init_DocxViewer(), DocxViewer_exports)).then((m) => ({ default: m.DocxViewer })));
|
|
11927
|
+
var HtmlViewer2 = lazy(() => Promise.resolve().then(() => (init_HtmlViewer(), HtmlViewer_exports)).then((m) => ({ default: m.HtmlViewer })));
|
|
11841
11928
|
var PEEK_ROWS = 20;
|
|
11842
11929
|
var PEEK_LINES = 40;
|
|
11843
11930
|
function GatedPdfViewer({ source }) {
|
|
@@ -11877,6 +11964,9 @@ function PreviewHost({ kind, source, mode = "full" }) {
|
|
|
11877
11964
|
case "docx":
|
|
11878
11965
|
viewer = /* @__PURE__ */ jsx(DocxViewer2, { url: source.url, base64: source.base64 });
|
|
11879
11966
|
break;
|
|
11967
|
+
case "html":
|
|
11968
|
+
viewer = /* @__PURE__ */ jsx(HtmlViewer2, { url: source.url, base64: source.base64, height: peek ? 240 : 480 });
|
|
11969
|
+
break;
|
|
11880
11970
|
default:
|
|
11881
11971
|
return null;
|
|
11882
11972
|
}
|
|
@@ -12228,7 +12318,7 @@ function FileCard({
|
|
|
12228
12318
|
whiteSpace: "nowrap"
|
|
12229
12319
|
},
|
|
12230
12320
|
children: [
|
|
12231
|
-
metaTokens.map((t, i) => /* @__PURE__ */ jsxs(
|
|
12321
|
+
metaTokens.map((t, i) => /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
12232
12322
|
i > 0 && /* @__PURE__ */ jsx("span", { style: { color: MUTED2 }, children: "\xB7" }),
|
|
12233
12323
|
/* @__PURE__ */ jsx("span", { children: t })
|
|
12234
12324
|
] }, i)),
|
|
@@ -12807,7 +12897,7 @@ function KeyValueListResolver(p) {
|
|
|
12807
12897
|
var _a3;
|
|
12808
12898
|
return sum + ((_a3 = g.items) != null ? _a3 : []).length;
|
|
12809
12899
|
}, 0);
|
|
12810
|
-
return /* @__PURE__ */ jsxs(
|
|
12900
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
12811
12901
|
/* @__PURE__ */ jsxs(
|
|
12812
12902
|
"div",
|
|
12813
12903
|
{
|
|
@@ -12985,7 +13075,7 @@ function BalanceSheetResolver(p) {
|
|
|
12985
13075
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
12986
13076
|
((_p = p.sections) != null ? _p : []).map((section) => {
|
|
12987
13077
|
var _a2;
|
|
12988
|
-
return /* @__PURE__ */ jsxs(
|
|
13078
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
12989
13079
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
|
|
12990
13080
|
padding: "8px 12px",
|
|
12991
13081
|
fontSize: "12px",
|
|
@@ -12998,7 +13088,7 @@ function BalanceSheetResolver(p) {
|
|
|
12998
13088
|
}, children: (_a2 = categoryLabels2[section.category]) != null ? _a2 : section.category }) }),
|
|
12999
13089
|
section.subsections.map((sub, si) => {
|
|
13000
13090
|
var _a3;
|
|
13001
|
-
return /* @__PURE__ */ jsxs(
|
|
13091
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13002
13092
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
|
|
13003
13093
|
padding: "6px 10px 6px 24px",
|
|
13004
13094
|
fontSize: "12px",
|
|
@@ -13174,7 +13264,7 @@ function IncomeStatementResolver(p) {
|
|
|
13174
13264
|
textAlign: "left",
|
|
13175
13265
|
whiteSpace: "nowrap"
|
|
13176
13266
|
}, children: "\xA0" }),
|
|
13177
|
-
periods.map((period) => /* @__PURE__ */ jsxs(
|
|
13267
|
+
periods.map((period) => /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13178
13268
|
/* @__PURE__ */ jsx("th", { style: {
|
|
13179
13269
|
fontSize: "11px",
|
|
13180
13270
|
fontWeight: 500,
|
|
@@ -13205,7 +13295,7 @@ function IncomeStatementResolver(p) {
|
|
|
13205
13295
|
sections.map((section, si) => {
|
|
13206
13296
|
var _a2;
|
|
13207
13297
|
const isSubtotal = section.sectionType === "subtotal";
|
|
13208
|
-
return /* @__PURE__ */ jsxs(
|
|
13298
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13209
13299
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, style: {
|
|
13210
13300
|
padding: "8px 12px",
|
|
13211
13301
|
fontSize: "12px",
|
|
@@ -13236,7 +13326,7 @@ function IncomeStatementResolver(p) {
|
|
|
13236
13326
|
var _a4;
|
|
13237
13327
|
const val = (_a4 = amounts[pi]) != null ? _a4 : 0;
|
|
13238
13328
|
const isNeg = val < 0;
|
|
13239
|
-
return /* @__PURE__ */ jsxs(
|
|
13329
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13240
13330
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13241
13331
|
padding: "6px 10px",
|
|
13242
13332
|
fontSize: "13px",
|
|
@@ -13271,7 +13361,7 @@ function IncomeStatementResolver(p) {
|
|
|
13271
13361
|
var _a2;
|
|
13272
13362
|
const val = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
|
|
13273
13363
|
const isNeg = val < 0;
|
|
13274
|
-
return /* @__PURE__ */ jsxs(
|
|
13364
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13275
13365
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13276
13366
|
padding: "8px 10px",
|
|
13277
13367
|
fontSize: "12px",
|
|
@@ -13306,7 +13396,7 @@ function IncomeStatementResolver(p) {
|
|
|
13306
13396
|
var _a2;
|
|
13307
13397
|
const val = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
|
|
13308
13398
|
const isNeg = val < 0;
|
|
13309
|
-
return /* @__PURE__ */ jsxs(
|
|
13399
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13310
13400
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13311
13401
|
padding: "8px 10px",
|
|
13312
13402
|
fontSize: "12px",
|
|
@@ -13340,7 +13430,7 @@ function IncomeStatementResolver(p) {
|
|
|
13340
13430
|
var _a2;
|
|
13341
13431
|
const val = (_a2 = netIncome[pi]) != null ? _a2 : 0;
|
|
13342
13432
|
const isNeg = val < 0;
|
|
13343
|
-
return /* @__PURE__ */ jsxs(
|
|
13433
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13344
13434
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13345
13435
|
padding: "10px 10px",
|
|
13346
13436
|
fontSize: "13px",
|
|
@@ -13560,7 +13650,7 @@ function CashFlowStatementResolver(p) {
|
|
|
13560
13650
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
13561
13651
|
activities.map((activity, ai) => {
|
|
13562
13652
|
var _a2, _b2, _c2;
|
|
13563
|
-
return /* @__PURE__ */ jsxs(
|
|
13653
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13564
13654
|
ai > 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
13565
13655
|
"td",
|
|
13566
13656
|
{
|
|
@@ -18097,8 +18187,8 @@ var CARD_MIN = 132;
|
|
|
18097
18187
|
var CARD_GAP = 16;
|
|
18098
18188
|
var AUTO_COMPACT_BELOW = 360;
|
|
18099
18189
|
function useContainerWidth(ref) {
|
|
18100
|
-
const [w, setW] =
|
|
18101
|
-
|
|
18190
|
+
const [w, setW] = React46.useState(0);
|
|
18191
|
+
React46.useLayoutEffect(() => {
|
|
18102
18192
|
const el = ref.current;
|
|
18103
18193
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
18104
18194
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -18201,15 +18291,15 @@ function WorkflowStepperRenderer({
|
|
|
18201
18291
|
const interactive = typeof onSelectStep === "function";
|
|
18202
18292
|
const statusColor3 = (s) => s === "active" || s === "running" ? ACCENT2 : STATUS_COLORS3[s];
|
|
18203
18293
|
const doneCount = steps.filter((s) => s.status === "done").length;
|
|
18204
|
-
const rootRef =
|
|
18294
|
+
const rootRef = React46.useRef(null);
|
|
18205
18295
|
const containerW = useContainerWidth(rootRef);
|
|
18206
18296
|
let resolved = density === "auto" ? "full" : density;
|
|
18207
18297
|
if (density === "auto" && containerW > 0) {
|
|
18208
18298
|
const needed = steps.length * CARD_MIN + Math.max(0, steps.length - 1) * CARD_GAP;
|
|
18209
18299
|
resolved = containerW < AUTO_COMPACT_BELOW || needed > containerW * 1.6 ? "compact" : "full";
|
|
18210
18300
|
}
|
|
18211
|
-
const scrollerRef =
|
|
18212
|
-
|
|
18301
|
+
const scrollerRef = React46.useRef(null);
|
|
18302
|
+
React46.useEffect(() => {
|
|
18213
18303
|
if (resolved !== "full" || loading) return;
|
|
18214
18304
|
const sc = scrollerRef.current;
|
|
18215
18305
|
if (!sc) return;
|
|
@@ -18220,11 +18310,11 @@ function WorkflowStepperRenderer({
|
|
|
18220
18310
|
el.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
|
|
18221
18311
|
}
|
|
18222
18312
|
}, [resolved, loading, selectedStep, activeStepId]);
|
|
18223
|
-
const [edges, setEdges] =
|
|
18313
|
+
const [edges, setEdges] = React46.useState({
|
|
18224
18314
|
left: false,
|
|
18225
18315
|
right: false
|
|
18226
18316
|
});
|
|
18227
|
-
const updateEdges =
|
|
18317
|
+
const updateEdges = React46.useCallback(() => {
|
|
18228
18318
|
const sc = scrollerRef.current;
|
|
18229
18319
|
if (!sc) return;
|
|
18230
18320
|
const max = sc.scrollWidth - sc.clientWidth;
|
|
@@ -18233,7 +18323,7 @@ function WorkflowStepperRenderer({
|
|
|
18233
18323
|
const right = sl < max - 1;
|
|
18234
18324
|
setEdges((prev) => prev.left === left && prev.right === right ? prev : { left, right });
|
|
18235
18325
|
}, []);
|
|
18236
|
-
|
|
18326
|
+
React46.useLayoutEffect(() => {
|
|
18237
18327
|
if (resolved !== "full" || loading) return;
|
|
18238
18328
|
updateEdges();
|
|
18239
18329
|
const sc = scrollerRef.current;
|
|
@@ -18289,7 +18379,7 @@ function WorkflowStepperRenderer({
|
|
|
18289
18379
|
const reached = s.status !== "pending";
|
|
18290
18380
|
const clickable = interactive && reached;
|
|
18291
18381
|
const size = act ? 11 : done ? 9 : 8;
|
|
18292
|
-
return /* @__PURE__ */ jsxs(
|
|
18382
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
18293
18383
|
i > 0 && /* @__PURE__ */ jsx(
|
|
18294
18384
|
"span",
|
|
18295
18385
|
{
|
|
@@ -18433,7 +18523,7 @@ function WorkflowStepperRenderer({
|
|
|
18433
18523
|
const color = statusColor3(step.status);
|
|
18434
18524
|
const humans = ((_a2 = step.assignees) != null ? _a2 : []).filter((a) => a.kind === "human");
|
|
18435
18525
|
const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
|
|
18436
|
-
return /* @__PURE__ */ jsxs(
|
|
18526
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
18437
18527
|
i > 0 && /* @__PURE__ */ jsx(
|
|
18438
18528
|
"div",
|
|
18439
18529
|
{
|
|
@@ -18799,11 +18889,11 @@ function FieldDetail({
|
|
|
18799
18889
|
}) {
|
|
18800
18890
|
var _a, _b, _c, _d;
|
|
18801
18891
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2, SURFACE: SURFACE2, ACCENT: ACCENT2 } = useTheme();
|
|
18802
|
-
const [editing, setEditing] =
|
|
18803
|
-
const [draft, setDraft] =
|
|
18804
|
-
const [saving, setSaving] =
|
|
18805
|
-
const [saveError, setSaveError] =
|
|
18806
|
-
const textareaRef =
|
|
18892
|
+
const [editing, setEditing] = React46.useState(false);
|
|
18893
|
+
const [draft, setDraft] = React46.useState("");
|
|
18894
|
+
const [saving, setSaving] = React46.useState(false);
|
|
18895
|
+
const [saveError, setSaveError] = React46.useState(null);
|
|
18896
|
+
const textareaRef = React46.useRef(null);
|
|
18807
18897
|
const color = fieldColor(field, SECONDARY2);
|
|
18808
18898
|
const corrected = field.state === "corrected";
|
|
18809
18899
|
const startEdit = (e) => {
|
|
@@ -19313,7 +19403,7 @@ function FieldDetails({
|
|
|
19313
19403
|
},
|
|
19314
19404
|
children: facts.map((f) => {
|
|
19315
19405
|
var _a2;
|
|
19316
|
-
return /* @__PURE__ */ jsxs(
|
|
19406
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
19317
19407
|
/* @__PURE__ */ jsx("dt", { style: { fontSize: "12px", color: MUTED2 }, children: f.label }),
|
|
19318
19408
|
/* @__PURE__ */ jsxs(
|
|
19319
19409
|
"dd",
|
|
@@ -19412,7 +19502,7 @@ function FieldAuditLog({
|
|
|
19412
19502
|
fields = []
|
|
19413
19503
|
}) {
|
|
19414
19504
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
19415
|
-
const fieldLabelMap =
|
|
19505
|
+
const fieldLabelMap = React46.useMemo(() => {
|
|
19416
19506
|
var _a;
|
|
19417
19507
|
const map = {};
|
|
19418
19508
|
for (const f of fields) map[f.field_key] = (_a = f.label) != null ? _a : f.field_key;
|
|
@@ -19611,10 +19701,10 @@ function PageOverlay({
|
|
|
19611
19701
|
secondary
|
|
19612
19702
|
}) {
|
|
19613
19703
|
const { PAPER: PAPER2, MUTED: MUTED2 } = useTheme();
|
|
19614
|
-
const imgRef =
|
|
19615
|
-
const selectedBoxRef =
|
|
19616
|
-
const [px, setPx] =
|
|
19617
|
-
|
|
19704
|
+
const imgRef = React46.useRef(null);
|
|
19705
|
+
const selectedBoxRef = React46.useRef(null);
|
|
19706
|
+
const [px, setPx] = React46.useState(null);
|
|
19707
|
+
React46.useEffect(() => {
|
|
19618
19708
|
const el = imgRef.current;
|
|
19619
19709
|
if (!el) return;
|
|
19620
19710
|
const measure = () => {
|
|
@@ -19628,7 +19718,7 @@ function PageOverlay({
|
|
|
19628
19718
|
ro.observe(el);
|
|
19629
19719
|
return () => ro.disconnect();
|
|
19630
19720
|
}, [page.imageUrl]);
|
|
19631
|
-
|
|
19721
|
+
React46.useEffect(() => {
|
|
19632
19722
|
if (!selectedKey) return;
|
|
19633
19723
|
if (!fields.some((f) => f.field_key === selectedKey && f.bbox)) return;
|
|
19634
19724
|
const el = selectedBoxRef.current;
|
|
@@ -19730,8 +19820,8 @@ function ExtractionDetail({
|
|
|
19730
19820
|
auditLoading
|
|
19731
19821
|
}) {
|
|
19732
19822
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
19733
|
-
const selectedCardRef =
|
|
19734
|
-
|
|
19823
|
+
const selectedCardRef = React46.useRef(null);
|
|
19824
|
+
React46.useEffect(() => {
|
|
19735
19825
|
if (!selectedKey || tab !== "fields") return;
|
|
19736
19826
|
const el = selectedCardRef.current;
|
|
19737
19827
|
if (el && typeof el.scrollIntoView === "function") {
|
|
@@ -19902,7 +19992,7 @@ function ExtractionModal({
|
|
|
19902
19992
|
children
|
|
19903
19993
|
}) {
|
|
19904
19994
|
const { BORDER: BORDER3, MUTED: MUTED2, SURFACE: SURFACE2, FOREGROUND: FOREGROUND2, SCRIM: SCRIM2 } = useTheme();
|
|
19905
|
-
|
|
19995
|
+
React46.useEffect(() => {
|
|
19906
19996
|
if (!open) return;
|
|
19907
19997
|
const onKey = (e) => {
|
|
19908
19998
|
if (e.key === "Escape") onClose();
|
|
@@ -20031,19 +20121,19 @@ function ExtractionModal({
|
|
|
20031
20121
|
function DocumentFieldExtractionResolver(p) {
|
|
20032
20122
|
var _a, _b;
|
|
20033
20123
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SURFACE: SURFACE2, SHADOW: SHADOW2, ACCENT: ACCENT2 } = useTheme();
|
|
20034
|
-
const [selectedKey, setSelectedKey] =
|
|
20035
|
-
const [open, setOpen] =
|
|
20036
|
-
const [tab, setTab] =
|
|
20124
|
+
const [selectedKey, setSelectedKey] = React46.useState(null);
|
|
20125
|
+
const [open, setOpen] = React46.useState(false);
|
|
20126
|
+
const [tab, setTab] = React46.useState("fields");
|
|
20037
20127
|
const pages = (_a = p.pages) != null ? _a : [];
|
|
20038
20128
|
const fields = (_b = p.fields) != null ? _b : [];
|
|
20039
20129
|
const editable = typeof p.onFieldSave === "function";
|
|
20040
20130
|
const onLoadAudit = p.onLoadAudit;
|
|
20041
|
-
|
|
20131
|
+
React46.useEffect(() => {
|
|
20042
20132
|
if (tab === "audit" && onLoadAudit) {
|
|
20043
20133
|
onLoadAudit();
|
|
20044
20134
|
}
|
|
20045
20135
|
}, [tab, onLoadAudit]);
|
|
20046
|
-
const correctionCounts =
|
|
20136
|
+
const correctionCounts = React46.useMemo(() => {
|
|
20047
20137
|
var _a2, _b2;
|
|
20048
20138
|
const counts = {};
|
|
20049
20139
|
for (const ev of (_a2 = p.auditEvents) != null ? _a2 : []) {
|
|
@@ -20289,8 +20379,8 @@ function formatAmount2(amount, currency = "USD") {
|
|
|
20289
20379
|
return `${sign}${symbol}${body}`;
|
|
20290
20380
|
}
|
|
20291
20381
|
function useContainerWidth2(ref) {
|
|
20292
|
-
const [w, setW] =
|
|
20293
|
-
|
|
20382
|
+
const [w, setW] = React46.useState(0);
|
|
20383
|
+
React46.useLayoutEffect(() => {
|
|
20294
20384
|
const el = ref.current;
|
|
20295
20385
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
20296
20386
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -20385,8 +20475,8 @@ function ValueAdjuster({
|
|
|
20385
20475
|
const { SURFACE_MUTED: SURFACE_MUTED2 } = useTheme();
|
|
20386
20476
|
const adjust = option.adjust;
|
|
20387
20477
|
const suggested = clampToRange((_a = option.value) != null ? _a : adjust.min, adjust);
|
|
20388
|
-
const [value, setValue] =
|
|
20389
|
-
const [text, setText] =
|
|
20478
|
+
const [value, setValue] = React46.useState(suggested);
|
|
20479
|
+
const [text, setText] = React46.useState(String(suggested));
|
|
20390
20480
|
const step = (_b = adjust.step) != null ? _b : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
|
|
20391
20481
|
const pct = adjust.max > adjust.min ? (value - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
20392
20482
|
const suggestedPct = adjust.max > adjust.min ? (suggested - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
@@ -20592,10 +20682,10 @@ function DecisionCardRenderer({
|
|
|
20592
20682
|
}) {
|
|
20593
20683
|
var _a, _b, _c;
|
|
20594
20684
|
const { BORDER: BORDER3, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2, SURFACE: SURFACE2, SURFACE_MUTED: SURFACE_MUTED2, SHADOW: SHADOW2 } = useTheme();
|
|
20595
|
-
const rootRef =
|
|
20685
|
+
const rootRef = React46.useRef(null);
|
|
20596
20686
|
const width = useContainerWidth2(rootRef);
|
|
20597
20687
|
const stacked = width > 0 && width < STACK_BELOW;
|
|
20598
|
-
const [adjustingIdx, setAdjustingIdx] =
|
|
20688
|
+
const [adjustingIdx, setAdjustingIdx] = React46.useState(null);
|
|
20599
20689
|
const options = (_a = data.options) != null ? _a : [];
|
|
20600
20690
|
const recommendedIdx = Math.max(
|
|
20601
20691
|
0,
|
|
@@ -20896,8 +20986,8 @@ function DecisionCardResolver(p) {
|
|
|
20896
20986
|
const decisionId = (_a = p.id) != null ? _a : p.title;
|
|
20897
20987
|
const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
|
|
20898
20988
|
const initial = hostResolved != null ? hostResolved : p.resolved ? composeResolution(p, p.resolved.option, p.resolved.value) : null;
|
|
20899
|
-
const [localResolved, setLocalResolved] =
|
|
20900
|
-
|
|
20989
|
+
const [localResolved, setLocalResolved] = React46.useState(initial);
|
|
20990
|
+
React46.useEffect(() => {
|
|
20901
20991
|
if (hostResolved !== void 0) setLocalResolved(hostResolved);
|
|
20902
20992
|
}, [hostResolved]);
|
|
20903
20993
|
const resolved = hostResolved != null ? hostResolved : localResolved;
|
|
@@ -20971,11 +21061,11 @@ function DecisionQueueRenderer({
|
|
|
20971
21061
|
var _a;
|
|
20972
21062
|
const { BORDER: BORDER3, MUTED: MUTED2, ACCENT: ACCENT2, SURFACE: SURFACE2, SURFACE_MUTED: SURFACE_MUTED2, BORDER_SOFT: BORDER_SOFT2, PAPER: PAPER2, SHADOW: SHADOW2 } = useTheme();
|
|
20973
21063
|
const items = (_a = data.items) != null ? _a : [];
|
|
20974
|
-
const [decisions, setDecisions] =
|
|
21064
|
+
const [decisions, setDecisions] = React46.useState(
|
|
20975
21065
|
() => items.map(() => void 0)
|
|
20976
21066
|
);
|
|
20977
21067
|
const firstUndecided = decisions.findIndex((d) => !d);
|
|
20978
|
-
const [focusIdx, setFocusIdx] =
|
|
21068
|
+
const [focusIdx, setFocusIdx] = React46.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
20979
21069
|
const isSubmitted = submitted != null;
|
|
20980
21070
|
const shown = isSubmitted ? items.map(
|
|
20981
21071
|
(item, i) => {
|
|
@@ -21000,16 +21090,16 @@ function DecisionQueueRenderer({
|
|
|
21000
21090
|
const final = decisions;
|
|
21001
21091
|
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
21002
21092
|
};
|
|
21003
|
-
const onReadyRef =
|
|
21004
|
-
|
|
21093
|
+
const onReadyRef = React46.useRef(onReady);
|
|
21094
|
+
React46.useEffect(() => {
|
|
21005
21095
|
onReadyRef.current = onReady;
|
|
21006
21096
|
});
|
|
21007
|
-
|
|
21097
|
+
React46.useEffect(() => {
|
|
21008
21098
|
if (!onReadyRef.current) return;
|
|
21009
21099
|
const msg = allDecided ? composeQueueMessage(items, decisions) : null;
|
|
21010
21100
|
onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
|
|
21011
21101
|
}, [decisions, allDecided, isSubmitted]);
|
|
21012
|
-
|
|
21102
|
+
React46.useEffect(() => {
|
|
21013
21103
|
if (!submitRef) return;
|
|
21014
21104
|
submitRef.current = handleSubmit;
|
|
21015
21105
|
return () => {
|
|
@@ -21234,7 +21324,7 @@ function DecisionQueueResolver(p) {
|
|
|
21234
21324
|
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
21235
21325
|
const queueId = (_b = (_a = p.id) != null ? _a : p.title) != null ? _b : "decision-queue";
|
|
21236
21326
|
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
21237
|
-
const [localSubmitted, setLocalSubmitted] =
|
|
21327
|
+
const [localSubmitted, setLocalSubmitted] = React46.useState(null);
|
|
21238
21328
|
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
21239
21329
|
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
21240
21330
|
const handleSubmit = (decisions, message) => {
|