@voltro/ui 0.53.0 → 0.55.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/dist/index.js CHANGED
@@ -1,85 +1,159 @@
1
- import { createContext as e, useContext as t, useId as n, useMemo as r, useState as i } from "react";
2
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
3
- import { FORM_KEY_FIELD as c, FORM_REDIRECT_FIELD as l, formActionPath as u, formSections as d, useAgentChat as f, useConnection as p, useDataCopilot as m, useDataTable as h, useFormBinding as g, useFormFlash as ee, useFormSkeleton as te, useQueryField as ne, useQueryFilters as re, useRecord as _, useTableSkeleton as ie, useWorkflowRunState as v } from "@voltro/client";
4
- import { useComments as ae } from "@voltro/plugin-comments/web";
5
- //#region src/widgets.tsx
6
- var y = (e) => e == null ? "" : String(e), b = ({ required: e }) => e ? /* @__PURE__ */ o("span", {
1
+ import { Fragment as e, createContext as t, useContext as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
2
+ import { FORM_KEY_FIELD as c, FORM_REDIRECT_FIELD as l, FormBindingProvider as u, formActionPath as d, formSections as f, isRichTextDocument as p, isSafeHref as m, parseRichText as ee, serializeRichText as h, useAgentChat as g, useConnection as te, useDataCopilot as _, useDataTable as ne, useFormBinding as re, useFormFlash as ie, useFormSkeleton as ae, useQueryField as oe, useQueryFilters as se, useRecord as ce, useTableSkeleton as le, useWorkflowRunState as v } from "@voltro/client";
3
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
4
+ import { useComments as ue } from "@voltro/plugin-comments/web";
5
+ //#region src/richText.tsx
6
+ var de = (t, n) => {
7
+ let r = t.marks ?? [], i = t.text;
8
+ return r.includes("code") && (i = /* @__PURE__ */ b("code", { children: i }, n)), r.includes("italic") && (i = /* @__PURE__ */ b("em", { children: i }, n)), r.includes("strike") && (i = /* @__PURE__ */ b("s", { children: i }, n)), r.includes("bold") && (i = /* @__PURE__ */ b("strong", { children: i }, n)), /* @__PURE__ */ b(e, { children: i }, n);
9
+ }, S = (t) => t.map((t, n) => {
10
+ if (t.type === "link") {
11
+ let r = t.content.map((e) => e.text).join("");
12
+ return m(t.href) ? /* @__PURE__ */ b("a", {
13
+ href: t.href,
14
+ rel: "noopener noreferrer nofollow",
15
+ children: r
16
+ }, n) : /* @__PURE__ */ b(e, { children: r }, n);
17
+ }
18
+ return de(t, n);
19
+ }), fe = (e, t) => {
20
+ switch (e.type) {
21
+ case "heading": {
22
+ let n = [
23
+ "h1",
24
+ "h2",
25
+ "h3"
26
+ ][e.level - 1] ?? "h3";
27
+ return /* @__PURE__ */ b(n, { children: S(e.content) }, t);
28
+ }
29
+ case "blockquote": return /* @__PURE__ */ b("blockquote", { children: S(e.content) }, t);
30
+ case "bulletList": return /* @__PURE__ */ b("ul", { children: e.content.map((e, t) => /* @__PURE__ */ b("li", { children: S(e.content) }, t)) }, t);
31
+ case "orderedList": return /* @__PURE__ */ b("ol", { children: e.content.map((e, t) => /* @__PURE__ */ b("li", { children: S(e.content) }, t)) }, t);
32
+ case "codeBlock": return /* @__PURE__ */ b("pre", { children: /* @__PURE__ */ b("code", { children: e.text }) }, t);
33
+ default: return /* @__PURE__ */ b("p", { children: S(e.content) }, t);
34
+ }
35
+ }, pe = (e) => p(e.doc) ? /* @__PURE__ */ b(y, { children: e.doc.content.map((e, t) => fe(e, t)) }) : null, C = (e) => {
36
+ let t = i(), [n, a] = s(() => h(e.value)), c = o(e.value);
37
+ r(() => {
38
+ e.value !== c.current && JSON.stringify(e.value) !== JSON.stringify(c.current) && (c.current = e.value, a(h(e.value)));
39
+ }, [e.value]);
40
+ let l = [e.description === void 0 ? "" : `${t}-desc`, e.error === void 0 ? "" : `${t}-error`].filter(Boolean).join(" ");
41
+ return /* @__PURE__ */ x("div", {
42
+ "data-voltro-field": !0,
43
+ "data-voltro-rich-text": !0,
44
+ children: [
45
+ /* @__PURE__ */ x("label", {
46
+ htmlFor: t,
47
+ children: [e.label, e.required ? /* @__PURE__ */ b("span", {
48
+ "aria-hidden": "true",
49
+ children: " *"
50
+ }) : null]
51
+ }),
52
+ e.description === void 0 ? null : /* @__PURE__ */ b("p", {
53
+ id: `${t}-desc`,
54
+ "data-voltro-field-hint": !0,
55
+ children: e.description
56
+ }),
57
+ /* @__PURE__ */ b("textarea", {
58
+ id: t,
59
+ name: e.name,
60
+ value: n,
61
+ onChange: (t) => {
62
+ a(t.target.value);
63
+ let n = ee(t.target.value);
64
+ c.current = n, e.onChange(n);
65
+ },
66
+ onBlur: e.onBlur,
67
+ disabled: e.disabled,
68
+ required: e.required,
69
+ "aria-required": e.required ? !0 : void 0,
70
+ "aria-invalid": e.error !== void 0,
71
+ "aria-describedby": l === "" ? void 0 : l
72
+ }),
73
+ e.error === void 0 ? null : /* @__PURE__ */ b("p", {
74
+ id: `${t}-error`,
75
+ role: "alert",
76
+ children: e.error
77
+ })
78
+ ]
79
+ });
80
+ }, w = (e) => e == null ? "" : String(e), T = ({ required: e }) => e ? /* @__PURE__ */ b("span", {
7
81
  "aria-hidden": "true",
8
82
  children: " *"
9
- }) : null, x = (e) => /* @__PURE__ */ s("div", {
83
+ }) : null, E = (e) => /* @__PURE__ */ x("div", {
10
84
  "data-voltro-field": !0,
11
85
  children: [
12
- /* @__PURE__ */ s("label", {
86
+ /* @__PURE__ */ x("label", {
13
87
  htmlFor: e.id,
14
- children: [e.label, /* @__PURE__ */ o(b, { required: e.required })]
88
+ children: [e.label, /* @__PURE__ */ b(T, { required: e.required })]
15
89
  }),
16
- e.description === void 0 ? null : /* @__PURE__ */ o("p", {
90
+ e.description === void 0 ? null : /* @__PURE__ */ b("p", {
17
91
  id: `${e.id}-desc`,
18
92
  "data-voltro-field-hint": !0,
19
93
  children: e.description
20
94
  }),
21
95
  e.children,
22
- e.error === void 0 ? null : /* @__PURE__ */ o("p", {
96
+ e.error === void 0 ? null : /* @__PURE__ */ b("p", {
23
97
  id: `${e.id}-error`,
24
98
  role: "alert",
25
99
  children: e.error
26
100
  })
27
101
  ]
28
- }), S = (e, t, n) => {
102
+ }), D = (e, t, n) => {
29
103
  let r = [t === void 0 ? "" : `${e}-desc`, n === void 0 ? "" : `${e}-error`].filter(Boolean);
30
104
  return r.length > 0 ? r.join(" ") : void 0;
31
- }, C = (e) => e ? !0 : void 0, w = (e, t) => (r) => {
32
- let i = n();
33
- return /* @__PURE__ */ o(x, {
34
- id: i,
35
- label: r.label,
36
- required: r.required,
37
- description: r.description,
38
- error: r.error,
39
- children: /* @__PURE__ */ o("input", {
40
- id: i,
105
+ }, O = (e) => e ? !0 : void 0, k = (e, t) => (n) => {
106
+ let r = i();
107
+ return /* @__PURE__ */ b(E, {
108
+ id: r,
109
+ label: n.label,
110
+ required: n.required,
111
+ description: n.description,
112
+ error: n.error,
113
+ children: /* @__PURE__ */ b("input", {
114
+ id: r,
41
115
  type: e,
42
- name: r.name,
43
- value: y(r.value),
44
- onChange: (e) => r.onChange(t(e.target.value)),
45
- onBlur: r.onBlur,
46
- disabled: r.disabled,
47
- required: r.required,
48
- "aria-required": C(r.required),
49
- "aria-invalid": r.error !== void 0,
50
- "aria-describedby": S(i, r.description, r.error)
116
+ name: n.name,
117
+ value: w(n.value),
118
+ onChange: (e) => n.onChange(t(e.target.value)),
119
+ onBlur: n.onBlur,
120
+ disabled: n.disabled,
121
+ required: n.required,
122
+ "aria-required": O(n.required),
123
+ "aria-invalid": n.error !== void 0,
124
+ "aria-describedby": D(r, n.description, n.error)
51
125
  })
52
126
  });
53
- }, oe = (e) => {
54
- let t = n();
55
- return /* @__PURE__ */ o(x, {
127
+ }, me = (e) => {
128
+ let t = i();
129
+ return /* @__PURE__ */ b(E, {
56
130
  id: t,
57
131
  label: e.label,
58
132
  required: e.required,
59
133
  description: e.description,
60
134
  error: e.error,
61
- children: /* @__PURE__ */ o("textarea", {
135
+ children: /* @__PURE__ */ b("textarea", {
62
136
  id: t,
63
137
  name: e.name,
64
- value: y(e.value),
138
+ value: w(e.value),
65
139
  onChange: (t) => e.onChange(t.target.value),
66
140
  disabled: e.disabled,
67
141
  onBlur: e.onBlur,
68
142
  required: e.required,
69
- "aria-required": C(e.required),
143
+ "aria-required": O(e.required),
70
144
  "aria-invalid": e.error !== void 0,
71
- "aria-describedby": S(t, e.description, e.error)
145
+ "aria-describedby": D(t, e.description, e.error)
72
146
  })
73
147
  });
74
- }, T = (e) => {
75
- let t = n();
76
- return /* @__PURE__ */ o(x, {
148
+ }, A = (e) => {
149
+ let t = i();
150
+ return /* @__PURE__ */ b(E, {
77
151
  id: t,
78
152
  label: e.label,
79
153
  required: e.required,
80
154
  description: e.description,
81
155
  error: e.error,
82
- children: /* @__PURE__ */ o("input", {
156
+ children: /* @__PURE__ */ b("input", {
83
157
  id: t,
84
158
  type: "checkbox",
85
159
  name: e.name,
@@ -87,115 +161,115 @@ var y = (e) => e == null ? "" : String(e), b = ({ required: e }) => e ? /* @__PU
87
161
  onChange: (t) => e.onChange(t.target.checked),
88
162
  disabled: e.disabled,
89
163
  onBlur: e.onBlur,
90
- "aria-required": C(e.required),
164
+ "aria-required": O(e.required),
91
165
  "aria-invalid": e.error !== void 0,
92
- "aria-describedby": S(t, e.description, e.error)
166
+ "aria-describedby": D(t, e.description, e.error)
93
167
  })
94
168
  });
95
- }, se = (e) => {
96
- let t = n();
97
- return /* @__PURE__ */ o(x, {
169
+ }, he = (e) => {
170
+ let t = i();
171
+ return /* @__PURE__ */ b(E, {
98
172
  id: t,
99
173
  label: e.label,
100
174
  required: e.required,
101
175
  description: e.description,
102
176
  error: e.error,
103
- children: /* @__PURE__ */ s("select", {
177
+ children: /* @__PURE__ */ x("select", {
104
178
  id: t,
105
179
  name: e.name,
106
- value: y(e.value),
180
+ value: w(e.value),
107
181
  onChange: (t) => e.onChange(t.target.value),
108
182
  disabled: e.disabled,
109
183
  onBlur: e.onBlur,
110
184
  required: e.required,
111
- "aria-required": C(e.required),
185
+ "aria-required": O(e.required),
112
186
  "aria-invalid": e.error !== void 0,
113
- "aria-describedby": S(t, e.description, e.error),
114
- children: [/* @__PURE__ */ o("option", {
187
+ "aria-describedby": D(t, e.description, e.error),
188
+ children: [/* @__PURE__ */ b("option", {
115
189
  value: "",
116
190
  children: "—"
117
- }), (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
191
+ }), (e.options ?? []).map((e) => /* @__PURE__ */ b("option", {
118
192
  value: e.value,
119
193
  children: e.label
120
194
  }, e.value))]
121
195
  })
122
196
  });
123
- }, ce = (e) => {
124
- let t = n();
125
- return /* @__PURE__ */ s("fieldset", {
197
+ }, ge = (e) => {
198
+ let t = i();
199
+ return /* @__PURE__ */ x("fieldset", {
126
200
  "data-voltro-field": !0,
127
201
  "aria-invalid": e.error !== void 0,
128
- "aria-required": C(e.required),
129
- "aria-describedby": S(t, e.description, e.error),
202
+ "aria-required": O(e.required),
203
+ "aria-describedby": D(t, e.description, e.error),
130
204
  children: [
131
- /* @__PURE__ */ s("legend", { children: [e.label, /* @__PURE__ */ o(b, { required: e.required })] }),
132
- e.description === void 0 ? null : /* @__PURE__ */ o("p", {
205
+ /* @__PURE__ */ x("legend", { children: [e.label, /* @__PURE__ */ b(T, { required: e.required })] }),
206
+ e.description === void 0 ? null : /* @__PURE__ */ b("p", {
133
207
  id: `${t}-desc`,
134
208
  "data-voltro-field-hint": !0,
135
209
  children: e.description
136
210
  }),
137
211
  (e.options ?? []).map((n) => {
138
212
  let r = `${t}-${n.value}`;
139
- return /* @__PURE__ */ s("span", { children: [/* @__PURE__ */ o("input", {
213
+ return /* @__PURE__ */ x("span", { children: [/* @__PURE__ */ b("input", {
140
214
  id: r,
141
215
  type: "radio",
142
216
  name: e.name,
143
217
  value: n.value,
144
- checked: y(e.value) === n.value,
218
+ checked: w(e.value) === n.value,
145
219
  onChange: () => e.onChange(n.value),
146
220
  disabled: e.disabled,
147
221
  onBlur: e.onBlur
148
- }), /* @__PURE__ */ o("label", {
222
+ }), /* @__PURE__ */ b("label", {
149
223
  htmlFor: r,
150
224
  children: n.label
151
225
  })] }, n.value);
152
226
  }),
153
- e.error === void 0 ? null : /* @__PURE__ */ o("p", {
227
+ e.error === void 0 ? null : /* @__PURE__ */ b("p", {
154
228
  id: `${t}-error`,
155
229
  role: "alert",
156
230
  children: e.error
157
231
  })
158
232
  ]
159
233
  });
160
- }, le = (e) => {
161
- let t = n(), r = Array.isArray(e.value) ? e.value.map(String) : [];
162
- return /* @__PURE__ */ o(x, {
234
+ }, _e = (e) => {
235
+ let t = i(), n = Array.isArray(e.value) ? e.value.map(String) : [];
236
+ return /* @__PURE__ */ b(E, {
163
237
  id: t,
164
238
  label: e.label,
165
239
  required: e.required,
166
240
  description: e.description,
167
241
  error: e.error,
168
- children: /* @__PURE__ */ o("select", {
242
+ children: /* @__PURE__ */ b("select", {
169
243
  id: t,
170
244
  name: e.name,
171
245
  multiple: !0,
172
- value: r,
246
+ value: n,
173
247
  onChange: (t) => e.onChange(Array.from(t.target.selectedOptions, (e) => e.value)),
174
248
  disabled: e.disabled,
175
249
  onBlur: e.onBlur,
176
- "aria-required": C(e.required),
250
+ "aria-required": O(e.required),
177
251
  "aria-invalid": e.error !== void 0,
178
- "aria-describedby": S(t, e.description, e.error),
179
- children: (e.options ?? []).map((e) => /* @__PURE__ */ o("option", {
252
+ "aria-describedby": D(t, e.description, e.error),
253
+ children: (e.options ?? []).map((e) => /* @__PURE__ */ b("option", {
180
254
  value: e.value,
181
255
  children: e.label
182
256
  }, e.value))
183
257
  })
184
258
  });
185
- }, ue = (e) => /* @__PURE__ */ o("input", {
259
+ }, ve = (e) => /* @__PURE__ */ b("input", {
186
260
  type: "hidden",
187
261
  name: e.name,
188
- value: y(e.value),
262
+ value: w(e.value),
189
263
  readOnly: !0
190
- }), de = (e) => {
191
- let t = n();
192
- return /* @__PURE__ */ o(x, {
264
+ }), ye = (e) => {
265
+ let t = i();
266
+ return /* @__PURE__ */ b(E, {
193
267
  id: t,
194
268
  label: e.label,
195
269
  required: e.required,
196
270
  description: e.description,
197
271
  error: e.error,
198
- children: /* @__PURE__ */ o("input", {
272
+ children: /* @__PURE__ */ b("input", {
199
273
  id: t,
200
274
  type: "file",
201
275
  name: e.name,
@@ -203,50 +277,51 @@ var y = (e) => e == null ? "" : String(e), b = ({ required: e }) => e ? /* @__PU
203
277
  disabled: e.disabled,
204
278
  onBlur: e.onBlur,
205
279
  required: e.required,
206
- "aria-required": C(e.required),
280
+ "aria-required": O(e.required),
207
281
  "aria-invalid": e.error !== void 0,
208
- "aria-describedby": S(t, e.description, e.error)
282
+ "aria-describedby": D(t, e.description, e.error)
209
283
  })
210
284
  });
211
- }, E = (e) => /* @__PURE__ */ s("div", {
285
+ }, j = (e) => /* @__PURE__ */ x("div", {
212
286
  "data-voltro-field": !0,
213
287
  "data-voltro-custom": !0,
214
- children: [/* @__PURE__ */ s("label", { children: [e.label, /* @__PURE__ */ o(b, { required: e.required })] }), /* @__PURE__ */ o("p", {
288
+ children: [/* @__PURE__ */ x("label", { children: [e.label, /* @__PURE__ */ b(T, { required: e.required })] }), /* @__PURE__ */ b("p", {
215
289
  role: "note",
216
290
  children: `No default widget for "${e.name}" — provide a render-prop via <Field>.`
217
291
  })]
218
- }), D = {
219
- text: w("text", (e) => e),
220
- number: w("number", (e) => e === "" ? void 0 : Number(e)),
221
- date: w("date", (e) => e),
222
- datetime: w("datetime-local", (e) => e),
223
- daterange: w("text", (e) => e),
224
- file: de,
225
- "async-select": w("text", (e) => e),
226
- textarea: oe,
227
- checkbox: T,
228
- switch: T,
229
- select: se,
230
- radio: ce,
231
- "multi-select": le,
232
- hidden: ue,
233
- array: E,
234
- reference: E,
235
- custom: E
236
- }, O = e({}), fe = (e) => {
237
- let n = t(O), i = r(() => ({
238
- ...n,
292
+ }), M = {
293
+ text: k("text", (e) => e),
294
+ number: k("number", (e) => e === "" ? void 0 : Number(e)),
295
+ date: k("date", (e) => e),
296
+ datetime: k("datetime-local", (e) => e),
297
+ daterange: k("text", (e) => e),
298
+ file: ye,
299
+ "async-select": k("text", (e) => e),
300
+ textarea: me,
301
+ "rich-text": C,
302
+ checkbox: A,
303
+ switch: A,
304
+ select: he,
305
+ radio: ge,
306
+ "multi-select": _e,
307
+ hidden: ve,
308
+ array: j,
309
+ reference: j,
310
+ custom: j
311
+ }, N = t({}), be = (e) => {
312
+ let t = n(N), r = a(() => ({
313
+ ...t,
239
314
  ...e.widgets
240
- }), [n, e.widgets]);
241
- return /* @__PURE__ */ o(O.Provider, {
242
- value: i,
315
+ }), [t, e.widgets]);
316
+ return /* @__PURE__ */ b(N.Provider, {
317
+ value: r,
243
318
  children: e.children
244
319
  });
245
- }, k = (e) => t(O)[e] ?? D[e] ?? D.custom, A = e(null), pe = () => {
246
- let e = t(A);
320
+ }, P = (e) => n(N)[e] ?? M[e] ?? M.custom, F = t(null), xe = () => {
321
+ let e = n(F);
247
322
  if (e === null) throw Error("<Field> must be rendered inside <AutoForm>");
248
323
  return e;
249
- }, me = (e, t) => {
324
+ }, Se = (e, t) => {
250
325
  let n = e.field(t.name);
251
326
  return {
252
327
  name: t.name,
@@ -261,14 +336,14 @@ var y = (e) => e == null ? "" : String(e), b = ({ required: e }) => e ? /* @__PU
261
336
  ...n.description === void 0 ? {} : { description: n.description },
262
337
  ...t.reference === void 0 ? {} : { reference: t.reference }
263
338
  };
264
- }, j = ({ name: e, children: t }) => {
265
- let n = pe(), r = n.fields.find((t) => t.name === e), i = k(r?.widget ?? "custom");
339
+ }, I = ({ name: e, children: t }) => {
340
+ let n = xe(), r = n.fields.find((t) => t.name === e), i = P(r?.widget ?? "custom");
266
341
  if (r === void 0) return null;
267
- let a = me(n, r);
268
- return t ? t(a) : /* @__PURE__ */ o(i, { ...a });
342
+ let a = Se(n, r);
343
+ return t ? t(a) : /* @__PURE__ */ b(i, { ...a });
269
344
  };
270
- function he(e) {
271
- let t = e.formKey ?? e.mutation, n = ee(t), r = g(e.api, e.mutation, {
345
+ function Ce(e) {
346
+ let t = e.formKey ?? e.mutation, n = ie(t), r = re(e.api, e.mutation, {
272
347
  ...e.schema ? { schema: e.schema } : {},
273
348
  ...e.defaults ? { defaults: e.defaults } : {},
274
349
  ...n === void 0 ? {} : { flash: n }
@@ -277,48 +352,51 @@ function he(e) {
277
352
  t !== void 0 && e.onSuccess && e.onSuccess(t);
278
353
  });
279
354
  };
280
- return /* @__PURE__ */ o(A.Provider, {
281
- value: r,
282
- children: /* @__PURE__ */ s("form", {
283
- ...e.action === !1 ? {} : {
284
- action: u(e.mutation),
285
- method: "post"
286
- },
287
- onSubmit: i,
288
- noValidate: !0,
289
- "data-voltro-autoform": e.mutation,
290
- children: [
291
- e.action === !1 ? null : /* @__PURE__ */ o("input", {
292
- type: "hidden",
293
- name: c,
294
- value: t
295
- }),
296
- e.action === !1 || e.redirectTo === void 0 ? null : /* @__PURE__ */ o("input", {
297
- type: "hidden",
298
- name: l,
299
- value: e.redirectTo
300
- }),
301
- e.children ? e.children(r) : d(r.fields).map((e, t) => e.name === void 0 ? e.fields.map((e) => /* @__PURE__ */ o(j, { name: e.name }, e.name)) : /* @__PURE__ */ s("fieldset", {
302
- "data-voltro-section": e.name,
303
- children: [/* @__PURE__ */ o("legend", { children: e.label ?? e.name }), e.fields.map((e) => /* @__PURE__ */ o(j, { name: e.name }, e.name))]
304
- }, e.name)),
305
- r.formError === void 0 ? null : /* @__PURE__ */ o("p", {
306
- role: "alert",
307
- "data-voltro-form-error": "",
308
- children: r.formError
309
- }),
310
- /* @__PURE__ */ o("button", {
311
- type: "submit",
312
- disabled: r.pending,
313
- children: e.submitLabel ?? "Submit"
314
- })
315
- ]
355
+ return /* @__PURE__ */ b(u, {
356
+ binding: r,
357
+ children: /* @__PURE__ */ b(F.Provider, {
358
+ value: r,
359
+ children: /* @__PURE__ */ x("form", {
360
+ ...e.action === !1 ? {} : {
361
+ action: d(e.mutation),
362
+ method: "post"
363
+ },
364
+ onSubmit: i,
365
+ noValidate: !0,
366
+ "data-voltro-autoform": e.mutation,
367
+ children: [
368
+ e.action === !1 ? null : /* @__PURE__ */ b("input", {
369
+ type: "hidden",
370
+ name: c,
371
+ value: t
372
+ }),
373
+ e.action === !1 || e.redirectTo === void 0 ? null : /* @__PURE__ */ b("input", {
374
+ type: "hidden",
375
+ name: l,
376
+ value: e.redirectTo
377
+ }),
378
+ e.children ? e.children(r) : f(r.fields).map((e, t) => e.name === void 0 ? e.fields.map((e) => /* @__PURE__ */ b(I, { name: e.name }, e.name)) : /* @__PURE__ */ x("fieldset", {
379
+ "data-voltro-section": e.name,
380
+ children: [/* @__PURE__ */ b("legend", { children: e.label ?? e.name }), e.fields.map((e) => /* @__PURE__ */ b(I, { name: e.name }, e.name))]
381
+ }, e.name)),
382
+ r.formError === void 0 ? null : /* @__PURE__ */ b("p", {
383
+ role: "alert",
384
+ "data-voltro-form-error": "",
385
+ children: r.formError
386
+ }),
387
+ /* @__PURE__ */ b("button", {
388
+ type: "submit",
389
+ disabled: r.pending,
390
+ children: e.submitLabel ?? "Submit"
391
+ })
392
+ ]
393
+ })
316
394
  })
317
395
  });
318
396
  }
319
397
  //#endregion
320
398
  //#region src/strings.tsx
321
- var M = {
399
+ var L = {
322
400
  filters: {
323
401
  clear: "Clear",
324
402
  filtersLabel: "Filters",
@@ -395,7 +473,7 @@ var M = {
395
473
  howToGetToken: "How do I get a token?",
396
474
  loading: "Loading…"
397
475
  }
398
- }, N = e(M), ge = (e, t) => ({
476
+ }, R = t(L), we = (e, t) => ({
399
477
  filters: {
400
478
  ...e.filters,
401
479
  ...t.filters
@@ -441,138 +519,138 @@ var M = {
441
519
  ...t.connectAccount
442
520
  }
443
521
  });
444
- function _e(e) {
445
- let n = t(N), i = r(() => ge(n, e.strings), [n, e.strings]);
446
- return /* @__PURE__ */ o(N.Provider, {
447
- value: i,
522
+ function Te(e) {
523
+ let t = n(R), r = a(() => we(t, e.strings), [t, e.strings]);
524
+ return /* @__PURE__ */ b(R.Provider, {
525
+ value: r,
448
526
  children: e.children
449
527
  });
450
528
  }
451
- var P = () => t(N), F = (e) => {
452
- let t = ne(e.api, e.source, {
529
+ var z = () => n(R), Ee = (e) => {
530
+ let t = oe(e.api, e.source, {
453
531
  skipUntilTerm: !0,
454
532
  ...e.labelField === void 0 ? {} : { labelField: e.labelField },
455
533
  ...e.valueField === void 0 ? {} : { valueField: e.valueField },
456
534
  ...e.input === void 0 ? {} : { input: e.input },
457
535
  ...e.debounceMs === void 0 ? {} : { debounceMs: e.debounceMs }
458
- }), r = P().asyncSelect, i = n(), a = e.value === void 0 || e.value === null ? "" : String(e.value), c = a !== "" && t.options.some((e) => e.value === a), l = `${i}-error`;
459
- return /* @__PURE__ */ s("div", {
536
+ }), n = z().asyncSelect, r = i(), a = e.value === void 0 || e.value === null ? "" : String(e.value), o = a !== "" && t.options.some((e) => e.value === a), s = `${r}-error`;
537
+ return /* @__PURE__ */ x("div", {
460
538
  "data-voltro-field": !0,
461
539
  "data-voltro-async-select": !0,
462
540
  children: [
463
- /* @__PURE__ */ s("label", {
464
- htmlFor: i,
541
+ /* @__PURE__ */ x("label", {
542
+ htmlFor: r,
465
543
  children: [e.label, e.required ? " *" : ""]
466
544
  }),
467
- /* @__PURE__ */ o("input", {
545
+ /* @__PURE__ */ b("input", {
468
546
  type: "search",
469
- "aria-label": r.searchLabel(e.label),
470
- placeholder: r.searchPlaceholder,
547
+ "aria-label": n.searchLabel(e.label),
548
+ placeholder: n.searchPlaceholder,
471
549
  onChange: (e) => t.search(e.target.value),
472
550
  disabled: e.disabled
473
551
  }),
474
- /* @__PURE__ */ s("select", {
475
- id: i,
552
+ /* @__PURE__ */ x("select", {
553
+ id: r,
476
554
  name: e.name,
477
555
  value: a,
478
556
  onChange: (t) => e.onChange(t.target.value),
479
557
  disabled: e.disabled,
480
558
  required: e.required,
481
559
  "aria-invalid": e.error !== void 0,
482
- "aria-describedby": e.error === void 0 ? void 0 : l,
560
+ "aria-describedby": e.error === void 0 ? void 0 : s,
483
561
  "aria-busy": t.loading,
484
562
  children: [
485
- /* @__PURE__ */ o("option", {
563
+ /* @__PURE__ */ b("option", {
486
564
  value: "",
487
- children: t.loading ? r.loading : r.empty
565
+ children: t.loading ? n.loading : n.empty
488
566
  }),
489
- a !== "" && !c ? /* @__PURE__ */ o("option", {
567
+ a !== "" && !o ? /* @__PURE__ */ b("option", {
490
568
  value: a,
491
569
  children: a
492
570
  }) : null,
493
- t.options.map((e) => /* @__PURE__ */ o("option", {
571
+ t.options.map((e) => /* @__PURE__ */ b("option", {
494
572
  value: e.value,
495
573
  children: e.label
496
574
  }, e.value))
497
575
  ]
498
576
  }),
499
- e.error === void 0 ? null : /* @__PURE__ */ o("p", {
500
- id: l,
577
+ e.error === void 0 ? null : /* @__PURE__ */ b("p", {
578
+ id: s,
501
579
  role: "alert",
502
580
  children: e.error
503
581
  })
504
582
  ]
505
583
  });
506
- }, I = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e), ve = (e, t) => e ? t === "asc" ? "ascending" : "descending" : "none";
507
- function ye(e) {
508
- let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: c, renderCell: l, rowActions: u, rowKey: d, ...f } = e, p = P().dataTable, m = h(t, n, f);
509
- return m.loading ? /* @__PURE__ */ o("p", {
584
+ }, De = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e), Oe = (e, t) => e ? t === "asc" ? "ascending" : "descending" : "none";
585
+ function ke(e) {
586
+ let { api: t, query: n, emptyText: r, loadingText: i, loadMoreText: a, renderCell: o, rowActions: s, rowKey: c, ...l } = e, u = z().dataTable, d = ne(t, n, l);
587
+ return d.loading ? /* @__PURE__ */ b("p", {
510
588
  "data-voltro-datatable-loading": !0,
511
589
  "aria-busy": "true",
512
590
  children: i ?? "Loading…"
513
- }) : m.rows.length === 0 ? /* @__PURE__ */ o("p", {
591
+ }) : d.rows.length === 0 ? /* @__PURE__ */ b("p", {
514
592
  "data-voltro-datatable-empty": !0,
515
593
  children: r ?? "No rows."
516
- }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s("table", {
594
+ }) : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x("table", {
517
595
  "data-voltro-datatable": n,
518
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [m.columns.map((e) => {
519
- let t = m.sort?.column === e.name, n = m.sort?.direction ?? "asc";
520
- return /* @__PURE__ */ o("th", {
521
- "aria-sort": ve(t, n),
596
+ children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ x("tr", { children: [d.columns.map((e) => {
597
+ let t = d.sort?.column === e.name, n = d.sort?.direction ?? "asc";
598
+ return /* @__PURE__ */ b("th", {
599
+ "aria-sort": Oe(t, n),
522
600
  scope: "col",
523
- children: /* @__PURE__ */ s("button", {
601
+ children: /* @__PURE__ */ x("button", {
524
602
  type: "button",
525
- onClick: () => m.toggleSort(e.name),
603
+ onClick: () => d.toggleSort(e.name),
526
604
  children: [e.label, t ? n === "asc" ? " ▲" : " ▼" : ""]
527
605
  })
528
606
  }, e.name);
529
- }), u ? /* @__PURE__ */ o("th", {
607
+ }), s ? /* @__PURE__ */ b("th", {
530
608
  scope: "col",
531
- children: p.actions
532
- }) : null] }) }), /* @__PURE__ */ o("tbody", { children: m.rows.map((e, t) => /* @__PURE__ */ s("tr", { children: [m.columns.map((t) => /* @__PURE__ */ o("td", {
609
+ children: u.actions
610
+ }) : null] }) }), /* @__PURE__ */ b("tbody", { children: d.rows.map((e, t) => /* @__PURE__ */ x("tr", { children: [d.columns.map((t) => /* @__PURE__ */ b("td", {
533
611
  "data-column": t.name,
534
- children: l ? l(e, t) : I(e[t.name])
535
- }, t.name)), u ? /* @__PURE__ */ o("td", { children: u(e) }) : null] }, d ? d(e) : String(e.id ?? t))) })]
536
- }), m.hasMore ? /* @__PURE__ */ o("button", {
612
+ children: o ? o(e, t) : De(e[t.name])
613
+ }, t.name)), s ? /* @__PURE__ */ b("td", { children: s(e) }) : null] }, c ? c(e) : String(e.id ?? t))) })]
614
+ }), d.hasMore ? /* @__PURE__ */ b("button", {
537
615
  type: "button",
538
616
  "data-voltro-datatable-more": !0,
539
- onClick: () => m.loadMore(),
540
- children: c ?? "Load more"
617
+ onClick: () => d.loadMore(),
618
+ children: a ?? "Load more"
541
619
  }) : null] });
542
620
  }
543
621
  //#endregion
544
622
  //#region src/workflow.tsx
545
- var be = (e) => e === "succeeded" ? "✓" : e === "failed" ? "✗" : "…";
546
- function xe(e) {
547
- let { api: t, runId: n, loadingText: r, emptyText: i } = e, a = P().workflow, c = v(t, n);
548
- return c.loading ? /* @__PURE__ */ o("p", {
623
+ var Ae = (e) => e === "succeeded" ? "✓" : e === "failed" ? "✗" : "…";
624
+ function je(e) {
625
+ let { api: t, runId: n, loadingText: r, emptyText: i } = e, a = z().workflow, o = v(t, n);
626
+ return o.loading ? /* @__PURE__ */ b("p", {
549
627
  "data-voltro-workflow-loading": !0,
550
628
  "aria-busy": "true",
551
629
  children: r ?? a.loading
552
- }) : c.steps.length === 0 ? /* @__PURE__ */ o("p", {
630
+ }) : o.steps.length === 0 ? /* @__PURE__ */ b("p", {
553
631
  "data-voltro-workflow-empty": !0,
554
632
  children: i ?? a.empty
555
- }) : /* @__PURE__ */ o("ol", {
633
+ }) : /* @__PURE__ */ b("ol", {
556
634
  "data-voltro-workflow-progress": n,
557
- "aria-busy": c.status === "running" ? "true" : void 0,
558
- children: c.steps.map((e) => {
559
- let t = c.currentStep?.id === e.id;
560
- return /* @__PURE__ */ s("li", {
635
+ "aria-busy": o.status === "running" ? "true" : void 0,
636
+ children: o.steps.map((e) => {
637
+ let t = o.currentStep?.id === e.id;
638
+ return /* @__PURE__ */ x("li", {
561
639
  "data-step": e.stepName,
562
640
  "data-status": e.status,
563
641
  "aria-current": t ? "step" : void 0,
564
642
  children: [
565
- /* @__PURE__ */ o("span", {
643
+ /* @__PURE__ */ b("span", {
566
644
  "aria-hidden": "true",
567
- children: be(e.status)
645
+ children: Ae(e.status)
568
646
  }),
569
647
  " ",
570
648
  e.stepName,
571
- e.attempt > 1 ? /* @__PURE__ */ s("span", {
649
+ e.attempt > 1 ? /* @__PURE__ */ x("span", {
572
650
  "data-attempts": !0,
573
651
  children: [" · ", a.attempt(e.attempt)]
574
652
  }) : null,
575
- e.durationMs === null ? null : /* @__PURE__ */ s("span", {
653
+ e.durationMs === null ? null : /* @__PURE__ */ x("span", {
576
654
  "data-duration": !0,
577
655
  children: [
578
656
  " · ",
@@ -580,7 +658,7 @@ function xe(e) {
580
658
  "ms"
581
659
  ]
582
660
  }),
583
- e.status === "failed" && e.errorMessage ? /* @__PURE__ */ s("span", {
661
+ e.status === "failed" && e.errorMessage ? /* @__PURE__ */ x("span", {
584
662
  "data-step-error": !0,
585
663
  children: [" · ", e.errorMessage]
586
664
  }) : null
@@ -589,105 +667,105 @@ function xe(e) {
589
667
  })
590
668
  });
591
669
  }
592
- function Se(e) {
593
- let { api: t, runId: n } = e, r = P().workflow, i = v(t, n);
594
- if (i.loading || i.status === void 0) return /* @__PURE__ */ o("span", {
670
+ function Me(e) {
671
+ let { api: t, runId: n } = e, r = z().workflow, i = v(t, n);
672
+ if (i.loading || i.status === void 0) return /* @__PURE__ */ b("span", {
595
673
  "data-voltro-workflow-badge": !0,
596
674
  "data-status": "loading",
597
675
  children: "…"
598
676
  });
599
677
  let a = i.status === "suspended" && i.waitingFor ? `${r.status.suspended} · ${i.waitingFor.name}` : r.status[i.status];
600
- return /* @__PURE__ */ s("span", {
678
+ return /* @__PURE__ */ x("span", {
601
679
  "data-voltro-workflow-badge": !0,
602
680
  "data-status": i.status,
603
681
  role: "status",
604
- children: [a, i.error ? /* @__PURE__ */ s("span", {
682
+ children: [a, i.error ? /* @__PURE__ */ x("span", {
605
683
  "data-error-detail": !0,
606
684
  children: [i.error.step ? ` · ${i.error.step}` : "", i.traceId ? ` · voltro logs --trace ${i.traceId}` : ""]
607
685
  }) : null]
608
686
  });
609
687
  }
610
- function Ce(e) {
611
- let { when: t, onApprove: n, onReject: r, approveLabel: i, rejectLabel: a, pending: c } = e;
612
- return t ? /* @__PURE__ */ s("div", {
688
+ function Ne(e) {
689
+ let { when: t, onApprove: n, onReject: r, approveLabel: i, rejectLabel: a, pending: o } = e;
690
+ return t ? /* @__PURE__ */ x("div", {
613
691
  "data-voltro-approval-controls": !0,
614
692
  role: "group",
615
693
  "aria-label": "Approval",
616
- children: [/* @__PURE__ */ o("button", {
694
+ children: [/* @__PURE__ */ b("button", {
617
695
  type: "button",
618
696
  "data-approve": !0,
619
697
  onClick: n,
620
- disabled: c,
698
+ disabled: o,
621
699
  children: i ?? "Approve"
622
- }), /* @__PURE__ */ o("button", {
700
+ }), /* @__PURE__ */ b("button", {
623
701
  type: "button",
624
702
  "data-reject": !0,
625
703
  onClick: r,
626
- disabled: c,
704
+ disabled: o,
627
705
  children: a ?? "Reject"
628
706
  })]
629
707
  }) : null;
630
708
  }
631
709
  //#endregion
632
710
  //#region src/presence.tsx
633
- var L = (e, t) => {
711
+ var B = (e, t) => {
634
712
  let n = e.meta?.[t];
635
713
  return typeof n == "string" ? n : void 0;
636
- }, R = (e) => L(e, "name") ?? L(e, "displayName") ?? e.key, z = (e) => {
714
+ }, V = (e) => B(e, "name") ?? B(e, "displayName") ?? e.key, H = (e) => {
637
715
  let t = e.trim().split(/\s+/).filter(Boolean);
638
716
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
639
717
  };
640
- function we(e) {
641
- let { members: t, max: n = 5, nameOf: r = R, renderAvatar: i } = e, a = P().presence, c = t.slice(0, n), l = t.length - c.length;
642
- return /* @__PURE__ */ s("div", {
718
+ function Pe(e) {
719
+ let { members: t, max: n = 5, nameOf: r = V, renderAvatar: i } = e, a = z().presence, o = t.slice(0, n), s = t.length - o.length;
720
+ return /* @__PURE__ */ x("div", {
643
721
  "data-voltro-presence-avatars": !0,
644
722
  role: "group",
645
723
  "aria-label": a.onlineCount(t.length),
646
- children: [c.map((e) => {
724
+ children: [o.map((e) => {
647
725
  let t = r(e);
648
- return i ? /* @__PURE__ */ o("span", { children: i(e, t) }, e.key) : /* @__PURE__ */ o("span", {
726
+ return i ? /* @__PURE__ */ b("span", { children: i(e, t) }, e.key) : /* @__PURE__ */ b("span", {
649
727
  "data-avatar": !0,
650
728
  title: t,
651
729
  "aria-label": t,
652
- children: z(t)
730
+ children: H(t)
653
731
  }, e.key);
654
- }), l > 0 ? /* @__PURE__ */ s("span", {
732
+ }), s > 0 ? /* @__PURE__ */ x("span", {
655
733
  "data-avatar-overflow": !0,
656
- "aria-label": a.moreOverflow(l),
657
- children: ["+", l]
734
+ "aria-label": a.moreOverflow(s),
735
+ children: ["+", s]
658
736
  }) : null]
659
737
  });
660
738
  }
661
- var B = (e, t, n = M.presence) => e.length === 0 ? "" : e.length === 1 ? n.editingOne(e[0], t) : e.length === 2 ? n.editingTwo(e[0], e[1], t) : n.editingMany(e[0], e.length - 1, t);
662
- function Te(e) {
663
- let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a = R } = e, s = P().presence, c = t.filter((e) => !(n !== void 0 && e.key === n || r !== void 0 && L(e, "field") !== r));
664
- return c.length === 0 ? null : /* @__PURE__ */ o("span", {
739
+ var U = (e, t, n = L.presence) => e.length === 0 ? "" : e.length === 1 ? n.editingOne(e[0], t) : e.length === 2 ? n.editingTwo(e[0], e[1], t) : n.editingMany(e[0], e.length - 1, t);
740
+ function Fe(e) {
741
+ let { members: t, selfKey: n, field: r, verb: i = "editing", nameOf: a = V } = e, o = z().presence, s = t.filter((e) => !(n !== void 0 && e.key === n || r !== void 0 && B(e, "field") !== r));
742
+ return s.length === 0 ? null : /* @__PURE__ */ b("span", {
665
743
  "data-voltro-editing-indicator": !0,
666
744
  "data-field": r,
667
745
  role: "status",
668
- children: B(c.map(a), i, s)
746
+ children: U(s.map(a), i, o)
669
747
  });
670
748
  }
671
749
  //#endregion
672
750
  //#region src/agentChat.tsx
673
- var V = (e) => typeof e.text == "string" ? e.text : "";
674
- function Ee({ text: e }) {
675
- let t = P().agentChat;
676
- return /* @__PURE__ */ s("details", {
751
+ var W = (e) => typeof e.text == "string" ? e.text : "";
752
+ function Ie({ text: e }) {
753
+ let t = z().agentChat;
754
+ return /* @__PURE__ */ x("details", {
677
755
  "data-part": "reasoning",
678
- children: [/* @__PURE__ */ o("summary", { children: t.reasoning }), /* @__PURE__ */ o("span", { children: e })]
756
+ children: [/* @__PURE__ */ b("summary", { children: t.reasoning }), /* @__PURE__ */ b("span", { children: e })]
679
757
  });
680
758
  }
681
- function H({ part: e }) {
759
+ function G({ part: e }) {
682
760
  switch (e.type) {
683
- case "text": return /* @__PURE__ */ o("span", {
761
+ case "text": return /* @__PURE__ */ b("span", {
684
762
  "data-part": "text",
685
- children: V(e)
763
+ children: W(e)
686
764
  });
687
- case "reasoning": return /* @__PURE__ */ o(Ee, { text: V(e) });
765
+ case "reasoning": return /* @__PURE__ */ b(Ie, { text: W(e) });
688
766
  case "tool": {
689
767
  let t = e;
690
- return /* @__PURE__ */ s("span", {
768
+ return /* @__PURE__ */ x("span", {
691
769
  "data-part": "tool",
692
770
  "data-tool": t.toolName,
693
771
  "data-state": t.state,
@@ -696,192 +774,192 @@ function H({ part: e }) {
696
774
  }
697
775
  case "source": {
698
776
  let t = e;
699
- return t.url ? /* @__PURE__ */ o("a", {
777
+ return t.url ? /* @__PURE__ */ b("a", {
700
778
  "data-part": "source",
701
779
  href: t.url,
702
780
  rel: "noreferrer",
703
781
  children: t.title ?? t.url
704
- }) : /* @__PURE__ */ o("span", {
782
+ }) : /* @__PURE__ */ b("span", {
705
783
  "data-part": "source",
706
784
  children: t.title ?? t.id ?? "source"
707
785
  });
708
786
  }
709
787
  case "file": {
710
788
  let t = e;
711
- return t.mediaType.startsWith("image/") ? /* @__PURE__ */ o("img", {
789
+ return t.mediaType.startsWith("image/") ? /* @__PURE__ */ b("img", {
712
790
  "data-part": "file",
713
791
  alt: "",
714
792
  src: `data:${t.mediaType};base64,${t.data}`
715
- }) : /* @__PURE__ */ s("span", {
793
+ }) : /* @__PURE__ */ x("span", {
716
794
  "data-part": "file",
717
795
  "data-media": t.mediaType,
718
796
  children: ["📎 ", t.mediaType]
719
797
  });
720
798
  }
721
- default: return /* @__PURE__ */ o("span", {
799
+ default: return /* @__PURE__ */ b("span", {
722
800
  "data-part": e.type,
723
801
  children: JSON.stringify(e)
724
802
  });
725
803
  }
726
804
  }
727
- function U({ message: e }) {
805
+ function K({ message: e }) {
728
806
  let t = e.parts ?? [];
729
- return /* @__PURE__ */ s("div", {
807
+ return /* @__PURE__ */ x("div", {
730
808
  "data-voltro-agent-message": !0,
731
809
  "data-role": e.role,
732
810
  "data-streaming": e.streaming ? "true" : void 0,
733
811
  "aria-busy": e.streaming ? "true" : void 0,
734
- children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ o(H, { part: e }, t)) : /* @__PURE__ */ o("span", {
812
+ children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ b(G, { part: e }, t)) : /* @__PURE__ */ b("span", {
735
813
  "data-part": "text",
736
814
  children: e.content
737
- }), e.streaming ? /* @__PURE__ */ o("span", {
815
+ }), e.streaming ? /* @__PURE__ */ b("span", {
738
816
  "data-cursor": !0,
739
817
  "aria-hidden": "true",
740
818
  children: "▍"
741
819
  }) : null]
742
820
  });
743
821
  }
744
- function W(e) {
745
- let { api: t, agent: n, threadId: r, placeholder: a, sendLabel: c, emptyText: l } = e, u = P().agentChat, d = f(t, n, { threadId: r }), [p, m] = i(""), h = () => {
746
- let e = p.trim();
747
- e.length === 0 || d.sending || (m(""), d.send(e));
822
+ function q(e) {
823
+ let { api: t, agent: n, threadId: r, placeholder: i, sendLabel: a, emptyText: o } = e, c = z().agentChat, l = g(t, n, { threadId: r }), [u, d] = s(""), f = () => {
824
+ let e = u.trim();
825
+ e.length === 0 || l.sending || (d(""), l.send(e));
748
826
  };
749
- return /* @__PURE__ */ s("div", {
827
+ return /* @__PURE__ */ x("div", {
750
828
  "data-voltro-agent-chat": n,
751
- children: [/* @__PURE__ */ o("div", {
829
+ children: [/* @__PURE__ */ b("div", {
752
830
  "data-messages": !0,
753
831
  role: "log",
754
832
  "aria-live": "polite",
755
- "aria-busy": d.streaming ? "true" : void 0,
756
- children: d.messages.length === 0 && !d.loading ? /* @__PURE__ */ o("p", {
833
+ "aria-busy": l.streaming ? "true" : void 0,
834
+ children: l.messages.length === 0 && !l.loading ? /* @__PURE__ */ b("p", {
757
835
  "data-empty": !0,
758
- children: l ?? "No messages yet."
759
- }) : d.messages.map((e) => /* @__PURE__ */ o(U, { message: e }, e.id))
760
- }), /* @__PURE__ */ s("form", {
836
+ children: o ?? "No messages yet."
837
+ }) : l.messages.map((e) => /* @__PURE__ */ b(K, { message: e }, e.id))
838
+ }), /* @__PURE__ */ x("form", {
761
839
  "data-composer": !0,
762
840
  onSubmit: (e) => {
763
- e.preventDefault(), h();
841
+ e.preventDefault(), f();
764
842
  },
765
- children: [/* @__PURE__ */ o("input", {
766
- value: p,
767
- onChange: (e) => m(e.target.value),
768
- placeholder: a ?? u.messagePlaceholder,
769
- "aria-label": u.messageLabel,
770
- disabled: d.sending
771
- }), /* @__PURE__ */ o("button", {
843
+ children: [/* @__PURE__ */ b("input", {
844
+ value: u,
845
+ onChange: (e) => d(e.target.value),
846
+ placeholder: i ?? c.messagePlaceholder,
847
+ "aria-label": c.messageLabel,
848
+ disabled: l.sending
849
+ }), /* @__PURE__ */ b("button", {
772
850
  type: "submit",
773
- disabled: d.sending || p.trim().length === 0,
774
- children: c ?? u.send
851
+ disabled: l.sending || u.trim().length === 0,
852
+ children: a ?? c.send
775
853
  })]
776
854
  })]
777
855
  });
778
856
  }
779
- function De(e) {
780
- let t = f(e.api, e.agent, { threadId: e.threadId });
857
+ function Le(e) {
858
+ let t = g(e.api, e.agent, { threadId: e.threadId });
781
859
  return e.children(t);
782
860
  }
783
861
  //#endregion
784
862
  //#region src/appAgent.tsx
785
- function Oe(e) {
786
- let { tools: t, showTools: n, ...r } = e, i = P().appAgent, a = (n ?? (t !== void 0 && t.length > 0)) && t && t.length > 0;
787
- return /* @__PURE__ */ s("div", {
863
+ function Re(e) {
864
+ let { tools: t, showTools: n, ...r } = e, i = z().appAgent, a = (n ?? (t !== void 0 && t.length > 0)) && t && t.length > 0;
865
+ return /* @__PURE__ */ x("div", {
788
866
  "data-voltro-app-agent": r.agent,
789
- children: [a ? /* @__PURE__ */ s("details", {
867
+ children: [a ? /* @__PURE__ */ x("details", {
790
868
  "data-agent-tools": !0,
791
- children: [/* @__PURE__ */ o("summary", { children: i.toolsSummary(t.length) }), /* @__PURE__ */ o("ul", { children: t.map((e) => /* @__PURE__ */ s("li", {
869
+ children: [/* @__PURE__ */ b("summary", { children: i.toolsSummary(t.length) }), /* @__PURE__ */ b("ul", { children: t.map((e) => /* @__PURE__ */ x("li", {
792
870
  "data-tool": e.name,
793
871
  "data-write": e.write ? "true" : void 0,
794
872
  children: [
795
- /* @__PURE__ */ o("code", { children: e.name }),
796
- e.confirm ? /* @__PURE__ */ s("span", {
873
+ /* @__PURE__ */ b("code", { children: e.name }),
874
+ e.confirm ? /* @__PURE__ */ x("span", {
797
875
  "data-confirm": !0,
798
876
  children: [" · ", i.needsConfirm]
799
877
  }) : null,
800
- e.description ? /* @__PURE__ */ s("span", {
878
+ e.description ? /* @__PURE__ */ x("span", {
801
879
  "data-desc": !0,
802
880
  children: [" — ", e.description]
803
881
  }) : null
804
882
  ]
805
883
  }, e.name)) })]
806
- }) : null, /* @__PURE__ */ o(W, { ...r })]
884
+ }) : null, /* @__PURE__ */ b(q, { ...r })]
807
885
  });
808
886
  }
809
887
  //#endregion
810
888
  //#region src/dataCopilot.tsx
811
- var ke = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), Ae = (e) => {
889
+ var ze = (e) => e == null ? "" : typeof e == "boolean" ? e ? "✓" : "✗" : typeof e == "object" ? JSON.stringify(e) : String(e), Be = (e) => {
812
890
  let t = /* @__PURE__ */ new Set(), n = [];
813
891
  for (let r of e) for (let e of Object.keys(r)) t.has(e) || (t.add(e), n.push(e));
814
892
  return n;
815
893
  };
816
- function G(e) {
894
+ function J(e) {
817
895
  let { answer: t, emptyText: n } = e;
818
896
  if (t === void 0) return null;
819
- if (!t.ok) return /* @__PURE__ */ o("p", {
897
+ if (!t.ok) return /* @__PURE__ */ b("p", {
820
898
  "data-voltro-data-copilot-refused": !0,
821
899
  role: "status",
822
900
  children: t.reason
823
901
  });
824
- if (t.rows.length === 0) return /* @__PURE__ */ o("p", {
902
+ if (t.rows.length === 0) return /* @__PURE__ */ b("p", {
825
903
  "data-voltro-data-copilot-empty": !0,
826
904
  children: n ?? "No rows."
827
905
  });
828
- let r = Ae(t.rows);
829
- return /* @__PURE__ */ s("table", {
906
+ let r = Be(t.rows);
907
+ return /* @__PURE__ */ x("table", {
830
908
  "data-voltro-data-copilot-results": !0,
831
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
909
+ children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: r.map((e) => /* @__PURE__ */ b("th", {
832
910
  scope: "col",
833
911
  children: e
834
- }, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.rows.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", {
912
+ }, e)) }) }), /* @__PURE__ */ b("tbody", { children: t.rows.map((e, t) => /* @__PURE__ */ b("tr", { children: r.map((t) => /* @__PURE__ */ b("td", {
835
913
  "data-column": t,
836
- children: ke(e[t])
914
+ children: ze(e[t])
837
915
  }, t)) }, String(e.id ?? t))) })]
838
916
  });
839
917
  }
840
- function je(e) {
841
- let { api: t, action: n, placeholder: r, askLabel: a, emptyText: c } = e, l = m(t, n), [u, d] = i(""), f = () => {
842
- let e = u.trim();
843
- e.length === 0 || l.pending || l.ask(e);
918
+ function Ve(e) {
919
+ let { api: t, action: n, placeholder: r, askLabel: i, emptyText: a } = e, o = _(t, n), [c, l] = s(""), u = () => {
920
+ let e = c.trim();
921
+ e.length === 0 || o.pending || o.ask(e);
844
922
  };
845
- return /* @__PURE__ */ s("div", {
923
+ return /* @__PURE__ */ x("div", {
846
924
  "data-voltro-data-copilot": n,
847
- children: [/* @__PURE__ */ s("form", {
925
+ children: [/* @__PURE__ */ x("form", {
848
926
  "data-composer": !0,
849
927
  onSubmit: (e) => {
850
- e.preventDefault(), f();
928
+ e.preventDefault(), u();
851
929
  },
852
- children: [/* @__PURE__ */ o("input", {
853
- value: u,
854
- onChange: (e) => d(e.target.value),
930
+ children: [/* @__PURE__ */ b("input", {
931
+ value: c,
932
+ onChange: (e) => l(e.target.value),
855
933
  placeholder: r ?? "Ask about your data…",
856
934
  "aria-label": "Ask about your data",
857
- disabled: l.pending
858
- }), /* @__PURE__ */ o("button", {
935
+ disabled: o.pending
936
+ }), /* @__PURE__ */ b("button", {
859
937
  type: "submit",
860
- disabled: l.pending || u.trim().length === 0,
861
- children: a ?? "Ask"
938
+ disabled: o.pending || c.trim().length === 0,
939
+ children: i ?? "Ask"
862
940
  })]
863
- }), /* @__PURE__ */ o("div", {
941
+ }), /* @__PURE__ */ b("div", {
864
942
  "data-answer": !0,
865
943
  "aria-live": "polite",
866
- "aria-busy": l.pending ? "true" : void 0,
867
- children: l.error === void 0 ? /* @__PURE__ */ o(G, {
868
- answer: l.answer,
869
- ...c === void 0 ? {} : { emptyText: c }
870
- }) : /* @__PURE__ */ o("p", {
944
+ "aria-busy": o.pending ? "true" : void 0,
945
+ children: o.error === void 0 ? /* @__PURE__ */ b(J, {
946
+ answer: o.answer,
947
+ ...a === void 0 ? {} : { emptyText: a }
948
+ }) : /* @__PURE__ */ b("p", {
871
949
  "data-voltro-data-copilot-error": !0,
872
950
  role: "alert",
873
- children: l.error instanceof Error ? l.error.message : String(l.error)
951
+ children: o.error instanceof Error ? o.error.message : String(o.error)
874
952
  })
875
953
  })]
876
954
  });
877
955
  }
878
- function Me(e) {
879
- let t = m(e.api, e.action);
956
+ function He(e) {
957
+ let t = _(e.api, e.action);
880
958
  return e.children(t);
881
959
  }
882
960
  //#endregion
883
961
  //#region src/skeleton.tsx
884
- var K = ({ w: e }) => /* @__PURE__ */ o("span", {
962
+ var Y = ({ w: e }) => /* @__PURE__ */ b("span", {
885
963
  "data-skeleton-bar": !0,
886
964
  style: {
887
965
  display: "inline-block",
@@ -891,75 +969,75 @@ var K = ({ w: e }) => /* @__PURE__ */ o("span", {
891
969
  },
892
970
  "aria-hidden": "true"
893
971
  });
894
- function Ne(e) {
895
- let t = te(e.api, e.mutation), n = t.length > 0 ? t.length : e.fallbackFields ?? 3, r = t.length > 0 ? d(t) : [{
972
+ function Ue(e) {
973
+ let t = ae(e.api, e.mutation), n = t.length > 0 ? t.length : e.fallbackFields ?? 3, r = t.length > 0 ? f(t) : [{
896
974
  name: void 0,
897
975
  label: void 0,
898
976
  fields: Array.from({ length: n }, (e, t) => ({ name: `f${t}` }))
899
977
  }];
900
- return /* @__PURE__ */ o("div", {
978
+ return /* @__PURE__ */ b("div", {
901
979
  "data-voltro-form-skeleton": e.mutation,
902
980
  "aria-busy": "true",
903
981
  "aria-hidden": "true",
904
- children: r.map((e, t) => /* @__PURE__ */ s("div", {
982
+ children: r.map((e, t) => /* @__PURE__ */ x("div", {
905
983
  ...e.name === void 0 ? {} : { "data-skeleton-section": e.name },
906
- children: [e.name !== void 0 && /* @__PURE__ */ o("div", {
984
+ children: [e.name !== void 0 && /* @__PURE__ */ b("div", {
907
985
  "data-skeleton-section-title": !0,
908
- children: /* @__PURE__ */ o(K, { w: "40%" })
909
- }), e.fields.map((e) => /* @__PURE__ */ s("div", {
986
+ children: /* @__PURE__ */ b(Y, { w: "40%" })
987
+ }), e.fields.map((e) => /* @__PURE__ */ x("div", {
910
988
  "data-skeleton-field": !0,
911
- children: [/* @__PURE__ */ o(K, { w: "30%" }), /* @__PURE__ */ o(K, {})]
989
+ children: [/* @__PURE__ */ b(Y, { w: "30%" }), /* @__PURE__ */ b(Y, {})]
912
990
  }, e.name))]
913
991
  }, e.name ?? `_${t}`))
914
992
  });
915
993
  }
916
- function Pe(e) {
917
- let t = ie(e.api, e.query), n = t.length > 0 ? t.length : e.fallbackColumns ?? 4, r = t.length > 0 ? t.map((e) => e.name) : Array.from({ length: n }, (e, t) => `c${t}`), i = e.rows ?? 5;
918
- return /* @__PURE__ */ s("table", {
994
+ function We(e) {
995
+ let t = le(e.api, e.query), n = t.length > 0 ? t.length : e.fallbackColumns ?? 4, r = t.length > 0 ? t.map((e) => e.name) : Array.from({ length: n }, (e, t) => `c${t}`), i = e.rows ?? 5;
996
+ return /* @__PURE__ */ x("table", {
919
997
  "data-voltro-table-skeleton": e.query,
920
998
  "aria-busy": "true",
921
999
  "aria-hidden": "true",
922
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
1000
+ children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: r.map((e) => /* @__PURE__ */ b("th", {
923
1001
  scope: "col",
924
- children: /* @__PURE__ */ o(K, { w: "60%" })
925
- }, e)) }) }), /* @__PURE__ */ o("tbody", { children: Array.from({ length: i }, (e, t) => /* @__PURE__ */ o("tr", {
1002
+ children: /* @__PURE__ */ b(Y, { w: "60%" })
1003
+ }, e)) }) }), /* @__PURE__ */ b("tbody", { children: Array.from({ length: i }, (e, t) => /* @__PURE__ */ b("tr", {
926
1004
  "data-skeleton-row": !0,
927
- children: r.map((e) => /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(K, {}) }, e))
1005
+ children: r.map((e) => /* @__PURE__ */ b("td", { children: /* @__PURE__ */ b(Y, {}) }, e))
928
1006
  }, t)) })]
929
1007
  });
930
1008
  }
931
1009
  //#endregion
932
1010
  //#region src/filters.tsx
933
- var q = (e) => e == null ? "" : String(e);
934
- function Fe(e) {
935
- let { filter: t, value: n, onChange: r } = e, i = P().filters, a = {
1011
+ var X = (e) => e == null ? "" : String(e);
1012
+ function Ge(e) {
1013
+ let { filter: t, value: n, onChange: r } = e, i = z().filters, a = {
936
1014
  "data-filter": t.name,
937
1015
  "aria-label": t.label
938
1016
  };
939
1017
  switch (t.kind) {
940
- case "select": return /* @__PURE__ */ s("select", {
1018
+ case "select": return /* @__PURE__ */ x("select", {
941
1019
  ...a,
942
- value: q(n),
1020
+ value: X(n),
943
1021
  onChange: (e) => r(e.target.value || void 0),
944
- children: [/* @__PURE__ */ o("option", {
1022
+ children: [/* @__PURE__ */ b("option", {
945
1023
  value: "",
946
1024
  children: i.anyOption(t.label)
947
- }), (t.options ?? []).map((e) => /* @__PURE__ */ o("option", {
1025
+ }), (t.options ?? []).map((e) => /* @__PURE__ */ b("option", {
948
1026
  value: e.value,
949
1027
  children: e.label
950
1028
  }, e.value))]
951
1029
  });
952
- case "multi-select": return /* @__PURE__ */ o("select", {
1030
+ case "multi-select": return /* @__PURE__ */ b("select", {
953
1031
  ...a,
954
1032
  multiple: !0,
955
1033
  value: Array.isArray(n) ? n : [],
956
1034
  onChange: (e) => r(Array.from(e.target.selectedOptions, (e) => e.value)),
957
- children: (t.options ?? []).map((e) => /* @__PURE__ */ o("option", {
1035
+ children: (t.options ?? []).map((e) => /* @__PURE__ */ b("option", {
958
1036
  value: e.value,
959
1037
  children: e.label
960
1038
  }, e.value))
961
1039
  });
962
- case "boolean": return /* @__PURE__ */ o("input", {
1040
+ case "boolean": return /* @__PURE__ */ b("input", {
963
1041
  ...a,
964
1042
  type: "checkbox",
965
1043
  checked: n === !0,
@@ -968,21 +1046,21 @@ function Fe(e) {
968
1046
  case "number-range":
969
1047
  case "date-range": {
970
1048
  let e = t.kind === "number-range" ? "number" : "date", i = n ?? {};
971
- return /* @__PURE__ */ s("span", {
1049
+ return /* @__PURE__ */ x("span", {
972
1050
  "data-filter": t.name,
973
1051
  "data-range": t.kind,
974
- children: [/* @__PURE__ */ o("input", {
1052
+ children: [/* @__PURE__ */ b("input", {
975
1053
  "aria-label": `${t.label} from`,
976
1054
  type: e,
977
- value: q(i.gte),
1055
+ value: X(i.gte),
978
1056
  onChange: (e) => r({
979
1057
  ...i,
980
1058
  gte: e.target.value || void 0
981
1059
  })
982
- }), /* @__PURE__ */ o("input", {
1060
+ }), /* @__PURE__ */ b("input", {
983
1061
  "aria-label": `${t.label} to`,
984
1062
  type: e,
985
- value: q(i.lte),
1063
+ value: X(i.lte),
986
1064
  onChange: (e) => r({
987
1065
  ...i,
988
1066
  lte: e.target.value || void 0
@@ -990,38 +1068,38 @@ function Fe(e) {
990
1068
  })]
991
1069
  });
992
1070
  }
993
- default: return /* @__PURE__ */ o("input", {
1071
+ default: return /* @__PURE__ */ b("input", {
994
1072
  ...a,
995
1073
  type: "text",
996
- value: q(n),
1074
+ value: X(n),
997
1075
  onChange: (e) => r(e.target.value || void 0)
998
1076
  });
999
1077
  }
1000
1078
  }
1001
- function J(e) {
1002
- let t = re(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = P().filters;
1003
- return /* @__PURE__ */ s("div", {
1079
+ function Ke(e) {
1080
+ let t = se(e.api, e.query, e.initial ? { initial: e.initial } : {}), n = z().filters;
1081
+ return /* @__PURE__ */ x("div", {
1004
1082
  "data-voltro-query-filters": e.query,
1005
- children: [/* @__PURE__ */ s("div", {
1083
+ children: [/* @__PURE__ */ x("div", {
1006
1084
  "data-filter-controls": !0,
1007
1085
  role: "group",
1008
1086
  "aria-label": n.filtersLabel,
1009
1087
  children: [
1010
- t.filters.map((e) => /* @__PURE__ */ s("label", {
1088
+ t.filters.map((e) => /* @__PURE__ */ x("label", {
1011
1089
  "data-filter-label": !0,
1012
- children: [/* @__PURE__ */ o("span", { children: e.label }), /* @__PURE__ */ o(Fe, {
1090
+ children: [/* @__PURE__ */ b("span", { children: e.label }), /* @__PURE__ */ b(Ge, {
1013
1091
  filter: e,
1014
1092
  value: t.values[e.name],
1015
1093
  onChange: (n) => t.setFilter(e.name, n)
1016
1094
  })]
1017
1095
  }, e.name)),
1018
- /* @__PURE__ */ o("button", {
1096
+ /* @__PURE__ */ b("button", {
1019
1097
  type: "button",
1020
1098
  "data-filter-clear": !0,
1021
1099
  onClick: () => t.clear(),
1022
1100
  children: n.clear
1023
1101
  }),
1024
- e.showCount ?? !0 ? /* @__PURE__ */ o("span", {
1102
+ e.showCount ?? !0 ? /* @__PURE__ */ b("span", {
1025
1103
  "data-filter-count": !0,
1026
1104
  children: n.resultCount(t.count ?? "…")
1027
1105
  }) : null
@@ -1031,46 +1109,46 @@ function J(e) {
1031
1109
  }
1032
1110
  //#endregion
1033
1111
  //#region src/recordView.tsx
1034
- var Y = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), X = (e) => Array.isArray(e) && e.every((e) => typeof e == "object" && !!e), Z = (e) => e == null ? "—" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e);
1035
- function Ie({ name: e, items: t }) {
1036
- let n = P().recordView;
1037
- if (t.length === 0) return /* @__PURE__ */ o("p", {
1112
+ var Z = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), Q = (e) => Array.isArray(e) && e.every((e) => typeof e == "object" && !!e), qe = (e) => e == null ? "—" : typeof e == "boolean" ? e ? "✓" : "✗" : String(e);
1113
+ function Je({ name: e, items: t }) {
1114
+ let n = z().recordView;
1115
+ if (t.length === 0) return /* @__PURE__ */ b("p", {
1038
1116
  "data-relation": e,
1039
1117
  "data-empty": !0,
1040
- children: n.emptyRelation(Y(e).toLowerCase())
1118
+ children: n.emptyRelation(Z(e).toLowerCase())
1041
1119
  });
1042
1120
  let r = Object.keys(t[0]);
1043
- return /* @__PURE__ */ s("table", {
1121
+ return /* @__PURE__ */ x("table", {
1044
1122
  "data-relation": e,
1045
- children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: r.map((e) => /* @__PURE__ */ o("th", {
1123
+ children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: r.map((e) => /* @__PURE__ */ b("th", {
1046
1124
  scope: "col",
1047
- children: Y(e)
1048
- }, e)) }) }), /* @__PURE__ */ o("tbody", { children: t.map((e, t) => /* @__PURE__ */ o("tr", { children: r.map((t) => /* @__PURE__ */ o("td", { children: Z(e[t]) }, t)) }, String(e.id ?? t))) })]
1125
+ children: Z(e)
1126
+ }, e)) }) }), /* @__PURE__ */ b("tbody", { children: t.map((e, t) => /* @__PURE__ */ b("tr", { children: r.map((t) => /* @__PURE__ */ b("td", { children: qe(e[t]) }, t)) }, String(e.id ?? t))) })]
1049
1127
  });
1050
1128
  }
1051
- function Le(e) {
1052
- let { api: t, query: n, input: r, fields: i, renderField: a, renderRelation: c, loadingText: l, emptyText: u } = e, { record: d, loading: f } = _(t, n, r ?? {});
1053
- if (f) return /* @__PURE__ */ o("p", {
1129
+ function Ye(e) {
1130
+ let { api: t, query: n, input: r, fields: i, renderField: a, renderRelation: o, loadingText: s, emptyText: c } = e, { record: l, loading: u } = ce(t, n, r ?? {});
1131
+ if (u) return /* @__PURE__ */ b("p", {
1054
1132
  "data-voltro-record-loading": !0,
1055
1133
  "aria-busy": "true",
1056
- children: l ?? "Loading…"
1134
+ children: s ?? "Loading…"
1057
1135
  });
1058
- if (d == null) return /* @__PURE__ */ o("p", {
1136
+ if (l == null) return /* @__PURE__ */ b("p", {
1059
1137
  "data-voltro-record-empty": !0,
1060
- children: u ?? "Not found."
1138
+ children: c ?? "Not found."
1061
1139
  });
1062
- let p = Object.entries(d), m = p.filter(([e, t]) => !X(t) && (i === void 0 || i.includes(e))), h = p.filter(([, e]) => X(e)), g = i === void 0 ? m : i.map((e) => [e, d[e]]).filter(([, e]) => !X(e));
1063
- return /* @__PURE__ */ s("div", {
1140
+ let d = Object.entries(l), f = d.filter(([e, t]) => !Q(t) && (i === void 0 || i.includes(e))), p = d.filter(([, e]) => Q(e)), m = i === void 0 ? f : i.map((e) => [e, l[e]]).filter(([, e]) => !Q(e));
1141
+ return /* @__PURE__ */ x("div", {
1064
1142
  "data-voltro-record-view": n,
1065
- children: [/* @__PURE__ */ o("dl", {
1143
+ children: [/* @__PURE__ */ b("dl", {
1066
1144
  "data-record-fields": !0,
1067
- children: g.map(([e, t]) => /* @__PURE__ */ s("div", {
1145
+ children: m.map(([e, t]) => /* @__PURE__ */ x("div", {
1068
1146
  "data-field": e,
1069
- children: [/* @__PURE__ */ o("dt", { children: Y(e) }), /* @__PURE__ */ o("dd", { children: a ? a(e, t, d) : Z(t) })]
1147
+ children: [/* @__PURE__ */ b("dt", { children: Z(e) }), /* @__PURE__ */ b("dd", { children: a ? a(e, t, l) : qe(t) })]
1070
1148
  }, e))
1071
- }), h.map(([e, t]) => /* @__PURE__ */ s("section", {
1149
+ }), p.map(([e, t]) => /* @__PURE__ */ x("section", {
1072
1150
  "data-record-relation": e,
1073
- children: [/* @__PURE__ */ o("h3", { children: Y(e) }), c ? c(e, t, d) : /* @__PURE__ */ o(Ie, {
1151
+ children: [/* @__PURE__ */ b("h3", { children: Z(e) }), o ? o(e, t, l) : /* @__PURE__ */ b(Je, {
1074
1152
  name: e,
1075
1153
  items: t
1076
1154
  })]
@@ -1079,7 +1157,7 @@ function Le(e) {
1079
1157
  }
1080
1158
  //#endregion
1081
1159
  //#region src/connectAccount.tsx
1082
- var Re = (e, t) => {
1160
+ var Xe = (e, t) => {
1083
1161
  switch (e.status) {
1084
1162
  case "connected": return e.accountLabel === null ? t.connected : t.connectedAs(e.accountLabel);
1085
1163
  case "expired": return t.expired;
@@ -1087,127 +1165,127 @@ var Re = (e, t) => {
1087
1165
  case "error": return t.errored;
1088
1166
  default: return t.notConnected;
1089
1167
  }
1090
- }, ze = ({ api: e, connectionId: t, ...n }) => {
1091
- let r = p(e, t);
1092
- return /* @__PURE__ */ o(Q, {
1168
+ }, Ze = ({ api: e, connectionId: t, ...n }) => {
1169
+ let r = te(e, t);
1170
+ return /* @__PURE__ */ b(Qe, {
1093
1171
  connection: r,
1094
1172
  loading: r.loading,
1095
1173
  ...n
1096
1174
  });
1097
- }, Q = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: c }) => {
1098
- let l = P().connectAccount, [u, d] = i("");
1175
+ }, Qe = ({ connection: e, instructionsUrl: t, loading: n = !1, children: r, className: i }) => {
1176
+ let a = z().connectAccount, [o, c] = s("");
1099
1177
  if (r !== void 0) return r(e);
1100
- if (n) return /* @__PURE__ */ o("div", {
1101
- className: c,
1178
+ if (n) return /* @__PURE__ */ b("div", {
1179
+ className: i,
1102
1180
  "data-voltro-connect": e.connectionId,
1103
- children: l.loading
1181
+ children: a.loading
1104
1182
  });
1105
- let f = async (t) => {
1106
- t.preventDefault(), u.trim() !== "" && (await e.submitToken(u), d(""));
1183
+ let l = async (t) => {
1184
+ t.preventDefault(), o.trim() !== "" && (await e.submitToken(o), c(""));
1107
1185
  };
1108
- return /* @__PURE__ */ s("div", {
1109
- className: c,
1186
+ return /* @__PURE__ */ x("div", {
1187
+ className: i,
1110
1188
  "data-voltro-connect": e.connectionId,
1111
1189
  "data-status": e.status,
1112
- children: [/* @__PURE__ */ s("div", { children: [
1113
- /* @__PURE__ */ o("strong", { children: e.label }),
1190
+ children: [/* @__PURE__ */ x("div", { children: [
1191
+ /* @__PURE__ */ b("strong", { children: e.label }),
1114
1192
  " — ",
1115
- /* @__PURE__ */ o("span", {
1193
+ /* @__PURE__ */ b("span", {
1116
1194
  role: e.needsAttention ? "alert" : void 0,
1117
- children: Re(e, l)
1195
+ children: Xe(e, a)
1118
1196
  })
1119
- ] }), e.connected || e.needsAttention ? /* @__PURE__ */ s(a, { children: [e.needsAttention && e.kind === "oauth2" && /* @__PURE__ */ o("button", {
1197
+ ] }), e.connected || e.needsAttention ? /* @__PURE__ */ x(y, { children: [e.needsAttention && e.kind === "oauth2" && /* @__PURE__ */ b("button", {
1120
1198
  type: "button",
1121
1199
  disabled: e.pending,
1122
1200
  onClick: () => {
1123
1201
  e.connect();
1124
1202
  },
1125
- children: l.reconnect
1126
- }), /* @__PURE__ */ o("button", {
1203
+ children: a.reconnect
1204
+ }), /* @__PURE__ */ b("button", {
1127
1205
  type: "button",
1128
1206
  disabled: e.pending,
1129
1207
  onClick: () => {
1130
1208
  e.disconnect();
1131
1209
  },
1132
- children: l.disconnect
1133
- })] }) : e.kind === "oauth2" ? /* @__PURE__ */ o("button", {
1210
+ children: a.disconnect
1211
+ })] }) : e.kind === "oauth2" ? /* @__PURE__ */ b("button", {
1134
1212
  type: "button",
1135
1213
  disabled: e.pending,
1136
1214
  onClick: () => {
1137
1215
  e.connect();
1138
1216
  },
1139
- children: l.connect(e.label)
1140
- }) : /* @__PURE__ */ s("form", {
1217
+ children: a.connect(e.label)
1218
+ }) : /* @__PURE__ */ x("form", {
1141
1219
  onSubmit: (e) => {
1142
- f(e);
1220
+ l(e);
1143
1221
  },
1144
1222
  children: [
1145
- /* @__PURE__ */ o("label", {
1223
+ /* @__PURE__ */ b("label", {
1146
1224
  htmlFor: `voltro-connect-${e.connectionId}`,
1147
- children: l.tokenLabel(e.label)
1225
+ children: a.tokenLabel(e.label)
1148
1226
  }),
1149
- /* @__PURE__ */ o("input", {
1227
+ /* @__PURE__ */ b("input", {
1150
1228
  id: `voltro-connect-${e.connectionId}`,
1151
1229
  type: "password",
1152
1230
  autoComplete: "off",
1153
- value: u,
1154
- placeholder: l.tokenPlaceholder,
1231
+ value: o,
1232
+ placeholder: a.tokenPlaceholder,
1155
1233
  onChange: (e) => {
1156
- d(e.target.value);
1234
+ c(e.target.value);
1157
1235
  }
1158
1236
  }),
1159
- /* @__PURE__ */ o("button", {
1237
+ /* @__PURE__ */ b("button", {
1160
1238
  type: "submit",
1161
- disabled: e.pending || u.trim() === "",
1162
- children: l.save
1239
+ disabled: e.pending || o.trim() === "",
1240
+ children: a.save
1163
1241
  }),
1164
- t !== void 0 && /* @__PURE__ */ o("a", {
1242
+ t !== void 0 && /* @__PURE__ */ b("a", {
1165
1243
  href: t,
1166
1244
  target: "_blank",
1167
1245
  rel: "noreferrer noopener",
1168
- children: l.howToGetToken
1246
+ children: a.howToGetToken
1169
1247
  })
1170
1248
  ]
1171
1249
  })]
1172
1250
  });
1173
1251
  }, $ = (e) => [...e.matchAll(/@([\w.-]+)/g)].map((e) => e[1]);
1174
- function Be({ comment: e, onReact: t, onRemove: n, onEdit: r }) {
1175
- let a = P().comments, [c, l] = i(!1), [u, d] = i(e.body);
1176
- return /* @__PURE__ */ s("li", {
1252
+ function $e({ comment: e, onReact: t, onRemove: n, onEdit: r }) {
1253
+ let i = z().comments, [a, o] = s(!1), [c, l] = s(e.body);
1254
+ return /* @__PURE__ */ x("li", {
1177
1255
  "data-comment": e.id,
1178
1256
  "data-author": e.authorSubjectId,
1179
1257
  children: [
1180
- /* @__PURE__ */ o("span", {
1258
+ /* @__PURE__ */ b("span", {
1181
1259
  "data-comment-author": !0,
1182
1260
  children: e.authorSubjectId
1183
1261
  }),
1184
- c ? /* @__PURE__ */ s("form", {
1262
+ a ? /* @__PURE__ */ x("form", {
1185
1263
  "data-comment-edit": !0,
1186
1264
  onSubmit: (e) => {
1187
- e.preventDefault(), r(u), l(!1);
1265
+ e.preventDefault(), r(c), o(!1);
1188
1266
  },
1189
- children: [/* @__PURE__ */ o("input", {
1190
- value: u,
1191
- onChange: (e) => d(e.target.value),
1192
- "aria-label": a.editLabel
1193
- }), /* @__PURE__ */ o("button", {
1267
+ children: [/* @__PURE__ */ b("input", {
1268
+ value: c,
1269
+ onChange: (e) => l(e.target.value),
1270
+ "aria-label": i.editLabel
1271
+ }), /* @__PURE__ */ b("button", {
1194
1272
  type: "submit",
1195
- children: a.save
1273
+ children: i.save
1196
1274
  })]
1197
- }) : /* @__PURE__ */ s("p", {
1275
+ }) : /* @__PURE__ */ x("p", {
1198
1276
  "data-comment-body": !0,
1199
- children: [e.body, e.editedAt ? /* @__PURE__ */ s("em", {
1277
+ children: [e.body, e.editedAt ? /* @__PURE__ */ x("em", {
1200
1278
  "data-comment-edited": !0,
1201
1279
  children: [
1202
1280
  " (",
1203
- a.edited,
1281
+ i.edited,
1204
1282
  ")"
1205
1283
  ]
1206
1284
  }) : null]
1207
1285
  }),
1208
- /* @__PURE__ */ s("span", {
1286
+ /* @__PURE__ */ x("span", {
1209
1287
  "data-comment-reactions": !0,
1210
- children: [e.reactions.map((e) => /* @__PURE__ */ s("button", {
1288
+ children: [e.reactions.map((e) => /* @__PURE__ */ x("button", {
1211
1289
  type: "button",
1212
1290
  "data-reaction": e.emoji,
1213
1291
  "data-mine": e.mine || void 0,
@@ -1217,49 +1295,49 @@ function Be({ comment: e, onReact: t, onRemove: n, onEdit: r }) {
1217
1295
  " ",
1218
1296
  e.count
1219
1297
  ]
1220
- }, e.emoji)), /* @__PURE__ */ o("button", {
1298
+ }, e.emoji)), /* @__PURE__ */ b("button", {
1221
1299
  type: "button",
1222
1300
  "data-reaction-add": !0,
1223
1301
  onClick: () => t("👍"),
1224
- "aria-label": a.react,
1302
+ "aria-label": i.react,
1225
1303
  children: "+👍"
1226
1304
  })]
1227
1305
  }),
1228
- /* @__PURE__ */ s("span", {
1306
+ /* @__PURE__ */ x("span", {
1229
1307
  "data-comment-actions": !0,
1230
- children: [/* @__PURE__ */ o("button", {
1308
+ children: [/* @__PURE__ */ b("button", {
1231
1309
  type: "button",
1232
- onClick: () => l((e) => !e),
1233
- children: a.edit
1234
- }), /* @__PURE__ */ o("button", {
1310
+ onClick: () => o((e) => !e),
1311
+ children: i.edit
1312
+ }), /* @__PURE__ */ b("button", {
1235
1313
  type: "button",
1236
1314
  onClick: n,
1237
- children: a.remove
1315
+ children: i.remove
1238
1316
  })]
1239
1317
  })
1240
1318
  ]
1241
1319
  });
1242
1320
  }
1243
- function Ve({ thread: e, api: t }) {
1244
- let n = P().comments, [r, a] = i("");
1245
- return /* @__PURE__ */ s("section", {
1321
+ function et({ thread: e, api: t }) {
1322
+ let n = z().comments, [r, i] = s("");
1323
+ return /* @__PURE__ */ x("section", {
1246
1324
  "data-thread": e.id,
1247
1325
  "data-status": e.status,
1248
1326
  children: [
1249
- /* @__PURE__ */ s("header", {
1327
+ /* @__PURE__ */ x("header", {
1250
1328
  "data-thread-header": !0,
1251
1329
  children: [
1252
- e.unreadCount > 0 ? /* @__PURE__ */ o("span", {
1330
+ e.unreadCount > 0 ? /* @__PURE__ */ b("span", {
1253
1331
  "data-thread-unread": !0,
1254
1332
  children: e.unreadCount
1255
1333
  }) : null,
1256
- /* @__PURE__ */ o("button", {
1334
+ /* @__PURE__ */ b("button", {
1257
1335
  type: "button",
1258
1336
  "data-thread-resolve": !0,
1259
1337
  onClick: () => void t.resolve(e.id, e.status !== "resolved"),
1260
1338
  children: e.status === "resolved" ? n.reopen : n.resolve
1261
1339
  }),
1262
- /* @__PURE__ */ o("button", {
1340
+ /* @__PURE__ */ b("button", {
1263
1341
  type: "button",
1264
1342
  "data-thread-markread": !0,
1265
1343
  onClick: () => void t.markRead(e.id),
@@ -1267,29 +1345,29 @@ function Ve({ thread: e, api: t }) {
1267
1345
  })
1268
1346
  ]
1269
1347
  }),
1270
- /* @__PURE__ */ o("ul", {
1348
+ /* @__PURE__ */ b("ul", {
1271
1349
  "data-thread-comments": !0,
1272
- children: e.comments.map((e) => /* @__PURE__ */ o(Be, {
1350
+ children: e.comments.map((e) => /* @__PURE__ */ b($e, {
1273
1351
  comment: e,
1274
1352
  onReact: (n) => void t.react(e.id, n),
1275
1353
  onRemove: () => void t.remove(e.id),
1276
1354
  onEdit: (n) => void t.edit(e.id, n)
1277
1355
  }, e.id))
1278
1356
  }),
1279
- /* @__PURE__ */ s("form", {
1357
+ /* @__PURE__ */ x("form", {
1280
1358
  "data-thread-reply": !0,
1281
1359
  onSubmit: (n) => {
1282
1360
  n.preventDefault(), r.trim() !== "" && (t.create(r, {
1283
1361
  threadId: e.id,
1284
1362
  mentions: $(r)
1285
- }), a(""));
1363
+ }), i(""));
1286
1364
  },
1287
- children: [/* @__PURE__ */ o("input", {
1365
+ children: [/* @__PURE__ */ b("input", {
1288
1366
  value: r,
1289
- onChange: (e) => a(e.target.value),
1367
+ onChange: (e) => i(e.target.value),
1290
1368
  placeholder: n.replyPlaceholder,
1291
1369
  "aria-label": n.replyLabel
1292
- }), /* @__PURE__ */ o("button", {
1370
+ }), /* @__PURE__ */ b("button", {
1293
1371
  type: "submit",
1294
1372
  children: n.reply
1295
1373
  })]
@@ -1297,25 +1375,25 @@ function Ve({ thread: e, api: t }) {
1297
1375
  ]
1298
1376
  });
1299
1377
  }
1300
- function He({ anchor: e, api: t = "app" }) {
1301
- let n = P().comments, r = ae(e, t), [a, c] = i("");
1302
- return /* @__PURE__ */ s("div", {
1378
+ function tt({ anchor: e, api: t = "app" }) {
1379
+ let n = z().comments, r = ue(e, t), [i, a] = s("");
1380
+ return /* @__PURE__ */ x("div", {
1303
1381
  "data-comments": !0,
1304
1382
  "data-anchor": e,
1305
- children: [r.threads.map((e) => /* @__PURE__ */ o(Ve, {
1383
+ children: [r.threads.map((e) => /* @__PURE__ */ b(et, {
1306
1384
  thread: e,
1307
1385
  api: r
1308
- }, e.id)), /* @__PURE__ */ s("form", {
1386
+ }, e.id)), /* @__PURE__ */ x("form", {
1309
1387
  "data-comments-new": !0,
1310
1388
  onSubmit: (e) => {
1311
- e.preventDefault(), a.trim() !== "" && (r.create(a, { mentions: $(a) }), c(""));
1389
+ e.preventDefault(), i.trim() !== "" && (r.create(i, { mentions: $(i) }), a(""));
1312
1390
  },
1313
- children: [/* @__PURE__ */ o("input", {
1314
- value: a,
1315
- onChange: (e) => c(e.target.value),
1391
+ children: [/* @__PURE__ */ b("input", {
1392
+ value: i,
1393
+ onChange: (e) => a(e.target.value),
1316
1394
  placeholder: n.newPlaceholder,
1317
1395
  "aria-label": n.newLabel
1318
- }), /* @__PURE__ */ o("button", {
1396
+ }), /* @__PURE__ */ b("button", {
1319
1397
  type: "submit",
1320
1398
  children: n.comment
1321
1399
  })]
@@ -1323,4 +1401,4 @@ function He({ anchor: e, api: t = "app" }) {
1323
1401
  });
1324
1402
  }
1325
1403
  //#endregion
1326
- export { W as AgentChat, U as AgentMessageView, H as AgentPartView, De as AgentStream, Oe as AppAgent, Ce as ApprovalControls, F as AsyncSelect, he as AutoForm, He as CommentsThread, Q as ConnectAccount, ze as ConnectAccountFor, je as DataCopilot, G as DataCopilotAnswer, Me as DataCopilotStream, ye as DataTable, Te as EditingIndicator, j as Field, Ne as FormSkeleton, we as PresenceAvatars, J as QueryFilters, Le as RecordView, Pe as TableSkeleton, _e as UiStringsProvider, fe as WidgetRegistryProvider, xe as WorkflowProgress, Se as WorkflowStatusBadge, M as defaultUiStrings, D as defaultWidgets, z as initials, B as summarizeEditors, P as useUiStrings, k as useWidget };
1404
+ export { q as AgentChat, K as AgentMessageView, G as AgentPartView, Le as AgentStream, Re as AppAgent, Ne as ApprovalControls, Ee as AsyncSelect, Ce as AutoForm, tt as CommentsThread, Qe as ConnectAccount, Ze as ConnectAccountFor, Ve as DataCopilot, J as DataCopilotAnswer, He as DataCopilotStream, ke as DataTable, Fe as EditingIndicator, I as Field, Ue as FormSkeleton, Pe as PresenceAvatars, Ke as QueryFilters, Ye as RecordView, pe as RichTextView, C as RichTextWidget, We as TableSkeleton, Te as UiStringsProvider, be as WidgetRegistryProvider, je as WorkflowProgress, Me as WorkflowStatusBadge, L as defaultUiStrings, M as defaultWidgets, H as initials, U as summarizeEditors, z as useUiStrings, P as useWidget };