@commercelayer/app-elements 6.1.0 → 6.1.2

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,10 +1,10 @@
1
1
  "use client";
2
- import { c as X, t as _, m as fr, a as hr, bh as he, bi as fe, bj as dt, bk as We, bl as mr, bm as Ur, bn as Vr, bo as rt, bp as vr, bq as qr, br as Dr, bs as gr, bt as jr, bu as $r, bv as Lt, bw as Gr, bx as zr, by as Ft, bz as Xr, bA as Re, bB as Zr, aT as te, bC as z, bD as Pe, bE as be, b6 as wt, bF as xt, bG as yr, bH as Et, bI as wr, bJ as Jr, bK as xe, bL as At, bM as en, bN as tn, bO as rn, bP as nn, bQ as nt, bR as an, bf as on, bd as sn, bS as ln, bT as cn, bU as un } from "./main-CHMUH05z.js";
2
+ import { c as X, t as _, m as fr, a as hr, bi as he, bj as fe, bk as dt, bl as We, bm as mr, bn as Ur, bo as Vr, bp as rt, bq as vr, br as qr, bs as Dr, bt as gr, bu as jr, bv as $r, bw as Lt, bx as Gr, by as zr, bz as Ft, bA as Xr, bB as Re, bC as Zr, aU as te, bD as z, bE as Pe, bF as be, b7 as wt, bG as xt, bH as yr, bI as Et, bJ as wr, bK as Jr, bL as xe, bM as At, bN as en, bO as tn, bP as rn, bQ as nn, bR as nt, bS as an, bg as on, be as sn, bT as ln, bU as cn, bV as un } from "./main-DHorNs6K.js";
3
3
  import * as b from "react";
4
4
  import f, { useLayoutEffect as br, useEffect as Pt, cloneElement as _r, createRef as Me, Component as $, useRef as bt, useCallback as dn, createElement as pn, forwardRef as fn, useMemo as hn } from "react";
5
5
  import * as mn from "react-dom";
6
6
  import vn from "react-dom";
7
- import { p as Dn } from "./parseISO-9qgqVQGb.js";
7
+ import { p as Dn } from "./parseISO-asedr7hB.js";
8
8
  function kr(o, r, t) {
9
9
  return X(o, +_(o) + r);
10
10
  }
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { t as D, B as re, D as le, E as ie, I as oe, N as ce, O as ue, P as de, Z as S, b as me, d as pe, e as fe, f as he, g as ye, h as ge, i as be, j as xe, k as ve, l as M, n as je, o as _e, p as Te, q as Ne, r as we, s as $e, u as Ce, v as ke, w as Ee, x as Se, y as Ve, z as Re, A as Ie, C as Ae, F as Ze, G as De, H as Me, J as qe, K as Oe, L as Fe, M as Le, Q as ze, R as Pe, S as Ue, T as Je, U as We, V as Ke, W as Be, X as Ye, Y as Xe, _ as He, $ as Ge, a0 as Qe, a1 as et, a2 as tt, a3 as at, a4 as st, a5 as nt, a6 as rt, a7 as lt, a8 as it, a9 as q, aa as ot, ab as ct, ac as ut, ad as dt, ae as mt, af as pt, ag as ft, ah as ht, ai as yt, aj as gt, ak as bt, al as xt, am as vt, an as jt, ao as _t, ap as Tt, aq as Nt, ar as wt, as as $t, at as Ct, au as kt, av as Et, aw as St, ax as Vt, ay as Rt, az as It, aA as At, aB as Zt, aC as Dt, aD as Mt, aE as qt, aF as Ot, aG as Ft, aH as Lt, aI as zt, aJ as Pt, aK as Ut, aL as Jt, aM as Wt, aN as Kt, aO as Bt, aP as Yt, aQ as Xt, aR as Ht, aS as Gt, aT as e, aU as V, aV as Qt, aW as ea, aX as ta, aY as v, aZ as $, a_ as aa, a$ as R, b0 as g, b1 as A, b2 as w, b3 as x, b4 as N, b5 as sa, b6 as k, b7 as B, b8 as Y, b9 as X, ba as na, bb as ra, bc as H, bd as I, be as la, bf as ia, bg as oa } from "./main-CHMUH05z.js";
3
- import O, { useReducer as ca, useCallback as C, useMemo as ua, createContext as da, useContext as ma, useRef as G, useState as f, useEffect as T } from "react";
2
+ import { t as D, B as re, D as le, E as ie, I as oe, N as ce, O as ue, P as de, Z as S, b as me, d as pe, e as fe, f as he, g as ye, h as ge, i as be, j as xe, k as ve, l as M, n as je, o as _e, p as Te, q as Ne, r as we, s as $e, u as Ce, v as Ee, w as ke, x as Se, y as Ve, z as Re, A as Ae, C as Ie, F as Ze, G as De, H as Me, J as qe, K as Oe, L as Le, M as Fe, Q as Pe, R as ze, S as Ue, T as Je, U as We, V as Be, W as Ke, X as Ye, Y as Xe, _ as He, $ as Ge, a0 as Qe, a1 as et, a2 as tt, a3 as at, a4 as st, a5 as nt, a6 as rt, a7 as lt, a8 as it, a9 as q, aa as ot, ab as ct, ac as ut, ad as dt, ae as mt, af as pt, ag as ft, ah as ht, ai as yt, aj as gt, ak as bt, al as xt, am as vt, an as jt, ao as _t, ap as Tt, aq as Nt, ar as wt, as as $t, at as Ct, au as Et, av as kt, aw as St, ax as Vt, ay as Rt, az as At, aA as It, aB as Zt, aC as Dt, aD as Mt, aE as qt, aF as Ot, aG as Lt, aH as Ft, aI as Pt, aJ as zt, aK as Ut, aL as Jt, aM as Wt, aN as Bt, aO as Kt, aP as Yt, aQ as Xt, aR as Ht, aS as Gt, aT as Qt, aU as e, aV as V, aW as ea, aX as ta, aY as aa, aZ as v, a_ as $, a$ as sa, b0 as R, b1 as g, b2 as I, b3 as w, b4 as x, b5 as N, b6 as na, b7 as E, b8 as K, b9 as Y, ba as X, bb as ra, bc as la, bd as H, be as A, bf as ia, bg as oa, bh as ca } from "./main-DHorNs6K.js";
3
+ import O, { useReducer as ua, useCallback as C, useMemo as da, createContext as ma, useContext as pa, useRef as G, useState as f, useEffect as T } from "react";
4
4
  import "react-hook-form";
