@isettingkit/business-rules 0.1.27 → 0.1.29

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.
Files changed (2) hide show
  1. package/dist/index.es.js +453 -452
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -1,45 +1,45 @@
1
- import { jsxs as c, Fragment as A, jsx as t } from "react/jsx-runtime";
2
- import { ValueDataType as V, ValueHowToSetUp as m, InputRange as ee, MultipleChoices as te, DynamicField as ae } from "@isettingkit/input";
1
+ import { jsxs as c, Fragment as _, jsx as a } from "react/jsx-runtime";
2
+ import { ValueDataType as F, ValueHowToSetUp as f, InputRange as ae, MultipleChoices as re, DynamicField as ne } from "@isettingkit/input";
3
3
  import { Stack as s } from "@inubekit/stack";
4
- import { Divider as S } from "@inubekit/divider";
5
- import { Button as B } from "@inubekit/button";
6
- import { useState as _, useEffect as re } from "react";
7
- import { Text as C } from "@inubekit/text";
8
- import { Date as G } from "@inubekit/date";
9
- import { Checkbox as ne } from "@inubekit/checkbox";
4
+ import { Divider as T } from "@inubekit/divider";
5
+ import { Button as P } from "@inubekit/button";
6
+ import { useState as z, useEffect as oe } from "react";
7
+ import { Text as y } from "@inubekit/text";
8
+ import { Date as Q } from "@inubekit/date";
9
+ import { Checkbox as le } from "@inubekit/checkbox";
10
10
  import { Toggle as K } from "@inubekit/toggle";
11
- import { inube as k } from "@inubekit/foundations";
12
- import x, { keyframes as oe } from "styled-components";
13
- import { useFormik as le } from "formik";
14
- import { mixed as X, object as F, number as N, string as H, date as P, lazy as ie } from "yup";
11
+ import { inube as S } from "@inubekit/foundations";
12
+ import b, { keyframes as de } from "styled-components";
13
+ import { useFormik as ie } from "formik";
14
+ import { mixed as X, object as V, number as L, string as B, date as Y, lazy as se } from "yup";
15
15
  import { DecisionViewConditionRenderer as q } from "@isettingkit/view";
16
16
  import { SkeletonLine as D } from "@inubekit/skeleton";
17
- import { MdOutlineDelete as de, MdClear as se, MdAdd as ce } from "react-icons/md";
17
+ import { MdOutlineDelete as ce, MdClear as ue, MdAdd as he } from "react-icons/md";
18
18
  import { Icon as Z } from "@inubekit/icon";
