@feedmepos/mf-connect 0.1.0-beta.7 → 0.1.0-beta.70

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 (123) hide show
  1. package/dist/Analytic-DEQUEGlq.js +427 -0
  2. package/dist/{App-DalxIjTu.js → App-CcoU2SAx.js} +445 -420
  3. package/dist/AuditLogs-CiB6u06w.js +1886 -0
  4. package/dist/Bin-C2_1m5RT.js +166 -0
  5. package/dist/{Broadcast-uMAvsC--.js → Broadcast-TotIXDuJ.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-JxbENan8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CixQu3Pr.js} +6 -8
  7. package/dist/Card-Ce-_xMgS.js +896 -0
  8. package/dist/Collections-DKva6Doi.js +459 -0
  9. package/dist/{Credit-QlnatflM.js → Credit-BVUxIJ6C.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKEumoan.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BE07lc4M.js → EffectSheet.vue_vue_type_style_index_0_lang-ah4bz-qR.js} +49 -49
  14. package/dist/{Experience-Czy41ifp.js → Experience-DV3384o0.js} +32 -30
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  16. package/dist/Game-DY83ti52.js +278 -0
  17. package/dist/Index-DEIaZ-2H.js +259 -0
  18. package/dist/Marketing-C2RwIlrg.js +20071 -0
  19. package/dist/Member-D4fc-wzd.js +333 -0
  20. package/dist/MemberList-DSMI6t_D.js +1598 -0
  21. package/dist/MemberTransactions-wXUlbbRq.js +45 -0
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CtM73bcN.js → MessageInput.vue_vue_type_script_setup_true_lang-DYS0klKm.js} +135 -120
  23. package/dist/Mission-P_KLDEpg.js +296 -0
  24. package/dist/Overview-8vc0f1D7.js +1078 -0
  25. package/dist/{Point-By6ogYy_.js → Point-B4Y0Pq60.js} +55 -53
  26. package/dist/{Promotion-DKcBr-RI.js → Promotion-C1CbesgZ.js} +65 -57
  27. package/dist/Queue-BlPA7PNH.js +244 -0
  28. package/dist/Record-Cl1qXSSk.js +340 -0
  29. package/dist/Reward-jy6-W1Eh.js +442 -0
  30. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-d5JNNNHf.js +150 -0
  31. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DYul_Nu8.js +1640 -0
  32. package/dist/Segment-B36Nrvxs.js +568 -0
  33. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-jN0xUFNR.js +181 -0
  34. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLFTNooB.js +186 -0
  35. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-H_Sehhgf.js +147 -0
  36. package/dist/Setting-AgQf2X4W.js +1931 -0
  37. package/dist/Store-D3Mm0pan.js +1841 -0
  38. package/dist/StoreRewards-L0VLWz8l.js +423 -0
  39. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Zl_cXXSD.js +1028 -0
  40. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-nEdCD6la.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-b4mfueTj.js} +1 -1
  41. package/dist/{Tier-DvAs0-yx.js → Tier-DQq-375x.js} +327 -318
  42. package/dist/{Title-B_Trr39o.js → Title-OJxuBvaa.js} +224 -209
  43. package/dist/{Transaction-DCJw-b3H.js → Transaction-vgsYRfD7.js} +2 -2
  44. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cwi0mvC3.js +130 -0
  45. package/dist/Voucher-BFwLaoxe.js +354 -0
  46. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DNUBaNtJ.js +419 -0
  47. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXkhu8e9.js → ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js} +1 -1
  48. package/dist/app-BQFTJ_hE.js +33357 -0
  49. package/dist/app-D7C3Fxfi.js +7077 -0
  50. package/dist/app.js +1 -1
  51. package/dist/{business-BC4-i1cU.js → business-vzpvmTdG.js} +1 -1
  52. package/dist/{campaign--0_yMbMV.js → campaign-BkxTDfsK.js} +2 -2
  53. package/dist/campaign-UQ8kMVeC.js +1810 -0
  54. package/dist/campaign.enum-BdT-e9h9.js +20 -0
  55. package/dist/campaign.fn-lc4ZhFCU.js +758 -0
  56. package/dist/collectible.enum-C8kd17Tz.js +19 -0
  57. package/dist/{collection.fn-3TwPe7aF.js → collection.fn-BIw1Y_tv.js} +2 -2
  58. package/dist/dto-CwzAhB8x.js +214 -0
  59. package/dist/{effect-BeR0LK61.js → effect-CJcvLlKG.js} +33 -16
  60. package/dist/email-addresses-BCJTQPT0.js +705 -0
  61. package/dist/{export-xeLLhqvh.js → export-URRwle1z.js} +5 -5
  62. package/dist/{helper-B5iqfKh8.js → helper-DccnE6zn.js} +1 -1
  63. package/dist/index-BiIZ7X6d.js +29556 -0
  64. package/dist/{index-CyKZ-SsN.js → index-BsRJ4kVb.js} +1 -1
  65. package/dist/{index-CU_d8jjU.js → index-C3lpXz_P.js} +1 -1
  66. package/dist/{index-Ct_wR519.js → index-CFA3EqId.js} +24 -21
  67. package/dist/{index-DP-dGMJC.js → index-CPRN3irj.js} +2230 -871
  68. package/dist/index-CaxFS90M.js +56 -0
  69. package/dist/index-CsaQJMAR.js +66 -0
  70. package/dist/index-D4MX9e5q.js +115 -0
  71. package/dist/index-DrE9VkxR.js +32 -0
  72. package/dist/index-EOPRlB9V.js +54 -0
  73. package/dist/{index-CAn5heDe.js → index-FcxOGFKj.js} +48 -4
  74. package/dist/{index-Bh-uaaBG.js → index-OScGm4mF.js} +1506 -1480
  75. package/dist/{index-BOdtpNkP.js → index-ghSGvG-m.js} +266 -173
  76. package/dist/index-vh86FiIQ.js +10 -0
  77. package/dist/{index.esm2017-5jeDA5Zo.js → index.esm2017-CE1CQHrP.js} +121 -121
  78. package/dist/loading-B8zghYbj.js +71 -0
  79. package/dist/{membership-D0nqqWNZ.js → membership-DoJMF2T6.js} +54 -46
  80. package/dist/money-CTR0rXZw.js +15 -0
  81. package/dist/number-Bhgz9eFP.js +12 -0
  82. package/dist/objectid-DdVJrRBw.js +145 -0
  83. package/dist/{loading-C-JDVajU.js → plugins-B5mQ7CHT.js} +3871 -3943
  84. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  85. package/dist/reward-DicsEEHe.js +36 -0
  86. package/dist/{rule-builder-BXt29Es4.js → rule-builder-BWb4JTrd.js} +1 -1
  87. package/dist/{rule-Dn_GgBCe.js → rule-s8siRar1.js} +185 -178
  88. package/dist/style.css +1 -1
  89. package/dist/{template-D2Oi3dxP.js → template-Qb5ozfLa.js} +5 -5
  90. package/dist/trigger-Bsb3Kj35.js +144 -0
  91. package/dist/user-DJ8aHRaM.js +54 -0
  92. package/dist/{vue-i18n-Dud8fvmw.js → vue-i18n-BG2U7GtN.js} +282 -282
  93. package/dist/{xlsx-CCRCidY2.js → xlsx-2QxyDFwt.js} +1 -1
  94. package/package.json +11 -7
  95. package/dist/Analytic-BMpS6jWb.js +0 -622
  96. package/dist/Card-DV8-g69L.js +0 -825
  97. package/dist/Collections-DRafEHT1.js +0 -453
  98. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TDoMehSB.js +0 -2813
  99. package/dist/Game-CD3zSitz.js +0 -255
  100. package/dist/Marketing-NNes8z6Q.js +0 -316
  101. package/dist/Member-CTqBgYuV.js +0 -69
  102. package/dist/MemberList-B99tS5ce.js +0 -1733
  103. package/dist/MemberTransactions-D1YCXPOg.js +0 -38
  104. package/dist/Mission-XbBVKBiE.js +0 -261
  105. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D1ESqEFO.js +0 -1753
  106. package/dist/Segment-B8cszL-F.js +0 -437
  107. package/dist/Setting-aZYABlMW.js +0 -1901
  108. package/dist/Store-Bx2tyJwe.js +0 -1511
  109. package/dist/StoreRewards-DTp9G6gw.js +0 -401
  110. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B2W7ly5Z.js +0 -890
  111. package/dist/Voucher-jqv3ji90.js +0 -490
  112. package/dist/app-WlcUVbFb.js +0 -5764
  113. package/dist/app-_w0hjM7u.js +0 -53428
  114. package/dist/dto-Ns2dLn1B.js +0 -2770
  115. package/dist/index-BWb9vRCi.js +0 -29193
  116. package/dist/index-CpU9aqyW.js +0 -206
  117. package/dist/index-CqO_ZvtD.js +0 -99
  118. package/dist/index-CuvNtC_M.js +0 -61
  119. package/dist/index-DsNsA2uX.js +0 -298
  120. package/dist/index-WAMr3npT.js +0 -762
  121. package/dist/money-hdbrblud.js +0 -15
  122. package/dist/number-CRWGOZaW.js +0 -12
  123. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,1640 @@
