@commercelayer/app-elements 5.5.4 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { t as k, b as Z, d as G, j as t, i as E, g as Q, e as P, f as g, h as j, k as V, D as z, l as S, n as p, B as U, o as T, p as K, q as ee, r as te, s as ae, v as $, I as le, C as ne } from "./main-DR-JViDx.js";
2
+ import { t as k, b as Z, d as G, j as t, i as E, g as Q, e as P, f as g, h as j, k as V, D as J, l as S, n as p, B as U, o as T, p as K, u as ee, q as te, r as ae, s as le, v as $, I as ne, C as se } from "./main-YD7ko8U-.js";
3
3
  import "react-hook-form";
4
- import I, { useReducer as se, useCallback as w, useMemo as re, createContext as ie, useContext as ue, useState as x, useEffect as N, useRef as ce } from "react";
4
+ import I, { useReducer as re, useCallback as w, useMemo as ie, createContext as ue, useContext as ce, useState as x, useEffect as N, useRef as oe } from "react";
5
5
  import { a as de } from "./fetchCoreResourcesSuggestions-CZkDwjO2.js";
6
- import { p as A } from "./parseISO-BGAQxnde.js";
6
+ import { p as A } from "./parseISO-Cq_loYUP.js";
7
7
  function q(e, a) {
8
8
  const l = e.match(
9
9
  /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
@@ -27,25 +27,25 @@ function D(e, a, l) {
27
27
  function M(e, a) {
28
28
  return e == null ? !0 : G(e, a);
29
29
  }
30
- const W = ie(
30
+ const W = ue(
31
31
  void 0
32
32
  );
33
- function oe(e, a) {
33
+ function fe(e, a) {
34
34
  var l;
35
35
  switch (a.type) {
36
36
  case "SET_PATH": {
37
- const i = { ...e.value };
37
+ const r = { ...e.value };
38
38
  if (a.value === null)
39
39
  if (/\.\d+$/.test(a.path)) {
40
- const u = a.path.replace(/\.\d+$/, ""), s = parseInt(((l = a.path.match(/\d+$/)) == null ? void 0 : l[0]) ?? "0", 10), r = Q(i, u);
41
- Array.isArray(r) && (r.splice(s, 1), D(i, u, r), r.length === 0 && u.endsWith(".nested.conditions") && M(i, u.replace(/\.conditions$/, "")));
40
+ const u = a.path.replace(/\.\d+$/, ""), i = parseInt(((l = a.path.match(/\d+$/)) == null ? void 0 : l[0]) ?? "0", 10), n = Q(r, u);
41
+ Array.isArray(n) && (n.splice(i, 1), D(r, u, n), n.length === 0 && u.endsWith(".nested.conditions") && M(r, u.replace(/\.conditions$/, "")));
42
42
  } else
43
- M(i, a.path);
43
+ M(r, a.path);
44
44
  else
45
- D(i, a.path, a.value);
45
+ D(r, a.path, a.value);
46
46
  return {
47
47
  ...e,
48
- value: i
48
+ value: r
49
49
  };
50
50
  }
51
51
  case "SET_SELECTED_RULE_INDEX":
@@ -75,32 +75,32 @@ function oe(e, a) {
75
75
  return e;
76
76
  }
77
77
  }
78
- function fe({
78
+ function me({
79
79
  children: e,
80
80
  initialValue: a
81
81
  }) {
82
- const [l, i] = se(oe, {
82
+ const [l, r] = re(fe, {
83
83
  value: a,
84
84
  selectedRuleIndex: 0
85
- }), u = w((d, c) => {
86
- i({ type: "SET_PATH", path: d, value: c });
87
- }, []), s = w((d) => {
88
- i({ type: "SET_SELECTED_RULE_INDEX", index: d });
89
- }, []), r = w((d) => {
90
- i({ type: "SET_VALUE", value: d });
91
- }, []), n = re(
85
+ }), u = w((c, m) => {
86
+ r({ type: "SET_PATH", path: c, value: m });
87
+ }, []), i = w((c) => {
88
+ r({ type: "SET_SELECTED_RULE_INDEX", index: c });
89
+ }, []), n = w((c) => {
90
+ r({ type: "SET_VALUE", value: c });
91
+ }, []), s = ie(
92
92
  () => ({
93
93
  state: l,
94
94
  setPath: u,
95
- setSelectedRuleIndex: s,
96
- setValue: r
95
+ setSelectedRuleIndex: i,
96
+ setValue: n
97
97
  }),
98
- [l, u, s, r]
98
+ [l, u, i, n]
99
99
  );
100
- return /* @__PURE__ */ t.jsx(W.Provider, { value: n, children: e });
100
+ return /* @__PURE__ */ t.jsx(W.Provider, { value: s, children: e });
101
101
  }
102
102
  function y() {
103
- const e = ue(W);
103
+ const e = ce(W);
104
104
  if (e === void 0)
105
105
  throw new Error("useRuleEngine must be used within a RuleEngineProvider");
106
106
  return e;
@@ -114,11 +114,11 @@ const X = P([
114
114
  function R(e) {
115
115
  return null;
116
116
  }
117
- function me({
117
+ function ge({
118
118
  item: e,
119
119
  pathPrefix: a
120
120
  }) {
121
- var i, u, s, r;
121
+ var r, u, i, n;
122
122
  const { setPath: l } = y();
123
123
  if (e == null)
124
124
  return null;
@@ -131,11 +131,11 @@ function me({
131
131
  name: `${a}.value.x`,
132
132
  type: "number",
133
133
  suffix: "X",
134
- defaultValue: (i = e.value) == null ? void 0 : i.x,
135
- onChange: (n) => {
134
+ defaultValue: (r = e.value) == null ? void 0 : r.x,
135
+ onChange: (s) => {
136
136
  l(
137
137
  `${a}.value.x`,
138
- parseInt(n.currentTarget.value, 10)
138
+ parseInt(s.currentTarget.value, 10)
139
139
  );
140
140
  }
141
141
  }
@@ -147,10 +147,10 @@ function me({
147
147
  type: "number",
148
148
  suffix: "Y",
149
149
  defaultValue: (u = e.value) == null ? void 0 : u.y,
150
- onChange: (n) => {
150
+ onChange: (s) => {
151
151
  l(
152
152
  `${a}.value.y`,
153
- parseInt(n.currentTarget.value, 10)
153
+ parseInt(s.currentTarget.value, 10)
154
154
  );
155
155
  }
156
156
  }
@@ -164,11 +164,11 @@ function me({
164
164
  name: `${a}.value.x`,
165
165
  type: "number",
166
166
  suffix: "X",
167
- defaultValue: (s = e.value) == null ? void 0 : s.x,
168
- onChange: (n) => {
167
+ defaultValue: (i = e.value) == null ? void 0 : i.x,
168
+ onChange: (s) => {
169
169
  l(
170
170
  `${a}.value.x`,
171
- parseInt(n.currentTarget.value, 10)
171
+ parseInt(s.currentTarget.value, 10)
172
172
  );
173
173
  }
174
174
  }
@@ -179,11 +179,11 @@ function me({
179
179
  name: `${a}.value.y`,
180
180
  type: "number",
181
181
  suffix: "Y",
182
- defaultValue: (r = e.value) == null ? void 0 : r.y,
183
- onChange: (n) => {
182
+ defaultValue: (n = e.value) == null ? void 0 : n.y,
183
+ onChange: (s) => {
184
184
  l(
185
185
  `${a}.value.y`,
186
- parseInt(n.currentTarget.value, 10)
186
+ parseInt(s.currentTarget.value, 10)
187
187
  );
188
188
  }
189
189
  }
@@ -199,29 +199,29 @@ function me({
199
199
  defaultValue: e.value,
200
200
  min: 0,
201
201
  suffix: "cents",
202
- onChange: (n) => {
202
+ onChange: (s) => {
203
203
  l(
204
204
  `${a}.value`,
205
- parseInt(n.currentTarget.value, 10)
205
+ parseInt(s.currentTarget.value, 10)
206
206
  );
207
207
  }
208
208
  }
209
209
  ) });
210
210
  case "percentage": {
211
- const n = (e.value * 100).toFixed(2);
211
+ const s = (e.value * 100).toFixed(2);
212
212
  return /* @__PURE__ */ t.jsx("div", { className: "w-24", children: /* @__PURE__ */ t.jsx(
213
213
  g,
214
214
  {
215
215
  name: `${a}.value`,
216
216
  type: "number",
217
- defaultValue: n.endsWith(".00") ? n.slice(0, -3) : n,
217
+ defaultValue: s.endsWith(".00") ? s.slice(0, -3) : s,
218
218
  min: 0,
219
219
  max: 100,
220
220
  suffix: "%",
221
- onChange: (d) => {
221
+ onChange: (c) => {
222
222
  l(
223
223
  `${a}.value`,
224
- parseFloat(d.currentTarget.value) / 100
224
+ parseFloat(c.currentTarget.value) / 100
225
225
  );
226
226
  }
227
227
  }
@@ -231,55 +231,55 @@ function me({
231
231
  return R();
232
232
  }
233
233
  }
234
- function ge({
234
+ function xe({
235
235
  item: e,
236
236
  index: a,
237
237
  onDelete: l
238
238
  }) {
239
239
  const {
240
- setPath: i,
240
+ setPath: r,
241
241
  state: { selectedRuleIndex: u }
242
- } = y(), s = {
242
+ } = y(), i = {
243
243
  percentage: "Percentage discount",
244
244
  fixed_amount: "Fixed amount",
245
245
  fixed_price: "Fixed price",
246
246
  buy_x_pay_y: "Buy X, Pay Y",
247
247
  every_x_discount_y: "Every X, Discount Y"
248
- }, r = `rules.${u}.actions.${a}`;
248
+ }, n = `rules.${u}.actions.${a}`;
249
249
  return /* @__PURE__ */ t.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
250
250
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 flex-grow p-2", children: [
251
251
  /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
252
252
  j,
253
253
  {
254
- name: `${r}.type`,
254
+ name: `${n}.type`,
255
255
  defaultValue: e != null ? {
256
- label: s[e.type],
256
+ label: i[e.type],
257
257
  value: e.type
258
258
  } : void 0,
259
- initialValues: Object.entries(s).map(
260
- ([n, d]) => ({ value: n, label: d })
259
+ initialValues: Object.entries(i).map(
260
+ ([s, c]) => ({ value: s, label: c })
261
261
  ),
262
- onSelect: (n) => {
263
- V(n) && i(`${r}.type`, n.value);
262
+ onSelect: (s) => {
263
+ V(s) && r(`${n}.type`, s.value);
264
264
  }
265
265
  }
266
266
  ) }),
267
- /* @__PURE__ */ t.jsx(me, { item: e, pathPrefix: r }),
267
+ /* @__PURE__ */ t.jsx(ge, { item: e, pathPrefix: n }),
268
268
  /* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
269
269
  /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
270
270
  g,
271
271
  {
272
- name: `${r}.selector`,
272
+ name: `${n}.selector`,
273
273
  type: "text",
274
274
  defaultValue: e != null ? e.selector : void 0,
275
- onChange: (n) => {
276
- i(`${r}.selector`, n.currentTarget.value);
275
+ onChange: (s) => {
276
+ r(`${n}.selector`, s.currentTarget.value);
277
277
  }
278
278
  }
279
279
  ) })
280
280
  ] }),
281
281
  l != null && /* @__PURE__ */ t.jsx(
282
- z,
282
+ J,
283
283
  {
284
284
  className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
285
285
  dropdownLabel: /* @__PURE__ */ t.jsx("button", { className: "flex items-center justify-center self-stretch flex-grow", children: /* @__PURE__ */ t.jsx(p, { name: "dotsThreeVertical", size: 16, weight: "bold" }) }),
@@ -288,7 +288,7 @@ function ge({
288
288
  {
289
289
  label: "Delete",
290
290
  onClick: () => {
291
- i(`${r}`, null), l();
291
+ r(`${n}`, null), l();
292
292
  }
293
293
  }
294
294
  ) })
@@ -296,24 +296,24 @@ function ge({
296
296
  )
297
297
  ] }) });
298
298
  }
299
- function xe({
299
+ function he({
300
300
  actions: e
301
301
  }) {
302
302
  const [a, l] = x(0), {
303
- setPath: i,
303
+ setPath: r,
304
304
  state: { selectedRuleIndex: u }
305
305
  } = y();
306
306
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
307
- /* @__PURE__ */ t.jsx("div", { children: e == null ? void 0 : e.map((s, r, n) => /* @__PURE__ */ t.jsx(
308
- ge,
307
+ /* @__PURE__ */ t.jsx("div", { children: e == null ? void 0 : e.map((i, n, s) => /* @__PURE__ */ t.jsx(
308
+ xe,
309
309
  {
310
- item: s,
311
- index: r,
312
- onDelete: n.length > 1 ? () => {
313
- l((d) => d + 1);
310
+ item: i,
311
+ index: n,
312
+ onDelete: s.length > 1 ? () => {
313
+ l((c) => c + 1);
314
314
  } : void 0
315
315
  },
316
- `${u}-${r}-${a}`
316
+ `${u}-${n}-${a}`
317
317
  )) }),
318
318
  /* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
319
319
  U,
@@ -322,7 +322,7 @@ function xe({
322
322
  variant: "secondary",
323
323
  alignItems: "center",
324
324
  onClick: () => {
325
- i(
325
+ r(
326
326
  `rules.${u}.actions.${(e == null ? void 0 : e.length) ?? 0}`,
327
327
  void 0
328
328
  );
@@ -338,10 +338,10 @@ function xe({
338
338
  function Y(e) {
339
339
  const [a, l] = x(void 0);
340
340
  return N(() => {
341
- (e == null ? void 0 : e.field) != null && de(e.field).then((i) => {
342
- l(i);
343
- }).catch((i) => {
344
- console.error("Error fetching field info:", i);
341
+ (e == null ? void 0 : e.field) != null && de(e.field).then((r) => {
342
+ l(r);
343
+ }).catch((r) => {
344
+ console.error("Error fetching field info:", r);
345
345
  });
346
346
  }, [e == null ? void 0 : e.field]), { infos: a };
347
347
  }
@@ -360,26 +360,26 @@ function B(e) {
360
360
  }
361
361
  return "string";
362
362
  }
363
- function he({
363
+ function be({
364
364
  item: e,
365
365
  pathPrefix: a
366
366
  }) {
367
- var s, r;
368
- const { setPath: l } = y(), { infos: i } = Y(e);
369
- let u = (s = i == null ? void 0 : i.field) == null ? void 0 : s.type;
367
+ var i, n;
368
+ const { setPath: l } = y(), { infos: r } = Y(e);
369
+ let u = (i = r == null ? void 0 : r.field) == null ? void 0 : i.type;
370
370
  return u == null && (u = B(e == null ? void 0 : e.value)), /* @__PURE__ */ t.jsx(
371
371
  j,
372
372
  {
373
373
  name: `${a}.matcher`,
374
374
  value: e != null ? {
375
- label: ((r = O.find((n) => n.matcher === e.matcher && (u != null && n.fieldTypes.includes(u) || u == null))) == null ? void 0 : r.label) ?? // eslint-disable-next-line no-irregular-whitespace
375
+ label: ((n = O.find((s) => s.matcher === e.matcher && (u != null && s.fieldTypes.includes(u) || u == null))) == null ? void 0 : n.label) ?? // eslint-disable-next-line no-irregular-whitespace
376
376
  (e.matcher != null ? `⚠️   ${e.matcher}` : ""),
377
377
  value: e.matcher
378
378
  } : void 0,
379
- initialValues: O.filter(({ fieldTypes: n, visible: d }) => d !== !1 && n.includes(u)).map(({ matcher: n, label: d }) => ({ value: n, label: d })),
380
- onSelect: (n) => {
381
- V(n) && (l(`${a}.matcher`, n.value), X.includes(
382
- n.value
379
+ initialValues: O.filter(({ fieldTypes: s, visible: c }) => c !== !1 && s.includes(u)).map(({ matcher: s, label: c }) => ({ value: s, label: c })),
380
+ onSelect: (s) => {
381
+ V(s) && (l(`${a}.matcher`, s.value), X.includes(
382
+ s.value
383
383
  ) && l(`${a}.value`, null));
384
384
  }
385
385
  }
@@ -644,45 +644,45 @@ const O = [
644
644
  label: "not at least one of"
645
645
  }
646
646
  };
647
- function be({
647
+ function ye({
648
648
  value: e,
649
649
  pathPrefix: a
650
650
  }) {
651
651
  return (typeof e != "object" || Array.isArray(e) || e === null) && (e = {
652
652
  in_and: []
653
- }), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([l, i], u) => /* @__PURE__ */ t.jsx(
654
- ye,
653
+ }), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([l, r], u) => /* @__PURE__ */ t.jsx(
654
+ ve,
655
655
  {
656
656
  pathPrefix: a,
657
- defaultValue: i,
657
+ defaultValue: r,
658
658
  initialMatcher: l
659
659
  },
660
660
  `${a}.${u}`
661
661
  )) });
662
662
  }
663
- function ye({
663
+ function ve({
664
664
  initialMatcher: e,
665
665
  defaultValue: a,
666
666
  pathPrefix: l
667
667
  }) {
668
- const [i, u] = x(e), [s, r] = x(e), [n, d] = x(a), { setPath: c } = y();
668
+ const [r, u] = x(e), [i, n] = x(e), [s, c] = x(a), { setPath: m } = y();
669
669
  return N(() => {
670
- i !== s && (c(`${l}.${i}`, null), u(s)), c(`${l}.${s}`, n);
671
- }, [s, n, c]), /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 last-of-type:mt-2", children: [
670
+ r !== i && (m(`${l}.${r}`, null), u(i)), m(`${l}.${i}`, s);
671
+ }, [i, s, m]), /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 last-of-type:mt-2", children: [
672
672
  /* @__PURE__ */ t.jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ t.jsx(
673
673
  j,
674
674
  {
675
675
  defaultValue: [
676
- { value: s, label: F[s].label }
676
+ { value: i, label: F[i].label }
677
677
  ],
678
678
  initialValues: Object.entries(F).map(
679
- ([o, { label: f }]) => ({
679
+ ([o, { label: d }]) => ({
680
680
  value: o,
681
- label: f
681
+ label: d
682
682
  })
683
683
  ),
684
684
  onSelect: (o) => {
685
- V(o) && r(o.value);
685
+ V(o) && n(o.value);
686
686
  }
687
687
  }
688
688
  ) }),
@@ -691,15 +691,15 @@ function ye({
691
691
  {
692
692
  isMulti: !0,
693
693
  isCreatable: !0,
694
- defaultValue: (Array.isArray(n) ? n : []).map((o) => ({
694
+ defaultValue: (Array.isArray(s) ? s : []).map((o) => ({
695
695
  value: o,
696
696
  label: o.toString()
697
697
  })),
698
698
  initialValues: [],
699
699
  onSelect: (o) => {
700
- K(o) && d(
700
+ K(o) && c(
701
701
  o.map(
702
- (f) => typeof f.value == "boolean" ? f.value.toString() : f.value
702
+ (d) => typeof d.value == "boolean" ? d.value.toString() : d.value
703
703
  )
704
704
  );
705
705
  }
@@ -707,13 +707,13 @@ function ye({
707
707
  ) })
708
708
  ] });
709
709
  }
710
- function ve({
710
+ function pe({
711
711
  value: e,
712
712
  onChange: a
713
713
  }) {
714
- const [l, i] = x(
714
+ const [l, r] = x(
715
715
  Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
716
- ), [u, s] = x(
716
+ ), [u, i] = x(
717
717
  Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
718
718
  );
719
719
  return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
@@ -723,9 +723,9 @@ function ve({
723
723
  type: "number",
724
724
  placeholder: "Min",
725
725
  value: l ?? "",
726
- onChange: (r) => {
727
- const n = parseInt(r.currentTarget.value, 10);
728
- i(isNaN(n) ? null : n), a([isNaN(n) ? null : n, u]);
726
+ onChange: (n) => {
727
+ const s = parseInt(n.currentTarget.value, 10);
728
+ r(isNaN(s) ? null : s), a([isNaN(s) ? null : s, u]);
729
729
  }
730
730
  }
731
731
  ) }),
@@ -736,21 +736,21 @@ function ve({
736
736
  type: "number",
737
737
  placeholder: "Max",
738
738
  value: u ?? "",
739
- onChange: (r) => {
740
- const n = parseInt(r.currentTarget.value, 10);
741
- s(isNaN(n) ? null : n), a([l, isNaN(n) ? null : n]);
739
+ onChange: (n) => {
740
+ const s = parseInt(n.currentTarget.value, 10);
741
+ i(isNaN(s) ? null : s), a([l, isNaN(s) ? null : s]);
742
742
  }
743
743
  }
744
744
  ) })
745
745
  ] });
746
746
  }
747
- function pe({
747
+ function je({
748
748
  value: e,
749
749
  onChange: a
750
750
  }) {
751
- const [l, i] = x(
751
+ const [l, r] = x(
752
752
  Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
753
- ), [u, s] = x(
753
+ ), [u, i] = x(
754
754
  Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
755
755
  );
756
756
  return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
@@ -760,9 +760,9 @@ function pe({
760
760
  type: "text",
761
761
  placeholder: "Min",
762
762
  value: l ?? "",
763
- onChange: (r) => {
764
- const n = r.currentTarget.value;
765
- i(n), a([n, u]);
763
+ onChange: (n) => {
764
+ const s = n.currentTarget.value;
765
+ r(s), a([s, u]);
766
766
  }
767
767
  }
768
768
  ) }),
@@ -773,46 +773,46 @@ function pe({
773
773
  type: "text",
774
774
  placeholder: "Max",
775
775
  value: u ?? "",
776
- onChange: (r) => {
777
- const n = r.currentTarget.value;
778
- s(n), a([l, n]);
776
+ onChange: (n) => {
777
+ const s = n.currentTarget.value;
778
+ i(s), a([l, s]);
779
779
  }
780
780
  }
781
781
  ) })
782
782
  ] });
783
783
  }
784
- function je({
784
+ function Ne({
785
785
  item: e,
786
786
  pathPrefix: a
787
787
  }) {
788
- var d;
789
- const { setPath: l } = y(), { infos: i } = Y(e), u = `${a}.value`;
788
+ var m;
789
+ const { setPath: l } = y(), { infos: r } = Y(e), { user: u } = ee(), i = `${a}.value`;
790
790
  if (e == null || X.includes(
791
791
  e.matcher
792
792
  ))
793
793
  return null;
794
- const s = e;
795
- let r = (d = i == null ? void 0 : i.field) == null ? void 0 : d.type;
796
- r == null && (r = B(s.value)), (typeof s.value == "string" && /^{{.*}}$/.test(s.value) || Array.isArray(s.value) && s.value.some(
797
- (c) => typeof c == "string" && /^{{.*}}$/.test(c)
798
- )) && (r = "string");
799
- let n = null;
800
- switch (r) {
794
+ const n = e;
795
+ let s = (m = r == null ? void 0 : r.field) == null ? void 0 : m.type;
796
+ s == null && (s = B(n.value)), (typeof n.value == "string" && /^{{.*}}$/.test(n.value) || Array.isArray(n.value) && n.value.some(
797
+ (o) => typeof o == "string" && /^{{.*}}$/.test(o)
798
+ )) && (s = "string");
799
+ let c = null;
800
+ switch (s) {
801
801
  case "datetime": {
802
- n = "date";
802
+ c = "date";
803
803
  break;
804
804
  }
805
805
  case "boolean": {
806
- n = "boolean";
806
+ c = "boolean";
807
807
  break;
808
808
  }
809
809
  case "string": {
810
- n = "text";
810
+ c = "text";
811
811
  break;
812
812
  }
813
813
  case "integer":
814
814
  case "float": {
815
- n = "number";
815
+ c = "number";
816
816
  break;
817
817
  }
818
818
  case "array":
@@ -820,11 +820,11 @@ function je({
820
820
  case "object":
821
821
  break;
822
822
  default: {
823
- n = "text";
823
+ c = "text";
824
824
  break;
825
825
  }
826
826
  }
827
- switch (s.matcher) {
827
+ switch (n.matcher) {
828
828
  case "eq":
829
829
  case "not_eq":
830
830
  case "lt":
@@ -844,54 +844,55 @@ function je({
844
844
  case "gteq_lt":
845
845
  case "gt_lteq":
846
846
  case "gteq_lteq": {
847
- n === "number" && (n = "numberRange"), n === "text" && (n = "textRange"), n === "date" && (n = "dateRange");
847
+ c === "number" && (c = "numberRange"), c === "text" && (c = "textRange"), c === "date" && (c = "dateRange");
848
848
  break;
849
849
  }
850
850
  case "is_in":
851
851
  case "is_not_in": {
852
- n = "tag";
852
+ c = "tag";
853
853
  break;
854
854
  }
855
855
  case "array_match": {
856
- n = "arrayMatch";
856
+ c = "arrayMatch";
857
857
  break;
858
858
  }
859
859
  default: {
860
- R(s.matcher);
860
+ R(n.matcher);
861
861
  break;
862
862
  }
863
863
  }
864
- switch (n) {
864
+ switch (c) {
865
865
  case "date": {
866
- const c = A(
867
- typeof s.value == "string" ? s.value : ""
866
+ const o = A(
867
+ typeof n.value == "string" ? n.value : ""
868
868
  );
869
869
  return /* @__PURE__ */ t.jsx(
870
- te,
870
+ ae,
871
871
  {
872
- value: T(c) ? c : void 0,
872
+ value: T(o) ? o : void 0,
873
873
  showTimeSelect: !0,
874
874
  placeholder: "Enter value",
875
- onChange: (o) => {
876
- l(u, o == null ? void 0 : o.toJSON());
877
- }
875
+ onChange: (d) => {
876
+ l(i, d == null ? void 0 : d.toJSON());
877
+ },
878
+ timezone: u == null ? void 0 : u.timezone
878
879
  }
879
880
  );
880
881
  }
881
882
  case "dateRange": {
882
- const c = Array.isArray(s.value) ? s.value.map((o) => {
883
- const f = A(typeof o == "string" ? o : "");
883
+ const o = Array.isArray(n.value) ? n.value.map((d) => {
884
+ const f = A(typeof d == "string" ? d : "");
884
885
  return T(f) ? f : null;
885
886
  }) : [null, null];
886
887
  return /* @__PURE__ */ t.jsx(
887
- ee,
888
+ te,
888
889
  {
889
- value: c,
890
+ value: o,
890
891
  showTimeSelect: !0,
891
- onChange: (o) => {
892
+ onChange: (d) => {
892
893
  l(
893
894
  `${a}.value`,
894
- o.map((f) => (f == null ? void 0 : f.toJSON()) ?? null)
895
+ d.map((f) => (f == null ? void 0 : f.toJSON()) ?? null)
895
896
  );
896
897
  }
897
898
  }
@@ -899,29 +900,29 @@ function je({
899
900
  }
900
901
  case "numberRange":
901
902
  return /* @__PURE__ */ t.jsx(
902
- ve,
903
+ pe,
903
904
  {
904
- value: s.value,
905
- onChange: (c) => {
906
- l(u, c);
905
+ value: n.value,
906
+ onChange: (o) => {
907
+ l(i, o);
907
908
  }
908
909
  }
909
910
  );
910
911
  case "textRange":
911
912
  return /* @__PURE__ */ t.jsx(
912
- pe,
913
+ je,
913
914
  {
914
- value: s.value,
915
- onChange: (c) => {
916
- l(u, c);
915
+ value: n.value,
916
+ onChange: (o) => {
917
+ l(i, o);
917
918
  }
918
919
  }
919
920
  );
920
921
  case "arrayMatch":
921
922
  return /* @__PURE__ */ t.jsx(
922
- be,
923
+ ye,
923
924
  {
924
- value: s.value,
925
+ value: n.value,
925
926
  pathPrefix: `${a}.value`
926
927
  }
927
928
  );
@@ -932,21 +933,21 @@ function je({
932
933
  isMulti: !0,
933
934
  isClearable: !1,
934
935
  isCreatable: !0,
935
- defaultValue: Array.isArray(s.value) ? s.value.map((c) => ({
936
- label: c.toString(),
937
- value: c
936
+ defaultValue: Array.isArray(n.value) ? n.value.map((o) => ({
937
+ label: o.toString(),
938
+ value: o
938
939
  })) : [],
939
940
  initialValues: [],
940
- onSelect: (c) => {
941
- K(c) && l(
941
+ onSelect: (o) => {
942
+ K(o) && l(
942
943
  `${a}.value`,
943
- c.map((o) => {
944
- if (r === "integer") {
945
- const f = parseInt(o.value.toString(), 10);
944
+ o.map((d) => {
945
+ if (s === "integer") {
946
+ const f = parseInt(d.value.toString(), 10);
946
947
  return isNaN(f) ? null : f;
947
948
  }
948
- return o.value;
949
- }).filter((o) => o != null)
949
+ return d.value;
950
+ }).filter((d) => d != null)
950
951
  );
951
952
  }
952
953
  }
@@ -957,12 +958,12 @@ function je({
957
958
  {
958
959
  name: `${a}.value`,
959
960
  type: "number",
960
- defaultValue: typeof s.value == "number" ? s.value : "",
961
+ defaultValue: typeof n.value == "number" ? n.value : "",
961
962
  placeholder: "Enter value",
962
- onChange: (c) => {
963
+ onChange: (o) => {
963
964
  l(
964
965
  `${a}.value`,
965
- parseInt(c.currentTarget.value, 10)
966
+ parseInt(o.currentTarget.value, 10)
966
967
  );
967
968
  }
968
969
  }
@@ -972,16 +973,16 @@ function je({
972
973
  j,
973
974
  {
974
975
  name: `${a}.value`,
975
- defaultValue: typeof s.value == "boolean" ? {
976
- label: s.value ? "Yes" : "No",
977
- value: s.value
976
+ defaultValue: typeof n.value == "boolean" ? {
977
+ label: n.value ? "Yes" : "No",
978
+ value: n.value
978
979
  } : void 0,
979
980
  initialValues: [
980
981
  { label: "Yes", value: !0 },
981
982
  { label: "No", value: !1 }
982
983
  ],
983
- onSelect: (c) => {
984
- V(c) && l(u, c.value);
984
+ onSelect: (o) => {
985
+ V(o) && l(i, o.value);
985
986
  }
986
987
  }
987
988
  );
@@ -992,10 +993,10 @@ function je({
992
993
  {
993
994
  name: `${a}.value`,
994
995
  type: "text",
995
- defaultValue: typeof s.value == "string" ? s.value : JSON.stringify(s.value),
996
+ defaultValue: typeof n.value == "string" ? n.value : JSON.stringify(n.value),
996
997
  placeholder: "Enter value",
997
- onChange: (c) => {
998
- l(u, c.currentTarget.value);
998
+ onChange: (o) => {
999
+ l(i, o.currentTarget.value);
999
1000
  }
1000
1001
  }
1001
1002
  );
@@ -1003,34 +1004,34 @@ function je({
1003
1004
  return R();
1004
1005
  }
1005
1006
  }
1006
- function Ne({
1007
+ function _e({
1007
1008
  item: e,
1008
1009
  nestingLevel: a,
1009
1010
  pathPrefix: l,
1010
- onDelete: i
1011
+ onDelete: r
1011
1012
  }) {
1012
- const { setPath: u } = y(), s = [];
1013
- return a < 2 && (s[0] ?? (s[0] = []), s[0].push(
1013
+ const { setPath: u } = y(), i = [];
1014
+ return a < 2 && (i[0] ?? (i[0] = []), i[0].push(
1014
1015
  /* @__PURE__ */ t.jsx(
1015
1016
  S,
1016
1017
  {
1017
1018
  label: "Nest conditions",
1018
1019
  onClick: () => {
1019
- var r;
1020
+ var n;
1020
1021
  u(
1021
- `${l}.nested.conditions.${(((r = e == null ? void 0 : e.nested) == null ? void 0 : r.conditions) ?? []).length}`,
1022
+ `${l}.nested.conditions.${(((n = e == null ? void 0 : e.nested) == null ? void 0 : n.conditions) ?? []).length}`,
1022
1023
  void 0
1023
1024
  );
1024
1025
  }
1025
1026
  }
1026
1027
  )
1027
- )), i != null && (s[1] ?? (s[1] = []), s[1].push(
1028
+ )), r != null && (i[1] ?? (i[1] = []), i[1].push(
1028
1029
  /* @__PURE__ */ t.jsx(
1029
1030
  S,
1030
1031
  {
1031
1032
  label: "Delete",
1032
1033
  onClick: () => {
1033
- u(`${l}`, null), i();
1034
+ u(`${l}`, null), r();
1034
1035
  }
1035
1036
  }
1036
1037
  )
@@ -1043,27 +1044,27 @@ function Ne({
1043
1044
  name: `${l}.field`,
1044
1045
  type: "text",
1045
1046
  defaultValue: e != null ? e.field : void 0,
1046
- onChange: (r) => {
1047
- u(`${l}.field`, r.currentTarget.value);
1047
+ onChange: (n) => {
1048
+ u(`${l}.field`, n.currentTarget.value);
1048
1049
  },
1049
- onBlur: (r) => {
1050
- u(`${l}.field`, r.currentTarget.value);
1050
+ onBlur: (n) => {
1051
+ u(`${l}.field`, n.currentTarget.value);
1051
1052
  }
1052
1053
  }
1053
1054
  ) }),
1054
- /* @__PURE__ */ t.jsx("div", { className: "flex-14", children: /* @__PURE__ */ t.jsx(he, { item: e, pathPrefix: l }) })
1055
+ /* @__PURE__ */ t.jsx("div", { className: "flex-14", children: /* @__PURE__ */ t.jsx(be, { item: e, pathPrefix: l }) })
1055
1056
  ] }),
1056
- /* @__PURE__ */ t.jsx(je, { item: e, pathPrefix: l })
1057
+ /* @__PURE__ */ t.jsx(Ne, { item: e, pathPrefix: l })
1057
1058
  ] }) }),
1058
- s.length > 0 && /* @__PURE__ */ t.jsx(
1059
- z,
1059
+ i.length > 0 && /* @__PURE__ */ t.jsx(
1060
+ J,
1060
1061
  {
1061
1062
  className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
1062
1063
  dropdownLabel: /* @__PURE__ */ t.jsx("button", { className: "flex items-center justify-center self-stretch flex-grow", children: /* @__PURE__ */ t.jsx(p, { name: "dotsThreeVertical", size: 16, weight: "bold" }) }),
1063
- dropdownItems: s.map((r, n, d) => /* @__PURE__ */ t.jsxs(I.Fragment, { children: [
1064
- r.map((c, o) => /* @__PURE__ */ t.jsx(I.Fragment, { children: c }, o)),
1065
- n < d.length - 1 && /* @__PURE__ */ t.jsx(ae, {})
1066
- ] }, n))
1064
+ dropdownItems: i.map((n, s, c) => /* @__PURE__ */ t.jsxs(I.Fragment, { children: [
1065
+ n.map((m, o) => /* @__PURE__ */ t.jsx(I.Fragment, { children: m }, o)),
1066
+ s < c.length - 1 && /* @__PURE__ */ t.jsx(le, {})
1067
+ ] }, s))
1067
1068
  }
1068
1069
  )
1069
1070
  ] });
@@ -1072,17 +1073,17 @@ function H({
1072
1073
  item: e,
1073
1074
  children: a,
1074
1075
  nestingLevel: l = 0,
1075
- pathPrefix: i
1076
+ pathPrefix: r
1076
1077
  }) {
1077
- var o, f;
1078
+ var o, d;
1078
1079
  const {
1079
1080
  state: { selectedRuleIndex: u }
1080
- } = y(), s = ((o = e == null ? void 0 : e.conditions_logic) == null ? void 0 : o.toLowerCase()) ?? "and", { setPath: r } = y(), [n, d] = x(0), c = l > 0;
1081
+ } = y(), i = ((o = e == null ? void 0 : e.conditions_logic) == null ? void 0 : o.toLowerCase()) ?? "and", { setPath: n } = y(), [s, c] = x(0), m = l > 0;
1081
1082
  return /* @__PURE__ */ t.jsxs(
1082
1083
  "div",
1083
1084
  {
1084
1085
  className: $("query-group", {
1085
- "p-4 border border-gray-200 rounded-md": c
1086
+ "p-4 border border-gray-200 rounded-md": m
1086
1087
  }),
1087
1088
  children: [
1088
1089
  a,
@@ -1090,54 +1091,54 @@ function H({
1090
1091
  /* @__PURE__ */ t.jsxs(
1091
1092
  "select",
1092
1093
  {
1093
- onChange: (m) => {
1094
- r(
1095
- `${i}.conditions_logic`,
1096
- m.currentTarget.value
1094
+ onChange: (f) => {
1095
+ n(
1096
+ `${r}.conditions_logic`,
1097
+ f.currentTarget.value
1097
1098
  );
1098
1099
  },
1099
- defaultValue: s,
1100
+ defaultValue: i,
1100
1101
  className: "pl-4 pr-8 py-2 font-bold focus:ring-0 focus:outline-none appearance-none bg-gray-50 border border-gray-200 rounded-md text-sm leading-4",
1101
1102
  children: [
1102
1103
  /* @__PURE__ */ t.jsxs("option", { value: "and", children: [
1103
- c ? "Nested in " : "",
1104
+ m ? "Nested in " : "",
1104
1105
  "AND"
1105
1106
  ] }),
1106
1107
  /* @__PURE__ */ t.jsxs("option", { value: "or", children: [
1107
- c ? "Nested in " : "",
1108
+ m ? "Nested in " : "",
1108
1109
  "OR"
1109
1110
  ] })
1110
1111
  ]
1111
1112
  }
1112
1113
  ),
1113
- /* @__PURE__ */ t.jsx("div", { className: "border-l border-gray-200 ml-3 pt-3", children: (f = e == null ? void 0 : e.conditions) == null ? void 0 : f.map((m, h, b) => {
1114
+ /* @__PURE__ */ t.jsx("div", { className: "border-l border-gray-200 ml-3 pt-3", children: (d = e == null ? void 0 : e.conditions) == null ? void 0 : d.map((f, h, b) => {
1114
1115
  const v = h === b.length - 1;
1115
1116
  return /* @__PURE__ */ t.jsxs(
1116
1117
  "div",
1117
1118
  {
1118
1119
  className: "flex items-center mb-4 last:mb-0 relative",
1119
1120
  children: [
1120
- /* @__PURE__ */ t.jsx(_e, { rounded: v }),
1121
+ /* @__PURE__ */ t.jsx(we, { rounded: v }),
1121
1122
  /* @__PURE__ */ t.jsx("div", { className: "ml-4 w-full", children: /* @__PURE__ */ t.jsx(
1122
1123
  H,
1123
1124
  {
1124
- item: (m == null ? void 0 : m.nested) ?? void 0,
1125
- nestingLevel: (m == null ? void 0 : m.nested) != null ? l + 1 : 0,
1126
- pathPrefix: `${i}.conditions.${h}.nested`,
1125
+ item: (f == null ? void 0 : f.nested) ?? void 0,
1126
+ nestingLevel: (f == null ? void 0 : f.nested) != null ? l + 1 : 0,
1127
+ pathPrefix: `${r}.conditions.${h}.nested`,
1127
1128
  children: /* @__PURE__ */ t.jsx(
1128
1129
  "div",
1129
1130
  {
1130
1131
  className: $({
1131
- "mb-4": (m == null ? void 0 : m.nested) != null
1132
+ "mb-4": (f == null ? void 0 : f.nested) != null
1132
1133
  }),
1133
1134
  children: /* @__PURE__ */ t.jsx(
1134
- Ne,
1135
+ _e,
1135
1136
  {
1136
- item: m,
1137
+ item: f,
1137
1138
  nestingLevel: l,
1138
- pathPrefix: `${i}.conditions.${h}`,
1139
+ pathPrefix: `${r}.conditions.${h}`,
1139
1140
  onDelete: b.length > 1 || l > 0 ? () => {
1140
- d((_) => _ + 1);
1141
+ c((_) => _ + 1);
1141
1142
  } : void 0
1142
1143
  }
1143
1144
  )
@@ -1147,7 +1148,7 @@ function H({
1147
1148
  ) })
1148
1149
  ]
1149
1150
  },
1150
- `${u}-${h}-${n}`
1151
+ `${u}-${h}-${s}`
1151
1152
  );
1152
1153
  }) })
1153
1154
  ] })
@@ -1155,7 +1156,7 @@ function H({
1155
1156
  }
1156
1157
  );
1157
1158
  }
1158
- function _e({
1159
+ function we({
1159
1160
  rounded: e = !1
1160
1161
  }) {
1161
1162
  return e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
@@ -1163,34 +1164,34 @@ function _e({
1163
1164
  /* @__PURE__ */ t.jsx("div", { className: "absolute -left-[1px] top-1/2 -translate-y-1/2 w-3.5 h-3.5 border-l border-b rounded-es-sm bg-white border-gray-200" })
1164
1165
  ] }) : /* @__PURE__ */ t.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
1165
1166
  }
1166
- function we() {
1167
- var s;
1167
+ function Te() {
1168
+ var i;
1168
1169
  const {
1169
1170
  setPath: e,
1170
1171
  state: { value: a, selectedRuleIndex: l }
1171
- } = y(), [i, u] = x(
1172
- ((s = a.rules[l]) == null ? void 0 : s.name) ?? ""
1172
+ } = y(), [r, u] = x(
1173
+ ((i = a.rules[l]) == null ? void 0 : i.name) ?? ""
1173
1174
  );
1174
1175
  return N(() => {
1175
- var r;
1176
- u(((r = a.rules[l]) == null ? void 0 : r.name) ?? "");
1176
+ var n;
1177
+ u(((n = a.rules[l]) == null ? void 0 : n.name) ?? "");
1177
1178
  }, [l]), /* @__PURE__ */ t.jsx(
1178
1179
  "div",
1179
1180
  {
1180
1181
  contentEditable: "plaintext-only",
1181
1182
  suppressContentEditableWarning: !0,
1182
- onInput: (r) => {
1183
- const d = r.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
1184
- e(`rules.${l}.name`, d);
1183
+ onInput: (n) => {
1184
+ const c = n.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
1185
+ e(`rules.${l}.name`, c);
1185
1186
  },
1186
- onKeyDown: (r) => {
1187
- r.key === "Enter" && (r.preventDefault(), r.currentTarget.blur());
1187
+ onKeyDown: (n) => {
1188
+ n.key === "Enter" && (n.preventDefault(), n.currentTarget.blur());
1188
1189
  },
1189
- onBlur: (r) => {
1190
- const n = r.currentTarget;
1191
- n.innerText = n.innerText.replace(/[\n\s]+/g, " ").trim();
1190
+ onBlur: (n) => {
1191
+ const s = n.currentTarget;
1192
+ s.innerText = s.innerText.replace(/[\n\s]+/g, " ").trim();
1192
1193
  },
1193
- children: i
1194
+ children: r
1194
1195
  },
1195
1196
  l
1196
1197
  );
@@ -1203,14 +1204,14 @@ const L = {
1203
1204
  } catch {
1204
1205
  return L;
1205
1206
  }
1206
- }, Te = (e) => {
1207
+ }, $e = (e) => {
1207
1208
  try {
1208
1209
  return JSON.parse(e ?? "{}"), !0;
1209
1210
  } catch {
1210
1211
  return !1;
1211
1212
  }
1212
1213
  };
1213
- function Ae(e) {
1214
+ function qe(e) {
1214
1215
  const [a, l] = x(
1215
1216
  C(e.value ?? e.defaultValue)
1216
1217
  );
@@ -1219,33 +1220,33 @@ function Ae(e) {
1219
1220
  a.rules.length === 0 && l(C(e.value));
1220
1221
  },
1221
1222
  [e.value]
1222
- ), /* @__PURE__ */ t.jsx(fe, { initialValue: { rules: a.rules }, children: /* @__PURE__ */ t.jsx($e, { ...e }) });
1223
+ ), /* @__PURE__ */ t.jsx(me, { initialValue: { rules: a.rules }, children: /* @__PURE__ */ t.jsx(Ce, { ...e }) });
1223
1224
  }
1224
- function $e(e) {
1225
+ function Ce(e) {
1225
1226
  const {
1226
1227
  state: { value: a, selectedRuleIndex: l },
1227
- setSelectedRuleIndex: i,
1228
+ setSelectedRuleIndex: r,
1228
1229
  setValue: u,
1229
- setPath: s
1230
- } = y(), [r, n] = x(
1230
+ setPath: i
1231
+ } = y(), [n, s] = x(
1231
1232
  e.defaultCodeEditorVisible ?? !1
1232
- ), d = a.rules[l], c = ce(null), [o, f] = x(0);
1233
+ ), c = a.rules[l], m = oe(null), [o, d] = x(0);
1233
1234
  N(
1234
1235
  function() {
1235
1236
  var b, v, _;
1236
- E(C((b = c.current) == null ? void 0 : b.getValue()), a) || (v = c.current) == null || v.setValue(JSON.stringify(a, null, 2)), (_ = e.onChange) == null || _.call(e, a);
1237
+ E(C((b = m.current) == null ? void 0 : b.getValue()), a) || (v = m.current) == null || v.setValue(JSON.stringify(a, null, 2)), (_ = e.onChange) == null || _.call(e, a);
1237
1238
  },
1238
1239
  [a]
1239
1240
  );
1240
- const m = w(
1241
+ const f = w(
1241
1242
  (h) => {
1242
1243
  const b = C(h);
1243
- c.current != null && c.current.hasTextFocus() && Te(h) && !E(b, a) && (u(b), f((v) => v + 1));
1244
+ m.current != null && m.current.hasTextFocus() && $e(h) && !E(b, a) && (u(b), d((v) => v + 1));
1244
1245
  },
1245
1246
  [a]
1246
1247
  );
1247
1248
  return /* @__PURE__ */ t.jsx(
1248
- le,
1249
+ ne,
1249
1250
  {
1250
1251
  hint: e.hint,
1251
1252
  feedback: e.feedback,
@@ -1254,7 +1255,7 @@ function $e(e) {
1254
1255
  /* @__PURE__ */ t.jsxs(
1255
1256
  "div",
1256
1257
  {
1257
- className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${r ? "" : "grow"}`,
1258
+ className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${n ? "" : "grow"}`,
1258
1259
  children: [
1259
1260
  /* @__PURE__ */ t.jsxs("header", { className: "w-full bg-white border-b border-gray-200 py-3 px-8 flex text-[13px] gap-4 text-gray-400 font-semibold items-center", children: [
1260
1261
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4 flex-wrap", children: [
@@ -1267,7 +1268,7 @@ function $e(e) {
1267
1268
  "text-black": l === b
1268
1269
  }),
1269
1270
  onClick: () => {
1270
- i(b);
1271
+ r(b);
1271
1272
  },
1272
1273
  children: v
1273
1274
  },
@@ -1281,11 +1282,11 @@ function $e(e) {
1281
1282
  "text-black": !0
1282
1283
  }),
1283
1284
  onClick: () => {
1284
- s(`rules.${a.rules.length}`, {
1285
+ i(`rules.${a.rules.length}`, {
1285
1286
  name: "Rule name",
1286
1287
  actions: [null],
1287
1288
  conditions: [null]
1288
- }), i(a.rules.length);
1289
+ }), r(a.rules.length);
1289
1290
  },
1290
1291
  children: /* @__PURE__ */ t.jsx(p, { name: "plus", size: 16, className: "shrink-0" })
1291
1292
  }
@@ -1296,24 +1297,24 @@ function $e(e) {
1296
1297
  {
1297
1298
  className: "text-blue-600 hover:text-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500",
1298
1299
  onClick: () => {
1299
- n(!r);
1300
+ s(!n);
1300
1301
  },
1301
1302
  children: /* @__PURE__ */ t.jsx(p, { name: "sidebarSimple", size: 16, color: "#101111" })
1302
1303
  }
1303
1304
  ) })
1304
1305
  ] }),
1305
- /* @__PURE__ */ t.jsxs(Ve, { children: [
1306
+ /* @__PURE__ */ t.jsxs(Ee, { children: [
1306
1307
  /* @__PURE__ */ t.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
1307
- /* @__PURE__ */ t.jsx(we, {}),
1308
+ /* @__PURE__ */ t.jsx(Te, {}),
1308
1309
  /* @__PURE__ */ t.jsx(p, { name: "pencilSimple", size: 16, className: "shrink-0" })
1309
1310
  ] }),
1310
- /* @__PURE__ */ t.jsx(J, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(xe, { actions: d == null ? void 0 : d.actions }) }),
1311
- /* @__PURE__ */ t.jsx(Ce, { children: "when" }),
1312
- /* @__PURE__ */ t.jsxs(J, { title: "Conditions", icon: "treeView", children: [
1311
+ /* @__PURE__ */ t.jsx(z, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(he, { actions: c == null ? void 0 : c.actions }) }),
1312
+ /* @__PURE__ */ t.jsx(Ve, { children: "when" }),
1313
+ /* @__PURE__ */ t.jsxs(z, { title: "Conditions", icon: "treeView", children: [
1313
1314
  /* @__PURE__ */ t.jsx(
1314
1315
  H,
1315
1316
  {
1316
- item: d,
1317
+ item: c,
1317
1318
  pathPrefix: `rules.${l}`
1318
1319
  }
1319
1320
  ),
@@ -1325,8 +1326,8 @@ function $e(e) {
1325
1326
  alignItems: "center",
1326
1327
  onClick: () => {
1327
1328
  var h;
1328
- s(
1329
- `rules.${l}.conditions.${((h = d == null ? void 0 : d.conditions) == null ? void 0 : h.length) ?? 0}`,
1329
+ i(
1330
+ `rules.${l}.conditions.${((h = c == null ? void 0 : c.conditions) == null ? void 0 : h.length) ?? 0}`,
1330
1331
  void 0
1331
1332
  );
1332
1333
  },
@@ -1342,31 +1343,31 @@ function $e(e) {
1342
1343
  },
1343
1344
  o
1344
1345
  ),
1345
- r && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
1346
- ne,
1346
+ n && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
1347
+ se,
1347
1348
  {
1348
- ref: c,
1349
+ ref: m,
1349
1350
  name: e.id ?? e.name,
1350
1351
  height: "100%",
1351
1352
  language: "json",
1352
1353
  jsonSchema: "order-rules",
1353
1354
  defaultValue: JSON.stringify(a, null, 2),
1354
1355
  noRounding: !0,
1355
- onChange: m
1356
+ onChange: f
1356
1357
  }
1357
1358
  ) })
1358
1359
  ] })
1359
1360
  }
1360
1361
  );
1361
1362
  }
1362
- function Ce({ children: e }) {
1363
+ function Ve({ children: e }) {
1363
1364
  return /* @__PURE__ */ t.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
1364
1365
  /* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
1365
1366
  /* @__PURE__ */ t.jsx("span", { className: "font-bold my-1 bg-gray-200 px-3 relative uppercase rounded h-[25px] items-center flex text-sm", children: e }),
1366
1367
  /* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
1367
1368
  ] });
1368
1369
  }
1369
- function J({
1370
+ function z({
1370
1371
  children: e,
1371
1372
  title: a,
1372
1373
  icon: l
@@ -1379,11 +1380,11 @@ function J({
1379
1380
  /* @__PURE__ */ t.jsx("div", { className: "p-6", children: e })
1380
1381
  ] });
1381
1382
  }
1382
- function Ve({
1383
+ function Ee({
1383
1384
  children: e
1384
1385
  }) {
1385
1386
  return /* @__PURE__ */ t.jsx("div", { className: "h-full w-full bg-gray-50 p-8 [background-image:radial-gradient(#d6d6d6_1px,transparent_1px)] [background-size:16px_16px] overflow-auto", children: /* @__PURE__ */ t.jsx("div", { className: "max-w-[900px] mx-auto", children: e }) });
1386
1387
  }
1387
1388
  export {
1388
- Ae as RuleEngine
1389
+ qe as RuleEngine
1389
1390
  };