5
5
  import "wouter";
6
- import { p as F } from "./parseISO-9qgqVQGb.js";
7
- function L(t, a) {
6
+ import { p as L } from "./parseISO-asedr7hB.js";
7
+ function F(t, a) {
8
8
  const s = t.match(
9
9
  /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
10
10
  );
@@ -50,30 +50,30 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50
50
  ZodIntersection: we,
51
51
  ZodIssueCode: $e,
52
52
  ZodLazy: Ce,
53
- ZodLiteral: ke,
54
- ZodMap: Ee,
53
+ ZodLiteral: Ee,
54
+ ZodMap: ke,
55
55
  ZodNaN: Se,
56
56
  ZodNativeEnum: Ve,
57
57
  ZodNever: Re,
58
- ZodNull: Ie,
59
- ZodNullable: Ae,
58
+ ZodNull: Ae,
59
+ ZodNullable: Ie,
60
60
  ZodNumber: Ze,
61
61
  ZodObject: De,
62
62
  ZodOptional: Me,
63
63
  ZodParsedType: qe,
64
64
  ZodPipeline: Oe,
65
- ZodPromise: Fe,
66
- ZodReadonly: Le,
67
- ZodRecord: ze,
65
+ ZodPromise: Le,
66
+ ZodReadonly: Fe,
67
+ ZodRecord: Pe,
68
68
  ZodSchema: S,
69
- ZodSet: Pe,
69
+ ZodSet: ze,
70
70
  ZodString: Ue,
71
71
  ZodSymbol: Je,
72
72
  ZodTransformer: M,
73
73
  ZodTuple: We,
74
74
  ZodType: S,
75
- ZodUndefined: Ke,
76
- ZodUnion: Be,
75
+ ZodUndefined: Be,
76
+ ZodUnion: Ke,
77
77
  ZodUnknown: Ye,
78
78
  ZodVoid: Xe,
79
79
  addIssueToContext: He,
@@ -108,56 +108,60 @@ const y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
108
108
  never: wt,
109
109
  null: $t,
110
110
  nullable: Ct,
111
- number: kt,
112
- object: Et,
111
+ number: Et,
112
+ object: kt,
113
113
  get objectUtil() {
114
114
  return St;
115
115
  },
116
116
  oboolean: Vt,
117
117
  onumber: Rt,
118
- optional: It,
119
- ostring: At,
118
+ optional: At,
119
+ ostring: It,
120
120
  pipeline: Zt,
121
121
  preprocess: Dt,
122
122
  promise: Mt,
123
123
  quotelessJson: qt,
124
124
  record: Ot,
125
- set: Ft,
126
- setErrorMap: Lt,
127
- strictObject: zt,
128
- string: Pt,
125
+ set: Lt,
126
+ setErrorMap: Ft,
127
+ strictObject: Pt,
128
+ string: zt,
129
129
  symbol: Ut,
130
130
  transformer: q,
131
131
  tuple: Jt,
132
132
  undefined: Wt,
133
- union: Kt,
134
- unknown: Bt,
133
+ union: Bt,
134
+ unknown: Kt,
135
135
  get util() {
136
136
  return Yt;
137
137
  },
138
138
  void: Xt
139
139
  }, Symbol.toStringTag, { value: "Module" }));
