@foris/avocado-not-front 2.0.0 → 2.0.1

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,15 +1,15 @@
1
1
  import V from "axios";
2
2
  import { create as Ue } from "zustand";
3
- import Ve, { useEffect as J, useMemo as R, useState as S, Fragment as T, useCallback as D, useRef as Je, cloneElement as He } from "react";
3
+ import Ve, { useEffect as J, useMemo as O, useState as S, Fragment as $, useCallback as D, useRef as Je, cloneElement as He } from "react";
4
4
  import { Heading as Ae, Text as Xe, ThemeStore as ue, Breadcrumbs as We, Button as Qe, CardNotification as he, Checkbox as Ye, PreviewerMarkdown as Ze, Divider as Fe, SkeletonBase as Oe, Modal as Pe, Pill as de, RoundButton as et, SelectPagination as tt, Select as nt, Switch as rt, Table as st, Pager as at, TextField as ot, toast as W, Accordion as ct, Drawer as it, Loading as lt, Toaster as dt } from "@foris/avocado-suite";
5
5
  import { SummaryCard as _t, PromptCodeEditor as ut } from "@foris/ai-agent";
6
6
  import ht from "@uiw/react-codemirror";
7
7
  import { json as be } from "@codemirror/lang-json";
8
8
  import { markdown as ft } from "@codemirror/lang-markdown";
9
9
  import { sql as yt } from "@codemirror/lang-sql";
10
- import { yaml as xt } from "@codemirror/lang-yaml";
10
+ import { yaml as mt } from "@codemirror/lang-yaml";
11
11
  import B from "jsonpath";
12
- import { Legend as mt, Tooltip as gt, XAxis as pt, YAxis as bt, ResponsiveContainer as te, AreaChart as jt, CartesianGrid as fe, Area as wt, BarChart as Ct, Bar as Nt, LineChart as vt, Line as Et, PieChart as kt, Pie as St, Cell as qt } from "recharts";
12
+ import { Legend as xt, Tooltip as gt, XAxis as pt, YAxis as bt, ResponsiveContainer as te, AreaChart as jt, CartesianGrid as fe, Area as wt, BarChart as Ct, Bar as Nt, LineChart as vt, Line as Et, PieChart as kt, Pie as St, Cell as qt } from "recharts";
13
13
  const v = Ue(() => ({})), oe = (e, t, s) => {
14
14
  const r = s == null ? void 0 : s.hash;
15
15
  v.setState((i) => {
@@ -34,26 +34,30 @@ const v = Ue(() => ({})), oe = (e, t, s) => {
34
34
  }
35
35
  };
36
36
  });
