@feedmepos/mf-settings 0.0.52 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3893 +0,0 @@
1
- var Ir = Object.defineProperty;
2
- var Ar = (r, e, t) => e in r ? Ir(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var Be = (r, e, t) => (Ar(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { defineComponent as Q, ref as ne, resolveComponent as H, openBlock as F, createBlock as Z, withCtx as q, withModifiers as rt, createCommentVNode as le, renderSlot as ue, createElementVNode as E, nextTick as Or, createElementBlock as K, normalizeClass as J, createTextVNode as Ne, toDisplayString as D, computed as z, normalizeStyle as Ce, createVNode as T, reactive as lt, Fragment as se, unref as R, renderList as me, h as _t, Teleport as Sr, Transition as Pr, withKeys as Tr, watch as Et, onMounted as Lr, onUnmounted as Nr, toRaw as wt, normalizeProps as Cr, guardReactiveProps as xr, getCurrentInstance as kr, isRef as Rt } from "vue";
5
- import { useCoreStore as fe, useI18n as pe, CustomAttributesForm as Vr } from "@feedmepos/mf-common";
6
- import { useSnackbar as ut, components as Fr, useDialog as ar, useDialogChild as jr, useBreakpoints as or } from "@feedmepos/ui-library";
7
- import { D as ct, u as ir, _ as Mr, a as Ur } from "./RestaurantSelector.vue_vue_type_script_setup_true_lang-e9712a4d.js";
8
- import { c as ge, _ as Dr, a as Ke } from "./object-8ac0c0d8.js";
9
- import { _ as Ee, c as Gr } from "./FormSection.vue_vue_type_script_setup_true_lang-6aab82f2.js";
10
- import { e as dt, g as lr, c as Br } from "./index-f1e5e565.js";
11
- import { u as ur, b as qe, a as He, g as ft } from "./index-72d7bc88.js";
12
- import { b as Kr } from "./business-906742ba.js";
13
- import { t as ze, w as Xe, x as qr, y as Hr, z as zr, A as Xr, B as xe, u as ve, D as Yr, G as Wr } from "./map-695afd6f.js";
14
- import { _ as cr, r as ce } from "./rules-c9fa22f8.js";
15
- import { u as Jr } from "./app-b66ea7e1.js";
16
- import "pinia";
17
- import "@feedmepos/mf-mdm";
18
- import "vue-router";
19
- import "@feedmepos/mf-e-invoice";
20
- var Zr = {};
21
- (function(r) {
22
- Object.defineProperty(r, "__esModule", { value: !0 }), function(e) {
23
- e.SLOT_SALE = "SLOT_SALE";
24
- }(r.ReportWidgetType || (r.ReportWidgetType = {})), function(e) {
25
- e.v2 = "v2", e.v3 = "v3", e.v4 = "v4";
26
- }(r.MENU_VERSION || (r.MENU_VERSION = {})), function(e) {
27
- e.Polygon = "Polygon";
28
- }(r.GeometryType || (r.GeometryType = {})), function(e) {
29
- e.stock = "stock", e.discovery = "discovery", e.pickup = "pickup", e.delivery = "delivery", e.foodpanda = "foodpanda", e.deliveryIntegration = "deliveryIntegration", e.kds = "kds", e.ods = "ods";
30
- }(r.RestaurantFeature || (r.RestaurantFeature = {})), function(e) {
31
- e.alpha = "alpha", e.beta = "beta", e.latest = "latest";
32
- }(r.RestaurantChannel || (r.RestaurantChannel = {})), function(e) {
33
- e.pickup = "pickup", e.delivery = "delivery";
34
- }(r.DiscoveryType || (r.DiscoveryType = {})), function(e) {
35
- e.new = "NEW", e.pending = "PENDING", e.approved = "APPROVED";
36
- }(r.PAYOUT_ACCOUNT_STATUS || (r.PAYOUT_ACCOUNT_STATUS = {})), function(e) {
37
- e.maybank = "MAYBANK", e.cimbBank = "CIMB_BANK", e.rhbBank = "RHB_BANK", e.bankIslam = "BANK_ISLAM", e.bankMuamalat = "BANK_MUAMALAT", e.bankRakyat = "BANK_RAKYAT", e.bankSimpananNasional = "BANK_SIMPANAN_NASIONAL", e.citiBank = "CITIBANK", e.hongLeongBank = "HONG_LEONG_BANK", e.hsbcBank = "HSBC_BANK", e.ocbcBank = "OCBC_BANK", e.publicBank = "PUBLIC_BANK", e.affinBank = "AFFIN_BANK", e.amBank = "AMBANK", e.agroBank = "AGRO_BANK", e.allianceBank = "ALLIANCE_BANK", e.alRajhiBank = "AL_RAJHI_BANK", e.bankOfChina = "BANK_OF_CHINA", e.bankOfAmerica = "BANK_OF_AMERICA", e.bankOfTokyoMitsubishiUFJ = "BANK_OF_TOKYO_MITSUBISHI_UFJ", e.bnpParibas = "BNP_PARIBAS", e.deutscheBank = "DEUTSCHE_BANK", e.industrialCommercialBankOfChina = "INDUSTRIAL_COMMERCIAL_BANK_OF_CHINA", e.jpMorganChaseBank = "JP_MORGAN_CHASE_BANK", e.kuwaitFinanceHouse = "KUWAIT_FINANCE_HOUSE", e.mizuhoBank = "MIZUHO_BANK", e.standardCharteredBank = "STANDARD_CHARTERED_BANK", e.sumitomoMitsuiBankingCorporation = "SUMITOMO_MITSUI_BANKING_CORPORATION", e.theRoyalBankOfScotland = "THE_ROYAL_BANK_OF_SCOTLAND", e.unitedOverseasBank = "UNITED_OVERSEAS_BANK";
38
- }(r.BankName || (r.BankName = {})), function(e) {
39
- e.current = "CURRENT_ACCOUNT", e.saving = "SAVING_ACCOUNT";
40
- }(r.BankType || (r.BankType = {})), function(e) {
41
- e[e.maybank = 100002270] = "maybank", e[e.cimbBank = 100002050] = "cimbBank", e[e.rhbBank = 100002186] = "rhbBank", e[e.bankIslam = 100002458] = "bankIslam", e[e.bankMuamalat = 100002458] = "bankMuamalat", e[e.bankRakyat = 100016020] = "bankRakyat", e[e.bankSimpananNasional = 100016017] = "bankSimpananNasional", e[e.citiBank = 100002173] = "citiBank", e[e.hongLeongBank = 100002241] = "hongLeongBank", e[e.hsbcBank = 100002225] = "hsbcBank", e[e.ocbcBank = 100002296] = "ocbcBank", e[e.publicBank = 100002335] = "publicBank", e[e.affinBank = 100002322] = "affinBank", e[e.amBank = 100002089] = "amBank", e[e.agroBank = 100033061] = "agroBank", e[e.allianceBank = 100002128] = "allianceBank", e[e.alRajhiBank = 100003509] = "alRajhiBank", e[e.bankOfChina = 100002429] = "bankOfChina", e[e.bankOfAmerica = 100002076] = "bankOfAmerica", e[e.bankOfTokyoMitsubishiUFJ = 100002102] = "bankOfTokyoMitsubishiUFJ", e[e.bnpParibas = 100002636] = "bnpParibas", e[e.deutscheBank = 100002199] = "deutscheBank", e[e.industrialCommercialBankOfChina = 100002597] = "industrialCommercialBankOfChina", e[e.jpMorganChaseBank = 100002157] = "jpMorganChaseBank", e[e.kuwaitFinanceHouse = 100003460] = "kuwaitFinanceHouse", e[e.mizuhoBank = 100002610] = "mizuhoBank", e[e.standardCharteredBank = 100002144] = "standardCharteredBank", e[e.sumitomoMitsuiBankingCorporation = 100002623] = "sumitomoMitsuiBankingCorporation", e[e.unitedOverseasBank = 100002267] = "unitedOverseasBank";
42
- }(r.BankRouting || (r.BankRouting = {})), function(e) {
43
- e.maybank = "MBBEMYKL", e.cimbBank = "CIBBMYKL", e.rhbBank = "RHBBMYKL", e.bankIslam = "BIMBMYKL", e.bankMuamalat = "BMMBMYKL", e.bankRakyat = "BKRMMYKL", e.bankSimpananNasional = "BSNAMYK1", e.citiBank = "CITIMYKL", e.hongLeongBank = "HLBBMYKL", e.hsbcBank = "HBMBMYKL", e.ocbcBank = "OCBCMYKL", e.publicBank = "PBBEMYKL", e.affinBank = "PHBMMYKL", e.amBank = "ARBKMYKL", e.agroBank = "AGOBMYKL", e.allianceBank = "MFBBMYKL", e.alRajhiBank = "RJHIMYKL", e.bankOfChina = "BKCHMYKL", e.bankOfAmerica = "BOFAMY2X", e.bankOfTokyoMitsubishiUFJ = "BOTKMYKX", e.bnpParibas = "BNPAMYKL", e.deutscheBank = "DEUTMYKL", e.industrialCommercialBankOfChina = "ICBKMYKL", e.jpMorganChaseBank = "CHASMYKX", e.kuwaitFinanceHouse = "KFHOMYKL", e.mizuhoBank = "MHCBMYKA", e.standardCharteredBank = "SCBLMYKX", e.sumitomoMitsuiBankingCorporation = "SMBCMYKL", e.unitedOverseasBank = "UOVBMYKL";
44
- }(r.BankSwiftCode || (r.BankSwiftCode = {})), function(e) {
45
- e.grab = "Grab", e.merchant = "Merchant", e.partner = "Partner";
46
- }(r.GF_CAMPAIGN_CREATED_BY || (r.GF_CAMPAIGN_CREATED_BY = {})), function(e) {
47
- e.all = "all", e.new = "new";
48
- }(r.GF_CAMPAIGN_EATER_TYPE || (r.GF_CAMPAIGN_EATER_TYPE = {})), function(e) {
49
- e.net = "net", e.percentage = "percentage", e.delivery = "delivery", e.freeItem = "freeItem";
50
- }(r.GF_CAMPAIGN_DISCOUNT_TYPE || (r.GF_CAMPAIGN_DISCOUNT_TYPE = {})), function(e) {
51
- e.order = "order", e.items = "items";
52
- }(r.GF_CAMPAIGN_SCOPE_TYPE || (r.GF_CAMPAIGN_SCOPE_TYPE = {}));
53
- })(Zr);
54
- const Qr = /* @__PURE__ */ Q({
55
- __name: "BottomSheetMenu",
56
- setup(r) {
57
- const e = ne(!1);
58
- async function t() {
59
- await Or(), e.value = !e.value;
60
- }
61
- return (n, s) => {
62
- const o = H("FmButton"), i = H("FmBottomSheet");
63
- return F(), Z(i, {
64
- modelValue: e.value,
65
- "onUpdate:modelValue": s[1] || (s[1] = (d) => e.value = d),
66
- "dismiss-away": "",
67
- "no-header": "",
68
- "z-index": 110
69
- }, {
70
- "bottom-sheet-button": q(() => [
71
- n.$slots.button ? le("", !0) : (F(), Z(o, {
72
- key: 0,
73
- icon: "more_vert",
74
- variant: "tertiary",
75
- onClick: rt(t, ["stop"])
76
- })),
77
- ue(n.$slots, "button")
78
- ]),
79
- default: q(() => [
80
- E("div", {
81
- onClick: s[0] || (s[0] = (d) => e.value = !1)
82
- }, [
83
- ue(n.$slots, "default")
84
- ])
85
- ]),
86
- _: 3
87
- }, 8, ["modelValue"]);
88
- };
89
- }
90
- }), en = { class: "py-8 px-12 hover:bg-fm-color-neutral-gray-100" }, tn = /* @__PURE__ */ Q({
91
- __name: "BottomSheetMenuItem",
92
- props: {
93
- label: {},
94
- icon: {},
95
- disabled: { type: Boolean },
96
- itemClass: {}
97
- },
98
- setup(r) {
99
- const e = r;
100
- return (t, n) => {
101
- const s = H("FmIcon");
102
- return F(), K("div", en, [
103
- t.$slots.content ? le("", !0) : (F(), K("div", {
104
- key: 0,
105
- class: J(["flex items-center", {
106
- "text-fm-color-typo-disabled": e.disabled,
107
- "cursor-pointer": !e.disabled,
108
- "cursor-not-allowed": e.disabled,
109
- [e.itemClass || ""]: e.itemClass && !e.disabled
110
- }])
111
- }, [
112
- t.icon ? (F(), Z(s, {
113
- key: 0,
114
- name: t.icon
115
- }, null, 8, ["name"])) : le("", !0),
116
- Ne(" " + D(t.label), 1)
117
- ], 2)),
118
- ue(t.$slots, "content")
119
- ]);
120
- };
121
- }
122
- }), rn = {
123
- key: 0,
124
- class: "space-y-4"
125
- }, nn = { class: "fm-typo-en-body-lg-600" }, sn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, an = {
126
- class: /* @__PURE__ */ J(["absolute inset-0", "h-full w-full", "rounded-md overflow-hidden"])
127
- }, on = {
128
- class: /* @__PURE__ */ J(["relative z-0", "w-full h-full", "overflow-hidden"])
129
- }, ln = ["src"], un = { class: "fm-typo-en-body-lg-600" }, cn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, be = /* @__PURE__ */ Q({
130
- __name: "ImageDropField",
131
- props: {
132
- label: {},
133
- subLabel: {},
134
- modelValue: {},
135
- previousUrl: {},
136
- width: { default: 323 },
137
- height: { default: 216 },
138
- canDelete: { type: Boolean, default: !0 }
139
- },
140
- emits: ["update:model-value", "reset:model-value"],
141
- setup(r, { emit: e }) {
142
- const t = r, n = e, s = z(() => t.modelValue ? URL.createObjectURL(t.modelValue) : t.previousUrl);
143
- return (o, i) => {
144
- const d = H("fm-icon"), c = H("fm-drop-field");
145
- return s.value ? (F(), K("div", rn, [
146
- E("p", nn, [
147
- Ne(D(t.label) + " ", 1),
148
- E("span", sn, D(o.subLabel), 1)
149
- ]),
150
- E("div", {
151
- class: J(["relative", "border-2 border-dashed border-fm-color-neutral-gray-300 rounded-md"]),
152
- style: Ce({ width: `${t.width}px`, height: `${t.height}px` })
153
- }, [
154
- E("div", an, [
155
- E("div", on, [
156
- E("img", {
157
- class: J(["h-full w-full", "object-cover"]),
158
- src: s.value,
159
- alt: "product image"
160
- }, null, 8, ln)
161
- ])
162
- ]),
163
- o.canDelete ? (F(), K("button", {
164
- key: 0,
165
- class: J([
166
- "absolute top-12 right-12 z-10",
167
- "w-24 h-24 rounded-[50%]",
168
- "bg-fm-color-neutral-white"
169
- ]),
170
- type: "button",
171
- onClick: i[0] || (i[0] = (u) => n("reset:model-value"))
172
- }, [
173
- T(d, { name: "close" })
174
- ])) : le("", !0)
175
- ], 4)
176
- ])) : (F(), Z(c, {
177
- key: 1,
178
- accept: ".jpg, .jpeg, .png, .gif",
179
- style: Ce({ width: `${t.width}px`, height: `${t.height}px` }),
180
- onFileUpload: i[1] || (i[1] = (u) => n("update:model-value", u))
181
- }, {
182
- label: q(() => [
183
- E("p", un, [
184
- Ne(D(t.label) + " ", 1),
185
- E("span", cn, D(t.subLabel), 1)
186
- ])
187
- ]),
188
- "accept-text": q(() => i[2] || (i[2] = [
189
- E("p", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Accepts .jpg, .jpeg, .png, .gif ", -1)
190
- ])),
191
- _: 1
192
- }, 8, ["style"]));
193
- };
194
- }
195
- }), dr = new RegExp(/^[a-z0-9][a-z0-9\-]{4,}[a-z0-9]$/), fr = [
196
- "home",
197
- "app",
198
- "about",
199
- "tnc",
200
- "terms-and-conditions",
201
- "redirection",
202
- "redirect",
203
- "auth",
204
- "login",
205
- "logout",
206
- "register",
207
- "user",
208
- "discovery",
209
- "discover",
210
- "order",
211
- "orders",
212
- "membership",
213
- "memberships",
214
- "member",
215
- "members",
216
- "benefit",
217
- "benefits",
218
- "reward",
219
- "rewards",
220
- "voucher",
221
- "vouchers",
222
- "search",
223
- "restaurant",
224
- "restaurants",
225
- "business",
226
- "businesses",
227
- "dine",
228
- "profile",
229
- "scan",
230
- "scanner",
231
- "menu",
232
- "cart",
233
- "me",
234
- "v",
235
- "active-orders",
236
- "qr",
237
- "setting",
238
- "settings",
239
- "error",
240
- "supportdetails",
241
- "support-details",
242
- "stacks",
243
- "imulus",
244
- "github",
245
- "twitter",
246
- "facebook",
247
- "google",
248
- "apple",
249
- "about",
250
- "account",
251
- "activate",
252
- "add",
253
- "admin",
254
- "administrator",
255
- "api",
256
- "app",
257
- "apps",
258
- "archive",
259
- "archives",
260
- "auth",
261
- "blog",
262
- "cache",
263
- "cancel",
264
- "careers",
265
- "cart",
266
- "changelog",
267
- "checkout",
268
- "codereview",
269
- "compare",
270
- "config",
271
- "configuration",
272
- "connect",
273
- "contact",
274
- "create",
275
- "delete",
276
- "direct_messages",
277
- "documentation",
278
- "download",
279
- "downloads",
280
- "edit",
281
- "email",
282
- "employment",
283
- "enterprise",
284
- "faq",
285
- "favorites",
286
- "feed",
287
- "feedback",
288
- "feeds",
289
- "fleet",
290
- "fleets",
291
- "follow",
292
- "followers",
293
- "following",
294
- "friend",
295
- "friends",
296
- "gist",
297
- "group",
298
- "groups",
299
- "help",
300
- "home",
301
- "hosting",
302
- "hostmaster",
303
- "idea",
304
- "ideas",
305
- "index",
306
- "info",
307
- "invitations",
308
- "invite",
309
- "is",
310
- "it",
311
- "job",
312
- "jobs",
313
- "json",
314
- "language",
315
- "languages",
316
- "lists",
317
- "login",
318
- "logout",
319
- "logs",
320
- "mail",
321
- "map",
322
- "maps",
323
- "mine",
324
- "mis",
325
- "news",
326
- "oauth",
327
- "oauth_clients",
328
- "offers",
329
- "openid",
330
- "order",
331
- "orders",
332
- "organizations",
333
- "plans",
334
- "popular",
335
- "post",
336
- "postmaster",
337
- "privacy",
338
- "projects",
339
- "put",
340
- "recruitment",
341
- "register",
342
- "remove",
343
- "replies",
344
- "root",
345
- "rss",
346
- "sales",
347
- "save",
348
- "search",
349
- "security",
350
- "sessions",
351
- "settings",
352
- "shop",
353
- "signup",
354
- "sitemap",
355
- "ssl",
356
- "ssladmin",
357
- "ssladministrator",
358
- "sslwebmaster",
359
- "status",
360
- "stories",
361
- "styleguide",
362
- "subscribe",
363
- "subscriptions",
364
- "support",
365
- "sysadmin",
366
- "sysadministrator",
367
- "terms",
368
- "tour",
369
- "translations",
370
- "trends",
371
- "unfollow",
372
- "unsubscribe",
373
- "update",
374
- "url",
375
- "user",
376
- "weather",
377
- "webmaster",
378
- "widget",
379
- "widgets",
380
- "wiki",
381
- "ww",
382
- "www",
383
- "wwww",
384
- "xfn",
385
- "xml",
386
- "xmpp",
387
- "yaml",
388
- "yml",
389
- "chinese",
390
- "mandarin",
391
- "spanish",
392
- "english",
393
- "bengali",
394
- "hindi",
395
- "portuguese",
396
- "russian",
397
- "japanese",
398
- "german",
399
- "wu",
400
- "javanese",
401
- "korean",
402
- "french",
403
- "vietnamese",
404
- "telugu",
405
- "chinese",
406
- "marathi",
407
- "tamil",
408
- "turkish",
409
- "urdu",
410
- "min-nan",
411
- "jinyu",
412
- "gujarati",
413
- "polish",
414
- "arabic",
415
- "ukrainian",
416
- "italian",
417
- "xiang",
418
- "malayalam",
419
- "hakka",
420
- "kannada",
421
- "oriya",
422
- "panjabi",
423
- "sunda",
424
- "panjabi",
425
- "romanian",
426
- "bhojpuri",
427
- "azerbaijani",
428
- "farsi",
429
- "maithili",
430
- "hausa",
431
- "arabic",
432
- "burmese",
433
- "serbo-croatian",
434
- "gan",
435
- "awadhi",
436
- "thai",
437
- "dutch",
438
- "yoruba",
439
- "sindhi",
440
- "ac",
441
- "ad",
442
- "ae",
443
- "af",
444
- "ag",
445
- "ai",
446
- "al",
447
- "am",
448
- "an",
449
- "ao",
450
- "aq",
451
- "ar",
452
- "as",
453
- "at",
454
- "au",
455
- "aw",
456
- "ax",
457
- "az",
458
- "ba",
459
- "bb",
460
- "bd",
461
- "be",
462
- "bf",
463
- "bg",
464
- "bh",
465
- "bi",
466
- "bj",
467
- "bm",
468
- "bn",
469
- "bo",
470
- "br",
471
- "bs",
472
- "bt",
473
- "bv",
474
- "bw",
475
- "by",
476
- "bz",
477
- "ca",
478
- "cc",
479
- "cd",
480
- "cf",
481
- "cg",
482
- "ch",
483
- "ci",
484
- "ck",
485
- "cl",
486
- "cm",
487
- "cn",
488
- "co",
489
- "cr",
490
- "cs",
491
- "cu",
492
- "cv",
493
- "cx",
494
- "cy",
495
- "cz",
496
- "dd",
497
- "de",
498
- "dj",
499
- "dk",
500
- "dm",
501
- "do",
502
- "dz",
503
- "ec",
504
- "ee",
505
- "eg",
506
- "eh",
507
- "er",
508
- "es",
509
- "et",
510
- "eu",
511
- "fi",
512
- "fj",
513
- "fk",
514
- "fm",
515
- "fo",
516
- "fr",
517
- "ga",
518
- "gb",
519
- "gd",
520
- "ge",
521
- "gf",
522
- "gg",
523
- "gh",
524
- "gi",
525
- "gl",
526
- "gm",
527
- "gn",
528
- "gp",
529
- "gq",
530
- "gr",
531
- "gs",
532
- "gt",
533
- "gu",
534
- "gw",
535
- "gy",
536
- "hk",
537
- "hm",
538
- "hn",
539
- "hr",
540
- "ht",
541
- "hu",
542
- "id",
543
- "ie",
544
- "il",
545
- "im",
546
- "in",
547
- "io",
548
- "iq",
549
- "ir",
550
- "is",
551
- "it",
552
- "je",
553
- "jm",
554
- "jo",
555
- "jp",
556
- "ke",
557
- "kg",
558
- "kh",
559
- "ki",
560
- "km",
561
- "kn",
562
- "kp",
563
- "kr",
564
- "kw",
565
- "ky",
566
- "kz",
567
- "la",
568
- "lb",
569
- "lc",
570
- "li",
571
- "lk",
572
- "lr",
573
- "ls",
574
- "lt",
575
- "lu",
576
- "lv",
577
- "ly",
578
- "ma",
579
- "mc",
580
- "md",
581
- "me",
582
- "mg",
583
- "mh",
584
- "mk",
585
- "ml",
586
- "mm",
587
- "mn",
588
- "mo",
589
- "mp",
590
- "mq",
591
- "mr",
592
- "ms",
593
- "mt",
594
- "mu",
595
- "mv",
596
- "mw",
597
- "mx",
598
- "my",
599
- "mz",
600
- "na",
601
- "nc",
602
- "ne",
603
- "nf",
604
- "ng",
605
- "ni",
606
- "nl",
607
- "no",
608
- "np",
609
- "nr",
610
- "nu",
611
- "nz",
612
- "om",
613
- "pa",
614
- "pe",
615
- "pf",
616
- "pg",
617
- "ph",
618
- "pk",
619
- "pl",
620
- "pm",
621
- "pn",
622
- "pr",
623
- "ps",
624
- "pt",
625
- "pw",
626
- "py",
627
- "qa",
628
- "re",
629
- "ro",
630
- "rs",
631
- "ru",
632
- "rw",
633
- "sa",
634
- "sb",
635
- "sc",
636
- "sd",
637
- "se",
638
- "sg",
639
- "sh",
640
- "si",
641
- "sj",
642
- "sk",
643
- "sl",
644
- "sm",
645
- "sn",
646
- "so",
647
- "sr",
648
- "ss",
649
- "st",
650
- "su",
651
- "sv",
652
- "sy",
653
- "sz",
654
- "tc",
655
- "td",
656
- "tf",
657
- "tg",
658
- "th",
659
- "tj",
660
- "tk",
661
- "tl",
662
- "tm",
663
- "tn",
664
- "to",
665
- "tp",
666
- "tr",
667
- "tt",
668
- "tv",
669
- "tw",
670
- "tz",
671
- "ua",
672
- "ug",
673
- "uk",
674
- "us",
675
- "uy",
676
- "uz",
677
- "va",
678
- "vc",
679
- "ve",
680
- "vg",
681
- "vi",
682
- "vn",
683
- "vu",
684
- "wf",
685
- "ws",
686
- "ye",
687
- "yt",
688
- "yu",
689
- "za",
690
- "zm",
691
- "zw"
692
- ], Ye = {
693
- async get(r, e) {
694
- const t = ze(void 0, e), n = Xe(t, r);
695
- return await (await qr(n)).text();
696
- },
697
- async update(r, e, t) {
698
- const n = ze(void 0, t), s = Xe(n, r);
699
- return await Hr(s, e), await zr(s);
700
- },
701
- async delete(r, e) {
702
- const t = ze(void 0, e), n = Xe(t, r);
703
- await Xr(n);
704
- }
705
- }, de = {
706
- async get(r) {
707
- return await Ye.get(r);
708
- },
709
- async update(r, e, t) {
710
- return await Ye.update(r, e);
711
- },
712
- async delete(r) {
713
- await Ye.delete(r);
714
- }
715
- }, dn = { class: "fm-typo-en-title-md-600" }, fn = { class: "pt-8 space-y-24" }, mn = { class: "flex gap-8 items-center justify-start" }, pn = /* @__PURE__ */ Q({
716
- __name: "BusinessForm",
717
- props: {
718
- businessId: {
719
- type: String,
720
- required: !0
721
- },
722
- initialValue: {
723
- type: Object,
724
- default: void 0
725
- }
726
- },
727
- setup(r, { expose: e }) {
728
- const t = r, n = ut(), s = ur(n), o = "https://feedmedev.cc", i = lt(
729
- t.initialValue ? ge(t.initialValue) : {
730
- thumbnail: void 0,
731
- name: "",
732
- url: void 0,
733
- newThumbnail: void 0
734
- }
735
- );
736
- z(() => i.newThumbnail ? URL.createObjectURL(i.newThumbnail) : i.thumbnail);
737
- const d = z(() => fe().currentCountry.value), c = ne(!1), u = ne(!1), b = ($) => {
738
- u.value = !u.value;
739
- };
740
- function g() {
741
- i.thumbnail = void 0, i.newThumbnail = void 0;
742
- }
743
- const p = async () => {
744
- const $ = i;
745
- await s.minor(async () => {
746
- var N, k, S;
747
- if ($.newThumbnail) {
748
- const M = await de.update(
749
- `business/${t.businessId}/thumbnail/${ct().toISOString()}.png`,
750
- $.newThumbnail
751
- );
752
- $.thumbnail = M, (N = t.initialValue) != null && N.thumbnail && await de.delete(t.initialValue.thumbnail);
753
- } else
754
- (k = t.initialValue) != null && k.thumbnail && !$.thumbnail && await de.delete((S = t.initialValue) == null ? void 0 : S.thumbnail);
755
- const y = await Kr.updateBusinessProfile(t.businessId, $), C = fe().currentBusiness;
756
- C.value = { ...C.value, ...y }, b();
757
- });
758
- };
759
- e({
760
- show: u,
761
- trigger: b
762
- });
763
- const { t: _ } = pe();
764
- return ($, y) => {
765
- const C = H("FmTextField"), N = H("fm-button"), k = H("fm-side-sheet");
766
- return F(), K(se, null, [
767
- ue($.$slots, "default", { trigger: b }),
768
- T(k, {
769
- id: "unit-form",
770
- modelValue: u.value,
771
- "onUpdate:modelValue": y[4] || (y[4] = (S) => u.value = S),
772
- "is-container": R(Fr).FmForm,
773
- "is-container-props": {
774
- onValidationSuccess: p,
775
- blameFormChildOnValidationFailed: !0
776
- },
777
- "max-width": 560,
778
- "z-index": 100
779
- }, {
780
- "side-sheet-header": q(() => [
781
- E("p", dn, D(R(_)("settings.business.form.title")), 1)
782
- ]),
783
- "side-sheet-footer": q(() => [
784
- E("div", mn, [
785
- T(N, {
786
- label: R(_)("common.update"),
787
- loading: c.value,
788
- size: "lg",
789
- type: "submit",
790
- variant: "primary"
791
- }, null, 8, ["label", "loading"]),
792
- T(N, {
793
- label: R(_)("common.cancel"),
794
- size: "lg",
795
- variant: "tertiary",
796
- onClick: y[3] || (y[3] = () => u.value = !1)
797
- }, null, 8, ["label"])
798
- ])
799
- ]),
800
- default: q(() => [
801
- E("div", fn, [
802
- E("div", null, [
803
- T(be, {
804
- label: R(_)("settings.business.form.cover_photo.label"),
805
- "sub-label": R(_)("settings.business.form.cover_photo.optional"),
806
- "previous-url": i.thumbnail,
807
- modelValue: i.newThumbnail,
808
- "onUpdate:modelValue": y[0] || (y[0] = (S) => i.newThumbnail = S),
809
- "onReset:modelValue": g
810
- }, null, 8, ["label", "sub-label", "previous-url", "modelValue"])
811
- ]),
812
- E("div", null, [
813
- T(C, {
814
- label: R(_)("settings.business.form.name"),
815
- modelValue: i.name,
816
- "onUpdate:modelValue": y[1] || (y[1] = (S) => i.name = S)
817
- }, null, 8, ["label", "modelValue"])
818
- ]),
819
- E("div", null, [
820
- T(C, {
821
- label: R(_)("settings.business.form.url.label"),
822
- "model-value": i.url || "",
823
- "onUpdate:modelValue": y[2] || (y[2] = (S) => i.url = S),
824
- placeholder: r.businessId,
825
- rules: [
826
- (S) => {
827
- var M;
828
- return !S || ((M = r.initialValue) == null ? void 0 : M.url) == i.url || d.value == R(dt.F_COUNTRY).enum.MY || R(_)("settings.business.form.url.errors.disabled");
829
- },
830
- (S) => !S || R(dr).test(S) || R(_)("settings.business.form.url.errors.format"),
831
- (S) => !S || !R(fr).includes(S) || R(_)("settings.business.form.url.errors.reserved")
832
- ]
833
- }, {
834
- prepend: q(() => [
835
- E("span", null, D(R(o) + "/"), 1)
836
- ]),
837
- _: 1
838
- }, 8, ["label", "model-value", "placeholder", "rules"])
839
- ])
840
- ])
841
- ]),
842
- _: 1
843
- }, 8, ["modelValue", "is-container", "is-container-props"])
844
- ], 64);
845
- };
846
- }
847
- }), hn = { class: "fm-typo-en-body-lg-600" }, vn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, It = /* @__PURE__ */ Q({
848
- __name: "FormLabel",
849
- props: {
850
- label: {},
851
- optional: { type: Boolean, default: !1 },
852
- subLabel: {}
853
- },
854
- setup(r) {
855
- const e = r, t = z(() => e.optional && !e.subLabel ? "(optional)" : e.subLabel);
856
- return (n, s) => (F(), K("p", hn, [
857
- Ne(D(n.label) + " ", 1),
858
- E("span", vn, D(t.value), 1)
859
- ]));
860
- }
861
- }), bn = { class: "space-y-4" }, gn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, yn = { class: "fm-typo-en-body-lg-600" }, At = /* @__PURE__ */ Q({
862
- __name: "InfoBasic",
863
- props: {
864
- name: {
865
- type: String,
866
- required: !0
867
- },
868
- value: {
869
- type: String,
870
- required: !0
871
- }
872
- },
873
- setup(r) {
874
- return (e, t) => (F(), K("div", bn, [
875
- E("div", gn, D(r.name), 1),
876
- E("div", yn, D(r.value), 1)
877
- ]));
878
- }
879
- }), $n = {};
880
- function _n(r, e) {
881
- return F(), K("div", null, e[0] || (e[0] = [
882
- E("div", { class: "h-px w-full bg-fm-color-neutral-gray-100" }, null, -1)
883
- ]));
884
- }
885
- const En = /* @__PURE__ */ cr($n, [["render", _n]]), wn = {
886
- key: 0,
887
- class: "ml-40 w-[320px] fm-corner-radius-lg p-16 border border-fm-color-neutral-gray-200 space-y-4"
888
- }, Rn = { class: "fm-typo-en-title-sm-600" }, Ot = /* @__PURE__ */ Q({
889
- __name: "Summary",
890
- props: {
891
- title: {},
892
- variant: {},
893
- items: {}
894
- },
895
- setup(r) {
896
- const e = r, t = ar();
897
- function n() {
898
- t.open({
899
- title: e.title,
900
- contentComponent: _t("div", { class: "space-y-4" }, [
901
- ...e.items.map(
902
- (s) => _t(At, {
903
- name: s.name,
904
- value: s.value || "--"
905
- })
906
- )
907
- ])
908
- });
909
- }
910
- return (s, o) => {
911
- const i = H("FmButton");
912
- return e.variant === "full" ? (F(), K("div", wn, [
913
- E("div", Rn, D(s.title), 1),
914
- T(En),
915
- (F(!0), K(se, null, me(s.items, (d) => (F(), Z(At, {
916
- key: d.name,
917
- name: d.name,
918
- value: d.value || "--"
919
- }, null, 8, ["name", "value"]))), 128))
920
- ])) : (F(), Z(i, {
921
- key: 1,
922
- icon: "info",
923
- variant: "tertiary",
924
- onClick: n
925
- }));
926
- };
927
- }
928
- }), In = {
929
- class: /* @__PURE__ */ J([
930
- "flex items-center",
931
- "px-24 pt-16 pb-8",
932
- "border-b border-fm-color-neutral-gray-100",
933
- "space-x-4"
934
- ])
935
- }, An = { class: "fm-typo-en-title-sm-600 mr-auto" }, On = {
936
- class: /* @__PURE__ */ J(["flex flex-col", "flex-1 overflow-scroll", "w-full", "px-24"])
937
- }, Sn = /* @__PURE__ */ Q({
938
- __name: "FullScreenForm",
939
- props: {
940
- show: { type: Boolean },
941
- title: {},
942
- primaryAction: {},
943
- secondaryActions: {},
944
- zIndex: { default: 50 }
945
- },
946
- emits: ["onPrimary", "onCancel"],
947
- setup(r, { emit: e }) {
948
- const t = e, n = () => {
949
- t("onPrimary");
950
- }, s = () => {
951
- t("onCancel");
952
- };
953
- return (o, i) => {
954
- const d = H("fm-button"), c = H("fm-form");
955
- return F(), Z(Sr, { to: "body" }, [
956
- T(Pr, { name: "fade" }, {
957
- default: q(() => [
958
- o.show ? (F(), Z(c, {
959
- key: 0,
960
- "blame-form-child-on-validation-failed": "",
961
- class: J(["fixed inset-0", "flex flex-col", "w-screen h-dvh", "bg-fm-color-neutral-white"]),
962
- style: Ce({ zIndex: o.zIndex }),
963
- tabindex: "-1",
964
- onValidationSuccess: n,
965
- onKeyup: Tr(s, ["esc"])
966
- }, {
967
- default: q(() => [
968
- E("div", In, [
969
- E("p", An, D(o.title), 1),
970
- ue(o.$slots, "append-title", {}, void 0, !0),
971
- (F(!0), K(se, null, me(o.secondaryActions, (u) => (F(), Z(d, {
972
- label: u.label,
973
- variant: "tertiary",
974
- onClick: u.click
975
- }, null, 8, ["label", "onClick"]))), 256)),
976
- T(d, {
977
- label: o.primaryAction.label,
978
- type: "submit",
979
- variant: "primary"
980
- }, null, 8, ["label"])
981
- ]),
982
- E("div", On, [
983
- ue(o.$slots, "default", {}, void 0, !0)
984
- ])
985
- ]),
986
- _: 3
987
- }, 8, ["style"])) : le("", !0)
988
- ]),
989
- _: 3
990
- })
991
- ]);
992
- };
993
- }
994
- });
995
- const Pn = /* @__PURE__ */ cr(Sn, [["__scopeId", "data-v-5b5c7179"]]);
996
- var nt = { exports: {} };
997
- const Tn = "2.0.0", mr = 256, Ln = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
998
- 9007199254740991, Nn = 16, Cn = mr - 6, xn = [
999
- "major",
1000
- "premajor",
1001
- "minor",
1002
- "preminor",
1003
- "patch",
1004
- "prepatch",
1005
- "prerelease"
1006
- ];
1007
- var Fe = {
1008
- MAX_LENGTH: mr,
1009
- MAX_SAFE_COMPONENT_LENGTH: Nn,
1010
- MAX_SAFE_BUILD_LENGTH: Cn,
1011
- MAX_SAFE_INTEGER: Ln,
1012
- RELEASE_TYPES: xn,
1013
- SEMVER_SPEC_VERSION: Tn,
1014
- FLAG_INCLUDE_PRERELEASE: 1,
1015
- FLAG_LOOSE: 2
1016
- };
1017
- const kn = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...r) => console.error("SEMVER", ...r) : () => {
1018
- };
1019
- var je = kn;
1020
- (function(r, e) {
1021
- const {
1022
- MAX_SAFE_COMPONENT_LENGTH: t,
1023
- MAX_SAFE_BUILD_LENGTH: n,
1024
- MAX_LENGTH: s
1025
- } = Fe, o = je;
1026
- e = r.exports = {};
1027
- const i = e.re = [], d = e.safeRe = [], c = e.src = [], u = e.t = {};
1028
- let b = 0;
1029
- const g = "[a-zA-Z0-9-]", p = [
1030
- ["\\s", 1],
1031
- ["\\d", s],
1032
- [g, n]
1033
- ], _ = (y) => {
1034
- for (const [C, N] of p)
1035
- y = y.split(`${C}*`).join(`${C}{0,${N}}`).split(`${C}+`).join(`${C}{1,${N}}`);
1036
- return y;
1037
- }, $ = (y, C, N) => {
1038
- const k = _(C), S = b++;
1039
- o(y, S, C), u[y] = S, c[S] = C, i[S] = new RegExp(C, N ? "g" : void 0), d[S] = new RegExp(k, N ? "g" : void 0);
1040
- };
1041
- $("NUMERICIDENTIFIER", "0|[1-9]\\d*"), $("NUMERICIDENTIFIERLOOSE", "\\d+"), $("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${g}*`), $("MAINVERSION", `(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`), $("MAINVERSIONLOOSE", `(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`), $("PRERELEASEIDENTIFIER", `(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`), $("PRERELEASEIDENTIFIERLOOSE", `(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`), $("PRERELEASE", `(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`), $("PRERELEASELOOSE", `(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`), $("BUILDIDENTIFIER", `${g}+`), $("BUILD", `(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`), $("FULLPLAIN", `v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`), $("FULL", `^${c[u.FULLPLAIN]}$`), $("LOOSEPLAIN", `[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`), $("LOOSE", `^${c[u.LOOSEPLAIN]}$`), $("GTLT", "((?:<|>)?=?)"), $("XRANGEIDENTIFIERLOOSE", `${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), $("XRANGEIDENTIFIER", `${c[u.NUMERICIDENTIFIER]}|x|X|\\*`), $("XRANGEPLAIN", `[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`), $("XRANGEPLAINLOOSE", `[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`), $("XRANGE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`), $("XRANGELOOSE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`), $("COERCEPLAIN", `(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`), $("COERCE", `${c[u.COERCEPLAIN]}(?:$|[^\\d])`), $("COERCEFULL", c[u.COERCEPLAIN] + `(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`), $("COERCERTL", c[u.COERCE], !0), $("COERCERTLFULL", c[u.COERCEFULL], !0), $("LONETILDE", "(?:~>?)"), $("TILDETRIM", `(\\s*)${c[u.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", $("TILDE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`), $("TILDELOOSE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`), $("LONECARET", "(?:\\^)"), $("CARETTRIM", `(\\s*)${c[u.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", $("CARET", `^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`), $("CARETLOOSE", `^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`), $("COMPARATORLOOSE", `^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`), $("COMPARATOR", `^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`), $("COMPARATORTRIM", `(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", $("HYPHENRANGE", `^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`), $("HYPHENRANGELOOSE", `^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`), $("STAR", "(<|>)?=?\\s*\\*"), $("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), $("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
1042
- })(nt, nt.exports);
1043
- var Ie = nt.exports;
1044
- const Vn = Object.freeze({ loose: !0 }), Fn = Object.freeze({}), jn = (r) => r ? typeof r != "object" ? Vn : r : Fn;
1045
- var mt = jn;
1046
- const St = /^[0-9]+$/, pr = (r, e) => {
1047
- const t = St.test(r), n = St.test(e);
1048
- return t && n && (r = +r, e = +e), r === e ? 0 : t && !n ? -1 : n && !t ? 1 : r < e ? -1 : 1;
1049
- }, Mn = (r, e) => pr(e, r);
1050
- var hr = {
1051
- compareIdentifiers: pr,
1052
- rcompareIdentifiers: Mn
1053
- };
1054
- const Ae = je, { MAX_LENGTH: Pt, MAX_SAFE_INTEGER: Oe } = Fe, { safeRe: Tt, t: Lt } = Ie, Un = mt, { compareIdentifiers: he } = hr;
1055
- let Dn = class ie {
1056
- constructor(e, t) {
1057
- if (t = Un(t), e instanceof ie) {
1058
- if (e.loose === !!t.loose && e.includePrerelease === !!t.includePrerelease)
1059
- return e;
1060
- e = e.version;
1061
- } else if (typeof e != "string")
1062
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);
1063
- if (e.length > Pt)
1064
- throw new TypeError(
1065
- `version is longer than ${Pt} characters`
1066
- );
1067
- Ae("SemVer", e, t), this.options = t, this.loose = !!t.loose, this.includePrerelease = !!t.includePrerelease;
1068
- const n = e.trim().match(t.loose ? Tt[Lt.LOOSE] : Tt[Lt.FULL]);
1069
- if (!n)
1070
- throw new TypeError(`Invalid Version: ${e}`);
1071
- if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major > Oe || this.major < 0)
1072
- throw new TypeError("Invalid major version");
1073
- if (this.minor > Oe || this.minor < 0)
1074
- throw new TypeError("Invalid minor version");
1075
- if (this.patch > Oe || this.patch < 0)
1076
- throw new TypeError("Invalid patch version");
1077
- n[4] ? this.prerelease = n[4].split(".").map((s) => {
1078
- if (/^[0-9]+$/.test(s)) {
1079
- const o = +s;
1080
- if (o >= 0 && o < Oe)
1081
- return o;
1082
- }
1083
- return s;
1084
- }) : this.prerelease = [], this.build = n[5] ? n[5].split(".") : [], this.format();
1085
- }
1086
- format() {
1087
- return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
1088
- }
1089
- toString() {
1090
- return this.version;
1091
- }
1092
- compare(e) {
1093
- if (Ae("SemVer.compare", this.version, this.options, e), !(e instanceof ie)) {
1094
- if (typeof e == "string" && e === this.version)
1095
- return 0;
1096
- e = new ie(e, this.options);
1097
- }
1098
- return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
1099
- }
1100
- compareMain(e) {
1101
- return e instanceof ie || (e = new ie(e, this.options)), he(this.major, e.major) || he(this.minor, e.minor) || he(this.patch, e.patch);
1102
- }
1103
- comparePre(e) {
1104
- if (e instanceof ie || (e = new ie(e, this.options)), this.prerelease.length && !e.prerelease.length)
1105
- return -1;
1106
- if (!this.prerelease.length && e.prerelease.length)
1107
- return 1;
1108
- if (!this.prerelease.length && !e.prerelease.length)
1109
- return 0;
1110
- let t = 0;
1111
- do {
1112
- const n = this.prerelease[t], s = e.prerelease[t];
1113
- if (Ae("prerelease compare", t, n, s), n === void 0 && s === void 0)
1114
- return 0;
1115
- if (s === void 0)
1116
- return 1;
1117
- if (n === void 0)
1118
- return -1;
1119
- if (n === s)
1120
- continue;
1121
- return he(n, s);
1122
- } while (++t);
1123
- }
1124
- compareBuild(e) {
1125
- e instanceof ie || (e = new ie(e, this.options));
1126
- let t = 0;
1127
- do {
1128
- const n = this.build[t], s = e.build[t];
1129
- if (Ae("build compare", t, n, s), n === void 0 && s === void 0)
1130
- return 0;
1131
- if (s === void 0)
1132
- return 1;
1133
- if (n === void 0)
1134
- return -1;
1135
- if (n === s)
1136
- continue;
1137
- return he(n, s);
1138
- } while (++t);
1139
- }
1140
- // preminor will bump the version up to the next minor release, and immediately
1141
- // down to pre-release. premajor and prepatch work the same way.
1142
- inc(e, t, n) {
1143
- switch (e) {
1144
- case "premajor":
1145
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", t, n);
1146
- break;
1147
- case "preminor":
1148
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", t, n);
1149
- break;
1150
- case "prepatch":
1151
- this.prerelease.length = 0, this.inc("patch", t, n), this.inc("pre", t, n);
1152
- break;
1153
- case "prerelease":
1154
- this.prerelease.length === 0 && this.inc("patch", t, n), this.inc("pre", t, n);
1155
- break;
1156
- case "major":
1157
- (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
1158
- break;
1159
- case "minor":
1160
- (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
1161
- break;
1162
- case "patch":
1163
- this.prerelease.length === 0 && this.patch++, this.prerelease = [];
1164
- break;
1165
- case "pre": {
1166
- const s = Number(n) ? 1 : 0;
1167
- if (!t && n === !1)
1168
- throw new Error("invalid increment argument: identifier is empty");
1169
- if (this.prerelease.length === 0)
1170
- this.prerelease = [s];
1171
- else {
1172
- let o = this.prerelease.length;
1173
- for (; --o >= 0; )
1174
- typeof this.prerelease[o] == "number" && (this.prerelease[o]++, o = -2);
1175
- if (o === -1) {
1176
- if (t === this.prerelease.join(".") && n === !1)
1177
- throw new Error("invalid increment argument: identifier already exists");
1178
- this.prerelease.push(s);
1179
- }
1180
- }
1181
- if (t) {
1182
- let o = [t, s];
1183
- n === !1 && (o = [t]), he(this.prerelease[0], t) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = o) : this.prerelease = o;
1184
- }
1185
- break;
1186
- }
1187
- default:
1188
- throw new Error(`invalid increment argument: ${e}`);
1189
- }
1190
- return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
1191
- }
1192
- };
1193
- var ee = Dn;
1194
- const Nt = ee, Gn = (r, e, t = !1) => {
1195
- if (r instanceof Nt)
1196
- return r;
1197
- try {
1198
- return new Nt(r, e);
1199
- } catch (n) {
1200
- if (!t)
1201
- return null;
1202
- throw n;
1203
- }
1204
- };
1205
- var $e = Gn;
1206
- const Bn = $e, Kn = (r, e) => {
1207
- const t = Bn(r, e);
1208
- return t ? t.version : null;
1209
- };
1210
- var qn = Kn;
1211
- const Hn = $e, zn = (r, e) => {
1212
- const t = Hn(r.trim().replace(/^[=v]+/, ""), e);
1213
- return t ? t.version : null;
1214
- };
1215
- var Xn = zn;
1216
- const Ct = ee, Yn = (r, e, t, n, s) => {
1217
- typeof t == "string" && (s = n, n = t, t = void 0);
1218
- try {
1219
- return new Ct(
1220
- r instanceof Ct ? r.version : r,
1221
- t
1222
- ).inc(e, n, s).version;
1223
- } catch {
1224
- return null;
1225
- }
1226
- };
1227
- var Wn = Yn;
1228
- const xt = $e, Jn = (r, e) => {
1229
- const t = xt(r, null, !0), n = xt(e, null, !0), s = t.compare(n);
1230
- if (s === 0)
1231
- return null;
1232
- const o = s > 0, i = o ? t : n, d = o ? n : t, c = !!i.prerelease.length;
1233
- if (!!d.prerelease.length && !c)
1234
- return !d.patch && !d.minor ? "major" : i.patch ? "patch" : i.minor ? "minor" : "major";
1235
- const b = c ? "pre" : "";
1236
- return t.major !== n.major ? b + "major" : t.minor !== n.minor ? b + "minor" : t.patch !== n.patch ? b + "patch" : "prerelease";
1237
- };
1238
- var Zn = Jn;
1239
- const Qn = ee, es = (r, e) => new Qn(r, e).major;
1240
- var ts = es;
1241
- const rs = ee, ns = (r, e) => new rs(r, e).minor;
1242
- var ss = ns;
1243
- const as = ee, os = (r, e) => new as(r, e).patch;
1244
- var is = os;
1245
- const ls = $e, us = (r, e) => {
1246
- const t = ls(r, e);
1247
- return t && t.prerelease.length ? t.prerelease : null;
1248
- };
1249
- var cs = us;
1250
- const kt = ee, ds = (r, e, t) => new kt(r, t).compare(new kt(e, t));
1251
- var ae = ds;
1252
- const fs = ae, ms = (r, e, t) => fs(e, r, t);
1253
- var ps = ms;
1254
- const hs = ae, vs = (r, e) => hs(r, e, !0);
1255
- var bs = vs;
1256
- const Vt = ee, gs = (r, e, t) => {
1257
- const n = new Vt(r, t), s = new Vt(e, t);
1258
- return n.compare(s) || n.compareBuild(s);
1259
- };
1260
- var pt = gs;
1261
- const ys = pt, $s = (r, e) => r.sort((t, n) => ys(t, n, e));
1262
- var _s = $s;
1263
- const Es = pt, ws = (r, e) => r.sort((t, n) => Es(n, t, e));
1264
- var Rs = ws;
1265
- const Is = ae, As = (r, e, t) => Is(r, e, t) > 0;
1266
- var Me = As;
1267
- const Os = ae, Ss = (r, e, t) => Os(r, e, t) < 0;
1268
- var ht = Ss;
1269
- const Ps = ae, Ts = (r, e, t) => Ps(r, e, t) === 0;
1270
- var vr = Ts;
1271
- const Ls = ae, Ns = (r, e, t) => Ls(r, e, t) !== 0;
1272
- var br = Ns;
1273
- const Cs = ae, xs = (r, e, t) => Cs(r, e, t) >= 0;
1274
- var vt = xs;
1275
- const ks = ae, Vs = (r, e, t) => ks(r, e, t) <= 0;
1276
- var bt = Vs;
1277
- const Fs = vr, js = br, Ms = Me, Us = vt, Ds = ht, Gs = bt, Bs = (r, e, t, n) => {
1278
- switch (e) {
1279
- case "===":
1280
- return typeof r == "object" && (r = r.version), typeof t == "object" && (t = t.version), r === t;
1281
- case "!==":
1282
- return typeof r == "object" && (r = r.version), typeof t == "object" && (t = t.version), r !== t;
1283
- case "":
1284
- case "=":
1285
- case "==":
1286
- return Fs(r, t, n);
1287
- case "!=":
1288
- return js(r, t, n);
1289
- case ">":
1290
- return Ms(r, t, n);
1291
- case ">=":
1292
- return Us(r, t, n);
1293
- case "<":
1294
- return Ds(r, t, n);
1295
- case "<=":
1296
- return Gs(r, t, n);
1297
- default:
1298
- throw new TypeError(`Invalid operator: ${e}`);
1299
- }
1300
- };
1301
- var gr = Bs;
1302
- const Ks = ee, qs = $e, { safeRe: Se, t: Pe } = Ie, Hs = (r, e) => {
1303
- if (r instanceof Ks)
1304
- return r;
1305
- if (typeof r == "number" && (r = String(r)), typeof r != "string")
1306
- return null;
1307
- e = e || {};
1308
- let t = null;
1309
- if (!e.rtl)
1310
- t = r.match(e.includePrerelease ? Se[Pe.COERCEFULL] : Se[Pe.COERCE]);
1311
- else {
1312
- const c = e.includePrerelease ? Se[Pe.COERCERTLFULL] : Se[Pe.COERCERTL];
1313
- let u;
1314
- for (; (u = c.exec(r)) && (!t || t.index + t[0].length !== r.length); )
1315
- (!t || u.index + u[0].length !== t.index + t[0].length) && (t = u), c.lastIndex = u.index + u[1].length + u[2].length;
1316
- c.lastIndex = -1;
1317
- }
1318
- if (t === null)
1319
- return null;
1320
- const n = t[2], s = t[3] || "0", o = t[4] || "0", i = e.includePrerelease && t[5] ? `-${t[5]}` : "", d = e.includePrerelease && t[6] ? `+${t[6]}` : "";
1321
- return qs(`${n}.${s}.${o}${i}${d}`, e);
1322
- };
1323
- var zs = Hs;
1324
- class Xs {
1325
- constructor() {
1326
- this.max = 1e3, this.map = /* @__PURE__ */ new Map();
1327
- }
1328
- get(e) {
1329
- const t = this.map.get(e);
1330
- if (t !== void 0)
1331
- return this.map.delete(e), this.map.set(e, t), t;
1332
- }
1333
- delete(e) {
1334
- return this.map.delete(e);
1335
- }
1336
- set(e, t) {
1337
- if (!this.delete(e) && t !== void 0) {
1338
- if (this.map.size >= this.max) {
1339
- const s = this.map.keys().next().value;
1340
- this.delete(s);
1341
- }
1342
- this.map.set(e, t);
1343
- }
1344
- return this;
1345
- }
1346
- }
1347
- var Ys = Xs, We, Ft;
1348
- function oe() {
1349
- if (Ft)
1350
- return We;
1351
- Ft = 1;
1352
- const r = /\s+/g;
1353
- class e {
1354
- constructor(m, I) {
1355
- if (I = s(I), m instanceof e)
1356
- return m.loose === !!I.loose && m.includePrerelease === !!I.includePrerelease ? m : new e(m.raw, I);
1357
- if (m instanceof o)
1358
- return this.raw = m.value, this.set = [[m]], this.formatted = void 0, this;
1359
- if (this.options = I, this.loose = !!I.loose, this.includePrerelease = !!I.includePrerelease, this.raw = m.trim().replace(r, " "), this.set = this.raw.split("||").map((w) => this.parseRange(w.trim())).filter((w) => w.length), !this.set.length)
1360
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1361
- if (this.set.length > 1) {
1362
- const w = this.set[0];
1363
- if (this.set = this.set.filter((h) => !y(h[0])), this.set.length === 0)
1364
- this.set = [w];
1365
- else if (this.set.length > 1) {
1366
- for (const h of this.set)
1367
- if (h.length === 1 && C(h[0])) {
1368
- this.set = [h];
1369
- break;
1370
- }
1371
- }
1372
- }
1373
- this.formatted = void 0;
1374
- }
1375
- get range() {
1376
- if (this.formatted === void 0) {
1377
- this.formatted = "";
1378
- for (let m = 0; m < this.set.length; m++) {
1379
- m > 0 && (this.formatted += "||");
1380
- const I = this.set[m];
1381
- for (let w = 0; w < I.length; w++)
1382
- w > 0 && (this.formatted += " "), this.formatted += I[w].toString().trim();
1383
- }
1384
- }
1385
- return this.formatted;
1386
- }
1387
- format() {
1388
- return this.range;
1389
- }
1390
- toString() {
1391
- return this.range;
1392
- }
1393
- parseRange(m) {
1394
- const w = ((this.options.includePrerelease && _) | (this.options.loose && $)) + ":" + m, h = n.get(w);
1395
- if (h)
1396
- return h;
1397
- const O = this.options.loose, x = O ? c[u.HYPHENRANGELOOSE] : c[u.HYPHENRANGE];
1398
- m = m.replace(x, A(this.options.includePrerelease)), i("hyphen replace", m), m = m.replace(c[u.COMPARATORTRIM], b), i("comparator trim", m), m = m.replace(c[u.TILDETRIM], g), i("tilde trim", m), m = m.replace(c[u.CARETTRIM], p), i("caret trim", m);
1399
- let G = m.split(" ").map((j) => k(j, this.options)).join(" ").split(/\s+/).map((j) => v(j, this.options));
1400
- O && (G = G.filter((j) => (i("loose invalid filter", j, this.options), !!j.match(c[u.COMPARATORLOOSE])))), i("range list", G);
1401
- const V = /* @__PURE__ */ new Map(), L = G.map((j) => new o(j, this.options));
1402
- for (const j of L) {
1403
- if (y(j))
1404
- return [j];
1405
- V.set(j.value, j);
1406
- }
1407
- V.size > 1 && V.has("") && V.delete("");
1408
- const B = [...V.values()];
1409
- return n.set(w, B), B;
1410
- }
1411
- intersects(m, I) {
1412
- if (!(m instanceof e))
1413
- throw new TypeError("a Range is required");
1414
- return this.set.some((w) => N(w, I) && m.set.some((h) => N(h, I) && w.every((O) => h.every((x) => O.intersects(x, I)))));
1415
- }
1416
- // if ANY of the sets match ALL of its comparators, then pass
1417
- test(m) {
1418
- if (!m)
1419
- return !1;
1420
- if (typeof m == "string")
1421
- try {
1422
- m = new d(m, this.options);
1423
- } catch {
1424
- return !1;
1425
- }
1426
- for (let I = 0; I < this.set.length; I++)
1427
- if (P(this.set[I], m, this.options))
1428
- return !0;
1429
- return !1;
1430
- }
1431
- }
1432
- We = e;
1433
- const t = Ys, n = new t(), s = mt, o = Ue(), i = je, d = ee, {
1434
- safeRe: c,
1435
- t: u,
1436
- comparatorTrimReplace: b,
1437
- tildeTrimReplace: g,
1438
- caretTrimReplace: p
1439
- } = Ie, { FLAG_INCLUDE_PRERELEASE: _, FLAG_LOOSE: $ } = Fe, y = (f) => f.value === "<0.0.0-0", C = (f) => f.value === "", N = (f, m) => {
1440
- let I = !0;
1441
- const w = f.slice();
1442
- let h = w.pop();
1443
- for (; I && w.length; )
1444
- I = w.every((O) => h.intersects(O, m)), h = w.pop();
1445
- return I;
1446
- }, k = (f, m) => (i("comp", f, m), f = W(f, m), i("caret", f), f = M(f, m), i("tildes", f), f = X(f, m), i("xrange", f), f = l(f, m), i("stars", f), f), S = (f) => !f || f.toLowerCase() === "x" || f === "*", M = (f, m) => f.trim().split(/\s+/).map((I) => Y(I, m)).join(" "), Y = (f, m) => {
1447
- const I = m.loose ? c[u.TILDELOOSE] : c[u.TILDE];
1448
- return f.replace(I, (w, h, O, x, G) => {
1449
- i("tilde", f, w, h, O, x, G);
1450
- let V;
1451
- return S(h) ? V = "" : S(O) ? V = `>=${h}.0.0 <${+h + 1}.0.0-0` : S(x) ? V = `>=${h}.${O}.0 <${h}.${+O + 1}.0-0` : G ? (i("replaceTilde pr", G), V = `>=${h}.${O}.${x}-${G} <${h}.${+O + 1}.0-0`) : V = `>=${h}.${O}.${x} <${h}.${+O + 1}.0-0`, i("tilde return", V), V;
1452
- });
1453
- }, W = (f, m) => f.trim().split(/\s+/).map((I) => U(I, m)).join(" "), U = (f, m) => {
1454
- i("caret", f, m);
1455
- const I = m.loose ? c[u.CARETLOOSE] : c[u.CARET], w = m.includePrerelease ? "-0" : "";
1456
- return f.replace(I, (h, O, x, G, V) => {
1457
- i("caret", f, h, O, x, G, V);
1458
- let L;
1459
- return S(O) ? L = "" : S(x) ? L = `>=${O}.0.0${w} <${+O + 1}.0.0-0` : S(G) ? O === "0" ? L = `>=${O}.${x}.0${w} <${O}.${+x + 1}.0-0` : L = `>=${O}.${x}.0${w} <${+O + 1}.0.0-0` : V ? (i("replaceCaret pr", V), O === "0" ? x === "0" ? L = `>=${O}.${x}.${G}-${V} <${O}.${x}.${+G + 1}-0` : L = `>=${O}.${x}.${G}-${V} <${O}.${+x + 1}.0-0` : L = `>=${O}.${x}.${G}-${V} <${+O + 1}.0.0-0`) : (i("no pr"), O === "0" ? x === "0" ? L = `>=${O}.${x}.${G}${w} <${O}.${x}.${+G + 1}-0` : L = `>=${O}.${x}.${G}${w} <${O}.${+x + 1}.0-0` : L = `>=${O}.${x}.${G} <${+O + 1}.0.0-0`), i("caret return", L), L;
1460
- });
1461
- }, X = (f, m) => (i("replaceXRanges", f, m), f.split(/\s+/).map((I) => a(I, m)).join(" ")), a = (f, m) => {
1462
- f = f.trim();
1463
- const I = m.loose ? c[u.XRANGELOOSE] : c[u.XRANGE];
1464
- return f.replace(I, (w, h, O, x, G, V) => {
1465
- i("xRange", f, w, h, O, x, G, V);
1466
- const L = S(O), B = L || S(x), j = B || S(G), te = j;
1467
- return h === "=" && te && (h = ""), V = m.includePrerelease ? "-0" : "", L ? h === ">" || h === "<" ? w = "<0.0.0-0" : w = "*" : h && te ? (B && (x = 0), G = 0, h === ">" ? (h = ">=", B ? (O = +O + 1, x = 0, G = 0) : (x = +x + 1, G = 0)) : h === "<=" && (h = "<", B ? O = +O + 1 : x = +x + 1), h === "<" && (V = "-0"), w = `${h + O}.${x}.${G}${V}`) : B ? w = `>=${O}.0.0${V} <${+O + 1}.0.0-0` : j && (w = `>=${O}.${x}.0${V} <${O}.${+x + 1}.0-0`), i("xRange return", w), w;
1468
- });
1469
- }, l = (f, m) => (i("replaceStars", f, m), f.trim().replace(c[u.STAR], "")), v = (f, m) => (i("replaceGTE0", f, m), f.trim().replace(c[m.includePrerelease ? u.GTE0PRE : u.GTE0], "")), A = (f) => (m, I, w, h, O, x, G, V, L, B, j, te) => (S(w) ? I = "" : S(h) ? I = `>=${w}.0.0${f ? "-0" : ""}` : S(O) ? I = `>=${w}.${h}.0${f ? "-0" : ""}` : x ? I = `>=${I}` : I = `>=${I}${f ? "-0" : ""}`, S(L) ? V = "" : S(B) ? V = `<${+L + 1}.0.0-0` : S(j) ? V = `<${L}.${+B + 1}.0-0` : te ? V = `<=${L}.${B}.${j}-${te}` : f ? V = `<${L}.${B}.${+j + 1}-0` : V = `<=${V}`, `${I} ${V}`.trim()), P = (f, m, I) => {
1470
- for (let w = 0; w < f.length; w++)
1471
- if (!f[w].test(m))
1472
- return !1;
1473
- if (m.prerelease.length && !I.includePrerelease) {
1474
- for (let w = 0; w < f.length; w++)
1475
- if (i(f[w].semver), f[w].semver !== o.ANY && f[w].semver.prerelease.length > 0) {
1476
- const h = f[w].semver;
1477
- if (h.major === m.major && h.minor === m.minor && h.patch === m.patch)
1478
- return !0;
1479
- }
1480
- return !1;
1481
- }
1482
- return !0;
1483
- };
1484
- return We;
1485
- }
1486
- var Je, jt;
1487
- function Ue() {
1488
- if (jt)
1489
- return Je;
1490
- jt = 1;
1491
- const r = Symbol("SemVer ANY");
1492
- class e {
1493
- static get ANY() {
1494
- return r;
1495
- }
1496
- constructor(b, g) {
1497
- if (g = t(g), b instanceof e) {
1498
- if (b.loose === !!g.loose)
1499
- return b;
1500
- b = b.value;
1501
- }
1502
- b = b.trim().split(/\s+/).join(" "), i("comparator", b, g), this.options = g, this.loose = !!g.loose, this.parse(b), this.semver === r ? this.value = "" : this.value = this.operator + this.semver.version, i("comp", this);
1503
- }
1504
- parse(b) {
1505
- const g = this.options.loose ? n[s.COMPARATORLOOSE] : n[s.COMPARATOR], p = b.match(g);
1506
- if (!p)
1507
- throw new TypeError(`Invalid comparator: ${b}`);
1508
- this.operator = p[1] !== void 0 ? p[1] : "", this.operator === "=" && (this.operator = ""), p[2] ? this.semver = new d(p[2], this.options.loose) : this.semver = r;
1509
- }
1510
- toString() {
1511
- return this.value;
1512
- }
1513
- test(b) {
1514
- if (i("Comparator.test", b, this.options.loose), this.semver === r || b === r)
1515
- return !0;
1516
- if (typeof b == "string")
1517
- try {
1518
- b = new d(b, this.options);
1519
- } catch {
1520
- return !1;
1521
- }
1522
- return o(b, this.operator, this.semver, this.options);
1523
- }
1524
- intersects(b, g) {
1525
- if (!(b instanceof e))
1526
- throw new TypeError("a Comparator is required");
1527
- return this.operator === "" ? this.value === "" ? !0 : new c(b.value, g).test(this.value) : b.operator === "" ? b.value === "" ? !0 : new c(this.value, g).test(b.semver) : (g = t(g), g.includePrerelease && (this.value === "<0.0.0-0" || b.value === "<0.0.0-0") || !g.includePrerelease && (this.value.startsWith("<0.0.0") || b.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && b.operator.startsWith(">") || this.operator.startsWith("<") && b.operator.startsWith("<") || this.semver.version === b.semver.version && this.operator.includes("=") && b.operator.includes("=") || o(this.semver, "<", b.semver, g) && this.operator.startsWith(">") && b.operator.startsWith("<") || o(this.semver, ">", b.semver, g) && this.operator.startsWith("<") && b.operator.startsWith(">")));
1528
- }
1529
- }
1530
- Je = e;
1531
- const t = mt, { safeRe: n, t: s } = Ie, o = gr, i = je, d = ee, c = oe();
1532
- return Je;
1533
- }
1534
- const Ws = oe(), Js = (r, e, t) => {
1535
- try {
1536
- e = new Ws(e, t);
1537
- } catch {
1538
- return !1;
1539
- }
1540
- return e.test(r);
1541
- };
1542
- var De = Js;
1543
- const Zs = oe(), Qs = (r, e) => new Zs(r, e).set.map((t) => t.map((n) => n.value).join(" ").trim().split(" "));
1544
- var ea = Qs;
1545
- const ta = ee, ra = oe(), na = (r, e, t) => {
1546
- let n = null, s = null, o = null;
1547
- try {
1548
- o = new ra(e, t);
1549
- } catch {
1550
- return null;
1551
- }
1552
- return r.forEach((i) => {
1553
- o.test(i) && (!n || s.compare(i) === -1) && (n = i, s = new ta(n, t));
1554
- }), n;
1555
- };
1556
- var sa = na;
1557
- const aa = ee, oa = oe(), ia = (r, e, t) => {
1558
- let n = null, s = null, o = null;
1559
- try {
1560
- o = new oa(e, t);
1561
- } catch {
1562
- return null;
1563
- }
1564
- return r.forEach((i) => {
1565
- o.test(i) && (!n || s.compare(i) === 1) && (n = i, s = new aa(n, t));
1566
- }), n;
1567
- };
1568
- var la = ia;
1569
- const Ze = ee, ua = oe(), Mt = Me, ca = (r, e) => {
1570
- r = new ua(r, e);
1571
- let t = new Ze("0.0.0");
1572
- if (r.test(t) || (t = new Ze("0.0.0-0"), r.test(t)))
1573
- return t;
1574
- t = null;
1575
- for (let n = 0; n < r.set.length; ++n) {
1576
- const s = r.set[n];
1577
- let o = null;
1578
- s.forEach((i) => {
1579
- const d = new Ze(i.semver.version);
1580
- switch (i.operator) {
1581
- case ">":
1582
- d.prerelease.length === 0 ? d.patch++ : d.prerelease.push(0), d.raw = d.format();
1583
- case "":
1584
- case ">=":
1585
- (!o || Mt(d, o)) && (o = d);
1586
- break;
1587
- case "<":
1588
- case "<=":
1589
- break;
1590
- default:
1591
- throw new Error(`Unexpected operation: ${i.operator}`);
1592
- }
1593
- }), o && (!t || Mt(t, o)) && (t = o);
1594
- }
1595
- return t && r.test(t) ? t : null;
1596
- };
1597
- var da = ca;
1598
- const fa = oe(), ma = (r, e) => {
1599
- try {
1600
- return new fa(r, e).range || "*";
1601
- } catch {
1602
- return null;
1603
- }
1604
- };
1605
- var pa = ma;
1606
- const ha = ee, yr = Ue(), { ANY: va } = yr, ba = oe(), ga = De, Ut = Me, Dt = ht, ya = bt, $a = vt, _a = (r, e, t, n) => {
1607
- r = new ha(r, n), e = new ba(e, n);
1608
- let s, o, i, d, c;
1609
- switch (t) {
1610
- case ">":
1611
- s = Ut, o = ya, i = Dt, d = ">", c = ">=";
1612
- break;
1613
- case "<":
1614
- s = Dt, o = $a, i = Ut, d = "<", c = "<=";
1615
- break;
1616
- default:
1617
- throw new TypeError('Must provide a hilo val of "<" or ">"');
1618
- }
1619
- if (ga(r, e, n))
1620
- return !1;
1621
- for (let u = 0; u < e.set.length; ++u) {
1622
- const b = e.set[u];
1623
- let g = null, p = null;
1624
- if (b.forEach((_) => {
1625
- _.semver === va && (_ = new yr(">=0.0.0")), g = g || _, p = p || _, s(_.semver, g.semver, n) ? g = _ : i(_.semver, p.semver, n) && (p = _);
1626
- }), g.operator === d || g.operator === c || (!p.operator || p.operator === d) && o(r, p.semver))
1627
- return !1;
1628
- if (p.operator === c && i(r, p.semver))
1629
- return !1;
1630
- }
1631
- return !0;
1632
- };
1633
- var gt = _a;
1634
- const Ea = gt, wa = (r, e, t) => Ea(r, e, ">", t);
1635
- var Ra = wa;
1636
- const Ia = gt, Aa = (r, e, t) => Ia(r, e, "<", t);
1637
- var Oa = Aa;
1638
- const Gt = oe(), Sa = (r, e, t) => (r = new Gt(r, t), e = new Gt(e, t), r.intersects(e, t));
1639
- var Pa = Sa;
1640
- const Ta = De, La = ae;
1641
- var Na = (r, e, t) => {
1642
- const n = [];
1643
- let s = null, o = null;
1644
- const i = r.sort((b, g) => La(b, g, t));
1645
- for (const b of i)
1646
- Ta(b, e, t) ? (o = b, s || (s = b)) : (o && n.push([s, o]), o = null, s = null);
1647
- s && n.push([s, null]);
1648
- const d = [];
1649
- for (const [b, g] of n)
1650
- b === g ? d.push(b) : !g && b === i[0] ? d.push("*") : g ? b === i[0] ? d.push(`<=${g}`) : d.push(`${b} - ${g}`) : d.push(`>=${b}`);
1651
- const c = d.join(" || "), u = typeof e.raw == "string" ? e.raw : String(e);
1652
- return c.length < u.length ? c : e;
1653
- };
1654
- const Bt = oe(), yt = Ue(), { ANY: Qe } = yt, we = De, $t = ae, Ca = (r, e, t = {}) => {
1655
- if (r === e)
1656
- return !0;
1657
- r = new Bt(r, t), e = new Bt(e, t);
1658
- let n = !1;
1659
- e:
1660
- for (const s of r.set) {
1661
- for (const o of e.set) {
1662
- const i = ka(s, o, t);
1663
- if (n = n || i !== null, i)
1664
- continue e;
1665
- }
1666
- if (n)
1667
- return !1;
1668
- }
1669
- return !0;
1670
- }, xa = [new yt(">=0.0.0-0")], Kt = [new yt(">=0.0.0")], ka = (r, e, t) => {
1671
- if (r === e)
1672
- return !0;
1673
- if (r.length === 1 && r[0].semver === Qe) {
1674
- if (e.length === 1 && e[0].semver === Qe)
1675
- return !0;
1676
- t.includePrerelease ? r = xa : r = Kt;
1677
- }
1678
- if (e.length === 1 && e[0].semver === Qe) {
1679
- if (t.includePrerelease)
1680
- return !0;
1681
- e = Kt;
1682
- }
1683
- const n = /* @__PURE__ */ new Set();
1684
- let s, o;
1685
- for (const _ of r)
1686
- _.operator === ">" || _.operator === ">=" ? s = qt(s, _, t) : _.operator === "<" || _.operator === "<=" ? o = Ht(o, _, t) : n.add(_.semver);
1687
- if (n.size > 1)
1688
- return null;
1689
- let i;
1690
- if (s && o) {
1691
- if (i = $t(s.semver, o.semver, t), i > 0)
1692
- return null;
1693
- if (i === 0 && (s.operator !== ">=" || o.operator !== "<="))
1694
- return null;
1695
- }
1696
- for (const _ of n) {
1697
- if (s && !we(_, String(s), t) || o && !we(_, String(o), t))
1698
- return null;
1699
- for (const $ of e)
1700
- if (!we(_, String($), t))
1701
- return !1;
1702
- return !0;
1703
- }
1704
- let d, c, u, b, g = o && !t.includePrerelease && o.semver.prerelease.length ? o.semver : !1, p = s && !t.includePrerelease && s.semver.prerelease.length ? s.semver : !1;
1705
- g && g.prerelease.length === 1 && o.operator === "<" && g.prerelease[0] === 0 && (g = !1);
1706
- for (const _ of e) {
1707
- if (b = b || _.operator === ">" || _.operator === ">=", u = u || _.operator === "<" || _.operator === "<=", s) {
1708
- if (p && _.semver.prerelease && _.semver.prerelease.length && _.semver.major === p.major && _.semver.minor === p.minor && _.semver.patch === p.patch && (p = !1), _.operator === ">" || _.operator === ">=") {
1709
- if (d = qt(s, _, t), d === _ && d !== s)
1710
- return !1;
1711
- } else if (s.operator === ">=" && !we(s.semver, String(_), t))
1712
- return !1;
1713
- }
1714
- if (o) {
1715
- if (g && _.semver.prerelease && _.semver.prerelease.length && _.semver.major === g.major && _.semver.minor === g.minor && _.semver.patch === g.patch && (g = !1), _.operator === "<" || _.operator === "<=") {
1716
- if (c = Ht(o, _, t), c === _ && c !== o)
1717
- return !1;
1718
- } else if (o.operator === "<=" && !we(o.semver, String(_), t))
1719
- return !1;
1720
- }
1721
- if (!_.operator && (o || s) && i !== 0)
1722
- return !1;
1723
- }
1724
- return !(s && u && !o && i !== 0 || o && b && !s && i !== 0 || p || g);
1725
- }, qt = (r, e, t) => {
1726
- if (!r)
1727
- return e;
1728
- const n = $t(r.semver, e.semver, t);
1729
- return n > 0 ? r : n < 0 || e.operator === ">" && r.operator === ">=" ? e : r;
1730
- }, Ht = (r, e, t) => {
1731
- if (!r)
1732
- return e;
1733
- const n = $t(r.semver, e.semver, t);
1734
- return n < 0 ? r : n > 0 || e.operator === "<" && r.operator === "<=" ? e : r;
1735
- };
1736
- var Va = Ca;
1737
- const et = Ie, zt = Fe, Fa = ee, Xt = hr, ja = $e, Ma = qn, Ua = Xn, Da = Wn, Ga = Zn, Ba = ts, Ka = ss, qa = is, Ha = cs, za = ae, Xa = ps, Ya = bs, Wa = pt, Ja = _s, Za = Rs, Qa = Me, eo = ht, to = vr, ro = br, no = vt, so = bt, ao = gr, oo = zs, io = Ue(), lo = oe(), uo = De, co = ea, fo = sa, mo = la, po = da, ho = pa, vo = gt, bo = Ra, go = Oa, yo = Pa, $o = Na, _o = Va;
1738
- var Eo = {
1739
- parse: ja,
1740
- valid: Ma,
1741
- clean: Ua,
1742
- inc: Da,
1743
- diff: Ga,
1744
- major: Ba,
1745
- minor: Ka,
1746
- patch: qa,
1747
- prerelease: Ha,
1748
- compare: za,
1749
- rcompare: Xa,
1750
- compareLoose: Ya,
1751
- compareBuild: Wa,
1752
- sort: Ja,
1753
- rsort: Za,
1754
- gt: Qa,
1755
- lt: eo,
1756
- eq: to,
1757
- neq: ro,
1758
- gte: no,
1759
- lte: so,
1760
- cmp: ao,
1761
- coerce: oo,
1762
- Comparator: io,
1763
- Range: lo,
1764
- satisfies: uo,
1765
- toComparators: co,
1766
- maxSatisfying: fo,
1767
- minSatisfying: mo,
1768
- minVersion: po,
1769
- validRange: ho,
1770
- outside: vo,
1771
- gtr: bo,
1772
- ltr: go,
1773
- intersects: yo,
1774
- simplifyRange: $o,
1775
- subset: _o,
1776
- SemVer: Fa,
1777
- re: et.re,
1778
- src: et.src,
1779
- tokens: et.t,
1780
- SEMVER_SPEC_VERSION: zt.SEMVER_SPEC_VERSION,
1781
- RELEASE_TYPES: zt.RELEASE_TYPES,
1782
- compareIdentifiers: Xt.compareIdentifiers,
1783
- rcompareIdentifiers: Xt.rcompareIdentifiers
1784
- };
1785
- const Yt = /* @__PURE__ */ lr(Eo);
1786
- var st = /* @__PURE__ */ ((r) => (r[r.menuV3 = 0] = "menuV3", r[r.applyEffectOnOrder = 1] = "applyEffectOnOrder", r[r.nestedAddon = 2] = "nestedAddon", r[r.feedmeDelivery = 3] = "feedmeDelivery", r[r.taxAndServiceChargeV4 = 4] = "taxAndServiceChargeV4", r[r.itemCombo = 5] = "itemCombo", r[r.itemTakeaway = 6] = "itemTakeaway", r[r.transferInventory = 7] = "transferInventory", r[r.qrEPayment = 8] = "qrEPayment", r[r.deliveryIntegration = 9] = "deliveryIntegration", r[r.rmsPayment = 10] = "rmsPayment", r[r.queue = 11] = "queue", r[r.paymentVoucher = 12] = "paymentVoucher", r))(st || {});
1787
- const $r = {
1788
- 0: "3.0.0-alpha",
1789
- 1: "3.5.0-alpha",
1790
- 2: "4.0.0-alpha",
1791
- 4: "4.0.0-alpha",
1792
- 5: "4.1.0-alpha",
1793
- // TODO: #475 make sure current pos version
1794
- 6: "4.3.10-alpha",
1795
- 7: "4.5.0-alpha",
1796
- 8: "6.9.0-alpha",
1797
- 9: "6.11.0-alpha",
1798
- 3: "6.12.0-alpha",
1799
- 10: "6.21.0-alpha",
1800
- 11: "6.21.0-alpha",
1801
- 12: "6.31.0-alpha"
1802
- };
1803
- function wo(r, e) {
1804
- return Yt.valid(e) && Yt.gte(e, $r[r]);
1805
- }
1806
- function Ro(r) {
1807
- return $r[r].replace("-alpha", "");
1808
- }
1809
- function Wt(r = "no name") {
1810
- return {
1811
- name: r,
1812
- address: {
1813
- line1: "",
1814
- line2: "",
1815
- state: "",
1816
- city: "",
1817
- postcode: "",
1818
- country: "",
1819
- coordinates: []
1820
- },
1821
- phoneNo: "",
1822
- regNo: "",
1823
- email: ""
1824
- };
1825
- }
1826
- function Jt() {
1827
- return Re({
1828
- line1: "",
1829
- line2: "",
1830
- city: "",
1831
- postcode: "",
1832
- state: "",
1833
- country: "",
1834
- coordinates: []
1835
- });
1836
- }
1837
- function Re(r) {
1838
- return {
1839
- ...r,
1840
- get formatted() {
1841
- const { line1: e, line2: t, postcode: n, city: s, state: o, country: i } = r;
1842
- return [e, t || "", n, s, o, i].map((d) => d.replace(/,\s*$/, "")).filter((d) => !!d.trim()).join(", ");
1843
- },
1844
- get isValidPostcode() {
1845
- const e = Number.parseInt(r.postcode);
1846
- return !isNaN(e);
1847
- },
1848
- get isValid() {
1849
- const e = ["line2"];
1850
- return Object.keys(r).filter((t) => !e.includes(t)).every((t) => !!r[t]);
1851
- },
1852
- get isValidCoordinate() {
1853
- return (r.coordinates || []).length === 2;
1854
- }
1855
- };
1856
- }
1857
- function Io({ posVersion: r, payoutAccount: e }) {
1858
- return !!r && wo(st.qrEPayment, r) ? !e || !e.enable ? "Payout account is required" : e.status !== dt.F_PAYOUT_ACCOUNT_STATUS.enum.APPROVED ? "Payout account under review" : !0 : `For POS ${Ro(st.qrEPayment)} or above`;
1859
- }
1860
- function _r(r) {
1861
- return {
1862
- id: r._id,
1863
- ...r,
1864
- profile: {
1865
- ...r.profile,
1866
- address: Re(r.profile.address)
1867
- },
1868
- allowEPayment: Io(r)
1869
- };
1870
- }
1871
- function tt(r) {
1872
- return _r(ft(r));
1873
- }
1874
- async function Zt(r) {
1875
- const e = ft(r), t = [];
1876
- for (const n of e)
1877
- t.push(await _r(n));
1878
- return t;
1879
- }
1880
- const ke = {
1881
- async readRestaurant(r) {
1882
- return await tt(await qe().get(`/restaurants/${r}`));
1883
- },
1884
- async readRestaurants() {
1885
- return await Zt(await He().get("/restaurants"));
1886
- },
1887
- async readRestaurantsByBusiness() {
1888
- return await Zt(await He().get("/restaurant-list"));
1889
- },
1890
- async createRestaurant(r) {
1891
- return await tt(await He().post("/restaurants", r));
1892
- },
1893
- async updateRestaurantProfile(r, e) {
1894
- return await tt(
1895
- await qe().put(`/restaurants/${r}/profile`, e)
1896
- );
1897
- },
1898
- async updateRestaurantAttributes(r, e) {
1899
- return ft(await qe().put(`/restaurants/${r}/attributes`, {
1900
- attributes: e
1901
- }));
1902
- }
1903
- }, Ao = /* @__PURE__ */ Q({
1904
- __name: "GoogleMap",
1905
- props: {
1906
- markers: {
1907
- type: Array,
1908
- default: () => []
1909
- },
1910
- polygons: {
1911
- type: Array,
1912
- default: () => []
1913
- },
1914
- zoom: {
1915
- type: Number,
1916
- default: 14
1917
- },
1918
- editable: {
1919
- type: Boolean,
1920
- default: !1
1921
- },
1922
- center: {
1923
- type: Object,
1924
- default: xe.jb
1925
- }
1926
- },
1927
- emits: ["map-click", "marker-change", "polygon-change", "polygon-right-click"],
1928
- setup(r, { expose: e, emit: t }) {
1929
- const n = r, s = t;
1930
- e({
1931
- setCenter: (a) => {
1932
- var l;
1933
- (l = i.value) == null || l.setCenter(a);
1934
- }
1935
- });
1936
- const o = ne(), i = ne(null), d = [];
1937
- function c(a) {
1938
- return {
1939
- lat: a.latLng.lat(),
1940
- lng: a.latLng.lng()
1941
- };
1942
- }
1943
- function u(a, l, v) {
1944
- const A = ve().maps.event.addListener(a, l, v);
1945
- d.push(A);
1946
- }
1947
- const b = ne([]);
1948
- function g(a, l, v) {
1949
- u(a, l, v);
1950
- }
1951
- function p(a) {
1952
- _(null), b.value = a.map((l, v) => {
1953
- const A = ve(), P = new A.maps.Marker({
1954
- position: l,
1955
- draggable: !0
1956
- });
1957
- return g(P, "dragend", (f) => {
1958
- s("marker-change", { index: v, position: c(f) });
1959
- }), P;
1960
- }), _(i.value);
1961
- }
1962
- function _(a) {
1963
- b.value.map((l) => wt(l).setMap(a));
1964
- }
1965
- const $ = ne([]);
1966
- function y(a, l, v) {
1967
- u(a, l, v);
1968
- }
1969
- function C(a, l, v) {
1970
- u(a, l, v);
1971
- }
1972
- function N(a) {
1973
- return $.value[a].getPath().getArray().map(({ lat: v, lng: A }) => ({
1974
- lat: v(),
1975
- lng: A()
1976
- }));
1977
- }
1978
- function k(a) {
1979
- const l = N(a);
1980
- s("polygon-change", { index: a, path: l });
1981
- }
1982
- function S(a, l) {
1983
- const A = N(a).filter((P, f) => f !== l);
1984
- s("polygon-change", { index: a, path: A });
1985
- }
1986
- function M(a, l) {
1987
- l.vertex !== void 0 ? S(a, l.vertex) : s("polygon-right-click", a);
1988
- }
1989
- function Y(a) {
1990
- W(null), $.value = a.map((l, v) => {
1991
- const A = ve(), P = new A.maps.Polygon({
1992
- paths: l.paths,
1993
- strokeColor: l.strokeColor,
1994
- fillColor: l.fillColor,
1995
- fillOpacity: 0.5,
1996
- editable: n.editable
1997
- });
1998
- return y(P, "contextmenu", (f) => M(v, f)), P.getPaths().forEach((f) => {
1999
- C(f, "insert_at", () => k(v)), C(f, "set_at", () => k(v));
2000
- }), P;
2001
- }), W(i.value);
2002
- }
2003
- function W(a) {
2004
- $.value.map((l) => wt(l).setMap(a));
2005
- }
2006
- function U(a, l, v) {
2007
- u(a, l, v);
2008
- }
2009
- function X() {
2010
- const a = ve().maps.Map;
2011
- i.value = new a(o.value, {
2012
- center: n.center,
2013
- zoom: n.zoom,
2014
- mapTypeControl: !1,
2015
- streetViewControl: !1,
2016
- draggable: !0,
2017
- scrollwheel: !0
2018
- }), U(i.value, "click", (l) => s("map-click", c(l)));
2019
- }
2020
- return Et(() => n.markers, p, { deep: !0 }), Et(() => n.polygons, Y, { deep: !0 }), Lr(() => {
2021
- !o.value || !ve() || (X(), p(n.markers), Y(n.polygons));
2022
- }), Nr(() => {
2023
- d.forEach((a) => a.remove());
2024
- }), (a, l) => (F(), K("div", {
2025
- ref_key: "mapRef",
2026
- ref: o,
2027
- class: "map app-map"
2028
- }, null, 512));
2029
- }
2030
- }), Oo = { class: "space-y-24" }, So = { class: "flex flex-row gap-8" }, Po = { class: "flex gap-8" }, To = { class: "flex gap-8" }, Lo = /* @__PURE__ */ Q({
2031
- __name: "CoordinateDialog",
2032
- props: {
2033
- address: {
2034
- type: String,
2035
- required: !0
2036
- },
2037
- coordinate: {
2038
- type: Object,
2039
- default: void 0
2040
- }
2041
- },
2042
- setup(r) {
2043
- const { t: e } = pe(), t = r, { emitData: n } = jr(), s = lt(
2044
- ge(t.coordinate ? t.coordinate : xe.jb)
2045
- );
2046
- function o({ position: i }) {
2047
- s.lat = i.lat, s.lng = i.lng, n(s);
2048
- }
2049
- return n(s), (i, d) => (F(), K("div", Oo, [
2050
- E("div", null, [
2051
- E("div", So, [
2052
- E("div", null, D(R(e)("settings.coordinate_dialog.address")) + ":", 1),
2053
- E("div", null, D(r.address || "--"), 1)
2054
- ]),
2055
- E("div", Po, [
2056
- E("div", null, D(R(e)("settings.coordinate_dialog.latitude")) + ":", 1),
2057
- E("div", null, D(s.lat), 1)
2058
- ]),
2059
- E("div", To, [
2060
- E("div", null, D(R(e)("settings.coordinate_dialog.longitude")) + ":", 1),
2061
- E("div", null, D(s.lng), 1)
2062
- ])
2063
- ]),
2064
- T(Ao, {
2065
- class: "w-full",
2066
- style: { height: "300px" },
2067
- editable: "",
2068
- center: s,
2069
- markers: [s],
2070
- onMarkerChange: o,
2071
- onMapClick: d[0] || (d[0] = (c) => o({ position: c }))
2072
- }, null, 8, ["center", "markers"])
2073
- ]));
2074
- }
2075
- }), No = /* @__PURE__ */ Q({
2076
- __name: "CoordinateInput",
2077
- props: {
2078
- modelValue: {
2079
- type: Array,
2080
- default: void 0
2081
- },
2082
- address: {
2083
- type: Object,
2084
- required: !0
2085
- },
2086
- required: {
2087
- type: Boolean,
2088
- default: !1
2089
- }
2090
- },
2091
- emits: ["update:model-value"],
2092
- setup(r, { emit: e }) {
2093
- const { t } = pe(), n = r, s = e, o = ar(), i = z(() => {
2094
- const g = n.modelValue || [];
2095
- return g.length < 2 ? null : Yr(g);
2096
- }), d = z(() => i.value ? `${i.value.lat}, ${i.value.lng}` : "");
2097
- async function c() {
2098
- const g = ve().maps.Geocoder, p = new g();
2099
- let _ = i.value;
2100
- _ || await new Promise(($) => {
2101
- n.address.formatted ? p.geocode({ address: n.address.formatted }, (y) => {
2102
- var N;
2103
- const C = (N = y == null ? void 0 : y[0]) == null ? void 0 : N.geometry;
2104
- _ = C ? { lng: C.location.lng(), lat: C.location.lat() } : xe.jb, $(!0);
2105
- }) : (_ = xe.jb, $(!0));
2106
- }), o.open({
2107
- contentComponent: Lo,
2108
- contentComponentProps: {
2109
- address: n.address.formatted,
2110
- coordinate: _
2111
- },
2112
- title: t("settings.coordinate_input.dialog.title"),
2113
- primaryActions: {
2114
- text: t("settings.coordinate_input.dialog.confirm"),
2115
- variant: "primary",
2116
- close: !0
2117
- },
2118
- secondaryActions: {
2119
- text: t("settings.coordinate_input.dialog.delete"),
2120
- variant: "destructive",
2121
- close: !0
2122
- }
2123
- }).onPrimary(async ($) => {
2124
- const y = $ ? Wr($) : [];
2125
- b(), s("update:model-value", y);
2126
- }).onSecondary(() => {
2127
- b(), s("update:model-value", []);
2128
- });
2129
- }
2130
- const u = ne(!1);
2131
- function b() {
2132
- u.value = !1;
2133
- }
2134
- return (g, p) => {
2135
- const _ = H("FmIcon"), $ = H("FmField"), y = H("FmFormGroup");
2136
- return F(), Z(y, {
2137
- modelValue: i.value,
2138
- "onUpdate:modelValue": p[0] || (p[0] = (C) => i.value = C),
2139
- label: R(t)("settings.coordinate_input.title")
2140
- }, {
2141
- default: q(() => [
2142
- T($, {
2143
- class: "cursor-pointer",
2144
- onClick: c
2145
- }, {
2146
- prepend: q(() => [
2147
- ue(g.$slots, "prepend")
2148
- ]),
2149
- append: q(() => [
2150
- T(_, {
2151
- class: "text-fm-color-neutral-gray-400",
2152
- name: "location_on",
2153
- outline: "",
2154
- size: "md"
2155
- })
2156
- ]),
2157
- default: q(() => [
2158
- ue(g.$slots, "default", {}, () => [
2159
- E("div", {
2160
- class: J([[i.value ? "text-fm-color-typo-primary" : "text-fm-color-typo-tertiary"], "break-all fm-typo-en-body-lg-400 line-clamp-1"])
2161
- }, D(i.value ? d.value : R(t)("settings.coordinate_input.not_set")), 3)
2162
- ])
2163
- ]),
2164
- _: 3
2165
- })
2166
- ]),
2167
- _: 3
2168
- }, 8, ["modelValue", "label"]);
2169
- };
2170
- }
2171
- }), Co = { class: "w-[140px] pt-16" }, xo = { class: "pl-32" }, ko = {
2172
- key: 1,
2173
- class: "flex gap-8 items-center my-8"
2174
- }, Vo = /* @__PURE__ */ Q({
2175
- __name: "OperationHoursInput",
2176
- props: {
2177
- modelValue: {
2178
- type: Object,
2179
- default: void 0
2180
- },
2181
- title: {
2182
- type: String,
2183
- required: !1
2184
- }
2185
- },
2186
- emits: ["update:model-value"],
2187
- setup(r, { emit: e }) {
2188
- const t = r, n = e, s = ut(), { t: o } = pe();
2189
- ct().startOf("week");
2190
- const i = z(
2191
- () => [
2192
- o("settings.operation_hours.mon"),
2193
- o("settings.operation_hours.tue"),
2194
- o("settings.operation_hours.wed"),
2195
- o("settings.operation_hours.thu"),
2196
- o("settings.operation_hours.fri"),
2197
- o("settings.operation_hours.sat"),
2198
- o("settings.operation_hours.sun")
2199
- ].map((N, k) => ({
2200
- key: k.toString(),
2201
- label: N,
2202
- value: k < 6 ? k + 1 : 0,
2203
- // key of OperatingHours, since data start from sunday, UI start from monday
2204
- slot: `checkbox-${k}-end`
2205
- }))
2206
- ), d = z(
2207
- () => t.modelValue ? Object.values(t.modelValue) : Array.from(Array(7)).map(() => ({
2208
- enable: !1,
2209
- hours: []
2210
- }))
2211
- ), c = z(() => Object.values(d.value).map((N) => N.hours)), u = z(() => d.value.reduce((N, k, S) => (k.hours.length > 0 && N.push(S), N), []));
2212
- function b() {
2213
- return { start: "00:00", end: "23:59" };
2214
- }
2215
- function g(N) {
2216
- const k = u.value.find((M) => !N.includes(M));
2217
- if (k !== void 0) {
2218
- C((M) => (M[k].enable = !1, M[k].hours = [], M));
2219
- return;
2220
- }
2221
- const S = N.find((M) => !u.value.includes(M));
2222
- S !== void 0 && d.value[S].hours.length === 0 && C((M) => (M[S].enable = !0, M[S].hours = [b()], M));
2223
- }
2224
- function p(N) {
2225
- C((k) => (k[N].hours.push(b()), k));
2226
- }
2227
- function _(N, k) {
2228
- c.value[N].length > 1 ? C((S) => (S[N].hours.splice(k, 1), S)) : s.open({ title: o("settings.operation_hours.cannot_remove_last"), type: "error" });
2229
- }
2230
- function $(N, k, S) {
2231
- S && C((M) => (M[N].hours[k].start = S, M));
2232
- }
2233
- function y(N, k, S) {
2234
- S && C((M) => (M[N].hours[k].end = S, M));
2235
- }
2236
- function C(N) {
2237
- const k = N(ge(d.value)), S = {
2238
- 0: k[0],
2239
- 1: k[1],
2240
- 2: k[2],
2241
- 3: k[3],
2242
- 4: k[4],
2243
- 5: k[5],
2244
- 6: k[6]
2245
- };
2246
- n("update:model-value", S);
2247
- }
2248
- return (N, k) => {
2249
- const S = H("FmCheckbox"), M = H("FmTimePicker"), Y = H("FmButton"), W = H("FmField");
2250
- return F(), K("div", null, [
2251
- (F(!0), K(se, null, me(i.value, (U) => (F(), K("div", {
2252
- key: U.value,
2253
- class: "flex flex-col items-start"
2254
- }, [
2255
- E("div", Co, [
2256
- T(S, {
2257
- "model-value": u.value,
2258
- label: U.label,
2259
- value: U.value,
2260
- "onUpdate:modelValue": g
2261
- }, null, 8, ["model-value", "label", "value"])
2262
- ]),
2263
- E("div", xo, [
2264
- E("div", null, [
2265
- u.value.includes(U.value) ? (F(!0), K(se, { key: 0 }, me(c.value[U.value], (X, a) => (F(), K("div", {
2266
- key: a,
2267
- class: "flex items-center gap-8"
2268
- }, [
2269
- T(M, {
2270
- "model-value": X.start,
2271
- "onUpdate:modelValue": (l) => $(U.value, a, l)
2272
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
2273
- E("span", {
2274
- class: J([["text-fm-color-typo-tertiary"], "fm-typo-en-body-lg-400"])
2275
- }, D(R(o)("settings.operation_hours.to")), 1),
2276
- T(M, {
2277
- "model-value": X.end,
2278
- "onUpdate:modelValue": (l) => y(U.value, a, l)
2279
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
2280
- T(Y, {
2281
- icon: "close",
2282
- variant: "tertiary",
2283
- onClick: (l) => _(U.value, a)
2284
- }, null, 8, ["onClick"]),
2285
- T(Y, {
2286
- class: J(a === 0 ? "" : "invisible"),
2287
- icon: "add",
2288
- color: "primary",
2289
- variant: "secondary",
2290
- onClick: (l) => p(U.value)
2291
- }, null, 8, ["class", "onClick"])
2292
- ]))), 128)) : (F(), K("div", ko, [
2293
- T(W, null, {
2294
- default: q(() => [
2295
- E("div", {
2296
- class: J([["text-fm-color-typo-tertiary"], "break-all fm-typo-en-body-lg-400 line-clamp-1"])
2297
- }, D(R(o)("settings.operation_hours.close")), 1)
2298
- ]),
2299
- _: 1
2300
- }),
2301
- E("span", {
2302
- class: J([["text-fm-color-typo-tertiary"], "fm-typo-en-body-lg-400"])
2303
- }, D(R(o)("settings.operation_hours.to")), 1),
2304
- T(W, null, {
2305
- default: q(() => [
2306
- E("div", {
2307
- class: J([["text-fm-color-typo-tertiary"], "break-all fm-typo-en-body-lg-400 line-clamp-1"])
2308
- }, D(R(o)("settings.operation_hours.close")), 1)
2309
- ]),
2310
- _: 1
2311
- })
2312
- ]))
2313
- ])
2314
- ])
2315
- ]))), 128))
2316
- ]);
2317
- };
2318
- }
2319
- }), Fo = { class: "space-y-24" }, jo = { class: "flex gap-16 xs:flex-col xs:gap-24" }, Mo = { class: "flex-1" }, Uo = { class: "flex-1" }, Do = { class: "flex gap-16 xs:flex-col xs:gap-24" }, Go = { class: "flex-1" }, Bo = { class: "flex-1" }, Ko = { class: "flex gap-16 xs:flex-col xs:gap-24" }, qo = { class: "flex-1" }, Ho = { class: "flex-1" }, zo = /* @__PURE__ */ Q({
2320
- __name: "RestaurantAddress",
2321
- props: {
2322
- modelValue: {
2323
- type: Object,
2324
- required: !0
2325
- }
2326
- },
2327
- emits: ["update:model-value"],
2328
- setup(r, { emit: e }) {
2329
- const { t } = pe();
2330
- Jt();
2331
- const n = r, s = e, o = z(() => ge(n.modelValue || Jt()));
2332
- function i(c) {
2333
- return (c || "").toString();
2334
- }
2335
- function d(c) {
2336
- s("update:model-value", c(o.value));
2337
- }
2338
- return (c, u) => {
2339
- const b = H("FmTextField");
2340
- return F(), K("div", Fo, [
2341
- E("div", jo, [
2342
- E("div", Mo, [
2343
- T(b, {
2344
- "model-value": o.value.line1,
2345
- label: R(t)("settings.address.line1"),
2346
- "label-mark": "required",
2347
- rules: [R(ce)],
2348
- "onUpdate:modelValue": u[0] || (u[0] = (g) => d((p) => ({ ...p, line1: i(g) })))
2349
- }, null, 8, ["model-value", "label", "rules"])
2350
- ]),
2351
- E("div", Uo, [
2352
- T(b, {
2353
- "model-value": o.value.line2,
2354
- label: R(t)("settings.address.line2"),
2355
- "onUpdate:modelValue": u[1] || (u[1] = (g) => d((p) => ({ ...p, line2: i(g) })))
2356
- }, null, 8, ["model-value", "label"])
2357
- ])
2358
- ]),
2359
- E("div", Do, [
2360
- E("div", Go, [
2361
- T(b, {
2362
- "model-value": o.value.city,
2363
- rules: [R(ce)],
2364
- label: R(t)("settings.address.city"),
2365
- "label-mark": "required",
2366
- "onUpdate:modelValue": u[2] || (u[2] = (g) => d((p) => ({ ...p, city: i(g) })))
2367
- }, null, 8, ["model-value", "rules", "label"])
2368
- ]),
2369
- E("div", Bo, [
2370
- T(b, {
2371
- "model-value": o.value.postcode,
2372
- label: R(t)("settings.address.postal_code"),
2373
- "label-mark": "required",
2374
- rules: [R(ce)],
2375
- "onUpdate:modelValue": u[3] || (u[3] = (g) => d((p) => ({ ...p, postcode: i(g) })))
2376
- }, null, 8, ["model-value", "label", "rules"])
2377
- ])
2378
- ]),
2379
- E("div", Ko, [
2380
- E("div", qo, [
2381
- T(b, {
2382
- "model-value": o.value.state,
2383
- label: R(t)("settings.address.state"),
2384
- "label-mark": "required",
2385
- rules: [R(ce)],
2386
- "onUpdate:modelValue": u[4] || (u[4] = (g) => d((p) => ({ ...p, state: i(g) })))
2387
- }, null, 8, ["model-value", "label", "rules"])
2388
- ]),
2389
- E("div", Ho, [
2390
- T(b, {
2391
- "model-value": o.value.country,
2392
- label: R(t)("settings.address.country"),
2393
- "label-mark": "required",
2394
- rules: [R(ce)],
2395
- "onUpdate:modelValue": u[5] || (u[5] = (g) => d((p) => ({ ...p, country: i(g) })))
2396
- }, null, 8, ["model-value", "label", "rules"])
2397
- ])
2398
- ])
2399
- ]);
2400
- };
2401
- }
2402
- });
2403
- class Xo {
2404
- constructor(e, t) {
2405
- Be(this, "restaurant");
2406
- Be(this, "data");
2407
- this.restaurant = e, this.data = t;
2408
- }
2409
- generateUrl(e) {
2410
- const t = e === "normal" ? ct().toISOString() : "photo";
2411
- return `restaurant/${this.restaurant.id}/${e}/${t}`;
2412
- }
2413
- async manageThumbnail() {
2414
- const { newThumbnailPhoto: e, thumbnailPhoto: t } = this.data;
2415
- if (e) {
2416
- const s = await de.update(this.generateUrl("thumbnail"), e, {
2417
- includedTime: !0
2418
- });
2419
- this.data.thumbnailPhoto = s;
2420
- return;
2421
- }
2422
- const n = this.restaurant.profile.thumbnailPhoto;
2423
- n && !t && (await de.delete(n), this.data.thumbnailPhoto = void 0);
2424
- }
2425
- async manageCover() {
2426
- const { newCoverPhoto: e, coverPhoto: t } = this.data;
2427
- if (e) {
2428
- const s = await de.update(this.generateUrl("cover"), e, {
2429
- includedTime: !0
2430
- });
2431
- this.data.coverPhoto = s;
2432
- return;
2433
- }
2434
- const n = this.restaurant.profile.coverPhoto;
2435
- n && !t && (await de.delete(n), this.data.coverPhoto = void 0);
2436
- }
2437
- async manageCarousels() {
2438
- const e = this.data.newPhotos || [];
2439
- for (const t of e) {
2440
- const n = await de.update(this.generateUrl("normal"), t);
2441
- this.data.photos = [...this.data.photos || [], n];
2442
- }
2443
- }
2444
- async run() {
2445
- return await this.manageThumbnail(), await this.manageCover(), await this.manageCarousels(), this.data;
2446
- }
2447
- }
2448
- async function Qt(r, e) {
2449
- const t = new Xo(r, e);
2450
- await t.run(), await ke.updateRestaurantProfile(r.id, t.data), await fe().readRestaurants();
2451
- }
2452
- const Yo = () => {
2453
- const r = fe();
2454
- return {
2455
- async createRestaurant(e, t, n) {
2456
- const s = await ke.createRestaurant({
2457
- businessId: e,
2458
- features: [],
2459
- profile: t
2460
- });
2461
- n && await ke.updateRestaurantAttributes(s.id, n), await Qt(s, t), await r.readRestaurants();
2462
- },
2463
- async updateRestaurantProfile(e, t) {
2464
- await Qt(e, t);
2465
- }
2466
- };
2467
- }, Wo = { class: "flex justify-center" }, Jo = { class: "space-y-24" }, Zo = { class: "space-y-24" }, Qo = { class: "flex gap-16 xs:flex-col xs:gap-24" }, ei = { class: "flex-1" }, ti = { class: "flex-1" }, ri = { class: "space-y-24" }, ni = { class: "space-y-24" }, si = { class: "space-y-8" }, ai = { class: "space-y-24" }, er = /* @__PURE__ */ Q({
2468
- __name: "RestaurantForm",
2469
- props: {
2470
- restaurantId: {
2471
- type: String,
2472
- default: void 0
2473
- },
2474
- restaurant: {
2475
- type: Object
2476
- },
2477
- initialValue: {
2478
- type: Object,
2479
- default: void 0
2480
- },
2481
- enableFeedmeExpress: {
2482
- type: Boolean,
2483
- required: !0
2484
- }
2485
- },
2486
- setup(r, { expose: e }) {
2487
- var I;
2488
- const t = r, { restaurants: n, currentBusiness: s, restaurantAttributeSettings: o } = fe(), i = ut(), d = ur(i), { copyTextToClipboard: c } = ir(), u = ne(!1), b = (w, h) => {
2489
- u.value = !u.value;
2490
- }, g = z(() => {
2491
- var w;
2492
- return (w = t.restaurant) == null ? void 0 : w.profile;
2493
- }), p = lt(
2494
- g.value ? ge(g.value) : {
2495
- ...Wt(),
2496
- address: Re(Wt().address),
2497
- legalName: "",
2498
- sstRegNo: "",
2499
- description: "",
2500
- url: "",
2501
- thumbnailPhoto: void 0,
2502
- coverPhoto: void 0,
2503
- newThumbnailPhoto: void 0,
2504
- newCoverPhoto: void 0,
2505
- newPhotos: [],
2506
- operatingHours: {
2507
- 0: {
2508
- enable: !1,
2509
- hours: []
2510
- },
2511
- 1: {
2512
- enable: !1,
2513
- hours: []
2514
- },
2515
- 2: {
2516
- enable: !1,
2517
- hours: []
2518
- },
2519
- 3: {
2520
- enable: !1,
2521
- hours: []
2522
- },
2523
- 4: {
2524
- enable: !1,
2525
- hours: []
2526
- },
2527
- 5: {
2528
- enable: !1,
2529
- hours: []
2530
- },
2531
- 6: {
2532
- enable: !1,
2533
- hours: []
2534
- }
2535
- }
2536
- }
2537
- ), _ = "https://feedmedev.cc/", $ = z(() => fe().currentCountry.value), { t: y } = pe(), C = ne(
2538
- t.restaurantId ? y("settings.business.restaurant.form.title.update") : y("settings.business.restaurant.form.title.add")
2539
- ), N = ne(((I = t.restaurant) == null ? void 0 : I.customAttributes) || {});
2540
- async function k(w) {
2541
- Object.values(N.value).length !== 0 && await ke.updateRestaurantAttributes(w, N.value);
2542
- }
2543
- const S = z(() => Re(p.address)), M = z(() => S.value.formatted);
2544
- function Y(w) {
2545
- var h;
2546
- if (typeof w == "string") {
2547
- const O = (h = n.value.find((x) => x._id === w)) == null ? void 0 : h.profile.operatingHours;
2548
- O ? p.operatingHours = ge(O) : i.open({
2549
- title: y("settings.business.restaurant.form.sections.operation_hours.invalid"),
2550
- type: "error"
2551
- });
2552
- }
2553
- }
2554
- function W() {
2555
- const w = _ + (p.url || t.restaurantId);
2556
- c(w);
2557
- }
2558
- function U() {
2559
- p.thumbnailPhoto = void 0, p.newThumbnailPhoto = void 0;
2560
- }
2561
- function X() {
2562
- p.coverPhoto = void 0, p.newCoverPhoto = void 0;
2563
- }
2564
- function a(w) {
2565
- p.newPhotos = p.newPhotos || [], p.newPhotos.push(w);
2566
- }
2567
- const l = Yo();
2568
- function v() {
2569
- var w, h;
2570
- if (b(), t.restaurantId) {
2571
- if (!((w = s.value) != null && w.id))
2572
- return;
2573
- d.minor(async () => {
2574
- var O, x;
2575
- t.restaurant && (await k(t.restaurantId), await l.updateRestaurantProfile(t.restaurant, {
2576
- ...p,
2577
- url: ((O = p.url) == null ? void 0 : O.trim()) || null,
2578
- code: ((x = p.code) == null ? void 0 : x.trim()) || null
2579
- }), y("settings.business.restaurant.form.message.updated"));
2580
- });
2581
- } else {
2582
- if (!((h = s.value) != null && h.id))
2583
- return;
2584
- d.minor(async () => {
2585
- var O, x;
2586
- await l.createRestaurant(
2587
- s.value.id,
2588
- {
2589
- ...p,
2590
- url: ((O = p.url) == null ? void 0 : O.trim()) || null,
2591
- code: ((x = p.code) == null ? void 0 : x.trim()) || null
2592
- },
2593
- N.value
2594
- ), y("settings.business.restaurant.form.message.created");
2595
- });
2596
- }
2597
- }
2598
- const A = z(() => ({
2599
- title: y("settings.business.restaurant.form.summary.title"),
2600
- items: [
2601
- {
2602
- name: y("settings.business.restaurant.form.summary.name"),
2603
- value: p.name
2604
- },
2605
- {
2606
- name: y("settings.business.restaurant.form.summary.legal_name"),
2607
- value: p.legalName
2608
- },
2609
- {
2610
- name: y("settings.business.restaurant.form.summary.contact"),
2611
- value: p.phoneNo
2612
- },
2613
- {
2614
- name: y("settings.business.restaurant.form.summary.address"),
2615
- value: M.value
2616
- }
2617
- ]
2618
- })), { isAtMost: P } = or();
2619
- z(() => P("sm"));
2620
- const f = ne(null), m = Jr(f);
2621
- return e({ trigger: b }), (w, h) => {
2622
- const O = H("FmTextField"), x = H("FmPhoneNumber"), G = H("FmTextarea"), V = H("FmButton");
2623
- return F(), K(se, null, [
2624
- ue(w.$slots, "trigger", Cr(xr({
2625
- trigger: b
2626
- }))),
2627
- T(Pn, {
2628
- title: C.value,
2629
- show: u.value,
2630
- "primary-action": { label: R(y)("common.save") },
2631
- "secondary-actions": [
2632
- { label: R(y)("settings.business.restaurant.actions.discard"), click: () => u.value = !1 }
2633
- ],
2634
- onOnPrimary: v,
2635
- onOnCancel: h[17] || (h[17] = (L) => u.value = !1)
2636
- }, {
2637
- "append-title": q(() => [
2638
- R(P)("sm") ? (F(), Z(Ot, {
2639
- key: 0,
2640
- variant: "dialog",
2641
- title: A.value.title,
2642
- items: A.value.items
2643
- }, null, 8, ["title", "items"])) : le("", !0)
2644
- ]),
2645
- default: q(() => [
2646
- E("div", Wo, [
2647
- E("div", {
2648
- ref_key: "formWrapper",
2649
- ref: f,
2650
- class: "py-24 pr-[400px] w-[1150px] xs:pr-0 sm:pr-0 xs:w-full"
2651
- }, [
2652
- R(P)("sm") ? le("", !0) : (F(), Z(Ot, {
2653
- key: 0,
2654
- class: "fixed",
2655
- style: Ce({
2656
- top: "85px",
2657
- left: R(m).right - 400 + "px"
2658
- }),
2659
- variant: "full",
2660
- title: A.value.title,
2661
- items: A.value.items
2662
- }, null, 8, ["style", "title", "items"])),
2663
- E("div", Jo, [
2664
- T(Ee, {
2665
- title: R(y)("settings.business.restaurant.form.sections.basic_info.title")
2666
- }, {
2667
- default: q(() => {
2668
- var L, B;
2669
- return [
2670
- E("div", Zo, [
2671
- E("div", null, [
2672
- T(O, {
2673
- label: R(y)("settings.business.restaurant.form.sections.basic_info.code.label"),
2674
- modelValue: p.code,
2675
- "onUpdate:modelValue": h[0] || (h[0] = (j) => p.code = j),
2676
- "label-mark": "optional",
2677
- "helper-text": R(y)("settings.business.restaurant.form.sections.basic_info.code.helper"),
2678
- disabled: ((L = g.value) == null ? void 0 : L.code) !== void 0 && ((B = g.value) == null ? void 0 : B.code) !== null
2679
- }, null, 8, ["label", "modelValue", "helper-text", "disabled"])
2680
- ]),
2681
- E("div", null, [
2682
- T(O, {
2683
- label: R(y)("settings.business.restaurant.form.sections.basic_info.name.label"),
2684
- modelValue: p.name,
2685
- "onUpdate:modelValue": h[1] || (h[1] = (j) => p.name = j),
2686
- "label-mark": "required",
2687
- rules: [R(ce)]
2688
- }, null, 8, ["label", "modelValue", "rules"])
2689
- ]),
2690
- E("div", null, [
2691
- T(O, {
2692
- label: R(y)("settings.business.restaurant.form.sections.basic_info.legal_name.label"),
2693
- modelValue: p.legalName,
2694
- "onUpdate:modelValue": h[2] || (h[2] = (j) => p.legalName = j),
2695
- "label-mark": "required",
2696
- rules: [R(ce)]
2697
- }, null, 8, ["label", "modelValue", "rules"])
2698
- ]),
2699
- E("div", null, [
2700
- T(O, {
2701
- label: R(y)("settings.business.restaurant.form.sections.basic_info.reg_no.label"),
2702
- modelValue: p.regNo,
2703
- "onUpdate:modelValue": h[3] || (h[3] = (j) => p.regNo = j),
2704
- "label-mark": "required",
2705
- rules: [R(ce)]
2706
- }, null, 8, ["label", "modelValue", "rules"])
2707
- ]),
2708
- E("div", null, [
2709
- T(O, {
2710
- modelValue: p.sstRegNo,
2711
- "onUpdate:modelValue": h[4] || (h[4] = (j) => p.sstRegNo = j),
2712
- label: R(y)("settings.business.restaurant.form.sections.basic_info.tax_no.label"),
2713
- "label-mark": "optional"
2714
- }, null, 8, ["modelValue", "label"])
2715
- ]),
2716
- E("div", Qo, [
2717
- E("div", ei, [
2718
- T(x, {
2719
- class: "w-full",
2720
- label: R(y)("settings.business.restaurant.form.sections.basic_info.contact.label"),
2721
- modelValue: p.phoneNo,
2722
- "onUpdate:modelValue": h[5] || (h[5] = (j) => p.phoneNo = j),
2723
- "label-mark": "optional"
2724
- }, null, 8, ["label", "modelValue"])
2725
- ]),
2726
- E("div", ti, [
2727
- T(O, {
2728
- class: "w-full",
2729
- modelValue: p.email,
2730
- "onUpdate:modelValue": h[6] || (h[6] = (j) => p.email = j),
2731
- label: R(y)("settings.business.restaurant.form.sections.basic_info.email.label"),
2732
- "label-mark": "optional"
2733
- }, null, 8, ["modelValue", "label"])
2734
- ])
2735
- ]),
2736
- E("div", null, [
2737
- T(be, {
2738
- label: R(y)("settings.business.restaurant.form.sections.basic_info.image.label"),
2739
- "sub-label": R(y)("settings.business.restaurant.form.sections.basic_info.image.optional"),
2740
- "previous-url": p.thumbnailPhoto,
2741
- modelValue: p.newThumbnailPhoto,
2742
- "onUpdate:modelValue": h[7] || (h[7] = (j) => p.newThumbnailPhoto = j),
2743
- "onReset:modelValue": U
2744
- }, null, 8, ["label", "sub-label", "previous-url", "modelValue"])
2745
- ])
2746
- ])
2747
- ];
2748
- }),
2749
- _: 1
2750
- }, 8, ["title"]),
2751
- R(o).length > 0 ? (F(), K(se, { key: 0 }, [
2752
- h[18] || (h[18] = E("div", { class: "w-full h-[2px] bg-fm-color-neutral-gray-100" }, null, -1)),
2753
- T(Ee, {
2754
- title: R(y)("settings.restaurantTagging.title"),
2755
- "sub-title": R(y)("settings.restaurantTagging.subtitle")
2756
- }, {
2757
- default: q(() => [
2758
- T(R(Vr), {
2759
- entity: "restaurant",
2760
- modelValue: N.value,
2761
- "onUpdate:modelValue": h[8] || (h[8] = (L) => N.value = L)
2762
- }, null, 8, ["modelValue"])
2763
- ]),
2764
- _: 1
2765
- }, 8, ["title", "sub-title"])
2766
- ], 64)) : le("", !0),
2767
- h[19] || (h[19] = E("div", { class: "w-full h-[2px] bg-fm-color-neutral-gray-100" }, null, -1)),
2768
- T(Ee, {
2769
- title: R(y)("settings.business.restaurant.form.sections.address.title")
2770
- }, {
2771
- default: q(() => [
2772
- E("div", ri, [
2773
- T(zo, {
2774
- modelValue: p.address,
2775
- "onUpdate:modelValue": h[9] || (h[9] = (L) => p.address = L)
2776
- }, null, 8, ["modelValue"]),
2777
- T(No, {
2778
- address: S.value,
2779
- modelValue: p.address.coordinates,
2780
- "onUpdate:modelValue": h[10] || (h[10] = (L) => p.address.coordinates = L)
2781
- }, null, 8, ["address", "modelValue"])
2782
- ])
2783
- ]),
2784
- _: 1
2785
- }, 8, ["title"]),
2786
- h[20] || (h[20] = E("div", { class: "w-full h-[2px] bg-fm-color-neutral-gray-100" }, null, -1)),
2787
- T(Ee, {
2788
- title: R(y)("settings.business.restaurant.form.sections.operation_hours.title")
2789
- }, {
2790
- default: q(() => [
2791
- E("div", ni, [
2792
- E("div", si, [
2793
- T(It, {
2794
- label: R(y)("settings.business.restaurant.form.sections.operation_hours.copy_with"),
2795
- optional: !1
2796
- }, null, 8, ["label"]),
2797
- T(Mr, {
2798
- class: "w-[320px]",
2799
- "exclude-restaurants": [r.restaurantId ?? ""],
2800
- "model-value": "",
2801
- "onUpdate:modelValue": h[11] || (h[11] = (L) => Y(L))
2802
- }, null, 8, ["exclude-restaurants"]),
2803
- T(Vo, {
2804
- modelValue: p.operatingHours,
2805
- "onUpdate:modelValue": h[12] || (h[12] = (L) => p.operatingHours = L)
2806
- }, null, 8, ["modelValue"])
2807
- ])
2808
- ])
2809
- ]),
2810
- _: 1
2811
- }, 8, ["title"]),
2812
- h[21] || (h[21] = E("div", { class: "w-full h-[2px] bg-fm-color-neutral-gray-100" }, null, -1)),
2813
- T(Ee, {
2814
- title: R(y)("settings.business.restaurant.form.sections.branding.title")
2815
- }, {
2816
- default: q(() => [
2817
- E("div", ai, [
2818
- T(G, {
2819
- label: R(y)("settings.business.restaurant.form.sections.branding.description"),
2820
- "model-value": p.description ?? "",
2821
- "onUpdate:modelValue": h[13] || (h[13] = (L) => p.description = L)
2822
- }, null, 8, ["label", "model-value"]),
2823
- T(O, {
2824
- label: R(y)("settings.business.restaurant.form.sections.branding.url.label"),
2825
- placeholder: r.restaurantId,
2826
- "model-value": p.url,
2827
- "onUpdate:modelValue": h[14] || (h[14] = (L) => p.url = L),
2828
- rules: [
2829
- (L) => {
2830
- var B;
2831
- return !L || ((B = g.value) == null ? void 0 : B.url) == p.url || $.value == R(dt.F_COUNTRY).enum.MY || R(y)("settings.business.restaurant.form.sections.branding.url.errors.disabled");
2832
- },
2833
- (L) => !L || R(dr).test(L) || R(y)("settings.business.restaurant.form.sections.branding.url.errors.invalid"),
2834
- (L) => !L || !R(fr).includes(L) || R(y)("settings.business.restaurant.form.sections.branding.url.errors.reserved")
2835
- ]
2836
- }, {
2837
- prepend: q(() => [
2838
- E("span", null, D(_))
2839
- ]),
2840
- append: q(() => [
2841
- T(V, {
2842
- variant: "tertiary",
2843
- icon: "file_copy",
2844
- "text-color": "neutral-gray-400",
2845
- onClick: W
2846
- })
2847
- ]),
2848
- _: 1
2849
- }, 8, ["label", "placeholder", "model-value", "rules"]),
2850
- E("div", null, [
2851
- T(be, {
2852
- label: R(y)("settings.business.form.cover_photo.label"),
2853
- "previous-url": p.coverPhoto,
2854
- modelValue: p.newCoverPhoto,
2855
- "onUpdate:modelValue": h[15] || (h[15] = (L) => p.newCoverPhoto = L),
2856
- "onReset:modelValue": X
2857
- }, null, 8, ["label", "previous-url", "modelValue"])
2858
- ]),
2859
- E("div", null, [
2860
- T(It, {
2861
- label: R(y)("settings.business.restaurant.form.sections.branding.carousel_photos.label")
2862
- }, null, 8, ["label"]),
2863
- (F(!0), K(se, null, me(p.photos || [], (L, B) => (F(), Z(be, {
2864
- key: B,
2865
- "previous-url": L,
2866
- "model-value": void 0,
2867
- "onReset:modelValue": (j) => {
2868
- var te;
2869
- return (te = p.photos) == null ? void 0 : te.splice(B, 1);
2870
- }
2871
- }, null, 8, ["previous-url", "onReset:modelValue"]))), 128)),
2872
- (F(!0), K(se, null, me(p.newPhotos || [], (L, B) => {
2873
- var j;
2874
- return F(), Z(be, {
2875
- key: B,
2876
- "model-value": ((j = p.newPhotos) == null ? void 0 : j[B]) || void 0,
2877
- "previous-url": void 0,
2878
- "onReset:modelValue": (te) => {
2879
- var _e;
2880
- return (_e = p.photos) == null ? void 0 : _e.splice(B, 1);
2881
- }
2882
- }, null, 8, ["model-value", "onReset:modelValue"]);
2883
- }), 128)),
2884
- T(be, {
2885
- "model-value": void 0,
2886
- "previous-url": void 0,
2887
- "onUpdate:modelValue": h[16] || (h[16] = (L) => a(L))
2888
- })
2889
- ])
2890
- ])
2891
- ]),
2892
- _: 1
2893
- }, 8, ["title"])
2894
- ])
2895
- ], 512)
2896
- ])
2897
- ]),
2898
- _: 1
2899
- }, 8, ["title", "show", "primary-action", "secondary-actions"])
2900
- ], 64);
2901
- };
2902
- }
2903
- }), oi = (r) => {
2904
- const e = ne(r || "");
2905
- function t(o) {
2906
- return `${o}`.trim().toLowerCase();
2907
- }
2908
- const n = z(() => t(e.value));
2909
- function s(o) {
2910
- return n.value ? o.some((i) => t(i).includes(n.value)) : !0;
2911
- }
2912
- return { searchKey: e, filter: s };
2913
- };
2914
- var Er = { exports: {} };
2915
- (function(r, e) {
2916
- (function(t, n) {
2917
- r.exports = n();
2918
- })(Br, function() {
2919
- return function(t) {
2920
- var n = {};
2921
- function s(o) {
2922
- if (n[o])
2923
- return n[o].exports;
2924
- var i = n[o] = { i: o, l: !1, exports: {} };
2925
- return t[o].call(i.exports, i, i.exports, s), i.l = !0, i.exports;
2926
- }
2927
- return s.m = t, s.c = n, s.d = function(o, i, d) {
2928
- s.o(o, i) || Object.defineProperty(o, i, { enumerable: !0, get: d });
2929
- }, s.r = function(o) {
2930
- typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
2931
- }, s.t = function(o, i) {
2932
- if (1 & i && (o = s(o)), 8 & i || 4 & i && typeof o == "object" && o && o.__esModule)
2933
- return o;
2934
- var d = /* @__PURE__ */ Object.create(null);
2935
- if (s.r(d), Object.defineProperty(d, "default", { enumerable: !0, value: o }), 2 & i && typeof o != "string")
2936
- for (var c in o)
2937
- s.d(
2938
- d,
2939
- c,
2940
- (function(u) {
2941
- return o[u];
2942
- }).bind(null, c)
2943
- );
2944
- return d;
2945
- }, s.n = function(o) {
2946
- var i = o && o.__esModule ? function() {
2947
- return o.default;
2948
- } : function() {
2949
- return o;
2950
- };
2951
- return s.d(i, "a", i), i;
2952
- }, s.o = function(o, i) {
2953
- return Object.prototype.hasOwnProperty.call(o, i);
2954
- }, s.p = "", s(s.s = 0);
2955
- }([
2956
- function(t, n, s) {
2957
- t.exports = s(1);
2958
- },
2959
- function(t, n, s) {
2960
- function o(a) {
2961
- return (o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
2962
- return typeof l;
2963
- } : function(l) {
2964
- return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
2965
- })(a);
2966
- }
2967
- function i(a) {
2968
- var l = "[object " + a + "]";
2969
- return function(v) {
2970
- return Object.prototype.toString.call(v) === l;
2971
- };
2972
- }
2973
- s.r(n), s.d(n, "default", function() {
2974
- return W;
2975
- }), s.d(n, "compare", function() {
2976
- return U;
2977
- }), s.d(n, "comparable", function() {
2978
- return X;
2979
- });
2980
- var d = i("Array"), c = i("Object"), u = i("Function");
2981
- function b(a, l) {
2982
- return u(a.get) ? a.get(l) : a[l];
2983
- }
2984
- function g(a) {
2985
- return function(l, v) {
2986
- if (!d(v) || !v.length)
2987
- return a(l, v);
2988
- for (var A = 0, P = v.length; A < P; A++)
2989
- if (a(l, b(v, A)))
2990
- return !0;
2991
- return !1;
2992
- };
2993
- }
2994
- function p(a) {
2995
- return function(l, v) {
2996
- if (!d(v) || !v.length)
2997
- return a(l, v);
2998
- for (var A = 0, P = v.length; A < P; A++)
2999
- if (!a(l, b(v, A)))
3000
- return !1;
3001
- return !0;
3002
- };
3003
- }
3004
- function _(a, l, v, A) {
3005
- return a.validate(a.options, l, v, A);
3006
- }
3007
- var $ = {
3008
- $eq: g(function(a, l) {
3009
- return a(l);
3010
- }),
3011
- $ne: p(function(a, l) {
3012
- return a(l);
3013
- }),
3014
- $gt: g(function(a, l) {
3015
- return a(l);
3016
- }),
3017
- $gte: g(function(a, l) {
3018
- return a(l);
3019
- }),
3020
- $lt: g(function(a, l) {
3021
- return a(l);
3022
- }),
3023
- $lte: g(function(a, l) {
3024
- return a(l);
3025
- }),
3026
- $mod: g(function(a, l) {
3027
- return a(l);
3028
- }),
3029
- $in: function(a, l) {
3030
- return a(l);
3031
- },
3032
- $nin: function(a, l) {
3033
- return a(l);
3034
- },
3035
- $not: function(a, l, v, A) {
3036
- return a(l, v, A);
3037
- },
3038
- $type: function(a, l) {
3039
- return a(l);
3040
- },
3041
- $all: function(a, l, v, A) {
3042
- return $.$and(a, l, v, A);
3043
- },
3044
- $size: function(a, l) {
3045
- return !!l && a === l.length;
3046
- },
3047
- $or: function(a, l, v, A) {
3048
- for (var P = 0, f = a.length; P < f; P++)
3049
- if (_(b(a, P), l, v, A))
3050
- return !0;
3051
- return !1;
3052
- },
3053
- $nor: function(a, l, v, A) {
3054
- return !$.$or(a, l, v, A);
3055
- },
3056
- $and: function(a, l, v, A) {
3057
- for (var P = 0, f = a.length; P < f; P++)
3058
- if (!_(b(a, P), l, v, A))
3059
- return !1;
3060
- return !0;
3061
- },
3062
- $regex: g(function(a, l) {
3063
- return typeof l == "string" && a.test(l);
3064
- }),
3065
- $where: function(a, l, v, A) {
3066
- return a.call(l, l, v, A);
3067
- },
3068
- $elemMatch: function(a, l, v, A) {
3069
- return d(l) ? !!~function(P, f) {
3070
- for (var m = 0; m < P.length; m++)
3071
- if (b(P, m), _(f, b(P, m)))
3072
- return m;
3073
- return -1;
3074
- }(l, a) : _(a, l, v, A);
3075
- },
3076
- $exists: function(a, l, v, A) {
3077
- return A.hasOwnProperty(v) === a;
3078
- }
3079
- }, y = {
3080
- $eq: function(a, l, v) {
3081
- var A = v.comparable, P = v.compare;
3082
- return a instanceof RegExp ? g(function(f) {
3083
- return typeof f == "string" && a.test(f);
3084
- }) : a instanceof Function ? g(a) : d(a) && !a.length ? g(function(f) {
3085
- return d(f) && !f.length;
3086
- }) : g(
3087
- a === null ? function(f) {
3088
- return f == null;
3089
- } : function(f) {
3090
- return P(A(f), A(a)) === 0;
3091
- }
3092
- );
3093
- },
3094
- $gt: function(a, l, v) {
3095
- var A = v.comparable, P = v.compare;
3096
- return function(f) {
3097
- return P(A(f), A(a)) > 0;
3098
- };
3099
- },
3100
- $gte: function(a, l, v) {
3101
- var A = v.comparable, P = v.compare;
3102
- return function(f) {
3103
- return P(A(f), A(a)) >= 0;
3104
- };
3105
- },
3106
- $lt: function(a, l, v) {
3107
- var A = v.comparable, P = v.compare;
3108
- return function(f) {
3109
- return P(A(f), A(a)) < 0;
3110
- };
3111
- },
3112
- $lte: function(a, l, v) {
3113
- var A = v.comparable, P = v.compare;
3114
- return function(f) {
3115
- return P(A(f), A(a)) <= 0;
3116
- };
3117
- },
3118
- $in: function(a, l, v) {
3119
- var A = v.comparable;
3120
- return function(P) {
3121
- if (!(P instanceof Array)) {
3122
- var f = A(P);
3123
- if (f === P && o(P) === "object") {
3124
- for (I = a.length; I--; )
3125
- if (String(a[I]) === String(P) && String(P) !== "[object Object]")
3126
- return !0;
3127
- }
3128
- if (f === void 0) {
3129
- for (I = a.length; I--; )
3130
- if (a[I] == null)
3131
- return !0;
3132
- }
3133
- for (I = a.length; I--; ) {
3134
- var m = _(Y(b(a, I), v), f, I, a);
3135
- if (m && String(m) !== "[object Object]" && String(f) !== "[object Object]")
3136
- return !0;
3137
- }
3138
- return !!~a.indexOf(f);
3139
- }
3140
- for (var I = P.length; I--; )
3141
- if (~a.indexOf(A(b(P, I))))
3142
- return !0;
3143
- return !1;
3144
- };
3145
- },
3146
- $nin: function(a, l, v) {
3147
- var A = y.$in(a, l, v);
3148
- return function(P, f, m, I) {
3149
- return !A(P, f, m, I);
3150
- };
3151
- },
3152
- $mod: function(a) {
3153
- return function(l) {
3154
- return l % a[0] == a[1];
3155
- };
3156
- },
3157
- $ne: function(a, l, v) {
3158
- var A = y.$eq(a, l, v);
3159
- return p(function(P, f, m, I) {
3160
- return !A(P, f, m, I);
3161
- });
3162
- },
3163
- $and: function(a, l, v) {
3164
- return a.map(S(v));
3165
- },
3166
- $all: function(a, l, v) {
3167
- return y.$and(a, l, v);
3168
- },
3169
- $or: function(a, l, v) {
3170
- return a.map(S(v));
3171
- },
3172
- $nor: function(a, l, v) {
3173
- return a.map(S(v));
3174
- },
3175
- $not: function(a, l, v) {
3176
- var A = S(v)(a);
3177
- return function(P, f, m) {
3178
- return !_(A, P, f, m);
3179
- };
3180
- },
3181
- $type: function(a) {
3182
- return function(l, v, A) {
3183
- return l != null && (l instanceof a || l.constructor == a);
3184
- };
3185
- },
3186
- $regex: function(a, l) {
3187
- return new RegExp(a, l.$options);
3188
- },
3189
- $where: function(a) {
3190
- if (typeof a == "function")
3191
- return a;
3192
- throw new Error(
3193
- 'In CSP mode, sift does not support strings in "$where" condition'
3194
- );
3195
- },
3196
- $elemMatch: function(a, l, v) {
3197
- return S(v)(a);
3198
- },
3199
- $exists: function(a) {
3200
- return !!a;
3201
- }
3202
- };
3203
- function C(a, l) {
3204
- return { options: a, validate: l };
3205
- }
3206
- function N(a, l) {
3207
- var v = a.keyPath, A = a.child, P = a.query, f = [];
3208
- if (function G(V, L, B, j, te) {
3209
- if (B === L.length || V == null)
3210
- return void te.push([V, L[B - 1], j]);
3211
- var _e = b(L, B);
3212
- if (d(V) && isNaN(Number(_e)))
3213
- for (var Ge = 0, Rr = V.length; Ge < Rr; Ge++)
3214
- G(b(V, Ge), L, B, V, te);
3215
- else
3216
- G(b(V, _e), L, B + 1, V, te);
3217
- }(l, v, 0, l, f), f.length === 1) {
3218
- var m = f[0];
3219
- return _(A, m[0], m[1], m[2]);
3220
- }
3221
- for (var I = P && P.$ne !== void 0, w = I, h = 0; h < f.length; h++) {
3222
- var O = f[h], x = _(A, O[0], O[1], O[2]);
3223
- I ? w &= x : w |= x;
3224
- }
3225
- return w;
3226
- }
3227
- function k(a, l, v) {
3228
- return C({ keyPath: a, child: l, query: v }, N);
3229
- }
3230
- function S(a) {
3231
- var l = a.comparable, v = a.expressions, A = function(m) {
3232
- var I;
3233
- return (!m || !(I = m) || I.constructor !== Object && I.constructor !== Array && I.constructor.toString() !== "function Object() { [native code] }" && I.constructor.toString() !== "function Array() { [native code] }" || I.toJSON) && (m = { $eq: m }), m;
3234
- }, P = function(m) {
3235
- m = l(m);
3236
- var I = [];
3237
- for (var w in m) {
3238
- var h = m[w];
3239
- if (w !== "$options") {
3240
- var O = $[w] || a && v && v[w];
3241
- if (O)
3242
- y[w] && (h = y[w](h, m, a)), I.push(C(l(h), O));
3243
- else {
3244
- if (w.charCodeAt(0) === 36)
3245
- throw new Error("Unknown operation " + w);
3246
- var x = w.split(".");
3247
- I.push(k(x, f(h), h));
3248
- }
3249
- }
3250
- }
3251
- return I.length === 1 ? I[0] : C(I, $.$and);
3252
- }, f = function(m) {
3253
- return m = A(m), function I(w, h) {
3254
- if (!c(w))
3255
- return h;
3256
- for (var O in w)
3257
- h.push(O), I(w[O], h);
3258
- return h;
3259
- }(m, []).join(",").search(/[$.]/) === -1 ? C(m, M) : P(m);
3260
- };
3261
- return function(m) {
3262
- return P(A(m));
3263
- };
3264
- }
3265
- function M(a, l) {
3266
- if (Object.prototype.toString.call(a) !== Object.prototype.toString.call(l))
3267
- return !1;
3268
- if (c(a)) {
3269
- if (Object.keys(a).length !== Object.keys(l).length)
3270
- return !1;
3271
- for (var v in a)
3272
- if (!M(a[v], l[v]))
3273
- return !1;
3274
- return !0;
3275
- }
3276
- if (d(a)) {
3277
- if (a.length !== l.length)
3278
- return !1;
3279
- for (var A = 0, P = a.length; A < P; A++)
3280
- if (!M(a[A], l[A]))
3281
- return !1;
3282
- return !0;
3283
- }
3284
- return a === l;
3285
- }
3286
- function Y(a, l) {
3287
- var v = S(l)(a);
3288
- return l && l.select && (v = {
3289
- options: v,
3290
- validate: function(A, P, f, m) {
3291
- return _(A, P && l.select(P), f, m);
3292
- }
3293
- }), v;
3294
- }
3295
- function W(a, l) {
3296
- var v = Y(a, l = Object.assign({ compare: U, comparable: X }, l));
3297
- return function(A, P, f) {
3298
- return _(v, A, P, f);
3299
- };
3300
- }
3301
- function U(a, l) {
3302
- if (M(a, l))
3303
- return 0;
3304
- if (o(a) === o(l)) {
3305
- if (a > l)
3306
- return 1;
3307
- if (a < l)
3308
- return -1;
3309
- }
3310
- }
3311
- function X(a) {
3312
- return a instanceof Date ? a.getTime() : d(a) ? a.map(X) : a && typeof a.toJSON == "function" ? a.toJSON() : a;
3313
- }
3314
- }
3315
- ]);
3316
- });
3317
- })(Er);
3318
- var ii = Er.exports;
3319
- const li = /* @__PURE__ */ lr(ii);
3320
- function tr(r, e) {
3321
- for (var t = 0; t < e.length; t++) {
3322
- var n = e[t];
3323
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, n.key, n);
3324
- }
3325
- }
3326
- function ui(r, e, t) {
3327
- return e && tr(r.prototype, e), t && tr(r, t), r;
3328
- }
3329
- function ci(r, e) {
3330
- r.prototype = Object.create(e.prototype), r.prototype.constructor = r, r.__proto__ = e;
3331
- }
3332
- function at(r) {
3333
- return at = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) {
3334
- return t.__proto__ || Object.getPrototypeOf(t);
3335
- }, at(r);
3336
- }
3337
- function Ve(r, e) {
3338
- return Ve = Object.setPrototypeOf || function(n, s) {
3339
- return n.__proto__ = s, n;
3340
- }, Ve(r, e);
3341
- }
3342
- function di() {
3343
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
3344
- return !1;
3345
- if (typeof Proxy == "function")
3346
- return !0;
3347
- try {
3348
- return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
3349
- })), !0;
3350
- } catch {
3351
- return !1;
3352
- }
3353
- }
3354
- function Le(r, e, t) {
3355
- return di() ? Le = Reflect.construct : Le = function(s, o, i) {
3356
- var d = [null];
3357
- d.push.apply(d, o);
3358
- var c = Function.bind.apply(s, d), u = new c();
3359
- return i && Ve(u, i.prototype), u;
3360
- }, Le.apply(null, arguments);
3361
- }
3362
- function fi(r) {
3363
- return Function.toString.call(r).indexOf("[native code]") !== -1;
3364
- }
3365
- function ot(r) {
3366
- var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
3367
- return ot = function(n) {
3368
- if (n === null || !fi(n))
3369
- return n;
3370
- if (typeof n != "function")
3371
- throw new TypeError("Super expression must either be null or a function");
3372
- if (typeof e < "u") {
3373
- if (e.has(n))
3374
- return e.get(n);
3375
- e.set(n, s);
3376
- }
3377
- function s() {
3378
- return Le(n, arguments, at(this).constructor);
3379
- }
3380
- return s.prototype = Object.create(n.prototype, {
3381
- constructor: {
3382
- value: s,
3383
- enumerable: !1,
3384
- writable: !0,
3385
- configurable: !0
3386
- }
3387
- }), Ve(s, n);
3388
- }, ot(r);
3389
- }
3390
- function rr(r) {
3391
- if (r === void 0)
3392
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3393
- return r;
3394
- }
3395
- var wr = function(e) {
3396
- return 'Cannot execute "' + e.action + '" on "' + e.subjectName + '"';
3397
- }, Te = wr, mi = /* @__PURE__ */ function(r) {
3398
- ci(e, r), e.setDefaultMessage = function(s) {
3399
- s === null ? Te = wr : Te = typeof s == "string" ? function() {
3400
- return s;
3401
- } : s;
3402
- }, e.from = function(s) {
3403
- var o = new this("");
3404
- return Object.defineProperty(o, "ability", {
3405
- value: s
3406
- }), o;
3407
- };
3408
- function e(n, s) {
3409
- var o;
3410
- return s === void 0 && (s = {}), o = r.call(this, n) || this, o._setMetadata(s), o.message = n || Te(rr(o)), o._customMessage = null, typeof Error.captureStackTrace == "function" && (o.name = o.constructor.name, Error.captureStackTrace(rr(o), o.constructor)), o;
3411
- }
3412
- var t = e.prototype;
3413
- return t.setMessage = function(s) {
3414
- return this._customMessage = s, this;
3415
- }, t.throwUnlessCan = function(s, o, i) {
3416
- if (!this.ability)
3417
- throw new ReferenceError("Cannot throw FordiddenError without respective ability instance");
3418
- var d = this.ability.relevantRuleFor(s, o, i);
3419
- if (!(d && !d.inverted)) {
3420
- this._setMetadata({
3421
- action: s,
3422
- subject: o,
3423
- field: i,
3424
- subjectName: this.ability.subjectName(o)
3425
- });
3426
- var c = d ? d.reason : "";
3427
- throw this.message = this._customMessage || c || Te(this), this;
3428
- }
3429
- }, t._setMetadata = function(s) {
3430
- this.subject = s.subject, this.subjectName = s.subjectName, this.action = s.action, this.field = s.field;
3431
- }, e;
3432
- }(ot(Error));
3433
- function it(r) {
3434
- return Array.isArray(r) ? r : [r];
3435
- }
3436
- function pi(r) {
3437
- if (!r || typeof r == "string")
3438
- return r;
3439
- var e = typeof r == "object" ? r.constructor : r;
3440
- return e.modelName || e.name;
3441
- }
3442
- function hi(r) {
3443
- return JSON.parse(JSON.stringify(r));
3444
- }
3445
- var vi = /[-/\\^$+?.()|[\]{}]/g, bi = /\.?\*+\.?/g, gi = /\*+/, yi = /\./g;
3446
- function $i(r, e, t) {
3447
- var n = t[0] === "*" || r[0] === "." && r[r.length - 1] === "." ? "+" : "*", s = r.indexOf("**") === -1 ? "[^.]" : ".", o = r.replace(yi, "\\$&").replace(gi, s + n);
3448
- return e + r.length === t.length ? "(?:" + o + ")?" : o;
3449
- }
3450
- function _i(r, e, t) {
3451
- return r === "." && (t[e - 1] === "*" || t[e + 1] === "*") ? r : "\\" + r;
3452
- }
3453
- function Ei(r) {
3454
- var e = r.map(function(n) {
3455
- return n.replace(vi, _i).replace(bi, $i);
3456
- }), t = e.length > 1 ? "(?:" + e.join("|") + ")" : e[0];
3457
- return new RegExp("^" + t + "$");
3458
- }
3459
- var wi = /* @__PURE__ */ function() {
3460
- function r(t) {
3461
- this.actions = t.actions || t.action, this.subject = t.subject, this.fields = !t.fields || t.fields.length === 0 ? void 0 : it(t.fields), Object.defineProperty(this, "_fieldsPattern", {
3462
- writable: !0
3463
- }), this.inverted = !!t.inverted, this.conditions = t.conditions, Object.defineProperty(this, "_matches", {
3464
- writable: !0,
3465
- value: this.conditions ? li(this.conditions) : void 0
3466
- }), this.reason = t.reason;
3467
- }
3468
- var e = r.prototype;
3469
- return e.matches = function(n) {
3470
- return this._matches ? typeof n == "string" ? !this.inverted : this._matches(n) : !0;
3471
- }, e.isRelevantFor = function(n, s) {
3472
- return this.fields ? s ? this.matchesField(s) : !this.inverted : !0;
3473
- }, e.matchesField = function(n) {
3474
- return typeof this._fieldsPattern > "u" && (this._fieldsPattern = this.fields.join("").indexOf("*") === -1 ? null : Ei(this.fields)), this._fieldsPattern === null || n.indexOf("*") !== -1 ? this.fields.indexOf(n) !== -1 : this._fieldsPattern.test(n);
3475
- }, r;
3476
- }(), re = typeof Symbol < "u" ? Symbol("private") : "__" + Date.now(), nr = {
3477
- crud: ["create", "read", "update", "delete"]
3478
- };
3479
- function sr(r, e) {
3480
- return r === e || Array.isArray(e) && e.indexOf(r) !== -1;
3481
- }
3482
- var Ri = /* @__PURE__ */ function() {
3483
- r.addAlias = function(n, s) {
3484
- if (n === "manage" || sr("manage", s))
3485
- throw new Error('Cannot add alias for "manage" action because it represents any action');
3486
- if (sr(n, s))
3487
- throw new Error("Attempt to alias action to itself: " + n + " -> " + s.toString());
3488
- return nr[n] = s, this;
3489
- };
3490
- function r(t, n) {
3491
- n === void 0 && (n = {}), Object.defineProperty(this, "subjectName", {
3492
- value: n.subjectName || pi
3493
- }), this[re] = {
3494
- RuleType: n.RuleType || wi,
3495
- originalRules: t || [],
3496
- hasPerFieldRules: !1,
3497
- indexedRules: /* @__PURE__ */ Object.create(null),
3498
- mergedRules: /* @__PURE__ */ Object.create(null),
3499
- events: {},
3500
- aliases: hi(nr)
3501
- }, this.update(t);
3502
- }
3503
- var e = r.prototype;
3504
- return e.update = function(n) {
3505
- if (!Array.isArray(n))
3506
- return this;
3507
- var s = {
3508
- rules: n,
3509
- ability: this
3510
- };
3511
- this.emit("update", s), this[re].originalRules = n.slice(0), this[re].mergedRules = /* @__PURE__ */ Object.create(null);
3512
- var o = this.buildIndexFor(n);
3513
- return process.env.NODE_ENV !== "production" && o.isAllInverted && n.length && console.warn("[casl]: Ability contains only inverted rules. That means user will not be able to do any actions. This will be changed to Error throw in the next major version"), this[re].indexedRules = o.rules, this[re].hasPerFieldRules = o.hasPerFieldRules, this.emit("updated", s), this;
3514
- }, e.buildIndexFor = function(n) {
3515
- for (var s = /* @__PURE__ */ Object.create(null), o = this[re].RuleType, i = !0, d = !1, c = 0; c < n.length; c++) {
3516
- var u = new o(n[c]), b = this.expandActions(u.actions), g = it(u.subject), p = n.length - c - 1;
3517
- i = !!(i && u.inverted), !d && u.fields && (d = !0);
3518
- for (var _ = 0; _ < g.length; _++) {
3519
- var $ = g[_];
3520
- s[$] = s[$] || /* @__PURE__ */ Object.create(null);
3521
- for (var y = 0; y < b.length; y++) {
3522
- var C = b[y];
3523
- s[$][C] = s[$][C] || /* @__PURE__ */ Object.create(null), s[$][C][p] = u;
3524
- }
3525
- }
3526
- }
3527
- return {
3528
- isAllInverted: i,
3529
- hasPerFieldRules: d,
3530
- rules: s
3531
- };
3532
- }, e.expandActions = function(n) {
3533
- for (var s = this[re].aliases, o = it(n), i = 0; i < o.length; ) {
3534
- var d = o[i++];
3535
- s.hasOwnProperty(d) && (o = o.concat(s[d]));
3536
- }
3537
- return o;
3538
- }, e.can = function(n, s, o) {
3539
- if (o && typeof o != "string")
3540
- throw new Error("Ability.can expects 3rd parameter to be a string. See https://stalniy.github.io/casl/abilities/2017/07/21/check-abilities.html#checking-fields for details");
3541
- var i = this.relevantRuleFor(n, s, o);
3542
- return !!i && !i.inverted;
3543
- }, e.relevantRuleFor = function(n, s, o) {
3544
- for (var i = this.rulesFor(n, s, o), d = 0; d < i.length; d++)
3545
- if (i[d].matches(s))
3546
- return i[d];
3547
- return null;
3548
- }, e.possibleRulesFor = function(n, s) {
3549
- var o = this.subjectName(s), i = this[re].mergedRules, d = o + "_" + n;
3550
- return i[d] || (i[d] = this.mergeRulesFor(n, o)), i[d];
3551
- }, e.mergeRulesFor = function(n, s) {
3552
- var o = this[re].indexedRules, i = [s, "all"].reduce(function(d, c) {
3553
- var u = o[c];
3554
- return u ? Object.assign(d, u[n], u.manage) : d;
3555
- }, []);
3556
- return i.filter(Boolean);
3557
- }, e.rulesFor = function(n, s, o) {
3558
- var i = this.possibleRulesFor(n, s);
3559
- return this[re].hasPerFieldRules ? i.filter(function(d) {
3560
- return d.isRelevantFor(s, o);
3561
- }) : i;
3562
- }, e.cannot = function() {
3563
- return !this.can.apply(this, arguments);
3564
- }, e.throwUnlessCan = function() {
3565
- var n;
3566
- console.warn(`
3567
- Ability.throwUnlessCan is deprecated and will be removed in 4.x version.
3568
- Please use "ForbiddenError.from(ability).throwUnlessCan(...)" instead.
3569
- `.trim()), (n = mi.from(this)).throwUnlessCan.apply(n, arguments);
3570
- }, e.on = function(n, s) {
3571
- var o = this[re].events, i = !0;
3572
- return o[n] || (o[n] = []), o[n].push(s), function() {
3573
- if (i) {
3574
- var d = o[n].indexOf(s);
3575
- o[n].splice(d, 1), i = !1;
3576
- }
3577
- };
3578
- }, e.emit = function(n, s) {
3579
- var o = this[re].events[n];
3580
- o && o.slice(0).forEach(function(i) {
3581
- return i(s);
3582
- });
3583
- }, ui(r, [{
3584
- key: "rules",
3585
- get: function() {
3586
- return this[re].originalRules;
3587
- }
3588
- }]), r;
3589
- }(), ye;
3590
- ((r) => {
3591
- ((e) => {
3592
- e[e.feedMe = 0] = "feedMe", e[e.business = 1] = "business", e[e.restaurant = 2] = "restaurant";
3593
- })(r.Level || (r.Level = {})), ((e) => {
3594
- e.manage = "manage", e.create = "create", e.read = "read", e.update = "update", e.delete = "delete";
3595
- })(r.Action || (r.Action = {}));
3596
- })(ye || (ye = {}));
3597
- ((r) => {
3598
- ((e) => {
3599
- ((t) => {
3600
- t.all = "all", t.restaurant = "restaurant", t.business = "business", t.delivery = "delivery", t.agent = "agent";
3601
- })(e.Feedme || (e.Feedme = {})), ((t) => {
3602
- t.quota = "quota", t.owner = "owner";
3603
- })(e.FeedmeBusinessField || (e.FeedmeBusinessField = {})), ((t) => {
3604
- t.profile = "business::profile", t.restaurant = "business::restaurant", t.menu = "business::menu", t.promotion = "business::promotion", t.voucher = "business::voucher", t.membership = "business::membership", t.stock = "business::stock", t.permission = "business::permission", t.role = "business::role";
3605
- })(e.Business || (e.Business = {})), ((t) => {
3606
- t.restaurant = "restaurant";
3607
- })(e.Restaurant || (e.Restaurant = {}));
3608
- })(r.Subject || (r.Subject = {}));
3609
- })(ye || (ye = {}));
3610
- function Ii(r, e) {
3611
- const n = fe().sessionUser.value;
3612
- if (!n)
3613
- return;
3614
- const { isAdmin: s } = n.role, o = n.permissions, i = e.filter((d) => d.businessId === r._id).length;
3615
- return r.restaurantQuota > i && ((n == null ? void 0 : n.id) === r.ownerId || s) && new Ri(o).can(
3616
- ye.Action.manage,
3617
- ye.Subject.Feedme.all
3618
- );
3619
- }
3620
- const Ai = { class: "fm-typo-cn-body-md-400 text-fm-color-typo-secondary xs:flex xs:flex-col" }, Oi = { class: "flex flex-1" }, Si = {
3621
- key: 0,
3622
- class: "flex gap-8"
3623
- }, Pi = {
3624
- key: 0,
3625
- class: "space-y-4"
3626
- }, Ti = { class: "fm-typo-en-body-md-600" }, Li = {
3627
- key: 0,
3628
- class: "space-y-8"
3629
- }, Ni = { class: "flex justify-end" }, Ci = { class: "flex-1 pb-64 overflow-auto divide-y divide-fm-color-neutral-gray-100" }, xi = { key: 0 }, ki = ["onClick"], Vi = { class: "flex justify-between items-center" }, Fi = { class: "fm-typo-en-body-lg-600" }, ji = { class: "flex gap-8" }, Mi = { class: "text-fm-color-typo-secondary" }, Ui = { class: "text-fm-color-typo-secondary" }, Di = { class: "text-fm-color-typo-secondary" }, al = /* @__PURE__ */ Q({
3630
- __name: "Business",
3631
- setup(r) {
3632
- const { searchKey: e, filter: t } = oi(), { copyTextToClipboard: n } = ir(), s = or(), o = z(() => s.breakpoints.value.xs), { t: i } = pe(), d = z(() => {
3633
- const { currentBusiness: $, restaurants: y } = fe(), C = $.value;
3634
- if (!C)
3635
- return null;
3636
- const { id: N, name: k, thumbnail: S, url: M } = C, Y = y.value.filter((U) => U.managable).map((U) => {
3637
- var m;
3638
- const { _id: X, profile: a } = U, { name: l, email: v, phoneNo: A, address: P, sstRegNo: f } = {
3639
- ...a,
3640
- address: Re(a.address)
3641
- };
3642
- return {
3643
- id: X,
3644
- code: ((m = U.profile) == null ? void 0 : m.code) || "--",
3645
- name: l,
3646
- email: v,
3647
- phone: A,
3648
- address: P.formatted,
3649
- withSST: !!f,
3650
- doc: U
3651
- };
3652
- });
3653
- return {
3654
- id: N,
3655
- name: k,
3656
- thumbnail: S,
3657
- url: `https://feedmedev.cc/${M || N}`,
3658
- doc: C,
3659
- canCreateRestaurant: Ii(C, y.value),
3660
- restaurants: Y.filter(
3661
- ({ code: U, name: X, address: a, phone: l, email: v }) => t([U, X, a, l, v])
3662
- )
3663
- };
3664
- }), c = z(() => [
3665
- {
3666
- header: i("settings.business.restaurant.code"),
3667
- accessorKey: "code",
3668
- enableSorting: !1
3669
- },
3670
- {
3671
- header: i("settings.business.restaurant.title"),
3672
- accessorKey: "name",
3673
- enableSorting: !1
3674
- },
3675
- {
3676
- header: i("settings.business.restaurant.address"),
3677
- accessorKey: "address",
3678
- size: 200,
3679
- enableSorting: !1
3680
- },
3681
- {
3682
- header: i("settings.business.restaurant.contact"),
3683
- accessorKey: "phone",
3684
- enableSorting: !1
3685
- },
3686
- {
3687
- header: i("settings.business.restaurant.email"),
3688
- accessorKey: "email",
3689
- enableSorting: !1
3690
- },
3691
- {
3692
- header: i("settings.business.restaurant.tax.title"),
3693
- enableSorting: !1,
3694
- cell: ($) => {
3695
- var C;
3696
- const y = $.row.original;
3697
- return (C = y.doc.profile.sstRegNo) != null && C.length ? y.doc.profile.sstRegNo : i("settings.business.restaurant.tax.not_set");
3698
- }
3699
- },
3700
- {
3701
- id: "action",
3702
- header: "",
3703
- size: 80,
3704
- cell: ($) => {
3705
- const y = $.row.original;
3706
- return Gr([
3707
- {
3708
- name: "edit",
3709
- onClick: () => _(y)
3710
- },
3711
- {
3712
- name: "file_copy",
3713
- onClick: () => {
3714
- n(y.id);
3715
- }
3716
- }
3717
- ]);
3718
- }
3719
- }
3720
- ]);
3721
- function u() {
3722
- var $;
3723
- n((($ = d.value) == null ? void 0 : $.url) || "");
3724
- }
3725
- function b() {
3726
- if (!d.value)
3727
- return;
3728
- const { name: $, url: y, thumbnail: C } = d.value.doc;
3729
- Ke(g, pn, {
3730
- businessId: d.value.id,
3731
- initialValue: {
3732
- name: $,
3733
- url: y,
3734
- thumbnail: C
3735
- }
3736
- });
3737
- }
3738
- const g = kr();
3739
- function p() {
3740
- Ke(g, er, {
3741
- enableFeedmeExpress: !1
3742
- });
3743
- }
3744
- function _($) {
3745
- var y;
3746
- Ke(g, er, {
3747
- restaurantId: $.id,
3748
- restaurant: $.doc,
3749
- enableFeedmeExpress: ((y = $.doc.feedmeDelivery) == null ? void 0 : y.enable) || !1
3750
- });
3751
- }
3752
- return ($, y) => {
3753
- var W;
3754
- const C = H("FmSpacer"), N = H("FmButton"), k = H("FmTooltip"), S = H("FmSearch"), M = H("FmTable"), Y = H("FmCircularProgress");
3755
- return F(), Z(Dr, {
3756
- heading: ((W = d.value) == null ? void 0 : W.name) || "--"
3757
- }, {
3758
- "sub-heading": q(() => {
3759
- var U;
3760
- return [
3761
- E("div", Ai, [
3762
- E("span", null, D(R(i)("settings.business.url")) + ": ", 1),
3763
- E("span", {
3764
- class: "cursor-pointer xs:w-max-[200px] truncate",
3765
- onClick: u
3766
- }, D((U = d.value) == null ? void 0 : U.url), 1)
3767
- ])
3768
- ];
3769
- }),
3770
- "append-heading": q(() => [
3771
- E("div", Oi, [
3772
- T(C),
3773
- o.value ? (F(), K(se, { key: 1 }, [
3774
- T(Ur, {
3775
- onClick: p,
3776
- label: R(i)("settings.business.add_restaurant"),
3777
- "prepend-icon": "add"
3778
- }, null, 8, ["label"]),
3779
- T(Qr, null, {
3780
- default: q(() => [
3781
- T(tn, {
3782
- label: R(i)("common.edit"),
3783
- onClick: b
3784
- }, null, 8, ["label"])
3785
- ]),
3786
- _: 1
3787
- })
3788
- ], 64)) : (F(), K("div", Si, [
3789
- T(N, {
3790
- onClick: b,
3791
- variant: "secondary",
3792
- label: R(i)("common.edit")
3793
- }, null, 8, ["label"]),
3794
- T(k, {
3795
- variant: "rich",
3796
- placement: "left",
3797
- "z-index": 100
3798
- }, {
3799
- content: q(() => {
3800
- var U;
3801
- return [
3802
- (U = d.value) != null && U.canCreateRestaurant ? le("", !0) : (F(), K("div", Pi, [
3803
- E("p", Ti, D(R(i)("settings.business.quota.limit_title")), 1),
3804
- E("p", null, D(R(i)("settings.business.quota.limit_message")), 1)
3805
- ]))
3806
- ];
3807
- }),
3808
- default: q(() => {
3809
- var U;
3810
- return [
3811
- T(N, {
3812
- onClick: p,
3813
- label: R(i)("settings.business.add_restaurant"),
3814
- disabled: !((U = d.value) != null && U.canCreateRestaurant),
3815
- "prepend-icon": "add"
3816
- }, null, 8, ["label", "disabled"])
3817
- ];
3818
- }),
3819
- _: 1
3820
- })
3821
- ]))
3822
- ])
3823
- ]),
3824
- default: q(() => {
3825
- var U, X;
3826
- return [
3827
- o.value ? (F(), K(se, { key: 1 }, [
3828
- T(S, {
3829
- class: "my-8 mx-16",
3830
- modelValue: R(e),
3831
- "onUpdate:modelValue": y[2] || (y[2] = (a) => Rt(e) ? e.value = a : null),
3832
- placeholder: R(i)("settings.business.search_restaurants")
3833
- }, null, 8, ["modelValue", "placeholder"]),
3834
- E("div", Ci, [
3835
- d.value ? (F(!0), K(se, { key: 1 }, me((X = d.value) == null ? void 0 : X.restaurants, (a) => {
3836
- var l;
3837
- return F(), K("div", {
3838
- key: a.id,
3839
- class: "py-12 px-16 space-y-4",
3840
- onClick: (v) => _(a)
3841
- }, [
3842
- E("div", Vi, [
3843
- E("div", Fi, D(a.name), 1),
3844
- E("div", ji, [
3845
- T(N, {
3846
- icon: "edit",
3847
- "text-color": "neutral-gray-400",
3848
- variant: "tertiary",
3849
- onClick: rt((v) => _(a), ["stop"])
3850
- }, null, 8, ["onClick"]),
3851
- T(N, {
3852
- icon: "file_copy",
3853
- "text-color": "neutral-gray-400",
3854
- variant: "tertiary",
3855
- onClick: rt((v) => R(n)(a.id), ["stop"])
3856
- }, null, 8, ["onClick"])
3857
- ])
3858
- ]),
3859
- E("div", Mi, D(R(i)("settings.business.restaurant.contact")) + ": " + D(a.phone), 1),
3860
- E("div", Ui, D(R(i)("settings.business.restaurant.email")) + ": " + D(a.email), 1),
3861
- E("div", Di, D(R(i)("settings.business.restaurant.tax.title")) + ": " + D((l = a.doc.profile.sstRegNo) != null && l.length ? a.doc.profile.sstRegNo : R(i)("settings.business.restaurant.tax.not_set")), 1)
3862
- ], 8, ki);
3863
- }), 128)) : (F(), K("div", xi, [
3864
- T(Y, { size: "lg" })
3865
- ]))
3866
- ])
3867
- ], 64)) : (F(), K("div", Li, [
3868
- E("div", Ni, [
3869
- T(S, {
3870
- class: "w-[320px]",
3871
- modelValue: R(e),
3872
- "onUpdate:modelValue": y[0] || (y[0] = (a) => Rt(e) ? e.value = a : null),
3873
- placeholder: R(i)("settings.business.search_restaurants")
3874
- }, null, 8, ["modelValue", "placeholder"])
3875
- ]),
3876
- T(M, {
3877
- "column-defs": c.value,
3878
- "row-data": ((U = d.value) == null ? void 0 : U.restaurants) || [],
3879
- "shrink-at": !1,
3880
- loading: !d.value,
3881
- onRowClick: y[1] || (y[1] = (a) => _(a.original))
3882
- }, null, 8, ["column-defs", "row-data", "loading"])
3883
- ]))
3884
- ];
3885
- }),
3886
- _: 1
3887
- }, 8, ["heading"]);
3888
- };
3889
- }
3890
- });
3891
- export {
3892
- al as default
3893
- };