@restio/ui 0.2.1-20261007123729 → 0.2.1-20261117141230

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.
@@ -1,11 +1,15 @@
1
- import { A as Ie, B as fe, Bt as Ee, D as Pe, E as xe, Et as ge, Ft as ue, Ht as Z, I as Fe, It as Oe, Jt as Be, Lt as Te, N as Ae, O as pe, Pt as $e, Rt as _e, T as Le, Wt as te, Y as Ge, Yt as He, f as Ve, jt as me, mt as ke, nt as Ye, pt as qe, q as Ke, qt as ve, rt as Ne, u as Xe, w as Je, wt as Qe, z as Ze } from "./src-Bzrq1hWW.js";
2
- import { useCallback as y, useEffect as se, useMemo as X, useRef as ie, useState as D } from "react";
1
+ import { A as Ie, B as fe, Bt as Ee, D as Pe, E as xe, Et as ge, Ft as ce, Ht as Q, I as Fe, It as Oe, Jt as Be, Lt as Te, N as Ae, O as pe, Pt as $e, Rt as _e, T as Le, Wt as se, Y as Ge, Yt as He, f as Ve, jt as be, mt as ke, nt as Ye, pt as qe, q as Ke, qt as ve, rt as Ne, u as Xe, w as Je, wt as Qe, z as Ze } from "./src-C5tNrBNS.js";
2
+ import { useCallback as j, useEffect as te, useMemo as X, useRef as ne, useState as z } from "react";
3
3
  import { createPortal as Ue } from "react-dom";
4
- var er = { "rst-pip-container": "_rst-pip-container_63eby_1" }, e = Be(), kr = ({ pipWindow: r, className: a, children: i, ...s }) => r ? Ue(/* @__PURE__ */ (0, e.jsx)("div", {
5
- className: [er["rst-pip-container"], a].filter(Boolean).join(" "),
6
- ...s,
7
- children: i
8
- }), r.document.body) : null;
4
+ var er = { "rst-pip-container": "_rst-pip-container_63eby_1" }, e = Be(), kr = ({ pipWindow: r, className: a, children: i, ...s }) => {
5
+ if (!r) return null;
6
+ const h = [er["rst-pip-container"], a].filter(Boolean).join(" ");
7
+ return Ue(/* @__PURE__ */ (0, e.jsx)("div", {
8
+ className: h,
9
+ ...s,
10
+ children: i
11
+ }), r.document.body);
12
+ };
9
13
  function Se() {
10
14
  return globalThis.documentPictureInPicture;
11
15
  }
@@ -17,7 +21,7 @@ function ar(r, a = document) {
17
21
  for (const { name: i, value: s } of Array.from(a.documentElement.attributes)) r.documentElement.setAttribute(i, s);
18
22
  for (const { name: i, value: s } of Array.from(a.body.attributes)) r.body.setAttribute(i, s);
19
23
  }