37
- }, Te = (e, t) => t.length === 0 ? e : Object.fromEntries(
38
- Object.entries(e).filter(
39
- ([s]) => !t.includes(s)
40
- )
41
- ), At = (e, t, s, r) => {
42
- sessionStorage.setItem("sessionId", s), v.setState((i) => {
43
- const o = i[e] ?? {}, l = o.entries ?? {}, n = Te(
44
- l,
45
- r
37
+ }, Te = (e, t, s) => {
38
+ const r = s && Object.keys(s).length > 0 ? { ...e, ...s } : e;
39
+ return t.length === 0 ? e : Object.fromEntries(
40
+ Object.entries(r).filter(
41
+ ([i]) => !t.includes(i)
42
+ )
43
+ );
44
+ }, At = (e, t, s, r, i) => {
45
+ sessionStorage.setItem("sessionId", s), v.setState((o) => {
46
+ const l = o[e] ?? {}, n = l.entries ?? {}, d = Te(
47
+ n,
48
+ r,
49
+ i
46
50
  );
47
51
  return {
48
- ...i,
52
+ ...o,
49
53
  [e]: {
50
- ...o,
54
+ ...l,
51
55
  currentPageId: t.hash,
52
- entries: n,
56
+ entries: d,
53
57
  isLoading: !1,
54
58
  overlay: null,
55
59
  pages: {
56
- ...o.pages,
60
+ ...l.pages,
57
61
  [t.hash]: {
58
62
  page: { ...t }
59
63
  }
@@ -61,24 +65,25 @@ const v = Ue(() => ({})), oe = (e, t, s) => {
61
65
  }
62
66
  };
63
67
  });
64
- }, Ot = (e, t, s) => {
65
- v.setState((r) => {
66
- var d;
67
- const i = r[e] ?? {}, o = i.entries ?? {}, l = Te(
68
- o,
69
- s
70
- ), n = (d = t.components) == null ? void 0 : d.some(
71
- (a) => a.component === "drawer"
68
+ }, Ot = (e, t, s, r) => {
69
+ v.setState((i) => {
70
+ var a;
71
+ const o = i[e] ?? {}, l = o.entries ?? {}, n = Te(
72
+ l,
73
+ s,
74
+ r
75
+ ), d = (a = t.components) == null ? void 0 : a.some(
76
+ (u) => u.component === "drawer"
72
77
  );
73
78
  return {
74
- ...r,
79
+ ...i,
75
80
  [e]: {
76
- ...i,
77
- entries: l,
81
+ ...o,
82
+ entries: n,
78
83
  overlay: t,
79
84
  isLoading: !1,
80
- isModalOpen: !n,
81
- isDrawerOpen: !!n
85
+ isModalOpen: !d,
86
+ isDrawerOpen: !!d
82
87
  }
83
88
  };
84
89
  });
@@ -94,16 +99,23 @@ const v = Ue(() => ({})), oe = (e, t, s) => {
94
99
  var s;
95
100
  return ((s = v.getState()[e]) == null ? void 0 : s.overlay) ?? null;
96
101
  }, q = (e, t) => {
97
- const { content: s, sessionId: r, deprecatedStateKeys: i = [] } = t;
102
+ const {
103
+ content: s,
104
+ sessionId: r,
105
+ deprecatedStateKeys: i = [],
106
+ sessionState: o = {}
107
+ } = t;
98
108
  s.type !== "page" && s.type !== "overlay" || (s.type === "page" ? At(
99
109
  e,
100
110
  s,
101
111
  r,
102
- i
112
+ i,
113
+ o
103
114
  ) : Ot(
104
115
  e,
105
116
  s,
106
- i
117
+ i,
118
+ o
107
119
  ));
108
120
  }, L = (e, t) => {
109
121
  v.setState((s) => {
@@ -128,7 +140,7 @@ const v = Ue(() => ({})), oe = (e, t, s) => {
128
140
  isLoading: t
129
141
  }
130
142
  }));
131
- }, xe = (e, t) => {
143
+ }, me = (e, t) => {
132
144
  v.setState((s) => ({
133
145
  ...s,
134
146
  [e]: {
@@ -275,14 +287,28 @@ const It = (e) => {
275
287
  }, [e == null ? void 0 : e.chatPanelCallback]), null), Kt = "_summaryCard_jva4h_1", Gt = {
276
288
  summaryCard: Kt
277
289
  }, Ut = (e) => {
278
- var t, s, r;
290
+ const t = e.dataSource, s = {
291
+ url: e.dataSource.url,
292
+ method: e.dataSource.method,
293
+ headers: e.dataSource.headers,
294
+ body: t == null ? void 0 : t.data
295
+ }, r = e.locale ?? "en", i = O(() => {
296
+ var l, n, d;
297
+ const o = {
298
+ title: (l = e == null ? void 0 : e.translations) == null ? void 0 : l.title,
299
+ loading: (n = e == null ? void 0 : e.translations) == null ? void 0 : n.loading,
300
+ noData: (d = e == null ? void 0 : e.translations) == null ? void 0 : d.noData
301
+ };
302
+ return Object.fromEntries(
303
+ Object.entries(o).filter(([, a]) => !!a)
304
+ );
305
+ }, [e == null ? void 0 : e.translations]);
279
306
  return /* @__PURE__ */ c.jsx("section", { className: Gt.summaryCard, children: /* @__PURE__ */ c.jsx(
280
307
  _t,
281
308
  {
282
- api: (t = e == null ? void 0 : e.dataSource) == null ? void 0 : t.url,
283
- body: (s = e == null ? void 0 : e.dataSource) == null ? void 0 : s.data,
284
- headers: (r = e == null ? void 0 : e.dataSource) == null ? void 0 : r.headers,
285
- ...e
309
+ dataSource: s,
310
+ locale: r,
311
+ translations: i
286
312
  }
287
313
  ) });
288
314
  }, M = (e, t) => {
@@ -290,7 +316,7 @@ const It = (e) => {
290
316
  var i;
291
317
  return ((i = r[e]) == null ? void 0 : i.entries) || {};
292
318
  });
293
- return R(() => {
319
+ return O(() => {
294
320
  const r = {
295
321
  disabled: !1
296
322
  };
@@ -320,7 +346,7 @@ const It = (e) => {
320
346
  ), { disabled: j } = M(
321
347
  t,
322
348
  l
323
- ), y = o ?? j, m = i ?? "json", x = {
349
+ ), y = o ?? j, x = i ?? "json", m = {
324
350
  url: (n == null ? void 0 : n.url) || "",
325
351
  method: (n == null ? void 0 : n.method) || "post",
326
352
  headers: n == null ? void 0 : n.headers,
@@ -338,8 +364,8 @@ const It = (e) => {
338
364
  ut,
339
365
  {
340
366
  themeMode: f,
341
- requestConfig: x,
342
- language: m,
367
+ requestConfig: m,
368
+ language: x,
343
369
  disabled: y,
344
370
  inputLabel: d,
345
371
  inputPlaceholder: a,
@@ -351,7 +377,7 @@ const It = (e) => {
351
377
  }, Xt = "_body_14tsv_1", Wt = "_body_content_14tsv_5", ve = {
352
378
  body: Xt,
353
379
  body_content: Wt
354
- }, Qt = ({ inputs: e }) => /* @__PURE__ */ c.jsx("section", { className: ve.body, children: /* @__PURE__ */ c.jsx("div", { className: ve.body_content, children: e.map((t, s) => /* @__PURE__ */ c.jsx(T, { children: t }, s)) }) }), X = (e) => {
380
+ }, Qt = ({ inputs: e }) => /* @__PURE__ */ c.jsx("section", { className: ve.body, children: /* @__PURE__ */ c.jsx("div", { className: ve.body_content, children: e.map((t, s) => /* @__PURE__ */ c.jsx($, { children: t }, s)) }) }), X = (e) => {
355
381
  if (!e)
356
382
  return { "content-type": "application/json" };
357
383
  if (typeof e == "function")
@@ -603,7 +629,7 @@ const It = (e) => {
603
629
  }
604
630
  },
605
631
  []
606
- ), o = R(() => t == null ? void 0 : t.map((l) => ({
632
+ ), o = O(() => t == null ? void 0 : t.map((l) => ({
607
633
  title: l == null ? void 0 : l.title,
608
634
  component: /* @__PURE__ */ c.jsx("div", { onClick: () => i(l) })
609
635
  })), []);
@@ -624,10 +650,10 @@ const It = (e) => {
624
650
  } = e, { getNextUI: _, fetchDataSource: h, fetchAndGetNextUI: j } = I(), { disabled: y } = M(
625
651
  t,
626
652
  a
627
- ), m = {
653
+ ), x = {
628
654
  ...f,
629
655
  children: l ?? o
630
- }, x = (m == null ? void 0 : m.disabled) ?? y, g = D(async () => {
656
+ }, m = (x == null ? void 0 : x.disabled) ?? y, g = D(async () => {
631
657
  var b, N, p;
632
658
  try {
633
659
  const C = {
@@ -636,7 +662,7 @@ const It = (e) => {
636
662
  };
637
663
  switch (L(t, C), i) {
638
664
  case "CLOSE_MODAL":
639
- xe(t, !1);
665
+ me(t, !1);
640
666
  break;
641
667
  case "CLOSE_DRAWER":
642
668
  Z(t, !1);
@@ -674,8 +700,8 @@ const It = (e) => {
674
700
  ), E = (N = w == null ? void 0 : w.data) == null ? void 0 : N.content;
675
701
  if ((E == null ? void 0 : E.type) !== "fetch")
676
702
  break;
677
- const O = E == null ? void 0 : E.dataSource, k = await h(
678
- O,
703
+ const T = E == null ? void 0 : E.dataSource, k = await h(
704
+ T,
679
705
  t,
680
706
  // Avoid to handle loading state until all the requests are done
681
707
  !1
@@ -710,9 +736,9 @@ const It = (e) => {
710
736
  return /* @__PURE__ */ c.jsx(
711
737
  Qe,
712
738
  {
713
- ...m,
714
- disabled: x,
715
- onClick: () => !x && (u ?? g)()
739
+ ...x,
740
+ disabled: m,
741
+ onClick: () => !m && (u ?? g)()
716
742
  }
717
743
  );
718
744
  }, nn = "_cardNotificationNotFront_t7pln_1", rn = {
@@ -745,7 +771,7 @@ const It = (e) => {
745
771
  }, { getNextUI: f } = I(), [_, h] = S(l || !1), { disabled: j } = M(
746
772
  t,
747
773
  d
748
- ), y = R(() => n && o ? `${o} *` : o ?? "", [o, n]), m = D(async () => {
774
+ ), y = O(() => n && o ? `${o} *` : o ?? "", [o, n]), x = D(async () => {
749
775
  var g;
750
776
  try {
751
777
  const b = !_;
@@ -771,16 +797,16 @@ const It = (e) => {
771
797
  } catch (b) {
772
798
  console.error("Error in checkbox action:", b), alert(JSON.stringify(b));
773
799
  }
774
- }, [t, s, r, i, _]), x = (u == null ? void 0 : u.disabled) ?? j;
800
+ }, [t, s, r, i, _]), m = (u == null ? void 0 : u.disabled) ?? j;
775
801
  return /* @__PURE__ */ c.jsx(
776
802
  Ye,
777
803
  {
778
804
  ...u,
779
805
  labelRight: y,
780
806
  checked: _,
781
- disabled: x,
807
+ disabled: m,
782
808
  onChange: () => {
783
- !x && m();
809
+ !m && x();
784
810
  }
785
811
  }
786
812
  );
@@ -805,12 +831,12 @@ const It = (e) => {
805
831
  } = e, [f, _] = S(l ?? ""), h = ue.useThemeStore((b) => b.theme.mode), { disabled: j } = M(
806
832
  t,
807
833
  d
808
- ), y = a ?? j, m = {
834
+ ), y = a ?? j, x = {
809
835
  json: be(),
810
836
  markdown: ft(),
811
837
  sql: yt(),
812
- yaml: xt()
813
- }, x = R(() => n && r ? `${r} *` : r ?? "", [r, n]), g = (b) => {
838
+ yaml: mt()
839
+ }, m = O(() => n && r ? `${r} *` : r ?? "", [r, n]), g = (b) => {
814
840
  _(b);
815
841
  const N = {
816
842
  [s]: b
@@ -818,7 +844,7 @@ const It = (e) => {
818
844
  L(t, N);
819
845
  };
820
846
  return /* @__PURE__ */ c.jsxs("div", { className: Y.codeEditor, children: [
821
- x && x !== "" && /* @__PURE__ */ c.jsx("label", { className: Y.codeEditor_label, children: x }),
847
+ m && m !== "" && /* @__PURE__ */ c.jsx("label", { className: Y.codeEditor_label, children: m }),
822
848
  /* @__PURE__ */ c.jsxs("div", { className: Y.codeEditor_wrapper, children: [
823
849
  /* @__PURE__ */ c.jsx(
824
850
  ht,
@@ -827,7 +853,7 @@ const It = (e) => {
827
853
  value: f,
828
854
  height: "400px",
829
855
  placeholder: o,
830
- extensions: [m[i] ?? be()],
856
+ extensions: [x[i] ?? be()],
831
857
  onChange: (b) => g(b),
832
858
  theme: h,
833
859
  editable: !y
@@ -877,7 +903,7 @@ var hn = Le.exports;
877
903
  const ee = /* @__PURE__ */ Lt(hn);
878
904
  const fn = "_dividerNotFront_tze3j_1", yn = {
879
905
  dividerNotFront: fn
880
- }, xn = (e) => /* @__PURE__ */ c.jsx(Fe, { ...e, className: yn.dividerNotFront }), mn = (e, t, s) => {
906
+ }, mn = (e) => /* @__PURE__ */ c.jsx(Fe, { ...e, className: yn.dividerNotFront }), xn = (e, t, s) => {
881
907
  const { url: r, paginationKeys: i, params: o } = e, l = [], n = (i == null ? void 0 : i.page) ?? "page";
882
908
  if (l.push(`${n}=${t}`), typeof s == "string") {
883
909
  const u = (i == null ? void 0 : i.text) ?? "text";
@@ -891,11 +917,11 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
891
917
  }
892
918
  const d = l.join("&");
893
919
  return d ? `${r}?${d}` : r;
894
- }, me = (e, t, s) => {
920
+ }, xe = (e, t, s) => {
895
921
  const { type: r, url: i, method: o, headers: l } = e;
896
922
  return r === "rest" ? {
897
923
  type: "rest",
898
- url: mn(e, t, s),
924
+ url: xn(e, t, s),
899
925
  method: o,
900
926
  headers: l,
901
927
  data: (e == null ? void 0 : e.data) || {}
@@ -918,10 +944,10 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
918
944
  const _ = {};
919
945
  for (const [h, j] of Object.entries(s))
920
946
  if (typeof j == "object" && "path" in j) {
921
- const y = j, m = (u = B.query(a, y.path)) == null ? void 0 : u[0];
922
- y.translations && String(m) in y.translations ? _[h] = ie(
923
- y.translations[String(m)]
924
- ) : _[h] = ie(m);
947
+ const y = j, x = (u = B.query(a, y.path)) == null ? void 0 : u[0];
948
+ y.translations && String(x) in y.translations ? _[h] = ie(
949
+ y.translations[String(x)]
950
+ ) : _[h] = ie(x);
925
951
  } else {
926
952
  const y = j;
927
953
  _[h] = ie((f = B.query(a, y)) == null ? void 0 : f[0]);
@@ -939,14 +965,14 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
939
965
  };
940
966
  return { items: o, pagination: d };
941
967
  }, ne = ({ withPadding: e = !1 }) => {
942
- const t = (s) => /* @__PURE__ */ c.jsx("span", { style: { color: $.labelColor }, children: s });
968
+ const t = (s) => /* @__PURE__ */ c.jsx("span", { style: { color: R.labelColor }, children: s });
943
969
  return /* @__PURE__ */ c.jsx(
944
- mt,
970
+ xt,
945
971
  {
946
972
  formatter: t,
947
973
  wrapperStyle: {
948
- fontSize: $.fontSize,
949
- fontFamily: $.fontFamily,
974
+ fontSize: R.fontSize,
975
+ fontFamily: R.fontFamily,
950
976
  padding: e ? "1rem 0" : "0"
951
977
  }
952
978
  }
@@ -961,9 +987,9 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
961
987
  if (!e || !t || !t.length)
962
988
  return null;
963
989
  const i = {
964
- backgroundColor: $.tooltipBg,
965
- borderRadius: $.tooltipBorderRadius,
966
- color: $.tooltipColor,
990
+ backgroundColor: R.tooltipBg,
991
+ borderRadius: R.tooltipBorderRadius,
992
+ color: R.tooltipColor,
967
993
  padding: "8px 12px",
968
994
  border: "1px solid #e5e7eb"
969
995
  };
@@ -987,16 +1013,16 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
987
1013
  dataKey: e,
988
1014
  hide: t,
989
1015
  tick: {
990
- fill: $.labelColor,
991
- fontSize: $.fontSize
1016
+ fill: R.labelColor,
1017
+ fontSize: R.fontSize
992
1018
  }
993
1019
  }
994
1020
  ), pe = () => /* @__PURE__ */ c.jsx(
995
1021
  bt,
996
1022
  {
997
1023
  tick: {
998
- fill: $.labelColor,
999
- fontSize: $.fontSize
1024
+ fill: R.labelColor,
1025
+ fontSize: R.fontSize
1000
1026
  }
1001
1027
  }
1002
1028
  ), pn = (e) => {
@@ -1070,8 +1096,8 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1070
1096
  {
1071
1097
  x: j,
1072
1098
  y,
1073
- fill: $.labelColor,
1074
- color: $.labelColor,
1099
+ fill: R.labelColor,
1100
+ color: R.labelColor,
1075
1101
  textAnchor: "middle",
1076
1102
  dominantBaseline: "central",
1077
1103
  children: f
@@ -1122,7 +1148,7 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1122
1148
  "var(--color-primitive-palette-15-50)",
1123
1149
  "var(--color-primitive-palette-16-50)",
1124
1150
  "var(--color-primitive-palette-17-50)"
1125
- ], $ = {
1151
+ ], R = {
1126
1152
  fontFamily: "Roboto, sans-serif",
1127
1153
  fontSize: 12,
1128
1154
  labelColor: "var(--color-neutral-90)",
@@ -1134,20 +1160,20 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1134
1160
  if (!n)
1135
1161
  return /* @__PURE__ */ c.jsx("div", { children: "Not supported chart type" });
1136
1162
  const { fetchDataSource: d } = I(), [a, u] = S(!1), [f, _] = S([]), h = async () => {
1137
- var y, m;
1163
+ var y, x;
1138
1164
  try {
1139
1165
  u(!0);
1140
- const { jsonPathData: x, mapperData: g } = o, b = me(
1166
+ const { jsonPathData: m, mapperData: g } = o, b = xe(
1141
1167
  o,
1142
1168
  1
1143
1169
  ), N = await d(
1144
1170
  b,
1145
1171
  s,
1146
1172
  !1
1147
- ), p = x ? (y = Be(N == null ? void 0 : N.data, x, g)) == null ? void 0 : y.items : (m = N == null ? void 0 : N.data) == null ? void 0 : m.data;
1173
+ ), p = m ? (y = Be(N == null ? void 0 : N.data, m, g)) == null ? void 0 : y.items : (x = N == null ? void 0 : N.data) == null ? void 0 : x.data;
1148
1174
  _(p), u(!1);
1149
- } catch (x) {
1150
- alert(JSON.stringify(x)), u(!1);
1175
+ } catch (m) {
1176
+ alert(JSON.stringify(m)), u(!1);
1151
1177
  }
1152
1178
  };
1153
1179
  J(() => {
@@ -1161,7 +1187,7 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1161
1187
  }, vn = "_header_g1eri_1", En = "_header_content_g1eri_5", Ee = {
1162
1188
  header: vn,
1163
1189
  header_content: En
1164
- }, kn = ({ components: e = [] }) => /* @__PURE__ */ c.jsx("section", { className: ee(Ee.header, "avocado-dark-theme"), children: /* @__PURE__ */ c.jsx("div", { className: Ee.header_content, children: e.map((t, s) => /* @__PURE__ */ c.jsx(T, { children: t }, s)) }) }), A = (e, t, s, r) => {
1190
+ }, kn = ({ components: e = [] }) => /* @__PURE__ */ c.jsx("section", { className: ee(Ee.header, "avocado-dark-theme"), children: /* @__PURE__ */ c.jsx("div", { className: Ee.header_content, children: e.map((t, s) => /* @__PURE__ */ c.jsx($, { children: t }, s)) }) }), A = (e, t, s, r) => {
1165
1191
  var l;
1166
1192
  const i = {
1167
1193
  accordion: (n) => /* @__PURE__ */ c.jsx(hr, { ...n, userFlow: e, pageId: t }),
@@ -1174,8 +1200,8 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1174
1200
  chart: (n) => /* @__PURE__ */ c.jsx(Nn, { ...n, userFlow: e }),
1175
1201
  checkbox: (n) => /* @__PURE__ */ c.jsx(an, { ...n, userFlow: e, pageId: t }),
1176
1202
  code: (n) => /* @__PURE__ */ c.jsx(un, { ...n, userFlow: e, pageId: t }),
1177
- divider: (n) => /* @__PURE__ */ c.jsx(xn, { ...n }),
1178
- drawer: (n) => /* @__PURE__ */ c.jsx(mr, { ...n, userFlow: e, pageId: t }),
1203
+ divider: (n) => /* @__PURE__ */ c.jsx(mn, { ...n }),
1204
+ drawer: (n) => /* @__PURE__ */ c.jsx(xr, { ...n, userFlow: e, pageId: t }),
1179
1205
  heading: (n) => It(n),
1180
1206
  pill: (n) => /* @__PURE__ */ c.jsx($n, { ...n }),
1181
1207
  modal: (n) => /* @__PURE__ */ c.jsx(An, { ...n, userFlow: e, pageId: t }),
@@ -1205,25 +1231,25 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1205
1231
  headerStatusColor: l,
1206
1232
  ...n
1207
1233
  }) => {
1208
- const d = v((x) => {
1234
+ const d = v((m) => {
1209
1235
  var g;
1210
- return (g = x[e]) == null ? void 0 : g.isModalOpen;
1211
- }), a = v((x) => {
1236
+ return (g = m[e]) == null ? void 0 : g.isModalOpen;
1237
+ }), a = v((m) => {
1212
1238
  var g;
1213
- return (g = x[e]) == null ? void 0 : g.isLoading;
1239
+ return (g = m[e]) == null ? void 0 : g.isLoading;
1214
1240
  }), u = d && !a, f = {
1215
1241
  ...n
1216
1242
  }, _ = (f == null ? void 0 : f.headerStatusColor) ?? l, h = D(() => {
1217
- ye(e), xe(e, !1);
1218
- }, [e, s]), j = Array.isArray(r) ? A(e, t, r) : r, y = A(e, t, i), m = A(e, t, o);
1243
+ ye(e), me(e, !1);
1244
+ }, [e, s]), j = Array.isArray(r) ? A(e, t, r) : r, y = A(e, t, i), x = A(e, t, o);
1219
1245
  return /* @__PURE__ */ c.jsx(
1220
1246
  Pe,
1221
1247
  {
1222
1248
  ...f,
1223
1249
  headerStatusColor: _,
1224
- header: typeof j == "string" ? j : /* @__PURE__ */ c.jsx(c.Fragment, { children: j.map((x, g) => /* @__PURE__ */ c.jsx(T, { children: x }, `modal-header-${g}`)) }),
1225
- children: /* @__PURE__ */ c.jsx("section", { className: qn.modalContent, children: y.map((x, g) => /* @__PURE__ */ c.jsx(T, { children: x }, `modal-body-${g}`)) }),
1226
- actions: /* @__PURE__ */ c.jsx(c.Fragment, { children: m.map((x, g) => /* @__PURE__ */ c.jsx(T, { children: x }, `modal-footer-${g}`)) }),
1250
+ header: typeof j == "string" ? j : /* @__PURE__ */ c.jsx(c.Fragment, { children: j.map((m, g) => /* @__PURE__ */ c.jsx($, { children: m }, `modal-header-${g}`)) }),
1251
+ children: /* @__PURE__ */ c.jsx("section", { className: qn.modalContent, children: y.map((m, g) => /* @__PURE__ */ c.jsx($, { children: m }, `modal-body-${g}`)) }),
1252
+ actions: /* @__PURE__ */ c.jsx(c.Fragment, { children: x.map((m, g) => /* @__PURE__ */ c.jsx($, { children: m }, `modal-footer-${g}`)) }),
1227
1253
  open: u,
1228
1254
  onClose: h
1229
1255
  }
@@ -1244,7 +1270,7 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1244
1270
  );
1245
1271
  return /* @__PURE__ */ c.jsx(c.Fragment, { children: i == null ? void 0 : i.map((n, d) => {
1246
1272
  const a = `overlay-${d}-${s == null ? void 0 : s.hash}`;
1247
- return /* @__PURE__ */ c.jsx(T, { children: n }, a);
1273
+ return /* @__PURE__ */ c.jsx($, { children: n }, a);
1248
1274
  }) });
1249
1275
  }, Tn = {
1250
1276
  success: {
@@ -1299,34 +1325,34 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1299
1325
  }, h = (_ == null ? void 0 : _.disabled) ?? f, j = D(async () => {
1300
1326
  var y;
1301
1327
  try {
1302
- const m = {
1328
+ const x = {
1303
1329
  ...(y = v.getState()[t]) == null ? void 0 : y.entries,
1304
1330
  [r]: { status: 200 }
1305
1331
  };
1306
- switch (L(t, m), i) {
1332
+ switch (L(t, x), i) {
1307
1333
  case "GO_TO_NEXT_UI": {
1308
- const x = await a(
1334
+ const m = await a(
1309
1335
  t,
1310
1336
  s,
1311
- m,
1337
+ x,
1312
1338
  r
1313
1339
  );
1314
- x != null && x.data && q(t, x == null ? void 0 : x.data);
1340
+ m != null && m.data && q(t, m == null ? void 0 : m.data);
1315
1341
  break;
1316
1342
  }
1317
1343
  case "FETCH_AND_GO_TO_NEXT_UI": {
1318
- const x = await u(
1344
+ const m = await u(
1319
1345
  t,
1320
1346
  s,
1321
- m,
1347
+ x,
1322
1348
  r,
1323
1349
  o
1324
1350
  );
1325
- x != null && x.data && q(t, x == null ? void 0 : x.data);
1351
+ m != null && m.data && q(t, m == null ? void 0 : m.data);
1326
1352
  break;
1327
1353
  }
1328
1354
  case "CLOSE_MODAL":
1329
- xe(t, !1);
1355
+ me(t, !1);
1330
1356
  break;
1331
1357
  case "CLOSE_DRAWER":
1332
1358
  Z(t, !1);
@@ -1338,8 +1364,8 @@ const fn = "_dividerNotFront_tze3j_1", yn = {
1338
1364
  console.warn(`Unhandled actionType: ${i}`);
1339
1365
  break;
1340
1366
  }
1341
- } catch (m) {
1342
- alert(JSON.stringify(m));
1367
+ } catch (x) {
1368
+ alert(JSON.stringify(x));
1343
1369
  }
1344
1370
  }, [i, o, s, r, t]);
1345
1371
  return /* @__PURE__ */ c.jsx(
@@ -1546,11 +1572,11 @@ const In = (e, t, s, r) => {
1546
1572
  }, { getNextUI: u, fetchDataSource: f } = I(), [_, h] = S((a == null ? void 0 : a.value) ?? ""), { disabled: j } = M(
1547
1573
  e,
1548
1574
  l
1549
- ), y = (a == null ? void 0 : a.disabled) ?? j, m = R(() => r && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, r]), x = R(() => {
1575
+ ), y = (a == null ? void 0 : a.disabled) ?? j, x = O(() => r && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, r]), m = O(() => {
1550
1576
  const p = a != null && a.isMulti ? _ : [_], C = {};
1551
1577
  return typeof p == "object" && "length" in p && (p == null || p.forEach((w) => {
1552
- const E = JSON.stringify(w.value), O = JSON.stringify(w.label);
1553
- C[E] = w, O in C || (C[O] = w);
1578
+ const E = JSON.stringify(w.value), T = JSON.stringify(w.label);
1579
+ C[E] = w, T in C || (C[T] = w);
1554
1580
  })), C;
1555
1581
  }, [_]), g = Ie({
1556
1582
  userFlow: e,
@@ -1565,10 +1591,10 @@ const In = (e, t, s, r) => {
1565
1591
  }, N = async (p, C, { page: w }) => {
1566
1592
  const {
1567
1593
  jsonPathLabel: E,
1568
- jsonPathOptions: O,
1594
+ jsonPathOptions: T,
1569
1595
  jsonPathValue: k,
1570
1596
  jsonPathPagination: K
1571
- } = i, G = me(
1597
+ } = i, G = xe(
1572
1598
  i,
1573
1599
  w,
1574
1600
  p
@@ -1578,7 +1604,7 @@ const In = (e, t, s, r) => {
1578
1604
  !1
1579
1605
  ), ae = se == null ? void 0 : se.data, Ke = ae ? In(
1580
1606
  ae,
1581
- O,
1607
+ T,
1582
1608
  E,
1583
1609
  k
1584
1610
  ) : [], { hasMore: Ge } = zn(
@@ -1599,7 +1625,7 @@ const In = (e, t, s, r) => {
1599
1625
  {
1600
1626
  ...a,
1601
1627
  className: ze.selectNotFront,
1602
- label: m,
1628
+ label: x,
1603
1629
  value: _,
1604
1630
  disabled: y,
1605
1631
  noOptionsMessage: () => /* @__PURE__ */ c.jsx(c.Fragment, { children: "Sin opciones" }),
@@ -1608,7 +1634,7 @@ const In = (e, t, s, r) => {
1608
1634
  additional: { page: 1 },
1609
1635
  isOptionDisabled: (p) => {
1610
1636
  const C = JSON.stringify(p == null ? void 0 : p.value), w = JSON.stringify(p == null ? void 0 : p.label);
1611
- return !!(x != null && x[C]) || !!(x != null && x[w]);
1637
+ return !!(m != null && m[C]) || !!(m != null && m[w]);
1612
1638
  },
1613
1639
  debounceTimeout: 350
1614
1640
  }
@@ -1629,7 +1655,7 @@ const In = (e, t, s, r) => {
1629
1655
  }, { getNextUI: u } = I(), [f, _] = S(a.value || ""), { disabled: h } = M(
1630
1656
  e,
1631
1657
  l
1632
- ), j = (a == null ? void 0 : a.disabled) ?? h, y = R(() => i && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, i]), m = Ie({
1658
+ ), j = (a == null ? void 0 : a.disabled) ?? h, y = O(() => i && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, i]), x = Ie({
1633
1659
  userFlow: e,
1634
1660
  pageId: t,
1635
1661
  responseKey: s,
@@ -1637,8 +1663,8 @@ const In = (e, t, s, r) => {
1637
1663
  getNextUI: u,
1638
1664
  isMulti: a == null ? void 0 : a.isMulti,
1639
1665
  debounceMs: n
1640
- }), x = (g) => {
1641
- _(g), m(g);
1666
+ }), m = (g) => {
1667
+ _(g), x(g);
1642
1668
  };
1643
1669
  return /* @__PURE__ */ c.jsx(
1644
1670
  nt,
@@ -1648,7 +1674,7 @@ const In = (e, t, s, r) => {
1648
1674
  label: y,
1649
1675
  value: f,
1650
1676
  disabled: j,
1651
- onChange: (g) => !j && x(g)
1677
+ onChange: (g) => !j && m(g)
1652
1678
  }
1653
1679
  );
1654
1680
  }, Un = (e) => {
@@ -1683,7 +1709,7 @@ const In = (e, t, s, r) => {
1683
1709
  }, { getNextUI: f } = I(), [_, h] = S(l || !1), { disabled: j } = M(
1684
1710
  t,
1685
1711
  d
1686
- ), y = (u == null ? void 0 : u.disabled) ?? j, m = R(() => n && o ? `${o} *` : o ?? "", [o, n]), x = D(async () => {
1712
+ ), y = (u == null ? void 0 : u.disabled) ?? j, x = O(() => n && o ? `${o} *` : o ?? "", [o, n]), m = D(async () => {
1687
1713
  var g;
1688
1714
  try {
1689
1715
  const b = !_;
@@ -1714,10 +1740,10 @@ const In = (e, t, s, r) => {
1714
1740
  rt,
1715
1741
  {
1716
1742
  ...u,
1717
- label: m,
1743
+ label: x,
1718
1744
  checked: _,
1719
1745
  disabled: y,
1720
- onChange: () => !y && x()
1746
+ onChange: () => !y && m()
1721
1747
  }
1722
1748
  );
1723
1749
  }, tr = "_tableSkeleton_3nr9n_1", nr = "_tableArrayPills_3nr9n_7", Me = {
@@ -1749,19 +1775,19 @@ const In = (e, t, s, r) => {
1749
1775
  responseKey: f,
1750
1776
  dataSource: _
1751
1777
  } = a.props, h = D(async () => {
1752
- var j, y, m;
1778
+ var j, y, x;
1753
1779
  try {
1754
- const x = {
1780
+ const m = {
1755
1781
  ...(j = v.getState()[e]) == null ? void 0 : j.entries,
1756
1782
  [f]: { status: 200 },
1757
1783
  [s]: [{ ...i }]
1758
1784
  };
1759
- switch (L(e, x), u) {
1785
+ switch (L(e, m), u) {
1760
1786
  case "GO_TO_NEXT_UI": {
1761
1787
  const g = await o(
1762
1788
  e,
1763
1789
  t,
1764
- x,
1790
+ m,
1765
1791
  f
1766
1792
  );
1767
1793
  g != null && g.data && q(e, g == null ? void 0 : g.data);
@@ -1771,7 +1797,7 @@ const In = (e, t, s, r) => {
1771
1797
  const g = await l(
1772
1798
  e,
1773
1799
  t,
1774
- x,
1800
+ m,
1775
1801
  f,
1776
1802
  _
1777
1803
  );
@@ -1782,7 +1808,7 @@ const In = (e, t, s, r) => {
1782
1808
  const g = await o(
1783
1809
  e,
1784
1810
  t,
1785
- x,
1811
+ m,
1786
1812
  f
1787
1813
  ), b = (y = g == null ? void 0 : g.data) == null ? void 0 : y.content;
1788
1814
  if ((b == null ? void 0 : b.type) !== "fetch")
@@ -1793,7 +1819,7 @@ const In = (e, t, s, r) => {
1793
1819
  // Avoid to handle loading state until all the requests are done
1794
1820
  !1
1795
1821
  ), C = {
1796
- ...(m = v.getState()[e]) == null ? void 0 : m.entries,
1822
+ ...(x = v.getState()[e]) == null ? void 0 : x.entries,
1797
1823
  [f]: {
1798
1824
  status: p == null ? void 0 : p.status,
1799
1825
  content: p == null ? void 0 : p.data
@@ -1813,8 +1839,8 @@ const In = (e, t, s, r) => {
1813
1839
  console.warn(`Unhandled actionType: ${u}`);
1814
1840
  break;
1815
1841
  }
1816
- } catch (x) {
1817
- alert(JSON.stringify(x));
1842
+ } catch (m) {
1843
+ alert(JSON.stringify(m));
1818
1844
  }
1819
1845
  }, [u, _, t, f, e]);
1820
1846
  return He(a, {
@@ -1838,7 +1864,7 @@ const In = (e, t, s, r) => {
1838
1864
  ...l
1839
1865
  }) => {
1840
1866
  var b, N, p;
1841
- const { fetchDataSource: n } = I(), [d, a] = S(!1), [u, f] = S(1), [_, h] = S(null), j = R(() => {
1867
+ const { fetchDataSource: n } = I(), [d, a] = S(!1), [u, f] = S(1), [_, h] = S(null), j = O(() => {
1842
1868
  if (o != null && o.length)
1843
1869
  return o.map((C, w) => ({
1844
1870
  renderContent: (E) => /* @__PURE__ */ c.jsx(
@@ -1856,7 +1882,7 @@ const In = (e, t, s, r) => {
1856
1882
  }, [o, e, t]), y = async (C = 1) => {
1857
1883
  try {
1858
1884
  a(!0);
1859
- const { jsonPathData: w, mapperData: E, jsonPathPagination: O } = i, k = me(
1885
+ const { jsonPathData: w, mapperData: E, jsonPathPagination: T } = i, k = xe(
1860
1886
  i,
1861
1887
  C
1862
1888
  ), K = await n(
@@ -1869,33 +1895,33 @@ const In = (e, t, s, r) => {
1869
1895
  K == null ? void 0 : K.data,
1870
1896
  w,
1871
1897
  E,
1872
- O
1898
+ T
1873
1899
  )
1874
1900
  ), a(!1);
1875
1901
  } catch (w) {
1876
1902
  alert(JSON.stringify(w)), a(!1);
1877
1903
  }
1878
- }, m = (C) => {
1904
+ }, x = (C) => {
1879
1905
  f(C), y(C);
1880
1906
  };
1881
1907
  J(() => {
1882
1908
  y();
1883
1909
  }, []);
1884
- const x = R(() => !(_ != null && _.items) || !(l != null && l.columns) ? l == null ? void 0 : l.columns : l.columns.map((C) => {
1910
+ const m = O(() => !(_ != null && _.items) || !(l != null && l.columns) ? l == null ? void 0 : l.columns : l.columns.map((C) => {
1885
1911
  var E;
1886
1912
  return ((E = _ == null ? void 0 : _.items) == null ? void 0 : E.some(
1887
- (O) => Array.isArray(C != null && C.accessor ? O[C == null ? void 0 : C.accessor] : void 0)
1913
+ (T) => Array.isArray(C != null && C.accessor ? T[C == null ? void 0 : C.accessor] : void 0)
1888
1914
  )) ? {
1889
1915
  ...C,
1890
- renderCell: (O) => {
1891
- const k = C.accessor ? O[C.accessor] : void 0;
1916
+ renderCell: (T) => {
1917
+ const k = C.accessor ? T[C.accessor] : void 0;
1892
1918
  return Array.isArray(k) ? /* @__PURE__ */ c.jsx(rr, { values: k }) : k;
1893
1919
  }
1894
1920
  } : C;
1895
1921
  }), [_ == null ? void 0 : _.items, l == null ? void 0 : l.columns]), g = {
1896
1922
  ...l,
1897
1923
  data: _ == null ? void 0 : _.items,
1898
- columns: x,
1924
+ columns: m,
1899
1925
  rightActions: j
1900
1926
  };
1901
1927
  return /* @__PURE__ */ c.jsx(c.Fragment, { children: d ? /* @__PURE__ */ c.jsx(ar, {}) : _ && ((b = _ == null ? void 0 : _.items) == null ? void 0 : b.length) > 0 ? /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
@@ -1907,7 +1933,7 @@ const In = (e, t, s, r) => {
1907
1933
  page: u,
1908
1934
  size: _ == null ? void 0 : _.pagination.size,
1909
1935
  total: (p = _ == null ? void 0 : _.pagination) == null ? void 0 : p.total,
1910
- onChange: m
1936
+ onChange: x
1911
1937
  }
1912
1938
  )
1913
1939
  ] }) : /* @__PURE__ */ c.jsx(he, { state: "info", title: "Sin registros", children: "No hay datos disponibles para mostrar en este momento" }) });
@@ -1928,12 +1954,12 @@ const In = (e, t, s, r) => {
1928
1954
  }, [u, f] = S((a == null ? void 0 : a.value) ?? ""), { disabled: _ } = M(
1929
1955
  t,
1930
1956
  n
1931
- ), h = (a == null ? void 0 : a.disabled) ?? _, j = R(() => l && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, l]), y = (m) => {
1957
+ ), h = (a == null ? void 0 : a.disabled) ?? _, j = O(() => l && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, l]), y = (x) => {
1932
1958
  var b;
1933
- const x = (b = m == null ? void 0 : m.target) == null ? void 0 : b.value;
1934
- f(x);
1959
+ const m = (b = x == null ? void 0 : x.target) == null ? void 0 : b.value;
1960
+ f(m);
1935
1961
  const g = {
1936
- [o]: x
1962
+ [o]: m
1937
1963
  };
1938
1964
  L(t, g);
1939
1965
  };
@@ -1948,7 +1974,7 @@ const In = (e, t, s, r) => {
1948
1974
  label: j,
1949
1975
  value: u,
1950
1976
  disabled: h,
1951
- onChange: (m) => !h && y(m)
1977
+ onChange: (x) => !h && y(x)
1952
1978
  }
1953
1979
  );
1954
1980
  }, dr = ({
@@ -2005,7 +2031,7 @@ const In = (e, t, s, r) => {
2005
2031
  ), { disabled: _ } = M(
2006
2032
  t,
2007
2033
  i
2008
- ), h = A(t, s, n), j = l ? A(t, s, l) : void 0, y = o ? A(t, s, o) : void 0, m = D(
2034
+ ), h = A(t, s, n), j = l ? A(t, s, l) : void 0, y = o ? A(t, s, o) : void 0, x = D(
2009
2035
  async (b) => {
2010
2036
  var N;
2011
2037
  try {
@@ -2029,22 +2055,22 @@ const In = (e, t, s, r) => {
2029
2055
  }
2030
2056
  },
2031
2057
  [t, s, r, d.actionType, a]
2032
- ), x = d.disabled || _, g = {
2058
+ ), m = d.disabled || _, g = {
2033
2059
  ...d,
2034
2060
  className: Se.accordion,
2035
- disabled: x,
2061
+ disabled: m,
2036
2062
  checkboxChecked: u,
2037
- onChanceCheckbox: d.hasCheckbox ? m : void 0,
2038
- actionContent: j ? /* @__PURE__ */ c.jsx(c.Fragment, { children: j.map((b, N) => /* @__PURE__ */ c.jsx(T, { children: b }, `accordion-action-${N}`)) }) : void 0,
2039
- customContent: y ? /* @__PURE__ */ c.jsx(c.Fragment, { children: y.map((b, N) => /* @__PURE__ */ c.jsx(T, { children: b }, `accordion-custom-${N}`)) }) : void 0,
2040
- children: h ? /* @__PURE__ */ c.jsx("section", { className: Se.accordionBody, children: h.map((b, N) => /* @__PURE__ */ c.jsx(T, { children: b }, `accordion-child-${N}`)) }) : void 0
2063
+ onChanceCheckbox: d.hasCheckbox ? x : void 0,
2064
+ actionContent: j ? /* @__PURE__ */ c.jsx(c.Fragment, { children: j.map((b, N) => /* @__PURE__ */ c.jsx($, { children: b }, `accordion-action-${N}`)) }) : void 0,
2065
+ customContent: y ? /* @__PURE__ */ c.jsx(c.Fragment, { children: y.map((b, N) => /* @__PURE__ */ c.jsx($, { children: b }, `accordion-custom-${N}`)) }) : void 0,
2066
+ children: h ? /* @__PURE__ */ c.jsx("section", { className: Se.accordionBody, children: h.map((b, N) => /* @__PURE__ */ c.jsx($, { children: b }, `accordion-child-${N}`)) }) : void 0
2041
2067
  };
2042
2068
  return /* @__PURE__ */ c.jsx(ct, { ...g });
2043
- }, fr = "_drawer_13pxo_1", yr = "_drawerBody_13pxo_5", xr = "_drawerFooter_13pxo_11", le = {
2069
+ }, fr = "_drawer_13pxo_1", yr = "_drawerBody_13pxo_5", mr = "_drawerFooter_13pxo_11", le = {
2044
2070
  drawer: fr,
2045
2071
  drawerBody: yr,
2046
- drawerFooter: xr
2047
- }, mr = ({
2072
+ drawerFooter: mr
2073
+ }, xr = ({
2048
2074
  userFlow: e,
2049
2075
  pageId: t,
2050
2076
  responseKey: s,
@@ -2054,11 +2080,11 @@ const In = (e, t, s, r) => {
2054
2080
  ...l
2055
2081
  }) => {
2056
2082
  const n = v((y) => {
2057
- var m;
2058
- return (m = y[e]) == null ? void 0 : m.isDrawerOpen;
2083
+ var x;
2084
+ return (x = y[e]) == null ? void 0 : x.isDrawerOpen;
2059
2085
  }), d = v((y) => {
2060
- var m;
2061
- return (m = y[e]) == null ? void 0 : m.isLoading;
2086
+ var x;
2087
+ return (x = y[e]) == null ? void 0 : x.isLoading;
2062
2088
  }), a = n && !d, u = {
2063
2089
  ...l,
2064
2090
  isOpen: a,
@@ -2074,9 +2100,9 @@ const In = (e, t, s, r) => {
2074
2100
  isOpen: a,
2075
2101
  onClose: f,
2076
2102
  heightGap: 0,
2077
- title: _ ? /* @__PURE__ */ c.jsx(c.Fragment, { children: Array.isArray(_) ? _.map((y, m) => /* @__PURE__ */ c.jsx(T, { children: y }, `drawer-header-${m}`)) : _ }) : void 0,
2078
- children: /* @__PURE__ */ c.jsx("section", { className: le.drawerBody, children: h.map((y, m) => /* @__PURE__ */ c.jsx(T, { children: y }, `drawer-body-${m}`)) }),
2079
- footer: j ? /* @__PURE__ */ c.jsx("div", { className: le.drawerFooter, children: j.map((y, m) => /* @__PURE__ */ c.jsx(T, { children: y }, `drawer-footer-${m}`)) }) : void 0
2103
+ title: _ ? /* @__PURE__ */ c.jsx(c.Fragment, { children: Array.isArray(_) ? _.map((y, x) => /* @__PURE__ */ c.jsx($, { children: y }, `drawer-header-${x}`)) : _ }) : void 0,
2104
+ children: /* @__PURE__ */ c.jsx("section", { className: le.drawerBody, children: h.map((y, x) => /* @__PURE__ */ c.jsx($, { children: y }, `drawer-body-${x}`)) }),
2105
+ footer: j ? /* @__PURE__ */ c.jsx("div", { className: le.drawerFooter, children: j.map((y, x) => /* @__PURE__ */ c.jsx($, { children: y }, `drawer-footer-${x}`)) }) : void 0
2080
2106
  }
2081
2107
  );
2082
2108
  }, qe = (e, t, s, r, i) => {
@@ -2122,7 +2148,7 @@ const In = (e, t, s, r) => {
2122
2148
  "body",
2123
2149
  ((j = l[e].pages[n].page) == null ? void 0 : j.body) || null,
2124
2150
  r
2125
- ) : null, u = R(() => {
2151
+ ) : null, u = O(() => {
2126
2152
  var y;
2127
2153
  return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
2128
2154
  ((y = l[e]) == null ? void 0 : y.isLoading) && /* @__PURE__ */ c.jsx(lt, {}),
@@ -2134,13 +2160,13 @@ const In = (e, t, s, r) => {
2134
2160
  }, [d, a, n, e]), f = async () => {
2135
2161
  var y;
2136
2162
  try {
2137
- const m = await De(
2163
+ const x = await De(
2138
2164
  t,
2139
2165
  e
2140
- ), x = (y = m == null ? void 0 : m.data) == null ? void 0 : y.content;
2141
- (m == null ? void 0 : m.status) === 200 ? oe(e, t, x) : o(!0);
2142
- } catch (m) {
2143
- console.error("[not-page]: API call failed", m), o(!0);
2166
+ ), m = (y = x == null ? void 0 : x.data) == null ? void 0 : y.content;
2167
+ (x == null ? void 0 : x.status) === 200 ? oe(e, t, m) : o(!0);
2168
+ } catch (x) {
2169
+ console.error("[not-page]: API call failed", x), o(!0);
2144
2170
  }
2145
2171
  };
2146
2172
  return J(() => {
@@ -2149,12 +2175,12 @@ const In = (e, t, s, r) => {
2149
2175
  "not api config",
2150
2176
  "not userFlow"
2151
2177
  ));
2152
- const y = "avocado-theme-mode-changed", m = (x) => {
2153
- const g = x.detail;
2178
+ const y = "avocado-theme-mode-changed", x = (m) => {
2179
+ const g = m.detail;
2154
2180
  ue.setThemeMode(g);
2155
2181
  };
2156
- return window.addEventListener(y, m), () => {
2157
- window.removeEventListener(y, m);
2182
+ return window.addEventListener(y, x), () => {
2183
+ window.removeEventListener(y, x);
2158
2184
  };
2159
2185
  }, []), i && console.error("[not-page]: No render page"), u;
2160
2186
  };
@@ -1,4 +1,4 @@
1
- (function(A,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("axios"),require("zustand"),require("react"),require("@foris/avocado-suite"),require("@foris/ai-agent"),require("@uiw/react-codemirror"),require("@codemirror/lang-json"),require("@codemirror/lang-markdown"),require("@codemirror/lang-sql"),require("@codemirror/lang-yaml"),require("jsonpath"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","axios","zustand","react","@foris/avocado-suite","@foris/ai-agent","@uiw/react-codemirror","@codemirror/lang-json","@codemirror/lang-markdown","@codemirror/lang-sql","@codemirror/lang-yaml","jsonpath","recharts"],L):(A=typeof globalThis<"u"?globalThis:A||self,L(A["avocado-not-front"]={},A.axios,A.zustand,A.React,A.AvocadoSuite,A.AiAgent,A.ReactCodeMirror,A.CodeMirrorLangJson,A.CodeMirrorLangMarkdown,A.CodeMirrorLangSql,A.CodeMirrorLangYaml,A.jsonpath,A.Recharts))})(this,function(A,L,Be,x,E,he,ze,fe,Ie,Ke,Ge,z,O){"use strict";const v=Be.create(()=>({})),te=(e,t,r)=>{const s=r==null?void 0:r.hash;v.setState(l=>{var o;return{...l,[e]:{...l[e],apiConfig:t,currentPageId:s,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:{},overlay:null,pages:{...(o=l[e])==null?void 0:o.pages,[s]:{page:r}}}}})},ye=(e,t)=>t.length===0?e:Object.fromEntries(Object.entries(e).filter(([r])=>!t.includes(r))),Ue=(e,t,r,s)=>{sessionStorage.setItem("sessionId",r),v.setState(l=>{const o=l[e]??{},i=o.entries??{},n=ye(i,s);return{...l,[e]:{...o,currentPageId:t.hash,entries:n,isLoading:!1,overlay:null,pages:{...o.pages,[t.hash]:{page:{...t}}}}}})},Ve=(e,t,r)=>{v.setState(s=>{var d;const l=s[e]??{},o=l.entries??{},i=ye(o,r),n=(d=t.components)==null?void 0:d.some(a=>a.component==="drawer");return{...s,[e]:{...l,entries:i,overlay:t,isLoading:!1,isModalOpen:!n,isDrawerOpen:!!n}}})},ne=e=>{v.setState(t=>({...t,[e]:{...t[e],overlay:null}}))},Je=e=>{var r;return((r=v.getState()[e])==null?void 0:r.overlay)??null},R=(e,t)=>{const{content:r,sessionId:s,deprecatedStateKeys:l=[]}=t;r.type!=="page"&&r.type!=="overlay"||(r.type==="page"?Ue(e,r,s,l):Ve(e,r,l))},M=(e,t)=>{v.setState(r=>{var s;return{...r,[e]:{...r[e],entries:{...(s=r[e])==null?void 0:s.entries,...t}}}})},H=(e,t)=>{v.setState(r=>({...r,[e]:{...r[e],isLoading:t}}))},se=(e,t)=>{v.setState(r=>({...r,[e]:{...r[e],isModalOpen:t}}))},X=(e,t)=>{v.setState(r=>({...r,[e]:{...r[e],isDrawerOpen:t}}))},me=(e,t)=>{v.setState(r=>{const s=r[e];return s?{...r,[e]:{...s,apiConfig:{...s.apiConfig,headers:t}}}:r})};let re=!1,F=[],ge=!1;const He=e=>e._userFlow||null,xe=e=>{F.forEach(({resolve:t,reject:r})=>{e?r(e):t(void 0)}),F=[]},We=async e=>{var s,l;const t=e==null?void 0:e.config;if(((s=e==null?void 0:e.response)==null?void 0:s.status)===401&&!t._retry){const o=He(t);if(o){const n=(l=v.getState()[o])==null?void 0:l.apiConfig;if(!n)return Promise.reject(e);if(n.onAuthenticationError||typeof n.headers=="function"){if(re)return new Promise((a,u)=>{F.push({resolve:a,reject:u})}).then(()=>L(t)).catch(a=>(console.error("[axiosInterceptors] Queued request failed:",a),Promise.reject(a)));t._retry=!0,re=!0;try{let a;if(n.onAuthenticationError)a=await n.onAuthenticationError();else if(typeof n.headers=="function")a=n.headers();else throw new Error("No refresh handler available");return n.onAuthenticationError&&(typeof n.headers=="string"?me(o,JSON.stringify(a)):me(o,a)),t.headers||(t.headers={}),Object.assign(t.headers,a),xe(null),L(t)}catch(a){return console.error("[axiosInterceptors] Token refresh failed:",a),console.error("[axiosInterceptors] Rejecting queued requests:",F.length),xe(a),Promise.reject(a)}finally{re=!1}}else console.warn("[axiosInterceptors] No refresh handler available, rejecting request")}else console.warn("[axiosInterceptors] No userFlow found in URL:",t.url)}return Promise.reject(e)};(()=>{if(ge){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),L.interceptors.response.use(void 0,We),console.debug("[axiosInterceptors] Response error interceptor registered"),ge=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function Xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pe={exports:{}},Q={};/**
1
+ (function(A,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("axios"),require("zustand"),require("react"),require("@foris/avocado-suite"),require("@foris/ai-agent"),require("@uiw/react-codemirror"),require("@codemirror/lang-json"),require("@codemirror/lang-markdown"),require("@codemirror/lang-sql"),require("@codemirror/lang-yaml"),require("jsonpath"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","axios","zustand","react","@foris/avocado-suite","@foris/ai-agent","@uiw/react-codemirror","@codemirror/lang-json","@codemirror/lang-markdown","@codemirror/lang-sql","@codemirror/lang-yaml","jsonpath","recharts"],L):(A=typeof globalThis<"u"?globalThis:A||self,L(A["avocado-not-front"]={},A.axios,A.zustand,A.React,A.AvocadoSuite,A.AiAgent,A.ReactCodeMirror,A.CodeMirrorLangJson,A.CodeMirrorLangMarkdown,A.CodeMirrorLangSql,A.CodeMirrorLangYaml,A.jsonpath,A.Recharts))})(this,function(A,L,Be,x,E,he,ze,fe,Ie,Ke,Ge,z,O){"use strict";const v=Be.create(()=>({})),te=(e,t,a)=>{const s=a==null?void 0:a.hash;v.setState(l=>{var o;return{...l,[e]:{...l[e],apiConfig:t,currentPageId:s,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:{},overlay:null,pages:{...(o=l[e])==null?void 0:o.pages,[s]:{page:a}}}}})},ye=(e,t,a)=>{const s=a&&Object.keys(a).length>0?{...e,...a}:e;return t.length===0?e:Object.fromEntries(Object.entries(s).filter(([l])=>!t.includes(l)))},Ue=(e,t,a,s,l)=>{sessionStorage.setItem("sessionId",a),v.setState(o=>{const i=o[e]??{},n=i.entries??{},d=ye(n,s,l);return{...o,[e]:{...i,currentPageId:t.hash,entries:d,isLoading:!1,overlay:null,pages:{...i.pages,[t.hash]:{page:{...t}}}}}})},Ve=(e,t,a,s)=>{v.setState(l=>{var r;const o=l[e]??{},i=o.entries??{},n=ye(i,a,s),d=(r=t.components)==null?void 0:r.some(u=>u.component==="drawer");return{...l,[e]:{...o,entries:n,overlay:t,isLoading:!1,isModalOpen:!d,isDrawerOpen:!!d}}})},ne=e=>{v.setState(t=>({...t,[e]:{...t[e],overlay:null}}))},Je=e=>{var a;return((a=v.getState()[e])==null?void 0:a.overlay)??null},R=(e,t)=>{const{content:a,sessionId:s,deprecatedStateKeys:l=[],sessionState:o={}}=t;a.type!=="page"&&a.type!=="overlay"||(a.type==="page"?Ue(e,a,s,l,o):Ve(e,a,l,o))},M=(e,t)=>{v.setState(a=>{var s;return{...a,[e]:{...a[e],entries:{...(s=a[e])==null?void 0:s.entries,...t}}}})},H=(e,t)=>{v.setState(a=>({...a,[e]:{...a[e],isLoading:t}}))},se=(e,t)=>{v.setState(a=>({...a,[e]:{...a[e],isModalOpen:t}}))},X=(e,t)=>{v.setState(a=>({...a,[e]:{...a[e],isDrawerOpen:t}}))},me=(e,t)=>{v.setState(a=>{const s=a[e];return s?{...a,[e]:{...s,apiConfig:{...s.apiConfig,headers:t}}}:a})};let ae=!1,F=[],ge=!1;const He=e=>e._userFlow||null,xe=e=>{F.forEach(({resolve:t,reject:a})=>{e?a(e):t(void 0)}),F=[]},We=async e=>{var s,l;const t=e==null?void 0:e.config;if(((s=e==null?void 0:e.response)==null?void 0:s.status)===401&&!t._retry){const o=He(t);if(o){const n=(l=v.getState()[o])==null?void 0:l.apiConfig;if(!n)return Promise.reject(e);if(n.onAuthenticationError||typeof n.headers=="function"){if(ae)return new Promise((r,u)=>{F.push({resolve:r,reject:u})}).then(()=>L(t)).catch(r=>(console.error("[axiosInterceptors] Queued request failed:",r),Promise.reject(r)));t._retry=!0,ae=!0;try{let r;if(n.onAuthenticationError)r=await n.onAuthenticationError();else if(typeof n.headers=="function")r=n.headers();else throw new Error("No refresh handler available");return n.onAuthenticationError&&(typeof n.headers=="string"?me(o,JSON.stringify(r)):me(o,r)),t.headers||(t.headers={}),Object.assign(t.headers,r),xe(null),L(t)}catch(r){return console.error("[axiosInterceptors] Token refresh failed:",r),console.error("[axiosInterceptors] Rejecting queued requests:",F.length),xe(r),Promise.reject(r)}finally{ae=!1}}else console.warn("[axiosInterceptors] No refresh handler available, rejecting request")}else console.warn("[axiosInterceptors] No userFlow found in URL:",t.url)}return Promise.reject(e)};(()=>{if(ge){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),L.interceptors.response.use(void 0,We),console.debug("[axiosInterceptors] Response error interceptor registered"),ge=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function Xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pe={exports:{}},Q={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var be;function Qe(){if(be)return Q;be=1;var e=x,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(n,d,a){var u,f={},_=null,h=null;a!==void 0&&(_=""+a),d.key!==void 0&&(_=""+d.key),d.ref!==void 0&&(h=d.ref);for(u in d)s.call(d,u)&&!o.hasOwnProperty(u)&&(f[u]=d[u]);if(n&&n.defaultProps)for(u in d=n.defaultProps,d)f[u]===void 0&&(f[u]=d[u]);return{$$typeof:t,type:n,key:_,ref:h,props:f,_owner:l.current}}return Q.Fragment=r,Q.jsx=i,Q.jsxs=i,Q}pe.exports=Qe();var c=pe.exports;const Ce=e=>{if(!(e!=null&&e.content))return null;const t={...e,children:e.content,type:e.variant};return c.jsx(E.Heading,{...t})},je=e=>{if(!e)return null;const t={...e,children:e.content};return c.jsx(E.Text,{...t})},Ye=e=>(x.useEffect(()=>{e!=null&&e.chatPanelCallback&&(e==null||e.chatPanelCallback(e))},[e==null?void 0:e.chatPanelCallback]),null),Ze={summaryCard:"_summaryCard_jva4h_1"},Fe=e=>{var t,r,s;return c.jsx("section",{className:Ze.summaryCard,children:c.jsx(he.SummaryCard,{api:(t=e==null?void 0:e.dataSource)==null?void 0:t.url,body:(r=e==null?void 0:e.dataSource)==null?void 0:r.data,headers:(s=e==null?void 0:e.dataSource)==null?void 0:s.headers,...e})})},K=(e,t)=>{const r=v(s=>{var l;return((l=s[e])==null?void 0:l.entries)||{}});return x.useMemo(()=>{const s={disabled:!1};return!t||t.length===0||t.forEach(l=>{const o=r[l.key],i=o==null||o===""||Array.isArray(o)&&o.length===0;l.when==="empty"&&i&&l.actions.forEach(d=>{s[d]=!0})}),s},[t,r])},$e={promptCodeEditor:"_promptCodeEditor_1d57s_1"},Pe=e=>{const{userFlow:t,responseKey:r,codeBlockValue:s,language:l,disabled:o,dependencies:i,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:u}=e,f=E.ThemeStore.useThemeStore(C=>C.theme.mode),[_,h]=x.useState(s||""),{disabled:j}=K(t,i),y=o??j,g=l??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},p=C=>{h(C);const k={[r]:C};M(t,k)};return x.useEffect(()=>{s!==void 0&&s!==_&&h(s)},[s]),c.jsx("section",{className:$e.promptCodeEditor,children:c.jsx(he.PromptCodeEditor,{themeMode:f,requestConfig:m,language:g,disabled:y,inputLabel:d,inputPlaceholder:a,codeBlockLabel:u,codeBlockValue:_,onCodeChange:p})})},we={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},et=({inputs:e})=>c.jsx("section",{className:we.body,children:c.jsx("div",{className:we.body_content,children:e.map((t,r)=>c.jsx(x.Fragment,{children:t},r))})}),W=e=>{if(!e)return{"content-type":"application/json"};if(typeof e=="function")return e();if(typeof e=="string")try{return JSON.parse(e)}catch{return{"content-type":"application/json",Authorization:e}}return e},Y=()=>new AbortController,tt=(e,t={},r={},s=!1,l)=>{const o=Y();s&&o.abort();const i=W(t);return{call:L.get(e,{headers:{...i},params:r,signal:o.signal,_userFlow:l}),controller:o}},ae=(e,t={},r={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.post(e,r,{headers:{...n},params:s,signal:i.signal,_userFlow:o}),controller:i}},nt=(e,t={},r={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.put(e,r,{headers:{...n},params:s,signal:i.signal,_userFlow:o}),controller:i}},st=(e,t={},r={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.patch(e,r,{headers:{...n},params:s,signal:i.signal,_userFlow:o}),controller:i}},rt=(e,t={},r={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.delete(e,{headers:{...n},data:r,params:s,signal:i.signal,_userFlow:o}),controller:i}},Ne=()=>{let e;return{callEndpoint:async s=>{s.controller&&(e=s.controller);let l={};try{l=await s.call}catch(o){throw o}return l},cancelEndpoint:()=>{e&&e.abort()}}},Ee=async(e,t,r="",s={},l={})=>{try{const{callEndpoint:o}=Ne(),{api:i,headers:n}=e,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:t});r&&a.append("hash_code",r),d&&a.append("sessionId",d);const u=`${i}/not-front/next-ui/?${a.toString()}`,f=W(n),_=ae(u,f,s,l,!1,t);return await o(_)}catch(o){return console.error(o),Promise.reject(o)}},I=()=>{const e=v(n=>n),{callEndpoint:t}=Ne(),r=async(n,d,a,u,f=!0)=>{var _;try{const h=(_=e[n])==null?void 0:_.apiConfig,j={state:{...a},triggerKey:u};return f&&H(n,!0),await Ee(h,n,d,j)}catch(h){throw f&&H(n,!1),console.error("[getNextUI] Error fetching next UI:",h),h}},s=(n,d)=>{const{method:a,url:u,headers:f,data:_,params:h}=n;switch(a){case"post":return ae(u,f,_,{},!1,d);case"put":return nt(u,f,_,{},!1,d);case"patch":return st(u,f,_,{},!1,d);case"delete":return rt(u,f,_,h,!1,d);case"get":default:return tt(u,f,h,!1,d)}},l=(n,d)=>{const{url:a,headers:u}=n,f={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return ae(a,{...u,"Content-Type":"application/json"},f,{},!1,d)},o=async(n,d,a=!0)=>{var u,f;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&H(d,!0);try{let _;switch(n==null?void 0:n.type){case"rest":_=s(n,d);break;case"graphql":_=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await t(_)}catch(_){const h=_;return console.error("[fetchDataSource] Error:",h),{status:((u=h==null?void 0:h.response)==null?void 0:u.status)??0,data:((f=h==null?void 0:h.response)==null?void 0:f.data)??{message:h==null?void 0:h.message,code:h==null?void 0:h.code,config:h==null?void 0:h.config}}}finally{a&&H(d,!1)}};return{getNextUI:r,fetchDataSource:o,fetchAndGetNextUI:async(n,d,a,u,f)=>{try{H(n,!0);const _=await o(f,n,!1);return _&&await r(n,d,a,u)}catch(_){throw H(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",_),_}}}},at=({userFlow:e,items:t,responseKey:r})=>{const{getNextUI:s}=I(),l=x.useCallback(async({actionType:i,hashCode:n,redirectUrl:d})=>{var a;try{switch(i){case"GO_TO_NEXT_UI":const u=await s(e,n,{...(a=v.getState()[e])==null?void 0:a.entries},r);u!=null&&u.data&&R(e,u==null?void 0:u.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(u){alert(JSON.stringify(u))}},[]),o=x.useMemo(()=>t==null?void 0:t.map(i=>({title:i==null?void 0:i.title,component:c.jsx("div",{onClick:()=>l(i)})})),[]);return c.jsx(E.Breadcrumbs,{items:o})},ot=e=>{const{userFlow:t,pageId:r,responseKey:s,actionType:l,label:o,content:i,dataSource:n,redirectUrl:d,dependencies:a,onClick:u,...f}=e,{getNextUI:_,fetchDataSource:h,fetchAndGetNextUI:j}=I(),{disabled:y}=K(t,a),g={...f,children:i??o},m=(g==null?void 0:g.disabled)??y,p=x.useCallback(async()=>{var C,k,b;try{const N={...(C=v.getState()[t])==null?void 0:C.entries,[s]:{status:200}};switch(M(t,N),l){case"CLOSE_MODAL":se(t,!1);break;case"CLOSE_DRAWER":X(t,!1);break;case"OPEN_DRAWER":X(t,!0);break;case"GO_TO_NEXT_UI":{const w=await _(t,r,N,s);w!=null&&w.data&&R(t,w==null?void 0:w.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const w=await j(t,r,N,s,n);w!=null&&w.data&&R(t,w==null?void 0:w.data);break}case"GET_DATA_SOURCE":{const w=await _(t,r,N,s),T=(k=w==null?void 0:w.data)==null?void 0:k.content;if((T==null?void 0:T.type)!=="fetch")break;const B=T==null?void 0:T.dataSource,S=await h(B,t,!1),V={...(b=v.getState()[t])==null?void 0:b.entries,[s]:{status:S==null?void 0:S.status,content:S==null?void 0:S.data}};M(t,V);const J=await _(t,r,V,s);J!=null&&J.data&&R(t,J==null?void 0:J.data);break}case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(N){alert(JSON.stringify(N))}},[l,n,r,s,t]);return c.jsx(E.Button,{...g,disabled:m,onClick:()=>!m&&(u??p)()})},ct={cardNotificationNotFront:"_cardNotificationNotFront_t7pln_1"},lt=e=>{const{content:t,description:r,...s}=e,l={...s,children:t??r};return c.jsx(E.CardNotification,{...l,className:ct.cardNotificationNotFront})},it=e=>{const{userFlow:t,pageId:r,responseKey:s,actionType:l,label:o,value:i,required:n,dependencies:d,...a}=e,u={...a},{getNextUI:f}=I(),[_,h]=x.useState(i||!1),{disabled:j}=K(t,d),y=x.useMemo(()=>n&&o?`${o} *`:o??"",[o,n]),g=x.useCallback(async()=>{var p;try{const C=!_;h(C);const k={...(p=v.getState()[t])==null?void 0:p.entries,[s]:C};switch(M(t,k),l){case"GO_TO_NEXT_UI":const b=await f(t,r,k,s);b!=null&&b.data&&R(t,b==null?void 0:b.data);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(C){console.error("Error in checkbox action:",C),alert(JSON.stringify(C))}},[t,r,s,l,_]),m=(u==null?void 0:u.disabled)??j;return c.jsx(E.Checkbox,{...u,labelRight:y,checked:_,disabled:m,onChange:()=>{!m&&g()}})},Z={codeEditor:"_codeEditor_1coz7_1",codeEditor_label:"_codeEditor_label_1coz7_4",codeEditor_wrapper:"_codeEditor_wrapper_1coz7_13",input:"_input_1coz7_17",preview:"_preview_1coz7_18"},dt=e=>{const{userFlow:t,responseKey:r,label:s,language:l,placeholder:o,value:i,required:n,dependencies:d,disabled:a,showPreview:u}=e,[f,_]=x.useState(i??""),h=E.ThemeStore.useThemeStore(C=>C.theme.mode),{disabled:j}=K(t,d),y=a??j,g={json:fe.json(),markdown:Ie.markdown(),sql:Ke.sql(),yaml:Ge.yaml()},m=x.useMemo(()=>n&&s?`${s} *`:s??"",[s,n]),p=C=>{_(C);const k={[r]:C};M(t,k)};return c.jsxs("div",{className:Z.codeEditor,children:[m&&m!==""&&c.jsx("label",{className:Z.codeEditor_label,children:m}),c.jsxs("div",{className:Z.codeEditor_wrapper,children:[c.jsx(ze,{className:Z.input,value:f,height:"400px",placeholder:o,extensions:[g[l]??fe.json()],onChange:C=>p(C),theme:h,editable:!y}),l=="markdown"&&u&&c.jsx(E.PreviewerMarkdown,{className:Z.preview,children:f})]})]})};var ke={exports:{}};/*!
9
+ */var be;function Qe(){if(be)return Q;be=1;var e=x,t=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(n,d,r){var u,f={},_=null,h=null;r!==void 0&&(_=""+r),d.key!==void 0&&(_=""+d.key),d.ref!==void 0&&(h=d.ref);for(u in d)s.call(d,u)&&!o.hasOwnProperty(u)&&(f[u]=d[u]);if(n&&n.defaultProps)for(u in d=n.defaultProps,d)f[u]===void 0&&(f[u]=d[u]);return{$$typeof:t,type:n,key:_,ref:h,props:f,_owner:l.current}}return Q.Fragment=a,Q.jsx=i,Q.jsxs=i,Q}pe.exports=Qe();var c=pe.exports;const je=e=>{if(!(e!=null&&e.content))return null;const t={...e,children:e.content,type:e.variant};return c.jsx(E.Heading,{...t})},Ce=e=>{if(!e)return null;const t={...e,children:e.content};return c.jsx(E.Text,{...t})},Ye=e=>(x.useEffect(()=>{e!=null&&e.chatPanelCallback&&(e==null||e.chatPanelCallback(e))},[e==null?void 0:e.chatPanelCallback]),null),Ze={summaryCard:"_summaryCard_jva4h_1"},Fe=e=>{const t=e.dataSource,a={url:e.dataSource.url,method:e.dataSource.method,headers:e.dataSource.headers,body:t==null?void 0:t.data},s=e.locale??"en",l=x.useMemo(()=>{var i,n,d;const o={title:(i=e==null?void 0:e.translations)==null?void 0:i.title,loading:(n=e==null?void 0:e.translations)==null?void 0:n.loading,noData:(d=e==null?void 0:e.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(o).filter(([,r])=>!!r))},[e==null?void 0:e.translations]);return c.jsx("section",{className:Ze.summaryCard,children:c.jsx(he.SummaryCard,{dataSource:a,locale:s,translations:l})})},K=(e,t)=>{const a=v(s=>{var l;return((l=s[e])==null?void 0:l.entries)||{}});return x.useMemo(()=>{const s={disabled:!1};return!t||t.length===0||t.forEach(l=>{const o=a[l.key],i=o==null||o===""||Array.isArray(o)&&o.length===0;l.when==="empty"&&i&&l.actions.forEach(d=>{s[d]=!0})}),s},[t,a])},$e={promptCodeEditor:"_promptCodeEditor_1d57s_1"},Pe=e=>{const{userFlow:t,responseKey:a,codeBlockValue:s,language:l,disabled:o,dependencies:i,dataSource:n,inputLabel:d,inputPlaceholder:r,codeBlockLabel:u}=e,f=E.ThemeStore.useThemeStore(j=>j.theme.mode),[_,h]=x.useState(s||""),{disabled:C}=K(t,i),y=o??C,g=l??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},p=j=>{h(j);const k={[a]:j};M(t,k)};return x.useEffect(()=>{s!==void 0&&s!==_&&h(s)},[s]),c.jsx("section",{className:$e.promptCodeEditor,children:c.jsx(he.PromptCodeEditor,{themeMode:f,requestConfig:m,language:g,disabled:y,inputLabel:d,inputPlaceholder:r,codeBlockLabel:u,codeBlockValue:_,onCodeChange:p})})},we={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},et=({inputs:e})=>c.jsx("section",{className:we.body,children:c.jsx("div",{className:we.body_content,children:e.map((t,a)=>c.jsx(x.Fragment,{children:t},a))})}),W=e=>{if(!e)return{"content-type":"application/json"};if(typeof e=="function")return e();if(typeof e=="string")try{return JSON.parse(e)}catch{return{"content-type":"application/json",Authorization:e}}return e},Y=()=>new AbortController,tt=(e,t={},a={},s=!1,l)=>{const o=Y();s&&o.abort();const i=W(t);return{call:L.get(e,{headers:{...i},params:a,signal:o.signal,_userFlow:l}),controller:o}},re=(e,t={},a={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.post(e,a,{headers:{...n},params:s,signal:i.signal,_userFlow:o}),controller:i}},nt=(e,t={},a={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.put(e,a,{headers:{...n},params:s,signal:i.signal,_userFlow:o}),controller:i}},st=(e,t={},a={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.patch(e,a,{headers:{...n},params:s,signal:i.signal,_userFlow:o}),controller:i}},at=(e,t={},a={},s={},l=!1,o)=>{const i=Y();l&&i.abort();const n=W(t);return{call:L.delete(e,{headers:{...n},data:a,params:s,signal:i.signal,_userFlow:o}),controller:i}},Ne=()=>{let e;return{callEndpoint:async s=>{s.controller&&(e=s.controller);let l={};try{l=await s.call}catch(o){throw o}return l},cancelEndpoint:()=>{e&&e.abort()}}},Ee=async(e,t,a="",s={},l={})=>{try{const{callEndpoint:o}=Ne(),{api:i,headers:n}=e,d=sessionStorage.getItem("sessionId"),r=new URLSearchParams({session_name:t});a&&r.append("hash_code",a),d&&r.append("sessionId",d);const u=`${i}/not-front/next-ui/?${r.toString()}`,f=W(n),_=re(u,f,s,l,!1,t);return await o(_)}catch(o){return console.error(o),Promise.reject(o)}},I=()=>{const e=v(n=>n),{callEndpoint:t}=Ne(),a=async(n,d,r,u,f=!0)=>{var _;try{const h=(_=e[n])==null?void 0:_.apiConfig,C={state:{...r},triggerKey:u};return f&&H(n,!0),await Ee(h,n,d,C)}catch(h){throw f&&H(n,!1),console.error("[getNextUI] Error fetching next UI:",h),h}},s=(n,d)=>{const{method:r,url:u,headers:f,data:_,params:h}=n;switch(r){case"post":return re(u,f,_,{},!1,d);case"put":return nt(u,f,_,{},!1,d);case"patch":return st(u,f,_,{},!1,d);case"delete":return at(u,f,_,h,!1,d);case"get":default:return tt(u,f,h,!1,d)}},l=(n,d)=>{const{url:r,headers:u}=n,f={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return re(r,{...u,"Content-Type":"application/json"},f,{},!1,d)},o=async(n,d,r=!0)=>{var u,f;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}r&&H(d,!0);try{let _;switch(n==null?void 0:n.type){case"rest":_=s(n,d);break;case"graphql":_=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await t(_)}catch(_){const h=_;return console.error("[fetchDataSource] Error:",h),{status:((u=h==null?void 0:h.response)==null?void 0:u.status)??0,data:((f=h==null?void 0:h.response)==null?void 0:f.data)??{message:h==null?void 0:h.message,code:h==null?void 0:h.code,config:h==null?void 0:h.config}}}finally{r&&H(d,!1)}};return{getNextUI:a,fetchDataSource:o,fetchAndGetNextUI:async(n,d,r,u,f)=>{try{H(n,!0);const _=await o(f,n,!1);return _&&await a(n,d,r,u)}catch(_){throw H(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",_),_}}}},rt=({userFlow:e,items:t,responseKey:a})=>{const{getNextUI:s}=I(),l=x.useCallback(async({actionType:i,hashCode:n,redirectUrl:d})=>{var r;try{switch(i){case"GO_TO_NEXT_UI":const u=await s(e,n,{...(r=v.getState()[e])==null?void 0:r.entries},a);u!=null&&u.data&&R(e,u==null?void 0:u.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(u){alert(JSON.stringify(u))}},[]),o=x.useMemo(()=>t==null?void 0:t.map(i=>({title:i==null?void 0:i.title,component:c.jsx("div",{onClick:()=>l(i)})})),[]);return c.jsx(E.Breadcrumbs,{items:o})},ot=e=>{const{userFlow:t,pageId:a,responseKey:s,actionType:l,label:o,content:i,dataSource:n,redirectUrl:d,dependencies:r,onClick:u,...f}=e,{getNextUI:_,fetchDataSource:h,fetchAndGetNextUI:C}=I(),{disabled:y}=K(t,r),g={...f,children:i??o},m=(g==null?void 0:g.disabled)??y,p=x.useCallback(async()=>{var j,k,b;try{const N={...(j=v.getState()[t])==null?void 0:j.entries,[s]:{status:200}};switch(M(t,N),l){case"CLOSE_MODAL":se(t,!1);break;case"CLOSE_DRAWER":X(t,!1);break;case"OPEN_DRAWER":X(t,!0);break;case"GO_TO_NEXT_UI":{const w=await _(t,a,N,s);w!=null&&w.data&&R(t,w==null?void 0:w.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const w=await C(t,a,N,s,n);w!=null&&w.data&&R(t,w==null?void 0:w.data);break}case"GET_DATA_SOURCE":{const w=await _(t,a,N,s),T=(k=w==null?void 0:w.data)==null?void 0:k.content;if((T==null?void 0:T.type)!=="fetch")break;const B=T==null?void 0:T.dataSource,S=await h(B,t,!1),V={...(b=v.getState()[t])==null?void 0:b.entries,[s]:{status:S==null?void 0:S.status,content:S==null?void 0:S.data}};M(t,V);const J=await _(t,a,V,s);J!=null&&J.data&&R(t,J==null?void 0:J.data);break}case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(N){alert(JSON.stringify(N))}},[l,n,a,s,t]);return c.jsx(E.Button,{...g,disabled:m,onClick:()=>!m&&(u??p)()})},ct={cardNotificationNotFront:"_cardNotificationNotFront_t7pln_1"},lt=e=>{const{content:t,description:a,...s}=e,l={...s,children:t??a};return c.jsx(E.CardNotification,{...l,className:ct.cardNotificationNotFront})},it=e=>{const{userFlow:t,pageId:a,responseKey:s,actionType:l,label:o,value:i,required:n,dependencies:d,...r}=e,u={...r},{getNextUI:f}=I(),[_,h]=x.useState(i||!1),{disabled:C}=K(t,d),y=x.useMemo(()=>n&&o?`${o} *`:o??"",[o,n]),g=x.useCallback(async()=>{var p;try{const j=!_;h(j);const k={...(p=v.getState()[t])==null?void 0:p.entries,[s]:j};switch(M(t,k),l){case"GO_TO_NEXT_UI":const b=await f(t,a,k,s);b!=null&&b.data&&R(t,b==null?void 0:b.data);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(j){console.error("Error in checkbox action:",j),alert(JSON.stringify(j))}},[t,a,s,l,_]),m=(u==null?void 0:u.disabled)??C;return c.jsx(E.Checkbox,{...u,labelRight:y,checked:_,disabled:m,onChange:()=>{!m&&g()}})},Z={codeEditor:"_codeEditor_1coz7_1",codeEditor_label:"_codeEditor_label_1coz7_4",codeEditor_wrapper:"_codeEditor_wrapper_1coz7_13",input:"_input_1coz7_17",preview:"_preview_1coz7_18"},dt=e=>{const{userFlow:t,responseKey:a,label:s,language:l,placeholder:o,value:i,required:n,dependencies:d,disabled:r,showPreview:u}=e,[f,_]=x.useState(i??""),h=E.ThemeStore.useThemeStore(j=>j.theme.mode),{disabled:C}=K(t,d),y=r??C,g={json:fe.json(),markdown:Ie.markdown(),sql:Ke.sql(),yaml:Ge.yaml()},m=x.useMemo(()=>n&&s?`${s} *`:s??"",[s,n]),p=j=>{_(j);const k={[a]:j};M(t,k)};return c.jsxs("div",{className:Z.codeEditor,children:[m&&m!==""&&c.jsx("label",{className:Z.codeEditor_label,children:m}),c.jsxs("div",{className:Z.codeEditor_wrapper,children:[c.jsx(ze,{className:Z.input,value:f,height:"400px",placeholder:o,extensions:[g[l]??fe.json()],onChange:j=>p(j),theme:h,editable:!y}),l=="markdown"&&u&&c.jsx(E.PreviewerMarkdown,{className:Z.preview,children:f})]})]})};var ke={exports:{}};/*!
10
10
  Copyright (c) 2018 Jed Watson.
11
11
  Licensed under the MIT License (MIT), see
12
12
  http://jedwatson.github.io/classnames
13
- */(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var s=[],l=0;l<arguments.length;l++){var o=arguments[l];if(o){var i=typeof o;if(i==="string"||i==="number")s.push(o);else if(Array.isArray(o)){if(o.length){var n=r.apply(null,o);n&&s.push(n)}}else if(i==="object"){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){s.push(o.toString());continue}for(var d in o)t.call(o,d)&&o[d]&&s.push(d)}}}return s.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(ke);var _t=ke.exports;const $=Xe(_t),nn={contentWrapper:"_contentWrapper_12gyy_1",contentWrapper__centered:"_contentWrapper__centered_12gyy_4"},ut={dividerNotFront:"_dividerNotFront_tze3j_1"},ht=e=>c.jsx(E.Divider,{...e,className:ut.dividerNotFront}),ft=(e,t,r)=>{const{url:s,paginationKeys:l,params:o}=e,i=[],n=(l==null?void 0:l.page)??"page";if(i.push(`${n}=${t}`),typeof r=="string"){const u=(l==null?void 0:l.text)??"text";i.push(`${u}=${encodeURIComponent(r||"")}`)}if(o&&typeof o=="object"){const u=Object.entries(o).map(([f,_])=>`${encodeURIComponent(f)}=${encodeURIComponent(_)}`);i.push(...u)}const d=i.join("&");return d?`${s}?${d}`:s},oe=(e,t,r)=>{const{type:s,url:l,method:o,headers:i}=e;return s==="rest"?{type:"rest",url:ft(e,t,r),method:o,headers:i,data:(e==null?void 0:e.data)||{}}:{type:"graphql",url:l,method:"post",headers:i,query:e==null?void 0:e.query,variables:{...(e==null?void 0:e.variables)||{},...typeof r=="string"?{text:r}:{},page:t}}},ce=e=>Array.isArray(e)?e:typeof e=="object"?JSON.stringify(e):e,ve=(e,t,r,s)=>{const l=z.query(e,t),o=l==null?void 0:l.map(a=>{var u,f;if(r){const _={};for(const[h,j]of Object.entries(r))if(typeof j=="object"&&"path"in j){const y=j,g=(u=z.query(a,y.path))==null?void 0:u[0];y.translations&&String(g)in y.translations?_[h]=ce(y.translations[String(g)]):_[h]=ce(g)}else{const y=j;_[h]=ce((f=z.query(a,y))==null?void 0:f[0])}return _}else return a}),i=z.value(e,(s==null?void 0:s.size)??"$.meta.size")??l.length,n=z.value(e,(s==null?void 0:s.total)??"$.meta.total")??0,d={size:i,total:n,totalPages:s!=null&&s.totalPages?z.value(e,(s==null?void 0:s.totalPages)??"$.meta.totalPages"):i>0?Math.ceil(n/i):0};return{items:o,pagination:d}},P=({withPadding:e=!1})=>{const t=r=>c.jsx("span",{style:{color:q.labelColor},children:r});return c.jsx(O.Legend,{formatter:t,wrapperStyle:{fontSize:q.fontSize,fontFamily:q.fontFamily,padding:e?"1rem 0":"0"}})},yt=({active:e,payload:t,label:r,tooltipKey:s})=>{var o;if(!e||!t||!t.length)return null;const l={backgroundColor:q.tooltipBg,borderRadius:q.tooltipBorderRadius,color:q.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(s){const i=(o=t[0])==null?void 0:o.payload;if(i&&i[s]!==void 0&&i[s]!==null)return c.jsx("div",{style:l,children:c.jsx("p",{style:{margin:0},children:i[s]})})}return c.jsxs("div",{style:l,children:[c.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:r}),t.map((i,n)=>c.jsx("p",{style:{margin:"2px 0",color:i.color},children:`${i.name}: ${i.value}`},n))]})},ee=({tooltipKey:e}={})=>c.jsx(O.Tooltip,{content:c.jsx(yt,{tooltipKey:e})}),le=({dataKey:e,hide:t=!1})=>c.jsx(O.XAxis,{dataKey:e,hide:t,tick:{fill:q.labelColor,fontSize:q.fontSize}}),ie=()=>c.jsx(O.YAxis,{tick:{fill:q.labelColor,fontSize:q.fontSize}}),mt={area:e=>{const{data:t,xKey:r,yKeys:s,tooltipKey:l}=e;return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.AreaChart,{data:t,children:[c.jsx(O.CartesianGrid,{strokeDasharray:"3 3"}),c.jsx(le,{dataKey:r}),c.jsx(ie,{}),c.jsx(ee,{tooltipKey:l}),c.jsx(P,{}),s.map((o,i)=>c.jsx(O.Area,{type:"monotone",dataKey:o,stroke:G[i%G.length],fill:G[i%G.length]},o))]})})},bar:e=>{const{data:t,yKeys:r,xKey:s,tooltipKey:l}=e;return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.BarChart,{data:t,children:[c.jsx(O.CartesianGrid,{strokeDasharray:"3 3"}),c.jsx(le,{hide:!0,dataKey:s}),c.jsx(ie,{}),c.jsx(ee,{tooltipKey:l}),c.jsx(P,{withPadding:!0}),r.map((o,i)=>c.jsx(O.Bar,{dataKey:o,fill:G[i%G.length]},o))]})})},line:e=>{const{data:t,xKey:r,yKeys:s,tooltipKey:l}=e;return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.LineChart,{data:t,children:[c.jsx(O.CartesianGrid,{strokeDasharray:"3 3"}),c.jsx(le,{dataKey:r}),c.jsx(ie,{}),c.jsx(ee,{tooltipKey:l}),c.jsx(P,{}),s.map((o,i)=>c.jsx(O.Line,{type:"monotone",dataKey:o,stroke:G[i%G.length],strokeWidth:2,dot:!1},o))]})})},pie:e=>{const{data:t,xKey:r,yKeys:s,tooltipKey:l}=e,o=({cx:i,cy:n,midAngle:d,innerRadius:a,outerRadius:u,value:f})=>{const _=Math.PI/180,h=25+a+(u-a),j=i+h*Math.cos(-(d??0)*_),y=n+h*Math.sin(-(d??0)*_);return c.jsx("text",{x:j,y,fill:q.labelColor,color:q.labelColor,textAnchor:"middle",dominantBaseline:"central",children:f})};return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.PieChart,{children:[c.jsx(ee,{tooltipKey:l}),c.jsx(P,{}),c.jsx(O.Pie,{data:t,dataKey:s[0],nameKey:r,label:o,outerRadius:120,children:t.map((i,n)=>c.jsx(O.Cell,{fill:G[n%G.length]},`cell-${n}`))})]})})}},G=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],q={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Ae=e=>{const{component:t,userFlow:r,hash:s,responseKey:l,dataSource:o,...i}=e,n=mt[i.type];if(!n)return c.jsx("div",{children:"Not supported chart type"});const{fetchDataSource:d}=I(),[a,u]=x.useState(!1),[f,_]=x.useState([]),h=async()=>{var y,g;try{u(!0);const{jsonPathData:m,mapperData:p}=o,C=oe(o,1),k=await d(C,r,!1),b=m?(y=ve(k==null?void 0:k.data,m,p))==null?void 0:y.items:(g=k==null?void 0:k.data)==null?void 0:g.data;_(b),u(!1)}catch(m){alert(JSON.stringify(m)),u(!1)}};x.useEffect(()=>{o?h():_(i.data)},[]);const j={...i,data:f};return a?c.jsx(E.SkeletonBase,{height:400}):f.length>0?n(j):c.jsx(E.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})},Oe={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},gt=({components:e=[]})=>c.jsx("section",{className:$(Oe.header,"avocado-dark-theme"),children:c.jsx("div",{className:Oe.header_content,children:e.map((t,r)=>c.jsx(x.Fragment,{children:t},r))})}),D=(e,t,r,s)=>{var i;const l={accordion:n=>c.jsx(zt,{...n,userFlow:e,pageId:t}),aiChatPanel:n=>c.jsx(Ye,{...n,userFlow:e,pageId:t,chatPanelCallback:s}),aiSummaryCard:n=>c.jsx(Fe,{...n,userFlow:e,pageId:t}),aiPromptCodeEditor:n=>c.jsx(Pe,{...n,userFlow:e,pageId:t}),breadcrumbs:n=>c.jsx(at,{...n,userFlow:e,pageId:t}),button:n=>c.jsx(ot,{...n,userFlow:e,pageId:t}),cardNotification:n=>c.jsx(lt,{...n}),chart:n=>c.jsx(Ae,{...n,userFlow:e}),checkbox:n=>c.jsx(it,{...n,userFlow:e,pageId:t}),code:n=>c.jsx(dt,{...n,userFlow:e,pageId:t}),divider:n=>c.jsx(ht,{...n}),drawer:n=>c.jsx(It,{...n,userFlow:e,pageId:t}),heading:n=>Ce(n),pill:n=>c.jsx(jt,{...n}),modal:n=>c.jsx(pt,{...n,userFlow:e,pageId:t}),roundButton:n=>c.jsx(wt,{...n,userFlow:e,pageId:t}),row:n=>c.jsx(Te,{...n,userFlow:e,pageId:t}),select:n=>c.jsx(At,{...n,userFlow:e,pageId:t}),switch:n=>c.jsx(Tt,{...n,userFlow:e,pageId:t}),spacing:n=>c.jsx(Ot,{...n,userFlow:e,pageId:t}),table:n=>c.jsx(Lt,{...n,userFlow:e,pageId:t}),text:n=>je(n),textField:n=>c.jsx(qt,{...n,userFlow:e,pageId:t}),toast:n=>c.jsx(Bt,{...n,userFlow:e,pageId:t})};return(i=r==null?void 0:r.filter(Boolean))==null?void 0:i.map(n=>{const d=l[n.component];return d?d({...n,userFlow:e,pageId:t}):null})},xt={modalContent:"_modalContent_p06ci_1"},pt=({userFlow:e,pageId:t,responseKey:r,header:s,body:l,footer:o,headerStatusColor:i,...n})=>{const d=v(m=>{var p;return(p=m[e])==null?void 0:p.isModalOpen}),a=v(m=>{var p;return(p=m[e])==null?void 0:p.isLoading}),u=d&&!a,f={...n},_=(f==null?void 0:f.headerStatusColor)??i,h=x.useCallback(()=>{ne(e),se(e,!1)},[e,r]),j=Array.isArray(s)?D(e,t,s):s,y=D(e,t,l),g=D(e,t,o);return c.jsx(E.Modal,{...f,headerStatusColor:_,header:typeof j=="string"?j:c.jsx(c.Fragment,{children:j.map((m,p)=>c.jsx(x.Fragment,{children:m},`modal-header-${p}`))}),children:c.jsx("section",{className:xt.modalContent,children:y.map((m,p)=>c.jsx(x.Fragment,{children:m},`modal-body-${p}`))}),actions:c.jsx(c.Fragment,{children:g.map((m,p)=>c.jsx(x.Fragment,{children:m},`modal-footer-${p}`))}),open:u,onClose:h})},bt=({userFlow:e,pageId:t})=>{var o,i;const r=Je(e);if(!r)return null;const s=[...(r==null?void 0:r.components)||[],...((o=r==null?void 0:r.header)==null?void 0:o.components)||[],...((i=r==null?void 0:r.body)==null?void 0:i.components)||[]],l=D(e,t,s);return c.jsx(c.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${r==null?void 0:r.hash}`;return c.jsx(x.Fragment,{children:n},a)})})},Ct={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},jt=e=>{const{content:t,variant:r="neutral",...s}=e,l=Ct[r],o={...s,children:t,color:(s==null?void 0:s.color)??l.color,textColor:(s==null?void 0:s.textColor)??l.textColor,iconColor:(s==null?void 0:s.iconColor)??l.iconColor};return c.jsx(E.Pill,{...o})},wt=e=>{const{userFlow:t,pageId:r,responseKey:s,actionType:l,dataSource:o,dependencies:i,onClick:n,...d}=e,{getNextUI:a,fetchAndGetNextUI:u}=I(),{disabled:f}=K(t,i),_={...d},h=(_==null?void 0:_.disabled)??f,j=x.useCallback(async()=>{var y;try{const g={...(y=v.getState()[t])==null?void 0:y.entries,[s]:{status:200}};switch(M(t,g),l){case"GO_TO_NEXT_UI":{const m=await a(t,r,g,s);m!=null&&m.data&&R(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await u(t,r,g,s,o);m!=null&&m.data&&R(t,m==null?void 0:m.data);break}case"CLOSE_MODAL":se(t,!1);break;case"CLOSE_DRAWER":X(t,!1);break;case"OPEN_DRAWER":X(t,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(g){alert(JSON.stringify(g))}},[l,o,r,s,t]);return c.jsx(E.RoundButton,{..._,disabled:h,onClick:()=>!h&&(n??j)()})},U={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},Te=e=>{const{userFlow:t,pageId:r,columnWidth:s,columns:l,gap:o="md",justifyContent:i="start",alignItems:n="stretch"}=e,d=Array.isArray(l)?l.map((a,u)=>{const f=`col_${u}`,_=`col_${u}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:f,responseKey:_};const h=a;return{gap:(h==null?void 0:h.gap)??"md",justifyContent:(h==null?void 0:h.justifyContent)??"start",alignItems:(h==null?void 0:h.alignItems)??"start",items:(h==null?void 0:h.items)??[],hash:(h==null?void 0:h.hash)??f,responseKey:(h==null?void 0:h.responseKey)??_}}):[];return d.length===0?null:c.jsx("div",{className:$(U.row,U[`row__gap-${o}`],U[`row__justify-${i}`],U[`row__align-${n}`]),children:d==null?void 0:d.map((a,u)=>{const f=(s==null?void 0:s[u])||`${100/d.length}%`,_=D(t,r,a.items);return!_||_.length===0?null:c.jsx("div",{className:$(U.row_column,U[`row_column__gap-${a.gap}`],U[`row_column__justify-${a.justifyContent}`],U[`row_column__align-${a.alignItems}`]),style:{width:f},children:_},a.hash||u)})})};function Se({userFlow:e,pageId:t,responseKey:r,actionType:s,getNextUI:l,isMulti:o=!1,debounceMs:i}){const n=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.useCallback(async u=>{var h;const f={...(h=v.getState()[e])==null?void 0:h.entries,[r]:u};if(M(e,f),s&&(s==="GO_TO_NEXT_UI"||s==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const y=await l(e,t,f,r,s==="GO_TO_NEXT_UI");y!=null&&y.data&&R(e,y.data)}catch(j){console.error("[useSelectChange] Failed to fetch next UI",j)}},[e,t,r,s,l]);return x.useCallback(u=>{if(!o){d(u);return}if(i==null){d(u);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(u),n.current=null},i)},[o,i,d])}const Nt=(e,t,r,s)=>{const l=z.query(e,t);return(l==null?void 0:l.map(o=>{var d,a;const i=(d=z.query(o,r))==null?void 0:d[0],n=s?(a=z.query(o,s))==null?void 0:a[0]:o;return{label:i,value:n}}))??[]},Et=(e,t,r,s=10)=>{var n,d;let l,o;if(r){const a=z.value(e,r.size??"$.meta.size")??s,u=z.value(e,r.total??"$.meta.total")??0;l=a,o=u}else{const a=e==null?void 0:e.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??s,o=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const i=o>0?Math.ceil(o/l)>t:!1;return{pageSize:l,total:o,hasMore:i}},Re={selectNotFront:"_selectNotFront_1yw9q_1"},kt=({userFlow:e,pageId:t,responseKey:r,required:s,dataSource:l,actionType:o,dependencies:i,debounceMs:n,...d})=>{const a={...d},{getNextUI:u,fetchDataSource:f}=I(),[_,h]=x.useState((a==null?void 0:a.value)??""),{disabled:j}=K(e,i),y=(a==null?void 0:a.disabled)??j,g=x.useMemo(()=>s&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,s]),m=x.useMemo(()=>{const b=a!=null&&a.isMulti?_:[_],N={};return typeof b=="object"&&"length"in b&&(b==null||b.forEach(w=>{const T=JSON.stringify(w.value),B=JSON.stringify(w.label);N[T]=w,B in N||(N[B]=w)})),N},[_]),p=Se({userFlow:e,pageId:t,responseKey:r,actionType:o,getNextUI:u,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),C=b=>{h(b),p(b)},k=async(b,N,{page:w})=>{const{jsonPathLabel:T,jsonPathOptions:B,jsonPathValue:S,jsonPathPagination:V}=l,J=oe(l,w,b),_e=await f(J,e,!1),ue=_e==null?void 0:_e.data,Gt=ue?Nt(ue,B,T,S):[],{hasMore:Ut}=Et(ue,w,V);return{options:Gt,hasMore:Ut,additional:{page:b?1:w+1}}};return c.jsx(E.SelectPagination,{...a,className:Re.selectNotFront,label:g,value:_,disabled:y,noOptionsMessage:()=>c.jsx(c.Fragment,{children:"Sin opciones"}),onChange:b=>!y&&C(b),loadOptions:k,additional:{page:1},isOptionDisabled:b=>{const N=JSON.stringify(b==null?void 0:b.value),w=JSON.stringify(b==null?void 0:b.label);return!!(m!=null&&m[N])||!!(m!=null&&m[w])},debounceTimeout:350})},vt=({userFlow:e,pageId:t,responseKey:r,dataSource:s,required:l,actionType:o,dependencies:i,debounceMs:n,...d})=>{const a={...d},{getNextUI:u}=I(),[f,_]=x.useState(a.value||""),{disabled:h}=K(e,i),j=(a==null?void 0:a.disabled)??h,y=x.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),g=Se({userFlow:e,pageId:t,responseKey:r,actionType:o,getNextUI:u,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),m=p=>{_(p),g(p)};return c.jsx(E.Select,{...a,className:Re.selectNotFront,label:y,value:f,disabled:j,onChange:p=>!j&&m(p)})},At=e=>{const{dataSource:t}=e;return t?c.jsx(kt,{...e}):c.jsx(vt,{...e})},De={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},Ot=e=>{const{size:t}=e,r=$(De.spacing,De[`spacing__${t}`]);return c.jsx("div",{className:r})},Tt=e=>{const{userFlow:t,pageId:r,responseKey:s,actionType:l,label:o,value:i,required:n,dependencies:d,...a}=e,u={...a},{getNextUI:f}=I(),[_,h]=x.useState(i||!1),{disabled:j}=K(t,d),y=(u==null?void 0:u.disabled)??j,g=x.useMemo(()=>n&&o?`${o} *`:o??"",[o,n]),m=x.useCallback(async()=>{var p;try{const C=!_;h(C);const k={...(p=v.getState()[t])==null?void 0:p.entries,[s]:C};switch(M(t,k),l){case"GO_TO_NEXT_UI":const b=await f(t,r,k,s);b!=null&&b.data&&R(t,b==null?void 0:b.data);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(C){console.error("Error in switch action:",C),alert(JSON.stringify(C))}},[t,r,s,l,_]);return c.jsx(E.Switch,{...u,label:g,checked:_,disabled:y,onChange:()=>!y&&m()})},Le={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},St=({values:e})=>{const r=e==null?void 0:e.slice(0,4),s=(e==null?void 0:e.length)-4;return c.jsxs("div",{className:Le.tableArrayPills,children:[r.map((l,o)=>c.jsx(E.Pill,{children:String(l)},o)),s>0&&c.jsxs(E.Pill,{outlined:!0,children:["+",s]})]})},Rt=({userFlow:e,pageId:t,tableResponseKey:r,component:s,rowData:l})=>{const{getNextUI:o,fetchAndGetNextUI:i,fetchDataSource:n}=I(),d=D(e,t,[{...s}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:u,responseKey:f,dataSource:_}=a.props,h=x.useCallback(async()=>{var j,y,g;try{const m={...(j=v.getState()[e])==null?void 0:j.entries,[f]:{status:200},[r]:[{...l}]};switch(M(e,m),u){case"GO_TO_NEXT_UI":{const p=await o(e,t,m,f);p!=null&&p.data&&R(e,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await i(e,t,m,f,_);p!=null&&p.data&&R(e,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await o(e,t,m,f),C=(y=p==null?void 0:p.data)==null?void 0:y.content;if((C==null?void 0:C.type)!=="fetch")break;const k=C==null?void 0:C.dataSource,b=await n(k,e,!1),N={...(g=v.getState()[e])==null?void 0:g.entries,[f]:{status:b==null?void 0:b.status,content:b==null?void 0:b.data}};M(e,N);const w=await o(e,t,N,f);w!=null&&w.data&&R(e,w==null?void 0:w.data);break}default:console.warn(`Unhandled actionType: ${u}`);break}}catch(m){alert(JSON.stringify(m))}},[u,_,t,f,e]);return x.cloneElement(a,{onClick:h})},Dt=()=>c.jsx("div",{className:Le.tableSkeleton,children:[...Array(10)].map((e,t)=>c.jsx(E.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${t}`))}),Lt=({userFlow:e,pageId:t,responseKey:r,component:s,dataSource:l,rightActions:o,...i})=>{var C,k,b;const{fetchDataSource:n}=I(),[d,a]=x.useState(!1),[u,f]=x.useState(1),[_,h]=x.useState(null),j=x.useMemo(()=>{if(o!=null&&o.length)return o.map((N,w)=>({renderContent:T=>c.jsx(Rt,{userFlow:e,pageId:t,tableResponseKey:r,component:N,rowData:T},`tableRowAction${w}`)}))},[o,e,t]),y=async(N=1)=>{try{a(!0);const{jsonPathData:w,mapperData:T,jsonPathPagination:B}=l,S=oe(l,N),V=await n(S,e,!1);h(ve(V==null?void 0:V.data,w,T,B)),a(!1)}catch(w){alert(JSON.stringify(w)),a(!1)}},g=N=>{f(N),y(N)};x.useEffect(()=>{y()},[]);const m=x.useMemo(()=>!(_!=null&&_.items)||!(i!=null&&i.columns)?i==null?void 0:i.columns:i.columns.map(N=>{var T;return((T=_==null?void 0:_.items)==null?void 0:T.some(B=>Array.isArray(N!=null&&N.accessor?B[N==null?void 0:N.accessor]:void 0)))?{...N,renderCell:B=>{const S=N.accessor?B[N.accessor]:void 0;return Array.isArray(S)?c.jsx(St,{values:S}):S}}:N}),[_==null?void 0:_.items,i==null?void 0:i.columns]),p={...i,data:_==null?void 0:_.items,columns:m,rightActions:j};return c.jsx(c.Fragment,{children:d?c.jsx(Dt,{}):_&&((C=_==null?void 0:_.items)==null?void 0:C.length)>0?c.jsxs(c.Fragment,{children:[c.jsx(E.Table,{...p}),(_==null?void 0:_.pagination)&&((k=_==null?void 0:_.pagination)==null?void 0:k.totalPages)>1&&c.jsx(E.Pager,{classname:{global:"row__end"},page:u,size:_==null?void 0:_.pagination.size,total:(b=_==null?void 0:_.pagination)==null?void 0:b.total,onChange:g})]}):c.jsx(E.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Mt={textFieldNotFront:"_textFieldNotFront_cps4i_1"},qt=e=>{const{userFlow:t,pageId:r,component:s,hash:l,responseKey:o,required:i,dependencies:n,...d}=e,a={...d},[u,f]=x.useState((a==null?void 0:a.value)??""),{disabled:_}=K(t,n),h=(a==null?void 0:a.disabled)??_,j=x.useMemo(()=>i&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,i]),y=g=>{var C;const m=(C=g==null?void 0:g.target)==null?void 0:C.value;f(m);const p={[o]:m};M(t,p)};return x.useEffect(()=>{f((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),c.jsx(E.TextField,{...a,className:Mt.textFieldNotFront,allowClear:!1,label:j,value:u,disabled:h,onChange:g=>!h&&y(g)})},Bt=({userFlow:e,pageId:t,responseKey:r,variant:s,content:l,actionType:o,redirectUrl:i})=>{const n=x.useCallback(async()=>{ne(e);try{switch(o){case"AUTOCLOSE_AND_REDIRECT":window.location.href=i;break;default:console.warn(`Unhandled actionType: ${o}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[o,t,r,e,i]);return x.useEffect(()=>{({info:E.toast.info,error:E.toast.error,success:E.toast.success,warning:E.toast.warning}[s]||E.toast.info)(l,{autoClose:o?!1:4e3,containerId:e,onClose:n})},[n,e]),null},Me={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},zt=e=>{const{userFlow:t,pageId:r,responseKey:s,dependencies:l,customContent:o,actionContent:i,components:n,...d}=e,{getNextUI:a}=I(),[u,f]=x.useState(d.checkboxChecked||!1),{disabled:_}=K(t,l),h=D(t,r,n),j=i?D(t,r,i):void 0,y=o?D(t,r,o):void 0,g=x.useCallback(async C=>{var k;try{const b=C.target.checked;f(b);const N={...(k=v.getState()[t])==null?void 0:k.entries,[s]:b};if(M(t,N),d.actionType==="GO_TO_NEXT_UI"){const w=await a(t,r,N,s);w!=null&&w.data&&R(t,w==null?void 0:w.data)}}catch(b){console.error("Error in accordion checkbox action:",b),alert(JSON.stringify(b))}},[t,r,s,d.actionType,a]),m=d.disabled||_,p={...d,className:Me.accordion,disabled:m,checkboxChecked:u,onChanceCheckbox:d.hasCheckbox?g:void 0,actionContent:j?c.jsx(c.Fragment,{children:j.map((C,k)=>c.jsx(x.Fragment,{children:C},`accordion-action-${k}`))}):void 0,customContent:y?c.jsx(c.Fragment,{children:y.map((C,k)=>c.jsx(x.Fragment,{children:C},`accordion-custom-${k}`))}):void 0,children:h?c.jsx("section",{className:Me.accordionBody,children:h.map((C,k)=>c.jsx(x.Fragment,{children:C},`accordion-child-${k}`))}):void 0};return c.jsx(E.Accordion,{...p})},de={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},It=({userFlow:e,pageId:t,responseKey:r,header:s,body:l,footer:o,...i})=>{const n=v(y=>{var g;return(g=y[e])==null?void 0:g.isDrawerOpen}),d=v(y=>{var g;return(g=y[e])==null?void 0:g.isLoading}),a=n&&!d,u={...i,isOpen:a,children:null},f=x.useCallback(()=>{ne(e),X(e,!1)},[e]),_=Array.isArray(s)?D(e,t,s):s?c.jsx(E.Heading,{type:"h2",children:s}):void 0,h=D(e,t,l),j=o?D(e,t,o):void 0;return c.jsx(E.Drawer,{...u,className:de.drawer,isOpen:a,onClose:f,heightGap:0,title:_?c.jsx(c.Fragment,{children:Array.isArray(_)?_.map((y,g)=>c.jsx(x.Fragment,{children:y},`drawer-header-${g}`)):_}):void 0,children:c.jsx("section",{className:de.drawerBody,children:h.map((y,g)=>c.jsx(x.Fragment,{children:y},`drawer-body-${g}`))}),footer:j?c.jsx("div",{className:de.drawerFooter,children:j.map((y,g)=>c.jsx(x.Fragment,{children:y},`drawer-footer-${g}`))}):void 0})},qe=(e,t,r,s,l)=>{const o=D(e,t,(s==null?void 0:s.components)||null,l);switch(r){case"body":return c.jsx(et,{...s,inputs:o||[]},JSON.stringify(s==null?void 0:s.components));case"header":return c.jsx(gt,{...s,components:o||[]},JSON.stringify(s==null?void 0:s.components));default:return null}},Kt=(e,t,r,s)=>{var _,h,j;const[l,o]=x.useState(!1),i=v(y=>y),n=(_=i[e])==null?void 0:_.currentPageId,d=n?qe(e,n,"header",((h=i[e].pages[n].page)==null?void 0:h.header)||null,s):null,a=n?qe(e,n,"body",((j=i[e].pages[n].page)==null?void 0:j.body)||null,s):null,u=x.useMemo(()=>{var y;return c.jsxs(c.Fragment,{children:[((y=i[e])==null?void 0:y.isLoading)&&c.jsx(E.Loading,{}),d,a,n&&c.jsx(bt,{userFlow:e,pageId:n}),i[e]&&c.jsx(E.Toaster,{})]})},[d,a,n,e]),f=async()=>{var y;try{const g=await Ee(t,e),m=(y=g==null?void 0:g.data)==null?void 0:y.content;(g==null?void 0:g.status)===200?te(e,t,m):o(!0)}catch(g){console.error("[not-page]: API call failed",g),o(!0)}};return x.useEffect(()=>{t!=null&&t.api&&!r&&e?f():!(t!=null&&t.api)&&r&&e||t!=null&&t.api&&r&&e?te(e,t,r):(!(t!=null&&t.api)&&!r||!e)&&(o(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const y="avocado-theme-mode-changed",g=m=>{const p=m.detail;E.ThemeStore.setThemeMode(p)};return window.addEventListener(y,g),()=>{window.removeEventListener(y,g)}},[]),l&&console.error("[not-page]: No render page"),u};A.Chart=Ae,A.Row=Te,A.heading=Ce,A.text=je,A.usePage=Kt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
13
+ */(function(e){(function(){var t={}.hasOwnProperty;function a(){for(var s=[],l=0;l<arguments.length;l++){var o=arguments[l];if(o){var i=typeof o;if(i==="string"||i==="number")s.push(o);else if(Array.isArray(o)){if(o.length){var n=a.apply(null,o);n&&s.push(n)}}else if(i==="object"){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){s.push(o.toString());continue}for(var d in o)t.call(o,d)&&o[d]&&s.push(d)}}}return s.join(" ")}e.exports?(a.default=a,e.exports=a):window.classNames=a})()})(ke);var _t=ke.exports;const $=Xe(_t),nn={contentWrapper:"_contentWrapper_12gyy_1",contentWrapper__centered:"_contentWrapper__centered_12gyy_4"},ut={dividerNotFront:"_dividerNotFront_tze3j_1"},ht=e=>c.jsx(E.Divider,{...e,className:ut.dividerNotFront}),ft=(e,t,a)=>{const{url:s,paginationKeys:l,params:o}=e,i=[],n=(l==null?void 0:l.page)??"page";if(i.push(`${n}=${t}`),typeof a=="string"){const u=(l==null?void 0:l.text)??"text";i.push(`${u}=${encodeURIComponent(a||"")}`)}if(o&&typeof o=="object"){const u=Object.entries(o).map(([f,_])=>`${encodeURIComponent(f)}=${encodeURIComponent(_)}`);i.push(...u)}const d=i.join("&");return d?`${s}?${d}`:s},oe=(e,t,a)=>{const{type:s,url:l,method:o,headers:i}=e;return s==="rest"?{type:"rest",url:ft(e,t,a),method:o,headers:i,data:(e==null?void 0:e.data)||{}}:{type:"graphql",url:l,method:"post",headers:i,query:e==null?void 0:e.query,variables:{...(e==null?void 0:e.variables)||{},...typeof a=="string"?{text:a}:{},page:t}}},ce=e=>Array.isArray(e)?e:typeof e=="object"?JSON.stringify(e):e,ve=(e,t,a,s)=>{const l=z.query(e,t),o=l==null?void 0:l.map(r=>{var u,f;if(a){const _={};for(const[h,C]of Object.entries(a))if(typeof C=="object"&&"path"in C){const y=C,g=(u=z.query(r,y.path))==null?void 0:u[0];y.translations&&String(g)in y.translations?_[h]=ce(y.translations[String(g)]):_[h]=ce(g)}else{const y=C;_[h]=ce((f=z.query(r,y))==null?void 0:f[0])}return _}else return r}),i=z.value(e,(s==null?void 0:s.size)??"$.meta.size")??l.length,n=z.value(e,(s==null?void 0:s.total)??"$.meta.total")??0,d={size:i,total:n,totalPages:s!=null&&s.totalPages?z.value(e,(s==null?void 0:s.totalPages)??"$.meta.totalPages"):i>0?Math.ceil(n/i):0};return{items:o,pagination:d}},P=({withPadding:e=!1})=>{const t=a=>c.jsx("span",{style:{color:q.labelColor},children:a});return c.jsx(O.Legend,{formatter:t,wrapperStyle:{fontSize:q.fontSize,fontFamily:q.fontFamily,padding:e?"1rem 0":"0"}})},yt=({active:e,payload:t,label:a,tooltipKey:s})=>{var o;if(!e||!t||!t.length)return null;const l={backgroundColor:q.tooltipBg,borderRadius:q.tooltipBorderRadius,color:q.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(s){const i=(o=t[0])==null?void 0:o.payload;if(i&&i[s]!==void 0&&i[s]!==null)return c.jsx("div",{style:l,children:c.jsx("p",{style:{margin:0},children:i[s]})})}return c.jsxs("div",{style:l,children:[c.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:a}),t.map((i,n)=>c.jsx("p",{style:{margin:"2px 0",color:i.color},children:`${i.name}: ${i.value}`},n))]})},ee=({tooltipKey:e}={})=>c.jsx(O.Tooltip,{content:c.jsx(yt,{tooltipKey:e})}),le=({dataKey:e,hide:t=!1})=>c.jsx(O.XAxis,{dataKey:e,hide:t,tick:{fill:q.labelColor,fontSize:q.fontSize}}),ie=()=>c.jsx(O.YAxis,{tick:{fill:q.labelColor,fontSize:q.fontSize}}),mt={area:e=>{const{data:t,xKey:a,yKeys:s,tooltipKey:l}=e;return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.AreaChart,{data:t,children:[c.jsx(O.CartesianGrid,{strokeDasharray:"3 3"}),c.jsx(le,{dataKey:a}),c.jsx(ie,{}),c.jsx(ee,{tooltipKey:l}),c.jsx(P,{}),s.map((o,i)=>c.jsx(O.Area,{type:"monotone",dataKey:o,stroke:G[i%G.length],fill:G[i%G.length]},o))]})})},bar:e=>{const{data:t,yKeys:a,xKey:s,tooltipKey:l}=e;return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.BarChart,{data:t,children:[c.jsx(O.CartesianGrid,{strokeDasharray:"3 3"}),c.jsx(le,{hide:!0,dataKey:s}),c.jsx(ie,{}),c.jsx(ee,{tooltipKey:l}),c.jsx(P,{withPadding:!0}),a.map((o,i)=>c.jsx(O.Bar,{dataKey:o,fill:G[i%G.length]},o))]})})},line:e=>{const{data:t,xKey:a,yKeys:s,tooltipKey:l}=e;return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.LineChart,{data:t,children:[c.jsx(O.CartesianGrid,{strokeDasharray:"3 3"}),c.jsx(le,{dataKey:a}),c.jsx(ie,{}),c.jsx(ee,{tooltipKey:l}),c.jsx(P,{}),s.map((o,i)=>c.jsx(O.Line,{type:"monotone",dataKey:o,stroke:G[i%G.length],strokeWidth:2,dot:!1},o))]})})},pie:e=>{const{data:t,xKey:a,yKeys:s,tooltipKey:l}=e,o=({cx:i,cy:n,midAngle:d,innerRadius:r,outerRadius:u,value:f})=>{const _=Math.PI/180,h=25+r+(u-r),C=i+h*Math.cos(-(d??0)*_),y=n+h*Math.sin(-(d??0)*_);return c.jsx("text",{x:C,y,fill:q.labelColor,color:q.labelColor,textAnchor:"middle",dominantBaseline:"central",children:f})};return c.jsx(O.ResponsiveContainer,{width:"100%",height:400,children:c.jsxs(O.PieChart,{children:[c.jsx(ee,{tooltipKey:l}),c.jsx(P,{}),c.jsx(O.Pie,{data:t,dataKey:s[0],nameKey:a,label:o,outerRadius:120,children:t.map((i,n)=>c.jsx(O.Cell,{fill:G[n%G.length]},`cell-${n}`))})]})})}},G=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],q={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Ae=e=>{const{component:t,userFlow:a,hash:s,responseKey:l,dataSource:o,...i}=e,n=mt[i.type];if(!n)return c.jsx("div",{children:"Not supported chart type"});const{fetchDataSource:d}=I(),[r,u]=x.useState(!1),[f,_]=x.useState([]),h=async()=>{var y,g;try{u(!0);const{jsonPathData:m,mapperData:p}=o,j=oe(o,1),k=await d(j,a,!1),b=m?(y=ve(k==null?void 0:k.data,m,p))==null?void 0:y.items:(g=k==null?void 0:k.data)==null?void 0:g.data;_(b),u(!1)}catch(m){alert(JSON.stringify(m)),u(!1)}};x.useEffect(()=>{o?h():_(i.data)},[]);const C={...i,data:f};return r?c.jsx(E.SkeletonBase,{height:400}):f.length>0?n(C):c.jsx(E.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})},Oe={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},gt=({components:e=[]})=>c.jsx("section",{className:$(Oe.header,"avocado-dark-theme"),children:c.jsx("div",{className:Oe.header_content,children:e.map((t,a)=>c.jsx(x.Fragment,{children:t},a))})}),D=(e,t,a,s)=>{var i;const l={accordion:n=>c.jsx(zt,{...n,userFlow:e,pageId:t}),aiChatPanel:n=>c.jsx(Ye,{...n,userFlow:e,pageId:t,chatPanelCallback:s}),aiSummaryCard:n=>c.jsx(Fe,{...n,userFlow:e,pageId:t}),aiPromptCodeEditor:n=>c.jsx(Pe,{...n,userFlow:e,pageId:t}),breadcrumbs:n=>c.jsx(rt,{...n,userFlow:e,pageId:t}),button:n=>c.jsx(ot,{...n,userFlow:e,pageId:t}),cardNotification:n=>c.jsx(lt,{...n}),chart:n=>c.jsx(Ae,{...n,userFlow:e}),checkbox:n=>c.jsx(it,{...n,userFlow:e,pageId:t}),code:n=>c.jsx(dt,{...n,userFlow:e,pageId:t}),divider:n=>c.jsx(ht,{...n}),drawer:n=>c.jsx(It,{...n,userFlow:e,pageId:t}),heading:n=>je(n),pill:n=>c.jsx(Ct,{...n}),modal:n=>c.jsx(pt,{...n,userFlow:e,pageId:t}),roundButton:n=>c.jsx(wt,{...n,userFlow:e,pageId:t}),row:n=>c.jsx(Te,{...n,userFlow:e,pageId:t}),select:n=>c.jsx(At,{...n,userFlow:e,pageId:t}),switch:n=>c.jsx(Tt,{...n,userFlow:e,pageId:t}),spacing:n=>c.jsx(Ot,{...n,userFlow:e,pageId:t}),table:n=>c.jsx(Lt,{...n,userFlow:e,pageId:t}),text:n=>Ce(n),textField:n=>c.jsx(qt,{...n,userFlow:e,pageId:t}),toast:n=>c.jsx(Bt,{...n,userFlow:e,pageId:t})};return(i=a==null?void 0:a.filter(Boolean))==null?void 0:i.map(n=>{const d=l[n.component];return d?d({...n,userFlow:e,pageId:t}):null})},xt={modalContent:"_modalContent_p06ci_1"},pt=({userFlow:e,pageId:t,responseKey:a,header:s,body:l,footer:o,headerStatusColor:i,...n})=>{const d=v(m=>{var p;return(p=m[e])==null?void 0:p.isModalOpen}),r=v(m=>{var p;return(p=m[e])==null?void 0:p.isLoading}),u=d&&!r,f={...n},_=(f==null?void 0:f.headerStatusColor)??i,h=x.useCallback(()=>{ne(e),se(e,!1)},[e,a]),C=Array.isArray(s)?D(e,t,s):s,y=D(e,t,l),g=D(e,t,o);return c.jsx(E.Modal,{...f,headerStatusColor:_,header:typeof C=="string"?C:c.jsx(c.Fragment,{children:C.map((m,p)=>c.jsx(x.Fragment,{children:m},`modal-header-${p}`))}),children:c.jsx("section",{className:xt.modalContent,children:y.map((m,p)=>c.jsx(x.Fragment,{children:m},`modal-body-${p}`))}),actions:c.jsx(c.Fragment,{children:g.map((m,p)=>c.jsx(x.Fragment,{children:m},`modal-footer-${p}`))}),open:u,onClose:h})},bt=({userFlow:e,pageId:t})=>{var o,i;const a=Je(e);if(!a)return null;const s=[...(a==null?void 0:a.components)||[],...((o=a==null?void 0:a.header)==null?void 0:o.components)||[],...((i=a==null?void 0:a.body)==null?void 0:i.components)||[]],l=D(e,t,s);return c.jsx(c.Fragment,{children:l==null?void 0:l.map((n,d)=>{const r=`overlay-${d}-${a==null?void 0:a.hash}`;return c.jsx(x.Fragment,{children:n},r)})})},jt={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},Ct=e=>{const{content:t,variant:a="neutral",...s}=e,l=jt[a],o={...s,children:t,color:(s==null?void 0:s.color)??l.color,textColor:(s==null?void 0:s.textColor)??l.textColor,iconColor:(s==null?void 0:s.iconColor)??l.iconColor};return c.jsx(E.Pill,{...o})},wt=e=>{const{userFlow:t,pageId:a,responseKey:s,actionType:l,dataSource:o,dependencies:i,onClick:n,...d}=e,{getNextUI:r,fetchAndGetNextUI:u}=I(),{disabled:f}=K(t,i),_={...d},h=(_==null?void 0:_.disabled)??f,C=x.useCallback(async()=>{var y;try{const g={...(y=v.getState()[t])==null?void 0:y.entries,[s]:{status:200}};switch(M(t,g),l){case"GO_TO_NEXT_UI":{const m=await r(t,a,g,s);m!=null&&m.data&&R(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await u(t,a,g,s,o);m!=null&&m.data&&R(t,m==null?void 0:m.data);break}case"CLOSE_MODAL":se(t,!1);break;case"CLOSE_DRAWER":X(t,!1);break;case"OPEN_DRAWER":X(t,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(g){alert(JSON.stringify(g))}},[l,o,a,s,t]);return c.jsx(E.RoundButton,{..._,disabled:h,onClick:()=>!h&&(n??C)()})},U={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},Te=e=>{const{userFlow:t,pageId:a,columnWidth:s,columns:l,gap:o="md",justifyContent:i="start",alignItems:n="stretch"}=e,d=Array.isArray(l)?l.map((r,u)=>{const f=`col_${u}`,_=`col_${u}`;if(Array.isArray(r))return{gap:"md",justifyContent:"start",alignItems:"start",items:r,hash:f,responseKey:_};const h=r;return{gap:(h==null?void 0:h.gap)??"md",justifyContent:(h==null?void 0:h.justifyContent)??"start",alignItems:(h==null?void 0:h.alignItems)??"start",items:(h==null?void 0:h.items)??[],hash:(h==null?void 0:h.hash)??f,responseKey:(h==null?void 0:h.responseKey)??_}}):[];return d.length===0?null:c.jsx("div",{className:$(U.row,U[`row__gap-${o}`],U[`row__justify-${i}`],U[`row__align-${n}`]),children:d==null?void 0:d.map((r,u)=>{const f=(s==null?void 0:s[u])||`${100/d.length}%`,_=D(t,a,r.items);return!_||_.length===0?null:c.jsx("div",{className:$(U.row_column,U[`row_column__gap-${r.gap}`],U[`row_column__justify-${r.justifyContent}`],U[`row_column__align-${r.alignItems}`]),style:{width:f},children:_},r.hash||u)})})};function Se({userFlow:e,pageId:t,responseKey:a,actionType:s,getNextUI:l,isMulti:o=!1,debounceMs:i}){const n=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.useCallback(async u=>{var h;const f={...(h=v.getState()[e])==null?void 0:h.entries,[a]:u};if(M(e,f),s&&(s==="GO_TO_NEXT_UI"||s==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const y=await l(e,t,f,a,s==="GO_TO_NEXT_UI");y!=null&&y.data&&R(e,y.data)}catch(C){console.error("[useSelectChange] Failed to fetch next UI",C)}},[e,t,a,s,l]);return x.useCallback(u=>{if(!o){d(u);return}if(i==null){d(u);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(u),n.current=null},i)},[o,i,d])}const Nt=(e,t,a,s)=>{const l=z.query(e,t);return(l==null?void 0:l.map(o=>{var d,r;const i=(d=z.query(o,a))==null?void 0:d[0],n=s?(r=z.query(o,s))==null?void 0:r[0]:o;return{label:i,value:n}}))??[]},Et=(e,t,a,s=10)=>{var n,d;let l,o;if(a){const r=z.value(e,a.size??"$.meta.size")??s,u=z.value(e,a.total??"$.meta.total")??0;l=r,o=u}else{const r=e==null?void 0:e.meta;l=(r==null?void 0:r.size)??((n=r==null?void 0:r.page)==null?void 0:n.size)??s,o=(r==null?void 0:r.total)??((d=r==null?void 0:r.page)==null?void 0:d.total)??0}const i=o>0?Math.ceil(o/l)>t:!1;return{pageSize:l,total:o,hasMore:i}},Re={selectNotFront:"_selectNotFront_1yw9q_1"},kt=({userFlow:e,pageId:t,responseKey:a,required:s,dataSource:l,actionType:o,dependencies:i,debounceMs:n,...d})=>{const r={...d},{getNextUI:u,fetchDataSource:f}=I(),[_,h]=x.useState((r==null?void 0:r.value)??""),{disabled:C}=K(e,i),y=(r==null?void 0:r.disabled)??C,g=x.useMemo(()=>s&&(r!=null&&r.label)?`${r==null?void 0:r.label} *`:(r==null?void 0:r.label)??"",[r==null?void 0:r.label,s]),m=x.useMemo(()=>{const b=r!=null&&r.isMulti?_:[_],N={};return typeof b=="object"&&"length"in b&&(b==null||b.forEach(w=>{const T=JSON.stringify(w.value),B=JSON.stringify(w.label);N[T]=w,B in N||(N[B]=w)})),N},[_]),p=Se({userFlow:e,pageId:t,responseKey:a,actionType:o,getNextUI:u,isMulti:r==null?void 0:r.isMulti,debounceMs:n}),j=b=>{h(b),p(b)},k=async(b,N,{page:w})=>{const{jsonPathLabel:T,jsonPathOptions:B,jsonPathValue:S,jsonPathPagination:V}=l,J=oe(l,w,b),_e=await f(J,e,!1),ue=_e==null?void 0:_e.data,Gt=ue?Nt(ue,B,T,S):[],{hasMore:Ut}=Et(ue,w,V);return{options:Gt,hasMore:Ut,additional:{page:b?1:w+1}}};return c.jsx(E.SelectPagination,{...r,className:Re.selectNotFront,label:g,value:_,disabled:y,noOptionsMessage:()=>c.jsx(c.Fragment,{children:"Sin opciones"}),onChange:b=>!y&&j(b),loadOptions:k,additional:{page:1},isOptionDisabled:b=>{const N=JSON.stringify(b==null?void 0:b.value),w=JSON.stringify(b==null?void 0:b.label);return!!(m!=null&&m[N])||!!(m!=null&&m[w])},debounceTimeout:350})},vt=({userFlow:e,pageId:t,responseKey:a,dataSource:s,required:l,actionType:o,dependencies:i,debounceMs:n,...d})=>{const r={...d},{getNextUI:u}=I(),[f,_]=x.useState(r.value||""),{disabled:h}=K(e,i),C=(r==null?void 0:r.disabled)??h,y=x.useMemo(()=>l&&(r!=null&&r.label)?`${r==null?void 0:r.label} *`:(r==null?void 0:r.label)??"",[r==null?void 0:r.label,l]),g=Se({userFlow:e,pageId:t,responseKey:a,actionType:o,getNextUI:u,isMulti:r==null?void 0:r.isMulti,debounceMs:n}),m=p=>{_(p),g(p)};return c.jsx(E.Select,{...r,className:Re.selectNotFront,label:y,value:f,disabled:C,onChange:p=>!C&&m(p)})},At=e=>{const{dataSource:t}=e;return t?c.jsx(kt,{...e}):c.jsx(vt,{...e})},De={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},Ot=e=>{const{size:t}=e,a=$(De.spacing,De[`spacing__${t}`]);return c.jsx("div",{className:a})},Tt=e=>{const{userFlow:t,pageId:a,responseKey:s,actionType:l,label:o,value:i,required:n,dependencies:d,...r}=e,u={...r},{getNextUI:f}=I(),[_,h]=x.useState(i||!1),{disabled:C}=K(t,d),y=(u==null?void 0:u.disabled)??C,g=x.useMemo(()=>n&&o?`${o} *`:o??"",[o,n]),m=x.useCallback(async()=>{var p;try{const j=!_;h(j);const k={...(p=v.getState()[t])==null?void 0:p.entries,[s]:j};switch(M(t,k),l){case"GO_TO_NEXT_UI":const b=await f(t,a,k,s);b!=null&&b.data&&R(t,b==null?void 0:b.data);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(j){console.error("Error in switch action:",j),alert(JSON.stringify(j))}},[t,a,s,l,_]);return c.jsx(E.Switch,{...u,label:g,checked:_,disabled:y,onChange:()=>!y&&m()})},Le={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},St=({values:e})=>{const a=e==null?void 0:e.slice(0,4),s=(e==null?void 0:e.length)-4;return c.jsxs("div",{className:Le.tableArrayPills,children:[a.map((l,o)=>c.jsx(E.Pill,{children:String(l)},o)),s>0&&c.jsxs(E.Pill,{outlined:!0,children:["+",s]})]})},Rt=({userFlow:e,pageId:t,tableResponseKey:a,component:s,rowData:l})=>{const{getNextUI:o,fetchAndGetNextUI:i,fetchDataSource:n}=I(),d=D(e,t,[{...s}]),r=(d==null?void 0:d[0])||null;if(!r)return null;const{actionType:u,responseKey:f,dataSource:_}=r.props,h=x.useCallback(async()=>{var C,y,g;try{const m={...(C=v.getState()[e])==null?void 0:C.entries,[f]:{status:200},[a]:[{...l}]};switch(M(e,m),u){case"GO_TO_NEXT_UI":{const p=await o(e,t,m,f);p!=null&&p.data&&R(e,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await i(e,t,m,f,_);p!=null&&p.data&&R(e,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await o(e,t,m,f),j=(y=p==null?void 0:p.data)==null?void 0:y.content;if((j==null?void 0:j.type)!=="fetch")break;const k=j==null?void 0:j.dataSource,b=await n(k,e,!1),N={...(g=v.getState()[e])==null?void 0:g.entries,[f]:{status:b==null?void 0:b.status,content:b==null?void 0:b.data}};M(e,N);const w=await o(e,t,N,f);w!=null&&w.data&&R(e,w==null?void 0:w.data);break}default:console.warn(`Unhandled actionType: ${u}`);break}}catch(m){alert(JSON.stringify(m))}},[u,_,t,f,e]);return x.cloneElement(r,{onClick:h})},Dt=()=>c.jsx("div",{className:Le.tableSkeleton,children:[...Array(10)].map((e,t)=>c.jsx(E.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${t}`))}),Lt=({userFlow:e,pageId:t,responseKey:a,component:s,dataSource:l,rightActions:o,...i})=>{var j,k,b;const{fetchDataSource:n}=I(),[d,r]=x.useState(!1),[u,f]=x.useState(1),[_,h]=x.useState(null),C=x.useMemo(()=>{if(o!=null&&o.length)return o.map((N,w)=>({renderContent:T=>c.jsx(Rt,{userFlow:e,pageId:t,tableResponseKey:a,component:N,rowData:T},`tableRowAction${w}`)}))},[o,e,t]),y=async(N=1)=>{try{r(!0);const{jsonPathData:w,mapperData:T,jsonPathPagination:B}=l,S=oe(l,N),V=await n(S,e,!1);h(ve(V==null?void 0:V.data,w,T,B)),r(!1)}catch(w){alert(JSON.stringify(w)),r(!1)}},g=N=>{f(N),y(N)};x.useEffect(()=>{y()},[]);const m=x.useMemo(()=>!(_!=null&&_.items)||!(i!=null&&i.columns)?i==null?void 0:i.columns:i.columns.map(N=>{var T;return((T=_==null?void 0:_.items)==null?void 0:T.some(B=>Array.isArray(N!=null&&N.accessor?B[N==null?void 0:N.accessor]:void 0)))?{...N,renderCell:B=>{const S=N.accessor?B[N.accessor]:void 0;return Array.isArray(S)?c.jsx(St,{values:S}):S}}:N}),[_==null?void 0:_.items,i==null?void 0:i.columns]),p={...i,data:_==null?void 0:_.items,columns:m,rightActions:C};return c.jsx(c.Fragment,{children:d?c.jsx(Dt,{}):_&&((j=_==null?void 0:_.items)==null?void 0:j.length)>0?c.jsxs(c.Fragment,{children:[c.jsx(E.Table,{...p}),(_==null?void 0:_.pagination)&&((k=_==null?void 0:_.pagination)==null?void 0:k.totalPages)>1&&c.jsx(E.Pager,{classname:{global:"row__end"},page:u,size:_==null?void 0:_.pagination.size,total:(b=_==null?void 0:_.pagination)==null?void 0:b.total,onChange:g})]}):c.jsx(E.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Mt={textFieldNotFront:"_textFieldNotFront_cps4i_1"},qt=e=>{const{userFlow:t,pageId:a,component:s,hash:l,responseKey:o,required:i,dependencies:n,...d}=e,r={...d},[u,f]=x.useState((r==null?void 0:r.value)??""),{disabled:_}=K(t,n),h=(r==null?void 0:r.disabled)??_,C=x.useMemo(()=>i&&(r!=null&&r.label)?`${r==null?void 0:r.label} *`:(r==null?void 0:r.label)??"",[r==null?void 0:r.label,i]),y=g=>{var j;const m=(j=g==null?void 0:g.target)==null?void 0:j.value;f(m);const p={[o]:m};M(t,p)};return x.useEffect(()=>{f((r==null?void 0:r.value)??"")},[r==null?void 0:r.value]),c.jsx(E.TextField,{...r,className:Mt.textFieldNotFront,allowClear:!1,label:C,value:u,disabled:h,onChange:g=>!h&&y(g)})},Bt=({userFlow:e,pageId:t,responseKey:a,variant:s,content:l,actionType:o,redirectUrl:i})=>{const n=x.useCallback(async()=>{ne(e);try{switch(o){case"AUTOCLOSE_AND_REDIRECT":window.location.href=i;break;default:console.warn(`Unhandled actionType: ${o}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[o,t,a,e,i]);return x.useEffect(()=>{({info:E.toast.info,error:E.toast.error,success:E.toast.success,warning:E.toast.warning}[s]||E.toast.info)(l,{autoClose:o?!1:4e3,containerId:e,onClose:n})},[n,e]),null},Me={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},zt=e=>{const{userFlow:t,pageId:a,responseKey:s,dependencies:l,customContent:o,actionContent:i,components:n,...d}=e,{getNextUI:r}=I(),[u,f]=x.useState(d.checkboxChecked||!1),{disabled:_}=K(t,l),h=D(t,a,n),C=i?D(t,a,i):void 0,y=o?D(t,a,o):void 0,g=x.useCallback(async j=>{var k;try{const b=j.target.checked;f(b);const N={...(k=v.getState()[t])==null?void 0:k.entries,[s]:b};if(M(t,N),d.actionType==="GO_TO_NEXT_UI"){const w=await r(t,a,N,s);w!=null&&w.data&&R(t,w==null?void 0:w.data)}}catch(b){console.error("Error in accordion checkbox action:",b),alert(JSON.stringify(b))}},[t,a,s,d.actionType,r]),m=d.disabled||_,p={...d,className:Me.accordion,disabled:m,checkboxChecked:u,onChanceCheckbox:d.hasCheckbox?g:void 0,actionContent:C?c.jsx(c.Fragment,{children:C.map((j,k)=>c.jsx(x.Fragment,{children:j},`accordion-action-${k}`))}):void 0,customContent:y?c.jsx(c.Fragment,{children:y.map((j,k)=>c.jsx(x.Fragment,{children:j},`accordion-custom-${k}`))}):void 0,children:h?c.jsx("section",{className:Me.accordionBody,children:h.map((j,k)=>c.jsx(x.Fragment,{children:j},`accordion-child-${k}`))}):void 0};return c.jsx(E.Accordion,{...p})},de={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},It=({userFlow:e,pageId:t,responseKey:a,header:s,body:l,footer:o,...i})=>{const n=v(y=>{var g;return(g=y[e])==null?void 0:g.isDrawerOpen}),d=v(y=>{var g;return(g=y[e])==null?void 0:g.isLoading}),r=n&&!d,u={...i,isOpen:r,children:null},f=x.useCallback(()=>{ne(e),X(e,!1)},[e]),_=Array.isArray(s)?D(e,t,s):s?c.jsx(E.Heading,{type:"h2",children:s}):void 0,h=D(e,t,l),C=o?D(e,t,o):void 0;return c.jsx(E.Drawer,{...u,className:de.drawer,isOpen:r,onClose:f,heightGap:0,title:_?c.jsx(c.Fragment,{children:Array.isArray(_)?_.map((y,g)=>c.jsx(x.Fragment,{children:y},`drawer-header-${g}`)):_}):void 0,children:c.jsx("section",{className:de.drawerBody,children:h.map((y,g)=>c.jsx(x.Fragment,{children:y},`drawer-body-${g}`))}),footer:C?c.jsx("div",{className:de.drawerFooter,children:C.map((y,g)=>c.jsx(x.Fragment,{children:y},`drawer-footer-${g}`))}):void 0})},qe=(e,t,a,s,l)=>{const o=D(e,t,(s==null?void 0:s.components)||null,l);switch(a){case"body":return c.jsx(et,{...s,inputs:o||[]},JSON.stringify(s==null?void 0:s.components));case"header":return c.jsx(gt,{...s,components:o||[]},JSON.stringify(s==null?void 0:s.components));default:return null}},Kt=(e,t,a,s)=>{var _,h,C;const[l,o]=x.useState(!1),i=v(y=>y),n=(_=i[e])==null?void 0:_.currentPageId,d=n?qe(e,n,"header",((h=i[e].pages[n].page)==null?void 0:h.header)||null,s):null,r=n?qe(e,n,"body",((C=i[e].pages[n].page)==null?void 0:C.body)||null,s):null,u=x.useMemo(()=>{var y;return c.jsxs(c.Fragment,{children:[((y=i[e])==null?void 0:y.isLoading)&&c.jsx(E.Loading,{}),d,r,n&&c.jsx(bt,{userFlow:e,pageId:n}),i[e]&&c.jsx(E.Toaster,{})]})},[d,r,n,e]),f=async()=>{var y;try{const g=await Ee(t,e),m=(y=g==null?void 0:g.data)==null?void 0:y.content;(g==null?void 0:g.status)===200?te(e,t,m):o(!0)}catch(g){console.error("[not-page]: API call failed",g),o(!0)}};return x.useEffect(()=>{t!=null&&t.api&&!a&&e?f():!(t!=null&&t.api)&&a&&e||t!=null&&t.api&&a&&e?te(e,t,a):(!(t!=null&&t.api)&&!a||!e)&&(o(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const y="avocado-theme-mode-changed",g=m=>{const p=m.detail;E.ThemeStore.setThemeMode(p)};return window.addEventListener(y,g),()=>{window.removeEventListener(y,g)}},[]),l&&console.error("[not-page]: No render page"),u};A.Chart=Ae,A.Row=Te,A.heading=je,A.text=Ce,A.usePage=Kt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
@@ -114,4 +114,5 @@ export interface NextUIResponseData {
114
114
  content: PageContent | FetchContent | OverlayContent;
115
115
  deprecatedStateKeys: string[];
116
116
  sessionId: string;
117
+ sessionState: Record<string, unknown>;
117
118
  }
@@ -1,4 +1,5 @@
1
1
  import { ButtonProps, CardNotificationProps, CheckboxProps, DividerProps, HeadingProps, PillProps, RoundButtonProps, SelectProps, SwitchProps, TableProps, TextFieldProps, TextProps, ModalProps, AccordionProps, DrawerProps } from '../../../avocado-suite';
2
+ import type { SupportedLocale } from '../../../ai-agent';
2
3
  import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource, NotFrontDataSourceChart, NotFrontDataSourceRest, NotFrontDataSourceSelect, NotFrontDataSourceTable, NotFrontDependency } from './componentsCore.type';
3
4
  /**
4
5
  * Represents a single breadcrumb item for the NotFront component
@@ -477,7 +478,14 @@ export interface AccordionNotFrontProps extends NotFrontBaseProps, Omit<Accordio
477
478
  export interface AISummaryCardNotFrontProps extends NotFrontBaseProps {
478
479
  component: 'aiSummaryCard';
479
480
  dataSource: NotFrontDataSource;
480
- title: string;
481
+ /** Locale for default translations. Defaults to "en" if not provided. */
482
+ locale?: SupportedLocale;
483
+ /** Labels for title, loading and empty state. All keys are optional; defaults are used when omitted. */
484
+ translations?: {
485
+ title?: string;
486
+ loading?: string;
487
+ noData?: string;
488
+ };
481
489
  }
482
490
  export interface AIChatPanelNotFrontProps extends NotFrontBaseProps {
483
491
  component: 'aiChatPanel';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foris/avocado-not-front",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -48,7 +48,7 @@
48
48
  "recharts": "3.1.0",
49
49
  "zustand": "4.5.4",
50
50
  "@uiw/react-codemirror": "4.23.12",
51
- "@foris/ai-agent": "0.10.0",
51
+ "@foris/ai-agent": "0.10.1",
52
52
  "@foris/avocado-core": "1.1.0",
53
53
  "@foris/avocado-icons": "1.16.1",
54
54
  "@foris/avocado-suite": "1.8.0",
@@ -69,7 +69,7 @@
69
69
  "recharts": ">=3.0.0",
70
70
  "streamdown": ">=1.6.0",
71
71
  "zustand": ">=4.0.0",
72
- "@foris/ai-agent": "0.10.0",
72
+ "@foris/ai-agent": "0.10.1",
73
73
  "@foris/avocado-core": "1.1.0",
74
74
  "@foris/avocado-icons": "1.16.1",
75
75
  "@foris/avocado-suite": "1.8.0"