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

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