20
- function tr(r) {
24
+ function sr(r) {
21
25
  const a = r.createElement("style");
22
26
  a.textContent = [
23
27
  "html, body { height: 100%; margin: 0; }",
@@ -30,32 +34,32 @@ function tr(r) {
30
34
  `), r.head.appendChild(a);
31
35
  }
32
36
  function Nr({ width: r, height: a, copyStyles: i = !0 } = {}) {
33
- const [s, b] = D(null), [h, p] = D(null), j = ie(null), k = y(async () => {
34
- const f = Se();
35
- if (!(!f || j.current)) {
36
- p(null);
37
+ const [s, h] = z(null), [b, f] = z(null), w = ne(null), k = j(async () => {
38
+ const g = Se();
39
+ if (!(!g || w.current)) {
40
+ f(null);
37
41
  try {
38
- const g = await f.requestWindow({
42
+ const x = await g.requestWindow({
39
43
  width: r,
40
44
  height: a
41
45
  });
42
- j.current = g, i && ar(g.document), tr(g.document), g.addEventListener("pagehide", () => {
43
- j.current = null, b(null);
44
- }), b(g);
45
- } catch (g) {
46
- p(g instanceof Error ? `${g.name}: ${g.message}` : String(g));
46
+ w.current = x, i && ar(x.document), sr(x.document), x.addEventListener("pagehide", () => {
47
+ w.current = null, h(null);
48
+ }), h(x);
49
+ } catch (x) {
50
+ f(x instanceof Error ? `${x.name}: ${x.message}` : String(x));
47
51
  }
48
52
  }
49
53
  }, [
50
54
  r,
51
55
  a,
52
56
  i
53
- ]), c = y(() => {
54
- j.current?.close();
57
+ ]), c = j(() => {
58
+ w.current?.close();
55
59
  }, []);
56
- return se(() => () => j.current?.close(), []), {
60
+ return te(() => () => w.current?.close(), []), {
57
61
  pipWindow: s,
58
- error: h,
62
+ error: b,
59
63
  isOpen: s !== null,
60
64
  isSupported: rr(),
61
65
  open: k,
@@ -63,32 +67,32 @@ function Nr({ width: r, height: a, copyStyles: i = !0 } = {}) {
63
67
  };
64
68
  }
65
69
  var Sr = 1;
66
- function sr(r, a) {
67
- const i = r.col + r.w, s = r.row + r.h, b = a.col + a.w, h = a.row + a.h;
68
- return r.col < b && i > a.col && r.row < h && s > a.row;
70
+ function tr(r, a) {
71
+ const i = r.col + r.w, s = r.row + r.h, h = a.col + a.w, b = a.row + a.h;
72
+ return r.col < h && i > a.col && r.row < b && s > a.row;
69
73
  }
70
74
  function ye(r) {
71
75
  return r.col >= 1 && r.col + r.w - 1 <= 12 && r.row >= 1 && r.row + r.h - 1 <= 30;
72
76
  }
73
- function be(r, a, i) {
77
+ function he(r, a, i) {
74
78
  for (const s of a)
75
- if (s.id !== i && sr(r, s.position))
79
+ if (s.id !== i && tr(r, s.position))
76
80
  return s.id;
77
81
  return null;
78
82
  }
79
83
  function Me(r, a, i) {
80
- for (let h = 1; h <= 30 - a + 1; h++) for (let p = 1; p <= 12 - r + 1; p++) {
81
- const j = {
82
- col: p,
83
- row: h,
84
+ for (let b = 1; b <= 30 - a + 1; b++) for (let f = 1; f <= 12 - r + 1; f++) {
85
+ const w = {
86
+ col: f,
87
+ row: b,
84
88
  w: r,
85
89
  h: a
86
90
  };
87
- if (!be(j, i)) return j;
91
+ if (!he(w, i)) return w;
88
92
  }
89
93
  return {
90
94
  col: 1,
91
- row: i.reduce((h, p) => Math.max(h, p.position.row + p.position.h), 1),
95
+ row: i.reduce((b, f) => Math.max(b, f.position.row + f.position.h), 1),
92
96
  w: r,
93
97
  h: a
94
98
  };
@@ -96,11 +100,11 @@ function Me(r, a, i) {
96
100
  function dr(r, a) {
97
101
  const i = {};
98
102
  for (const s of r) {
99
- const b = a[s.dataSourceId];
100
- if (!b) continue;
101
- const h = b.data ?? [], p = ke(h.length > 0 ? Object.keys(h[0]) : []), j = Ne(s.columns ?? p), k = /* @__PURE__ */ new Set(), c = [];
102
- for (const f of j) k.has(f.id) || (k.add(f.id), c.push(f));
103
- i[s.dataSourceId] = c;
103
+ const h = a[s.dataSourceId];
104
+ if (!h) continue;
105
+ const b = h.data ?? [], f = b.length > 0 ? Object.keys(b[0]) : [], w = ke(f), k = s.columns ?? w, c = Ne(k), g = /* @__PURE__ */ new Set(), x = [];
106
+ for (const _ of c) g.has(_.id) || (g.add(_.id), x.push(_));
107
+ i[s.dataSourceId] = x;
104
108
  }
105
109
  return i;
106
110
  }
@@ -117,93 +121,93 @@ function Ce() {
117
121
  };
118
122
  }
119
123
  function ir(r, a) {
120
- const [i, s] = D(r ?? Ce), [b, h] = D(null), [p, j] = D(a ? "view" : "edit"), k = ie(!1), c = y(() => {
124
+ const [i, s] = z(r ?? Ce), [h, b] = z(null), [f, w] = z(a ? "view" : "edit"), k = ne(!1), c = j(() => {
121
125
  k.current = !0;
122
- }, []), f = y((u, x, W) => {
126
+ }, []), g = j((o, p, I) => {
123
127
  s((d) => {
124
128
  const C = {
125
129
  id: we(),
126
- title: `New ${u}`,
127
- componentType: u,
128
- dataSourceId: x,
129
- position: W
130
+ title: `New ${o}`,
131
+ componentType: o,
132
+ dataSourceId: p,
133
+ position: I
130
134
  };
131
135
  return {
132
136
  ...d,
133
137
  widgets: [...d.widgets, C]
134
138
  };
135
139
  }), c();
136
- }, [c]), g = y((u) => {
137
- s((x) => {
138
- const W = Me(6, 3, x.widgets), d = {
140
+ }, [c]), x = j((o) => {
141
+ s((p) => {
142
+ const I = Me(6, 3, p.widgets), d = {
139
143
  id: we(),
140
- position: W,
141
- ...u.widget
144
+ position: I,
145
+ ...o.widget
142
146
  };
143
147
  return {
144
- ...x,
145
- widgets: [...x.widgets, d]
148
+ ...p,
149
+ widgets: [...p.widgets, d]
146
150
  };
147
151
  }), c();
148
- }, [c]), w = y((u) => {
149
- s((x) => ({
150
- ...x,
151
- widgets: x.widgets.filter((W) => W.id !== u)
152
- })), h((x) => x === u ? null : x), c();
153
- }, [c]), R = y((u, x) => {
154
- s((W) => ({
155
- ...W,
156
- widgets: W.widgets.map((d) => {
157
- if (d.id !== u) return d;
152
+ }, [c]), _ = j((o) => {
153
+ s((p) => ({
154
+ ...p,
155
+ widgets: p.widgets.filter((I) => I.id !== o)
156
+ })), b((p) => p === o ? null : p), c();
157
+ }, [c]), W = j((o, p) => {
158
+ s((I) => ({
159
+ ...I,
160
+ widgets: I.widgets.map((d) => {
161
+ if (d.id !== o) return d;
158
162
  const C = {
159
163
  ...d,
160
- ...x
164
+ ...p
161
165
  };
162
- if (x.dataSourceId && x.dataSourceId !== d.dataSourceId) {
163
- const P = pe[d.componentType] ?? [];
164
- C.columns = void 0, C.componentProps = xe(P), C.filters = void 0, C.uiConfig = void 0;
166
+ if (p.dataSourceId && p.dataSourceId !== d.dataSourceId) {
167
+ const F = pe[d.componentType] ?? [];
168
+ C.columns = void 0, C.componentProps = xe(F), C.filters = void 0, C.uiConfig = void 0;
165
169
  }
166
170
  return C;
167
171
  })
168
172
  })), c();
169
- }, [c]), o = y((u, x) => {
170
- R(u, { position: x });
171
- }, [R]), E = y((u) => {
172
- h(u);
173
- }, []), L = i.widgets.find((u) => u.id === b) ?? null, O = y((u) => {
174
- s((x) => ({
175
- ...x,
176
- name: u
173
+ }, [c]), l = j((o, p) => {
174
+ W(o, { position: p });
175
+ }, [W]), P = j((o) => {
176
+ b(o);
177
+ }, []), L = i.widgets.find((o) => o.id === h) ?? null, B = j((o) => {
178
+ s((p) => ({
179
+ ...p,
180
+ name: o
177
181
  })), c();
178
- }, [c]), t = y((u) => {
179
- s((x) => ({
180
- ...x,
181
- filters: typeof u == "function" ? u(x.filters) : u
182
+ }, [c]), t = j((o) => {
183
+ s((p) => ({
184
+ ...p,
185
+ filters: typeof o == "function" ? o(p.filters) : o
182
186
  })), c();
183
- }, [c]), l = y((u) => {
184
- s(u ?? Ce()), h(null), k.current = !1;
185
- }, []), B = y((u) => {
186
- s(u), h(null), k.current = !1;
187
+ }, [c]), u = j((o) => {
188
+ s(o ?? Ce()), b(null), k.current = !1;
189
+ }, []), M = j((o) => {
190
+ s(o), b(null), k.current = !1;
187
191
  }, []);
188
192
  return {
189
193
  state: {
190
194
  config: i,
191
- selectedWidgetId: b,
195
+ selectedWidgetId: h,
192
196
  isDirty: k.current
193
197
  },
194
- mode: p,
195
- setMode: j,
196
- addWidget: f,
197
- addPrebuiltWidget: g,
198
- removeWidget: w,
199
- updateWidget: R,
200
- moveWidget: o,
201
- selectWidget: E,
198
+ mode: f,
199
+ setMode: w,
200
+ addWidget: g,
201
+ addPrebuiltWidget: x,
202
+ removeWidget: _,
203
+ updateWidget: W,
204
+ moveWidget: l,
205
+ selectWidget: P,
202
206
  selectedWidget: L,
203
- setName: O,
207
+ setName: B,
204
208
  setFilters: t,
205
- resetConfig: l,
206
- loadConfig: B
209
+ resetConfig: u,
210
+ loadConfig: M
207
211
  };
208
212
  }
209
213
  var n = {
@@ -263,141 +267,141 @@ var n = {
263
267
  "rst-dashboard-builder-template-item": "_rst-dashboard-builder-template-item_ukxxh_705",
264
268
  "rst-dashboard-builder-template-item-name": "_rst-dashboard-builder-template-item-name_ukxxh_727",
265
269
  "rst-dashboard-builder-template-item-desc": "_rst-dashboard-builder-template-item-desc_ukxxh_733"
266
- }, Q = 12, de = 30, oe = 12;
270
+ }, ee = 12, ie = 30, me = 12;
267
271
  function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
268
- const b = ie(null), [h, p] = D(null), [j, k] = D(null), [c, f] = D(null), [g, w] = D(null), [R, o] = D(!1), [E, L] = D(null), [O, t] = D(null), [l, B] = D(null), [u, x] = D(null), [W, d] = D(!1), C = y(() => b.current ? {
269
- colWidth: (b.current.getBoundingClientRect().width - oe * (Q - 1)) / Q,
272
+ const h = ne(null), [b, f] = z(null), [w, k] = z(null), [c, g] = z(null), [x, _] = z(null), [W, l] = z(!1), [P, L] = z(null), [B, t] = z(null), [u, M] = z(null), [o, p] = z(null), [I, d] = z(!1), C = j(() => h.current ? {
273
+ colWidth: (h.current.getBoundingClientRect().width - 132) / ee,
270
274
  rowHeight: 92
271
- } : null, []), P = y((v, N) => {
272
- if (!b.current) return {
275
+ } : null, []), F = j((y, N) => {
276
+ if (!h.current) return {
273
277
  col: 1,
274
278
  row: 1
275
279
  };
276
- const z = b.current.getBoundingClientRect(), M = (z.width - oe * (Q - 1)) / Q;
280
+ const R = h.current.getBoundingClientRect(), D = (R.width - 132) / ee;
277
281
  return {
278
- col: Math.max(1, Math.min(Q, Math.round((v - z.left) / (M + oe)) + 1)),
279
- row: Math.max(1, Math.min(de, Math.round((N - z.top) / 92) + 1))
282
+ col: Math.max(1, Math.min(ee, Math.round((y - R.left) / (D + me)) + 1)),
283
+ row: Math.max(1, Math.min(ie, Math.round((N - R.top) / 92) + 1))
280
284
  };
281
- }, []), U = y((v) => {
282
- if (v.preventDefault(), v.dataTransfer.types.includes("application/widget-type")) {
283
- v.dataTransfer.dropEffect = "copy";
285
+ }, []), Z = j((y) => {
286
+ if (y.preventDefault(), y.dataTransfer.types.includes("application/widget-type")) {
287
+ y.dataTransfer.dropEffect = "copy";
284
288
  return;
285
289
  }
286
- if (v.dataTransfer.types.includes("application/move-widget") && h && j && c) {
287
- v.dataTransfer.dropEffect = "move";
288
- const N = r.find((I) => I.id === h);
290
+ if (y.dataTransfer.types.includes("application/move-widget") && b && w && c) {
291
+ y.dataTransfer.dropEffect = "move";
292
+ const N = r.find((E) => E.id === b);
289
293
  if (!N) return;
290
- const z = C();
291
- if (!z) return;
292
- const M = v.clientX - j.x, G = v.clientY - j.y, ne = Math.round(M / (z.colWidth + oe)), Y = Math.round(G / z.rowHeight), H = {
293
- col: Math.max(1, Math.min(Q - N.position.w + 1, c.col + ne)),
294
- row: Math.max(1, Math.min(de - N.position.h + 1, c.row + Y)),
294
+ const R = C();
295
+ if (!R) return;
296
+ const D = y.clientX - w.x, G = y.clientY - w.y, oe = Math.round(D / (R.colWidth + me)), Y = Math.round(G / R.rowHeight), H = {
297
+ col: Math.max(1, Math.min(ee - N.position.w + 1, c.col + oe)),
298
+ row: Math.max(1, Math.min(ie - N.position.h + 1, c.row + Y)),
295
299
  w: N.position.w,
296
300
  h: N.position.h
297
301
  };
298
- w(H);
299
- const T = be(H, r, h);
300
- o(T !== null);
302
+ _(H);
303
+ const T = he(H, r, b);
304
+ l(T !== null);
301
305
  }
302
306
  }, [
303
- h,
304
- j,
307
+ b,
308
+ w,
305
309
  c,
306
310
  C,
307
311
  r
308
- ]), ee = y((v) => {
309
- v.preventDefault();
310
- const N = v.dataTransfer.getData("application/widget-type");
312
+ ]), U = j((y) => {
313
+ y.preventDefault();
314
+ const N = y.dataTransfer.getData("application/widget-type");
311
315
  if (N) {
312
- const { col: z, row: M } = P(v.clientX, v.clientY), G = {
313
- col: z,
314
- row: M,
316
+ const { col: R, row: D } = F(y.clientX, y.clientY), G = {
317
+ col: R,
318
+ row: D,
315
319
  w: 4,
316
320
  h: 3
317
321
  };
318
- if (z + 4 - 1 > Q && (G.col = 9), M + 3 - 1 > de && (G.row = 28), be(G, r)) return;
322
+ if (R + 4 - 1 > ee && (G.col = 9), D + 3 - 1 > ie && (G.row = 28), he(G, r)) return;
319
323
  i(N, "", G), s();
320
324
  return;
321
325
  }
322
- h && g && (!R && ye(g) && (a(h, g), s()), p(null), k(null), f(null), w(null), o(!1));
326
+ b && x && (!W && ye(x) && (a(b, x), s()), f(null), k(null), g(null), _(null), l(!1));
323
327
  }, [
324
- P,
328
+ F,
325
329
  r,
326
330
  i,
327
331
  s,
328
- h,
329
- g,
330
- R,
332
+ b,
333
+ x,
334
+ W,
331
335
  a
332
- ]), re = y((v, N) => {
333
- v.stopPropagation(), v.dataTransfer.setData("application/move-widget", N.id), v.dataTransfer.effectAllowed = "move", p(N.id), k({
334
- x: v.clientX,
335
- y: v.clientY
336
- }), f({ ...N.position }), w({ ...N.position }), o(!1);
337
- }, []), _ = y(() => {
338
- p(null), k(null), f(null), w(null), o(!1);
339
- }, []), le = y((v, N, z) => {
340
- v.stopPropagation(), v.preventDefault(), L(N.id), t(z), B({ ...N.position }), x({
341
- x: v.clientX,
342
- y: v.clientY
336
+ ]), re = j((y, N) => {
337
+ y.stopPropagation(), y.dataTransfer.setData("application/move-widget", N.id), y.dataTransfer.effectAllowed = "move", f(N.id), k({
338
+ x: y.clientX,
339
+ y: y.clientY
340
+ }), g({ ...N.position }), _({ ...N.position }), l(!1);
341
+ }, []), de = j(() => {
342
+ f(null), k(null), g(null), _(null), l(!1);
343
+ }, []), v = j((y, N, R) => {
344
+ y.stopPropagation(), y.preventDefault(), L(N.id), t(R), M({ ...N.position }), p({
345
+ x: y.clientX,
346
+ y: y.clientY
343
347
  }), d(!1);
344
348
  }, []);
345
- return se(() => {
346
- if (!E || !O || !l || !u) return;
347
- const v = (z) => {
348
- if (!r.find((S) => S.id === E)) return;
349
- const M = C();
350
- if (!M) return;
351
- const G = z.clientX - u.x, ne = z.clientY - u.y, Y = Math.round(G / (M.colWidth + oe)), H = Math.round(ne / M.rowHeight), T = l.col, I = l.row, q = l.w, K = l.h;
352
- let F = { ...l };
353
- switch (O) {
349
+ return te(() => {
350
+ if (!P || !B || !u || !o) return;
351
+ const y = (R) => {
352
+ if (!r.find((S) => S.id === P)) return;
353
+ const D = C();
354
+ if (!D) return;
355
+ const G = R.clientX - o.x, oe = R.clientY - o.y, Y = Math.round(G / (D.colWidth + me)), H = Math.round(oe / D.rowHeight), T = u.col, E = u.row, q = u.w, K = u.h;
356
+ let O = { ...u };
357
+ switch (B) {
354
358
  case "e": {
355
- const S = Math.max(1, Math.min(Q - T + 1, q + Y));
356
- F = {
357
- ...F,
359
+ const S = Math.max(1, Math.min(ee - T + 1, q + Y));
360
+ O = {
361
+ ...O,
358
362
  w: S
359
363
  };
360
364
  break;
361
365
  }
362
366
  case "w": {
363
367
  const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = T + q - S;
364
- F = {
365
- ...l,
368
+ O = {
369
+ ...u,
366
370
  col: S,
367
371
  w: Math.max(1, A)
368
372
  };
369
373
  break;
370
374
  }
371
375
  case "s": {
372
- const S = Math.max(1, Math.min(de - I + 1, K + H));
373
- F = {
374
- ...l,
376
+ const S = Math.max(1, Math.min(ie - E + 1, K + H));
377
+ O = {
378
+ ...u,
375
379
  h: S
376
380
  };
377
381
  break;
378
382
  }
379
383
  case "n": {
380
- const S = Math.max(1, Math.min(I + K - 1, I + H)), A = I + K - S;
381
- F = {
382
- ...l,
384
+ const S = Math.max(1, Math.min(E + K - 1, E + H)), A = E + K - S;
385
+ O = {
386
+ ...u,
383
387
  row: S,
384
388
  h: Math.max(1, A)
385
389
  };
386
390
  break;
387
391
  }
388
392
  case "se": {
389
- const S = Math.max(1, Math.min(Q - T + 1, q + Y)), A = Math.max(1, Math.min(de - I + 1, K + H));
390
- F = {
391
- ...l,
393
+ const S = Math.max(1, Math.min(ee - T + 1, q + Y)), A = Math.max(1, Math.min(ie - E + 1, K + H));
394
+ O = {
395
+ ...u,
392
396
  w: S,
393
397
  h: A
394
398
  };
395
399
  break;
396
400
  }
397
401
  case "sw": {
398
- const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = T + q - S, m = Math.max(1, Math.min(de - I + 1, K + H));
399
- F = {
400
- ...l,
402
+ const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = T + q - S, m = Math.max(1, Math.min(ie - E + 1, K + H));
403
+ O = {
404
+ ...u,
401
405
  col: S,
402
406
  w: Math.max(1, A),
403
407
  h: m
@@ -405,9 +409,9 @@ function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
405
409
  break;
406
410
  }
407
411
  case "ne": {
408
- const S = Math.max(1, Math.min(I + K - 1, I + H)), A = I + K - S, m = Math.max(1, Math.min(Q - T + 1, q + Y));
409
- F = {
410
- ...l,
412
+ const S = Math.max(1, Math.min(E + K - 1, E + H)), A = E + K - S, m = Math.max(1, Math.min(ee - T + 1, q + Y));
413
+ O = {
414
+ ...u,
411
415
  row: S,
412
416
  h: Math.max(1, A),
413
417
  w: m
@@ -415,8 +419,8 @@ function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
415
419
  break;
416
420
  }
417
421
  case "nw": {
418
- const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = Math.max(1, Math.min(I + K - 1, I + H)), m = T + q - S, $ = I + K - A;
419
- F = {
422
+ const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = Math.max(1, Math.min(E + K - 1, E + H)), m = T + q - S, $ = E + K - A;
423
+ O = {
420
424
  col: S,
421
425
  row: A,
422
426
  w: Math.max(1, m),
@@ -425,61 +429,61 @@ function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
425
429
  break;
426
430
  }
427
431
  }
428
- w(F), p(E);
429
- const ce = be(F, r, E);
430
- d(ce !== null), o(ce !== null);
432
+ _(O), f(P);
433
+ const le = he(O, r, P);
434
+ d(le !== null), l(le !== null);
431
435
  }, N = () => {
432
- r.find((z) => z.id === E) && g && !W && ye(g) && (a(E, g), s()), L(null), t(null), B(null), x(null), d(!1), p(null), k(null), f(null), w(null), o(!1);
436
+ r.find((R) => R.id === P) && x && !I && ye(x) && (a(P, x), s()), L(null), t(null), M(null), p(null), d(!1), f(null), k(null), g(null), _(null), l(!1);
433
437
  };
434
- return document.addEventListener("mousemove", v), document.addEventListener("mouseup", N), () => {
435
- document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", N);
438
+ return document.addEventListener("mousemove", y), document.addEventListener("mouseup", N), () => {
439
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", N);
436
440
  };
437
441
  }, [
438
- E,
439
- O,
440
- l,
442
+ P,
443
+ B,
441
444
  u,
445
+ o,
442
446
  r,
443
- g,
444
- W,
447
+ x,
448
+ I,
445
449
  C,
446
450
  a,
447
451
  s
448
452
  ]), {
449
- gridRef: b,
450
- draggingWidgetId: h,
451
- dragPreviewPos: g,
452
- hasCollision: R,
453
- resizeCollision: W,
454
- handleDragOver: U,
455
- handleDrop: ee,
453
+ gridRef: h,
454
+ draggingWidgetId: b,
455
+ dragPreviewPos: x,
456
+ hasCollision: W,
457
+ resizeCollision: I,
458
+ handleDragOver: Z,
459
+ handleDrop: U,
456
460
  handleWidgetDragStart: re,
457
- handleWidgetDragEnd: _,
458
- handleResizeStart: le,
459
- pixelToGrid: P
461
+ handleWidgetDragEnd: de,
462
+ handleResizeStart: v,
463
+ pixelToGrid: F
460
464
  };
461
465
  }
462
- var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, onSelectWidget: s, onMoveWidget: b, onRemoveWidget: h, onAddWidget: p, onChange: j, getWidgetActions: k, mode: c = "edit" }) => {
463
- const f = c === "view", { gridRef: g, draggingWidgetId: w, dragPreviewPos: R, hasCollision: o, handleDragOver: E, handleDrop: L, handleWidgetDragStart: O, handleWidgetDragEnd: t, handleResizeStart: l } = nr({
466
+ var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, onSelectWidget: s, onMoveWidget: h, onRemoveWidget: b, onAddWidget: f, onChange: w, getWidgetActions: k, mode: c = "edit" }) => {
467
+ const g = c === "view", { gridRef: x, draggingWidgetId: _, dragPreviewPos: W, hasCollision: l, handleDragOver: P, handleDrop: L, handleWidgetDragStart: B, handleWidgetDragEnd: t, handleResizeStart: u } = nr({
464
468
  widgets: r,
465
- onMoveWidget: b,
466
- onAddWidget: p,
467
- onChange: j
468
- }), B = y((d, C) => {
469
+ onMoveWidget: h,
470
+ onAddWidget: f,
471
+ onChange: w
472
+ }), M = j((d, C) => {
469
473
  d.stopPropagation(), s(C);
470
- }, [s]), u = y(() => {
474
+ }, [s]), o = j(() => {
471
475
  s(null);
472
- }, [s]), x = y((d) => {
473
- const C = i[d.dataSourceId]?.data ?? [], P = C.length > 0 ? Object.keys(C[0]) : [];
476
+ }, [s]), p = j((d) => {
477
+ const C = i[d.dataSourceId]?.data ?? [], F = C.length > 0 ? Object.keys(C[0]) : [];
474
478
  return {
475
479
  data: C,
476
- columns: d.columns ?? ke(P)
480
+ columns: d.columns ?? ke(F)
477
481
  };
478
- }, [i]), W = [];
482
+ }, [i]), I = [];
479
483
  for (let d = 1; d <= lr; d++) for (let C = 1; C <= or; C++) {
480
- const P = f ? n["rst-dashboard-builder-grid-cell-view"] : n["rst-dashboard-builder-grid-cell"];
481
- W.push(/* @__PURE__ */ (0, e.jsx)("div", {
482
- className: P,
484
+ const F = g ? n["rst-dashboard-builder-grid-cell-view"] : n["rst-dashboard-builder-grid-cell"];
485
+ I.push(/* @__PURE__ */ (0, e.jsx)("div", {
486
+ className: F,
483
487
  style: {
484
488
  gridColumn: C,
485
489
  gridRow: d
@@ -488,42 +492,42 @@ var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, o
488
492
  }
489
493
  return /* @__PURE__ */ (0, e.jsx)("div", {
490
494
  className: n["rst-dashboard-builder-canvas"],
491
- onClick: u,
495
+ onClick: o,
492
496
  children: /* @__PURE__ */ (0, e.jsxs)("div", {
493
- ref: g,
497
+ ref: x,
494
498
  className: n["rst-dashboard-builder-grid"],
495
- onDragOver: E,
499
+ onDragOver: P,
496
500
  onDrop: L,
497
501
  children: [
498
- W,
502
+ I,
499
503
  r.length === 0 && /* @__PURE__ */ (0, e.jsx)("div", {
500
504
  className: n["rst-dashboard-builder-grid-empty"],
501
505
  children: "Drag a widget from the palette to get started"
502
506
  }),
503
507
  r.map((d) => {
504
- const C = !f && d.id === a, P = !f && d.id === w, U = x(d), ee = P && R ? R : d.position, re = P && o;
508
+ const C = !g && d.id === a, F = !g && d.id === _, Z = p(d), U = F && W ? W : d.position, re = F && l, de = [
509
+ n["rst-dashboard-builder-widget"],
510
+ g ? n["rst-dashboard-builder-widget-view"] : "",
511
+ C ? n["rst-dashboard-builder-widget-selected"] : "",
512
+ F ? n["rst-dashboard-builder-widget-dragging"] : "",
513
+ re ? n["rst-dashboard-builder-widget-collision"] : ""
514
+ ].filter(Boolean).join(" ");
505
515
  return /* @__PURE__ */ (0, e.jsxs)("div", {
506
- className: [
507
- n["rst-dashboard-builder-widget"],
508
- f ? n["rst-dashboard-builder-widget-view"] : "",
509
- C ? n["rst-dashboard-builder-widget-selected"] : "",
510
- P ? n["rst-dashboard-builder-widget-dragging"] : "",
511
- re ? n["rst-dashboard-builder-widget-collision"] : ""
512
- ].filter(Boolean).join(" "),
516
+ className: de,
513
517
  style: {
514
- gridColumn: `${ee.col} / span ${ee.w}`,
515
- gridRow: `${ee.row} / span ${ee.h}`
518
+ gridColumn: `${U.col} / span ${U.w}`,
519
+ gridRow: `${U.row} / span ${U.h}`
516
520
  },
517
- draggable: !f,
518
- ...f ? {} : {
519
- onDragStart: (_) => O(_, d),
521
+ draggable: !g,
522
+ ...g ? {} : {
523
+ onDragStart: (v) => B(v, d),
520
524
  onDragEnd: t,
521
- onClick: (_) => B(_, d.id),
525
+ onClick: (v) => M(v, d.id),
522
526
  role: "button",
523
527
  tabIndex: 0,
524
528
  "aria-label": `Widget: ${d.title}`,
525
- onKeyDown: (_) => {
526
- (_.key === "Enter" || _.key === " ") && (_.preventDefault(), s(d.id)), (_.key === "Delete" || _.key === "Backspace") && (_.preventDefault(), h(d.id), j());
529
+ onKeyDown: (v) => {
530
+ (v.key === "Enter" || v.key === " ") && (v.preventDefault(), s(d.id)), (v.key === "Delete" || v.key === "Backspace") && (v.preventDefault(), b(d.id), w());
527
531
  }
528
532
  },
529
533
  children: [/* @__PURE__ */ (0, e.jsx)(Xe, {
@@ -532,52 +536,52 @@ var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, o
532
536
  title: d.title,
533
537
  subtitle: d.subtitle,
534
538
  icon: d.icon,
535
- data: U.data,
536
- columns: U.columns,
539
+ data: Z.data,
540
+ columns: Z.columns,
537
541
  enableExport: k?.(d).enableExport ?? !0,
538
542
  enableScreenshot: k?.(d).enableScreenshot ?? !1,
539
543
  enableExpand: k?.(d).enableExpand ?? !0,
540
544
  enableFilter: k?.(d).enableFilter ?? !1,
541
- fieldOptions: Ne(U.columns),
542
- children: ({ data: _ }) => /* @__PURE__ */ (0, e.jsx)(Je, {
543
- data: _,
544
- columns: U.columns,
545
+ fieldOptions: Ne(Z.columns),
546
+ children: ({ data: v }) => /* @__PURE__ */ (0, e.jsx)(Je, {
547
+ data: v,
548
+ columns: Z.columns,
545
549
  activeComponent: d.componentType,
546
550
  componentProps: d.componentProps,
547
551
  showConfigurator: !1
548
552
  })
549
- }), !f && C && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [
553
+ }), !g && C && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [
550
554
  /* @__PURE__ */ (0, e.jsx)("div", {
551
555
  className: n["rst-dashboard-builder-resize-handle-n"],
552
- onMouseDown: (_) => l(_, d, "n")
556
+ onMouseDown: (v) => u(v, d, "n")
553
557
  }),
554
558
  /* @__PURE__ */ (0, e.jsx)("div", {
555
559
  className: n["rst-dashboard-builder-resize-handle-s"],
556
- onMouseDown: (_) => l(_, d, "s")
560
+ onMouseDown: (v) => u(v, d, "s")
557
561
  }),
558
562
  /* @__PURE__ */ (0, e.jsx)("div", {
559
563
  className: n["rst-dashboard-builder-resize-handle-e"],
560
- onMouseDown: (_) => l(_, d, "e")
564
+ onMouseDown: (v) => u(v, d, "e")
561
565
  }),
562
566
  /* @__PURE__ */ (0, e.jsx)("div", {
563
567
  className: n["rst-dashboard-builder-resize-handle-w"],
564
- onMouseDown: (_) => l(_, d, "w")
568
+ onMouseDown: (v) => u(v, d, "w")
565
569
  }),
566
570
  /* @__PURE__ */ (0, e.jsx)("div", {
567
571
  className: n["rst-dashboard-builder-resize-handle-ne"],
568
- onMouseDown: (_) => l(_, d, "ne")
572
+ onMouseDown: (v) => u(v, d, "ne")
569
573
  }),
570
574
  /* @__PURE__ */ (0, e.jsx)("div", {
571
575
  className: n["rst-dashboard-builder-resize-handle-nw"],
572
- onMouseDown: (_) => l(_, d, "nw")
576
+ onMouseDown: (v) => u(v, d, "nw")
573
577
  }),
574
578
  /* @__PURE__ */ (0, e.jsx)("div", {
575
579
  className: n["rst-dashboard-builder-resize-handle-se"],
576
- onMouseDown: (_) => l(_, d, "se")
580
+ onMouseDown: (v) => u(v, d, "se")
577
581
  }),
578
582
  /* @__PURE__ */ (0, e.jsx)("div", {
579
583
  className: n["rst-dashboard-builder-resize-handle-sw"],
580
- onMouseDown: (_) => l(_, d, "sw")
584
+ onMouseDown: (v) => u(v, d, "sw")
581
585
  })
582
586
  ] })]
583
587
  }, `${d.id}::${d.dataSourceId}`);
@@ -630,7 +634,7 @@ var cr = [
630
634
  icon: "chart",
631
635
  description: "Single-metric KPI card"
632
636
  }
633
- ], ze = ({ widget: r, dataSources: a, onUpdate: i, onRemove: s, onClose: b, onAddWidget: h, prebuiltSections: p, onAddPrebuiltSection: j }) => {
637
+ ], ze = ({ widget: r, dataSources: a, onUpdate: i, onRemove: s, onClose: h, onAddWidget: b, prebuiltSections: f, onAddPrebuiltSection: w }) => {
634
638
  const k = Object.values(a).map((t) => ({
635
639
  value: t.id,
636
640
  label: t.name
@@ -640,40 +644,41 @@ var cr = [
640
644
  }, ...Object.keys(He).map((t) => ({
641
645
  value: t,
642
646
  leadingVisual: t
643
- }))], []), f = r?.dataSourceId, g = X(() => {
644
- if (!f) return [];
645
- const t = a[f];
646
- return t ? t.fields.map((l) => ({
647
- id: l.id,
648
- header: l.name,
649
- accessorKey: l.id
647
+ }))], []), g = r?.dataSourceId, x = X(() => {
648
+ if (!g) return [];
649
+ const t = a[g];
650
+ return t ? t.fields.map((u) => ({
651
+ id: u.id,
652
+ header: u.name,
653
+ accessorKey: u.id
650
654
  })) : [];
651
- }, [f, a]), w = X(() => pe[r?.componentType ?? "table-grid"] ?? [], [r?.componentType]), R = X(() => r?.componentProps ?? xe(w), [r?.componentProps, w]), o = y((t, l) => {
652
- i({ [t]: l });
653
- }, [i]), E = y((t) => {
655
+ }, [g, a]), _ = X(() => pe[r?.componentType ?? "table-grid"] ?? [], [r?.componentType]), W = X(() => r?.componentProps ?? xe(_), [r?.componentProps, _]), l = j((t, u) => {
656
+ i({ [t]: u });
657
+ }, [i]), P = j((t) => {
658
+ const u = pe[t] ?? [];
654
659
  i({
655
660
  componentType: t,
656
- componentProps: xe(pe[t] ?? [])
661
+ componentProps: xe(u)
657
662
  });
658
- }, [i]), L = y((t, l) => {
663
+ }, [i]), L = j((t, u) => {
659
664
  i({ componentProps: {
660
- ...R,
661
- [t]: l
665
+ ...W,
666
+ [t]: u
662
667
  } });
663
- }, [R, i]), O = X(() => !p || p.length === 0 ? [] : p.filter((t) => t.version === 1), [p]);
668
+ }, [W, i]), B = X(() => !f || f.length === 0 ? [] : f.filter((t) => t.version === 1), [f]);
664
669
  return r ? /* @__PURE__ */ (0, e.jsxs)("aside", {
665
670
  className: n["rst-dashboard-builder-configurator"],
666
671
  "aria-label": "Widget configurator",
667
672
  children: [/* @__PURE__ */ (0, e.jsxs)("div", {
668
673
  className: n["rst-dashboard-builder-configurator-header"],
669
- children: [/* @__PURE__ */ (0, e.jsx)(te, {
674
+ children: [/* @__PURE__ */ (0, e.jsx)(se, {
670
675
  variant: "heading",
671
676
  children: "Configure"
672
- }), /* @__PURE__ */ (0, e.jsx)(Z, {
677
+ }), /* @__PURE__ */ (0, e.jsx)(Q, {
673
678
  variant: "invisible",
674
679
  size: "small",
675
680
  leadingVisual: "close",
676
- onClick: b,
681
+ onClick: h,
677
682
  "aria-label": "Close configurator"
678
683
  })]
679
684
  }), /* @__PURE__ */ (0, e.jsxs)("div", {
@@ -686,7 +691,7 @@ var cr = [
686
691
  children: "Title"
687
692
  }), /* @__PURE__ */ (0, e.jsx)(_e, {
688
693
  value: r.title,
689
- onChange: (t) => o("title", t ?? ""),
694
+ onChange: (t) => l("title", t ?? ""),
690
695
  placeholder: "Widget title"
691
696
  })]
692
697
  }),
@@ -697,7 +702,7 @@ var cr = [
697
702
  children: "Subtitle"
698
703
  }), /* @__PURE__ */ (0, e.jsx)(_e, {
699
704
  value: r.subtitle ?? "",
700
- onChange: (t) => o("subtitle", t || void 0),
705
+ onChange: (t) => l("subtitle", t || void 0),
701
706
  placeholder: "Optional subtitle"
702
707
  })]
703
708
  }),
@@ -708,13 +713,13 @@ var cr = [
708
713
  children: "Icon"
709
714
  }), /* @__PURE__ */ (0, e.jsx)(ge, {
710
715
  value: r.icon ?? "",
711
- onChange: (t) => o("icon", t || void 0),
716
+ onChange: (t) => l("icon", t || void 0),
712
717
  options: c,
713
- renderList: ({ options: t, value: l, onChange: B, onClose: u }) => /* @__PURE__ */ (0, e.jsx)(Te, {
718
+ renderList: ({ options: t, value: u, onChange: M, onClose: o }) => /* @__PURE__ */ (0, e.jsx)(Te, {
714
719
  options: t,
715
- activeIndex: [typeof l == "string" ? l : ""],
716
- onClick: (x) => {
717
- B(x.value), u();
720
+ activeIndex: [typeof u == "string" ? u : ""],
721
+ onClick: (p) => {
722
+ M(p.value), o();
718
723
  },
719
724
  showFilter: !0
720
725
  })
@@ -727,7 +732,7 @@ var cr = [
727
732
  children: "Data Source"
728
733
  }), /* @__PURE__ */ (0, e.jsx)(ge, {
729
734
  value: r.dataSourceId,
730
- onChange: (t) => o("dataSourceId", t),
735
+ onChange: (t) => l("dataSourceId", t),
731
736
  options: k
732
737
  })]
733
738
  }),
@@ -743,12 +748,12 @@ var cr = [
743
748
  })),
744
749
  value: r.columns?.map((t) => t.id).filter(Boolean) ?? a[r.dataSourceId].fields.map((t) => t.id),
745
750
  onChange: (t) => {
746
- const l = a[r.dataSourceId], B = t.map((u) => l.fields.find((x) => x.id === u)).filter(Boolean).map((u) => ({
747
- id: u.id,
748
- header: u.name,
749
- accessorKey: u.id
751
+ const u = a[r.dataSourceId], M = t.map((o) => u.fields.find((p) => p.id === o)).filter(Boolean).map((o) => ({
752
+ id: o.id,
753
+ header: o.name,
754
+ accessorKey: o.id
750
755
  }));
751
- i({ columns: B.length === l.fields.length ? void 0 : B });
756
+ i({ columns: M.length === u.fields.length ? void 0 : M });
752
757
  }
753
758
  })]
754
759
  }),
@@ -761,9 +766,9 @@ var cr = [
761
766
  }),
762
767
  /* @__PURE__ */ (0, e.jsxs)("div", {
763
768
  className: n["rst-dashboard-builder-checkbox-row"],
764
- children: [/* @__PURE__ */ (0, e.jsx)(ue, {
769
+ children: [/* @__PURE__ */ (0, e.jsx)(ce, {
765
770
  checked: r.enableExport ?? !0,
766
- onChange: (t) => o("enableExport", t)
771
+ onChange: (t) => l("enableExport", t)
767
772
  }), /* @__PURE__ */ (0, e.jsx)("span", {
768
773
  className: n["rst-dashboard-builder-checkbox-label"],
769
774
  children: "Export CSV"
@@ -771,9 +776,9 @@ var cr = [
771
776
  }),
772
777
  /* @__PURE__ */ (0, e.jsxs)("div", {
773
778
  className: n["rst-dashboard-builder-checkbox-row"],
774
- children: [/* @__PURE__ */ (0, e.jsx)(ue, {
779
+ children: [/* @__PURE__ */ (0, e.jsx)(ce, {
775
780
  checked: r.enableScreenshot ?? !1,
776
- onChange: (t) => o("enableScreenshot", t)
781
+ onChange: (t) => l("enableScreenshot", t)
777
782
  }), /* @__PURE__ */ (0, e.jsx)("span", {
778
783
  className: n["rst-dashboard-builder-checkbox-label"],
779
784
  children: "Screenshot"
@@ -781,9 +786,9 @@ var cr = [
781
786
  }),
782
787
  /* @__PURE__ */ (0, e.jsxs)("div", {
783
788
  className: n["rst-dashboard-builder-checkbox-row"],
784
- children: [/* @__PURE__ */ (0, e.jsx)(ue, {
789
+ children: [/* @__PURE__ */ (0, e.jsx)(ce, {
785
790
  checked: r.enableExpand ?? !0,
786
- onChange: (t) => o("enableExpand", t)
791
+ onChange: (t) => l("enableExpand", t)
787
792
  }), /* @__PURE__ */ (0, e.jsx)("span", {
788
793
  className: n["rst-dashboard-builder-checkbox-label"],
789
794
  children: "Expand"
@@ -791,9 +796,9 @@ var cr = [
791
796
  }),
792
797
  /* @__PURE__ */ (0, e.jsxs)("div", {
793
798
  className: n["rst-dashboard-builder-checkbox-row"],
794
- children: [/* @__PURE__ */ (0, e.jsx)(ue, {
799
+ children: [/* @__PURE__ */ (0, e.jsx)(ce, {
795
800
  checked: r.enableFilter ?? !0,
796
- onChange: (t) => o("enableFilter", t)
801
+ onChange: (t) => l("enableFilter", t)
797
802
  }), /* @__PURE__ */ (0, e.jsx)("span", {
798
803
  className: n["rst-dashboard-builder-checkbox-label"],
799
804
  children: "Filter"
@@ -803,17 +808,17 @@ var cr = [
803
808
  }),
804
809
  /* @__PURE__ */ (0, e.jsx)("div", { className: n["rst-dashboard-builder-configurator-divider"] }),
805
810
  /* @__PURE__ */ (0, e.jsx)(Le, {
806
- schema: w,
807
- values: R,
811
+ schema: _,
812
+ values: W,
808
813
  onChange: L,
809
- columns: g,
814
+ columns: x,
810
815
  scope: "all",
811
816
  componentId: r.componentType,
812
- onComponentChange: E,
817
+ onComponentChange: P,
813
818
  componentMetaList: Pe
814
819
  }, r.dataSourceId ?? "no-ds"),
815
820
  /* @__PURE__ */ (0, e.jsx)("div", { className: n["rst-dashboard-builder-configurator-divider"] }),
816
- /* @__PURE__ */ (0, e.jsx)(Z, {
821
+ /* @__PURE__ */ (0, e.jsx)(Q, {
817
822
  variant: "danger",
818
823
  size: "small",
819
824
  value: "Remove widget",
@@ -827,7 +832,7 @@ var cr = [
827
832
  "aria-label": "Add widget",
828
833
  children: [/* @__PURE__ */ (0, e.jsx)("div", {
829
834
  className: n["rst-dashboard-builder-configurator-header"],
830
- children: /* @__PURE__ */ (0, e.jsx)(te, {
835
+ children: /* @__PURE__ */ (0, e.jsx)(se, {
831
836
  variant: "heading",
832
837
  children: "Add Widget"
833
838
  })
@@ -835,7 +840,7 @@ var cr = [
835
840
  className: n["rst-dashboard-builder-configurator-body"],
836
841
  children: [cr.map((t) => /* @__PURE__ */ (0, e.jsxs)("button", {
837
842
  className: n["rst-dashboard-builder-add-widget-item"],
838
- onClick: () => h(t.type),
843
+ onClick: () => b(t.type),
839
844
  children: [/* @__PURE__ */ (0, e.jsx)(ve, { src: t.icon }), /* @__PURE__ */ (0, e.jsxs)("div", { children: [/* @__PURE__ */ (0, e.jsx)("div", {
840
845
  className: n["rst-dashboard-builder-add-widget-item-label"],
841
846
  children: t.label
@@ -843,15 +848,15 @@ var cr = [
843
848
  className: n["rst-dashboard-builder-add-widget-item-desc"],
844
849
  children: t.description
845
850
  })] })]
846
- }, t.type)), O.length > 0 && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [
851
+ }, t.type)), B.length > 0 && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [
847
852
  /* @__PURE__ */ (0, e.jsx)("div", { className: n["rst-dashboard-builder-configurator-divider"] }),
848
- /* @__PURE__ */ (0, e.jsx)(te, {
853
+ /* @__PURE__ */ (0, e.jsx)(se, {
849
854
  variant: "heading",
850
855
  children: "Pre-built Sections"
851
856
  }),
852
- O.map((t) => /* @__PURE__ */ (0, e.jsxs)("button", {
857
+ B.map((t) => /* @__PURE__ */ (0, e.jsxs)("button", {
853
858
  className: n["rst-dashboard-builder-add-widget-item"],
854
- onClick: () => j?.(t),
859
+ onClick: () => w?.(t),
855
860
  children: [/* @__PURE__ */ (0, e.jsx)(ve, { src: "layout" }), /* @__PURE__ */ (0, e.jsxs)("div", { children: [/* @__PURE__ */ (0, e.jsx)("div", {
856
861
  className: n["rst-dashboard-builder-add-widget-item-label"],
857
862
  children: t.name
@@ -865,64 +870,64 @@ var cr = [
865
870
  });
866
871
  };
867
872
  ze.displayName = "WidgetConfigurator";
868
- var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s, onSave: b, onChange: h, widgetActionDefaults: p, readOnly: j, className: k }) => {
869
- const { state: c, mode: f, setMode: g, addWidget: w, addPrebuiltWidget: R, removeWidget: o, updateWidget: E, moveWidget: L, selectWidget: O, selectedWidget: t, setName: l, setFilters: B, loadConfig: u } = ir(a, j), [x, W] = D(!1), [d, C] = D("dialog"), [P, U] = D(null), [ee, re] = D(null), [_, le] = D(!1), [v, N] = D(null), z = X(() => dr(c.config.widgets, r), [c.config.widgets, r]), M = f === "view", G = M ? ee : c.config.filters;
870
- se(() => {
871
- x && N(G);
872
- }, [x]);
873
- const ne = y(() => {
874
- M ? re(v) : B(v), W(!1);
873
+ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s, onSave: h, onChange: b, widgetActionDefaults: f, readOnly: w, className: k }) => {
874
+ const { state: c, mode: g, setMode: x, addWidget: _, addPrebuiltWidget: W, removeWidget: l, updateWidget: P, moveWidget: L, selectWidget: B, selectedWidget: t, setName: u, setFilters: M, loadConfig: o } = ir(a, w), [p, I] = z(!1), [d, C] = z("dialog"), [F, Z] = z(null), [U, re] = z(null), [de, v] = z(!1), [y, N] = z(null), R = X(() => dr(c.config.widgets, r), [c.config.widgets, r]), D = g === "view", G = D ? U : c.config.filters;
875
+ te(() => {
876
+ p && N(G);
877
+ }, [p]);
878
+ const oe = j(() => {
879
+ D ? re(y) : M(y), I(!1);
875
880
  }, [
876
- v,
877
- M,
878
- B
881
+ y,
882
+ D,
883
+ M
879
884
  ]);
880
- se(() => {
881
- M && !_ && (re(c.config.filters), le(!0)), M || le(!1);
885
+ te(() => {
886
+ D && !de && (re(c.config.filters), v(!0)), D || v(!1);
882
887
  }, [
883
- M,
884
- _,
888
+ D,
889
+ de,
885
890
  c.config.filters
886
891
  ]);
887
- const Y = ie(h);
888
- Y.current = h;
889
- const H = y((m, $) => {
890
- (M ? re : B)((ae) => ({
892
+ const Y = ne(b);
893
+ Y.current = b;
894
+ const H = j((m, $) => {
895
+ (D ? re : M)((ae) => ({
891
896
  ...ae ?? {},
892
897
  [m]: $
893
898
  }));
894
- }, [M, B]), T = X(() => ({
899
+ }, [D, M]), T = X(() => ({
895
900
  filters: G,
896
901
  onFilterChange: H
897
- }), [G, H]), I = X(() => !i || i.length === 0 ? [] : i.filter((m) => m.version === 1), [i]), q = X(() => I.map((m) => ({
902
+ }), [G, H]), E = X(() => !i || i.length === 0 ? [] : i.filter((m) => m.version === 1), [i]), q = X(() => E.map((m) => ({
898
903
  value: m.name,
899
904
  id: m.name,
900
905
  description: m.description
901
- })), [I]), K = y((m) => {
902
- const $ = I.find((J) => J.name === m);
906
+ })), [E]), K = j((m) => {
907
+ const $ = E.find((J) => J.name === m);
903
908
  if (!$) return;
904
909
  const ae = {
905
910
  version: 1,
906
911
  ...$.config
907
912
  };
908
- u(ae);
909
- }, [I, u]), F = X(() => ({
910
- enableExport: p?.enableExport ?? !0,
911
- enableScreenshot: p?.enableScreenshot ?? !1,
912
- enableExpand: p?.enableExpand ?? !0,
913
- enableFilter: p?.enableFilter ?? !0
914
- }), [p]), ce = y((m) => ({
915
- enableExport: m.enableExport ?? F.enableExport,
916
- enableScreenshot: m.enableScreenshot ?? F.enableScreenshot,
917
- enableExpand: m.enableExpand ?? F.enableExpand,
918
- enableFilter: m.enableFilter ?? F.enableFilter
919
- }), [F]);
920
- se(() => {
913
+ o(ae);
914
+ }, [E, o]), O = X(() => ({
915
+ enableExport: f?.enableExport ?? !0,
916
+ enableScreenshot: f?.enableScreenshot ?? !1,
917
+ enableExpand: f?.enableExpand ?? !0,
918
+ enableFilter: f?.enableFilter ?? !0
919
+ }), [f]), le = j((m) => ({
920
+ enableExport: m.enableExport ?? O.enableExport,
921
+ enableScreenshot: m.enableScreenshot ?? O.enableScreenshot,
922
+ enableExpand: m.enableExpand ?? O.enableExpand,
923
+ enableFilter: m.enableFilter ?? O.enableFilter
924
+ }), [O]);
925
+ te(() => {
921
926
  Y.current?.(c.config);
922
927
  }, [c.config]);
923
- const S = [n["rst-dashboard-builder"], k].filter(Boolean).join(" "), A = y(() => {
924
- b(c.config);
925
- }, [c.config, b]);
928
+ const S = [n["rst-dashboard-builder"], k].filter(Boolean).join(" "), A = j(() => {
929
+ h(c.config);
930
+ }, [c.config, h]);
926
931
  return /* @__PURE__ */ (0, e.jsx)("div", {
927
932
  className: S,
928
933
  children: /* @__PURE__ */ (0, e.jsxs)("div", {
@@ -931,39 +936,39 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
931
936
  className: n["rst-dashboard-builder-toolbar"],
932
937
  children: [/* @__PURE__ */ (0, e.jsxs)("div", {
933
938
  className: n["rst-dashboard-builder-toolbar-left"],
934
- children: [M ? /* @__PURE__ */ (0, e.jsx)("span", {
939
+ children: [D ? /* @__PURE__ */ (0, e.jsx)("span", {
935
940
  className: n["rst-dashboard-builder-name-display"],
936
941
  children: c.config.name
937
942
  }) : /* @__PURE__ */ (0, e.jsx)("input", {
938
943
  className: n["rst-dashboard-builder-name-input"],
939
944
  type: "text",
940
945
  value: c.config.name,
941
- onChange: (m) => l(m.target.value),
946
+ onChange: (m) => u(m.target.value),
942
947
  placeholder: "Dashboard name",
943
948
  "aria-label": "Dashboard name"
944
- }), Object.keys(z).length > 0 && /* @__PURE__ */ (0, e.jsx)(Z, {
949
+ }), Object.keys(R).length > 0 && /* @__PURE__ */ (0, e.jsx)(Q, {
945
950
  variant: "invisible",
946
951
  size: "small",
947
952
  leadingVisual: "filter",
948
- onClick: () => W((m) => !m),
953
+ onClick: () => I((m) => !m),
949
954
  "aria-label": "Toggle filter panel",
950
- "aria-pressed": x
955
+ "aria-pressed": p
951
956
  })]
952
957
  }), /* @__PURE__ */ (0, e.jsxs)("div", {
953
958
  className: n["rst-dashboard-builder-toolbar-right"],
954
959
  children: [
955
- I.length > 0 && !M && /* @__PURE__ */ (0, e.jsx)(Oe, {
960
+ E.length > 0 && !D && /* @__PURE__ */ (0, e.jsx)(Oe, {
956
961
  options: q,
957
962
  onChange: K,
958
963
  placeholder: "Load Template",
959
964
  size: "small"
960
965
  }),
961
- !j && /* @__PURE__ */ (0, e.jsx)(Ee, {
962
- value: f,
966
+ !w && /* @__PURE__ */ (0, e.jsx)(Ee, {
967
+ value: g,
963
968
  options: [{ value: "edit" }, { value: "view" }],
964
- onChange: (m) => g(m)
969
+ onChange: (m) => x(m)
965
970
  }),
966
- !M && /* @__PURE__ */ (0, e.jsx)(Z, {
971
+ !D && /* @__PURE__ */ (0, e.jsx)(Q, {
967
972
  variant: "primary",
968
973
  size: "small",
969
974
  value: "Save",
@@ -981,23 +986,23 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
981
986
  },
982
987
  children: [
983
988
  /* @__PURE__ */ (0, e.jsx)(De, {
984
- mode: f,
989
+ mode: g,
985
990
  widgets: c.config.widgets,
986
991
  selectedWidgetId: c.selectedWidgetId,
987
992
  dataSources: r,
988
- onSelectWidget: O,
993
+ onSelectWidget: B,
989
994
  onMoveWidget: L,
990
- onRemoveWidget: o,
991
- onAddWidget: w,
995
+ onRemoveWidget: l,
996
+ onAddWidget: _,
992
997
  onChange: () => {
993
998
  },
994
- getWidgetActions: ce
999
+ getWidgetActions: le
995
1000
  }),
996
- x && Object.keys(z).length > 0 && /* @__PURE__ */ (0, e.jsxs)(me, {
997
- open: x,
1001
+ p && Object.keys(R).length > 0 && /* @__PURE__ */ (0, e.jsxs)(be, {
1002
+ open: p,
998
1003
  variant: d,
999
1004
  position: d === "dialog" ? "center" : "right",
1000
- onClose: () => W(!1),
1005
+ onClose: () => I(!1),
1001
1006
  closeOnEscape: !0,
1002
1007
  closeOnClickOutside: d === "dialog",
1003
1008
  width: d === "sidepanel" ? 360 : void 0,
@@ -1005,10 +1010,10 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
1005
1010
  maxHeight: d === "dialog" ? "80vh" : void 0,
1006
1011
  "aria-label": "Dashboard filters",
1007
1012
  children: [
1008
- /* @__PURE__ */ (0, e.jsx)(me.Header, {
1013
+ /* @__PURE__ */ (0, e.jsx)(be.Header, {
1009
1014
  title: "Filters",
1010
- onClose: () => W(!1),
1011
- actions: /* @__PURE__ */ (0, e.jsx)(Z, {
1015
+ onClose: () => I(!1),
1016
+ actions: /* @__PURE__ */ (0, e.jsx)(Q, {
1012
1017
  variant: "invisible",
1013
1018
  size: "small",
1014
1019
  leadingVisual: d === "dialog" ? "square-half" : "open-center",
@@ -1019,19 +1024,19 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
1019
1024
  /* @__PURE__ */ (0, e.jsx)("div", {
1020
1025
  className: n["rst-dashboard-builder-filter-body"],
1021
1026
  children: (() => {
1022
- const m = Object.keys(z);
1027
+ const m = Object.keys(R);
1023
1028
  if (m.length === 0) return /* @__PURE__ */ (0, e.jsx)("div", {
1024
1029
  style: { padding: "var(--rst-space-default)" },
1025
1030
  children: "No data sources to filter."
1026
1031
  });
1027
- const $ = P && m.includes(P) ? P : m[0], ae = v?.[$] ?? Ye();
1032
+ const $ = F && m.includes(F) ? F : m[0], ae = y?.[$] ?? Ye();
1028
1033
  return /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [/* @__PURE__ */ (0, e.jsx)("div", {
1029
1034
  className: n["rst-dashboard-builder-filter-tabs"],
1030
- children: m.map((J) => /* @__PURE__ */ (0, e.jsx)(Z, {
1035
+ children: m.map((J) => /* @__PURE__ */ (0, e.jsx)(Q, {
1031
1036
  value: J,
1032
1037
  variant: J === $ ? "base" : "invisible",
1033
1038
  size: "small",
1034
- onClick: () => U(J),
1039
+ onClick: () => Z(J),
1035
1040
  children: J
1036
1041
  }, J))
1037
1042
  }), /* @__PURE__ */ (0, e.jsx)(Ge, {
@@ -1040,40 +1045,40 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
1040
1045
  ...We ?? {},
1041
1046
  [$]: J.filters.length === 0 ? null : J
1042
1047
  })),
1043
- fieldOptions: z[$]
1048
+ fieldOptions: R[$]
1044
1049
  })] });
1045
1050
  })()
1046
1051
  }),
1047
- /* @__PURE__ */ (0, e.jsxs)(me.Footer, { children: [/* @__PURE__ */ (0, e.jsx)(Z, {
1052
+ /* @__PURE__ */ (0, e.jsxs)(be.Footer, { children: [/* @__PURE__ */ (0, e.jsx)(Q, {
1048
1053
  variant: "invisible",
1049
1054
  size: "small",
1050
1055
  value: "Clear",
1051
1056
  onClick: () => N({})
1052
- }), /* @__PURE__ */ (0, e.jsx)(Z, {
1057
+ }), /* @__PURE__ */ (0, e.jsx)(Q, {
1053
1058
  variant: "primary",
1054
1059
  size: "small",
1055
1060
  value: "Apply",
1056
- onClick: ne
1061
+ onClick: oe
1057
1062
  })] })
1058
1063
  ]
1059
1064
  }),
1060
- !M && /* @__PURE__ */ (0, e.jsx)(ze, {
1065
+ !D && /* @__PURE__ */ (0, e.jsx)(ze, {
1061
1066
  widget: t,
1062
1067
  dataSources: r,
1063
1068
  onUpdate: (m) => {
1064
- t && E(t.id, m);
1069
+ t && P(t.id, m);
1065
1070
  },
1066
1071
  onRemove: () => {
1067
- t && o(t.id);
1072
+ t && l(t.id);
1068
1073
  },
1069
- onClose: () => O(null),
1074
+ onClose: () => B(null),
1070
1075
  onAddWidget: (m) => {
1071
1076
  const $ = Object.values(r)[0], ae = Me(6, 3, c.config.widgets);
1072
- w(m, $?.id ?? "", ae);
1077
+ _(m, $?.id ?? "", ae);
1073
1078
  },
1074
1079
  prebuiltSections: s,
1075
1080
  onAddPrebuiltSection: (m) => {
1076
- R(m);
1081
+ W(m);
1077
1082
  }
1078
1083
  })
1079
1084
  ]
@@ -1083,7 +1088,7 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
1083
1088
  });
1084
1089
  };
1085
1090
  ur.displayName = "DashboardBuilder";
1086
- var he = {
1091
+ var ue = {
1087
1092
  "rst-border-beam": "_rst-border-beam_4g5sg_1",
1088
1093
  "rst-border-beam-effect": "_rst-border-beam-effect_4g5sg_7",
1089
1094
  "rst-border-beam-ring": "_rst-border-beam-ring_4g5sg_15",
@@ -1097,12 +1102,12 @@ function hr(r) {
1097
1102
  })).sort((a, i) => a.percent - i.percent);
1098
1103
  }
1099
1104
  function br(r, a, i, s) {
1100
- const b = 360 / Math.max(1, s), h = 2 * (a + i);
1101
- return h <= 0 || r <= 0 ? Math.min(90, b) : Math.min(r / h * 360, b);
1105
+ const h = 360 / Math.max(1, s), b = 2 * (a + i);
1106
+ return b <= 0 || r <= 0 ? Math.min(90, h) : Math.min(r / b * 360, h);
1102
1107
  }
1103
1108
  function mr(r, a) {
1104
1109
  const i = Math.max(0, Math.min(a, 360)), s = hr(r);
1105
- return `conic-gradient(from 0deg, ${s.length ? s.map((b) => `${b.color} ${b.percent / 100 * i}deg`).join(", ") : "var(--rst-borderColor-focus) 0deg"}, transparent ${i}deg, transparent 360deg)`;
1110
+ return `conic-gradient(from 0deg, ${s.length ? s.map((h) => `${h.color} ${h.percent / 100 * i}deg`).join(", ") : "var(--rst-borderColor-focus) 0deg"}, transparent ${i}deg, transparent 360deg)`;
1106
1111
  }
1107
1112
  var xr = [
1108
1113
  {
@@ -1117,54 +1122,54 @@ var xr = [
1117
1122
  color: "var(--rst-borderColor-focus)",
1118
1123
  percent: 100
1119
1124
  }
1120
- ], pr = ({ children: r, color: a = xr, count: i = 1, duration: s = 6, lineWidth: b = 1, outset: h = 0, inset: p = 0, size: j = 120, className: k, style: c, ...f }) => {
1121
- const g = ie(null), [w, R] = D({
1125
+ ], pr = ({ children: r, color: a = xr, count: i = 1, duration: s = 6, lineWidth: h = 1, outset: b = 0, inset: f = 0, size: w = 120, className: k, style: c, ...g }) => {
1126
+ const x = ne(null), [_, W] = z({
1122
1127
  radius: "",
1123
1128
  width: 0,
1124
1129
  height: 0
1125
1130
  });
1126
- se(() => {
1127
- const t = g.current?.firstElementChild;
1128
- if (!t || typeof ResizeObserver > "u") return;
1129
- const l = new ResizeObserver(() => {
1130
- R({
1131
- radius: getComputedStyle(t).borderTopLeftRadius,
1132
- width: t.clientWidth,
1133
- height: t.clientHeight
1131
+ te(() => {
1132
+ const M = x.current?.firstElementChild;
1133
+ if (!M || typeof ResizeObserver > "u") return;
1134
+ const o = new ResizeObserver(() => {
1135
+ W({
1136
+ radius: getComputedStyle(M).borderTopLeftRadius,
1137
+ width: M.clientWidth,
1138
+ height: M.clientHeight
1134
1139
  });
1135
1140
  });
1136
- return l.observe(t), () => l.disconnect();
1141
+ return o.observe(M), () => o.disconnect();
1137
1142
  }, []);
1138
- const o = Math.max(1, Math.floor(i)), E = X(() => mr(a, br(j, w.width, w.height, o)), [
1143
+ const l = Math.max(1, Math.floor(i)), P = X(() => mr(a, br(w, _.width, _.height, l)), [
1139
1144
  a,
1140
- j,
1141
- w.width,
1142
- w.height,
1143
- o
1144
- ]), L = 360 / o, O = Math.hypot(w.width + 2 * h, w.height + 2 * h);
1145
+ w,
1146
+ _.width,
1147
+ _.height,
1148
+ l
1149
+ ]), L = 360 / l, B = Math.hypot(_.width + 2 * b, _.height + 2 * b), t = [ue["rst-border-beam"], k].filter(Boolean).join(" "), u = {
1150
+ "--rst-border-beam-gradient": P,
1151
+ "--rst-border-beam-duration": `${s}s`,
1152
+ "--rst-border-beam-line-width": `${h}px`,
1153
+ "--rst-border-beam-outset": `${b}px`,
1154
+ "--rst-border-beam-inset": `${f}px`,
1155
+ ...B > 0 ? { "--rst-border-beam-diagonal": `${B}px` } : {},
1156
+ ..._.radius ? { "--rst-border-beam-radius": _.radius } : {},
1157
+ ...c
1158
+ };
1145
1159
  return /* @__PURE__ */ (0, e.jsxs)("div", {
1146
- ref: g,
1147
- className: [he["rst-border-beam"], k].filter(Boolean).join(" "),
1148
- style: {
1149
- "--rst-border-beam-gradient": E,
1150
- "--rst-border-beam-duration": `${s}s`,
1151
- "--rst-border-beam-line-width": `${b}px`,
1152
- "--rst-border-beam-outset": `${h}px`,
1153
- "--rst-border-beam-inset": `${p}px`,
1154
- ...O > 0 ? { "--rst-border-beam-diagonal": `${O}px` } : {},
1155
- ...w.radius ? { "--rst-border-beam-radius": w.radius } : {},
1156
- ...c
1157
- },
1158
- ...f,
1160
+ ref: x,
1161
+ className: t,
1162
+ style: u,
1163
+ ...g,
1159
1164
  children: [r, /* @__PURE__ */ (0, e.jsx)("span", {
1160
- className: he["rst-border-beam-effect"],
1165
+ className: ue["rst-border-beam-effect"],
1161
1166
  "aria-hidden": "true",
1162
1167
  children: /* @__PURE__ */ (0, e.jsx)("span", {
1163
- className: he["rst-border-beam-ring"],
1164
- children: Array.from({ length: o }, (t, l) => /* @__PURE__ */ (0, e.jsx)("span", {
1165
- className: he["rst-border-beam-spin"],
1166
- style: { "--rst-border-beam-offset": `${l * L}deg` }
1167
- }, l))
1168
+ className: ue["rst-border-beam-ring"],
1169
+ children: Array.from({ length: l }, (M, o) => /* @__PURE__ */ (0, e.jsx)("span", {
1170
+ className: ue["rst-border-beam-spin"],
1171
+ style: { "--rst-border-beam-offset": `${o * L}deg` }
1172
+ }, o))
1168
1173
  })
1169
1174
  })]
1170
1175
  });
@@ -1186,7 +1191,7 @@ function _r({ block: r, onBlockEvent: a }) {
1186
1191
  onBlockEvent: a
1187
1192
  });
1188
1193
  if (r.component === "chart") {
1189
- const b = s.height ?? 16;
1194
+ const h = s.height ?? 16;
1190
1195
  return /* @__PURE__ */ (0, e.jsx)(qe, {
1191
1196
  data: i,
1192
1197
  columns: r.columns,
@@ -1198,7 +1203,7 @@ function _r({ block: r, onBlockEvent: a }) {
1198
1203
  subtitle: s.subtitle,
1199
1204
  showLegend: s.showLegend,
1200
1205
  showGrid: s.showGrid,
1201
- height: b
1206
+ height: h
1202
1207
  });
1203
1208
  }
1204
1209
  return r.component === "kpi" ? /* @__PURE__ */ (0, e.jsx)(Fe, {
@@ -1209,12 +1214,12 @@ function _r({ block: r, onBlockEvent: a }) {
1209
1214
  data: i,
1210
1215
  columns: r.columns,
1211
1216
  layout: Ae(s.layout),
1212
- onCardClick: Re(r, "action") ? (b) => a?.({
1217
+ onCardClick: Re(r, "action") ? (h) => a?.({
1213
1218
  blockId: r.id,
1214
1219
  component: "card-list",
1215
1220
  event: "action",
1216
1221
  handler: r.handler,
1217
- values: b
1222
+ values: h
1218
1223
  }) : void 0
1219
1224
  }) : /* @__PURE__ */ (0, e.jsx)(Ke, {
1220
1225
  data: i,
@@ -1227,12 +1232,12 @@ function _r({ block: r, onBlockEvent: a }) {
1227
1232
  });
1228
1233
  }
1229
1234
  function vr({ block: r, onBlockEvent: a }) {
1230
- const [i, s] = D(!1);
1235
+ const [i, s] = z(!1);
1231
1236
  return Re(r, "submit") ? /* @__PURE__ */ (0, e.jsx)(fe, {
1232
1237
  data: r.data ?? [{}],
1233
1238
  columns: r.columns,
1234
1239
  labelAlign: "top",
1235
- onSubmit: async (b) => {
1240
+ onSubmit: async (h) => {
1236
1241
  s(!0);
1237
1242
  try {
1238
1243
  await a?.({
@@ -1240,7 +1245,7 @@ function vr({ block: r, onBlockEvent: a }) {
1240
1245
  component: "form",
1241
1246
  event: "submit",
1242
1247
  handler: r.handler,
1243
- values: b
1248
+ values: h
1244
1249
  });
1245
1250
  } finally {
1246
1251
  s(!1);
@@ -1279,73 +1284,73 @@ var V = {
1279
1284
  "rst-chat-processing": "_rst-chat-processing_12syz_80",
1280
1285
  "rst-chat-composer": "_rst-chat-composer_12syz_84"
1281
1286
  };
1282
- function Mr({ messages: r, isProcessing: a = !1, inputValue: i, onInputChange: s, onSubmit: b, onKeyDown: h, onBlockEvent: p, emptyStateText: j = "Ask a question to get started.", inputPlaceholder: k = "Ask something...", className: c, renderBlock: f }) {
1283
- const g = ie(null);
1284
- se(() => {
1285
- const o = g.current;
1286
- o && (o.scrollTop = o.scrollHeight);
1287
+ function Mr({ messages: r, isProcessing: a = !1, inputValue: i, onInputChange: s, onSubmit: h, onKeyDown: b, onBlockEvent: f, emptyStateText: w = "Ask a question to get started.", inputPlaceholder: k = "Ask something...", className: c, renderBlock: g }) {
1288
+ const x = ne(null);
1289
+ te(() => {
1290
+ const l = x.current;
1291
+ l && (l.scrollTop = l.scrollHeight);
1287
1292
  }, [r, a]);
1288
- const w = a || i.trim().length === 0, R = (o, E) => o.type === "text" ? /* @__PURE__ */ (0, e.jsx)(te, {
1293
+ const _ = a || i.trim().length === 0, W = (l, P) => l.type === "text" ? /* @__PURE__ */ (0, e.jsx)(se, {
1289
1294
  variant: "body",
1290
1295
  className: V["rst-chat-text"],
1291
- children: o.text
1292
- }, E) : /* @__PURE__ */ (0, e.jsxs)("div", {
1296
+ children: l.text
1297
+ }, P) : /* @__PURE__ */ (0, e.jsxs)("div", {
1293
1298
  className: V["rst-chat-block"],
1294
- children: [o.block.meta?.title && /* @__PURE__ */ (0, e.jsx)(te, {
1299
+ children: [l.block.meta?.title && /* @__PURE__ */ (0, e.jsx)(se, {
1295
1300
  variant: "label",
1296
1301
  className: V["rst-chat-block-title"],
1297
- children: o.block.meta.title
1298
- }), f ? f(o.block) : /* @__PURE__ */ (0, e.jsx)(_r, {
1299
- block: o.block,
1300
- onBlockEvent: p
1302
+ children: l.block.meta.title
1303
+ }), g ? g(l.block) : /* @__PURE__ */ (0, e.jsx)(_r, {
1304
+ block: l.block,
1305
+ onBlockEvent: f
1301
1306
  })]
1302
- }, o.block.id);
1307
+ }, l.block.id);
1303
1308
  return /* @__PURE__ */ (0, e.jsxs)("div", {
1304
1309
  className: [V["rst-chat"], c].filter(Boolean).join(" "),
1305
1310
  children: [r.length === 0 ? /* @__PURE__ */ (0, e.jsx)("div", {
1306
1311
  className: V["rst-chat-empty"],
1307
- children: /* @__PURE__ */ (0, e.jsx)(te, {
1312
+ children: /* @__PURE__ */ (0, e.jsx)(se, {
1308
1313
  variant: "body",
1309
- children: j
1314
+ children: w
1310
1315
  })
1311
1316
  }) : /* @__PURE__ */ (0, e.jsxs)("div", {
1312
- ref: g,
1317
+ ref: x,
1313
1318
  className: V["rst-chat-messages"],
1314
1319
  role: "log",
1315
1320
  "aria-live": "polite",
1316
- children: [r.map((o) => /* @__PURE__ */ (0, e.jsx)("article", {
1317
- className: [V["rst-chat-message"], V[`rst-chat-message-${o.role}`]].join(" "),
1318
- "aria-label": `${o.role === "user" ? "You" : "Assistant"}: ${fr(o.parts)}`,
1321
+ children: [r.map((l) => /* @__PURE__ */ (0, e.jsx)("article", {
1322
+ className: [V["rst-chat-message"], V[`rst-chat-message-${l.role}`]].join(" "),
1323
+ "aria-label": `${l.role === "user" ? "You" : "Assistant"}: ${fr(l.parts)}`,
1319
1324
  children: /* @__PURE__ */ (0, e.jsx)("div", {
1320
- className: [V["rst-chat-bubble"], V[`rst-chat-bubble-${o.role}`]].join(" "),
1321
- children: o.parts.map(R)
1325
+ className: [V["rst-chat-bubble"], V[`rst-chat-bubble-${l.role}`]].join(" "),
1326
+ children: l.parts.map(W)
1322
1327
  })
1323
- }, o.id)), a && /* @__PURE__ */ (0, e.jsx)("div", {
1328
+ }, l.id)), a && /* @__PURE__ */ (0, e.jsx)("div", {
1324
1329
  className: V["rst-chat-processing"],
1325
- children: /* @__PURE__ */ (0, e.jsx)(te, {
1330
+ children: /* @__PURE__ */ (0, e.jsx)(se, {
1326
1331
  variant: "caption",
1327
1332
  children: "Working..."
1328
1333
  })
1329
1334
  })]
1330
1335
  }), /* @__PURE__ */ (0, e.jsxs)("form", {
1331
1336
  className: V["rst-chat-composer"],
1332
- onSubmit: (o) => {
1333
- o.preventDefault(), w || b();
1337
+ onSubmit: (l) => {
1338
+ l.preventDefault(), _ || h();
1334
1339
  },
1335
1340
  children: [/* @__PURE__ */ (0, e.jsx)(Qe, {
1336
1341
  value: i,
1337
1342
  onChange: s,
1338
- onKeyDown: h,
1343
+ onKeyDown: b,
1339
1344
  placeholder: k,
1340
1345
  ariaLabel: "Message",
1341
1346
  rows: 1,
1342
1347
  disabled: a
1343
- }), /* @__PURE__ */ (0, e.jsx)(Z, {
1348
+ }), /* @__PURE__ */ (0, e.jsx)(Q, {
1344
1349
  type: "submit",
1345
1350
  variant: "primary",
1346
1351
  value: "Send",
1347
1352
  leadingVisual: "send",
1348
- disabled: w
1353
+ disabled: _
1349
1354
  })]
1350
1355
  })]
1351
1356
  });