@feedmepos/mf-connect 0.1.0-beta.2 → 0.1.0-beta.21

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