1
+ import { defineComponent as B, computed as I, resolveComponent as k, openBlock as r, createElementBlock as V, createElementVNode as R, createVNode as v, unref as e, createTextVNode as te, toDisplayString as j, withCtx as h, onMounted as z, createBlock as g, createCommentVNode as N, ref as P, Fragment as M, renderList as A, normalizeClass as H, watch as ie, resolveDynamicComponent as ae, onBeforeMount as ue, isRef as de, createSlots as pe } from "vue";
2
+ import { a as ye, C as ce, b as ve, c as be, d as fe } from "./index-OScGm4mF.js";
3
+ import { R as D, a as ge } from "./rule-builder-BWb4JTrd.js";
4
+ import { a as ke, R as S, S as Ee, C as L, W as Ve, T as ne, O as re } from "./rule-s8siRar1.js";
5
+ import { p as Te } from "./plugins-B5mQ7CHT.js";
6
+ import { useDialog as le, useDialogChild as se } from "@feedmepos/ui-library";
7
+ import { h as J } from "./moment-BWErdI6_.js";
8
+ import { z as Fe } from "./app-D7C3Fxfi.js";
9
+ import { u as Q } from "./membership-DoJMF2T6.js";
10
+ import { u as X } from "./business-vzpvmTdG.js";
11
+ import { _ as Y } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
12
+ import { c as me } from "./object-qECH92oz.js";
13
+ import { Z } from "./zod-Bg2FbC-D.js";
14
+ import { _ as Se } from "./SelectItems.vue_vue_type_script_setup_true_lang-jN0xUFNR.js";
15
+ import "./index-ghSGvG-m.js";
16
+ import "./index-CPRN3irj.js";
17
+ import "./index-C3lpXz_P.js";
18
+ import "./index-EOPRlB9V.js";
19
+ const Ue = { class: "flex items-center justify-between" }, Ce = { class: "flex items-center gap-8 xs:flex-wrap" }, xe = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, Re = /* @__PURE__ */ B({
20
+ __name: "RuleEntry",
21
+ props: {
22
+ modelValue: {
23
+ type: Object,
24
+ required: !0
25
+ }
26
+ },
27
+ emits: ["edit", "remove"],
28
+ setup(o, { emit: x }) {
29
+ const y = o, s = I(() => {
30
+ const [u, i] = Object.entries(y.modelValue.conditions)[0];
31
+ return {
32
+ negated: y.modelValue.negated == !0,
33
+ property: y.modelValue.property,
34
+ operator: u,
35
+ equator: i
36
+ };
37
+ }), l = x, c = I(
38
+ () => ke(
39
+ s.value.property,
40
+ s.value.operator,
41
+ s.value.equator,
42
+ s.value.negated
43
+ )
44
+ );
45
+ async function t(u) {
46
+ u.stopPropagation(), await Te.remove("Are you sure you want to remove this rule?") && l("remove", y.modelValue);
47
+ }
48
+ return (u, i) => {
49
+ var f;
50
+ const p = k("FmChip"), d = k("FmTooltip"), b = k("FmIcon");
51
+ return r(), V("div", Ue, [
52
+ R("div", Ce, [
53
+ v(p, {
54
+ label: (f = e(ye).find((E) => E.property === y.modelValue.property)) == null ? void 0 : f.name,
55
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
56
+ }, null, 8, ["label"]),
57
+ i[1] || (i[1] = R("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
58
+ R("div", {
59
+ onClick: i[0] || (i[0] = (E) => l("edit", y.modelValue)),
60
+ class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 text-fm-color-typo-primary !bg-transparent border-dashed border-2 fm-typo-en-body-md-600 cursor-pointer"
61
+ }, [
62
+ te(j(e(c)[0]) + " ", 1),
63
+ v(d, {
64
+ "z-index": 1e3,
65
+ content: e(c)[1]
66
+ }, {
67
+ default: h(() => [
68
+ R("div", xe, j(e(c)[1]), 1)
69
+ ]),
70
+ _: 1
71
+ }, 8, ["content"])
72
+ ])
73
+ ]),
74
+ v(b, {
75
+ name: "close",
76
+ size: "md",
77
+ class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
78
+ onClick: t
79
+ })
80
+ ]);
81
+ };
82
+ }
83
+ });
84
+ Fe.enum([
85
+ "MIN_SPEND",
86
+ "SPECIFIC_DATE",
87
+ "SPECIFIC_TIMERANGE",
88
+ "WEEKLY",
89
+ "MONTHLY",
90
+ "BIRTHDAY",
91
+ "TIER",
92
+ "TITLE",
93
+ "CUSTOM"
94
+ ]);
95
+ const Ye = [
96
+ {
97
+ type: "MIN_SPEND",
98
+ name: "Minimum spend",
99
+ for: ["bill"],
100
+ rules: []
101
+ },
102
+ {
103
+ type: "SPECIFIC_DATE",
104
+ name: "Specific date",
105
+ for: ["trigger"],
106
+ rules: []
107
+ },
108
+ {
109
+ type: "SPECIFIC_TIMERANGE",
110
+ name: "Specific time range",
111
+ for: ["trigger"],
112
+ rules: []
113
+ },
114
+ {
115
+ type: "WEEKLY",
116
+ name: "Weekly",
117
+ for: ["trigger"],
118
+ rules: [
119
+ {
120
+ property: "trigger.date",
121
+ operator: "_rrule",
122
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ type: "MONTHLY",
128
+ name: "Monthly",
129
+ for: ["trigger"],
130
+ rules: [
131
+ {
132
+ property: "trigger.date",
133
+ operator: "_rrule",
134
+ equator: "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
135
+ }
136
+ ]
137
+ },
138
+ {
139
+ type: "BIRTHDAY",
140
+ name: "Birthday",
141
+ for: ["user"],
142
+ rules: [
143
+ {
144
+ property: "user.birthday",
145
+ operator: "_isDay",
146
+ equator: {
147
+ op: "this",
148
+ unit: "day",
149
+ ignoreYear: !0
150
+ }
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ type: "TIER",
156
+ name: "Specific tier",
157
+ for: ["user"],
158
+ rules: [
159
+ {
160
+ property: "user.tier",
161
+ operator: "_equal",
162
+ equator: 1
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ type: "TITLE",
168
+ name: "Specific title",
169
+ for: ["user"],
170
+ rules: [
171
+ {
172
+ property: "user.titles",
173
+ operator: "_hasAny",
174
+ equator: []
175
+ }
176
+ ]
177
+ },
178
+ {
179
+ type: "CUSTOM",
180
+ name: "Weekday special",
181
+ for: ["trigger"],
182
+ rules: [
183
+ {
184
+ property: "trigger.date",
185
+ operator: "_rrule",
186
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ type: "CUSTOM",
192
+ name: "Weekend special",
193
+ for: ["trigger"],
194
+ rules: [
195
+ {
196
+ property: "trigger.date",
197
+ operator: "_rrule",
198
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ type: "CUSTOM",
204
+ name: "Happy hour",
205
+ for: ["trigger"],
206
+ rules: [
207
+ {
208
+ property: "trigger.time",
209
+ operator: "_isBetweenTime",
210
+ equator: [
211
+ {
212
+ start: "21:00",
213
+ end: "23:59"
214
+ }
215
+ ]
216
+ }
217
+ ]
218
+ },
219
+ {
220
+ type: "CUSTOM",
221
+ name: "Mother's day special",
222
+ for: ["trigger"],
223
+ rules: [
224
+ {
225
+ property: "trigger.date",
226
+ operator: "_rrule",
227
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
228
+ }
229
+ ]
230
+ },
231
+ {
232
+ type: "CUSTOM",
233
+ name: "Father's day special",
234
+ for: ["trigger"],
235
+ rules: [
236
+ {
237
+ property: "trigger.date",
238
+ operator: "_rrule",
239
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
240
+ }
241
+ ]
242
+ },
243
+ {
244
+ type: "CUSTOM",
245
+ name: "Christmas",
246
+ for: ["trigger"],
247
+ rules: [
248
+ {
249
+ property: "trigger.date",
250
+ operator: "_rrule",
251
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ type: "CUSTOM",
257
+ name: "Feedback rating",
258
+ for: ["feedback"],
259
+ rules: [
260
+ {
261
+ property: "feedback.rating",
262
+ operator: "_lessThanOrEqual",
263
+ equator: 5
264
+ }
265
+ ]
266
+ },
267
+ {
268
+ type: "CUSTOM",
269
+ name: "Custom",
270
+ for: ["trigger", "user", "bill", "feedback"],
271
+ rules: [
272
+ {
273
+ property: "trigger.date",
274
+ operator: "_isOnDate",
275
+ equator: J().format("YYYY-MM-DD")
276
+ }
277
+ ]
278
+ }
279
+ ], Oe = { class: "flex flex-nowrap gap-x-4 items-center" }, De = /* @__PURE__ */ B({
280
+ __name: "IsDayInput",
281
+ props: {
282
+ modelValue: {
283
+ type: Object
284
+ }
285
+ },
286
+ emits: ["update:model-value"],
287
+ setup(o, { emit: x }) {
288
+ const y = o, s = x;
289
+ z(() => {
290
+ y.modelValue || s("update:model-value", {
291
+ op: "before",
292
+ x: 1
293
+ });
294
+ });
295
+ function l(c) {
296
+ const t = me(
297
+ y.modelValue ?? {
298
+ op: "before",
299
+ x: 1
300
+ }
301
+ );
302
+ s("update:model-value", {
303
+ ...t,
304
+ ...c
305
+ });
306
+ }
307
+ return (c, t) => {
308
+ var i, p, d;
309
+ const u = k("FmStepperField");
310
+ return r(), V("div", Oe, [
311
+ v(u, {
312
+ class: "w-1/3",
313
+ "model-value": ((i = o.modelValue) == null ? void 0 : i.x) ?? null,
314
+ max: 365,
315
+ "show-steppers": !1,
316
+ "append-text": "days",
317
+ "onUpdate:modelValue": t[0] || (t[0] = (b) => l({ x: b }))
318
+ }, null, 8, ["model-value"]),
319
+ v(Y, {
320
+ "model-value": ((p = o.modelValue) == null ? void 0 : p.op) ?? void 0,
321
+ items: [
322
+ { label: "before", value: "before" },
323
+ { label: "after", value: "after" }
324
+ ],
325
+ "onUpdate:modelValue": t[1] || (t[1] = (b) => l({ op: b }))
326
+ }, null, 8, ["model-value"]),
327
+ v(Y, {
328
+ "model-value": ((d = o.modelValue) == null ? void 0 : d.ignoreYear) ?? !1,
329
+ items: [
330
+ { label: "same year", value: !1 },
331
+ { label: "ignore year", value: !0 }
332
+ ],
333
+ required: !0,
334
+ "onUpdate:modelValue": t[2] || (t[2] = (b) => l({ ignoreYear: b == !0 }))
335
+ }, null, 8, ["model-value"])
336
+ ]);
337
+ };
338
+ }
339
+ }), we = { class: "grid grid-cols-4 gap-x-4 items-center" }, Me = /* @__PURE__ */ B({
340
+ __name: "IsRangeInput",
341
+ props: {
342
+ modelValue: {
343
+ type: Object,
344
+ default: () => ({
345
+ op: "this",
346
+ unit: "day",
347
+ ignoreYear: !0
348
+ })
349
+ }
350
+ },
351
+ emits: ["update:model-value"],
352
+ setup(o, { emit: x }) {
353
+ const y = o, s = x;
354
+ z(() => {
355
+ y.modelValue || s("update:model-value", {
356
+ op: "this",
357
+ unit: "day",
358
+ ignoreYear: !0
359
+ });
360
+ });
361
+ const l = [
362
+ { label: "day", value: "day" },
363
+ { label: "week", value: "week" },
364
+ { label: "month", value: "month" },
365
+ { label: "quarter", value: "quarter" },
366
+ { label: "year", value: "year" }
367
+ ], c = [
368
+ {
369
+ label: "this",
370
+ value: "this"
371
+ },
372
+ {
373
+ label: "last",
374
+ value: "last"
375
+ },
376
+ {
377
+ label: "next",
378
+ value: "next"
379
+ }
380
+ ];
381
+ return (t, u) => {
382
+ var p, d, b, f, E;
383
+ const i = k("FmStepperField");
384
+ return r(), V("div", we, [
385
+ v(Y, {
386
+ "model-value": (p = o.modelValue) == null ? void 0 : p.op,
387
+ label: "",
388
+ items: c,
389
+ required: !0,
390
+ "onUpdate:modelValue": u[0] || (u[0] = (m) => s("update:model-value", { op: m, unit: "day", ignoreYear: !1 }))
391
+ }, null, 8, ["model-value"]),
392
+ ((d = o.modelValue) == null ? void 0 : d.op) != "this" ? (r(), g(i, {
393
+ key: 0,
394
+ "model-value": ((b = o.modelValue) == null ? void 0 : b.x) || 0,
395
+ max: 365,
396
+ "show-steppers": !1,
397
+ "onUpdate:modelValue": u[1] || (u[1] = (m) => s("update:model-value", {
398
+ op: o.modelValue.op,
399
+ unit: o.modelValue.unit,
400
+ ignoreYear: o.modelValue.ignoreYear == !0,
401
+ x: m
402
+ }))
403
+ }, null, 8, ["model-value"])) : N("", !0),
404
+ v(Y, {
405
+ "model-value": (f = o.modelValue) == null ? void 0 : f.unit,
406
+ label: "",
407
+ items: l,
408
+ required: !0,
409
+ "onUpdate:modelValue": u[2] || (u[2] = (m) => s("update:model-value", { ...y.modelValue, unit: m }))
410
+ }, null, 8, ["model-value"]),
411
+ v(Y, {
412
+ label: "",
413
+ "model-value": (E = o.modelValue) == null ? void 0 : E.ignoreYear,
414
+ items: [
415
+ { label: "same", value: !1 },
416
+ { label: "ignore", value: !0 }
417
+ ],
418
+ required: !0,
419
+ "onUpdate:modelValue": u[3] || (u[3] = (m) => s("update:model-value", {
420
+ ...y.modelValue,
421
+ ignoreYear: m == !0
422
+ }))
423
+ }, null, 8, ["model-value"])
424
+ ]);
425
+ };
426
+ }
427
+ }), he = { class: "space-y-8" }, qe = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Ie = {
428
+ key: 0,
429
+ class: "flex items-center gap-8"
430
+ }, Be = { class: "flex gap-4" }, Ne = {
431
+ key: 0,
432
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
433
+ }, Ae = ["onClick"], $e = {
434
+ key: 1,
435
+ class: "flex items-center gap-8"
436
+ }, Pe = { class: "flex gap-4 xs:gap-[2px]" }, Le = { class: "grid grid-cols-6 gap-8" }, He = {
437
+ key: 0,
438
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
439
+ }, We = ["onClick"], je = {
440
+ key: 1,
441
+ class: "grid grid-cols-2 items-center gap-8"
442
+ }, Ke = { class: "flex gap-4" }, Ge = {
443
+ key: 4,
444
+ class: "flex items-center justify-end gap-8"
445
+ }, ee = /* @__PURE__ */ B({
446
+ __name: "RruleInput",
447
+ props: {
448
+ modelValue: {
449
+ type: String
450
+ },
451
+ startDate: {
452
+ type: Object
453
+ },
454
+ applyButton: {
455
+ type: Boolean
456
+ },
457
+ fixedFrequency: {
458
+ type: Boolean
459
+ }
460
+ },
461
+ emits: ["update:model-value", "cancel"],
462
+ setup(o, { emit: x }) {
463
+ const y = o, s = x, l = P(
464
+ y.modelValue ? S.fromString(y.modelValue) : new S({
465
+ dtstart: y.startDate,
466
+ freq: S.DAILY,
467
+ wkst: S.SU,
468
+ interval: 1,
469
+ byhour: 0,
470
+ byminute: 0,
471
+ bysecond: 0
472
+ })
473
+ );
474
+ function c(t) {
475
+ var u;
476
+ if ("freq" in t)
477
+ switch (t.freq) {
478
+ case S.WEEKLY:
479
+ l.value = new S({
480
+ dtstart: y.startDate,
481
+ freq: t.freq,
482
+ interval: 1,
483
+ byhour: 0,
484
+ byminute: 0,
485
+ bysecond: 0,
486
+ wkst: S.SU,
487
+ byweekday: [S.MO]
488
+ });
489
+ break;
490
+ case S.MONTHLY:
491
+ l.value = new S({
492
+ dtstart: y.startDate,
493
+ freq: t.freq,
494
+ interval: 1,
495
+ byhour: 0,
496
+ byminute: 0,
497
+ bysecond: 0,
498
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
499
+ wkst: S.SU
500
+ });
501
+ break;
502
+ case S.YEARLY:
503
+ l.value = new S({
504
+ dtstart: y.startDate,
505
+ freq: t.freq,
506
+ interval: 1,
507
+ byhour: 0,
508
+ byminute: 0,
509
+ bysecond: 0,
510
+ wkst: S.SU,
511
+ bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
512
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
513
+ });
514
+ break;
515
+ default:
516
+ l.value = new S({
517
+ dtstart: y.startDate,
518
+ freq: t.freq,
519
+ interval: 1,
520
+ byhour: 0,
521
+ byminute: 0,
522
+ bysecond: 0,
523
+ wkst: S.SU
524
+ });
525
+ }
526
+ t.interval && t.interval > 0 && (l.value = new S({
527
+ ...l.value.origOptions,
528
+ dtstart: y.startDate,
529
+ interval: t.interval
530
+ })), "byweekday" in t && t.byweekday && Array.isArray(t.byweekday) && t.byweekday.length > 0 && (l.value.options.bymonthday.length > 0 && l.value.options.freq == S.MONTHLY && (l.value.options.bymonthday = []), l.value = new S({
531
+ ...l.value.origOptions,
532
+ dtstart: y.startDate,
533
+ bymonthday: [],
534
+ byweekday: t.byweekday
535
+ })), "bysetpos" in t && t.bysetpos != null && (l.value = new S({
536
+ ...l.value.origOptions,
537
+ dtstart: y.startDate,
538
+ bymonthday: [],
539
+ bysetpos: t.bysetpos,
540
+ byweekday: ((u = l.value.options.byweekday) == null ? void 0 : u.length) > 0 ? l.value.options.byweekday : [6]
541
+ })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (l.value = new S({
542
+ ...l.value.origOptions,
543
+ dtstart: y.startDate,
544
+ bysetpos: [],
545
+ byweekday: [],
546
+ bymonthday: t.bymonthday
547
+ })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (l.value = new S({
548
+ ...l.value.origOptions,
549
+ dtstart: y.startDate,
550
+ bysetpos: [],
551
+ bymonth: t.bymonth
552
+ })), "bynweekday" in t && t.bynweekday && (l.value = new S({
553
+ ...l.value.origOptions,
554
+ dtstart: y.startDate,
555
+ bysetpos: [],
556
+ byweekday: new Ve(
557
+ t.bynweekday[0][0],
558
+ t.bynweekday[0][1]
559
+ )
560
+ })), y.applyButton || s("update:model-value", l.value.toString());
561
+ }
562
+ return z(() => {
563
+ y.modelValue || s(
564
+ "update:model-value",
565
+ new S({
566
+ dtstart: y.startDate,
567
+ freq: S.DAILY,
568
+ wkst: S.SU,
569
+ interval: 1,
570
+ byhour: 0,
571
+ byminute: 0,
572
+ bysecond: 0
573
+ }).toString()
574
+ );
575
+ }), (t, u) => {
576
+ var f, E, m;
577
+ const i = k("FmStepperField"), p = k("FmChip"), d = k("FmButtonGroup"), b = k("FmButton");
578
+ return r(), V("div", he, [
579
+ R("div", qe, j(e(Ee)(e(l).options)), 1),
580
+ o.fixedFrequency ? N("", !0) : (r(), V("div", Ie, [
581
+ u[8] || (u[8] = R("div", null, "Repeat every", -1)),
582
+ v(i, {
583
+ class: "w-[100px]",
584
+ "model-value": e(l).options.interval,
585
+ "onUpdate:modelValue": u[0] || (u[0] = (a) => c({ interval: a > 0 ? a : e(l).options.interval })),
586
+ min: 1
587
+ }, null, 8, ["model-value"]),
588
+ v(Y, {
589
+ class: "w-min",
590
+ items: e(L).frequencies,
591
+ "model-value": e(l).origOptions.freq,
592
+ "onUpdate:modelValue": u[1] || (u[1] = (a) => c({ freq: a }))
593
+ }, null, 8, ["items", "model-value"])
594
+ ])),
595
+ e(l).options.freq === e(S).WEEKLY ? (r(), V(M, { key: 1 }, [
596
+ u[9] || (u[9] = R("div", null, "Repeat on", -1)),
597
+ R("div", Be, [
598
+ (r(!0), V(M, null, A(e(L).weekdays, (a) => {
599
+ var U;
600
+ return r(), g(p, {
601
+ class: H(["cursor-pointer", `${(U = e(l).options.byweekday) != null && U.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
602
+ label: a.label[0],
603
+ key: a.value,
604
+ compact: !0,
605
+ onClick: () => {
606
+ var C, w;
607
+ c({
608
+ byweekday: (C = e(l).options.byweekday) != null && C.includes(a.value) ? ((w = e(l).options.byweekday) == null ? void 0 : w.filter((F) => F !== a.value)) || [] : [...e(l).options.byweekday || [], a.value]
609
+ });
610
+ }
611
+ }, null, 8, ["class", "label", "onClick"]);
612
+ }), 128))
613
+ ])
614
+ ], 64)) : N("", !0),
615
+ e(l).options.freq == e(S).MONTHLY ? (r(), V(M, { key: 2 }, [
616
+ v(d, {
617
+ "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
618
+ items: [
619
+ {
620
+ label: "Each"
621
+ },
622
+ {
623
+ label: "On the"
624
+ }
625
+ ],
626
+ "onUpdate:modelValue": u[2] || (u[2] = (a) => {
627
+ a.label == "Each" ? c({ bymonthday: [1] }) : c({ bysetpos: 1 });
628
+ })
629
+ }, null, 8, ["model-value"]),
630
+ e(l).options.bymonthday.length > 0 ? (r(), V("div", Ne, [
631
+ (r(!0), V(M, null, A(e(L).dates, (a) => (r(), V("div", {
632
+ key: a.value,
633
+ class: H(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(a.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a.value == 31 ? "border-r" : ""}`]),
634
+ onClick: (U) => c({
635
+ bymonthday: e(l).options.bymonthday.includes(a.value) ? e(l).options.bymonthday.filter((C) => C !== a.value) : [...e(l).options.bymonthday, a.value]
636
+ })
637
+ }, j(a.value), 11, Ae))), 128))
638
+ ])) : (r(), V("div", $e, [
639
+ v(Y, {
640
+ items: e(L).ordinals,
641
+ "model-value": (f = e(l).options.bysetpos) == null ? void 0 : f[0],
642
+ "onUpdate:modelValue": u[3] || (u[3] = (a) => c({ bysetpos: a }))
643
+ }, null, 8, ["items", "model-value"]),
644
+ R("div", Pe, [
645
+ (r(!0), V(M, null, A(e(L).weekdays, (a) => {
646
+ var U;
647
+ return r(), g(p, {
648
+ class: H(["cursor-pointer", `${(U = e(l).options.byweekday) != null && U.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
649
+ label: a.label[0],
650
+ key: a.value,
651
+ compact: !0,
652
+ onClick: () => {
653
+ c({
654
+ byweekday: [a.value]
655
+ });
656
+ }
657
+ }, null, 8, ["class", "label", "onClick"]);
658
+ }), 128))
659
+ ])
660
+ ]))
661
+ ], 64)) : N("", !0),
662
+ e(l).options.freq == e(S).YEARLY ? (r(), V(M, { key: 3 }, [
663
+ u[10] || (u[10] = R("div", null, "Month", -1)),
664
+ R("div", Le, [
665
+ (r(!0), V(M, null, A(e(L).months, (a) => {
666
+ var U, C;
667
+ return r(), g(p, {
668
+ key: a.value,
669
+ class: H(["cursor-pointer", {
670
+ "bg-fm-color-primary text-white": (U = e(l).options.bymonth) == null ? void 0 : U.includes(
671
+ a.value
672
+ ),
673
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((C = e(l).options.bymonth) != null && C.includes(a.value))
674
+ }]),
675
+ label: a.shortName,
676
+ compact: !0,
677
+ onClick: (w) => c({
678
+ bymonth: (e(l).options.bymonth ?? []).includes(a.value) ? (e(l).options.bymonth ?? []).filter((F) => F !== a.value) : [...e(l).options.bymonth ?? [], a.value]
679
+ })
680
+ }, null, 8, ["class", "label", "onClick"]);
681
+ }), 128))
682
+ ]),
683
+ v(d, {
684
+ "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
685
+ items: [
686
+ {
687
+ label: "Each"
688
+ },
689
+ {
690
+ label: "On the"
691
+ }
692
+ ],
693
+ "onUpdate:modelValue": u[4] || (u[4] = (a) => {
694
+ a.label == "Each" ? c({
695
+ bymonthday: [1],
696
+ bymonth: e(l).options.bymonth ?? [1]
697
+ }) : c({
698
+ byweekday: [e(S).SU.nth(1)],
699
+ bymonth: e(l).options.bymonth ?? [1]
700
+ });
701
+ })
702
+ }, null, 8, ["model-value"]),
703
+ e(l).options.bymonthday.length > 0 ? (r(), V("div", He, [
704
+ (r(!0), V(M, null, A(Array(31).fill(null).map((a, U) => U + 1), (a) => (r(), V("div", {
705
+ key: a,
706
+ class: H(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(a) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a == 31 ? "border-r" : ""}`]),
707
+ onClick: (U) => c({
708
+ bymonthday: e(l).options.bymonthday.includes(a) ? e(l).options.bymonthday.filter((C) => C !== a) : [...e(l).options.bymonthday, a]
709
+ })
710
+ }, j(a), 11, We))), 128))
711
+ ])) : (r(), V("div", je, [
712
+ v(Y, {
713
+ items: e(L).ordinals,
714
+ "model-value": (m = (E = e(l).options.bynweekday) == null ? void 0 : E[0]) == null ? void 0 : m[1],
715
+ "onUpdate:modelValue": u[5] || (u[5] = (a) => {
716
+ var U, C;
717
+ return c({
718
+ bynweekday: [[((C = (U = e(l).options.bynweekday) == null ? void 0 : U[0]) == null ? void 0 : C[0]) ?? 1, a]]
719
+ });
720
+ })
721
+ }, null, 8, ["items", "model-value"]),
722
+ R("div", Ke, [
723
+ (r(!0), V(M, null, A(e(L).weekdays, (a) => {
724
+ var U, C;
725
+ return r(), g(p, {
726
+ class: H(["cursor-pointer", `${((C = (U = e(l).options.bynweekday) == null ? void 0 : U[0]) == null ? void 0 : C[0]) === a.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
727
+ label: a.label[0],
728
+ key: a.value,
729
+ compact: !0,
730
+ onClick: () => {
731
+ var w, F;
732
+ c({
733
+ bynweekday: [
734
+ [a.value, ((F = (w = e(l).options.bynweekday) == null ? void 0 : w[0]) == null ? void 0 : F[1]) ?? 1]
735
+ ]
736
+ });
737
+ }
738
+ }, null, 8, ["class", "label", "onClick"]);
739
+ }), 128))
740
+ ])
741
+ ]))
742
+ ], 64)) : N("", !0),
743
+ o.applyButton ? (r(), V("div", Ge, [
744
+ v(b, {
745
+ label: "Cancel",
746
+ variant: "tertiary",
747
+ onClick: u[6] || (u[6] = (a) => s("cancel"))
748
+ }),
749
+ v(b, {
750
+ label: "Apply",
751
+ onClick: u[7] || (u[7] = (a) => s("update:model-value", e(l).toString()))
752
+ })
753
+ ])) : N("", !0)
754
+ ]);
755
+ };
756
+ }
757
+ }), _e = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Qe = /* @__PURE__ */ B({
758
+ __name: "IsInMonthInput",
759
+ props: {
760
+ modelValue: {
761
+ type: Object,
762
+ required: !0
763
+ }
764
+ },
765
+ emits: ["update:model-value"],
766
+ setup(o, { emit: x }) {
767
+ const y = o, s = x, l = J.months().map((c, t) => ({
768
+ name: c,
769
+ shortName: J().month(t).format("MMM"),
770
+ value: t
771
+ }));
772
+ return z(() => {
773
+ y.modelValue || s("update:model-value", []);
774
+ }), (c, t) => {
775
+ const u = k("FmChip");
776
+ return r(), V("div", _e, [
777
+ (r(!0), V(M, null, A(e(l), (i) => {
778
+ var p, d;
779
+ return r(), g(u, {
780
+ class: H(["cursor-pointer", {
781
+ "bg-fm-color-primary text-white": (p = o.modelValue) == null ? void 0 : p.includes(i.value),
782
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((d = o.modelValue) != null && d.includes(
783
+ i.value
784
+ ))
785
+ }]),
786
+ label: i.name,
787
+ key: i.value,
788
+ compact: !0,
789
+ onClick: (b) => s(
790
+ "update:model-value",
791
+ o.modelValue.includes(i.value) ? o.modelValue.filter((f) => f !== i.value) : [...o.modelValue, i.value]
792
+ )
793
+ }, null, 8, ["class", "label", "onClick"]);
794
+ }), 128))
795
+ ]);
796
+ };
797
+ }
798
+ }), ze = { class: "" }, Ze = { class: "flex justify-end gap-8 w-full" }, Je = /* @__PURE__ */ B({
799
+ __name: "MenuDialog",
800
+ props: {
801
+ modelValue: { type: Boolean },
802
+ initialValue: {},
803
+ filterItems: { type: Function }
804
+ },
805
+ emits: ["update:model-value", "confirm"],
806
+ setup(o, { emit: x }) {
807
+ const y = o, s = P(), l = P(!1), c = x;
808
+ function t() {
809
+ var i;
810
+ (i = s.value) == null || i.onConfirm(), c("update:model-value", !1);
811
+ }
812
+ function u() {
813
+ c("update:model-value", !1);
814
+ }
815
+ return ie(
816
+ () => y.modelValue,
817
+ (i) => {
818
+ l.value = i;
819
+ }
820
+ ), z(() => {
821
+ l.value = y.modelValue;
822
+ }), (i, p) => {
823
+ const d = k("FmButton"), b = k("FmDialog");
824
+ return r(), g(b, {
825
+ "content-scrollable": !1,
826
+ contentClass: "pt-0",
827
+ modelValue: l.value,
828
+ "onUpdate:modelValue": p[0] || (p[0] = (f) => l.value = f),
829
+ title: "Select Items",
830
+ "close-button": !1
831
+ }, {
832
+ "dialog-header": h(() => p[1] || (p[1] = [
833
+ R("div", null, "Select Item", -1)
834
+ ])),
835
+ "dialog-footer": h(() => [
836
+ R("div", Ze, [
837
+ v(d, {
838
+ variant: "tertiary",
839
+ onClick: u,
840
+ label: "Cancel"
841
+ }),
842
+ v(d, {
843
+ variant: "primary",
844
+ onClick: t,
845
+ label: "Confirm"
846
+ })
847
+ ])
848
+ ]),
849
+ default: h(() => [
850
+ R("div", ze, [
851
+ v(Se, {
852
+ ref_key: "selectItemRef",
853
+ ref: s,
854
+ "initial-value": i.initialValue,
855
+ "filter-items": i.filterItems,
856
+ "on-complete": (f) => {
857
+ c("confirm", f), u();
858
+ }
859
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
860
+ ])
861
+ ]),
862
+ _: 1
863
+ }, 8, ["modelValue"]);
864
+ };
865
+ }
866
+ }), Xe = { id: "select-menu" }, et = /* @__PURE__ */ B({
867
+ __name: "SelectMenu",
868
+ props: {
869
+ modelValue: {}
870
+ },
871
+ emits: ["update:model-value"],
872
+ setup(o, { emit: x }) {
873
+ const y = o, s = P(!1), l = I(() => {
874
+ var u;
875
+ return ((u = y.modelValue) == null ? void 0 : u.length) || 0;
876
+ }), c = x;
877
+ function t(u) {
878
+ c("update:model-value", u);
879
+ }
880
+ return (u, i) => {
881
+ const p = k("FmField");
882
+ return r(), V("div", Xe, [
883
+ v(p, {
884
+ class: "text-fm-color-typo-tertiary",
885
+ onClick: i[0] || (i[0] = (d) => s.value = !0)
886
+ }, {
887
+ default: h(() => [
888
+ te(j(l.value) + " item(s) selected ", 1)
889
+ ]),
890
+ _: 1
891
+ }),
892
+ v(Je, {
893
+ modelValue: s.value,
894
+ "onUpdate:modelValue": [
895
+ i[1] || (i[1] = (d) => s.value = d),
896
+ i[2] || (i[2] = (d) => s.value = d)
897
+ ],
898
+ "initial-value": u.modelValue,
899
+ onConfirm: t
900
+ }, null, 8, ["modelValue", "initial-value"])
901
+ ]);
902
+ };
903
+ }
904
+ }), tt = {
905
+ key: 19,
906
+ class: "fm-typo-en-body-lg-600"
907
+ }, lt = /* @__PURE__ */ B({
908
+ __name: "RuleEquator",
909
+ props: {
910
+ type: {
911
+ type: String,
912
+ required: !0
913
+ },
914
+ operator: {
915
+ type: String,
916
+ required: !0
917
+ },
918
+ modelValue: {
919
+ type: Object
920
+ }
921
+ },
922
+ emits: ["update:model-value"],
923
+ setup(o, { emit: x }) {
924
+ const y = o, s = x, l = I(() => {
925
+ const c = ce[y.operator].safeParse(y.modelValue);
926
+ return c.success ? [] : c.error.errors;
927
+ });
928
+ return (c, t) => {
929
+ var m, a, U, C, w, F;
930
+ const u = k("FmTextField"), i = k("FmStepperField"), p = k("FmSimpleDatePicker"), d = k("FmSimpleDateRangePicker"), b = k("FmTimeRangePicker"), f = k("FmTimePicker"), E = k("FmHelperText");
931
+ return r(), V("div", {
932
+ class: H({ "pb-4": e(l).length })
933
+ }, [
934
+ o.type === "text" ? (r(), g(u, {
935
+ key: 0,
936
+ "model-value": o.modelValue,
937
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => s("update:model-value", n))
938
+ }, null, 8, ["model-value"])) : o.type === "number" ? (r(), g(i, {
939
+ key: 1,
940
+ "model-value": o.modelValue,
941
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => s("update:model-value", n))
942
+ }, null, 8, ["model-value"])) : o.operator == "_isDay" ? (r(), g(ae(De), {
943
+ key: 2,
944
+ "model-value": o.modelValue,
945
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => s("update:model-value", n))
946
+ }, null, 8, ["model-value"])) : o.operator == "_isRange" ? (r(), g(ae(Me), {
947
+ key: 3,
948
+ "model-value": o.modelValue,
949
+ "onUpdate:modelValue": t[3] || (t[3] = (n) => s("update:model-value", n))
950
+ }, null, 8, ["model-value"])) : o.operator == "_isOnDate" ? (r(), g(p, {
951
+ key: 4,
952
+ "model-value": o.modelValue,
953
+ "onUpdate:modelValue": t[4] || (t[4] = (n) => s("update:model-value", n))
954
+ }, null, 8, ["model-value"])) : o.operator == "_isBetween" ? (r(), g(d, {
955
+ key: 5,
956
+ "model-value": {
957
+ startDate: (m = o.modelValue) == null ? void 0 : m.start,
958
+ endDate: (a = o.modelValue) == null ? void 0 : a.end
959
+ },
960
+ "onUpdate:modelValue": t[5] || (t[5] = (n) => {
961
+ s("update:model-value", {
962
+ start: n.startDate,
963
+ end: n.endDate
964
+ });
965
+ })
966
+ }, null, 8, ["model-value"])) : o.operator == "_isInMonth" ? (r(), g(Qe, {
967
+ key: 6,
968
+ "model-value": o.modelValue,
969
+ "onUpdate:modelValue": t[6] || (t[6] = (n) => s("update:model-value", n))
970
+ }, null, 8, ["model-value"])) : o.operator == "_rrule" ? (r(), g(ee, {
971
+ key: 7,
972
+ "model-value": o.modelValue,
973
+ "onUpdate:modelValue": t[7] || (t[7] = (n) => s("update:model-value", n))
974
+ }, null, 8, ["model-value"])) : o.operator == "_isBetweenTime" ? (r(), g(b, {
975
+ key: 8,
976
+ "disable-time-check": !0,
977
+ "model-value": [(C = (U = o.modelValue) == null ? void 0 : U[0]) == null ? void 0 : C.start, (F = (w = o.modelValue) == null ? void 0 : w[0]) == null ? void 0 : F.end],
978
+ "onUpdate:modelValue": t[8] || (t[8] = (n) => s("update:model-value", [
979
+ {
980
+ start: n[0],
981
+ end: n[1]
982
+ }
983
+ ]))
984
+ }, null, 8, ["model-value"])) : o.operator == "_isOnTime" ? (r(), g(f, {
985
+ key: 9,
986
+ "model-value": o.modelValue,
987
+ "onUpdate:modelValue": t[9] || (t[9] = (n) => s("update:model-value", n))
988
+ }, null, 8, ["model-value"])) : o.type == "tier" ? (r(), g(Y, {
989
+ key: 10,
990
+ items: (e(Q)().sortedTiers ?? []).map((n, q) => ({
991
+ label: `Tier ${q + 1} - ${n.name}`,
992
+ value: q + 1
993
+ })),
994
+ "model-value": o.modelValue,
995
+ "onUpdate:modelValue": t[10] || (t[10] = (n) => s("update:model-value", n))
996
+ }, null, 8, ["items", "model-value"])) : o.type == "boolean" ? (r(), g(Y, {
997
+ key: 11,
998
+ multiselect: !0,
999
+ items: [
1000
+ { label: "true", value: !0 },
1001
+ { label: "false", value: !1 }
1002
+ ],
1003
+ "model-value": o.modelValue ?? [],
1004
+ "onUpdate:modelValue": t[11] || (t[11] = (n) => s("update:model-value", n))
1005
+ }, null, 8, ["model-value"])) : o.type == "exist" ? (r(), g(Y, {
1006
+ key: 12,
1007
+ items: [
1008
+ { label: "true", value: "true" },
1009
+ { label: "false", value: "false" }
1010
+ ],
1011
+ "model-value": o.modelValue ?? [],
1012
+ "onUpdate:modelValue": t[12] || (t[12] = (n) => s("update:model-value", n))
1013
+ }, null, 8, ["model-value"])) : o.type == "gender" ? (r(), g(Y, {
1014
+ key: 13,
1015
+ multiselect: !0,
1016
+ items: [
1017
+ { label: "Male", value: "MALE" },
1018
+ { label: "Female", value: "FEMALE" }
1019
+ ],
1020
+ "model-value": o.modelValue ?? [],
1021
+ "onUpdate:modelValue": t[13] || (t[13] = (n) => s("update:model-value", n))
1022
+ }, null, 8, ["model-value"])) : o.type == "collectible" ? (r(), g(Y, {
1023
+ key: 14,
1024
+ multiselect: !0,
1025
+ items: [],
1026
+ "model-value": o.modelValue ?? [],
1027
+ "onUpdate:modelValue": t[14] || (t[14] = (n) => s("update:model-value", n))
1028
+ }, null, 8, ["model-value"])) : o.type == "segment" ? (r(), g(Y, {
1029
+ key: 15,
1030
+ multiselect: !0,
1031
+ items: e(Q)().segmentOptions,
1032
+ "model-value": o.modelValue ?? [],
1033
+ "onUpdate:modelValue": t[15] || (t[15] = (n) => s("update:model-value", n)),
1034
+ label: "Select segment(s) to match"
1035
+ }, null, 8, ["items", "model-value"])) : o.type == "title" ? (r(), g(Y, {
1036
+ key: 16,
1037
+ multiselect: !0,
1038
+ items: (e(Q)().sortedTitles ?? []).map((n) => ({
1039
+ label: n.name,
1040
+ value: n._id
1041
+ })),
1042
+ "model-value": o.modelValue ?? [],
1043
+ "onUpdate:modelValue": t[16] || (t[16] = (n) => s("update:model-value", n))
1044
+ }, null, 8, ["items", "model-value"])) : o.type == "product" ? (r(), g(et, {
1045
+ key: 17,
1046
+ "model-value": o.modelValue,
1047
+ "onUpdate:modelValue": t[17] || (t[17] = (n) => s("update:model-value", n))
1048
+ }, null, 8, ["model-value"])) : o.type == "location" ? (r(), g(Y, {
1049
+ key: 18,
1050
+ multiselect: !0,
1051
+ items: e(X)().locations.map((n) => ({
1052
+ label: n.name,
1053
+ value: n._id
1054
+ })),
1055
+ "model-value": o.modelValue ?? [],
1056
+ "onUpdate:modelValue": t[18] || (t[18] = (n) => s("update:model-value", n))
1057
+ }, null, 8, ["items", "model-value"])) : (r(), V("div", tt, "Rule Not implemented")),
1058
+ v(E, {
1059
+ class: "items-end",
1060
+ state: e(Z).helperState(e(l), ""),
1061
+ text: e(Z).helperText(e(l), "")
1062
+ }, null, 8, ["state", "text"])
1063
+ ], 2);
1064
+ };
1065
+ }
1066
+ }), ot = { class: "space-y-4" }, at = { class: "flex items-center gap-8" }, nt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, rt = /* @__PURE__ */ B({
1067
+ __name: "CustomRuleDialog",
1068
+ props: {
1069
+ triggerType: {
1070
+ type: String,
1071
+ required: !0
1072
+ },
1073
+ includeOnly: {
1074
+ type: String
1075
+ },
1076
+ modelValue: {
1077
+ type: Object,
1078
+ default: () => {
1079
+ }
1080
+ }
1081
+ },
1082
+ setup(o) {
1083
+ const x = le(), y = Q(), { emitData: s, emitAction: l } = se(), c = o, t = I(
1084
+ () => ve(c.triggerType, c.includeOnly)
1085
+ ), u = (F) => ne[t.value.find((n) => n.property === F).type], i = I(() => {
1086
+ if (!f.value) return [];
1087
+ const F = t.value.find(
1088
+ (n) => n.property === f.value.property
1089
+ );
1090
+ return F ? ne[F.type].filter((n) => {
1091
+ var q, $;
1092
+ return !(($ = (q = re[n]) == null ? void 0 : q.exclude) != null && $.includes(f.value.property));
1093
+ }).map((n) => ({
1094
+ label: re[n].name,
1095
+ value: n
1096
+ })) : [];
1097
+ }), p = be, d = I(() => {
1098
+ const F = p.safeParse(f.value);
1099
+ return F.success ? [] : F.error.errors;
1100
+ }), b = P(!1), f = P(
1101
+ me(c.modelValue) ?? D.constructEntry(
1102
+ t.value[0].property,
1103
+ u(t.value[0].property)[0],
1104
+ null
1105
+ )
1106
+ ), E = I(() => {
1107
+ var W;
1108
+ const { property: F, negated: n, conditions: q } = f.value, $ = Object.keys(q || {})[0], K = Object.values(q || {})[0];
1109
+ return {
1110
+ property: F,
1111
+ negated: n == !0,
1112
+ type: (W = t.value.find((G) => G.property === F)) == null ? void 0 : W.type,
1113
+ operator: $,
1114
+ equator: K
1115
+ };
1116
+ });
1117
+ function m(F) {
1118
+ f.value = D.constructEntry(
1119
+ F,
1120
+ u(F)[0],
1121
+ null
1122
+ );
1123
+ }
1124
+ function a(F) {
1125
+ f.value = { ...f.value, negated: F == !0 };
1126
+ }
1127
+ function U(F) {
1128
+ f.value = {
1129
+ ...f.value,
1130
+ conditions: { [F]: null }
1131
+ };
1132
+ }
1133
+ function C(F) {
1134
+ f.value.conditions = {
1135
+ [E.value.operator]: F
1136
+ };
1137
+ }
1138
+ function w() {
1139
+ s(f.value), l("primary"), x.close();
1140
+ }
1141
+ return ue(async () => {
1142
+ await y.readMembership();
1143
+ }), (F, n) => {
1144
+ const q = k("FmIcon"), $ = k("FmField"), K = k("FmPill"), W = k("FmMenuItem"), G = k("FmMenu"), _ = k("FmButton");
1145
+ return r(), V("div", ot, [
1146
+ n[5] || (n[5] = R("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1147
+ v(G, {
1148
+ shift: !0,
1149
+ placement: "top-start",
1150
+ modelValue: e(b),
1151
+ "onUpdate:modelValue": n[0] || (n[0] = (O) => de(b) ? b.value = O : null),
1152
+ onMenuChanged: n[1] || (n[1] = (O) => b.value = O)
1153
+ }, {
1154
+ "menu-button": h(() => [
1155
+ v($, null, {
1156
+ append: h(() => [
1157
+ v(q, {
1158
+ name: e(b) ? "expand_less" : "expand_more"
1159
+ }, null, 8, ["name"])
1160
+ ]),
1161
+ default: h(() => {
1162
+ var O;
1163
+ return [
1164
+ te(j((O = e(t).find((T) => T.property == e(f).property)) == null ? void 0 : O.name) + " ", 1)
1165
+ ];
1166
+ }),
1167
+ _: 1
1168
+ })
1169
+ ]),
1170
+ default: h(() => [
1171
+ (r(!0), V(M, null, A(e(t), (O) => (r(), g(W, {
1172
+ key: O.property,
1173
+ "model-value": e(f).property == O.property,
1174
+ label: O.name,
1175
+ disabled: O.premium && !e(X)().isPremium,
1176
+ onClick: (T) => O.premium && !e(X)().isPremium ? null : m(O.property)
1177
+ }, pe({ _: 2 }, [
1178
+ O.premium ? {
1179
+ name: "append",
1180
+ fn: h(() => [
1181
+ v(K, { variant: "premium" })
1182
+ ]),
1183
+ key: "0"
1184
+ } : void 0
1185
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1186
+ ]),
1187
+ _: 1
1188
+ }, 8, ["modelValue"]),
1189
+ n[6] || (n[6] = R("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1190
+ R("div", at, [
1191
+ v(Y, {
1192
+ class: "w-1/4",
1193
+ items: [
1194
+ { label: "is", value: !1 },
1195
+ { label: "is not", value: !0 }
1196
+ ],
1197
+ "model-value": e(f).negated ?? !1,
1198
+ "onUpdate:modelValue": a
1199
+ }, null, 8, ["model-value"]),
1200
+ v(Y, {
1201
+ class: "flex-1",
1202
+ items: e(i),
1203
+ "model-value": e(E).operator,
1204
+ "onUpdate:modelValue": U
1205
+ }, null, 8, ["items", "model-value"])
1206
+ ]),
1207
+ R("div", null, [
1208
+ n[4] || (n[4] = R("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1209
+ e(E).type ? (r(), g(lt, {
1210
+ key: 0,
1211
+ type: e(E).type,
1212
+ operator: e(E).operator,
1213
+ "model-value": e(E).equator,
1214
+ "onUpdate:modelValue": C
1215
+ }, null, 8, ["type", "operator", "model-value"])) : N("", !0)
1216
+ ]),
1217
+ R("div", nt, [
1218
+ v(_, {
1219
+ onClick: n[2] || (n[2] = (O) => e(x).close()),
1220
+ label: "Cancel",
1221
+ variant: "tertiary"
1222
+ }),
1223
+ v(_, {
1224
+ onClick: n[3] || (n[3] = (O) => w()),
1225
+ disabled: e(d).length > 0,
1226
+ label: "Save"
1227
+ }, null, 8, ["disabled"])
1228
+ ])
1229
+ ]);
1230
+ };
1231
+ }
1232
+ }), ut = { class: "flex flex-col gap-8" }, st = { class: "grid grid-cols-2 items-center" }, mt = { class: "flex items-center gap-8" }, it = { class: "pt-16 flex items-center self-end gap-8" }, dt = /* @__PURE__ */ B({
1233
+ __name: "PresetRuleDialog",
1234
+ props: {
1235
+ preset: {
1236
+ type: String,
1237
+ required: !0
1238
+ },
1239
+ modelValue: {
1240
+ type: Object
1241
+ }
1242
+ },
1243
+ setup(o) {
1244
+ const x = le(), { emitData: y, emitAction: s } = se(), l = Q(), c = o;
1245
+ function t() {
1246
+ const { operator: E, equator: m } = p.value;
1247
+ switch (c.preset) {
1248
+ case "MIN_SPEND":
1249
+ case "SPECIFIC_DATE":
1250
+ case "SPECIFIC_TIMERANGE":
1251
+ case "WEEKLY":
1252
+ case "MONTHLY":
1253
+ case "BIRTHDAY":
1254
+ case "TIER":
1255
+ return `Applies to ${l.sortedTiers.filter((U, C) => E == "_equal" ? C + 1 == m : E == "_moreThanOrEqual" ? C + 1 >= m : C + 1 <= m).map((U) => U.name).join(", ")}`;
1256
+ }
1257
+ }
1258
+ function u() {
1259
+ var E, m;
1260
+ switch (c.preset) {
1261
+ case "MIN_SPEND":
1262
+ return D.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1263
+ case "SPECIFIC_DATE":
1264
+ return D.constructEntry("trigger.date", "_isOnDate", "");
1265
+ case "SPECIFIC_TIMERANGE":
1266
+ return D.constructEntry("trigger.time", "_isBetweenTime", [
1267
+ { start: "00:00", end: "23:59" }
1268
+ ]);
1269
+ case "WEEKLY":
1270
+ return D.constructEntry(
1271
+ "trigger.date",
1272
+ "_rrule",
1273
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1274
+ );
1275
+ case "MONTHLY":
1276
+ return D.constructEntry(
1277
+ "trigger.date",
1278
+ "_rrule",
1279
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1280
+ );
1281
+ case "BIRTHDAY":
1282
+ return D.constructEntry("user.birthday", "_isDay", {
1283
+ op: "after",
1284
+ x: 1,
1285
+ ignoreYear: !0
1286
+ });
1287
+ case "TIER":
1288
+ return D.constructEntry("user.tier", "_equal", 1);
1289
+ case "TITLE":
1290
+ return D.constructEntry("user.titles", "_hasAny", [
1291
+ (m = (E = l.sortedTitles) == null ? void 0 : E[0]) == null ? void 0 : m._id
1292
+ ]);
1293
+ case "CUSTOM":
1294
+ throw new Error("Not implemented");
1295
+ }
1296
+ }
1297
+ const i = P(u()), p = I(() => {
1298
+ const E = D.simplify(i.value);
1299
+ return {
1300
+ ...E,
1301
+ equator: E.equator
1302
+ };
1303
+ });
1304
+ function d(E, m) {
1305
+ const a = p.value;
1306
+ i.value = D.constructEntry(
1307
+ a.property,
1308
+ m ?? a.operator,
1309
+ E,
1310
+ i.value.name
1311
+ );
1312
+ }
1313
+ function b() {
1314
+ y(i.value), s("primary"), x.close();
1315
+ }
1316
+ const f = I(() => {
1317
+ const E = fe.safeParse(i.value);
1318
+ return E.success ? [] : E.error.errors;
1319
+ });
1320
+ return ue(async () => {
1321
+ await l.readMembership();
1322
+ }), (E, m) => {
1323
+ var K, W, G, _, O;
1324
+ const a = k("FmStepperField"), U = k("FmDatePicker"), C = k("FmTimeRangePicker"), w = k("FmRadio"), F = k("FmSelect"), n = k("FmRadioGroup"), q = k("FmHelperText"), $ = k("FmButton");
1325
+ return r(), V("div", ut, [
1326
+ o.preset == "MIN_SPEND" ? (r(), g(a, {
1327
+ key: 0,
1328
+ label: "Minimum spend",
1329
+ "model-value": e(p).equator,
1330
+ "onUpdate:modelValue": m[0] || (m[0] = (T) => d(T))
1331
+ }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_DATE" ? (r(), g(U, {
1332
+ key: 1,
1333
+ label: "Specific Date",
1334
+ "model-value": e(p).equator,
1335
+ "onUpdate:modelValue": m[1] || (m[1] = (T) => d(T))
1336
+ }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_TIMERANGE" ? (r(), g(C, {
1337
+ key: 2,
1338
+ label: "Time is between",
1339
+ "disable-time-check": !0,
1340
+ "model-value": [(W = (K = e(p).equator) == null ? void 0 : K[0]) == null ? void 0 : W.start, (_ = (G = e(p).equator) == null ? void 0 : G[0]) == null ? void 0 : _.end],
1341
+ "onUpdate:modelValue": m[2] || (m[2] = (T) => d([
1342
+ {
1343
+ start: T[0],
1344
+ end: T[1]
1345
+ }
1346
+ ]))
1347
+ }, null, 8, ["model-value"])) : o.preset == "WEEKLY" ? (r(), g(ee, {
1348
+ key: 3,
1349
+ label: "Weekly",
1350
+ "fixed-frequency": !0,
1351
+ "model-value": e(p).equator,
1352
+ "onUpdate:modelValue": m[3] || (m[3] = (T) => d(T))
1353
+ }, null, 8, ["model-value"])) : o.preset == "MONTHLY" ? (r(), g(ee, {
1354
+ key: 4,
1355
+ label: "Weekly",
1356
+ "fixed-frequency": !0,
1357
+ "model-value": e(p).equator,
1358
+ "onUpdate:modelValue": m[4] || (m[4] = (T) => d(T))
1359
+ }, null, 8, ["model-value"])) : o.preset == "BIRTHDAY" ? (r(), V(M, { key: 5 }, [
1360
+ R("div", st, [
1361
+ v(w, {
1362
+ label: "N days before birthday",
1363
+ value: "_isDay",
1364
+ "model-value": e(p).operator,
1365
+ "onUpdate:modelValue": m[5] || (m[5] = () => {
1366
+ d(
1367
+ {
1368
+ op: "after",
1369
+ x: 1,
1370
+ ignoreYear: !0
1371
+ },
1372
+ "_isDay"
1373
+ );
1374
+ })
1375
+ }, null, 8, ["model-value"]),
1376
+ R("div", mt, [
1377
+ v(w, {
1378
+ label: "Is in this",
1379
+ value: "_isRange",
1380
+ "model-value": e(p).operator,
1381
+ "onUpdate:modelValue": m[6] || (m[6] = () => {
1382
+ d(
1383
+ {
1384
+ op: "this",
1385
+ unit: "day",
1386
+ ignoreYear: !0
1387
+ },
1388
+ "_isRange"
1389
+ );
1390
+ })
1391
+ }, null, 8, ["model-value"]),
1392
+ e(p).operator == "_isRange" ? (r(), g(F, {
1393
+ key: 0,
1394
+ items: ["day", "week", "month"].map((T) => ({ label: T, value: T })),
1395
+ "model-value": e(p).equator.unit,
1396
+ "onUpdate:modelValue": m[7] || (m[7] = (T) => d(
1397
+ {
1398
+ op: "this",
1399
+ unit: T,
1400
+ ignoreYear: !0
1401
+ },
1402
+ "_isRange"
1403
+ ))
1404
+ }, null, 8, ["items", "model-value"])) : N("", !0)
1405
+ ])
1406
+ ]),
1407
+ e(p).operator == "_isDay" ? (r(), g(a, {
1408
+ key: 0,
1409
+ label: "Days before birthday",
1410
+ "show-steppers": !1,
1411
+ "model-value": e(p).equator.x,
1412
+ "onUpdate:modelValue": m[8] || (m[8] = (T) => d({
1413
+ op: "after",
1414
+ x: T,
1415
+ ignoreYear: !0
1416
+ }))
1417
+ }, null, 8, ["model-value"])) : N("", !0)
1418
+ ], 64)) : o.preset == "TIER" ? (r(), V(M, { key: 6 }, [
1419
+ v(n, {
1420
+ inline: !0,
1421
+ "model-value": e(p).operator,
1422
+ "onUpdate:modelValue": m[9] || (m[9] = (T) => d(e(p).equator, T))
1423
+ }, {
1424
+ default: h(() => [
1425
+ v(w, {
1426
+ value: "_moreThanOrEqual",
1427
+ label: "At least"
1428
+ }),
1429
+ v(w, {
1430
+ value: "_equal",
1431
+ label: "Equal"
1432
+ }),
1433
+ v(w, {
1434
+ value: "_lessThanOrEqual",
1435
+ label: "At most"
1436
+ })
1437
+ ]),
1438
+ _: 1
1439
+ }, 8, ["model-value"]),
1440
+ v(Y, {
1441
+ items: (e(l).sortedTiers ?? []).map((T, oe) => ({
1442
+ label: `Tier ${oe + 1} - ${T.name}`,
1443
+ value: oe + 1
1444
+ })),
1445
+ "model-value": e(p).equator,
1446
+ "onUpdate:modelValue": m[10] || (m[10] = (T) => d(T))
1447
+ }, null, 8, ["items", "model-value"]),
1448
+ v(q, {
1449
+ text: t()
1450
+ }, null, 8, ["text"])
1451
+ ], 64)) : o.preset == "TITLE" ? (r(), g(Y, {
1452
+ key: 7,
1453
+ label: "User has title",
1454
+ items: (e(l).sortedTitles ?? []).map((T) => ({
1455
+ label: T.name,
1456
+ value: T._id
1457
+ })),
1458
+ "model-value": (O = e(p).equator) == null ? void 0 : O[0],
1459
+ "onUpdate:modelValue": m[11] || (m[11] = (T) => d([T]))
1460
+ }, null, 8, ["items", "model-value"])) : N("", !0),
1461
+ v(q, {
1462
+ class: "mt-[-8px]",
1463
+ text: e(Z).helperText(e(f), ""),
1464
+ state: e(Z).helperState(e(f), "")
1465
+ }, null, 8, ["text", "state"]),
1466
+ R("div", it, [
1467
+ v($, {
1468
+ onClick: m[12] || (m[12] = (T) => e(x).close()),
1469
+ label: "Cancel",
1470
+ variant: "tertiary"
1471
+ }),
1472
+ v($, {
1473
+ onClick: m[13] || (m[13] = (T) => b()),
1474
+ disabled: e(f).length > 0,
1475
+ label: "Save"
1476
+ }, null, 8, ["disabled"])
1477
+ ])
1478
+ ]);
1479
+ };
1480
+ }
1481
+ }), pt = /* @__PURE__ */ B({
1482
+ __name: "RuleConfigurator",
1483
+ props: {
1484
+ triggerType: {
1485
+ type: String,
1486
+ required: !0
1487
+ },
1488
+ includeOnly: {
1489
+ type: String
1490
+ },
1491
+ modelValue: {
1492
+ type: Object,
1493
+ default: () => {
1494
+ }
1495
+ }
1496
+ },
1497
+ emits: ["update:model-value"],
1498
+ setup(o, { expose: x, emit: y }) {
1499
+ const s = o, l = y, c = le(), t = P();
1500
+ function u(d) {
1501
+ c.open({
1502
+ title: d.name,
1503
+ closeButton: !1,
1504
+ dismissAway: !1,
1505
+ contentComponent: dt,
1506
+ contentComponentProps: {
1507
+ preset: d.type,
1508
+ modelValue: s.modelValue
1509
+ }
1510
+ }).onPrimary((b) => l("update:model-value", b));
1511
+ }
1512
+ function i(d) {
1513
+ c.open({
1514
+ title: "Edit rule",
1515
+ closeButton: !1,
1516
+ dismissAway: !1,
1517
+ contentComponent: rt,
1518
+ contentComponentProps: {
1519
+ triggerType: s.triggerType,
1520
+ includeOnly: s.includeOnly,
1521
+ modelValue: d
1522
+ }
1523
+ }).onPrimary((b) => l("update:model-value", b));
1524
+ }
1525
+ function p(d) {
1526
+ if (d.type == "CUSTOM") {
1527
+ const [b] = d.rules;
1528
+ return i(
1529
+ D.constructEntry(b.property, b.operator, b.equator)
1530
+ );
1531
+ }
1532
+ return u(d);
1533
+ }
1534
+ return x({
1535
+ showCustomDialog: i
1536
+ }), (d, b) => {
1537
+ const f = k("FmButton"), E = k("FmMenuItem"), m = k("FmMenu");
1538
+ return r(), g(m, {
1539
+ shift: !0,
1540
+ placement: "top-start"
1541
+ }, {
1542
+ "menu-button": h(() => [
1543
+ v(f, {
1544
+ label: "Add condition",
1545
+ icon: "add",
1546
+ class: "text-fm-color-primary border-fm-color-primary",
1547
+ "icon-color": "primary",
1548
+ variant: "secondary"
1549
+ })
1550
+ ]),
1551
+ default: h(() => [
1552
+ (r(!0), V(M, null, A(e(Ye).filter(
1553
+ (a) => !o.includeOnly || a.for.includes(o.includeOnly)
1554
+ ), (a) => (r(), g(E, {
1555
+ key: a.name,
1556
+ "model-value": a.name == e(t),
1557
+ label: a.name,
1558
+ onClick: (U) => p(a)
1559
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
1560
+ ]),
1561
+ _: 1
1562
+ });
1563
+ };
1564
+ }
1565
+ }), Dt = /* @__PURE__ */ B({
1566
+ __name: "RuleGroup",
1567
+ props: {
1568
+ triggerType: {
1569
+ type: String,
1570
+ required: !0
1571
+ },
1572
+ includeOnly: {
1573
+ type: String
1574
+ },
1575
+ modelValue: {
1576
+ type: Object
1577
+ }
1578
+ },
1579
+ emits: ["update:model-value"],
1580
+ setup(o, { emit: x }) {
1581
+ const y = o, s = x, l = I(
1582
+ () => y.modelValue ?? D.scaffoldGroup()
1583
+ ), c = I(() => D.getLogic(l.value)), t = P();
1584
+ return (u, i) => {
1585
+ const p = k("FmButtonGroup"), d = k("FmCard");
1586
+ return r(), g(d, { variant: "outlined" }, {
1587
+ default: h(() => [
1588
+ v(d, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1589
+ default: h(() => [
1590
+ i[3] || (i[3] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1)),
1591
+ v(pt, {
1592
+ ref_key: "configuratorRef",
1593
+ ref: t,
1594
+ "include-only": o.includeOnly,
1595
+ "trigger-type": o.triggerType,
1596
+ "onUpdate:modelValue": i[0] || (i[0] = (b) => s("update:model-value", e(D).setRuleToGroup(e(l), b)))
1597
+ }, null, 8, ["include-only", "trigger-type"]),
1598
+ (r(!0), V(M, null, A(e(l).rules, (b, f) => {
1599
+ var E;
1600
+ return r(), V(M, null, [
1601
+ e(ge)(b) ? (r(), g(Re, {
1602
+ "model-value": b,
1603
+ key: f,
1604
+ onEdit: (E = e(t)) == null ? void 0 : E.showCustomDialog,
1605
+ onRemove: i[1] || (i[1] = (m) => {
1606
+ s(
1607
+ "update:model-value",
1608
+ e(D).removeEntry(e(l), m.name)
1609
+ );
1610
+ })
1611
+ }, null, 8, ["model-value", "onEdit"])) : N("", !0),
1612
+ v(p, {
1613
+ class: "w-[200px]",
1614
+ disabled: Object.keys(e(l).rules).length < 2,
1615
+ items: [{ label: "And" }, { label: "Or" }],
1616
+ "model-value": e(c) === "&&" ? { label: "And" } : { label: "Or" },
1617
+ "onUpdate:modelValue": i[2] || (i[2] = (m) => s(
1618
+ "update:model-value",
1619
+ e(D).setRuleToGroup(
1620
+ e(l),
1621
+ [],
1622
+ m.label === "And" ? "&&" : "||"
1623
+ )
1624
+ ))
1625
+ }, null, 8, ["disabled", "model-value"])
1626
+ ], 64);
1627
+ }), 256))
1628
+ ]),
1629
+ _: 1
1630
+ })
1631
+ ]),
1632
+ _: 1
1633
+ });
1634
+ };
1635
+ }
1636
+ });
1637
+ export {
1638
+ Dt as _,
1639
+ ee as a
1640
+ };