@agentruntime-labs/apps-react 0.0.0-stage → 0.1.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/LICENSE +55 -0
- package/NOTICE +2 -0
- package/README.md +36 -2
- package/dist/host/AgentRuntimeApp.d.ts +37 -0
- package/dist/host/EmbeddedApp.d.ts +49 -0
- package/dist/host/provider.d.ts +41 -0
- package/dist/host/theme.d.ts +50 -0
- package/dist/host/useAgentRuntimeApp.d.ts +70 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +1816 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/displayValue.d.ts +3 -0
- package/dist/lib/document.d.ts +13 -0
- package/dist/lib/eventSteps.d.ts +11 -0
- package/dist/lib/layout.d.ts +23 -0
- package/dist/lib/nodeNames.d.ts +6 -0
- package/dist/lib/rowSelection.d.ts +44 -0
- package/dist/lib/runSteps.d.ts +61 -0
- package/dist/lib/safeUrl.d.ts +8 -0
- package/dist/lib/surfaceFileValues.d.ts +29 -0
- package/dist/renderer/SurfaceFiles.d.ts +14 -0
- package/dist/renderer/SurfaceRenderer.d.ts +22 -0
- package/dist/renderer/registry.d.ts +35 -0
- package/dist/styles.css +1 -0
- package/dist/ui/button.d.ts +12 -0
- package/dist/ui/fields.d.ts +15 -0
- package/dist/ui/hostStyled.d.ts +12 -0
- package/dist/ui/icons.d.ts +11 -0
- package/dist/ui/portal.d.ts +6 -0
- package/dist/ui/select.d.ts +11 -0
- package/dist/ui/table.d.ts +8 -0
- package/package.json +84 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,1816 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n, jsxs as d, Fragment as We } from "react/jsx-runtime";
|
|
3
|
+
import * as V from "react";
|
|
4
|
+
import { createContext as mt, useRef as ae, useMemo as xe, useContext as Ye, useState as _, useEffect as Y, isValidElement as Ht, cloneElement as Gt, Fragment as Jt, useCallback as K, useId as Wt } from "react";
|
|
5
|
+
import { createClient as Yt, createEmbedTransport as Xt, EmbedError as Te, SecretKeyError as Zt, ValidationError as Qt, NetworkError as ht, NotFoundError as er, AuthenticationError as tr, PermissionError as rr } from "@agentruntime-labs/apps-js";
|
|
6
|
+
export * from "@agentruntime-labs/apps-js";
|
|
7
|
+
import { clsx as nr } from "clsx";
|
|
8
|
+
import { twMerge as ir } from "tailwind-merge";
|
|
9
|
+
import { cva as pt } from "class-variance-authority";
|
|
10
|
+
import * as Ve from "@radix-ui/react-checkbox";
|
|
11
|
+
import * as Pe from "@radix-ui/react-switch";
|
|
12
|
+
import * as F from "@radix-ui/react-select";
|
|
13
|
+
const Xe = mt(null);
|
|
14
|
+
function mn({
|
|
15
|
+
baseUrl: e,
|
|
16
|
+
getToken: t,
|
|
17
|
+
publishableKey: r,
|
|
18
|
+
tenantId: i,
|
|
19
|
+
projectId: o,
|
|
20
|
+
transport: l,
|
|
21
|
+
clientOptions: f,
|
|
22
|
+
client: x,
|
|
23
|
+
components: h,
|
|
24
|
+
theme: b,
|
|
25
|
+
colorScheme: a,
|
|
26
|
+
children: p
|
|
27
|
+
}) {
|
|
28
|
+
const v = ae(t);
|
|
29
|
+
v.current = t;
|
|
30
|
+
const s = !!t, c = JSON.stringify(f ?? {}), y = xe(() => x || Yt({
|
|
31
|
+
...f,
|
|
32
|
+
baseUrl: e,
|
|
33
|
+
publishableKey: r,
|
|
34
|
+
tenantId: i,
|
|
35
|
+
projectId: o,
|
|
36
|
+
transport: l,
|
|
37
|
+
getToken: s ? () => v.current?.() : void 0
|
|
38
|
+
}), [x, e, r, i, o, l, s, c]), g = xe(() => ({ client: y, components: h, theme: b, colorScheme: a }), [y, h, b, a]);
|
|
39
|
+
return /* @__PURE__ */ n(Xe.Provider, { value: g, children: p });
|
|
40
|
+
}
|
|
41
|
+
function hn() {
|
|
42
|
+
const e = Ye(Xe);
|
|
43
|
+
if (!e) throw new Error("useAgentRuntime: wrap your app in <AgentRuntimeProvider>.");
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
function gt() {
|
|
47
|
+
return Ye(Xe);
|
|
48
|
+
}
|
|
49
|
+
function w(...e) {
|
|
50
|
+
return ir(nr(e));
|
|
51
|
+
}
|
|
52
|
+
const ar = pt(
|
|
53
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
54
|
+
{
|
|
55
|
+
variants: {
|
|
56
|
+
variant: {
|
|
57
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
58
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
59
|
+
outline: "border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
60
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
61
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
62
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
63
|
+
},
|
|
64
|
+
size: {
|
|
65
|
+
default: "h-10 px-4 py-2",
|
|
66
|
+
sm: "h-9 rounded-md px-3",
|
|
67
|
+
lg: "h-11 rounded-md px-8",
|
|
68
|
+
icon: "h-10 w-10"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
defaultVariants: {
|
|
72
|
+
variant: "default",
|
|
73
|
+
size: "default"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
), X = V.forwardRef(({ className: e, variant: t, size: r, ...i }, o) => /* @__PURE__ */ n("button", { className: w(ar({ variant: t, size: r }), e), ref: o, ...i }));
|
|
77
|
+
X.displayName = "Button";
|
|
78
|
+
function or({ style: e, children: t, ...r }) {
|
|
79
|
+
return /* @__PURE__ */ n("div", { "data-ar-custom": "", ...r, style: { display: "contents", ...e }, children: t });
|
|
80
|
+
}
|
|
81
|
+
function ee({ children: e, ...t }) {
|
|
82
|
+
return /* @__PURE__ */ n(
|
|
83
|
+
"svg",
|
|
84
|
+
{
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
86
|
+
width: "24",
|
|
87
|
+
height: "24",
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
fill: "none",
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
strokeWidth: "2",
|
|
92
|
+
strokeLinecap: "round",
|
|
93
|
+
strokeLinejoin: "round",
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
...t,
|
|
96
|
+
children: e
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
const bt = (e) => /* @__PURE__ */ n(ee, { ...e, children: /* @__PURE__ */ n("path", { d: "M20 6 9 17l-5-5" }) }), yt = (e) => /* @__PURE__ */ n(ee, { ...e, children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) }), sr = (e) => /* @__PURE__ */ n(ee, { ...e, children: /* @__PURE__ */ n("path", { d: "m18 15-6-6-6 6" }) }), ve = (e) => /* @__PURE__ */ d(ee, { ...e, children: [
|
|
101
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
102
|
+
/* @__PURE__ */ n("path", { d: "M12 8v4M12 16h.01" })
|
|
103
|
+
] }), lr = (e) => /* @__PURE__ */ d(ee, { ...e, children: [
|
|
104
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
105
|
+
/* @__PURE__ */ n("path", { d: "m9 12 2 2 4-4" })
|
|
106
|
+
] }), cr = (e) => /* @__PURE__ */ d(ee, { ...e, children: [
|
|
107
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
108
|
+
/* @__PURE__ */ n("path", { d: "M12 16v-4M12 8h.01" })
|
|
109
|
+
] }), Ze = (e) => /* @__PURE__ */ n(ee, { ...e, children: /* @__PURE__ */ n("path", { d: "M18 6 6 18M6 6l12 12" }) }), dr = (e) => /* @__PURE__ */ d(ee, { ...e, children: [
|
|
110
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
111
|
+
/* @__PURE__ */ n("path", { d: "m3 3 18 18M21 15l-5-5-3 3" })
|
|
112
|
+
] }), wt = (e) => /* @__PURE__ */ d(ee, { ...e, children: [
|
|
113
|
+
/* @__PURE__ */ n("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
114
|
+
/* @__PURE__ */ n("path", { d: "M14 2v6h6" })
|
|
115
|
+
] }), ur = (e) => /* @__PURE__ */ n(ee, { ...e, children: /* @__PURE__ */ n("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) }), xt = V.forwardRef(({ className: e, type: t, ...r }, i) => /* @__PURE__ */ n(
|
|
116
|
+
"input",
|
|
117
|
+
{
|
|
118
|
+
type: t,
|
|
119
|
+
className: w(
|
|
120
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
121
|
+
e
|
|
122
|
+
),
|
|
123
|
+
ref: i,
|
|
124
|
+
...r
|
|
125
|
+
}
|
|
126
|
+
));
|
|
127
|
+
xt.displayName = "Input";
|
|
128
|
+
const vt = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
129
|
+
"textarea",
|
|
130
|
+
{
|
|
131
|
+
className: w(
|
|
132
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
133
|
+
e
|
|
134
|
+
),
|
|
135
|
+
ref: r,
|
|
136
|
+
...t
|
|
137
|
+
}
|
|
138
|
+
));
|
|
139
|
+
vt.displayName = "Textarea";
|
|
140
|
+
const fr = pt(
|
|
141
|
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
142
|
+
{
|
|
143
|
+
variants: {
|
|
144
|
+
variant: {
|
|
145
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
146
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
147
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
148
|
+
success: "border-transparent bg-success text-success-foreground hover:bg-success/80",
|
|
149
|
+
warning: "border-transparent bg-warning text-warning-foreground hover:bg-warning/80",
|
|
150
|
+
info: "border-transparent bg-info text-info-foreground hover:bg-info/80",
|
|
151
|
+
outline: "text-foreground"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
defaultVariants: { variant: "default" }
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
function mr({ className: e, variant: t, ...r }) {
|
|
158
|
+
return /* @__PURE__ */ n("div", { className: w(fr({ variant: t }), e), ...r });
|
|
159
|
+
}
|
|
160
|
+
const kt = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
161
|
+
Ve.Root,
|
|
162
|
+
{
|
|
163
|
+
ref: r,
|
|
164
|
+
className: w(
|
|
165
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
166
|
+
e
|
|
167
|
+
),
|
|
168
|
+
...t,
|
|
169
|
+
children: /* @__PURE__ */ n(Ve.Indicator, { className: "flex items-center justify-center text-current", children: /* @__PURE__ */ n(bt, { className: "h-4 w-4" }) })
|
|
170
|
+
}
|
|
171
|
+
));
|
|
172
|
+
kt.displayName = Ve.Root.displayName;
|
|
173
|
+
const Nt = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
174
|
+
Pe.Root,
|
|
175
|
+
{
|
|
176
|
+
className: w(
|
|
177
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
178
|
+
e
|
|
179
|
+
),
|
|
180
|
+
...t,
|
|
181
|
+
ref: r,
|
|
182
|
+
children: /* @__PURE__ */ n(Pe.Thumb, { className: "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0" })
|
|
183
|
+
}
|
|
184
|
+
));
|
|
185
|
+
Nt.displayName = Pe.Root.displayName;
|
|
186
|
+
const St = mt(null);
|
|
187
|
+
function hr() {
|
|
188
|
+
return Ye(St);
|
|
189
|
+
}
|
|
190
|
+
const pr = F.Root, gr = F.Value, Ct = V.forwardRef(({ className: e, children: t, ...r }, i) => /* @__PURE__ */ d(
|
|
191
|
+
F.Trigger,
|
|
192
|
+
{
|
|
193
|
+
ref: i,
|
|
194
|
+
className: w(
|
|
195
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
196
|
+
e
|
|
197
|
+
),
|
|
198
|
+
...r,
|
|
199
|
+
children: [
|
|
200
|
+
t,
|
|
201
|
+
/* @__PURE__ */ n(F.Icon, { asChild: !0, children: /* @__PURE__ */ n(yt, { className: "h-4 w-4 opacity-50" }) })
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
));
|
|
205
|
+
Ct.displayName = F.Trigger.displayName;
|
|
206
|
+
const Tt = V.forwardRef(({ className: e, children: t, position: r = "popper", ...i }, o) => {
|
|
207
|
+
const l = hr();
|
|
208
|
+
return /* @__PURE__ */ n(F.Portal, { container: l ?? void 0, children: /* @__PURE__ */ d(
|
|
209
|
+
F.Content,
|
|
210
|
+
{
|
|
211
|
+
ref: o,
|
|
212
|
+
className: w(
|
|
213
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
214
|
+
r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
215
|
+
e
|
|
216
|
+
),
|
|
217
|
+
position: r,
|
|
218
|
+
...i,
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ n(F.ScrollUpButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ n(sr, { className: "h-4 w-4" }) }),
|
|
221
|
+
/* @__PURE__ */ n(
|
|
222
|
+
F.Viewport,
|
|
223
|
+
{
|
|
224
|
+
className: w(
|
|
225
|
+
"p-1",
|
|
226
|
+
r === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
227
|
+
),
|
|
228
|
+
children: t
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ n(F.ScrollDownButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ n(yt, { className: "h-4 w-4" }) })
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
) });
|
|
235
|
+
});
|
|
236
|
+
Tt.displayName = F.Content.displayName;
|
|
237
|
+
const It = V.forwardRef(({ className: e, children: t, ...r }, i) => /* @__PURE__ */ d(
|
|
238
|
+
F.Item,
|
|
239
|
+
{
|
|
240
|
+
ref: i,
|
|
241
|
+
className: w(
|
|
242
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
243
|
+
e
|
|
244
|
+
),
|
|
245
|
+
...r,
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ n("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ n(F.ItemIndicator, { children: /* @__PURE__ */ n(bt, { className: "h-4 w-4" }) }) }),
|
|
248
|
+
/* @__PURE__ */ n(F.ItemText, { children: t })
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
));
|
|
252
|
+
It.displayName = F.Item.displayName;
|
|
253
|
+
const _t = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ n("table", { ref: r, className: w("w-full caption-bottom text-sm", e), ...t }) }));
|
|
254
|
+
_t.displayName = "Table";
|
|
255
|
+
const Rt = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("thead", { ref: r, className: w("[&_tr]:border-b", e), ...t }));
|
|
256
|
+
Rt.displayName = "TableHeader";
|
|
257
|
+
const At = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("tbody", { ref: r, className: w("[&_tr:last-child]:border-0", e), ...t }));
|
|
258
|
+
At.displayName = "TableBody";
|
|
259
|
+
const Ce = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("tr", { ref: r, className: w("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", e), ...t }));
|
|
260
|
+
Ce.displayName = "TableRow";
|
|
261
|
+
const Et = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
262
|
+
"th",
|
|
263
|
+
{
|
|
264
|
+
ref: r,
|
|
265
|
+
className: w("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", e),
|
|
266
|
+
...t
|
|
267
|
+
}
|
|
268
|
+
));
|
|
269
|
+
Et.displayName = "TableHead";
|
|
270
|
+
const $e = V.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("td", { ref: r, className: w("p-4 align-middle [&:has([role=checkbox])]:pr-0", e), ...t }));
|
|
271
|
+
$e.displayName = "TableCell";
|
|
272
|
+
function br(e, t = /* @__PURE__ */ new Set()) {
|
|
273
|
+
return e && (t.add(e.id), e.children?.forEach((r) => br(r, t))), t;
|
|
274
|
+
}
|
|
275
|
+
function De(e, t) {
|
|
276
|
+
if (e.id === t) return e;
|
|
277
|
+
for (const r of e.children ?? []) {
|
|
278
|
+
const i = De(r, t);
|
|
279
|
+
if (i) return i;
|
|
280
|
+
}
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
function yr(e, t, r = null) {
|
|
284
|
+
if (e.id === t) return r;
|
|
285
|
+
for (const i of e.children ?? []) {
|
|
286
|
+
const o = yr(i, t, e);
|
|
287
|
+
if (o) return o;
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
function Re(e, t, r = "root") {
|
|
292
|
+
t(e, r), e.children?.forEach((i, o) => Re(i, t, `${r}.children[${o}]`));
|
|
293
|
+
}
|
|
294
|
+
function ke(e) {
|
|
295
|
+
return !!(e && typeof e == "object" && "bind" in e);
|
|
296
|
+
}
|
|
297
|
+
function pn(e) {
|
|
298
|
+
if (!e || typeof e != "object") return null;
|
|
299
|
+
const t = e;
|
|
300
|
+
return !t.root || typeof t.root != "object" ? null : t;
|
|
301
|
+
}
|
|
302
|
+
function Mt(e) {
|
|
303
|
+
switch (String(e.source ?? "")) {
|
|
304
|
+
case "workflow.run":
|
|
305
|
+
return "Start a run to see status";
|
|
306
|
+
case "workflow.node.output":
|
|
307
|
+
return e.node_id ? "Waiting for step output — start a run or open with ?run_id=…" : "Pick a workflow step, then start a run";
|
|
308
|
+
case "workflow.node.state":
|
|
309
|
+
return e.node_id ? "No step status yet — start a run to see gate state" : "Pick a gate step, then start a run";
|
|
310
|
+
case "database.query":
|
|
311
|
+
return "No rows — check the query or browse view params";
|
|
312
|
+
case "connection.read":
|
|
313
|
+
return "No connection data — verify connection id and tool";
|
|
314
|
+
case "tenant.config":
|
|
315
|
+
return "Set this key in App Studio → Config";
|
|
316
|
+
case "static":
|
|
317
|
+
return "—";
|
|
318
|
+
default:
|
|
319
|
+
return "—";
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function Ue(e) {
|
|
323
|
+
if (e == null) return "";
|
|
324
|
+
if (ke(e)) {
|
|
325
|
+
const t = e.bind;
|
|
326
|
+
return Mt(t);
|
|
327
|
+
}
|
|
328
|
+
if (typeof e == "string") return e;
|
|
329
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
330
|
+
if (typeof e == "object")
|
|
331
|
+
try {
|
|
332
|
+
return JSON.stringify(e, null, 2);
|
|
333
|
+
} catch {
|
|
334
|
+
return String(e);
|
|
335
|
+
}
|
|
336
|
+
return String(e);
|
|
337
|
+
}
|
|
338
|
+
function gn(e, t) {
|
|
339
|
+
if (!ke(e)) return !1;
|
|
340
|
+
const r = e.bind;
|
|
341
|
+
return t === Mt(r);
|
|
342
|
+
}
|
|
343
|
+
function Qe(e) {
|
|
344
|
+
return e.type.startsWith("workflow.");
|
|
345
|
+
}
|
|
346
|
+
function nt(e) {
|
|
347
|
+
return !!(e && typeof e == "object" && typeof e.type == "string");
|
|
348
|
+
}
|
|
349
|
+
function Bt(e, t = "onClick") {
|
|
350
|
+
const r = e?.events?.[t];
|
|
351
|
+
return r && typeof r == "object" ? r : {};
|
|
352
|
+
}
|
|
353
|
+
function ge(e, t = "onClick") {
|
|
354
|
+
const r = Bt(e, t);
|
|
355
|
+
return Array.isArray(r.steps) ? r.steps.filter(nt) : nt(r.action) ? [r.action] : [];
|
|
356
|
+
}
|
|
357
|
+
function Be(e, t = "onClick") {
|
|
358
|
+
const r = Bt(e, t).options ?? {};
|
|
359
|
+
return {
|
|
360
|
+
...r,
|
|
361
|
+
require_valid: r.require_valid ?? !0,
|
|
362
|
+
disable_while_running: r.disable_while_running ?? !0
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const wr = 48;
|
|
366
|
+
function xr(e) {
|
|
367
|
+
const t = e.filter((a) => a.layout), r = e.filter((a) => !a.layout);
|
|
368
|
+
if (t.length === 0)
|
|
369
|
+
return r.map((a) => ({ gapAbove: 0, items: [{ node: a, offsetPct: 0, widthPct: 100, minHeight: 0 }] }));
|
|
370
|
+
const i = [...t].sort((a, p) => a.layout.y - p.layout.y || a.layout.x - p.layout.x), o = Math.min(...i.map((a) => a.layout.x)), l = Math.max(...i.map((a) => a.layout.x + a.layout.w)), f = Math.max(1, l - o), x = [];
|
|
371
|
+
for (const a of i) {
|
|
372
|
+
const p = a.layout, v = x[x.length - 1];
|
|
373
|
+
v && p.y < Math.max(...v.map((c) => c.layout.y + c.layout.h)) - 8 && v.every((c) => p.x >= c.layout.x + c.layout.w || p.x + p.w <= c.layout.x) ? v.push(a) : x.push([a]);
|
|
374
|
+
}
|
|
375
|
+
let h = null;
|
|
376
|
+
const b = x.map((a) => {
|
|
377
|
+
const p = Math.min(...a.map((g) => g.layout.y)), v = Math.max(...a.map((g) => g.layout.y + g.layout.h)), s = h === null ? 0 : Math.max(0, Math.min(wr, p - h));
|
|
378
|
+
h = v;
|
|
379
|
+
let c = o;
|
|
380
|
+
const y = [...a].sort((g, m) => g.layout.x - m.layout.x).map((g) => {
|
|
381
|
+
const m = g.layout, k = {
|
|
382
|
+
node: g,
|
|
383
|
+
offsetPct: Math.max(0, m.x - c) / f * 100,
|
|
384
|
+
widthPct: m.w / f * 100,
|
|
385
|
+
minHeight: m.h
|
|
386
|
+
};
|
|
387
|
+
return c = m.x + m.w, k;
|
|
388
|
+
});
|
|
389
|
+
return { gapAbove: s, items: y };
|
|
390
|
+
});
|
|
391
|
+
for (const a of r)
|
|
392
|
+
b.push({ gapAbove: 12, items: [{ node: a, offsetPct: 0, widthPct: 100, minHeight: 0 }] });
|
|
393
|
+
return b;
|
|
394
|
+
}
|
|
395
|
+
const vr = {
|
|
396
|
+
Stack: "Group",
|
|
397
|
+
Section: "Group box",
|
|
398
|
+
Grid: "Columns",
|
|
399
|
+
Text: "Text",
|
|
400
|
+
Label: "Label",
|
|
401
|
+
Badge: "Status tag",
|
|
402
|
+
Link: "Link",
|
|
403
|
+
Video: "Video",
|
|
404
|
+
Table: "Table",
|
|
405
|
+
TextField: "Text field",
|
|
406
|
+
TextArea: "Text area",
|
|
407
|
+
Select: "Dropdown",
|
|
408
|
+
Checkbox: "Checkbox",
|
|
409
|
+
Switch: "Switch",
|
|
410
|
+
Button: "Button"
|
|
411
|
+
};
|
|
412
|
+
function kr(e) {
|
|
413
|
+
return e ? e.kind === "Text" && e.props?.variant === "heading" ? "Heading" : e.kind === "TextField" && e.props?.inputType === "date" ? "Date" : vr[e.kind] ?? e.kind : "";
|
|
414
|
+
}
|
|
415
|
+
function Nr(e) {
|
|
416
|
+
return typeof e == "string" ? e.trim() : typeof e == "number" ? String(e) : "";
|
|
417
|
+
}
|
|
418
|
+
function Ae(e) {
|
|
419
|
+
if (!e) return "";
|
|
420
|
+
const t = e.props ?? {};
|
|
421
|
+
for (const r of ["label", "text", "title", "content"]) {
|
|
422
|
+
const i = t[r];
|
|
423
|
+
if (ke(i)) continue;
|
|
424
|
+
const o = Nr(i);
|
|
425
|
+
if (o) return o.length > 40 ? `${o.slice(0, 39)}…` : o;
|
|
426
|
+
}
|
|
427
|
+
return kr(e);
|
|
428
|
+
}
|
|
429
|
+
const Sr = /* @__PURE__ */ new Set(["TextField", "TextArea", "Select", "Checkbox", "Switch"]);
|
|
430
|
+
function Cr(e) {
|
|
431
|
+
return Sr.has(e);
|
|
432
|
+
}
|
|
433
|
+
function Ke(e) {
|
|
434
|
+
if (typeof e != "object" || e === null || Array.isArray(e)) return null;
|
|
435
|
+
const t = e.file_id;
|
|
436
|
+
return typeof t == "string" && t !== "" ? e : null;
|
|
437
|
+
}
|
|
438
|
+
function Tr(e) {
|
|
439
|
+
return Array.isArray(e) ? e.map(Ke).filter((t) => t !== null) : [];
|
|
440
|
+
}
|
|
441
|
+
function et(e) {
|
|
442
|
+
return !e.missing && (e.mime_type ?? "").toLowerCase().startsWith("image/");
|
|
443
|
+
}
|
|
444
|
+
function tt(e) {
|
|
445
|
+
return e.filename || "File";
|
|
446
|
+
}
|
|
447
|
+
function Ir(e) {
|
|
448
|
+
const t = typeof e == "string" ? e.trim() : "";
|
|
449
|
+
if (t)
|
|
450
|
+
try {
|
|
451
|
+
const r = typeof window < "u" ? window.location.origin : "http://localhost", i = new URL(t, r);
|
|
452
|
+
return i.protocol === "https:" || i.protocol === "http:" || i.protocol === "blob:" ? i.href : void 0;
|
|
453
|
+
} catch {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function it(e) {
|
|
458
|
+
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? "" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
459
|
+
}
|
|
460
|
+
function Ee(e) {
|
|
461
|
+
return Ir(e.url);
|
|
462
|
+
}
|
|
463
|
+
function ze({ label: e, className: t }) {
|
|
464
|
+
return /* @__PURE__ */ d(
|
|
465
|
+
"div",
|
|
466
|
+
{
|
|
467
|
+
role: "img",
|
|
468
|
+
"aria-label": e,
|
|
469
|
+
"data-ar-part": "file-placeholder",
|
|
470
|
+
className: w(
|
|
471
|
+
"flex min-h-12 items-center justify-center gap-1.5 rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground",
|
|
472
|
+
t
|
|
473
|
+
),
|
|
474
|
+
children: [
|
|
475
|
+
/* @__PURE__ */ n(dr, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
476
|
+
/* @__PURE__ */ n("span", { children: e })
|
|
477
|
+
]
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
function _r({ file: e, alt: t }) {
|
|
482
|
+
const r = Ee(e), [i, o] = _(!1);
|
|
483
|
+
return e.missing ? /* @__PURE__ */ n(ze, { label: "File not available" }) : !r || i ? /* @__PURE__ */ n(ze, { label: "Image not available" }) : /* @__PURE__ */ n("img", { className: "max-w-full rounded-md border", src: r, alt: t || e.filename || "", onError: () => o(!0) });
|
|
484
|
+
}
|
|
485
|
+
function jt({ file: e }) {
|
|
486
|
+
const t = Ee(e), [r, i] = _(!1);
|
|
487
|
+
if (e.missing) return /* @__PURE__ */ n(ze, { label: "File not available" });
|
|
488
|
+
const o = tt(e);
|
|
489
|
+
return et(e) && t && !r ? /* @__PURE__ */ d("figure", { className: "flex flex-col gap-1", children: [
|
|
490
|
+
/* @__PURE__ */ n("img", { className: "max-h-96 max-w-full rounded-md border object-contain", src: t, alt: o, onError: () => i(!0) }),
|
|
491
|
+
/* @__PURE__ */ d("figcaption", { className: "text-xs text-muted-foreground", children: [
|
|
492
|
+
o,
|
|
493
|
+
e.size_bytes ? ` · ${it(e.size_bytes)}` : ""
|
|
494
|
+
] })
|
|
495
|
+
] }) : /* @__PURE__ */ d("div", { className: "flex items-center gap-3 rounded-md border p-3 text-sm", children: [
|
|
496
|
+
/* @__PURE__ */ n(wt, { className: "h-5 w-5 shrink-0 text-muted-foreground" }),
|
|
497
|
+
/* @__PURE__ */ d("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
498
|
+
/* @__PURE__ */ n("span", { className: "truncate font-medium", title: o, children: o }),
|
|
499
|
+
e.size_bytes ? /* @__PURE__ */ n("span", { className: "text-xs text-muted-foreground", children: it(e.size_bytes) }) : null
|
|
500
|
+
] }),
|
|
501
|
+
t ? /* @__PURE__ */ d(
|
|
502
|
+
"a",
|
|
503
|
+
{
|
|
504
|
+
href: t,
|
|
505
|
+
download: e.filename || void 0,
|
|
506
|
+
target: "_blank",
|
|
507
|
+
rel: "noopener noreferrer",
|
|
508
|
+
"data-ar-part": "file-open",
|
|
509
|
+
className: "inline-flex h-8 items-center rounded-md border px-3 text-xs font-medium hover:bg-accent",
|
|
510
|
+
children: [
|
|
511
|
+
/* @__PURE__ */ n(ur, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
512
|
+
"Download"
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
) : null
|
|
516
|
+
] });
|
|
517
|
+
}
|
|
518
|
+
function Rr({ file: e, onOpen: t }) {
|
|
519
|
+
const r = Ee(e), i = tt(e);
|
|
520
|
+
return /* @__PURE__ */ n(
|
|
521
|
+
X,
|
|
522
|
+
{
|
|
523
|
+
type: "button",
|
|
524
|
+
variant: "ghost",
|
|
525
|
+
className: "relative aspect-square h-auto w-full overflow-hidden rounded-md border p-0",
|
|
526
|
+
"aria-label": `Open ${i}`,
|
|
527
|
+
title: i,
|
|
528
|
+
onClick: t,
|
|
529
|
+
children: et(e) && r ? /* @__PURE__ */ n("img", { src: r, alt: i, loading: "lazy", className: "h-full w-full object-cover" }) : /* @__PURE__ */ d("span", { className: "flex h-full w-full flex-col items-center justify-center gap-1 bg-muted/30 p-2 text-xs", children: [
|
|
530
|
+
/* @__PURE__ */ n(wt, { className: "h-5 w-5 text-muted-foreground" }),
|
|
531
|
+
/* @__PURE__ */ n("span", { className: "max-w-full truncate", children: i })
|
|
532
|
+
] })
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
function Ar({ files: e, index: t, onIndexChange: r, onClose: i }) {
|
|
537
|
+
const o = e[t], l = Ee(o), f = tt(o), x = e.length - 1, h = ae(null);
|
|
538
|
+
return Y(() => h.current?.focus(), []), /* @__PURE__ */ n("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4", "data-ar-part": "gallery-viewer", onClick: i, children: /* @__PURE__ */ d(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
ref: h,
|
|
542
|
+
role: "dialog",
|
|
543
|
+
"aria-modal": "true",
|
|
544
|
+
"aria-label": f,
|
|
545
|
+
tabIndex: -1,
|
|
546
|
+
className: "w-full max-w-3xl space-y-3 rounded-lg border bg-background p-4 shadow-lg outline-none",
|
|
547
|
+
onClick: (b) => b.stopPropagation(),
|
|
548
|
+
onKeyDown: (b) => {
|
|
549
|
+
b.key === "Escape" && i(), b.key === "ArrowLeft" && t > 0 && r(t - 1), b.key === "ArrowRight" && t < x && r(t + 1);
|
|
550
|
+
},
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
|
|
553
|
+
/* @__PURE__ */ n("h2", { className: "truncate text-sm font-semibold", children: f }),
|
|
554
|
+
/* @__PURE__ */ n("button", { type: "button", "aria-label": "Close", onClick: i, children: /* @__PURE__ */ n(Ze, { className: "h-4 w-4" }) })
|
|
555
|
+
] }),
|
|
556
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
557
|
+
/* @__PURE__ */ n(X, { type: "button", variant: "outline", size: "sm", "aria-label": "Previous", disabled: t <= 0, onClick: () => r(t - 1), children: "‹" }),
|
|
558
|
+
/* @__PURE__ */ n("div", { className: "flex min-h-48 min-w-0 flex-1 items-center justify-center", children: et(o) && l ? /* @__PURE__ */ n("img", { src: l, alt: f, className: "max-h-[70vh] max-w-full rounded-md object-contain" }) : /* @__PURE__ */ n(jt, { file: o }) }),
|
|
559
|
+
/* @__PURE__ */ n(X, { type: "button", variant: "outline", size: "sm", "aria-label": "Next", disabled: t >= x, onClick: () => r(t + 1), children: "›" })
|
|
560
|
+
] }),
|
|
561
|
+
/* @__PURE__ */ d("p", { className: "text-center text-xs text-muted-foreground", children: [
|
|
562
|
+
t + 1,
|
|
563
|
+
" / ",
|
|
564
|
+
e.length
|
|
565
|
+
] })
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
) });
|
|
569
|
+
}
|
|
570
|
+
function Er({ files: e }) {
|
|
571
|
+
const [t, r] = _(null), i = e.filter((o) => !o.missing);
|
|
572
|
+
return i.length === 0 ? null : /* @__PURE__ */ d(We, { children: [
|
|
573
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4", "data-ar-part": "gallery", children: i.map((o, l) => /* @__PURE__ */ n(Rr, { file: o, onOpen: () => r(l) }, `${o.file_id}-${l}`)) }),
|
|
574
|
+
t !== null && i[t] ? /* @__PURE__ */ n(Ar, { files: i, index: t, onIndexChange: r, onClose: () => r(null) }) : null
|
|
575
|
+
] });
|
|
576
|
+
}
|
|
577
|
+
const Ie = "onRowClick", qe = "__row_handle";
|
|
578
|
+
function Mr(e) {
|
|
579
|
+
const t = e.props?.columns;
|
|
580
|
+
return Array.isArray(t) ? t.flatMap((r) => {
|
|
581
|
+
const i = r, o = typeof i.key == "string" ? i.key.trim() : "";
|
|
582
|
+
if (!o) return [];
|
|
583
|
+
const l = typeof i.label == "string" && i.label.trim() ? i.label.trim() : o;
|
|
584
|
+
return [{ key: o, label: l }];
|
|
585
|
+
}) : [];
|
|
586
|
+
}
|
|
587
|
+
function Ft(e) {
|
|
588
|
+
return e.kind === "Table" && (e.props?.selectable === !0 || ge(e, Ie).length > 0);
|
|
589
|
+
}
|
|
590
|
+
function bn(e, t) {
|
|
591
|
+
const r = [];
|
|
592
|
+
return Re(e, (i) => {
|
|
593
|
+
i.kind !== "Table" || !Ft(i) && i.id !== t || r.push({ id: i.id, name: Ae(i), columns: Mr(i) });
|
|
594
|
+
}), r;
|
|
595
|
+
}
|
|
596
|
+
function yn(e, t) {
|
|
597
|
+
return `{{selected.${e}.${t}}}`;
|
|
598
|
+
}
|
|
599
|
+
const Ot = /\{\{\s*selected\.([^.\s{}]+)\.([^{}]+?)\s*\}\}/g, Br = /^\{\{\s*selected\.([^.\s{}]+)\.([^{}]+?)\s*\}\}$/;
|
|
600
|
+
function Lt(e) {
|
|
601
|
+
if (typeof e != "string") return null;
|
|
602
|
+
const t = Br.exec(e.trim());
|
|
603
|
+
return t ? { tableId: t[1], column: t[2].trim() } : null;
|
|
604
|
+
}
|
|
605
|
+
function He(e, t) {
|
|
606
|
+
const r = e?.[t];
|
|
607
|
+
return r && typeof r == "object" && !Array.isArray(r) ? r : null;
|
|
608
|
+
}
|
|
609
|
+
function jr(e, t) {
|
|
610
|
+
if (!e || !t || typeof e != "object" || typeof t != "object") return !1;
|
|
611
|
+
const r = e, i = t;
|
|
612
|
+
return r.id != null && i.id != null ? String(r.id) === String(i.id) : JSON.stringify(at(r)) === JSON.stringify(at(i));
|
|
613
|
+
}
|
|
614
|
+
function at(e) {
|
|
615
|
+
if (!(qe in e)) return e;
|
|
616
|
+
const { [qe]: t, ...r } = e;
|
|
617
|
+
return r;
|
|
618
|
+
}
|
|
619
|
+
function _e(e, t = /* @__PURE__ */ new Set()) {
|
|
620
|
+
if (typeof e == "string")
|
|
621
|
+
for (const r of e.matchAll(Ot)) t.add(r[1]);
|
|
622
|
+
else if (Array.isArray(e))
|
|
623
|
+
for (const r of e) _e(r, t);
|
|
624
|
+
else if (e && typeof e == "object")
|
|
625
|
+
for (const r of Object.values(e)) _e(r, t);
|
|
626
|
+
return t;
|
|
627
|
+
}
|
|
628
|
+
function Fr(e) {
|
|
629
|
+
return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
630
|
+
}
|
|
631
|
+
function Ge(e, t) {
|
|
632
|
+
if (typeof e == "string") {
|
|
633
|
+
const r = Lt(e);
|
|
634
|
+
if (r) {
|
|
635
|
+
const i = He(t, r.tableId)?.[r.column];
|
|
636
|
+
return i ?? "";
|
|
637
|
+
}
|
|
638
|
+
return e.replace(Ot, (i, o, l) => Fr(He(t, o)?.[l.trim()]));
|
|
639
|
+
}
|
|
640
|
+
return Array.isArray(e) ? e.map((r) => Ge(r, t)) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([r, i]) => [r, Ge(i, t)])) : e;
|
|
641
|
+
}
|
|
642
|
+
function wn(e, t) {
|
|
643
|
+
const r = Lt(e);
|
|
644
|
+
if (!r) return null;
|
|
645
|
+
const i = t.find((l) => l.id === r.tableId), o = i?.columns.find((l) => l.key === r.column);
|
|
646
|
+
return `${i?.name ?? r.tableId} · ${o?.label ?? r.column}`;
|
|
647
|
+
}
|
|
648
|
+
function Or(e) {
|
|
649
|
+
if (typeof e != "string" || !e.trim()) return !1;
|
|
650
|
+
try {
|
|
651
|
+
const t = new URL(e.trim());
|
|
652
|
+
return t.protocol === "http:" || t.protocol === "https:";
|
|
653
|
+
} catch {
|
|
654
|
+
return !1;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const Lr = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
658
|
+
function Vr(e) {
|
|
659
|
+
if (typeof e != "string" || !e.trim()) return "#";
|
|
660
|
+
try {
|
|
661
|
+
const t = new URL(e, "https://relative.invalid/");
|
|
662
|
+
return Lr.has(t.protocol) ? e : "#";
|
|
663
|
+
} catch {
|
|
664
|
+
return "#";
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function je(e, t, r) {
|
|
668
|
+
if (!t) return "";
|
|
669
|
+
const i = "rounded-md border border-dashed";
|
|
670
|
+
return e === "Grid" ? w(i, "border-violet-400/50 bg-violet-500/5 p-2") : e === "Section" ? w(i, "border-sky-400/50 bg-sky-500/5 p-2") : w(i, "border-muted-foreground/35 bg-muted/20 p-2", r && "min-h-[3rem]");
|
|
671
|
+
}
|
|
672
|
+
function ie(e, t) {
|
|
673
|
+
return e ?? t;
|
|
674
|
+
}
|
|
675
|
+
function Q(e, t, r) {
|
|
676
|
+
return e == null ? t : ke(e) && !r ? "—" : Ue(e);
|
|
677
|
+
}
|
|
678
|
+
function Se(e) {
|
|
679
|
+
return typeof e == "string" && e.trim() ? e : void 0;
|
|
680
|
+
}
|
|
681
|
+
function ot(e, t) {
|
|
682
|
+
if (t) return !1;
|
|
683
|
+
const r = ge(e, "onClick");
|
|
684
|
+
return r.length > 0 && !r.some(Qe);
|
|
685
|
+
}
|
|
686
|
+
function st(e) {
|
|
687
|
+
const t = Number(e);
|
|
688
|
+
return Number.isInteger(t) && t > 0 ? t : 2;
|
|
689
|
+
}
|
|
690
|
+
function Pr(e) {
|
|
691
|
+
return e === "secondary" || e === "outline" || e === "destructive" || e === "ghost" ? e : "default";
|
|
692
|
+
}
|
|
693
|
+
function we(e, t) {
|
|
694
|
+
return e.children?.map((r) => /* @__PURE__ */ n(me, { ...t, node: r }, r.id));
|
|
695
|
+
}
|
|
696
|
+
function $r(e) {
|
|
697
|
+
return Array.isArray(e) ? e.filter((t) => typeof t == "object" && t !== null) : [];
|
|
698
|
+
}
|
|
699
|
+
function me(e) {
|
|
700
|
+
return e.designMode ? /* @__PURE__ */ n("div", { "data-surface-id": e.node.id, className: "contents", children: /* @__PURE__ */ n(ct, { ...e }) }) : /* @__PURE__ */ n(ct, { ...e });
|
|
701
|
+
}
|
|
702
|
+
function Fe({ node: e, htmlFor: t }) {
|
|
703
|
+
const r = e.props ?? {};
|
|
704
|
+
return r.label ? /* @__PURE__ */ d("label", { className: "text-sm font-medium", htmlFor: t, "data-ar-part": "label", children: [
|
|
705
|
+
String(r.label),
|
|
706
|
+
r.required ? /* @__PURE__ */ d("span", { className: "text-destructive", "aria-hidden": !0, children: [
|
|
707
|
+
" ",
|
|
708
|
+
"*"
|
|
709
|
+
] }) : null
|
|
710
|
+
] }) : null;
|
|
711
|
+
}
|
|
712
|
+
function lt({ required: e, error: t }) {
|
|
713
|
+
return /* @__PURE__ */ d(We, { children: [
|
|
714
|
+
e ? /* @__PURE__ */ n("span", { className: "-ml-1.5 text-destructive", "aria-hidden": !0, children: "*" }) : null,
|
|
715
|
+
t ? /* @__PURE__ */ n("span", { className: "w-full text-sm font-medium text-destructive", "data-ar-part": "error", children: t }) : null
|
|
716
|
+
] });
|
|
717
|
+
}
|
|
718
|
+
function Oe({ message: e }) {
|
|
719
|
+
return e ? /* @__PURE__ */ n("p", { className: "text-sm font-medium text-destructive", "data-ar-part": "error", children: e }) : null;
|
|
720
|
+
}
|
|
721
|
+
function ct(e) {
|
|
722
|
+
const t = e.components?.[e.node.kind];
|
|
723
|
+
if (!t) return /* @__PURE__ */ n(dt, { ...e });
|
|
724
|
+
const { node: r, interactionMode: i = "editable", designMode: o = !1, draft: l, onDraftChange: f, onAction: x, onEvent: h, busyIds: b, fieldErrors: a } = e, p = (s) => /* @__PURE__ */ n("div", { "data-ar-builtin": "", style: { display: "contents" }, children: s }), v = {
|
|
725
|
+
node: r,
|
|
726
|
+
props: r.props ?? {},
|
|
727
|
+
value: l?.[r.id],
|
|
728
|
+
setValue: (s) => f?.(r.id, s),
|
|
729
|
+
emit: (s, c) => {
|
|
730
|
+
h ? h(r, s, c) : r.events?.[s]?.action && x?.(r.id, s, r.events[s].action);
|
|
731
|
+
},
|
|
732
|
+
disabled: i !== "editable",
|
|
733
|
+
busy: !!b?.has(r.id),
|
|
734
|
+
error: a?.[r.id],
|
|
735
|
+
interactionMode: i,
|
|
736
|
+
designMode: o,
|
|
737
|
+
children: r.children?.length ? p(we(r, e)) : null,
|
|
738
|
+
renderNode: (s) => /* @__PURE__ */ n(Jt, { children: p(/* @__PURE__ */ n(me, { ...e, node: s })) }, s.id),
|
|
739
|
+
renderDefault: () => p(/* @__PURE__ */ n(dt, { ...e }))
|
|
740
|
+
};
|
|
741
|
+
return /* @__PURE__ */ n(or, { "data-ar-custom": r.kind, "data-ar-id": r.id, children: /* @__PURE__ */ n(t, { ...v }) });
|
|
742
|
+
}
|
|
743
|
+
function dt(e) {
|
|
744
|
+
const t = Dr(e);
|
|
745
|
+
return Ht(t) ? Gt(t, { "data-ar-kind": e.node.kind, "data-ar-id": e.node.id }) : t;
|
|
746
|
+
}
|
|
747
|
+
function Dr(e) {
|
|
748
|
+
const { node: t, interactionMode: r = "editable", designMode: i = !1, draft: o, onDraftChange: l, onAction: f, onEvent: x, busyIds: h, fieldErrors: b } = e, a = t.props ?? {}, p = b?.[t.id], v = `surface-field-${t.id}`, s = r !== "editable";
|
|
749
|
+
switch (t.kind) {
|
|
750
|
+
case "Stack": {
|
|
751
|
+
const c = ie(a.direction, "vertical"), y = Number(ie(a.gap, 12)), g = Number(ie(a.padding, 0));
|
|
752
|
+
return a.layoutMode === "absolute" && !i ? /* @__PURE__ */ n("div", { className: "flex w-full flex-col", style: { padding: g }, "data-surface-kind": "Canvas", children: xr(t.children ?? []).map((m, k) => /* @__PURE__ */ n(
|
|
753
|
+
"div",
|
|
754
|
+
{
|
|
755
|
+
className: "flex w-full flex-wrap items-start",
|
|
756
|
+
style: { marginTop: k === 0 ? 0 : Math.max(m.gapAbove, 8) },
|
|
757
|
+
children: m.items.map((T) => /* @__PURE__ */ n(
|
|
758
|
+
"div",
|
|
759
|
+
{
|
|
760
|
+
className: "min-w-0",
|
|
761
|
+
style: {
|
|
762
|
+
marginLeft: `${T.offsetPct}%`,
|
|
763
|
+
width: `${T.widthPct}%`,
|
|
764
|
+
minWidth: "min(100%, 160px)",
|
|
765
|
+
minHeight: T.minHeight
|
|
766
|
+
},
|
|
767
|
+
children: /* @__PURE__ */ n(
|
|
768
|
+
me,
|
|
769
|
+
{
|
|
770
|
+
...e,
|
|
771
|
+
node: T.node
|
|
772
|
+
}
|
|
773
|
+
)
|
|
774
|
+
},
|
|
775
|
+
T.node.id
|
|
776
|
+
))
|
|
777
|
+
},
|
|
778
|
+
m.items[0]?.node.id ?? k
|
|
779
|
+
)) }) : a.layoutMode === "absolute" ? /* @__PURE__ */ n("div", { className: "relative w-full", style: { padding: g, minHeight: i ? 120 : void 0 }, children: t.children?.map((m) => {
|
|
780
|
+
const k = m.layout, T = k ? {
|
|
781
|
+
position: "absolute",
|
|
782
|
+
left: k.x,
|
|
783
|
+
top: k.y,
|
|
784
|
+
width: k.w,
|
|
785
|
+
minHeight: k.h,
|
|
786
|
+
height: k.h
|
|
787
|
+
} : void 0;
|
|
788
|
+
return /* @__PURE__ */ n("div", { className: "overflow-hidden", style: T, children: /* @__PURE__ */ n(
|
|
789
|
+
me,
|
|
790
|
+
{
|
|
791
|
+
...e,
|
|
792
|
+
node: m
|
|
793
|
+
}
|
|
794
|
+
) }, m.id);
|
|
795
|
+
}) }) : /* @__PURE__ */ d(
|
|
796
|
+
"div",
|
|
797
|
+
{
|
|
798
|
+
className: w(
|
|
799
|
+
"flex w-full",
|
|
800
|
+
c === "horizontal" ? "flex-row flex-wrap items-center" : "flex-col",
|
|
801
|
+
a.justify === "end" && "justify-end",
|
|
802
|
+
je("Stack", i, !t.children?.length)
|
|
803
|
+
),
|
|
804
|
+
style: { gap: y, padding: g },
|
|
805
|
+
"data-surface-kind": "Stack",
|
|
806
|
+
children: [
|
|
807
|
+
i ? /* @__PURE__ */ n("div", { className: "pointer-events-none text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Stack" }) : null,
|
|
808
|
+
t.children?.map((m) => /* @__PURE__ */ n(
|
|
809
|
+
me,
|
|
810
|
+
{
|
|
811
|
+
...e,
|
|
812
|
+
node: m
|
|
813
|
+
},
|
|
814
|
+
m.id
|
|
815
|
+
))
|
|
816
|
+
]
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
case "Section":
|
|
821
|
+
return /* @__PURE__ */ d("section", { className: w("space-y-3", je("Section", i, !t.children?.length)), "data-surface-kind": "Section", children: [
|
|
822
|
+
a.title ? /* @__PURE__ */ n("h2", { className: "text-lg font-semibold", children: String(a.title) }) : i ? /* @__PURE__ */ n("h2", { className: "text-sm font-medium text-muted-foreground", children: "Section" }) : null,
|
|
823
|
+
t.children?.map((c) => /* @__PURE__ */ n(
|
|
824
|
+
me,
|
|
825
|
+
{
|
|
826
|
+
...e,
|
|
827
|
+
node: c
|
|
828
|
+
},
|
|
829
|
+
c.id
|
|
830
|
+
))
|
|
831
|
+
] });
|
|
832
|
+
case "Text":
|
|
833
|
+
return /* @__PURE__ */ n(
|
|
834
|
+
"p",
|
|
835
|
+
{
|
|
836
|
+
className: w(
|
|
837
|
+
"whitespace-pre-wrap",
|
|
838
|
+
a.variant === "heading" ? "text-lg font-semibold" : "text-sm",
|
|
839
|
+
a.variant === "muted" && "text-muted-foreground"
|
|
840
|
+
),
|
|
841
|
+
children: Q(a.content, "", i)
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
case "Label":
|
|
845
|
+
return /* @__PURE__ */ n("div", { className: "text-sm font-medium whitespace-pre-wrap", children: Q(a.text, "", i) });
|
|
846
|
+
case "Badge":
|
|
847
|
+
return /* @__PURE__ */ n(mr, { variant: "secondary", children: Q(a.label, "", i) });
|
|
848
|
+
case "Button": {
|
|
849
|
+
const c = t.events?.onClick?.action;
|
|
850
|
+
return /* @__PURE__ */ n(
|
|
851
|
+
X,
|
|
852
|
+
{
|
|
853
|
+
type: "button",
|
|
854
|
+
variant: Pr(a.variant),
|
|
855
|
+
disabled: s && !ot(t, i) || a.disabled === !0 || !!h?.has(t.id),
|
|
856
|
+
onClick: () => {
|
|
857
|
+
x ? x(t, "onClick") : c && f?.(t.id, "onClick", c);
|
|
858
|
+
},
|
|
859
|
+
children: Q(a.label, "Action", i)
|
|
860
|
+
}
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
case "TextArea": {
|
|
864
|
+
const c = o?.[t.id] ?? ie(a.value, "");
|
|
865
|
+
return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
866
|
+
/* @__PURE__ */ n(Fe, { node: t, htmlFor: v }),
|
|
867
|
+
/* @__PURE__ */ n(
|
|
868
|
+
vt,
|
|
869
|
+
{
|
|
870
|
+
id: v,
|
|
871
|
+
rows: Number(ie(a.rows, 3)),
|
|
872
|
+
disabled: s || !a.editable,
|
|
873
|
+
placeholder: a.placeholder ? String(a.placeholder) : void 0,
|
|
874
|
+
"aria-invalid": p ? !0 : void 0,
|
|
875
|
+
value: String(c ?? ""),
|
|
876
|
+
onChange: (y) => l?.(t.id, y.target.value)
|
|
877
|
+
}
|
|
878
|
+
),
|
|
879
|
+
/* @__PURE__ */ n(Oe, { message: p })
|
|
880
|
+
] });
|
|
881
|
+
}
|
|
882
|
+
case "Video":
|
|
883
|
+
return Se(a.src) ? /* @__PURE__ */ n("video", { className: "w-full max-w-xl rounded-md border", controls: !!a.controls, src: Se(a.src) }) : i ? /* @__PURE__ */ n("div", { className: "flex h-full min-h-12 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground", children: "Video — set or bind a source URL" }) : null;
|
|
884
|
+
case "Link":
|
|
885
|
+
return /* @__PURE__ */ n("a", { className: "text-primary underline text-sm", href: Vr(ie(a.href, "#")), target: "_blank", rel: "noreferrer", children: Q(a.label, "Open", i) });
|
|
886
|
+
case "Grid":
|
|
887
|
+
return /* @__PURE__ */ d("div", { className: i ? "space-y-1" : void 0, "data-surface-kind": "Grid", children: [
|
|
888
|
+
i ? /* @__PURE__ */ d("div", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
889
|
+
"Grid (",
|
|
890
|
+
st(a.columns),
|
|
891
|
+
" cols)"
|
|
892
|
+
] }) : null,
|
|
893
|
+
/* @__PURE__ */ n(
|
|
894
|
+
"div",
|
|
895
|
+
{
|
|
896
|
+
className: w(
|
|
897
|
+
"grid gap-3",
|
|
898
|
+
je("Grid", i, !t.children?.length)
|
|
899
|
+
),
|
|
900
|
+
style: { gridTemplateColumns: `repeat(${st(a.columns)}, minmax(0, 1fr))` },
|
|
901
|
+
children: we(t, e)
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
] });
|
|
905
|
+
case "Card":
|
|
906
|
+
return /* @__PURE__ */ d("div", { className: "rounded-lg border bg-card p-4 shadow-sm space-y-3", children: [
|
|
907
|
+
a.title ? /* @__PURE__ */ n("h3", { className: "font-medium", children: String(a.title) }) : null,
|
|
908
|
+
we(t, e)
|
|
909
|
+
] });
|
|
910
|
+
case "List":
|
|
911
|
+
return /* @__PURE__ */ n("ul", { className: "space-y-2 text-sm", children: we(t, e) });
|
|
912
|
+
case "Divider":
|
|
913
|
+
return /* @__PURE__ */ n("hr", { className: "border-border" });
|
|
914
|
+
case "Metric":
|
|
915
|
+
return /* @__PURE__ */ d("div", { className: "space-y-1", children: [
|
|
916
|
+
/* @__PURE__ */ n("div", { className: "text-xs text-muted-foreground", children: Q(a.label, "", i) }),
|
|
917
|
+
/* @__PURE__ */ n("div", { className: "text-2xl font-semibold", children: Q(a.value, "", i) })
|
|
918
|
+
] });
|
|
919
|
+
case "Image": {
|
|
920
|
+
const c = Ke(a.file), y = typeof a.alt == "string" ? a.alt : "";
|
|
921
|
+
if (c) return /* @__PURE__ */ n(_r, { file: c, alt: y });
|
|
922
|
+
if (Se(a.src)) return /* @__PURE__ */ n("img", { className: "max-w-full rounded-md border", src: Se(a.src), alt: y });
|
|
923
|
+
const g = a.file !== void 0 && a.file !== null && a.file !== "";
|
|
924
|
+
return g || i ? /* @__PURE__ */ n("div", { className: "flex h-full min-h-12 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground", children: g ? "Image not available" : "Image — set or bind a file or a link" }) : null;
|
|
925
|
+
}
|
|
926
|
+
case "Gallery": {
|
|
927
|
+
const c = Tr(a.files);
|
|
928
|
+
return c.length === 0 ? i ? /* @__PURE__ */ n("div", { className: "flex h-full min-h-12 items-center justify-center rounded-md border border-dashed text-xs text-muted-foreground", children: "Gallery — bind a list of files" }) : null : /* @__PURE__ */ n(Er, { files: c });
|
|
929
|
+
}
|
|
930
|
+
case "TextField": {
|
|
931
|
+
const c = o?.[t.id] ?? ie(a.value, "");
|
|
932
|
+
return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
933
|
+
/* @__PURE__ */ n(Fe, { node: t, htmlFor: v }),
|
|
934
|
+
/* @__PURE__ */ n(
|
|
935
|
+
xt,
|
|
936
|
+
{
|
|
937
|
+
id: v,
|
|
938
|
+
type: a.inputType === "date" ? "date" : a.inputType === "number" ? "number" : "text",
|
|
939
|
+
disabled: s || !a.editable,
|
|
940
|
+
placeholder: a.placeholder ? String(a.placeholder) : void 0,
|
|
941
|
+
"aria-invalid": p ? !0 : void 0,
|
|
942
|
+
value: String(c ?? ""),
|
|
943
|
+
onChange: (y) => l?.(t.id, y.target.value)
|
|
944
|
+
}
|
|
945
|
+
),
|
|
946
|
+
/* @__PURE__ */ n(Oe, { message: p })
|
|
947
|
+
] });
|
|
948
|
+
}
|
|
949
|
+
case "Select": {
|
|
950
|
+
const c = String(o?.[t.id] ?? ie(a.value, "")), y = Array.isArray(a.options) ? a.options : [];
|
|
951
|
+
return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
952
|
+
/* @__PURE__ */ n(Fe, { node: t, htmlFor: v }),
|
|
953
|
+
/* @__PURE__ */ d(
|
|
954
|
+
pr,
|
|
955
|
+
{
|
|
956
|
+
disabled: s || !a.editable,
|
|
957
|
+
value: c,
|
|
958
|
+
onValueChange: (g) => l?.(t.id, g),
|
|
959
|
+
children: [
|
|
960
|
+
/* @__PURE__ */ n(Ct, { id: v, "aria-invalid": p ? !0 : void 0, children: /* @__PURE__ */ n(gr, { placeholder: String(ie(a.placeholder, "Choose…")) }) }),
|
|
961
|
+
/* @__PURE__ */ n(Tt, { "data-ar-part": "menu", children: y.map((g) => {
|
|
962
|
+
const m = g;
|
|
963
|
+
return /* @__PURE__ */ n(It, { value: String(m.value ?? m.label), "data-ar-part": "option", children: String(m.label ?? m.value) }, m.value ?? m.label);
|
|
964
|
+
}) })
|
|
965
|
+
]
|
|
966
|
+
}
|
|
967
|
+
),
|
|
968
|
+
/* @__PURE__ */ n(Oe, { message: p })
|
|
969
|
+
] });
|
|
970
|
+
}
|
|
971
|
+
case "Checkbox": {
|
|
972
|
+
const c = !!(o?.[t.id] ?? a.checked);
|
|
973
|
+
return /* @__PURE__ */ d("label", { className: "flex flex-wrap items-center gap-2 text-sm", children: [
|
|
974
|
+
/* @__PURE__ */ n(
|
|
975
|
+
kt,
|
|
976
|
+
{
|
|
977
|
+
checked: c,
|
|
978
|
+
disabled: s || !a.editable,
|
|
979
|
+
"aria-invalid": p ? !0 : void 0,
|
|
980
|
+
onCheckedChange: (y) => l?.(t.id, !!y)
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
a.label ? /* @__PURE__ */ n("span", { children: String(a.label) }) : null,
|
|
984
|
+
/* @__PURE__ */ n(lt, { required: a.required === !0, error: p })
|
|
985
|
+
] });
|
|
986
|
+
}
|
|
987
|
+
case "Switch": {
|
|
988
|
+
const c = !!(o?.[t.id] ?? a.checked);
|
|
989
|
+
return /* @__PURE__ */ d("label", { className: "flex flex-wrap items-center gap-2 text-sm", children: [
|
|
990
|
+
/* @__PURE__ */ n(
|
|
991
|
+
Nt,
|
|
992
|
+
{
|
|
993
|
+
checked: c,
|
|
994
|
+
disabled: s || !a.editable,
|
|
995
|
+
"aria-invalid": p ? !0 : void 0,
|
|
996
|
+
onCheckedChange: (y) => l?.(t.id, y)
|
|
997
|
+
}
|
|
998
|
+
),
|
|
999
|
+
a.label ? /* @__PURE__ */ n("span", { children: String(a.label) }) : null,
|
|
1000
|
+
/* @__PURE__ */ n(lt, { required: a.required === !0, error: p })
|
|
1001
|
+
] });
|
|
1002
|
+
}
|
|
1003
|
+
case "Table": {
|
|
1004
|
+
const c = (Array.isArray(a.columns) ? a.columns : []).filter(
|
|
1005
|
+
(M) => M?.key !== qe
|
|
1006
|
+
), y = $r(a.rows), g = i && ke(a.rows) ? Ue(a.rows) : "No rows yet", m = !i && Ft(t), k = s || !!h?.has(t.id), T = o?.[t.id], R = (M) => {
|
|
1007
|
+
k || (l?.(t.id, M), ge(t, Ie).length > 0 && x?.(t, Ie, { [t.id]: M }));
|
|
1008
|
+
}, $ = typeof a.title == "string" ? a.title.trim() : "";
|
|
1009
|
+
return /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
1010
|
+
$ ? /* @__PURE__ */ n("h3", { className: "text-sm font-medium", children: $ }) : null,
|
|
1011
|
+
/* @__PURE__ */ d(_t, { role: m ? "grid" : void 0, "aria-label": m || $ ? Ae(t) : void 0, children: [
|
|
1012
|
+
/* @__PURE__ */ n(Rt, { children: /* @__PURE__ */ n(Ce, { children: c.map((M) => {
|
|
1013
|
+
const D = M;
|
|
1014
|
+
return /* @__PURE__ */ n(Et, { "data-ar-part": "header-cell", children: String(D.label ?? D.key) }, D.key ?? D.label);
|
|
1015
|
+
}) }) }),
|
|
1016
|
+
/* @__PURE__ */ d(At, { children: [
|
|
1017
|
+
y.map((M, D) => {
|
|
1018
|
+
const A = m && jr(M, T);
|
|
1019
|
+
return /* @__PURE__ */ n(
|
|
1020
|
+
Ce,
|
|
1021
|
+
{
|
|
1022
|
+
"data-ar-part": "row",
|
|
1023
|
+
...m ? {
|
|
1024
|
+
"aria-selected": A,
|
|
1025
|
+
"aria-disabled": k || void 0,
|
|
1026
|
+
"data-state": A ? "selected" : void 0,
|
|
1027
|
+
tabIndex: k ? -1 : 0,
|
|
1028
|
+
onClick: () => R(M),
|
|
1029
|
+
onKeyDown: (B) => {
|
|
1030
|
+
B.key !== "Enter" && B.key !== " " || (B.preventDefault(), R(M));
|
|
1031
|
+
}
|
|
1032
|
+
} : {},
|
|
1033
|
+
className: w(
|
|
1034
|
+
m && "cursor-pointer data-[state=selected]:bg-primary/10 data-[state=selected]:font-medium data-[state=selected]:shadow-[inset_3px_0_0_0_hsl(var(--ar-primary))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
1035
|
+
m && k && "cursor-not-allowed opacity-60"
|
|
1036
|
+
),
|
|
1037
|
+
children: c.map((B) => {
|
|
1038
|
+
const I = B;
|
|
1039
|
+
return /* @__PURE__ */ n($e, { "data-ar-part": "cell", children: Ue(M[I.key ?? ""]) }, I.key);
|
|
1040
|
+
})
|
|
1041
|
+
},
|
|
1042
|
+
D
|
|
1043
|
+
);
|
|
1044
|
+
}),
|
|
1045
|
+
y.length === 0 ? /* @__PURE__ */ n(Ce, { children: /* @__PURE__ */ n($e, { colSpan: Math.max(1, c.length), className: "py-6 text-center text-xs text-muted-foreground", children: g || "No rows yet" }) }) : null
|
|
1046
|
+
] })
|
|
1047
|
+
] })
|
|
1048
|
+
] });
|
|
1049
|
+
}
|
|
1050
|
+
case "Tabs":
|
|
1051
|
+
return /* @__PURE__ */ n("div", { className: "space-y-3", children: we(t, e) });
|
|
1052
|
+
case "IconButton": {
|
|
1053
|
+
const c = t.events?.onClick?.action;
|
|
1054
|
+
return /* @__PURE__ */ n(
|
|
1055
|
+
X,
|
|
1056
|
+
{
|
|
1057
|
+
type: "button",
|
|
1058
|
+
size: "icon",
|
|
1059
|
+
variant: "ghost",
|
|
1060
|
+
disabled: s && !ot(t, i) || a.disabled === !0 || !!h?.has(t.id),
|
|
1061
|
+
onClick: () => {
|
|
1062
|
+
x ? x(t, "onClick") : c && f?.(t.id, "onClick", c);
|
|
1063
|
+
},
|
|
1064
|
+
"aria-label": Q(a.label, "Action", i),
|
|
1065
|
+
children: Q(a.icon, "•", i)
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
case "FilePreview": {
|
|
1070
|
+
const c = Ke(a.file);
|
|
1071
|
+
return c ? /* @__PURE__ */ n(jt, { file: c }) : /* @__PURE__ */ n("div", { className: "rounded border p-3 text-sm text-muted-foreground", children: Q(a.filename ?? a.label, "File", i) });
|
|
1072
|
+
}
|
|
1073
|
+
default:
|
|
1074
|
+
return /* @__PURE__ */ d("div", { className: "rounded border border-dashed p-3 text-xs text-muted-foreground", children: [
|
|
1075
|
+
"Unsupported component: ",
|
|
1076
|
+
t.kind
|
|
1077
|
+
] });
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
function Vt(e) {
|
|
1081
|
+
return /* @__PURE__ */ n(me, { ...e });
|
|
1082
|
+
}
|
|
1083
|
+
function Ur(e) {
|
|
1084
|
+
const t = {};
|
|
1085
|
+
for (const [r, i] of Object.entries(e ?? {})) {
|
|
1086
|
+
if (typeof i != "string" || !i.trim()) continue;
|
|
1087
|
+
const o = `--ar-${r.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`)}`;
|
|
1088
|
+
t[o] = i;
|
|
1089
|
+
}
|
|
1090
|
+
return t;
|
|
1091
|
+
}
|
|
1092
|
+
function Pt({ theme: e, colorScheme: t = "light", className: r, style: i, children: o, ...l }) {
|
|
1093
|
+
const [f, x] = _(null);
|
|
1094
|
+
return /* @__PURE__ */ d("div", { ...l, className: w("ar-app", r), "data-ar-theme": t, style: { ...Ur(e), ...i }, children: [
|
|
1095
|
+
/* @__PURE__ */ n(St.Provider, { value: f, children: o }),
|
|
1096
|
+
/* @__PURE__ */ n("div", { ref: x, className: "ar-portal", "data-ar-portal": "" })
|
|
1097
|
+
] });
|
|
1098
|
+
}
|
|
1099
|
+
function Je(e) {
|
|
1100
|
+
if (e instanceof Te)
|
|
1101
|
+
switch (e.code) {
|
|
1102
|
+
case "invalid_key":
|
|
1103
|
+
return { title: "This app can't be shown", detail: "Its access key isn't valid." };
|
|
1104
|
+
case "origin_not_allowed":
|
|
1105
|
+
return { title: "This site isn't allowed to show this app", detail: "The app's owner needs to add this site to the app's allowed sites." };
|
|
1106
|
+
case "not_found":
|
|
1107
|
+
return { title: "App not found", detail: "This app or screen isn't available to visitors." };
|
|
1108
|
+
case "rate_limited":
|
|
1109
|
+
return {
|
|
1110
|
+
title: "Too many requests",
|
|
1111
|
+
detail: e.retryAfterSeconds ? `Please try again in ${e.retryAfterSeconds} ${e.retryAfterSeconds === 1 ? "second" : "seconds"}.` : "Please try again in a moment."
|
|
1112
|
+
};
|
|
1113
|
+
case "unavailable":
|
|
1114
|
+
return { title: "Temporarily unavailable", detail: "This app can't be loaded right now. Please try again shortly." };
|
|
1115
|
+
case "bad_input":
|
|
1116
|
+
return { title: "Those values can't be used", detail: e.message || "One of the values given to this app isn't valid." };
|
|
1117
|
+
default:
|
|
1118
|
+
return { title: "Unable to load this app", detail: "Something went wrong. Please try again." };
|
|
1119
|
+
}
|
|
1120
|
+
return e instanceof Zt ? { title: "This app isn't set up correctly", detail: "A secret key was given. Use the app's publishable key (it starts with ar_pk_)." } : e instanceof Qt ? { title: "This app isn't set up correctly", detail: e.message } : e instanceof ht ? { title: "Couldn't reach AgentRuntime", detail: "Check your connection and try again." } : { title: "Unable to load this app", detail: "Something went wrong. Please try again." };
|
|
1121
|
+
}
|
|
1122
|
+
function $t(e) {
|
|
1123
|
+
const { events: t, ...r } = e;
|
|
1124
|
+
return { ...r, children: e.children?.map($t) };
|
|
1125
|
+
}
|
|
1126
|
+
function Kr(e) {
|
|
1127
|
+
return JSON.stringify(Object.entries(e ?? {}).sort(([t], [r]) => t < r ? -1 : t > r ? 1 : 0));
|
|
1128
|
+
}
|
|
1129
|
+
function Le({ className: e }) {
|
|
1130
|
+
return /* @__PURE__ */ n("div", { className: w("animate-pulse rounded-md bg-muted", e) });
|
|
1131
|
+
}
|
|
1132
|
+
function zr({ error: e, onRetry: t }) {
|
|
1133
|
+
const { title: r, detail: i } = Je(e), o = e instanceof Te ? e.code : "error", l = !(e instanceof Te) || ["rate_limited", "unavailable", "unknown", "bad_input"].includes(e.code);
|
|
1134
|
+
return /* @__PURE__ */ d("div", { className: "flex flex-col items-center gap-2 rounded-lg border bg-card px-4 py-8 text-center", role: "alert", "data-ar-part": "embed-error", "data-ar-error": o, children: [
|
|
1135
|
+
/* @__PURE__ */ n(ve, { className: "h-5 w-5 text-destructive" }),
|
|
1136
|
+
/* @__PURE__ */ n("p", { className: "text-sm font-medium", children: r }),
|
|
1137
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: i }),
|
|
1138
|
+
l ? /* @__PURE__ */ n(X, { type: "button", size: "sm", variant: "outline", onClick: t, children: "Try again" }) : null
|
|
1139
|
+
] });
|
|
1140
|
+
}
|
|
1141
|
+
function qr({
|
|
1142
|
+
publishableKey: e,
|
|
1143
|
+
appId: t,
|
|
1144
|
+
view: r,
|
|
1145
|
+
inputs: i,
|
|
1146
|
+
baseUrl: o,
|
|
1147
|
+
inputsDebounceMs: l = 300,
|
|
1148
|
+
className: f,
|
|
1149
|
+
style: x,
|
|
1150
|
+
theme: h,
|
|
1151
|
+
colorScheme: b,
|
|
1152
|
+
components: a,
|
|
1153
|
+
frame: p = !0,
|
|
1154
|
+
loadingFallback: v,
|
|
1155
|
+
errorFallback: s,
|
|
1156
|
+
onError: c,
|
|
1157
|
+
transport: y
|
|
1158
|
+
}) {
|
|
1159
|
+
const g = ae(c);
|
|
1160
|
+
g.current = c;
|
|
1161
|
+
const m = xe(() => {
|
|
1162
|
+
if (y) return { transport: y, error: null };
|
|
1163
|
+
try {
|
|
1164
|
+
return { transport: Xt({ publishableKey: e, baseUrl: o }), error: null };
|
|
1165
|
+
} catch (C) {
|
|
1166
|
+
return { transport: null, error: C };
|
|
1167
|
+
}
|
|
1168
|
+
}, [y, e, o]), k = m.transport, [T, R] = _(null), [$, M] = _(0), [D, A] = _(0);
|
|
1169
|
+
Y(() => {
|
|
1170
|
+
if (!k || r || !t) return;
|
|
1171
|
+
let C = !1;
|
|
1172
|
+
const J = new AbortController();
|
|
1173
|
+
return (async () => {
|
|
1174
|
+
try {
|
|
1175
|
+
const L = await k.getApp({ appId: t, signal: J.signal });
|
|
1176
|
+
C || R({ appId: t, viewId: L.defaultViewId || L.navigation[0]?.view_id || "", error: null });
|
|
1177
|
+
} catch (L) {
|
|
1178
|
+
if (C) return;
|
|
1179
|
+
R({ appId: t, viewId: "", error: L }), g.current?.(L);
|
|
1180
|
+
}
|
|
1181
|
+
})(), () => {
|
|
1182
|
+
C = !0, J.abort();
|
|
1183
|
+
};
|
|
1184
|
+
}, [k, t, r, $]);
|
|
1185
|
+
const B = T?.appId === t ? T : null, I = r || B?.viewId || "", z = r ? null : B?.error ?? null, le = Kr(i), oe = ae(i);
|
|
1186
|
+
oe.current = i;
|
|
1187
|
+
const [U, O] = _(le);
|
|
1188
|
+
Y(() => {
|
|
1189
|
+
if (le === U) return;
|
|
1190
|
+
if (l <= 0) {
|
|
1191
|
+
O(le);
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
const C = setTimeout(() => O(le), l);
|
|
1195
|
+
return () => clearTimeout(C);
|
|
1196
|
+
}, [le, U, l]);
|
|
1197
|
+
const [q, ce] = _({ key: "", screen: "", data: null, error: null, fetching: !1 }), se = JSON.stringify([t, I, U]);
|
|
1198
|
+
Y(() => {
|
|
1199
|
+
if (!k || !t || !I) return;
|
|
1200
|
+
let C = !1;
|
|
1201
|
+
const J = new AbortController(), L = JSON.stringify([t, I]);
|
|
1202
|
+
ce((re) => ({ key: se, screen: L, data: re.screen === L ? re.data : null, error: null, fetching: !0 }));
|
|
1203
|
+
const Me = Object.fromEntries(JSON.parse(U));
|
|
1204
|
+
return k.render({ appId: t, viewId: I, inputs: Me, signal: J.signal }).then((re) => !C && ce({ key: se, screen: L, data: re, error: null, fetching: !1 })).catch((re) => {
|
|
1205
|
+
C || (ce((Ne) => ({ ...Ne, key: se, error: re, fetching: !1 })), g.current?.(re));
|
|
1206
|
+
}), () => {
|
|
1207
|
+
C = !0, J.abort();
|
|
1208
|
+
};
|
|
1209
|
+
}, [k, t, I, se, D]);
|
|
1210
|
+
const de = z !== null || !r && !B, te = K(() => de ? M((C) => C + 1) : A((C) => C + 1), [de]), H = xe(() => q.data?.tree ? $t(q.data.tree) : null, [q.data]), G = m.error ?? z ?? q.error;
|
|
1211
|
+
let Z;
|
|
1212
|
+
if (G && !H)
|
|
1213
|
+
Z = s ? s(G, te) : /* @__PURE__ */ n(zr, { error: G, onRetry: te });
|
|
1214
|
+
else if (!H)
|
|
1215
|
+
k && t && !I && B && !B.error ? Z = /* @__PURE__ */ n("p", { className: "py-10 text-center text-sm text-muted-foreground", children: "This app has nothing to show yet." }) : Z = v ?? /* @__PURE__ */ d("div", { className: "flex w-full flex-col gap-4 rounded-lg border bg-card p-6", "aria-busy": "true", "aria-label": "Loading app", "data-ar-part": "loading", children: [
|
|
1216
|
+
/* @__PURE__ */ n(Le, { className: "h-4 w-24" }),
|
|
1217
|
+
/* @__PURE__ */ n(Le, { className: "h-9 w-full" }),
|
|
1218
|
+
/* @__PURE__ */ n(Le, { className: "h-20 w-full" })
|
|
1219
|
+
] });
|
|
1220
|
+
else {
|
|
1221
|
+
const C = Array.isArray(H.children) && H.children.length === 0;
|
|
1222
|
+
Z = /* @__PURE__ */ d(We, { children: [
|
|
1223
|
+
G ? /* @__PURE__ */ d("div", { role: "alert", className: "mb-3 flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-sm", "data-ar-part": "refresh-error", "data-ar-error": G instanceof Te ? G.code : "error", children: [
|
|
1224
|
+
/* @__PURE__ */ n(ve, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
1225
|
+
/* @__PURE__ */ d("span", { className: "flex-1", children: [
|
|
1226
|
+
"Couldn't refresh this screen. ",
|
|
1227
|
+
Je(G).title,
|
|
1228
|
+
". ",
|
|
1229
|
+
Je(G).detail
|
|
1230
|
+
] }),
|
|
1231
|
+
/* @__PURE__ */ n("button", { type: "button", className: "font-medium underline-offset-4 hover:underline", onClick: te, children: "Try again" })
|
|
1232
|
+
] }) : null,
|
|
1233
|
+
/* @__PURE__ */ n(
|
|
1234
|
+
"section",
|
|
1235
|
+
{
|
|
1236
|
+
"data-ar-part": "screen",
|
|
1237
|
+
className: w("relative transition-opacity", p && "rounded-lg border bg-card p-4 shadow-sm sm:p-6", q.fetching && "opacity-80"),
|
|
1238
|
+
"aria-busy": q.fetching || void 0,
|
|
1239
|
+
children: C ? /* @__PURE__ */ n("div", { className: "py-10 text-center text-sm text-muted-foreground", children: "This screen is empty." }) : (
|
|
1240
|
+
// Always read-only, whatever the server says: no event handlers, so nothing can call an action.
|
|
1241
|
+
/* @__PURE__ */ n(Vt, { node: H, interactionMode: "read_only", components: a })
|
|
1242
|
+
)
|
|
1243
|
+
}
|
|
1244
|
+
)
|
|
1245
|
+
] });
|
|
1246
|
+
}
|
|
1247
|
+
return /* @__PURE__ */ n(Pt, { theme: h, colorScheme: b, className: f, style: x, "data-ar-app": t, "data-ar-view": I, "data-ar-embed": "", children: Z });
|
|
1248
|
+
}
|
|
1249
|
+
function Hr(e, t) {
|
|
1250
|
+
const r = [];
|
|
1251
|
+
return Re(e, (i) => {
|
|
1252
|
+
if (!Cr(i.kind) || !i.props?.required) return;
|
|
1253
|
+
const o = i.id in t ? t[i.id] : i.kind === "Checkbox" || i.kind === "Switch" ? i.props?.checked : i.props?.value;
|
|
1254
|
+
(o == null || typeof o == "string" && o.trim() === "" || o === !1) && r.push({ id: i.id, name: Ae(i) });
|
|
1255
|
+
}), r;
|
|
1256
|
+
}
|
|
1257
|
+
function Dt(e, t, r) {
|
|
1258
|
+
const i = [..._e(e)].filter((o) => !He(t, o));
|
|
1259
|
+
return i.length === 0 ? null : `Pick a row in ${i.map((o) => r?.(o) ?? o).join(" and ")} first.`;
|
|
1260
|
+
}
|
|
1261
|
+
const Gr = "This link can't be opened: only web addresses (http or https) are allowed.";
|
|
1262
|
+
function Jr(e, t = 60) {
|
|
1263
|
+
return e.length > t ? `${e.slice(0, t - 1)}…` : e;
|
|
1264
|
+
}
|
|
1265
|
+
async function Wr(e, t, r, i, o = {}) {
|
|
1266
|
+
const l = [], f = Dt(e, o, r.tableName);
|
|
1267
|
+
if (f)
|
|
1268
|
+
return r.showMessage(f, "warning"), { ok: !1, log: l, error: f };
|
|
1269
|
+
for (const x of e) {
|
|
1270
|
+
const h = Ge(x, o);
|
|
1271
|
+
try {
|
|
1272
|
+
if (Qe(h)) {
|
|
1273
|
+
if (i === "test") {
|
|
1274
|
+
if (!r.testServerStep) {
|
|
1275
|
+
l.push({ step: h, status: "skipped", detail: "Skipped in test mode" });
|
|
1276
|
+
continue;
|
|
1277
|
+
}
|
|
1278
|
+
const a = await r.testServerStep(h);
|
|
1279
|
+
if (l.push({ step: h, status: a.ok ? "tested" : "failed", detail: a.detail, result: a.result }), !a.ok) return { ok: !1, log: l, error: a.detail };
|
|
1280
|
+
continue;
|
|
1281
|
+
}
|
|
1282
|
+
const b = await r.runServerStep(h);
|
|
1283
|
+
l.push({ step: h, status: "done", result: b });
|
|
1284
|
+
continue;
|
|
1285
|
+
}
|
|
1286
|
+
switch (h.type) {
|
|
1287
|
+
case "ui.message":
|
|
1288
|
+
r.showMessage(h.text, h.tone ?? "success");
|
|
1289
|
+
break;
|
|
1290
|
+
case "ui.navigate":
|
|
1291
|
+
r.navigate(h.view_id);
|
|
1292
|
+
break;
|
|
1293
|
+
case "ui.open_url":
|
|
1294
|
+
if (!Or(h.url)) {
|
|
1295
|
+
const b = `Only http and https links can be opened, not “${Jr(String(h.url ?? ""))}”.`;
|
|
1296
|
+
return l.push({ step: h, status: "failed", detail: b }), r.showMessage(Gr, "warning"), { ok: !1, log: l, error: b };
|
|
1297
|
+
}
|
|
1298
|
+
r.openUrl(h.url.trim());
|
|
1299
|
+
break;
|
|
1300
|
+
case "ui.set_value":
|
|
1301
|
+
r.setValue(h.component_id, h.value);
|
|
1302
|
+
break;
|
|
1303
|
+
case "ui.refresh":
|
|
1304
|
+
r.refresh();
|
|
1305
|
+
break;
|
|
1306
|
+
}
|
|
1307
|
+
l.push({ step: h, status: "done" });
|
|
1308
|
+
} catch (b) {
|
|
1309
|
+
const a = b instanceof Error ? b.message : String(b);
|
|
1310
|
+
l.push({ step: h, status: "failed", detail: a });
|
|
1311
|
+
const p = Xr(b);
|
|
1312
|
+
if (p) {
|
|
1313
|
+
for (const c of _e(e)) r.setValue(c, null);
|
|
1314
|
+
p === "row_changed" && r.refresh();
|
|
1315
|
+
const s = p === "row_changed" ? "That row has changed or is no longer there. The table is up to date now; pick the row again." : "Pick the row again.";
|
|
1316
|
+
return r.showMessage(s, "warning"), { ok: !1, log: l, error: a };
|
|
1317
|
+
}
|
|
1318
|
+
const v = t.error_message?.trim() || Yr(b);
|
|
1319
|
+
return r.showMessage(v, "error"), { ok: !1, log: l, error: a };
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return { ok: !0, log: l };
|
|
1323
|
+
}
|
|
1324
|
+
function Yr(e) {
|
|
1325
|
+
const t = e?.status;
|
|
1326
|
+
return t === 401 ? "Your session has ended. Sign in again, then try once more." : t === 403 ? "You don't have permission to do that here." : t === 404 ? "That workflow or run wasn't found. It may have been deleted." : t === 409 ? "This was already handled, or it changed. Refresh to see where it stands." : "That didn't go through. Try again in a moment.";
|
|
1327
|
+
}
|
|
1328
|
+
function Xr(e) {
|
|
1329
|
+
const t = e, r = t?.code ?? t?.data?.error;
|
|
1330
|
+
return r === "row_changed" || r === "row_not_picked" ? r : null;
|
|
1331
|
+
}
|
|
1332
|
+
function xn(e, t) {
|
|
1333
|
+
const r = {};
|
|
1334
|
+
return Re(e, (i) => {
|
|
1335
|
+
const o = i.props?.workflow_input, l = o && typeof o.param == "string" ? o.param : "";
|
|
1336
|
+
if (!l) return;
|
|
1337
|
+
const f = i.id in t ? t[i.id] : i.kind === "Checkbox" || i.kind === "Switch" ? i.props?.checked : i.props?.value;
|
|
1338
|
+
(f != null && typeof f != "object" || f != null && !("bind" in f)) && (r[l] = f);
|
|
1339
|
+
}), r;
|
|
1340
|
+
}
|
|
1341
|
+
const Zr = /* @__PURE__ */ new Set(["completed", "succeeded", "success", "failed", "failure", "error", "stopped", "cancelled", "canceled"]);
|
|
1342
|
+
function Qr(e) {
|
|
1343
|
+
typeof window < "u" && window.open(e, "_blank", "noopener,noreferrer");
|
|
1344
|
+
}
|
|
1345
|
+
function en(e) {
|
|
1346
|
+
const t = gt(), r = e.client ?? t?.client;
|
|
1347
|
+
if (!r) throw new Error("useAgentRuntimeApp: wrap your app in <AgentRuntimeProvider> or pass `client`.");
|
|
1348
|
+
const i = e.app, [o, l] = _(e.view ?? ""), [f, x] = _({ runId: e.runId, taskId: e.taskId, workflowRef: e.workflowRef }), [h, b] = _({}), [a, p] = _({}), [v, s] = _(/* @__PURE__ */ new Set()), [c, y] = _(null), [g, m] = _(null), [k, T] = _(null), [R, $] = _(0), [M, D] = _({ key: "", data: null, error: null, fetching: !1 }), A = ae(e);
|
|
1349
|
+
A.current = e, Y(() => {
|
|
1350
|
+
e.view !== void 0 && (l(e.view), b({}), p({}));
|
|
1351
|
+
}, [e.view]), Y(() => {
|
|
1352
|
+
x({ runId: e.runId, taskId: e.taskId, workflowRef: e.workflowRef });
|
|
1353
|
+
}, [e.runId, e.taskId, e.workflowRef]);
|
|
1354
|
+
const B = e.navigation === "app" || !o;
|
|
1355
|
+
Y(() => {
|
|
1356
|
+
if (!B || !i) return;
|
|
1357
|
+
let u = !1;
|
|
1358
|
+
const S = new AbortController();
|
|
1359
|
+
return r.getApp({ appId: i, signal: S.signal }).then((N) => !u && T({ appId: i, info: N, error: null })).catch((N) => {
|
|
1360
|
+
u || (T({ appId: i, info: null, error: N }), A.current.onError?.(N));
|
|
1361
|
+
}), () => {
|
|
1362
|
+
u = !0, S.abort();
|
|
1363
|
+
};
|
|
1364
|
+
}, [r, i, B]);
|
|
1365
|
+
const I = k?.appId === i ? k : null, z = o || I?.info?.defaultViewId || I?.info?.navigation[0]?.view_id || "", le = xe(() => Array.isArray(e.navigation) ? e.navigation.filter((u) => u?.view_id) : e.navigation === "app" ? I?.info?.navigation ?? [] : [], [e.navigation, I]), oe = JSON.stringify([i, z, f.runId ?? "", f.taskId ?? "", f.workflowRef ?? ""]), U = K(() => $((u) => u + 1), []);
|
|
1366
|
+
Y(() => {
|
|
1367
|
+
if (!i || !z) return;
|
|
1368
|
+
let u = !1;
|
|
1369
|
+
const S = new AbortController();
|
|
1370
|
+
return D((N) => N.key === oe ? { ...N, fetching: !0 } : { key: oe, data: null, error: null, fetching: !0 }), r.render({ appId: i, viewId: z, context: f, signal: S.signal }).then((N) => !u && D({ key: oe, data: N, error: null, fetching: !1 })).catch((N) => {
|
|
1371
|
+
u || (D((E) => ({ ...E, key: oe, error: N, fetching: !1 })), A.current.onError?.(N));
|
|
1372
|
+
}), () => {
|
|
1373
|
+
u = !0, S.abort();
|
|
1374
|
+
};
|
|
1375
|
+
}, [r, i, z, oe, R]);
|
|
1376
|
+
const O = M.key === oe ? M : null, q = O?.data?.tree ?? null, ce = O?.data?.run?.status != null ? String(O.data.run.status) : "", se = e.refreshIntervalMs ?? 5e3;
|
|
1377
|
+
Y(() => {
|
|
1378
|
+
if (!f.runId) return;
|
|
1379
|
+
if (r.transport.subscribeRun)
|
|
1380
|
+
return r.transport.subscribeRun({ appId: i, runId: f.runId, onEvent: U, onError: (S) => A.current.onError?.(S) });
|
|
1381
|
+
if (!se || Zr.has(ce.toLowerCase())) return;
|
|
1382
|
+
const u = setInterval(U, se);
|
|
1383
|
+
return () => clearInterval(u);
|
|
1384
|
+
}, [r, i, f.runId, ce, se, U]);
|
|
1385
|
+
const de = K((u) => {
|
|
1386
|
+
y(u), A.current.onMessage?.(u);
|
|
1387
|
+
}, []), te = ae(h);
|
|
1388
|
+
te.current = h;
|
|
1389
|
+
const H = ae(q);
|
|
1390
|
+
H.current = q;
|
|
1391
|
+
const G = ae(f);
|
|
1392
|
+
G.current = f;
|
|
1393
|
+
const Z = K((u) => {
|
|
1394
|
+
const S = H.current;
|
|
1395
|
+
return S && Ae(De(S, u)) || "the table";
|
|
1396
|
+
}, []), C = K(
|
|
1397
|
+
(u, S, N) => {
|
|
1398
|
+
const E = ge(u, S);
|
|
1399
|
+
if (E.length === 0) return !1;
|
|
1400
|
+
const W = H.current, ue = E.some(Qe);
|
|
1401
|
+
if ((S === "onClick" || S === Ie) && ue && Be(u, S).require_valid && W) {
|
|
1402
|
+
const pe = Hr(W, N);
|
|
1403
|
+
if (pe.length > 0)
|
|
1404
|
+
return p(Object.fromEntries(pe.map((fe) => [fe.id, "Fill this in"]))), !1;
|
|
1405
|
+
}
|
|
1406
|
+
const ne = Dt(E, N, Z);
|
|
1407
|
+
return ne ? (p({}), de({ text: ne, tone: "warning" }), !1) : !0;
|
|
1408
|
+
},
|
|
1409
|
+
[de, Z]
|
|
1410
|
+
), J = K(
|
|
1411
|
+
async (u, S, N) => {
|
|
1412
|
+
const E = ge(u, S), W = Be(u, S), ue = N ? { ...te.current, ...N } : te.current;
|
|
1413
|
+
if (!C(u, S, ue)) return;
|
|
1414
|
+
p({}), y(null), W.disable_while_running && s((j) => new Set(j).add(u.id));
|
|
1415
|
+
let ne = G.current, pe = !1, fe = "";
|
|
1416
|
+
await Wr(
|
|
1417
|
+
E,
|
|
1418
|
+
W,
|
|
1419
|
+
{
|
|
1420
|
+
runServerStep: async (j) => {
|
|
1421
|
+
try {
|
|
1422
|
+
const P = await r.action({
|
|
1423
|
+
appId: i,
|
|
1424
|
+
viewId: z,
|
|
1425
|
+
componentId: u.id,
|
|
1426
|
+
event: S,
|
|
1427
|
+
step: j,
|
|
1428
|
+
values: ue,
|
|
1429
|
+
context: ne
|
|
1430
|
+
}), be = P?.run_id != null ? String(P.run_id) : "", qt = "workflow_ref" in j ? j.workflow_ref : "";
|
|
1431
|
+
return be && be !== ne.runId && (ne = { runId: be, taskId: void 0, workflowRef: qt || ne.workflowRef }, pe = !0), P;
|
|
1432
|
+
} catch (P) {
|
|
1433
|
+
throw A.current.onError?.(P), P;
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
showMessage: (j, P) => de({ text: j, tone: P }),
|
|
1437
|
+
navigate: (j) => {
|
|
1438
|
+
fe = j;
|
|
1439
|
+
},
|
|
1440
|
+
openUrl: (j) => (A.current.openUrl ?? Qr)(j),
|
|
1441
|
+
setValue: (j, P) => b((be) => ({ ...be, [j]: P })),
|
|
1442
|
+
refresh: U,
|
|
1443
|
+
tableName: Z
|
|
1444
|
+
},
|
|
1445
|
+
"live",
|
|
1446
|
+
ue
|
|
1447
|
+
), s((j) => {
|
|
1448
|
+
const P = new Set(j);
|
|
1449
|
+
return P.delete(u.id), P;
|
|
1450
|
+
}), (fe || pe) && b({}), pe && (x(ne), A.current.onRunChange?.(ne)), fe && (l(fe), A.current.onNavigate?.(fe)), U();
|
|
1451
|
+
},
|
|
1452
|
+
[z, i, r, C, U, de, Z]
|
|
1453
|
+
), L = K(
|
|
1454
|
+
(u, S, N) => {
|
|
1455
|
+
if (!C(u, S, N ? { ...te.current, ...N } : te.current)) return;
|
|
1456
|
+
const E = Be(u, S).confirm?.trim();
|
|
1457
|
+
if (E) {
|
|
1458
|
+
const W = A.current.confirm;
|
|
1459
|
+
W ? Promise.resolve(W(E)).then((ue) => {
|
|
1460
|
+
ue && J(u, S, N);
|
|
1461
|
+
}) : m({ node: u, event: S, question: E, values: N });
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
J(u, S, N);
|
|
1465
|
+
},
|
|
1466
|
+
[C, J]
|
|
1467
|
+
), Me = K(
|
|
1468
|
+
(u) => {
|
|
1469
|
+
m(null), u && g && J(g.node, g.event, g.values);
|
|
1470
|
+
},
|
|
1471
|
+
[g, J]
|
|
1472
|
+
), re = K(() => y(null), []), Ne = K(
|
|
1473
|
+
(u, S) => {
|
|
1474
|
+
b((E) => ({ ...E, [u]: S })), p((E) => {
|
|
1475
|
+
if (!E[u]) return E;
|
|
1476
|
+
const W = { ...E };
|
|
1477
|
+
return delete W[u], W;
|
|
1478
|
+
});
|
|
1479
|
+
const N = H.current ? De(H.current, u) : null;
|
|
1480
|
+
N && N.kind !== "TextField" && N.kind !== "TextArea" && ge(N, "onChange").length > 0 && L(N, "onChange", { [u]: S });
|
|
1481
|
+
},
|
|
1482
|
+
[L]
|
|
1483
|
+
), Ut = K((u) => {
|
|
1484
|
+
b({}), p({}), y(null), l(u), A.current.onNavigate?.(u);
|
|
1485
|
+
}, []), Kt = K(() => {
|
|
1486
|
+
const u = {};
|
|
1487
|
+
b({}), x(u), A.current.onRunChange?.(u);
|
|
1488
|
+
}, []), rt = I?.error && !o ? I.error : null;
|
|
1489
|
+
let he;
|
|
1490
|
+
rt ? he = "error" : z ? !O || !O.data && !O.error ? he = "loading" : O.data ? he = "ready" : he = "error" : he = B && !I ? "loading" : "no-view";
|
|
1491
|
+
const zt = q ? {
|
|
1492
|
+
node: q,
|
|
1493
|
+
interactionMode: O?.data?.interaction?.mode ?? "editable",
|
|
1494
|
+
draft: h,
|
|
1495
|
+
fieldErrors: a,
|
|
1496
|
+
busyIds: v,
|
|
1497
|
+
onDraftChange: Ne,
|
|
1498
|
+
onEvent: L
|
|
1499
|
+
} : null;
|
|
1500
|
+
return {
|
|
1501
|
+
status: he,
|
|
1502
|
+
/** The latest render (screen tree, interaction mode, run). Kept while a refresh is in flight. */
|
|
1503
|
+
render: O?.data ?? null,
|
|
1504
|
+
error: rt ?? O?.error ?? null,
|
|
1505
|
+
isFetching: !!O?.fetching,
|
|
1506
|
+
appInfo: I?.info ?? null,
|
|
1507
|
+
viewId: z,
|
|
1508
|
+
navigation: le,
|
|
1509
|
+
context: f,
|
|
1510
|
+
runStatus: ce,
|
|
1511
|
+
values: h,
|
|
1512
|
+
fieldErrors: a,
|
|
1513
|
+
busyIds: v,
|
|
1514
|
+
message: c,
|
|
1515
|
+
pendingConfirm: g ? { question: g.question } : null,
|
|
1516
|
+
/** Props for `<SurfaceRenderer>`; null until the screen has loaded. */
|
|
1517
|
+
rendererProps: zt,
|
|
1518
|
+
setValue: Ne,
|
|
1519
|
+
handleEvent: L,
|
|
1520
|
+
answerConfirm: Me,
|
|
1521
|
+
dismissMessage: re,
|
|
1522
|
+
navigate: Ut,
|
|
1523
|
+
startOver: Kt,
|
|
1524
|
+
refresh: U
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
const ut = {
|
|
1528
|
+
embed_browse: "This screen is view-only here.",
|
|
1529
|
+
run_in_progress: "The workflow is still working on this. The screen updates when it's your turn.",
|
|
1530
|
+
completed: "This run has finished. There's nothing left to do here.",
|
|
1531
|
+
failed: "This run stopped with an error, so there's nothing to do here.",
|
|
1532
|
+
cancelled: "This run was cancelled.",
|
|
1533
|
+
canceled: "This run was cancelled."
|
|
1534
|
+
};
|
|
1535
|
+
function tn(e, t) {
|
|
1536
|
+
return e === "editable" ? null : t && ut[t] ? ut[t] : t && !/^[a-z0-9_]+$/.test(t) ? t : e === "closed" ? "This step is closed — nothing left to do here." : "This screen is read-only right now.";
|
|
1537
|
+
}
|
|
1538
|
+
function ft(e) {
|
|
1539
|
+
return e instanceof er ? "This app or screen wasn't found. It may have been deleted, or it belongs to another workspace." : e instanceof tr ? "Your session has ended. Sign in again to use this app." : e instanceof rr ? "You don't have access to this app." : e instanceof ht ? "Couldn't reach AgentRuntime. Check your connection and try again." : e instanceof Error && e.message ? e.message : "The server didn't respond. Try again in a moment.";
|
|
1540
|
+
}
|
|
1541
|
+
function ye({ className: e }) {
|
|
1542
|
+
return /* @__PURE__ */ n("div", { className: w("animate-pulse rounded-md bg-muted", e) });
|
|
1543
|
+
}
|
|
1544
|
+
function rn() {
|
|
1545
|
+
return /* @__PURE__ */ d("div", { className: "flex w-full flex-col gap-4 rounded-lg border bg-card p-6", "aria-busy": "true", "aria-label": "Loading app", "data-ar-part": "loading", children: [
|
|
1546
|
+
/* @__PURE__ */ n(ye, { className: "h-4 w-24" }),
|
|
1547
|
+
/* @__PURE__ */ n(ye, { className: "h-9 w-full" }),
|
|
1548
|
+
/* @__PURE__ */ n(ye, { className: "h-4 w-24" }),
|
|
1549
|
+
/* @__PURE__ */ n(ye, { className: "h-20 w-full" }),
|
|
1550
|
+
/* @__PURE__ */ n(ye, { className: "h-9 w-28" })
|
|
1551
|
+
] });
|
|
1552
|
+
}
|
|
1553
|
+
function nn({ message: e, onDismiss: t }) {
|
|
1554
|
+
return /* @__PURE__ */ d(
|
|
1555
|
+
"div",
|
|
1556
|
+
{
|
|
1557
|
+
role: "status",
|
|
1558
|
+
"data-ar-part": "message",
|
|
1559
|
+
"data-ar-tone": e.tone,
|
|
1560
|
+
className: w(
|
|
1561
|
+
"flex items-start gap-2 rounded-md border px-3 py-2 text-sm",
|
|
1562
|
+
e.tone === "success" && "border-success/40 bg-success/10",
|
|
1563
|
+
e.tone === "info" && "border-info/40 bg-info/10",
|
|
1564
|
+
e.tone === "warning" && "border-warning/40 bg-warning/10",
|
|
1565
|
+
e.tone === "error" && "border-destructive/40 bg-destructive/10"
|
|
1566
|
+
),
|
|
1567
|
+
children: [
|
|
1568
|
+
e.tone === "error" || e.tone === "warning" ? /* @__PURE__ */ n(ve, { className: w("mt-0.5 h-4 w-4 shrink-0", e.tone === "error" && "text-destructive") }) : /* @__PURE__ */ n(lr, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
1569
|
+
/* @__PURE__ */ n("span", { className: "flex-1", children: e.text }),
|
|
1570
|
+
/* @__PURE__ */ n("button", { type: "button", "aria-label": "Dismiss", onClick: t, children: /* @__PURE__ */ n(Ze, { className: "h-4 w-4" }) })
|
|
1571
|
+
]
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
function an({ question: e, onAnswer: t }) {
|
|
1576
|
+
const r = Wt(), i = ae(null);
|
|
1577
|
+
return Y(() => {
|
|
1578
|
+
i.current?.focus();
|
|
1579
|
+
}, []), /* @__PURE__ */ n("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4", "data-ar-part": "confirm", onClick: () => t(!1), children: /* @__PURE__ */ d(
|
|
1580
|
+
"div",
|
|
1581
|
+
{
|
|
1582
|
+
role: "alertdialog",
|
|
1583
|
+
"aria-modal": "true",
|
|
1584
|
+
"aria-labelledby": r,
|
|
1585
|
+
className: "w-full max-w-md space-y-4 rounded-lg border bg-background p-6 shadow-lg",
|
|
1586
|
+
onClick: (o) => o.stopPropagation(),
|
|
1587
|
+
onKeyDown: (o) => {
|
|
1588
|
+
o.key === "Escape" && t(!1);
|
|
1589
|
+
},
|
|
1590
|
+
children: [
|
|
1591
|
+
/* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
1592
|
+
/* @__PURE__ */ n("h2", { id: r, className: "text-lg font-semibold", children: e }),
|
|
1593
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: "Choose Continue to go ahead." })
|
|
1594
|
+
] }),
|
|
1595
|
+
/* @__PURE__ */ d("div", { className: "flex justify-end gap-2", children: [
|
|
1596
|
+
/* @__PURE__ */ n(X, { type: "button", variant: "outline", onClick: () => t(!1), children: "Not yet" }),
|
|
1597
|
+
/* @__PURE__ */ n(X, { ref: i, type: "button", onClick: () => t(!0), children: "Continue" })
|
|
1598
|
+
] })
|
|
1599
|
+
]
|
|
1600
|
+
}
|
|
1601
|
+
) });
|
|
1602
|
+
}
|
|
1603
|
+
function on({
|
|
1604
|
+
className: e,
|
|
1605
|
+
style: t,
|
|
1606
|
+
theme: r,
|
|
1607
|
+
colorScheme: i,
|
|
1608
|
+
components: o,
|
|
1609
|
+
showMessages: l = !0,
|
|
1610
|
+
messageDurationMs: f = 6e3,
|
|
1611
|
+
showRunStatus: x = !0,
|
|
1612
|
+
frame: h = !0,
|
|
1613
|
+
loadingFallback: b,
|
|
1614
|
+
errorFallback: a,
|
|
1615
|
+
...p
|
|
1616
|
+
}) {
|
|
1617
|
+
const v = gt(), s = en(p), { message: c, dismissMessage: y } = s;
|
|
1618
|
+
Y(() => {
|
|
1619
|
+
if (!c || f <= 0 || c.tone === "warning" || c.tone === "error") return;
|
|
1620
|
+
const R = setTimeout(y, f);
|
|
1621
|
+
return () => clearTimeout(R);
|
|
1622
|
+
}, [c, f, y]);
|
|
1623
|
+
const g = v?.components || o ? { ...v?.components, ...o } : void 0, m = s.render, k = m?.interaction ? tn(m.interaction.mode, m.interaction.reason) : null;
|
|
1624
|
+
let T;
|
|
1625
|
+
if (s.status === "loading")
|
|
1626
|
+
T = b ?? /* @__PURE__ */ n(rn, {});
|
|
1627
|
+
else if (s.status === "no-view")
|
|
1628
|
+
T = /* @__PURE__ */ n("p", { className: "py-10 text-center text-sm text-muted-foreground", children: "This app has no screens yet." });
|
|
1629
|
+
else if (s.status === "error" || !m)
|
|
1630
|
+
T = a ? a(s.error, s.refresh) : /* @__PURE__ */ d("div", { className: "flex flex-col items-center gap-3 px-4 py-10 text-center", role: "alert", "data-ar-part": "load-error", children: [
|
|
1631
|
+
/* @__PURE__ */ n(ve, { className: "h-6 w-6 text-destructive" }),
|
|
1632
|
+
/* @__PURE__ */ n("p", { className: "font-medium", children: "Unable to load this screen" }),
|
|
1633
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: ft(s.error) }),
|
|
1634
|
+
/* @__PURE__ */ n(X, { type: "button", size: "sm", onClick: s.refresh, children: "Retry" })
|
|
1635
|
+
] });
|
|
1636
|
+
else {
|
|
1637
|
+
const R = Array.isArray(m.tree?.children) && m.tree.children.length === 0;
|
|
1638
|
+
T = /* @__PURE__ */ n(
|
|
1639
|
+
"section",
|
|
1640
|
+
{
|
|
1641
|
+
"data-ar-part": "screen",
|
|
1642
|
+
className: w("relative transition-opacity", h && "rounded-lg border bg-card p-4 shadow-sm sm:p-6", s.isFetching && "opacity-80"),
|
|
1643
|
+
"aria-busy": s.isFetching || void 0,
|
|
1644
|
+
"aria-label": s.navigation.find(($) => $.view_id === s.viewId)?.label || s.viewId,
|
|
1645
|
+
children: m.tree && !R && s.rendererProps ? /* @__PURE__ */ n(Vt, { ...s.rendererProps, components: g }) : /* @__PURE__ */ n("div", { className: "py-10 text-center text-sm text-muted-foreground", children: "This screen is empty." })
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
return /* @__PURE__ */ d(
|
|
1650
|
+
Pt,
|
|
1651
|
+
{
|
|
1652
|
+
theme: r ?? v?.theme,
|
|
1653
|
+
colorScheme: i ?? v?.colorScheme,
|
|
1654
|
+
className: e,
|
|
1655
|
+
style: t,
|
|
1656
|
+
"data-ar-app": p.app,
|
|
1657
|
+
"data-ar-view": s.viewId,
|
|
1658
|
+
children: [
|
|
1659
|
+
/* @__PURE__ */ d("div", { className: "flex w-full flex-col gap-4", children: [
|
|
1660
|
+
s.navigation.length > 1 ? /* @__PURE__ */ n("nav", { className: "-mb-px flex gap-1 overflow-x-auto border-b", "aria-label": "App screens", "data-ar-part": "nav", children: s.navigation.map((R) => {
|
|
1661
|
+
const $ = R.view_id === s.viewId;
|
|
1662
|
+
return /* @__PURE__ */ n(
|
|
1663
|
+
"button",
|
|
1664
|
+
{
|
|
1665
|
+
type: "button",
|
|
1666
|
+
"aria-current": $ ? "page" : void 0,
|
|
1667
|
+
"data-ar-part": "tab",
|
|
1668
|
+
className: w(
|
|
1669
|
+
"whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors",
|
|
1670
|
+
$ ? "border-primary font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
1671
|
+
),
|
|
1672
|
+
onClick: () => s.navigate(R.view_id),
|
|
1673
|
+
children: R.label ?? R.view_id
|
|
1674
|
+
},
|
|
1675
|
+
R.view_id
|
|
1676
|
+
);
|
|
1677
|
+
}) }) : null,
|
|
1678
|
+
x && s.context.runId ? /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border bg-muted/40 px-3 py-2 text-sm", "data-ar-part": "run", children: [
|
|
1679
|
+
/* @__PURE__ */ n("span", { className: "text-muted-foreground", children: "Run" }),
|
|
1680
|
+
/* @__PURE__ */ n("span", { className: "font-mono text-xs", children: s.context.runId.slice(0, 8) }),
|
|
1681
|
+
/* @__PURE__ */ n("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium", children: s.runStatus || "running" }),
|
|
1682
|
+
/* @__PURE__ */ d(X, { type: "button", size: "sm", variant: "ghost", className: "ml-auto h-7 text-xs", onClick: s.startOver, children: [
|
|
1683
|
+
/* @__PURE__ */ n(Ze, { className: "mr-1 h-3 w-3" }),
|
|
1684
|
+
"Start over"
|
|
1685
|
+
] })
|
|
1686
|
+
] }) : null,
|
|
1687
|
+
l && s.message ? (
|
|
1688
|
+
// Sticky, so a message from a button at the bottom of a long screen shows where the user is, and
|
|
1689
|
+
// no taller than nothing, so the screen doesn't jump under the pointer when a message comes or goes.
|
|
1690
|
+
// Hosts with their own sticky header move it with `[data-ar-part="message-bar"] { top: … }`.
|
|
1691
|
+
/* @__PURE__ */ n("div", { className: "pointer-events-none sticky top-2 z-10 -my-2 h-0", "data-ar-part": "message-bar", children: /* @__PURE__ */ n("div", { className: "pointer-events-auto rounded-md bg-background shadow-md", children: /* @__PURE__ */ n(nn, { message: s.message, onDismiss: s.dismissMessage }) }) })
|
|
1692
|
+
) : null,
|
|
1693
|
+
k ? /* @__PURE__ */ d("div", { className: "flex items-start gap-2 rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground", "data-ar-part": "notice", children: [
|
|
1694
|
+
/* @__PURE__ */ n(cr, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
1695
|
+
/* @__PURE__ */ n("span", { children: k })
|
|
1696
|
+
] }) : null,
|
|
1697
|
+
s.status === "ready" && s.error ? /* @__PURE__ */ d("div", { role: "alert", className: "flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-sm", "data-ar-part": "refresh-error", children: [
|
|
1698
|
+
/* @__PURE__ */ n(ve, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
1699
|
+
/* @__PURE__ */ d("span", { className: "flex-1", children: [
|
|
1700
|
+
"Couldn't refresh this screen. ",
|
|
1701
|
+
ft(s.error)
|
|
1702
|
+
] }),
|
|
1703
|
+
/* @__PURE__ */ n("button", { type: "button", className: "font-medium underline-offset-4 hover:underline", onClick: s.refresh, children: "Retry" })
|
|
1704
|
+
] }) : null,
|
|
1705
|
+
T
|
|
1706
|
+
] }),
|
|
1707
|
+
s.pendingConfirm ? /* @__PURE__ */ n(an, { question: s.pendingConfirm.question, onAnswer: s.answerConfirm }) : null
|
|
1708
|
+
]
|
|
1709
|
+
}
|
|
1710
|
+
);
|
|
1711
|
+
}
|
|
1712
|
+
function vn(e) {
|
|
1713
|
+
return "publishableKey" in e && e.publishableKey !== void 0 ? /* @__PURE__ */ n(qr, { ...e }) : /* @__PURE__ */ n(on, { ...e });
|
|
1714
|
+
}
|
|
1715
|
+
const kn = [
|
|
1716
|
+
"Stack",
|
|
1717
|
+
"Section",
|
|
1718
|
+
"Text",
|
|
1719
|
+
"Label",
|
|
1720
|
+
"Badge",
|
|
1721
|
+
"Button",
|
|
1722
|
+
"TextArea",
|
|
1723
|
+
"Video",
|
|
1724
|
+
"Link",
|
|
1725
|
+
"Grid",
|
|
1726
|
+
"Card",
|
|
1727
|
+
"List",
|
|
1728
|
+
"Divider",
|
|
1729
|
+
"Metric",
|
|
1730
|
+
"Image",
|
|
1731
|
+
"TextField",
|
|
1732
|
+
"Select",
|
|
1733
|
+
"Checkbox",
|
|
1734
|
+
"Switch",
|
|
1735
|
+
"Table",
|
|
1736
|
+
"Tabs",
|
|
1737
|
+
"IconButton",
|
|
1738
|
+
"FilePreview"
|
|
1739
|
+
];
|
|
1740
|
+
export {
|
|
1741
|
+
vn as AgentRuntimeApp,
|
|
1742
|
+
mn as AgentRuntimeProvider,
|
|
1743
|
+
Pt as AppRoot,
|
|
1744
|
+
kn as BUILT_IN_KINDS,
|
|
1745
|
+
mr as Badge,
|
|
1746
|
+
X as Button,
|
|
1747
|
+
kt as Checkbox,
|
|
1748
|
+
qr as EmbeddedApp,
|
|
1749
|
+
or as HostStyled,
|
|
1750
|
+
xt as Input,
|
|
1751
|
+
St as PortalContainerContext,
|
|
1752
|
+
Ie as ROW_CLICK_EVENT,
|
|
1753
|
+
qe as ROW_HANDLE_KEY,
|
|
1754
|
+
pr as Select,
|
|
1755
|
+
Tt as SelectContent,
|
|
1756
|
+
It as SelectItem,
|
|
1757
|
+
Ct as SelectTrigger,
|
|
1758
|
+
gr as SelectValue,
|
|
1759
|
+
Vt as SurfaceRenderer,
|
|
1760
|
+
Nt as Switch,
|
|
1761
|
+
_t as Table,
|
|
1762
|
+
At as TableBody,
|
|
1763
|
+
$e as TableCell,
|
|
1764
|
+
Et as TableHead,
|
|
1765
|
+
Rt as TableHeader,
|
|
1766
|
+
Ce as TableRow,
|
|
1767
|
+
vt as Textarea,
|
|
1768
|
+
Gr as UNSAFE_LINK_MESSAGE,
|
|
1769
|
+
xr as absoluteChildrenToFlowRows,
|
|
1770
|
+
Ke as asSurfaceFile,
|
|
1771
|
+
Tr as asSurfaceFiles,
|
|
1772
|
+
ar as buttonVariants,
|
|
1773
|
+
br as collectNodeIds,
|
|
1774
|
+
xn as collectWorkflowInputValues,
|
|
1775
|
+
wn as describeSelectedToken,
|
|
1776
|
+
Je as embedErrorMessage,
|
|
1777
|
+
Hr as emptyRequiredFields,
|
|
1778
|
+
Yr as failedStepMessage,
|
|
1779
|
+
De as findNode,
|
|
1780
|
+
yr as findParent,
|
|
1781
|
+
it as formatBytes,
|
|
1782
|
+
Ue as formatSurfaceDisplayValue,
|
|
1783
|
+
Bt as getEventConfig,
|
|
1784
|
+
Be as getEventOptions,
|
|
1785
|
+
ge as getEventSteps,
|
|
1786
|
+
ke as isBindValue,
|
|
1787
|
+
Cr as isInputKind,
|
|
1788
|
+
Or as isSafeOpenUrl,
|
|
1789
|
+
Qe as isServerStep,
|
|
1790
|
+
gn as isUnresolvedBindingDisplay,
|
|
1791
|
+
kr as kindLabel,
|
|
1792
|
+
ft as loadErrorMessage,
|
|
1793
|
+
Ae as nodeDisplayName,
|
|
1794
|
+
Lt as parseSelectedToken,
|
|
1795
|
+
pn as parseViewDocument,
|
|
1796
|
+
bn as pickableTables,
|
|
1797
|
+
Xr as pickedRowProblem,
|
|
1798
|
+
Ge as resolveSelectedTokens,
|
|
1799
|
+
Ft as rowsArePickable,
|
|
1800
|
+
Wr as runEventSteps,
|
|
1801
|
+
Vr as safeLinkHref,
|
|
1802
|
+
Ir as safeLinkUrl,
|
|
1803
|
+
jr as sameRow,
|
|
1804
|
+
He as selectedRow,
|
|
1805
|
+
yn as selectedRowToken,
|
|
1806
|
+
Mr as tableColumns,
|
|
1807
|
+
_e as tablesReferencedIn,
|
|
1808
|
+
Ur as themeStyle,
|
|
1809
|
+
hn as useAgentRuntime,
|
|
1810
|
+
en as useAgentRuntimeApp,
|
|
1811
|
+
gt as useOptionalAgentRuntime,
|
|
1812
|
+
hr as usePortalContainer,
|
|
1813
|
+
Re as walkNodes,
|
|
1814
|
+
$t as withoutEvents
|
|
1815
|
+
};
|
|
1816
|
+
//# sourceMappingURL=index.js.map
|