140
- function z(t, a, s) {
141
- return t == null ? t : Ht(t, a, s);
140
+ var fa = 1, ha = 4;
141
+ function ya(t) {
142
+ return Ht(t, fa | ha);
142
143
  }
143
- function P(t, a) {
144
- return t == null ? !0 : Gt(t, a);
144
+ function P(t, a, s) {
145
+ return t == null ? t : Gt(t, a, s);
145
146
  }
146
- const Q = da(
147
+ function z(t, a) {
148
+ return t == null ? !0 : Qt(t, a);
149
+ }
150
+ const Q = ma(
147
151
  void 0
148
152
  );
149
- function pa(t, a) {
153
+ function ga(t, a) {
150
154
  switch (a.type) {
151
155
  case "SET_PATH": {
152
- const s = { ...t.value };
156
+ const s = ya(t.value);
153
157
  if (a.value === null)
154
158
  if (/\.\d+$/.test(a.path)) {
155
- const l = a.path.replace(/\.\d+$/, ""), c = parseInt(a.path.match(/\d+$/)?.[0] ?? "0", 10), n = Qt(s, l);
156
- Array.isArray(n) && (n.splice(c, 1), z(s, l, n), n.length === 0 && l.endsWith(".nested.conditions") && P(s, l.replace(/\.conditions$/, "")));
159
+ const l = a.path.replace(/\.\d+$/, ""), c = parseInt(a.path.match(/\d+$/)?.[0] ?? "0", 10), n = ea(s, l);
160
+ Array.isArray(n) && (n.splice(c, 1), P(s, l, n), n.length === 0 && l.endsWith(".nested.conditions") && z(s, l.replace(/\.conditions$/, "")));
157
161
  } else
158
- P(s, a.path);
162
+ z(s, a.path);
159
163
  else
160
- z(s, a.path, a.value);
164
+ P(s, a.path, a.value);
161
165
  return {
162
166
  ...t,
163
167
  value: s
@@ -190,11 +194,11 @@ function pa(t, a) {
190
194
  return t;
191
195
  }
192
196
  }
193
- function fa({
197
+ function ba({
194
198
  children: t,
195
199
  initialValue: a
196
200
  }) {
197
- const [s, l] = ca(pa, {
201
+ const [s, l] = ua(ga, {
198
202
  value: a.value,
199
203
  selectedRuleIndex: 0
200
204
  }), c = C((u, i) => {
@@ -205,7 +209,7 @@ function fa({
205
209
  }, 50);
206
210
  }, []), r = C((u) => {
207
211
  l({ type: "SET_VALUE", value: u });
208
- }, []), o = ua(
212
+ }, []), o = da(
209
213
  () => ({
210
214
  state: s,
211
215
  setPath: c,
@@ -226,7 +230,7 @@ function fa({
226
230
  return /* @__PURE__ */ e.jsx(Q.Provider, { value: o, children: t });
227
231
  }
228
232
  function b() {
229
- const t = ma(Q);
233
+ const t = pa(Q);
230
234
  if (t === void 0)
231
235
  throw new Error("useRuleEngine must be used within a RuleEngineProvider");
232
236
  return t;
@@ -236,8 +240,8 @@ function ee({
236
240
  name: a,
237
241
  preset: s
238
242
  }) {
239
- const { setPath: l, schemaType: c } = b(), { t: n } = ea(), r = G(null), o = c === "order-rules" ? "order" : c === "price-rules" ? "price" : void 0, u = ta(
240
- (s === "condition" ? ha : s === "action" ? ya : []).filter(
243
+ const { setPath: l, schemaType: c } = b(), { t: n } = ta(), r = G(null), o = c === "order-rules" ? "order" : c === "price-rules" ? "price" : void 0, u = aa(
244
+ (s === "condition" ? xa : s === "action" ? va : []).filter(
241
245
  (i) => o != null && i.startsWith(o)
242
246
  ).map((i) => ({
243
247
  value: i,
@@ -265,7 +269,7 @@ function ee({
265
269
  return [];
266
270
  const d = u.filter(
267
271
  (p) => p.label.includes(i)
268
- ), m = (await aa([o], i)).filter((p) => p.value.startsWith(i)).map((p) => {
272
+ ), m = (await sa([o], i)).filter((p) => p.value.startsWith(i)).map((p) => {
269
273
  const _ = p.type === "relationship" || p.value.endsWith(".metadata") ? `${p.value}.` : p.value;
270
274
  return {
271
275
  value: _,
@@ -280,7 +284,7 @@ function ee({
280
284
  }
281
285
  );
282
286
  }
283
- const ha = [
287
+ const xa = [
284
288
  "order.billing_address.country_code",
285
289
  "order.country_code",
286
290
  "order.currency_code",
@@ -323,7 +327,7 @@ const ha = [
323
327
  "price.sku.tags.name",
324
328
  "price.processed_at",
325
329
  "price.amount_cents"
326
- ], ya = [
330
+ ], va = [
327
331
  "order.line_items.line_item_options",
328
332
  "order.line_items.shipment",
329
333
  "order.line_items.sku_code",
@@ -335,7 +339,7 @@ const ha = [
335
339
  "order",
336
340
  "price"
337
341
  ];
338
- function ga({
342
+ function ja({
339
343
  item: t,
340
344
  pathPrefix: a
341
345
  }) {
@@ -451,7 +455,7 @@ function ga({
451
455
  return R();
452
456
  }
453
457
  }
454
- function ba({
458
+ function _a({
455
459
  item: t,
456
460
  index: a,
457
461
  onDelete: s
@@ -486,7 +490,7 @@ function ba({
486
490
  }
487
491
  }
488
492
  ) }),
489
- /* @__PURE__ */ e.jsx(ga, { item: t, pathPrefix: o }),
493
+ /* @__PURE__ */ e.jsx(ja, { item: t, pathPrefix: o }),
490
494
  /* @__PURE__ */ e.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
491
495
  /* @__PURE__ */ e.jsx("div", { className: "flex-1", children: /* @__PURE__ */ e.jsx(
492
496
  ee,
@@ -498,7 +502,7 @@ function ba({
498
502
  ) })
499
503
  ] }),
500
504
  s != null && /* @__PURE__ */ e.jsx(
501
- A,
505
+ I,
502
506
  {
503
507
  className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
504
508
  dropdownLabel: /* @__PURE__ */ e.jsx(
@@ -522,7 +526,7 @@ function ba({
522
526
  )
523
527
  ] }) });
524
528
  }
525
- function xa({
529
+ function Ta({
526
530
  actions: t
527
531
  }) {
528
532
  const [a, s] = f(0), {
@@ -531,7 +535,7 @@ function xa({
531
535
  } = b();
532
536
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
533
537
  /* @__PURE__ */ e.jsx("div", { children: t?.map((n, r, o) => /* @__PURE__ */ e.jsx(
534
- ba,
538
+ _a,
535
539
  {
536
540
  item: n,
537
541
  index: r,
@@ -564,7 +568,7 @@ function xa({
564
568
  function te(t) {
565
569
  const [a, s] = f(void 0);
566
570
  return T(() => {
567
- t?.field != null && sa(t.field).then((l) => {
571
+ t?.field != null && na(t.field).then((l) => {
568
572
  s(l);
569
573
  }).catch((l) => {
570
574
  console.error("Error fetching field info:", l);
@@ -573,20 +577,20 @@ function te(t) {
573
577
  }
574
578
  function ae(t) {
575
579
  if (typeof t == "string")
576
- return k(L(t)) ? "datetime" : "string";
580
+ return E(F(t)) ? "datetime" : "string";
577
581
  if (typeof t == "number")
578
582
  return "integer";
579
583
  if (typeof t == "boolean")
580
584
  return "boolean";
581
585
  if (Array.isArray(t)) {
582
586
  if (typeof t[0] == "string")
583
- return k(L(t[0])) ? "datetime" : "string";
587
+ return E(F(t[0])) ? "datetime" : "string";
584
588
  if (typeof t[0] == "number")
585
589
  return "integer";
586
590
  }
587
591
  return "string";
588
592
  }
589
- function va({
593
+ function Na({
590
594
  item: t,
591
595
  pathPrefix: a
592
596
  }) {
@@ -602,7 +606,7 @@ function va({
602
606
  } : void 0,
603
607
  initialValues: U.filter(({ fieldTypes: n, visible: r }) => r !== !1 && n.includes(c)).map(({ matcher: n, label: r }) => ({ value: n, label: r })),
604
608
  onSelect: (n) => {
605
- $(n) && (s(`${a}.matcher`, n.value), B.includes(
609
+ $(n) && (s(`${a}.matcher`, n.value), K.includes(
606
610
  n.value
607
611
  ) && s(`${a}.value`, null));
608
612
  }
@@ -868,14 +872,14 @@ const U = [
868
872
  label: "not at least one of"
869
873
  }
870
874
  };
871
- function ja({
875
+ function wa({
872
876
  value: t,
873
877
  pathPrefix: a
874
878
  }) {
875
879
  return (typeof t != "object" || Array.isArray(t) || t === null) && (t = {
876
880
  in_and: []
877
881
  }), /* @__PURE__ */ e.jsx("div", { children: Object.entries(t).map(([s, l], c) => /* @__PURE__ */ e.jsx(
878
- _a,
882
+ $a,
879
883
  {
880
884
  pathPrefix: a,
881
885
  defaultValue: l,
@@ -885,7 +889,7 @@ function ja({
885
889
  c}`
886
890
  )) });
887
891
  }
888
- function _a({
892
+ function $a({
889
893
  initialMatcher: t,
890
894
  defaultValue: a,
891
895
  pathPrefix: s
@@ -932,7 +936,7 @@ function _a({
932
936
  ) })
933
937
  ] });
934
938
  }
935
- function Ta({
939
+ function Ca({
936
940
  value: t,
937
941
  onChange: a
938
942
  }) {
@@ -969,7 +973,7 @@ function Ta({
969
973
  ) })
970
974
  ] });
971
975
  }
972
- function Na({
976
+ function Ea({
973
977
  value: t,
974
978
  onChange: a
975
979
  }) {
@@ -1006,12 +1010,12 @@ function Na({
1006
1010
  ) })
1007
1011
  ] });
1008
1012
  }
1009
- function wa({
1013
+ function ka({
1010
1014
  item: t,
1011
1015
  pathPrefix: a
1012
1016
  }) {
1013
1017
  const { setPath: s } = b(), { infos: l } = te(t), { user: c } = X(), n = `${a}.value`;
1014
- if (t == null || B.includes(
1018
+ if (t == null || K.includes(
1015
1019
  t.matcher
1016
1020
  ))
1017
1021
  return null;
@@ -1087,13 +1091,13 @@ function wa({
1087
1091
  }
1088
1092
  switch (u) {
1089
1093
  case "date": {
1090
- const i = F(
1094
+ const i = L(
1091
1095
  typeof r.value == "string" ? r.value : ""
1092
1096
  );
1093
1097
  return /* @__PURE__ */ e.jsx(
1094
- ra,
1098
+ la,
1095
1099
  {
1096
- value: k(i) ? i : void 0,
1100
+ value: E(i) ? i : void 0,
1097
1101
  showTimeSelect: !0,
1098
1102
  placeholder: "Enter value",
1099
1103
  onChange: (d) => {
@@ -1105,11 +1109,11 @@ function wa({
1105
1109
  }
1106
1110
  case "dateRange": {
1107
1111
  const i = Array.isArray(r.value) ? r.value.map((d) => {
1108
- const m = F(typeof d == "string" ? d : "");
1109
- return k(m) ? m : null;
1112
+ const m = L(typeof d == "string" ? d : "");
1113
+ return E(m) ? m : null;
1110
1114
  }) : [null, null];
1111
1115
  return /* @__PURE__ */ e.jsx(
1112
- na,
1116
+ ra,
1113
1117
  {
1114
1118
  value: i,
1115
1119
  showTimeSelect: !0,
@@ -1124,7 +1128,7 @@ function wa({
1124
1128
  }
1125
1129
  case "numberRange":
1126
1130
  return /* @__PURE__ */ e.jsx(
1127
- Ta,
1131
+ Ca,
1128
1132
  {
1129
1133
  value: r.value,
1130
1134
  onChange: (i) => {
@@ -1134,7 +1138,7 @@ function wa({
1134
1138
  );
1135
1139
  case "textRange":
1136
1140
  return /* @__PURE__ */ e.jsx(
1137
- Na,
1141
+ Ea,
1138
1142
  {
1139
1143
  value: r.value,
1140
1144
  onChange: (i) => {
@@ -1144,7 +1148,7 @@ function wa({
1144
1148
  );
1145
1149
  case "arrayMatch":
1146
1150
  return /* @__PURE__ */ e.jsx(
1147
- ja,
1151
+ wa,
1148
1152
  {
1149
1153
  value: r.value,
1150
1154
  pathPrefix: `${a}.value`
@@ -1228,7 +1232,7 @@ function wa({
1228
1232
  return R();
1229
1233
  }
1230
1234
  }
1231
- function $a({
1235
+ function Sa({
1232
1236
  item: t,
1233
1237
  nestingLevel: a,
1234
1238
  pathPrefix: s,
@@ -1269,12 +1273,12 @@ function $a({
1269
1273
  name: `${s}.field`
1270
1274
  }
1271
1275
  ) }),
1272
- /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(va, { item: t, pathPrefix: s }) })
1276
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(Na, { item: t, pathPrefix: s }) })
1273
1277
  ] }),
1274
- /* @__PURE__ */ e.jsx(wa, { item: t, pathPrefix: s })
1278
+ /* @__PURE__ */ e.jsx(ka, { item: t, pathPrefix: s })
1275
1279
  ] }) }),
1276
1280
  n.length > 0 && /* @__PURE__ */ e.jsx(
1277
- A,
1281
+ I,
1278
1282
  {
1279
1283
  className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
1280
1284
  dropdownLabel: /* @__PURE__ */ e.jsx(
@@ -1311,7 +1315,7 @@ function se({
1311
1315
  return /* @__PURE__ */ e.jsxs(
1312
1316
  "div",
1313
1317
  {
1314
- className: I("query-group", {
1318
+ className: A("query-group", {
1315
1319
  "p-4 border border-gray-200 rounded-md": i
1316
1320
  }),
1317
1321
  children: [
@@ -1347,7 +1351,7 @@ function se({
1347
1351
  {
1348
1352
  className: "flex items-center mb-4 last:mb-0 relative",
1349
1353
  children: [
1350
- /* @__PURE__ */ e.jsx(Ca, { rounded: h }),
1354
+ /* @__PURE__ */ e.jsx(Va, { rounded: h }),
1351
1355
  /* @__PURE__ */ e.jsx("div", { className: "ml-4 w-full", children: /* @__PURE__ */ e.jsx(
1352
1356
  se,
1353
1357
  {
@@ -1357,11 +1361,11 @@ function se({
1357
1361
  children: /* @__PURE__ */ e.jsx(
1358
1362
  "div",
1359
1363
  {
1360
- className: I({
1364
+ className: A({
1361
1365
  "mb-4": d?.nested != null
1362
1366
  }),
1363
1367
  children: /* @__PURE__ */ e.jsx(
1364
- $a,
1368
+ Sa,
1365
1369
  {
1366
1370
  item: d,
1367
1371
  nestingLevel: s,
@@ -1385,7 +1389,7 @@ function se({
1385
1389
  }
1386
1390
  );
1387
1391
  }
1388
- function Ca({
1392
+ function Va({
1389
1393
  rounded: t = !1
1390
1394
  }) {
1391
1395
  return t ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
@@ -1393,7 +1397,7 @@ function Ca({
1393
1397
  /* @__PURE__ */ e.jsx("div", { className: "absolute -left-px 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" })
1394
1398
  ] }) : /* @__PURE__ */ e.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
1395
1399
  }
1396
- function ka() {
1400
+ function Ra() {
1397
1401
  const {
1398
1402
  setPath: t,
1399
1403
  state: { value: a, selectedRuleIndex: s }
@@ -1435,33 +1439,33 @@ function ka() {
1435
1439
  }
1436
1440
  const W = {
1437
1441
  rules: []
1438
- }, E = (t) => {
1442
+ }, k = (t) => {
1439
1443
  try {
1440
1444
  return JSON.parse(t ?? JSON.stringify(W));
1441
1445
  } catch {
1442
1446
  return W;
1443
1447
  }
1444
- }, Ea = (t) => {
1448
+ }, Aa = (t) => {
1445
1449
  try {
1446
1450
  return JSON.parse(t ?? "{}"), !0;
1447
1451
  } catch {
1448
1452
  return !1;
1449
1453
  }
1450
1454
  };
1451
- function qa(t) {
1455
+ function Pa(t) {
1452
1456
  const {
1453
1457
  settings: { domain: a }
1454
1458
  } = X(), [s, l] = f([]), [c, n] = f(
1455
- E(t.value ?? t.defaultValue)
1459
+ k(t.value ?? t.defaultValue)
1456
1460
  );
1457
1461
  return T(
1458
1462
  function() {
1459
- c.rules?.length === 0 && n(E(t.value));
1463
+ c.rules?.length === 0 && n(k(t.value));
1460
1464
  },
1461
1465
  [t.value]
1462
1466
  ), T(
1463
1467
  function() {
1464
- la(t.schemaType, a).then((o) => {
1468
+ ia(t.schemaType, a).then((o) => {
1465
1469
  const i = y.object({
1466
1470
  properties: y.object({
1467
1471
  rules: y.object({
@@ -1492,18 +1496,18 @@ function qa(t) {
1492
1496
  },
1493
1497
  [a]
1494
1498
  ), /* @__PURE__ */ e.jsx(
1495
- fa,
1499
+ ba,
1496
1500
  {
1497
1501
  initialValue: {
1498
1502
  value: { rules: c.rules },
1499
1503
  availableActionTypes: s,
1500
1504
  schemaType: t.schemaType
1501
1505
  },
1502
- children: /* @__PURE__ */ e.jsx(Sa, { ...t })
1506
+ children: /* @__PURE__ */ e.jsx(Ia, { ...t })
1503
1507
  }
1504
1508
  );
1505
1509
  }
1506
- function Sa(t) {
1510
+ function Ia(t) {
1507
1511
  const {
1508
1512
  state: { value: a, selectedRuleIndex: s },
1509
1513
  setSelectedRuleIndex: l,
@@ -1514,19 +1518,19 @@ function Sa(t) {
1514
1518
  ), u = a.rules?.[s], i = G(null), [d, m] = f(0);
1515
1519
  T(
1516
1520
  function() {
1517
- V(E(i.current?.getValue()), a) || i.current?.setValue(JSON.stringify(a, null, 2)), t.onChange?.(a);
1521
+ V(k(i.current?.getValue()), a) || i.current?.setValue(JSON.stringify(a, null, 2)), t.onChange?.(a);
1518
1522
  },
1519
1523
  [a]
1520
1524
  );
1521
1525
  const j = C(
1522
1526
  (h) => {
1523
- const p = E(h);
1524
- i.current?.hasTextFocus() && Ea(h) && !V(p, a) && (c(p), m((_) => _ + 1));
1527
+ const p = k(h);
1528
+ i.current?.hasTextFocus() && Aa(h) && !V(p, a) && (c(p), m((_) => _ + 1));
1525
1529
  },
1526
1530
  [a]
1527
1531
  );
1528
1532
  return /* @__PURE__ */ e.jsx(
1529
- ia,
1533
+ oa,
1530
1534
  {
1531
1535
  hint: t.hint,
1532
1536
  feedback: t.feedback,
@@ -1550,7 +1554,7 @@ function Sa(t) {
1550
1554
  "button",
1551
1555
  {
1552
1556
  type: "button",
1553
- className: I("font-bold mr-2", {
1557
+ className: A("font-bold mr-2", {
1554
1558
  "text-black": s === p
1555
1559
  }),
1556
1560
  onClick: () => {
@@ -1560,7 +1564,7 @@ function Sa(t) {
1560
1564
  }
1561
1565
  ),
1562
1566
  /* @__PURE__ */ e.jsx(
1563
- A,
1567
+ I,
1564
1568
  {
1565
1569
  menuPosition: p === 0 ? "bottom-left" : "bottom-right",
1566
1570
  dropdownLabel: /* @__PURE__ */ e.jsx(N, { variant: "circle", children: /* @__PURE__ */ e.jsx(x, { name: "dotsThreeVertical", size: 16 }) }),
@@ -1572,6 +1576,7 @@ function Sa(t) {
1572
1576
  const Z = a.rules?.length ?? 0;
1573
1577
  n(`rules.${Z}`, {
1574
1578
  ...h,
1579
+ id: void 0,
1575
1580
  name: `${h.name} (copy)`
1576
1581
  }), l(Z);
1577
1582
  },
@@ -1624,14 +1629,14 @@ function Sa(t) {
1624
1629
  }
1625
1630
  ) })
1626
1631
  ] }),
1627
- /* @__PURE__ */ e.jsx(Ra, { children: u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1632
+ /* @__PURE__ */ e.jsx(Da, { children: u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1628
1633
  /* @__PURE__ */ e.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
1629
- /* @__PURE__ */ e.jsx(ka, {}),
1634
+ /* @__PURE__ */ e.jsx(Ra, {}),
1630
1635
  /* @__PURE__ */ e.jsx(x, { name: "pencilSimple", size: 16, className: "shrink-0" })
1631
1636
  ] }),
1632
- /* @__PURE__ */ e.jsx(K, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ e.jsx(xa, { actions: u?.actions }) }),
1633
- /* @__PURE__ */ e.jsx(Va, { children: "when" }),
1634
- /* @__PURE__ */ e.jsxs(K, { title: "Conditions", icon: "treeView", children: [
1637
+ /* @__PURE__ */ e.jsx(B, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ e.jsx(Ta, { actions: u?.actions }) }),
1638
+ /* @__PURE__ */ e.jsx(Za, { children: "when" }),
1639
+ /* @__PURE__ */ e.jsxs(B, { title: "Conditions", icon: "treeView", children: [
1635
1640
  /* @__PURE__ */ e.jsx(
1636
1641
  se,
1637
1642
  {
@@ -1664,7 +1669,7 @@ function Sa(t) {
1664
1669
  d
1665
1670
  ),
1666
1671
  r && /* @__PURE__ */ e.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ e.jsx(
1667
- oa,
1672
+ ca,
1668
1673
  {
1669
1674
  ref: i,
1670
1675
  name: t.id ?? t.name,
@@ -1680,14 +1685,14 @@ function Sa(t) {
1680
1685
  }
1681
1686
  );
1682
1687
  }
1683
- function Va({ children: t }) {
1688
+ function Za({ children: t }) {
1684
1689
  return /* @__PURE__ */ e.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
1685
1690
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
1686
1691
  /* @__PURE__ */ e.jsx("span", { className: "font-bold my-1 bg-gray-200 px-3 relative uppercase rounded h-[25px] items-center flex text-sm", children: t }),
1687
1692
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
1688
1693
  ] });
1689
1694
  }
1690
- function K({
1695
+ function B({
1691
1696
  children: t,
1692
1697
  title: a,
1693
1698
  icon: s
@@ -1700,11 +1705,11 @@ function K({
1700
1705
  /* @__PURE__ */ e.jsx("div", { className: "p-6", children: t })
1701
1706
  ] });
1702
1707
  }
1703
- function Ra({
1708
+ function Da({
1704
1709
  children: t
1705
1710
  }) {
1706
1711
  return /* @__PURE__ */ e.jsx("div", { className: "h-full w-full bg-gray-50 p-8 bg-[radial-gradient(#d6d6d6_1px,transparent_1px)] bg-size-[16px_16px] overflow-auto", children: /* @__PURE__ */ e.jsx("div", { className: "max-w-[900px] mx-auto", children: t }) });
1707
1712
  }
1708
1713
  export {
1709
- qa as RuleEngine
1714
+ Pa as RuleEngine
1710
1715
  };