19
- import { createPortal as ue } from "react-dom";
20
- import { Blanket as he } from "@inubekit/blanket";
21
- import { Grid as pe } from "@inubekit/grid";
22
- import { useMediaQuery as me } from "@inubekit/hooks";
23
- const ge = (r) => {
19
+ import { createPortal as pe } from "react-dom";
20
+ import { Blanket as ge } from "@inubekit/blanket";
21
+ import { Grid as me } from "@inubekit/grid";
22
+ import { useMediaQuery as be } from "@inubekit/hooks";
23
+ const fe = (e) => {
24
24
  const {
25
- onHandleStartChange: e,
26
- onHandleEndChange: l,
25
+ onHandleStartChange: t,
26
+ onHandleEndChange: o,
27
27
  onCheckClosedChange: d,
28
28
  labelStart: h,
29
- labelEnd: a,
29
+ labelEnd: r,
30
30
  checkedClosed: i = !1,
31
- required: o = !1,
31
+ required: l = !1,
32
32
  valueStart: u = "",
33
33
  valueEnd: p = "",
34
- messageStart: f = "",
34
+ messageStart: m = "",
35
35
  messageEnd: g = "",
36
36
  statusStart: v = "pending",
37
- statusEnd: b = "pending"
38
- } = r, [n, U] = _(i), [$, I] = _(u), [R, L] = _(p);
39
- return /* @__PURE__ */ c(A, { children: [
37
+ statusEnd: w = "pending"
38
+ } = e, [n, R] = z(i), [N, I] = z(u), [U, $] = z(p);
39
+ return /* @__PURE__ */ c(_, { children: [
40
40
  /* @__PURE__ */ c(s, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
41
- /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
42
- C,
41
+ /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(
42
+ y,
43
43
  {
44
44
  appearance: "gray",
45
45
  margin: "10px 0",
@@ -49,19 +49,19 @@ const ge = (r) => {
49
49
  children: "Vigencia"
50
50
  }
51
51
  ) }),
52
- /* @__PURE__ */ t(
52
+ /* @__PURE__ */ a(
53
53
  s,
54
54
  {
55
55
  alignContent: "center",
56
56
  justifyContent: "center",
57
57
  wrap: "wrap",
58
58
  gap: "4px",
59
- children: /* @__PURE__ */ t(
60
- ne,
59
+ children: /* @__PURE__ */ a(
60
+ le,
61
61
  {
62
62
  label: "Cerrada",
63
- onChange: ({ target: y }) => {
64
- U(y.checked), d && d(y.checked);
63
+ onChange: ({ target: x }) => {
64
+ R(x.checked), d && d(x.checked);
65
65
  },
66
66
  checked: n,
67
67
  value: ""
@@ -71,44 +71,44 @@ const ge = (r) => {
71
71
  )
72
72
  ] }),
73
73
  /* @__PURE__ */ c(s, { justifyContent: "space-between", gap: "24px", children: [
74
- /* @__PURE__ */ t(s, { width: "189px", children: /* @__PURE__ */ t(
75
- G,
74
+ /* @__PURE__ */ a(s, { width: "189px", children: /* @__PURE__ */ a(
75
+ Q,
76
76
  {
77
77
  id: "dateStart",
78
78
  label: h,
79
- onChange: (y) => {
80
- I(y.target.value), e(y);
79
+ onChange: (x) => {
80
+ I(x.target.value), t(x);
81
81
  },
82
- value: $,
83
- required: o,
82
+ value: N,
83
+ required: l,
84
84
  size: "compact",
85
85
  status: v,
86
- message: f
86
+ message: m
87
87
  }
88
88
  ) }),
89
- n && /* @__PURE__ */ t(s, { width: "189px", children: /* @__PURE__ */ t(
90
- G,
89
+ n && /* @__PURE__ */ a(s, { width: "189px", children: /* @__PURE__ */ a(
90
+ Q,
91
91
  {
92
92
  id: "dateEnd",
93
- label: a,
94
- onChange: (y) => {
95
- L(y.target.value), l(y);
93
+ label: r,
94
+ onChange: (x) => {
95
+ $(x.target.value), o(x);
96
96
  },
97
- value: R,
98
- required: o,
97
+ value: U,
98
+ required: l,
99
99
  size: "compact",
100
- status: b,
100
+ status: w,
101
101
  message: g
102
102
  }
103
103
  ) })
104
104
  ] })
105
105
  ] });
106
- }, be = x.div`
106
+ }, ve = b.div`
107
107
  & > div {
108
108
  border-radius: 8px;
109
- border: 1px solid ${k.palette.neutral.N30};
109
+ border: 1px solid ${S.palette.neutral.N30};
110
110
  }
111
- `, fe = x.div`
111
+ `, xe = b.div`
112
112
  width: 100%;
113
113
  height: 100%;
114
114
  overflow-y: auto;
@@ -125,124 +125,124 @@ const ge = (r) => {
125
125
  background-color: #ebecf0;
126
126
  border-radius: 8px;
127
127
  }
128
- `, xe = (r) => {
128
+ `, ye = (e) => {
129
129
  const {
130
- checked: e,
131
- children: l,
130
+ checked: t,
131
+ children: o,
132
132
  handleToggleChange: d,
133
133
  id: h,
134
- labelToggle: a,
134
+ labelToggle: r,
135
135
  name: i,
136
- valueToggle: o = ""
137
- } = r, [u, p] = _(e), f = (g) => {
136
+ valueToggle: l = ""
137
+ } = e, [u, p] = z(t), m = (g) => {
138
138
  p(g.target.checked), d(g);
139
139
  };
140
- return re(() => {
141
- p(e);
142
- }, [e]), /* @__PURE__ */ c(A, { children: [
143
- /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
140
+ return oe(() => {
141
+ p(t);
142
+ }, [t]), /* @__PURE__ */ c(_, { children: [
143
+ /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(
144
144
  K,
145
145
  {
146
146
  checked: u,
147
147
  id: h,
148
148
  name: i,
149
- onChange: f,
149
+ onChange: m,
150
150
  size: "small",
151
- value: o,
152
- children: /* @__PURE__ */ t(C, { size: "medium", type: "label", weight: "bold", children: a })
151
+ value: l,
152
+ children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: r })
153
153
  }
154
154
  ) }),
155
- u && /* @__PURE__ */ t(A, { children: l })
155
+ u && /* @__PURE__ */ a(_, { children: o })
156
156
  ] });
157
- }, ve = (r) => ({
157
+ }, Ce = (e) => ({
158
158
  schema: X().test(
159
159
  "isArrayOrString",
160
160
  "Must be an array of strings/numbers or a single string",
161
- (e) => Array.isArray(e) ? e.every(
162
- (l) => typeof l == "string" || typeof l == "number"
163
- ) : typeof e == "string"
161
+ (t) => Array.isArray(t) ? t.every(
162
+ (o) => typeof o == "string" || typeof o == "number"
163
+ ) : typeof t == "string"
164
164
  ),
165
- value: r
166
- }), ye = (r) => ({
165
+ value: e
166
+ }), we = (e) => ({
167
167
  schema: X().test(
168
168
  "isArrayOrString",
169
169
  "Must be an array of strings/numbers or a single string",
170
- (e) => Array.isArray(e) ? e.every(
171
- (l) => typeof l == "string" || typeof l == "number"
172
- ) : typeof e == "string"
170
+ (t) => Array.isArray(t) ? t.every(
171
+ (o) => typeof o == "string" || typeof o == "number"
172
+ ) : typeof t == "string"
173
173
  ),
174
- value: r
175
- }), Ce = (r) => {
176
- const e = (r == null ? void 0 : r.from) ?? 0, l = (r == null ? void 0 : r.to) ?? 0;
174
+ value: e
175
+ }), Se = (e) => {
176
+ const t = (e == null ? void 0 : e.from) ?? 0, o = (e == null ? void 0 : e.to) ?? 0;
177
177
  return {
178
- schema: F({
179
- from: N().required("Range From is required").max(l, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
180
- to: N().required("Range To is required").min(e, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
178
+ schema: V({
179
+ from: L().required("Range From is required").max(o, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
180
+ to: L().required("Range To is required").min(t, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
181
181
  }),
182
- value: { from: e, to: l }
182
+ value: { from: t, to: o }
183
183
  };
184
- }, j = (r, e) => e === V.PERCENTAGE ? {
185
- schema: N().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
186
- value: r
184
+ }, j = (e, t) => t === F.PERCENTAGE ? {
185
+ schema: L().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
186
+ value: e
187
187
  } : {
188
- schema: H().required("Required"),
189
- value: r
190
- }, we = (r) => ({
191
- schema: H().required("Required").test(
188
+ schema: B().required("Required"),
189
+ value: e
190
+ }, ke = (e) => ({
191
+ schema: B().required("Required").test(
192
192
  "non-empty",
193
193
  "Value cannot be empty",
194
- (e) => e != null && e.trim() !== ""
194
+ (t) => t != null && t.trim() !== ""
195
195
  ),
196
- value: r
197
- }), ke = {
198
- [m.LIST_OF_VALUES]: ve,
199
- [m.LIST_OF_VALUES_MULTI]: ye,
200
- [m.RANGE]: Ce,
201
- [m.GREATER_THAN]: j,
202
- [m.LESS_THAN]: j,
203
- [m.EQUAL]: j
204
- }, Se = (r) => ke[r] || we;
205
- function Te({ decision: r, onSubmitEvent: e }) {
206
- const l = {
207
- name: r.name || "",
208
- dataType: r.dataType || "",
209
- valueUse: r.valueUse || "",
210
- value: r.value || { from: 0, to: 0 },
211
- startDate: r.startDate || "",
212
- endDate: r.endDate || "",
196
+ value: e
197
+ }), Te = {
198
+ [f.LIST_OF_VALUES]: Ce,
199
+ [f.LIST_OF_VALUES_MULTI]: we,
200
+ [f.RANGE]: Se,
201
+ [f.GREATER_THAN]: j,
202
+ [f.LESS_THAN]: j,
203
+ [f.EQUAL]: j
204
+ }, Ee = (e) => Te[e] || ke;
205
+ function De({ decision: e, onSubmitEvent: t }) {
206
+ const o = {
207
+ name: e.name || "",
208
+ dataType: e.dataType || "",
209
+ valueUse: e.valueUse || "",
210
+ value: e.value || { from: 0, to: 0 },
211
+ startDate: e.startDate || "",
212
+ endDate: e.endDate || "",
213
213
  toggleNone: !0,
214
214
  conditions: {},
215
215
  checkClosed: !1
216
- }, d = F({
217
- name: H().required("Name is required"),
218
- startDate: P().required("Start date is required"),
219
- endDate: P().when("checkClosed", (i, o, { parent: u }) => (u == null ? void 0 : u.checkClosed) ? o.required("End date is required").test(
216
+ }, d = V({
217
+ name: B().required("Name is required"),
218
+ startDate: Y().required("Start date is required"),
219
+ endDate: Y().when("checkClosed", (i, l, { parent: u }) => (u == null ? void 0 : u.checkClosed) ? l.required("End date is required").test(
220
220
  "is-after-startDate",
221
221
  "End date must be greater than or equal to Start date",
222
- function(f) {
222
+ function(m) {
223
223
  const g = this.parent.startDate;
224
- return !g || !f ? !0 : new Date(f) >= new Date(g);
224
+ return !g || !m ? !0 : new Date(m) >= new Date(g);
225
225
  }
226
- ) : o.notRequired()),
227
- value: F({
228
- from: N().min(0, "From value must be greater than or equal to 0").required("From value is required"),
229
- to: N().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
226
+ ) : l.notRequired()),
227
+ value: V({
228
+ from: L().min(0, "From value must be greater than or equal to 0").required("From value is required"),
229
+ to: L().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
230
230
  "is-greater",
231
231
  "To value must be greater than From value",
232
232
  function(i) {
233
- const { from: o } = this.parent;
234
- return i > o;
233
+ const { from: l } = this.parent;
234
+ return i > l;
235
235
  }
236
236
  )
237
237
  }).required("Range value is required"),
238
- conditions: ie((i, { parent: o }) => {
239
- var p, f;
240
- return (o == null ? void 0 : o.toggleNone) && ((p = o == null ? void 0 : o.conditions) == null ? void 0 : p.length) > 0 ? F().shape({}) : F(
241
- (f = r.conditions) == null ? void 0 : f.reduce(
238
+ conditions: se((i, { parent: l }) => {
239
+ var p, m;
240
+ return (l == null ? void 0 : l.toggleNone) && ((p = l == null ? void 0 : l.conditions) == null ? void 0 : p.length) > 0 ? V().shape({}) : V(
241
+ (m = e.conditions) == null ? void 0 : m.reduce(
242
242
  (g, v) => {
243
243
  if (h.values.conditions[v.name] !== void 0) {
244
- const b = Se(v.valueUse);
245
- g[v.name] = b(
244
+ const w = Ee(v.valueUse);
245
+ g[v.name] = w(
246
246
  v.value,
247
247
  v.dataType
248
248
  ).schema;
@@ -253,66 +253,66 @@ function Te({ decision: r, onSubmitEvent: e }) {
253
253
  )
254
254
  );
255
255
  })
256
- }), h = le({
257
- initialValues: l,
256
+ }), h = ie({
257
+ initialValues: o,
258
258
  validationSchema: d,
259
259
  validateOnBlur: !0,
260
260
  onSubmit: (i) => {
261
261
  var u;
262
- const o = {
263
- ...r,
262
+ const l = {
263
+ ...e,
264
264
  name: i.name,
265
265
  dataType: i.dataType,
266
266
  valueUse: i.valueUse,
267
267
  value: i.value,
268
268
  startDate: i.startDate,
269
269
  endDate: i.endDate,
270
- conditions: (u = r.conditions) == null ? void 0 : u.map((p) => ({
270
+ conditions: (u = e.conditions) == null ? void 0 : u.map((p) => ({
271
271
  ...p,
272
272
  value: i.conditions[p.name]
273
273
  }))
274
274
  };
275
- e(o);
275
+ t(l);
276
276
  }
277
277
  });
278
278
  return { formik: h, handleToggleNoneChange: (i) => {
279
- var o;
280
- h.setFieldValue("toggleNone", i), (o = r.conditions) == null || o.forEach((u) => {
279
+ var l;
280
+ h.setFieldValue("toggleNone", i), (l = e.conditions) == null || l.forEach((u) => {
281
281
  if (i)
282
282
  h.setFieldValue(`conditions.${u.name}`, void 0);
283
283
  else {
284
- const p = u.valueUse === m.LIST_OF_VALUES_MULTI ? [] : "";
284
+ const p = u.valueUse === f.LIST_OF_VALUES_MULTI ? [] : "";
285
285
  h.setFieldValue(`conditions.${u.name}`, p);
286
286
  }
287
287
  });
288
288
  } };
289
289
  }
290
- const De = (r) => {
291
- var o, u, p, f, g, v, b;
292
- const { decision: e, onSubmitEvent: l, textValues: d, onCancel: h } = r, { formik: a, handleToggleNoneChange: i } = Te({
293
- decision: e,
294
- onSubmitEvent: l
290
+ const Ae = (e) => {
291
+ var l, u, p, m, g, v, w;
292
+ const { decision: t, onSubmitEvent: o, textValues: d, onCancel: h } = e, { formik: r, handleToggleNoneChange: i } = De({
293
+ decision: t,
294
+ onSubmitEvent: o
295
295
  });
296
- return /* @__PURE__ */ t("form", { onSubmit: a.handleSubmit, children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
297
- /* @__PURE__ */ t(
298
- ee,
296
+ return /* @__PURE__ */ a("form", { onSubmit: r.handleSubmit, children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
297
+ /* @__PURE__ */ a(
298
+ ae,
299
299
  {
300
300
  id: "valueRange",
301
- typeInput: e.dataType.toLowerCase(),
302
- label: e.name,
303
- valueFrom: a.values.value.from,
304
- valueTo: a.values.value.to,
305
- handleInputChangeFrom: (n) => a.setFieldValue("value.from", n),
306
- handleInputChangeTo: (n) => a.setFieldValue("value.to", n),
307
- messageFrom: (o = a.errors.value) == null ? void 0 : o.from,
308
- messageTo: (u = a.errors.value) == null ? void 0 : u.to,
309
- statusFrom: (p = a.touched.value) != null && p.from ? (f = a.errors.value) != null && f.from ? "invalid" : "valid" : "pending",
310
- statusTo: (g = a.touched.value) != null && g.to ? (v = a.errors.value) != null && v.to ? "invalid" : "valid" : "pending",
311
- onBlur: a.handleBlur
301
+ typeInput: t.dataType.toLowerCase(),
302
+ label: t.name,
303
+ valueFrom: r.values.value.from,
304
+ valueTo: r.values.value.to,
305
+ handleInputChangeFrom: (n) => r.setFieldValue("value.from", n),
306
+ handleInputChangeTo: (n) => r.setFieldValue("value.to", n),
307
+ messageFrom: (l = r.errors.value) == null ? void 0 : l.from,
308
+ messageTo: (u = r.errors.value) == null ? void 0 : u.to,
309
+ statusFrom: (p = r.touched.value) != null && p.from ? (m = r.errors.value) != null && m.from ? "invalid" : "valid" : "pending",
310
+ statusTo: (g = r.touched.value) != null && g.to ? (v = r.errors.value) != null && v.to ? "invalid" : "valid" : "pending",
311
+ onBlur: r.handleBlur
312
312
  }
313
313
  ),
314
- /* @__PURE__ */ t(S, { dashed: !0 }),
315
- /* @__PURE__ */ t(be, { children: /* @__PURE__ */ t(fe, { children: /* @__PURE__ */ c(
314
+ /* @__PURE__ */ a(T, { dashed: !0 }),
315
+ /* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ c(
316
316
  s,
317
317
  {
318
318
  direction: "column",
@@ -321,91 +321,91 @@ const De = (r) => {
321
321
  height: "272px",
322
322
  children: [
323
323
  /* @__PURE__ */ c(s, { direction: "row", justifyContent: "space-between", children: [
324
- /* @__PURE__ */ t(C, { children: d.factsThatConditionIt }),
325
- /* @__PURE__ */ t(
324
+ /* @__PURE__ */ a(y, { children: d.factsThatConditionIt }),
325
+ /* @__PURE__ */ a(
326
326
  K,
327
327
  {
328
328
  id: "toggleNone",
329
- onChange: () => i(!a.values.toggleNone),
330
- checked: a.values.toggleNone,
329
+ onChange: () => i(!r.values.toggleNone),
330
+ checked: r.values.toggleNone,
331
331
  size: "small",
332
- children: /* @__PURE__ */ t(C, { size: "medium", type: "label", weight: "bold", children: d.none })
332
+ children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: d.none })
333
333
  }
334
334
  )
335
335
  ] }),
336
- /* @__PURE__ */ t(s, { direction: "column", gap: "20px", children: (b = e.conditions) == null ? void 0 : b.map((n) => {
337
- var U, $, I, R, L, z, M;
338
- return /* @__PURE__ */ t(
339
- xe,
336
+ /* @__PURE__ */ a(s, { direction: "column", gap: "20px", children: (w = t.conditions) == null ? void 0 : w.map((n) => {
337
+ var R, N, I, U, $, M, O;
338
+ return /* @__PURE__ */ a(
339
+ ye,
340
340
  {
341
341
  id: `toggle-${n.name}`,
342
342
  name: `toggle.${n.name}`,
343
343
  labelToggle: n.name,
344
- checked: !a.values.toggleNone && a.values.conditions[n.name] !== void 0,
345
- handleToggleChange: (w) => {
346
- if (!w.target.checked)
347
- a.setFieldValue(
344
+ checked: !r.values.toggleNone && r.values.conditions[n.name] !== void 0,
345
+ handleToggleChange: (C) => {
346
+ if (!C.target.checked)
347
+ r.setFieldValue(
348
348
  `conditions.${n.name}`,
349
349
  void 0
350
- ), a.setFieldTouched(
350
+ ), r.setFieldTouched(
351
351
  `conditions.${n.name}`,
352
352
  !1,
353
353
  !1
354
354
  );
355
355
  else {
356
- const T = n.valueUse === m.LIST_OF_VALUES_MULTI ? [] : "";
357
- a.setFieldValue(
356
+ const E = n.valueUse === f.LIST_OF_VALUES_MULTI ? [] : "";
357
+ r.setFieldValue(
358
358
  `conditions.${n.name}`,
359
- T
359
+ E
360
360
  );
361
361
  }
362
362
  },
363
- children: n.valueUse === m.LIST_OF_VALUES_MULTI ? /* @__PURE__ */ t(
364
- te,
363
+ children: n.valueUse === f.LIST_OF_VALUES_MULTI ? /* @__PURE__ */ a(
364
+ re,
365
365
  {
366
366
  id: n.name,
367
367
  labelSelect: n.name,
368
368
  labelSelected: `Selected ${n.name}`,
369
- options: ($ = (U = n.possibleValue) == null ? void 0 : U.list) == null ? void 0 : $.map((w) => ({
370
- id: w,
371
- label: w,
372
- checked: (a.values.conditions[n.name] || []).includes(w)
369
+ options: (N = (R = n.possibleValue) == null ? void 0 : R.list) == null ? void 0 : N.map((C) => ({
370
+ id: C,
371
+ label: C,
372
+ checked: (r.values.conditions[n.name] || []).includes(C)
373
373
  })),
374
- onHandleSelectCheckChange: (w) => {
375
- const y = w.filter((T) => T.checked).map((T) => T.id);
376
- a.setFieldValue(
374
+ onHandleSelectCheckChange: (C) => {
375
+ const x = C.filter((E) => E.checked).map((E) => E.id);
376
+ r.setFieldValue(
377
377
  `conditions.${n.name}`,
378
- y
379
- ), a.setFieldTouched(
378
+ x
379
+ ), r.setFieldTouched(
380
380
  `conditions.${n.name}`,
381
381
  !0,
382
382
  !0
383
383
  );
384
384
  },
385
385
  placeholderSelect: `Select ${n.name}`,
386
- message: (I = a.touched.conditions) != null && I[n.name] && ((R = a.errors.conditions) != null && R[n.name]) ? a.errors.conditions[n.name] : void 0,
387
- onBlur: () => a.setFieldTouched(
386
+ message: (I = r.touched.conditions) != null && I[n.name] && ((U = r.errors.conditions) != null && U[n.name]) ? r.errors.conditions[n.name] : void 0,
387
+ onBlur: () => r.setFieldTouched(
388
388
  `conditions.${n.name}`,
389
389
  !0,
390
390
  !0
391
391
  )
392
392
  }
393
- ) : /* @__PURE__ */ t(
394
- ae,
393
+ ) : /* @__PURE__ */ a(
394
+ ne,
395
395
  {
396
396
  type: n.dataType.toLowerCase(),
397
397
  name: `conditions.${n.name}`,
398
398
  label: n.name,
399
- value: a.values.conditions[n.name],
400
- onChange: (w) => a.setFieldValue(
399
+ value: r.values.conditions[n.name],
400
+ onChange: (C) => r.setFieldValue(
401
401
  `conditions.${n.name}`,
402
- w
402
+ C
403
403
  ),
404
404
  messageValidate: String(
405
- (L = a.errors.conditions) == null ? void 0 : L[n.name]
405
+ ($ = r.errors.conditions) == null ? void 0 : $[n.name]
406
406
  ),
407
- statusValidate: (z = a.touched.conditions) != null && z[n.name] ? (M = a.errors.conditions) != null && M[n.name] ? "invalid" : "valid" : void 0,
408
- onBlur: a.handleBlur
407
+ statusValidate: (M = r.touched.conditions) != null && M[n.name] ? (O = r.errors.conditions) != null && O[n.name] ? "invalid" : "valid" : void 0,
408
+ onBlur: r.handleBlur
409
409
  }
410
410
  )
411
411
  },
@@ -415,63 +415,38 @@ const De = (r) => {
415
415
  ]
416
416
  }
417
417
  ) }) }),
418
- /* @__PURE__ */ t(S, { dashed: !0 }),
419
- /* @__PURE__ */ t(
420
- ge,
418
+ /* @__PURE__ */ a(T, { dashed: !0 }),
419
+ /* @__PURE__ */ a(
420
+ fe,
421
421
  {
422
422
  labelStart: d.termStart,
423
423
  labelEnd: d.termEnd,
424
- valueStart: a.values.startDate,
425
- valueEnd: a.values.endDate,
426
- messageStart: a.errors.startDate,
427
- messageEnd: a.errors.endDate,
428
- statusStart: a.touched.startDate ? a.errors.startDate ? "invalid" : "valid" : void 0,
429
- statusEnd: a.touched.endDate ? a.errors.endDate ? "invalid" : "valid" : void 0,
430
- onHandleStartChange: (n) => a.setFieldValue("startDate", n.target.value),
431
- onHandleEndChange: (n) => a.setFieldValue("endDate", n.target.value),
424
+ valueStart: r.values.startDate,
425
+ valueEnd: r.values.endDate,
426
+ messageStart: r.errors.startDate,
427
+ messageEnd: r.errors.endDate,
428
+ statusStart: r.touched.startDate ? r.errors.startDate ? "invalid" : "valid" : void 0,
429
+ statusEnd: r.touched.endDate ? r.errors.endDate ? "invalid" : "valid" : void 0,
430
+ onHandleStartChange: (n) => r.setFieldValue("startDate", n.target.value),
431
+ onHandleEndChange: (n) => r.setFieldValue("endDate", n.target.value),
432
432
  onCheckClosedChange: (n) => {
433
- a.setFieldValue("checkClosed", n), n && a.setFieldValue("endDate", "");
433
+ r.setFieldValue("checkClosed", n), n && r.setFieldValue("endDate", "");
434
434
  },
435
- checkedClosed: a.values.checkClosed
435
+ checkedClosed: r.values.checkClosed
436
436
  }
437
437
  ),
438
- /* @__PURE__ */ t(S, {}),
438
+ /* @__PURE__ */ a(T, {}),
439
439
  /* @__PURE__ */ c(s, { direction: "row", justifyContent: "end", gap: "16px", children: [
440
- /* @__PURE__ */ t(B, { appearance: "gray", onClick: h, children: d.cancel }),
441
- /* @__PURE__ */ t(B, { type: "submit", children: d.confirm })
440
+ /* @__PURE__ */ a(P, { appearance: "gray", onClick: h, children: d.cancel }),
441
+ /* @__PURE__ */ a(P, { type: "submit", children: d.confirm })
442
442
  ] })
443
443
  ] }) });
444
- }, E = (r) => {
445
- if (!r)
446
- return;
447
- const e = r.value;
448
- if (!e)
449
- return;
450
- if (((d) => typeof d == "object" && d !== null)(e))
451
- switch (r.valueUse) {
452
- case m.LIST_OF_VALUES_MULTI:
453
- return e;
454
- case m.LIST_OF_VALUES:
455
- return e;
456
- case m.RANGE:
457
- return {
458
- from: e.from,
459
- to: e.to
460
- };
461
- case m.GREATER_THAN:
462
- case m.LESS_THAN:
463
- case m.EQUAL:
464
- return e.value;
465
- default:
466
- return e.value;
467
- }
468
- return e;
469
- }, Q = x.div`
444
+ }, W = b.div`
470
445
  & > div {
471
446
  border-radius: 8px;
472
- border: 1px solid ${k.palette.neutral.N30};
447
+ border: 1px solid ${S.palette.neutral.N30};
473
448
  }
474
- `, Y = x.div`
449
+ `, J = b.div`
475
450
  width: 100%;
476
451
  height: 100%;
477
452
  overflow-y: auto;
@@ -489,24 +464,41 @@ const De = (r) => {
489
464
  background-color: #ebecf0;
490
465
  border-radius: 8px;
491
466
  }
492
- `, W = (r) => {
493
- const { decision: e, loading: l = !1, textValues: d } = r, h = (i) => i && Object.keys(i).length > 0, a = {
494
- name: (e == null ? void 0 : e.name) || "",
495
- dataType: (e == null ? void 0 : e.dataType) || "alphabetical",
496
- value: E(e),
497
- valueUse: (e == null ? void 0 : e.valueUse) || "equal"
467
+ `, Fe = (e) => e.value, Ve = (e) => e.value, _e = (e) => ({
468
+ from: e.from ?? "",
469
+ to: e.to ?? ""
470
+ }), Le = (e) => e.value, Re = (e) => e.value, Ne = (e) => e.value;
471
+ var k = /* @__PURE__ */ ((e) => (e.EQUAL = "equal", e.GREATER_THAN = "greater_than", e.LESS_THAN = "less_than", e.LIST_OF_VALUES = "list_of_values", e.LIST_OF_VALUES_MULTI = "list_of_values_multi", e.RANGE = "range", e))(k || {});
472
+ const Ie = (e) => e.value, Ue = {
473
+ [k.LIST_OF_VALUES]: Fe,
474
+ [k.LIST_OF_VALUES_MULTI]: Ve,
475
+ [k.RANGE]: _e,
476
+ [k.GREATER_THAN]: Le,
477
+ [k.LESS_THAN]: Re,
478
+ [k.EQUAL]: Ne
479
+ };
480
+ function A(e) {
481
+ const t = e == null ? void 0 : e.value, o = typeof t == "object" && t !== null && !Array.isArray(t), d = Ue[e == null ? void 0 : e.valueUse] || Ie;
482
+ return o && d(t) || t || void 0;
483
+ }
484
+ const ee = (e) => {
485
+ const { decision: t, loading: o = !1, textValues: d } = e, h = (i) => i && Object.keys(i).length > 0, r = {
486
+ name: (t == null ? void 0 : t.name) || "",
487
+ dataType: (t == null ? void 0 : t.dataType) || "alphabetical",
488
+ value: A(t),
489
+ valueUse: (t == null ? void 0 : t.valueUse) || "equal"
498
490
  };
499
- return !l && e && d ? /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
500
- e && /* @__PURE__ */ t(s, { direction: "column", alignItems: "center", children: /* @__PURE__ */ t(
491
+ return !o && t && d ? /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
492
+ t && /* @__PURE__ */ a(s, { direction: "column", alignItems: "center", children: /* @__PURE__ */ a(
501
493
  q,
502
494
  {
503
- element: a,
504
- valueData: E(a),
495
+ element: r,
496
+ valueData: A(r),
505
497
  type: "decision"
506
498
  }
507
- ) }, e.name),
508
- /* @__PURE__ */ t(S, { dashed: !0 }),
509
- /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ c(
499
+ ) }, t.name),
500
+ /* @__PURE__ */ a(T, { dashed: !0 }),
501
+ /* @__PURE__ */ a(J, { children: /* @__PURE__ */ c(
510
502
  s,
511
503
  {
512
504
  direction: "column",
@@ -514,8 +506,8 @@ const De = (r) => {
514
506
  justifyContent: "space-between",
515
507
  height: "203px",
516
508
  children: [
517
- /* @__PURE__ */ t(
518
- C,
509
+ /* @__PURE__ */ a(
510
+ y,
519
511
  {
520
512
  type: "label",
521
513
  size: "large",
@@ -525,58 +517,58 @@ const De = (r) => {
525
517
  children: d.factsThatConditionIt
526
518
  }
527
519
  ),
528
- e.conditions && e.conditions.map((i) => {
520
+ t.conditions && t.conditions.map((i) => {
529
521
  if (i.hidden) return null;
530
- const o = i.value;
531
- return (typeof o == "object" && h(o) || o !== void 0 && typeof o == "string" && o.length > 0) && /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(s, { direction: "column", padding: "8px", children: /* @__PURE__ */ t(
522
+ const l = i.value;
523
+ return (typeof l == "object" && h(l) || l !== void 0 && typeof l == "string" && l.length > 0) && /* @__PURE__ */ a(W, { children: /* @__PURE__ */ a(s, { direction: "column", padding: "8px", children: /* @__PURE__ */ a(
532
524
  q,
533
525
  {
534
526
  element: {
535
527
  ...i,
536
- value: o
528
+ value: l
537
529
  },
538
- valueData: E(i)
530
+ valueData: A(i)
539
531
  }
540
532
  ) }) }, i.name);
541
533
  }),
542
- /* @__PURE__ */ t(S, { dashed: !0 }),
534
+ /* @__PURE__ */ a(T, { dashed: !0 }),
543
535
  /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
544
- (e == null ? void 0 : e.startDate) && (e == null ? void 0 : e.endDate) && /* @__PURE__ */ t(
536
+ (t == null ? void 0 : t.startDate) && (t == null ? void 0 : t.endDate) && /* @__PURE__ */ a(
545
537
  q,
546
538
  {
547
539
  element: {
548
540
  name: d.terms,
549
- value: String(e.startDate),
550
- valueUse: m.RANGE,
551
- dataType: V.DATE
541
+ value: String(t.startDate),
542
+ valueUse: f.RANGE,
543
+ dataType: F.DATE
552
544
  },
553
- valueData: E({
545
+ valueData: A({
554
546
  name: d.terms,
555
547
  value: {
556
- from: String(e.startDate),
557
- to: String(e.endDate)
548
+ from: String(t.startDate),
549
+ to: String(t.endDate)
558
550
  },
559
- valueUse: m.RANGE,
560
- dataType: V.DATE
551
+ valueUse: f.RANGE,
552
+ dataType: F.DATE
561
553
  }),
562
554
  type: "decision"
563
555
  },
564
556
  d.terms
565
557
  ),
566
- (e == null ? void 0 : e.startDate) && !(e != null && e.endDate) && /* @__PURE__ */ t(
558
+ (t == null ? void 0 : t.startDate) && !(t != null && t.endDate) && /* @__PURE__ */ a(
567
559
  q,
568
560
  {
569
561
  element: {
570
562
  name: d.terms,
571
- value: String(e.startDate),
572
- valueUse: m.EQUAL,
573
- dataType: V.DATE
563
+ value: String(t.startDate),
564
+ valueUse: f.EQUAL,
565
+ dataType: F.DATE
574
566
  },
575
- valueData: E({
567
+ valueData: A({
576
568
  name: d.terms,
577
- value: String(e.startDate),
578
- valueUse: m.EQUAL,
579
- dataType: V.DATE
569
+ value: String(t.startDate),
570
+ valueUse: f.EQUAL,
571
+ dataType: F.DATE
580
572
  }),
581
573
  type: "decision"
582
574
  },
@@ -588,21 +580,21 @@ const De = (r) => {
588
580
  ) })
589
581
  ] }) : /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
590
582
  /* @__PURE__ */ c(s, { direction: "column", alignItems: "center", gap: "4px", children: [
591
- /* @__PURE__ */ t(D, { animated: !0, width: "180px" }),
592
- /* @__PURE__ */ t(D, { animated: !0, width: "85px" })
583
+ /* @__PURE__ */ a(D, { animated: !0, width: "180px" }),
584
+ /* @__PURE__ */ a(D, { animated: !0, width: "85px" })
593
585
  ] }, "loading"),
594
586
  /* @__PURE__ */ c(s, { direction: "column", gap: "12px", alignItems: "center", children: [
595
- /* @__PURE__ */ t(S, { dashed: !0 }),
596
- /* @__PURE__ */ t(D, { animated: !0, width: "150px" })
587
+ /* @__PURE__ */ a(T, { dashed: !0 }),
588
+ /* @__PURE__ */ a(D, { animated: !0, width: "150px" })
597
589
  ] }),
598
- /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(
590
+ /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(
599
591
  s,
600
592
  {
601
593
  direction: "column",
602
594
  gap: "12px",
603
595
  justifyContent: "space-between",
604
596
  height: "203px",
605
- children: Array.from({ length: 5 }).map((i, o) => /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ c(
597
+ children: Array.from({ length: 5 }).map((i, l) => /* @__PURE__ */ a(W, { children: /* @__PURE__ */ c(
606
598
  s,
607
599
  {
608
600
  direction: "column",
@@ -610,17 +602,17 @@ const De = (r) => {
610
602
  alignItems: "start",
611
603
  padding: "8px",
612
604
  children: [
613
- /* @__PURE__ */ t(D, { animated: !0, width: "180px" }),
614
- /* @__PURE__ */ t(D, { animated: !0, width: "85px" })
605
+ /* @__PURE__ */ a(D, { animated: !0, width: "180px" }),
606
+ /* @__PURE__ */ a(D, { animated: !0, width: "85px" })
615
607
  ]
616
608
  }
617
- ) }, `condition-${o}`))
609
+ ) }, `condition-${l}`))
618
610
  }
619
611
  ) })
620
612
  ] });
621
- }, Ee = x.div`
613
+ }, $e = b.div`
622
614
  border-radius: 8px;
623
- border: 1px solid ${k.palette.neutral.N30};
615
+ border: 1px solid ${S.palette.neutral.N30};
624
616
  box-sizing: border-box;
625
617
  display: flex;
626
618
  flex-direction: column;
@@ -630,7 +622,7 @@ const De = (r) => {
630
622
  height: 100%;
631
623
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
632
624
  `;
633
- x.div`
625
+ b.div`
634
626
  width: 100%;
635
627
  height: 100%;
636
628
  overflow-y: auto;
@@ -649,19 +641,19 @@ x.div`
649
641
  border-radius: 8px;
650
642
  }
651
643
  `;
652
- const O = (r) => {
653
- const { children: e, controls: l = !0, handleDelete: d, id: h } = r;
654
- return /* @__PURE__ */ t(Ee, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "12px 16px", children: [
655
- e,
656
- l && /* @__PURE__ */ c(A, { children: [
657
- /* @__PURE__ */ t(S, {}),
658
- /* @__PURE__ */ t(s, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ t(
644
+ const G = (e) => {
645
+ const { children: t, controls: o = !0, handleDelete: d, id: h } = e;
646
+ return /* @__PURE__ */ a($e, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "12px 16px", children: [
647
+ t,
648
+ o && /* @__PURE__ */ c(_, { children: [
649
+ /* @__PURE__ */ a(T, {}),
650
+ /* @__PURE__ */ a(s, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ a(
659
651
  Z,
660
652
  {
661
653
  cursorHover: !0,
662
654
  appearance: "dark",
663
655
  size: "24px",
664
- icon: /* @__PURE__ */ t(de, {}),
656
+ icon: /* @__PURE__ */ a(ce, {}),
665
657
  onClick: () => {
666
658
  d(h);
667
659
  }
@@ -669,15 +661,15 @@ const O = (r) => {
669
661
  ) })
670
662
  ] })
671
663
  ] }) });
672
- }, Ve = x.div`
664
+ }, qe = b.div`
673
665
  position: relative;
674
666
  & > div {
675
667
  padding: 24px 16px;
676
668
  }
677
- `, Fe = x.div`
678
- background-color: ${({ theme: r }) => {
679
- var e, l;
680
- return ((l = (e = r == null ? void 0 : r.palette) == null ? void 0 : e.neutral) == null ? void 0 : l.N0) || k.palette.neutral.N0;
669
+ `, ze = b.div`
670
+ background-color: ${({ theme: e }) => {
671
+ var t, o;
672
+ return ((o = (t = e == null ? void 0 : e.palette) == null ? void 0 : t.neutral) == null ? void 0 : o.N0) || S.palette.neutral.N0;
681
673
  }};
682
674
  max-width: 450px;
683
675
  max-height: 90vh;
@@ -705,23 +697,23 @@ const O = (r) => {
705
697
  background-color: #ebecf0;
706
698
  border-radius: 8px;
707
699
  }
708
- `, Ae = (r) => {
709
- const { children: e, portalId: l, onCloseModal: d, title: h } = r, a = document.getElementById(l);
710
- if (!a)
700
+ `, Me = (e) => {
701
+ const { children: t, portalId: o, onCloseModal: d, title: h } = e, r = document.getElementById(o);
702
+ if (!r)
711
703
  throw new Error(
712
704
  "The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
713
705
  );
714
- return ue(
715
- /* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ t(he, { children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
716
- /* @__PURE__ */ t(s, { direction: "column", gap: "24px", children: /* @__PURE__ */ c(s, { alignItems: "center", justifyContent: "space-between", children: [
717
- /* @__PURE__ */ t(C, { type: "title", size: "large", appearance: "dark", weight: "bold", children: h }),
718
- /* @__PURE__ */ t(se, { size: "24px", cursor: "pointer", onClick: d })
706
+ return pe(
707
+ /* @__PURE__ */ a(qe, { children: /* @__PURE__ */ a(ge, { children: /* @__PURE__ */ a(ze, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
708
+ /* @__PURE__ */ a(s, { direction: "column", gap: "24px", children: /* @__PURE__ */ c(s, { alignItems: "center", justifyContent: "space-between", children: [
709
+ /* @__PURE__ */ a(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children: h }),
710
+ /* @__PURE__ */ a(ue, { size: "24px", cursor: "pointer", onClick: d })
719
711
  ] }) }),
720
- e
712
+ t
721
713
  ] }) }) }) }),
722
- a
714
+ r
723
715
  );
724
- }, Ne = oe`
716
+ }, Oe = de`
725
717
  from {
726
718
  opacity: 0;
727
719
  transform: translateY(20px);
@@ -730,16 +722,16 @@ const O = (r) => {
730
722
  opacity: 1;
731
723
  transform: translateY(0);
732
724
  }
733
- `, J = x.div`
725
+ `, te = b.div`
734
726
  width: 100%;
735
727
  height: 100%;
736
728
  & > div {
737
- animation: ${Ne} 600ms ease-out;
729
+ animation: ${Oe} 600ms ease-out;
738
730
  }
739
731
  `;
740
- x.div`
732
+ b.div`
741
733
  border-radius: 8px;
742
- border: 1px solid ${k.palette.neutral.N30};
734
+ border: 1px solid ${S.palette.neutral.N30};
743
735
  box-sizing: border-box;
744
736
  display: flex;
745
737
  flex-direction: column;
@@ -749,7 +741,7 @@ x.div`
749
741
  height: 100%;
750
742
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
751
743
  `;
752
- const Ue = x.div`
744
+ const je = b.div`
753
745
  & > div {
754
746
  width: 100%;
755
747
  height: 100%;
@@ -769,16 +761,16 @@ const Ue = x.div`
769
761
  border-radius: 8px;
770
762
  }
771
763
  }
772
- `, $e = x.div`
764
+ `, He = b.div`
773
765
  & > div > div {
774
766
  border-radius: 8px;
775
- border: 1px solid ${k.palette.neutral.N30};
767
+ border: 1px solid ${S.palette.neutral.N30};
776
768
  box-sizing: border-box;
777
769
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
778
770
  }
779
- `, Ie = x.div`
771
+ `, Be = b.div`
780
772
  & > div {
781
- background-color: ${k.palette.neutral.N30};
773
+ background-color: ${S.palette.neutral.N30};
782
774
  justify-content: center;
783
775
  }
784
776
  min-height: 300px;
@@ -786,33 +778,139 @@ const Ue = x.div`
786
778
  height: 100%;
787
779
  padding-bottom: 12px;
788
780
  `;
789
- x.div`
781
+ b.div`
790
782
  & > div {
791
783
  border-radius: 8px;
792
- border: 1px solid ${k.palette.neutral.N30};
784
+ border: 1px solid ${S.palette.neutral.N30};
793
785
  }
794
786
  `;
795
- const rt = (r) => {
787
+ function Ge({
788
+ index: e,
789
+ handleOpenModal: t
790
+ }) {
791
+ return /* @__PURE__ */ a(
792
+ G,
793
+ {
794
+ id: `loading-card-${e}`,
795
+ handleDelete: () => {
796
+ },
797
+ handleView: () => t(),
798
+ controls: !1,
799
+ children: /* @__PURE__ */ a(ee, { loading: !0 })
800
+ },
801
+ `loading-card-${e}`
802
+ );
803
+ }
804
+ function Pe({
805
+ decision: e,
806
+ controls: t,
807
+ handleOpenModal: o,
808
+ handleDelete: d,
809
+ textValues: h
810
+ }) {
811
+ return e ? /* @__PURE__ */ a(te, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
812
+ /* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.id }),
813
+ /* @__PURE__ */ a(
814
+ G,
815
+ {
816
+ id: e.id,
817
+ handleDelete: () => d(e.id),
818
+ handleView: () => o(e),
819
+ controls: t,
820
+ children: /* @__PURE__ */ a(ee, { decision: e, textValues: h })
821
+ }
822
+ )
823
+ ] }) }, e.id) : null;
824
+ }
825
+ function Qe({
826
+ index: e,
827
+ handleOpenModal: t
828
+ }) {
829
+ return /* @__PURE__ */ a(te, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
830
+ /* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
831
+ /* @__PURE__ */ a(Be, { onClick: () => t(), children: /* @__PURE__ */ a(
832
+ G,
833
+ {
834
+ id: `add-decision-${e}`,
835
+ handleDelete: () => {
836
+ },
837
+ handleView: () => t(),
838
+ controls: !1,
839
+ children: /* @__PURE__ */ c(s, { direction: "column", gap: "12px", alignItems: "center", children: [
840
+ /* @__PURE__ */ a(Z, { appearance: "gray", icon: /* @__PURE__ */ a(he, {}), size: "35px" }),
841
+ /* @__PURE__ */ a(y, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
842
+ ] })
843
+ }
844
+ ) })
845
+ ] }) }, `add-decision-${e}`);
846
+ }
847
+ const Ye = {
848
+ loading: Ge,
849
+ decision: Pe,
850
+ add: Qe
851
+ };
852
+ function H(e) {
853
+ const { type: t } = e, o = Ye[t];
854
+ return o ? o(e) : null;
855
+ }
856
+ function We({
857
+ controls: e,
858
+ decisions: t,
859
+ loading: o,
860
+ handleOpenModal: d,
861
+ handleDelete: h,
862
+ textValues: r
863
+ }) {
864
+ const i = o ? Array.from({ length: 3 }).map(
865
+ (u, p) => H({
866
+ type: "loading",
867
+ index: p,
868
+ controls: e,
869
+ loading: o,
870
+ handleOpenModal: d,
871
+ handleDelete: h,
872
+ textValues: r
873
+ })
874
+ ) : t.map(
875
+ (u) => H({
876
+ type: "decision",
877
+ decision: u,
878
+ controls: e,
879
+ loading: o,
880
+ handleOpenModal: d,
881
+ handleDelete: h,
882
+ textValues: r
883
+ })
884
+ ), l = (t.length === 0 || t.length < Math.floor(window.innerWidth / 300)) && !o && e;
885
+ return { renderedCards: i, shouldRenderAddCard: l };
886
+ }
887
+ const vt = (e) => {
796
888
  const {
797
- controls: e = !0,
798
- decisions: l,
889
+ controls: t = !0,
890
+ decisions: o,
799
891
  textValues: d,
800
892
  decisionTemplate: h,
801
- isModalOpen: a,
893
+ isModalOpen: r,
802
894
  selectedDecision: i,
803
- loading: o,
895
+ loading: l,
804
896
  handleOpenModal: u,
805
897
  handleCloseModal: p,
806
- handleSubmitForm: f,
898
+ handleSubmitForm: m,
807
899
  handleDelete: g
808
- } = r, v = me("(max-width: 681px)");
809
- return /* @__PURE__ */ c(A, { children: [
810
- /* @__PURE__ */ t($e, { children: /* @__PURE__ */ t(Ue, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "6px", children: [
811
- l.length === 0 && !o && /* @__PURE__ */ c(C, { as: "span", type: "label", size: "large", appearance: "gray", children: [
900
+ } = e, v = be("(max-width: 681px)"), { renderedCards: w, shouldRenderAddCard: n } = We({
901
+ controls: t,
902
+ decisions: o,
903
+ loading: l,
904
+ handleOpenModal: u,
905
+ handleDelete: g,
906
+ textValues: d
907
+ });
908
+ return /* @__PURE__ */ c(_, { children: [
909
+ /* @__PURE__ */ a(He, { children: /* @__PURE__ */ a(je, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "6px", children: [
910
+ o.length === 0 && !l && /* @__PURE__ */ c(y, { as: "span", type: "label", size: "large", appearance: "gray", children: [
812
911
  "Aún no tienes definidas tasas de interés efectivas. Presiona",
813
- " ",
814
- /* @__PURE__ */ t(
815
- C,
912
+ /* @__PURE__ */ a(
913
+ y,
816
914
  {
817
915
  as: "span",
818
916
  type: "label",
@@ -822,11 +920,10 @@ const rt = (r) => {
822
920
  children: "“+ Agregar decisión”"
823
921
  }
824
922
  ),
825
- " ",
826
923
  "para empezar."
827
924
  ] }),
828
925
  /* @__PURE__ */ c(
829
- pe,
926
+ me,
830
927
  {
831
928
  templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
832
929
  autoFlow: "row dense",
@@ -838,127 +935,31 @@ const rt = (r) => {
838
935
  padding: "6px",
839
936
  height: v ? "auto" : "484px",
840
937
  children: [
841
- o ? Array.from({ length: 3 }).map((b, n) => /* @__PURE__ */ t(
842
- O,
843
- {
844
- id: `loading-card-${n}`,
845
- handleDelete: () => {
846
- },
847
- handleView: () => u(),
848
- controls: !1,
849
- children: /* @__PURE__ */ t(W, { loading: !0 })
850
- },
851
- `loading-card-${n}`
852
- )) : l.map((b) => /* @__PURE__ */ t(J, { children: /* @__PURE__ */ c(
853
- s,
854
- {
855
- direction: "column",
856
- gap: "4px",
857
- width: "100%",
858
- padding: "0 0 12px 0",
859
- children: [
860
- /* @__PURE__ */ t(
861
- C,
862
- {
863
- type: "title",
864
- size: "medium",
865
- appearance: "gray",
866
- weight: "bold",
867
- children: b.id
868
- }
869
- ),
870
- /* @__PURE__ */ t(
871
- O,
872
- {
873
- id: b.id,
874
- handleDelete: () => g(b.id),
875
- handleView: () => u(b),
876
- controls: e,
877
- children: /* @__PURE__ */ t(
878
- W,
879
- {
880
- decision: b,
881
- textValues: d
882
- }
883
- )
884
- }
885
- )
886
- ]
887
- },
888
- b.id
889
- ) }, b.id)),
890
- (l.length === 0 || l.length < Math.floor(window.innerWidth / 300)) && !o && e && /* @__PURE__ */ t(J, { children: /* @__PURE__ */ c(
891
- s,
892
- {
893
- direction: "column",
894
- gap: "4px",
895
- width: "100%",
896
- height: "100%",
897
- children: [
898
- /* @__PURE__ */ t(
899
- C,
900
- {
901
- type: "title",
902
- size: "medium",
903
- appearance: "gray",
904
- weight: "bold",
905
- children: "Nueva decisión"
906
- }
907
- ),
908
- /* @__PURE__ */ t(
909
- Ie,
910
- {
911
- onClick: () => u(),
912
- children: /* @__PURE__ */ t(
913
- O,
914
- {
915
- id: `add-decision-${l.length}`,
916
- handleDelete: () => {
917
- },
918
- handleView: () => u(),
919
- controls: !1,
920
- children: /* @__PURE__ */ c(
921
- s,
922
- {
923
- direction: "column",
924
- gap: "12px",
925
- alignItems: "center",
926
- children: [
927
- /* @__PURE__ */ t(
928
- Z,
929
- {
930
- appearance: "gray",
931
- icon: /* @__PURE__ */ t(ce, {}),
932
- size: "35px"
933
- }
934
- ),
935
- /* @__PURE__ */ t(C, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
936
- ]
937
- }
938
- )
939
- }
940
- )
941
- }
942
- )
943
- ]
944
- },
945
- `add-decision-${l.length}`
946
- ) }, `add-decision-${l.length}`)
938
+ w,
939
+ n && H({
940
+ type: "add",
941
+ index: o.length,
942
+ controls: t,
943
+ loading: l,
944
+ handleOpenModal: u,
945
+ handleDelete: g,
946
+ textValues: d
947
+ })
947
948
  ]
948
949
  }
949
950
  )
950
951
  ] }) }) }),
951
- a && /* @__PURE__ */ t(
952
- Ae,
952
+ r && /* @__PURE__ */ a(
953
+ Me,
953
954
  {
954
955
  portalId: "modal-portal",
955
956
  onCloseModal: p,
956
957
  title: i ? "Editar Decisión" : "Nueva decisión",
957
- children: /* @__PURE__ */ t(
958
- De,
958
+ children: /* @__PURE__ */ a(
959
+ Ae,
959
960
  {
960
961
  decision: i || h,
961
- onSubmitEvent: f,
962
+ onSubmitEvent: m,
962
963
  textValues: d,
963
964
  onCancel: () => p()
964
965
  }
@@ -968,9 +969,9 @@ const rt = (r) => {
968
969
  ] });
969
970
  };
970
971
  export {
971
- O as BusinessRuleCard,
972
- W as BusinessRuleView,
973
- rt as BusinessRules,
974
- Ae as ModalRules,
975
- De as RulesForm
972
+ G as BusinessRuleCard,
973
+ ee as BusinessRuleView,
974
+ vt as BusinessRules,
975
+ Me as ModalRules,
976
+ Ae as RulesForm
976
977
  };