@oneclick.dev/cms-core-modules 0.0.102 → 0.0.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/AgendaOpeningHoursCard-B7ROIPWw.js +1 -0
  2. package/dist/AgendaOpeningHoursCard-Cp4wxUeK.mjs +172 -0
  3. package/dist/AppointmentListTable-DZJNmTMb.mjs +177 -0
  4. package/dist/AppointmentListTable-Dieu9US_.js +1 -0
  5. package/dist/{ContentEditor-Cjqgb64R.mjs → ContentEditor-B1nfKG_5.mjs} +706 -677
  6. package/dist/{ContentEditor-YgOS3kxS.js → ContentEditor-DdFU8piH.js} +15 -16
  7. package/dist/{Create-6uT9HWar.mjs → Create-BRBh0xjM.mjs} +2 -2
  8. package/dist/{Create-DuZ5nZrX.js → Create-qPeQxkdl.js} +1 -1
  9. package/dist/{DateFormatter-2B0R-DY4.mjs → DateFormatter-Bw-87W31.mjs} +212 -227
  10. package/dist/DateFormatter-CYAD4GBN.js +1 -0
  11. package/dist/{Detail-BZ-iE9vf.js → Detail-C857g62L.js} +1 -1
  12. package/dist/{Detail-CJVMJDP7.mjs → Detail-CujdFApD.mjs} +2 -2
  13. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +76 -0
  14. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +1 -0
  15. package/dist/{Entries-DkRhOt95.js → Entries-BaS6H6ak.js} +1 -1
  16. package/dist/{Entries-dLlCrXXe.mjs → Entries-C8UJkrVC.mjs} +1 -1
  17. package/dist/{Find-Bd1uLqSa.mjs → Find-B24ZEhYM.mjs} +1 -1
  18. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-9Q7TMm4u.mjs} +37 -37
  19. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-DiNzGl-q.js} +1 -1
  20. package/dist/{Overview-DoOASlNz.mjs → Overview-3HWhsqaz.mjs} +2 -2
  21. package/dist/{Overview-37nilXzE.js → Overview-CpHhuiaV.js} +1 -1
  22. package/dist/{Overview-DeQQ0FY3.js → Overview-DAxCu9XC.js} +1 -1
  23. package/dist/{Overview-C--dq51X.mjs → Overview-D_T3K6aq.mjs} +1 -1
  24. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cz_22Oce.mjs +2927 -0
  25. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-DPPNc-Z5.js +349 -0
  26. package/dist/TableView-CPAw3h8g.js +4 -0
  27. package/dist/TableView-DXmEF6pY.mjs +6143 -0
  28. package/dist/agenda-BNG05SAq.js +1 -0
  29. package/dist/agenda-D1RxMxBS.mjs +1152 -0
  30. package/dist/availability-CMrRa5y2.mjs +269 -0
  31. package/dist/availability-Cf2YfMwM.js +1 -0
  32. package/dist/booking-data-DgJd0BcM.mjs +889 -0
  33. package/dist/booking-data-Di5GmH_8.js +1 -0
  34. package/dist/cms-core-modules.css +1 -1
  35. package/dist/{exceptions-Bp5BSvxO.js → exceptions-CI0B4xVj.js} +1 -1
  36. package/dist/{exceptions-C97cNZYl.mjs → exceptions-vo8SA5SE.mjs} +68 -68
  37. package/dist/index-BtujSJeg.js +35 -0
  38. package/dist/{index-CrGjxSwa.mjs → index-CrgzoTyR.mjs} +1 -1
  39. package/dist/{index-D2a6wEPh.js → index-DPd3waTN.js} +1 -1
  40. package/dist/{index-CABh6Qn6.mjs → index-DrXxXB2F.mjs} +15 -15
  41. package/dist/{index-B-lVEpFX.mjs → index-MYWjg0zi.mjs} +3 -3
  42. package/dist/index-dOdMm1pV.mjs +1105 -0
  43. package/dist/index.cjs.js +1 -1
  44. package/dist/index.mjs +196 -143
  45. package/dist/interpolation-DEDSLETn.mjs +128 -0
  46. package/dist/interpolation-DERg6Lwt.js +1 -0
  47. package/dist/orders-CzzcFQha.mjs +559 -0
  48. package/dist/orders-ETtbA4aQ.js +1 -0
  49. package/dist/{payment-Bosr0m3u.mjs → payment-C3ohkehF.mjs} +1 -1
  50. package/dist/{payment-DDnC03jb.js → payment-Dfr-Ro-a.js} +1 -1
  51. package/dist/{resources-BtF5RUUq.js → resources-CxeFd57z.js} +1 -1
  52. package/dist/{resources-B7qDBC91.mjs → resources-WI_4SO6T.mjs} +2 -2
  53. package/dist/server-handlers.cjs.js +1 -1
  54. package/dist/server-handlers.mjs +457 -387
  55. package/dist/src/appointments/chat-components/AgendaOpeningHoursCard.vue.d.ts +15 -0
  56. package/dist/src/appointments/components/edit/CustomerInformationFieldEditorDialog.vue.d.ts +17 -5
  57. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +8 -3
  58. package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +1 -0
  59. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +6 -3
  60. package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +3 -0
  61. package/dist/src/appointments/components/edit/EventView.vue.d.ts +6 -1
  62. package/dist/src/appointments/components/edit/MetadataSchemaEditorDialog.vue.d.ts +12 -0
  63. package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +21 -0
  64. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +8 -3
  65. package/dist/src/appointments/index.d.ts +53 -0
  66. package/dist/src/appointments/pages/edit/agenda.vue.d.ts +3 -1
  67. package/dist/src/appointments/pages/edit/availability.vue.d.ts +1 -26
  68. package/dist/src/appointments/pages/edit/booking-data.vue.d.ts +65 -0
  69. package/dist/src/appointments/pages/edit/orders.vue.d.ts +7 -3
  70. package/dist/src/appointments/tools.d.ts +52 -0
  71. package/dist/src/appointments/types.d.ts +12 -0
  72. package/dist/src/table/config.d.ts +200 -0
  73. package/dist/src/table/get_data_flow-DEFAULT.json.d.ts +129 -0
  74. package/dist/src/table/index.d.ts +200 -0
  75. package/dist/utils-CanmrIWO.mjs +47 -0
  76. package/dist/utils-Yd6F5mea.js +3 -0
  77. package/package.json +2 -2
  78. package/src/appointments/tools.ts +38 -0
  79. package/dist/AppointmentListTable-CQ0WIXtj.js +0 -1
  80. package/dist/AppointmentListTable-aV_UJd6j.mjs +0 -159
  81. package/dist/DateFormatter-DbtOLV0L.js +0 -1
  82. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DXa-Xxue.mjs +0 -74
  83. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-ozYrxb2g.js +0 -1
  84. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CL5kbDII.mjs +0 -2782
  85. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-DcyyNvf6.js +0 -349
  86. package/dist/TableView-CIJs118q.mjs +0 -5929
  87. package/dist/TableView-DzZYf34i.js +0 -4
  88. package/dist/agenda-CCOjPiwP.mjs +0 -1133
  89. package/dist/agenda-CNPQfaIQ.js +0 -1
  90. package/dist/availability-B1D4Fyzi.mjs +0 -629
  91. package/dist/availability-DxrUcYbW.js +0 -1
  92. package/dist/index-BOnqrBfY.js +0 -35
  93. package/dist/index-Bj0qaL1N.mjs +0 -1091
  94. package/dist/interpolation-BBwG_ON6.mjs +0 -65
  95. package/dist/interpolation-CsOrww73.js +0 -1
  96. package/dist/orders-BJV5vRQr.mjs +0 -397
  97. package/dist/orders-C1C5IEIP.js +0 -1
  98. package/dist/regular-slots-Cc1jmKuC.mjs +0 -222
  99. package/dist/regular-slots-DBs1XVeN.js +0 -1
  100. package/dist/src/appointments/pages/edit/regular-slots.vue.d.ts +0 -2
  101. package/dist/utils-BVKy9S2J.mjs +0 -29
  102. package/dist/utils-D6CaKJbp.js +0 -2
@@ -1,2782 +0,0 @@
1
- import { defineComponent as se, ref as E, resolveComponent as y, openBlock as R, createBlock as J, withCtx as x, createVNode as p, createTextVNode as A, createElementVNode as g, unref as B, normalizeClass as ue, toDisplayString as F, inject as et, useTemplateRef as ie, computed as he, createElementBlock as U, Fragment as me, createCommentVNode as z } from "vue";
2
- import { User as tt, Mail as st, Phone as nt, Clock as ot, Users as it, Tag as at, CreditCard as rt, Receipt as lt, Ban as ct, ClockCheck as ut, MoreHorizontal as dt, Download as ft, MailCheck as pt, XCircle as ht, Gift as mt } from "lucide-vue-next";
3
- import { useModule as ne, useMailer as Ae, useModulePermissions as gt, useFirebaseIntegration as vt } from "@oneclick.dev/cms-kit";
4
- import { t as q } from "./index-RLz1QPrf.mjs";
5
- function K(s) {
6
- return Array.isArray ? Array.isArray(s) : Le(s) === "[object Array]";
7
- }
8
- function _t(s) {
9
- if (typeof s == "string")
10
- return s;
11
- if (typeof s == "bigint")
12
- return s.toString();
13
- const e = s + "";
14
- return e == "0" && 1 / s == -1 / 0 ? "-0" : e;
15
- }
16
- function ge(s) {
17
- return s == null ? "" : _t(s);
18
- }
19
- function N(s) {
20
- return typeof s == "string";
21
- }
22
- function re(s) {
23
- return typeof s == "number";
24
- }
25
- function xt(s) {
26
- return s === !0 || s === !1 || yt(s) && Le(s) == "[object Boolean]";
27
- }
28
- function Ne(s) {
29
- return typeof s == "object";
30
- }
31
- function yt(s) {
32
- return Ne(s) && s !== null;
33
- }
34
- function L(s) {
35
- return s != null;
36
- }
37
- function ae(s) {
38
- return !s.trim().length;
39
- }
40
- function Le(s) {
41
- return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(s);
42
- }
43
- const Dt = "Incorrect 'index' type", bt = (s) => `Invalid value for key ${s}`, Ct = (s) => `Pattern length exceeds max of ${s}.`, At = (s) => `Missing ${s} property in key`, kt = (s) => `Property 'weight' in key '${s}' must be a positive integer`, $e = Object.prototype.hasOwnProperty;
44
- class wt {
45
- constructor(e) {
46
- this._keys = [], this._keyMap = {};
47
- let t = 0;
48
- e.forEach((n) => {
49
- const o = Pe(n);
50
- this._keys.push(o), this._keyMap[o.id] = o, t += o.weight;
51
- }), this._keys.forEach((n) => {
52
- n.weight /= t;
53
- });
54
- }
55
- get(e) {
56
- return this._keyMap[e];
57
- }
58
- keys() {
59
- return this._keys;
60
- }
61
- toJSON() {
62
- return JSON.stringify(this._keys);
63
- }
64
- }
65
- function Pe(s) {
66
- let e = null, t = null, n = null, o = 1, r = null;
67
- if (N(s) || K(s))
68
- n = s, e = Fe(s), t = ve(s);
69
- else {
70
- if (!$e.call(s, "name"))
71
- throw new Error(At("name"));
72
- const a = s.name;
73
- if (n = a, $e.call(s, "weight") && (o = s.weight, o <= 0))
74
- throw new Error(kt(a));
75
- e = Fe(a), t = ve(a), r = s.getFn;
76
- }
77
- return {
78
- path: e,
79
- id: t,
80
- weight: o,
81
- src: n,
82
- getFn: r
83
- };
84
- }
85
- function Fe(s) {
86
- return K(s) ? s : s.split(".");
87
- }
88
- function ve(s) {
89
- return K(s) ? s.join(".") : s;
90
- }
91
- function Mt(s, e) {
92
- const t = [];
93
- let n = !1;
94
- const o = (r, a, u, c) => {
95
- if (L(r))
96
- if (!a[u])
97
- t.push(c !== void 0 ? {
98
- v: r,
99
- i: c
100
- } : r);
101
- else {
102
- const i = a[u], l = r[i];
103
- if (!L(l))
104
- return;
105
- if (u === a.length - 1 && (N(l) || re(l) || xt(l) || typeof l == "bigint"))
106
- t.push(c !== void 0 ? {
107
- v: ge(l),
108
- i: c
109
- } : ge(l));
110
- else if (K(l)) {
111
- n = !0;
112
- for (let m = 0, _ = l.length; m < _; m += 1)
113
- o(l[m], a, u + 1, m);
114
- } else a.length && o(l, a, u + 1, c);
115
- }
116
- };
117
- return o(s, N(e) ? e.split(".") : e, 0), n ? t : t[0];
118
- }
119
- const It = {
120
- includeMatches: !1,
121
- findAllMatches: !1,
122
- minMatchCharLength: 1
123
- }, Et = {
124
- isCaseSensitive: !1,
125
- ignoreDiacritics: !1,
126
- includeScore: !1,
127
- keys: [],
128
- shouldSort: !0,
129
- sortFn: (s, e) => s.score === e.score ? s.idx < e.idx ? -1 : 1 : s.score < e.score ? -1 : 1
130
- }, St = {
131
- location: 0,
132
- threshold: 0.6,
133
- distance: 100
134
- }, $t = {
135
- useExtendedSearch: !1,
136
- useTokenSearch: !1,
137
- getFn: Mt,
138
- ignoreLocation: !1,
139
- ignoreFieldNorm: !1,
140
- fieldNormWeight: 1
141
- }, D = Object.freeze({
142
- ...Et,
143
- ...It,
144
- ...St,
145
- ...$t
146
- }), Ft = /[^ ]+/g;
147
- function Bt(s = 1, e = 3) {
148
- const t = /* @__PURE__ */ new Map(), n = Math.pow(10, e);
149
- return {
150
- get(o) {
151
- const r = o.match(Ft).length;
152
- if (t.has(r))
153
- return t.get(r);
154
- const a = 1 / Math.pow(r, 0.5 * s), u = parseFloat(Math.round(a * n) / n);
155
- return t.set(r, u), u;
156
- },
157
- clear() {
158
- t.clear();
159
- }
160
- };
161
- }
162
- class ke {
163
- constructor({
164
- getFn: e = D.getFn,
165
- fieldNormWeight: t = D.fieldNormWeight
166
- } = {}) {
167
- this.norm = Bt(t, 3), this.getFn = e, this.isCreated = !1, this.docs = [], this.keys = [], this._keysMap = {}, this.setIndexRecords();
168
- }
169
- setSources(e = []) {
170
- this.docs = e;
171
- }
172
- setIndexRecords(e = []) {
173
- this.records = e;
174
- }
175
- setKeys(e = []) {
176
- this.keys = e, this._keysMap = {}, e.forEach((t, n) => {
177
- this._keysMap[t.id] = n;
178
- });
179
- }
180
- create() {
181
- this.isCreated || !this.docs.length || (this.isCreated = !0, N(this.docs[0]) ? this.docs.forEach((e, t) => {
182
- this._addString(e, t);
183
- }) : this.docs.forEach((e, t) => {
184
- this._addObject(e, t);
185
- }), this.norm.clear());
186
- }
187
- // Adds a doc to the end of the index
188
- add(e) {
189
- const t = this.size();
190
- N(e) ? this._addString(e, t) : this._addObject(e, t);
191
- }
192
- // Removes the doc at the specified index of the index
193
- removeAt(e) {
194
- this.records.splice(e, 1);
195
- for (let t = e, n = this.size(); t < n; t += 1)
196
- this.records[t].i -= 1;
197
- }
198
- // Removes docs at the specified indices (must be sorted ascending)
199
- removeAll(e) {
200
- for (let t = e.length - 1; t >= 0; t -= 1)
201
- this.records.splice(e[t], 1);
202
- for (let t = 0, n = this.records.length; t < n; t += 1)
203
- this.records[t].i = t;
204
- }
205
- getValueForItemAtKeyId(e, t) {
206
- return e[this._keysMap[t]];
207
- }
208
- size() {
209
- return this.records.length;
210
- }
211
- _addString(e, t) {
212
- if (!L(e) || ae(e))
213
- return;
214
- const n = {
215
- v: e,
216
- i: t,
217
- n: this.norm.get(e)
218
- };
219
- this.records.push(n);
220
- }
221
- _addObject(e, t) {
222
- const n = {
223
- i: t,
224
- $: {}
225
- };
226
- this.keys.forEach((o, r) => {
227
- const a = o.getFn ? o.getFn(e) : this.getFn(e, o.path);
228
- if (L(a)) {
229
- if (K(a)) {
230
- const u = [];
231
- for (let c = 0, i = a.length; c < i; c += 1) {
232
- const l = a[c];
233
- if (L(l)) {
234
- if (N(l)) {
235
- if (!ae(l)) {
236
- const m = {
237
- v: l,
238
- i: c,
239
- n: this.norm.get(l)
240
- };
241
- u.push(m);
242
- }
243
- } else if (L(l.v)) {
244
- const m = N(l.v) ? l.v : ge(l.v);
245
- if (!ae(m)) {
246
- const _ = {
247
- v: m,
248
- i: l.i,
249
- n: this.norm.get(m)
250
- };
251
- u.push(_);
252
- }
253
- }
254
- }
255
- }
256
- n.$[r] = u;
257
- } else if (N(a) && !ae(a)) {
258
- const u = {
259
- v: a,
260
- n: this.norm.get(a)
261
- };
262
- n.$[r] = u;
263
- }
264
- }
265
- }), this.records.push(n);
266
- }
267
- toJSON() {
268
- return {
269
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
270
- keys: this.keys.map(({
271
- getFn: e,
272
- ...t
273
- }) => t),
274
- records: this.records
275
- };
276
- }
277
- }
278
- function ze(s, e, {
279
- getFn: t = D.getFn,
280
- fieldNormWeight: n = D.fieldNormWeight
281
- } = {}) {
282
- const o = new ke({
283
- getFn: t,
284
- fieldNormWeight: n
285
- });
286
- return o.setKeys(s.map(Pe)), o.setSources(e), o.create(), o;
287
- }
288
- function Rt(s, {
289
- getFn: e = D.getFn,
290
- fieldNormWeight: t = D.fieldNormWeight
291
- } = {}) {
292
- const {
293
- keys: n,
294
- records: o
295
- } = s, r = new ke({
296
- getFn: e,
297
- fieldNormWeight: t
298
- });
299
- return r.setKeys(n), r.setIndexRecords(o), r;
300
- }
301
- function jt(s = [], e = D.minMatchCharLength) {
302
- const t = [];
303
- let n = -1, o = -1, r = 0;
304
- for (let a = s.length; r < a; r += 1) {
305
- const u = s[r];
306
- u && n === -1 ? n = r : !u && n !== -1 && (o = r - 1, o - n + 1 >= e && t.push([n, o]), n = -1);
307
- }
308
- return s[r - 1] && r - n >= e && t.push([n, r - 1]), t;
309
- }
310
- const Q = 32;
311
- function Tt(s, e, t, {
312
- location: n = D.location,
313
- distance: o = D.distance,
314
- threshold: r = D.threshold,
315
- findAllMatches: a = D.findAllMatches,
316
- minMatchCharLength: u = D.minMatchCharLength,
317
- includeMatches: c = D.includeMatches,
318
- ignoreLocation: i = D.ignoreLocation
319
- } = {}) {
320
- if (e.length > Q)
321
- throw new Error(Ct(Q));
322
- const l = e.length, m = s.length, _ = Math.max(0, Math.min(n, m));
323
- let d = r, f = _;
324
- const v = (I, T) => {
325
- const b = I / l;
326
- if (i) return b;
327
- const O = Math.abs(_ - T);
328
- return o ? b + O / o : O ? 1 : b;
329
- }, C = u > 1 || c, $ = C ? Array(m) : [];
330
- let j;
331
- for (; (j = s.indexOf(e, f)) > -1; ) {
332
- const I = v(0, j);
333
- if (d = Math.min(I, d), f = j + l, C) {
334
- let T = 0;
335
- for (; T < l; )
336
- $[j + T] = 1, T += 1;
337
- }
338
- }
339
- f = -1;
340
- let w = [], S = 1, P = l + m;
341
- const W = 1 << l - 1;
342
- for (let I = 0; I < l; I += 1) {
343
- let T = 0, b = P;
344
- for (; T < b; )
345
- v(I, _ + b) <= d ? T = b : P = b, b = Math.floor((P - T) / 2 + T);
346
- P = b;
347
- let O = Math.max(1, _ - b + 1);
348
- const ee = a ? m : Math.min(_ + b, m) + l, H = Array(ee + 2);
349
- H[ee + 1] = (1 << I) - 1;
350
- for (let h = ee; h >= O; h -= 1) {
351
- const M = h - 1, Z = t[s[M]];
352
- if (C && ($[M] = +!!Z), H[h] = (H[h + 1] << 1 | 1) & Z, I && (H[h] |= (w[h + 1] | w[h]) << 1 | 1 | w[h + 1]), H[h] & W && (S = v(I, M), S <= d)) {
353
- if (d = S, f = M, f <= _)
354
- break;
355
- O = Math.max(1, 2 * _ - f);
356
- }
357
- }
358
- if (v(I + 1, _) > d)
359
- break;
360
- w = H;
361
- }
362
- const V = {
363
- isMatch: f >= 0,
364
- // Count exact matches (those with a score of 0) to be "almost" exact
365
- score: Math.max(1e-3, S)
366
- };
367
- if (C) {
368
- const I = jt($, u);
369
- I.length ? c && (V.indices = I) : V.isMatch = !1;
370
- }
371
- return V;
372
- }
373
- function Ot(s) {
374
- const e = {};
375
- for (let t = 0, n = s.length; t < n; t += 1) {
376
- const o = s.charAt(t);
377
- e[o] = (e[o] || 0) | 1 << n - t - 1;
378
- }
379
- return e;
380
- }
381
- function we(s) {
382
- if (s.length <= 1) return s;
383
- s.sort((t, n) => t[0] - n[0] || t[1] - n[1]);
384
- const e = [s[0]];
385
- for (let t = 1, n = s.length; t < n; t += 1) {
386
- const o = e[e.length - 1], r = s[t];
387
- r[0] <= o[1] + 1 ? o[1] = Math.max(o[1], r[1]) : e.push(r);
388
- }
389
- return e;
390
- }
391
- const Ve = {
392
- ł: "l",
393
- // ł
394
- Ł: "L",
395
- // Ł
396
- đ: "d",
397
- // đ
398
- Đ: "D",
399
- // Đ
400
- ø: "o",
401
- // ø
402
- Ø: "O",
403
- // Ø
404
- ħ: "h",
405
- // ħ
406
- Ħ: "H",
407
- // Ħ
408
- ŧ: "t",
409
- // ŧ
410
- Ŧ: "T",
411
- // Ŧ
412
- ı: "i",
413
- // ı
414
- ß: "ss"
415
- // ß
416
- }, Nt = new RegExp("[" + Object.keys(Ve).join("") + "]", "g"), te = String.prototype.normalize ? (s) => s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "").replace(Nt, (e) => Ve[e]) : (s) => s;
417
- class Me {
418
- constructor(e, {
419
- location: t = D.location,
420
- threshold: n = D.threshold,
421
- distance: o = D.distance,
422
- includeMatches: r = D.includeMatches,
423
- findAllMatches: a = D.findAllMatches,
424
- minMatchCharLength: u = D.minMatchCharLength,
425
- isCaseSensitive: c = D.isCaseSensitive,
426
- ignoreDiacritics: i = D.ignoreDiacritics,
427
- ignoreLocation: l = D.ignoreLocation
428
- } = {}) {
429
- if (this.options = {
430
- location: t,
431
- threshold: n,
432
- distance: o,
433
- includeMatches: r,
434
- findAllMatches: a,
435
- minMatchCharLength: u,
436
- isCaseSensitive: c,
437
- ignoreDiacritics: i,
438
- ignoreLocation: l
439
- }, e = c ? e : e.toLowerCase(), e = i ? te(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length)
440
- return;
441
- const m = (d, f) => {
442
- this.chunks.push({
443
- pattern: d,
444
- alphabet: Ot(d),
445
- startIndex: f
446
- });
447
- }, _ = this.pattern.length;
448
- if (_ > Q) {
449
- let d = 0;
450
- const f = _ % Q, v = _ - f;
451
- for (; d < v; )
452
- m(this.pattern.substr(d, Q), d), d += Q;
453
- if (f) {
454
- const C = _ - Q;
455
- m(this.pattern.substr(C), C);
456
- }
457
- } else
458
- m(this.pattern, 0);
459
- }
460
- searchIn(e) {
461
- const {
462
- isCaseSensitive: t,
463
- ignoreDiacritics: n,
464
- includeMatches: o
465
- } = this.options;
466
- if (e = t ? e : e.toLowerCase(), e = n ? te(e) : e, this.pattern === e) {
467
- const v = {
468
- isMatch: !0,
469
- score: 0
470
- };
471
- return o && (v.indices = [[0, e.length - 1]]), v;
472
- }
473
- const {
474
- location: r,
475
- distance: a,
476
- threshold: u,
477
- findAllMatches: c,
478
- minMatchCharLength: i,
479
- ignoreLocation: l
480
- } = this.options, m = [];
481
- let _ = 0, d = !1;
482
- this.chunks.forEach(({
483
- pattern: v,
484
- alphabet: C,
485
- startIndex: $
486
- }) => {
487
- const {
488
- isMatch: j,
489
- score: w,
490
- indices: S
491
- } = Tt(e, v, C, {
492
- location: r + $,
493
- distance: a,
494
- threshold: u,
495
- findAllMatches: c,
496
- minMatchCharLength: i,
497
- includeMatches: o,
498
- ignoreLocation: l
499
- });
500
- j && (d = !0), _ += w, j && S && m.push(...S);
501
- });
502
- const f = {
503
- isMatch: d,
504
- score: d ? _ / this.chunks.length : 1
505
- };
506
- return d && o && (f.indices = we(m)), f;
507
- }
508
- }
509
- class G {
510
- constructor(e) {
511
- this.pattern = e;
512
- }
513
- static isMultiMatch(e) {
514
- return Be(e, this.multiRegex);
515
- }
516
- static isSingleMatch(e) {
517
- return Be(e, this.singleRegex);
518
- }
519
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
520
- search(e) {
521
- return {
522
- isMatch: !1,
523
- score: 1
524
- };
525
- }
526
- }
527
- function Be(s, e) {
528
- const t = s.match(e);
529
- return t ? t[1] : null;
530
- }
531
- class Lt extends G {
532
- constructor(e) {
533
- super(e);
534
- }
535
- static get type() {
536
- return "exact";
537
- }
538
- static get multiRegex() {
539
- return /^="(.*)"$/;
540
- }
541
- static get singleRegex() {
542
- return /^=(.*)$/;
543
- }
544
- search(e) {
545
- const t = e === this.pattern;
546
- return {
547
- isMatch: t,
548
- score: t ? 0 : 1,
549
- indices: [0, this.pattern.length - 1]
550
- };
551
- }
552
- }
553
- class Pt extends G {
554
- constructor(e) {
555
- super(e);
556
- }
557
- static get type() {
558
- return "inverse-exact";
559
- }
560
- static get multiRegex() {
561
- return /^!"(.*)"$/;
562
- }
563
- static get singleRegex() {
564
- return /^!(.*)$/;
565
- }
566
- search(e) {
567
- const n = e.indexOf(this.pattern) === -1;
568
- return {
569
- isMatch: n,
570
- score: n ? 0 : 1,
571
- indices: [0, e.length - 1]
572
- };
573
- }
574
- }
575
- class zt extends G {
576
- constructor(e) {
577
- super(e);
578
- }
579
- static get type() {
580
- return "prefix-exact";
581
- }
582
- static get multiRegex() {
583
- return /^\^"(.*)"$/;
584
- }
585
- static get singleRegex() {
586
- return /^\^(.*)$/;
587
- }
588
- search(e) {
589
- const t = e.startsWith(this.pattern);
590
- return {
591
- isMatch: t,
592
- score: t ? 0 : 1,
593
- indices: [0, this.pattern.length - 1]
594
- };
595
- }
596
- }
597
- class Vt extends G {
598
- constructor(e) {
599
- super(e);
600
- }
601
- static get type() {
602
- return "inverse-prefix-exact";
603
- }
604
- static get multiRegex() {
605
- return /^!\^"(.*)"$/;
606
- }
607
- static get singleRegex() {
608
- return /^!\^(.*)$/;
609
- }
610
- search(e) {
611
- const t = !e.startsWith(this.pattern);
612
- return {
613
- isMatch: t,
614
- score: t ? 0 : 1,
615
- indices: [0, e.length - 1]
616
- };
617
- }
618
- }
619
- class Ut extends G {
620
- constructor(e) {
621
- super(e);
622
- }
623
- static get type() {
624
- return "suffix-exact";
625
- }
626
- static get multiRegex() {
627
- return /^"(.*)"\$$/;
628
- }
629
- static get singleRegex() {
630
- return /^(.*)\$$/;
631
- }
632
- search(e) {
633
- const t = e.endsWith(this.pattern);
634
- return {
635
- isMatch: t,
636
- score: t ? 0 : 1,
637
- indices: [e.length - this.pattern.length, e.length - 1]
638
- };
639
- }
640
- }
641
- class Wt extends G {
642
- constructor(e) {
643
- super(e);
644
- }
645
- static get type() {
646
- return "inverse-suffix-exact";
647
- }
648
- static get multiRegex() {
649
- return /^!"(.*)"\$$/;
650
- }
651
- static get singleRegex() {
652
- return /^!(.*)\$$/;
653
- }
654
- search(e) {
655
- const t = !e.endsWith(this.pattern);
656
- return {
657
- isMatch: t,
658
- score: t ? 0 : 1,
659
- indices: [0, e.length - 1]
660
- };
661
- }
662
- }
663
- class Ue extends G {
664
- constructor(e, {
665
- location: t = D.location,
666
- threshold: n = D.threshold,
667
- distance: o = D.distance,
668
- includeMatches: r = D.includeMatches,
669
- findAllMatches: a = D.findAllMatches,
670
- minMatchCharLength: u = D.minMatchCharLength,
671
- isCaseSensitive: c = D.isCaseSensitive,
672
- ignoreDiacritics: i = D.ignoreDiacritics,
673
- ignoreLocation: l = D.ignoreLocation
674
- } = {}) {
675
- super(e), this._bitapSearch = new Me(e, {
676
- location: t,
677
- threshold: n,
678
- distance: o,
679
- includeMatches: r,
680
- findAllMatches: a,
681
- minMatchCharLength: u,
682
- isCaseSensitive: c,
683
- ignoreDiacritics: i,
684
- ignoreLocation: l
685
- });
686
- }
687
- static get type() {
688
- return "fuzzy";
689
- }
690
- static get multiRegex() {
691
- return /^"(.*)"$/;
692
- }
693
- static get singleRegex() {
694
- return /^(.*)$/;
695
- }
696
- search(e) {
697
- return this._bitapSearch.searchIn(e);
698
- }
699
- }
700
- class We extends G {
701
- constructor(e) {
702
- super(e);
703
- }
704
- static get type() {
705
- return "include";
706
- }
707
- static get multiRegex() {
708
- return /^'"(.*)"$/;
709
- }
710
- static get singleRegex() {
711
- return /^'(.*)$/;
712
- }
713
- search(e) {
714
- let t = 0, n;
715
- const o = [], r = this.pattern.length;
716
- for (; (n = e.indexOf(this.pattern, t)) > -1; )
717
- t = n + r, o.push([n, t - 1]);
718
- const a = !!o.length;
719
- return {
720
- isMatch: a,
721
- score: a ? 0 : 1,
722
- indices: o
723
- };
724
- }
725
- }
726
- const _e = [Lt, We, zt, Vt, Wt, Ut, Pt, Ue], Re = _e.length, Ht = "\0", Kt = "|";
727
- function Gt(s) {
728
- const e = [], t = s.length;
729
- let n = 0;
730
- for (; n < t; ) {
731
- for (; n < t && s[n] === " "; ) n++;
732
- if (n >= t) break;
733
- let o = n;
734
- for (; o < t && s[o] !== " " && s[o] !== '"'; ) o++;
735
- if (o < t && s[o] === '"') {
736
- for (o++; o < t; ) {
737
- if (s[o] === '"') {
738
- const r = o + 1;
739
- if (r >= t || s[r] === " ") {
740
- o++;
741
- break;
742
- }
743
- if (s[r] === "$" && (r + 1 >= t || s[r + 1] === " ")) {
744
- o += 2;
745
- break;
746
- }
747
- }
748
- o++;
749
- }
750
- e.push(s.substring(n, o)), n = o;
751
- } else {
752
- for (; o < t && s[o] !== " "; ) o++;
753
- e.push(s.substring(n, o)), n = o;
754
- }
755
- }
756
- return e;
757
- }
758
- function Yt(s, e = {}) {
759
- return s.replace(/\\\|/g, Ht).split(Kt).map((n) => {
760
- const o = n.replace(/\u0000/g, "|"), r = Gt(o.trim()).filter((u) => u && !!u.trim()), a = [];
761
- for (let u = 0, c = r.length; u < c; u += 1) {
762
- const i = r[u];
763
- let l = !1, m = -1;
764
- for (; !l && ++m < Re; ) {
765
- const _ = _e[m], d = _.isMultiMatch(i);
766
- d && (a.push(new _(d, e)), l = !0);
767
- }
768
- if (!l)
769
- for (m = -1; ++m < Re; ) {
770
- const _ = _e[m], d = _.isSingleMatch(i);
771
- if (d) {
772
- a.push(new _(d, e));
773
- break;
774
- }
775
- }
776
- }
777
- return a;
778
- });
779
- }
780
- const Qt = /* @__PURE__ */ new Set([Ue.type, We.type]);
781
- class Jt {
782
- constructor(e, {
783
- isCaseSensitive: t = D.isCaseSensitive,
784
- ignoreDiacritics: n = D.ignoreDiacritics,
785
- includeMatches: o = D.includeMatches,
786
- minMatchCharLength: r = D.minMatchCharLength,
787
- ignoreLocation: a = D.ignoreLocation,
788
- findAllMatches: u = D.findAllMatches,
789
- location: c = D.location,
790
- threshold: i = D.threshold,
791
- distance: l = D.distance
792
- } = {}) {
793
- this.query = null, this.options = {
794
- isCaseSensitive: t,
795
- ignoreDiacritics: n,
796
- includeMatches: o,
797
- minMatchCharLength: r,
798
- findAllMatches: u,
799
- ignoreLocation: a,
800
- location: c,
801
- threshold: i,
802
- distance: l
803
- }, e = t ? e : e.toLowerCase(), e = n ? te(e) : e, this.pattern = e, this.query = Yt(this.pattern, this.options);
804
- }
805
- static condition(e, t) {
806
- return t.useExtendedSearch;
807
- }
808
- // Note: searchIn operates on a single text value and sets hasInverse on the
809
- // result when inverse patterns are involved. _searchObjectList uses this to
810
- // switch from "ANY key" to "ALL keys" aggregation. See #712.
811
- searchIn(e) {
812
- const t = this.query;
813
- if (!t)
814
- return {
815
- isMatch: !1,
816
- score: 1
817
- };
818
- const {
819
- includeMatches: n,
820
- isCaseSensitive: o,
821
- ignoreDiacritics: r
822
- } = this.options;
823
- e = o ? e : e.toLowerCase(), e = r ? te(e) : e;
824
- let a = 0;
825
- const u = [];
826
- let c = 0, i = !1;
827
- for (let l = 0, m = t.length; l < m; l += 1) {
828
- const _ = t[l];
829
- u.length = 0, a = 0, i = !1;
830
- for (let d = 0, f = _.length; d < f; d += 1) {
831
- const v = _[d], {
832
- isMatch: C,
833
- indices: $,
834
- score: j
835
- } = v.search(e);
836
- if (C) {
837
- a += 1, c += j;
838
- const w = v.constructor.type;
839
- w.startsWith("inverse") && (i = !0), n && (Qt.has(w) ? u.push(...$) : u.push($));
840
- } else {
841
- c = 0, a = 0, u.length = 0, i = !1;
842
- break;
843
- }
844
- }
845
- if (a) {
846
- const d = {
847
- isMatch: !0,
848
- score: c / a
849
- };
850
- return i && (d.hasInverse = !0), n && (d.indices = we(u)), d;
851
- }
852
- }
853
- return {
854
- isMatch: !1,
855
- score: 1
856
- };
857
- }
858
- }
859
- const xe = [];
860
- function Ie(...s) {
861
- xe.push(...s);
862
- }
863
- function le(s, e) {
864
- for (let t = 0, n = xe.length; t < n; t += 1) {
865
- const o = xe[t];
866
- if (o.condition(s, e))
867
- return new o(s, e);
868
- }
869
- return new Me(s, e);
870
- }
871
- const ce = {
872
- AND: "$and",
873
- OR: "$or"
874
- }, ye = {
875
- PATH: "$path",
876
- PATTERN: "$val"
877
- }, De = (s) => !!(s[ce.AND] || s[ce.OR]), Xt = (s) => !!s[ye.PATH], Zt = (s) => !K(s) && Ne(s) && !De(s), je = (s) => ({
878
- [ce.AND]: Object.keys(s).map((e) => ({
879
- [e]: s[e]
880
- }))
881
- });
882
- function He(s, e, {
883
- auto: t = !0
884
- } = {}) {
885
- const n = (o) => {
886
- if (N(o)) {
887
- const c = {
888
- keyId: null,
889
- pattern: o
890
- };
891
- return t && (c.searcher = le(o, e)), c;
892
- }
893
- const r = Object.keys(o), a = Xt(o);
894
- if (!a && r.length > 1 && !De(o))
895
- return n(je(o));
896
- if (Zt(o)) {
897
- const c = a ? o[ye.PATH] : r[0], i = a ? o[ye.PATTERN] : o[c];
898
- if (!N(i))
899
- throw new Error(bt(c));
900
- const l = {
901
- keyId: ve(c),
902
- pattern: i
903
- };
904
- return t && (l.searcher = le(i, e)), l;
905
- }
906
- const u = {
907
- children: [],
908
- operator: r[0]
909
- };
910
- return r.forEach((c) => {
911
- const i = o[c];
912
- K(i) && i.forEach((l) => {
913
- u.children.push(n(l));
914
- });
915
- }), u;
916
- };
917
- return De(s) || (s = je(s)), n(s);
918
- }
919
- function be(s, {
920
- ignoreFieldNorm: e = D.ignoreFieldNorm
921
- }) {
922
- let t = 1;
923
- return s.forEach(({
924
- key: n,
925
- norm: o,
926
- score: r
927
- }) => {
928
- const a = n ? n.weight : null;
929
- t *= Math.pow(r === 0 && a ? Number.EPSILON : r, (a || 1) * (e ? 1 : o));
930
- }), t;
931
- }
932
- function qt(s, {
933
- ignoreFieldNorm: e = D.ignoreFieldNorm
934
- }) {
935
- s.forEach((t) => {
936
- t.score = be(t.matches, {
937
- ignoreFieldNorm: e
938
- });
939
- });
940
- }
941
- class es {
942
- constructor(e) {
943
- this.limit = e, this.heap = [];
944
- }
945
- get size() {
946
- return this.heap.length;
947
- }
948
- shouldInsert(e) {
949
- return this.size < this.limit || e < this.heap[0].score;
950
- }
951
- insert(e) {
952
- this.size < this.limit ? (this.heap.push(e), this._bubbleUp(this.size - 1)) : e.score < this.heap[0].score && (this.heap[0] = e, this._sinkDown(0));
953
- }
954
- extractSorted(e) {
955
- return this.heap.sort(e);
956
- }
957
- _bubbleUp(e) {
958
- const t = this.heap;
959
- for (; e > 0; ) {
960
- const n = e - 1 >> 1;
961
- if (t[e].score <= t[n].score) break;
962
- const o = t[e];
963
- t[e] = t[n], t[n] = o, e = n;
964
- }
965
- }
966
- _sinkDown(e) {
967
- const t = this.heap, n = t.length;
968
- let o = e;
969
- do {
970
- e = o;
971
- const r = 2 * e + 1, a = 2 * e + 2;
972
- if (r < n && t[r].score > t[o].score && (o = r), a < n && t[a].score > t[o].score && (o = a), o !== e) {
973
- const u = t[e];
974
- t[e] = t[o], t[o] = u;
975
- }
976
- } while (o !== e);
977
- }
978
- }
979
- function ts(s, e) {
980
- const t = s.matches;
981
- e.matches = [], L(t) && t.forEach((n) => {
982
- if (!L(n.indices) || !n.indices.length)
983
- return;
984
- const {
985
- indices: o,
986
- value: r
987
- } = n, a = {
988
- indices: o,
989
- value: r
990
- };
991
- n.key && (a.key = n.key.src), n.idx > -1 && (a.refIndex = n.idx), e.matches.push(a);
992
- });
993
- }
994
- function ss(s, e) {
995
- e.score = s.score;
996
- }
997
- function ns(s, e, {
998
- includeMatches: t = D.includeMatches,
999
- includeScore: n = D.includeScore
1000
- } = {}) {
1001
- const o = [];
1002
- return t && o.push(ts), n && o.push(ss), s.map((r) => {
1003
- const {
1004
- idx: a
1005
- } = r, u = {
1006
- item: e[a],
1007
- refIndex: a
1008
- };
1009
- return o.length && o.forEach((c) => {
1010
- c(r, u);
1011
- }), u;
1012
- });
1013
- }
1014
- const os = /\b\w+\b/g;
1015
- function Ce({
1016
- isCaseSensitive: s = !1,
1017
- ignoreDiacritics: e = !1
1018
- } = {}) {
1019
- return {
1020
- tokenize(t) {
1021
- return s || (t = t.toLowerCase()), e && (t = te(t)), t.match(os) || [];
1022
- }
1023
- };
1024
- }
1025
- function is(s, e, t) {
1026
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1027
- let r = 0;
1028
- function a(u, c, i, l) {
1029
- const m = t.tokenize(u);
1030
- if (!m.length) return;
1031
- r++;
1032
- const _ = /* @__PURE__ */ new Map();
1033
- for (const d of m)
1034
- _.set(d, (_.get(d) || 0) + 1);
1035
- for (const [d, f] of _) {
1036
- const v = {
1037
- docIdx: c,
1038
- keyIdx: i,
1039
- subIdx: l,
1040
- tf: f
1041
- };
1042
- let C = n.get(d);
1043
- C || (C = [], n.set(d, C)), C.push(v), o.set(d, (o.get(d) || 0) + 1);
1044
- }
1045
- }
1046
- for (const u of s) {
1047
- const {
1048
- i: c,
1049
- v: i,
1050
- $: l
1051
- } = u;
1052
- if (i !== void 0) {
1053
- a(i, c, -1, -1);
1054
- continue;
1055
- }
1056
- if (l)
1057
- for (let m = 0; m < e; m++) {
1058
- const _ = l[m];
1059
- if (_)
1060
- if (Array.isArray(_))
1061
- for (const d of _)
1062
- a(d.v, c, m, d.i ?? -1);
1063
- else
1064
- a(_.v, c, m, -1);
1065
- }
1066
- }
1067
- return {
1068
- terms: n,
1069
- fieldCount: r,
1070
- df: o
1071
- };
1072
- }
1073
- function as(s, e, t, n) {
1074
- const {
1075
- i: o,
1076
- v: r,
1077
- $: a
1078
- } = e;
1079
- function u(c, i, l) {
1080
- const m = n.tokenize(c);
1081
- if (!m.length) return;
1082
- s.fieldCount++;
1083
- const _ = /* @__PURE__ */ new Map();
1084
- for (const d of m)
1085
- _.set(d, (_.get(d) || 0) + 1);
1086
- for (const [d, f] of _) {
1087
- const v = {
1088
- docIdx: o,
1089
- keyIdx: i,
1090
- subIdx: l,
1091
- tf: f
1092
- };
1093
- let C = s.terms.get(d);
1094
- C || (C = [], s.terms.set(d, C)), C.push(v), s.df.set(d, (s.df.get(d) || 0) + 1);
1095
- }
1096
- }
1097
- if (r !== void 0) {
1098
- u(r, -1, -1);
1099
- return;
1100
- }
1101
- if (a)
1102
- for (let c = 0; c < t; c++) {
1103
- const i = a[c];
1104
- if (i)
1105
- if (Array.isArray(i))
1106
- for (const l of i)
1107
- u(l.v, c, l.i ?? -1);
1108
- else
1109
- u(i.v, c, -1);
1110
- }
1111
- }
1112
- function Te(s, e) {
1113
- for (const [t, n] of s.terms) {
1114
- const o = n.filter((a) => a.docIdx !== e), r = n.length - o.length;
1115
- r > 0 && (s.fieldCount -= r, s.df.set(t, (s.df.get(t) || 0) - r), o.length === 0 ? (s.terms.delete(t), s.df.delete(t)) : s.terms.set(t, o));
1116
- }
1117
- }
1118
- class X {
1119
- // Statics are assigned in entry.ts
1120
- constructor(e, t, n) {
1121
- this.options = {
1122
- ...D,
1123
- ...t
1124
- }, this.options.useExtendedSearch, this.options.useTokenSearch, this._keyStore = new wt(this.options.keys), this._docs = e, this._myIndex = null, this._invertedIndex = null, this.setCollection(e, n), this._lastQuery = null, this._lastSearcher = null;
1125
- }
1126
- _getSearcher(e) {
1127
- if (this._lastQuery === e)
1128
- return this._lastSearcher;
1129
- const t = this._invertedIndex ? {
1130
- ...this.options,
1131
- _invertedIndex: this._invertedIndex
1132
- } : this.options, n = le(e, t);
1133
- return this._lastQuery = e, this._lastSearcher = n, n;
1134
- }
1135
- setCollection(e, t) {
1136
- if (this._docs = e, t && !(t instanceof ke))
1137
- throw new Error(Dt);
1138
- if (this._myIndex = t || ze(this.options.keys, this._docs, {
1139
- getFn: this.options.getFn,
1140
- fieldNormWeight: this.options.fieldNormWeight
1141
- }), this.options.useTokenSearch) {
1142
- const n = Ce({
1143
- isCaseSensitive: this.options.isCaseSensitive,
1144
- ignoreDiacritics: this.options.ignoreDiacritics
1145
- });
1146
- this._invertedIndex = is(this._myIndex.records, this._myIndex.keys.length, n);
1147
- }
1148
- }
1149
- add(e) {
1150
- if (L(e) && (this._docs.push(e), this._myIndex.add(e), this._invertedIndex)) {
1151
- const t = this._myIndex.records[this._myIndex.records.length - 1], n = Ce({
1152
- isCaseSensitive: this.options.isCaseSensitive,
1153
- ignoreDiacritics: this.options.ignoreDiacritics
1154
- });
1155
- as(this._invertedIndex, t, this._myIndex.keys.length, n);
1156
- }
1157
- }
1158
- remove(e = () => !1) {
1159
- const t = [], n = [];
1160
- for (let o = 0, r = this._docs.length; o < r; o += 1)
1161
- e(this._docs[o], o) && (t.push(this._docs[o]), n.push(o));
1162
- if (n.length) {
1163
- if (this._invertedIndex)
1164
- for (const o of n)
1165
- Te(this._invertedIndex, o);
1166
- for (let o = n.length - 1; o >= 0; o -= 1)
1167
- this._docs.splice(n[o], 1);
1168
- this._myIndex.removeAll(n);
1169
- }
1170
- return t;
1171
- }
1172
- removeAt(e) {
1173
- this._invertedIndex && Te(this._invertedIndex, e);
1174
- const t = this._docs.splice(e, 1)[0];
1175
- return this._myIndex.removeAt(e), t;
1176
- }
1177
- getIndex() {
1178
- return this._myIndex;
1179
- }
1180
- search(e, t) {
1181
- const {
1182
- limit: n = -1
1183
- } = t || {}, {
1184
- includeMatches: o,
1185
- includeScore: r,
1186
- shouldSort: a,
1187
- sortFn: u,
1188
- ignoreFieldNorm: c
1189
- } = this.options;
1190
- if (N(e) && !e.trim()) {
1191
- let m = this._docs.map((_, d) => ({
1192
- item: _,
1193
- refIndex: d
1194
- }));
1195
- return re(n) && n > -1 && (m = m.slice(0, n)), m;
1196
- }
1197
- const i = re(n) && n > 0 && N(e);
1198
- let l;
1199
- if (i) {
1200
- const m = new es(n);
1201
- N(this._docs[0]) ? this._searchStringList(e, {
1202
- heap: m,
1203
- ignoreFieldNorm: c
1204
- }) : this._searchObjectList(e, {
1205
- heap: m,
1206
- ignoreFieldNorm: c
1207
- }), l = m.extractSorted(u);
1208
- } else
1209
- l = N(e) ? N(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e), qt(l, {
1210
- ignoreFieldNorm: c
1211
- }), a && l.sort(u), re(n) && n > -1 && (l = l.slice(0, n));
1212
- return ns(l, this._docs, {
1213
- includeMatches: o,
1214
- includeScore: r
1215
- });
1216
- }
1217
- _searchStringList(e, {
1218
- heap: t,
1219
- ignoreFieldNorm: n
1220
- } = {}) {
1221
- const o = this._getSearcher(e), {
1222
- records: r
1223
- } = this._myIndex, a = t ? null : [];
1224
- return r.forEach(({
1225
- v: u,
1226
- i: c,
1227
- n: i
1228
- }) => {
1229
- if (!L(u))
1230
- return;
1231
- const {
1232
- isMatch: l,
1233
- score: m,
1234
- indices: _
1235
- } = o.searchIn(u);
1236
- if (l) {
1237
- const d = {
1238
- item: u,
1239
- idx: c,
1240
- matches: [{
1241
- score: m,
1242
- value: u,
1243
- norm: i,
1244
- indices: _
1245
- }]
1246
- };
1247
- t ? (d.score = be(d.matches, {
1248
- ignoreFieldNorm: n
1249
- }), t.shouldInsert(d.score) && t.insert(d)) : a.push(d);
1250
- }
1251
- }), a;
1252
- }
1253
- _searchLogical(e) {
1254
- const t = He(e, this.options), n = (u, c, i) => {
1255
- if (!("children" in u)) {
1256
- const {
1257
- keyId: d,
1258
- searcher: f
1259
- } = u;
1260
- let v;
1261
- return d === null ? (v = [], this._myIndex.keys.forEach((C, $) => {
1262
- v.push(...this._findMatches({
1263
- key: C,
1264
- value: c[$],
1265
- searcher: f
1266
- }));
1267
- })) : v = this._findMatches({
1268
- key: this._keyStore.get(d),
1269
- value: this._myIndex.getValueForItemAtKeyId(c, d),
1270
- searcher: f
1271
- }), v && v.length ? [{
1272
- idx: i,
1273
- item: c,
1274
- matches: v
1275
- }] : [];
1276
- }
1277
- const {
1278
- children: l,
1279
- operator: m
1280
- } = u, _ = [];
1281
- for (let d = 0, f = l.length; d < f; d += 1) {
1282
- const v = l[d], C = n(v, c, i);
1283
- if (C.length)
1284
- _.push(...C);
1285
- else if (m === ce.AND)
1286
- return [];
1287
- }
1288
- return _;
1289
- }, o = this._myIndex.records, r = /* @__PURE__ */ new Map(), a = [];
1290
- return o.forEach(({
1291
- $: u,
1292
- i: c
1293
- }) => {
1294
- if (L(u)) {
1295
- const i = n(t, u, c);
1296
- i.length && (r.has(c) || (r.set(c, {
1297
- idx: c,
1298
- item: u,
1299
- matches: []
1300
- }), a.push(r.get(c))), i.forEach(({
1301
- matches: l
1302
- }) => {
1303
- r.get(c).matches.push(...l);
1304
- }));
1305
- }
1306
- }), a;
1307
- }
1308
- // When a search involves inverse patterns (e.g. !Syrup), the aggregation
1309
- // across keys switches from "ANY key matches" to "ALL keys must match."
1310
- // This is signaled by hasInverse on the SearchResult from ExtendedSearch.
1311
- //
1312
- // For mixed patterns like "^hello !Syrup", a key failure is ambiguous —
1313
- // it could be the positive or inverse term that failed. In that case we
1314
- // conservatively exclude the item, which is strictly better than the old
1315
- // behavior of including it. See: https://github.com/krisk/Fuse/issues/712
1316
- _searchObjectList(e, {
1317
- heap: t,
1318
- ignoreFieldNorm: n
1319
- } = {}) {
1320
- const o = this._getSearcher(e), {
1321
- keys: r,
1322
- records: a
1323
- } = this._myIndex, u = t ? null : [];
1324
- return a.forEach(({
1325
- $: c,
1326
- i
1327
- }) => {
1328
- if (!L(c))
1329
- return;
1330
- const l = [];
1331
- let m = !1, _ = !1;
1332
- if (r.forEach((d, f) => {
1333
- const v = this._findMatches({
1334
- key: d,
1335
- value: c[f],
1336
- searcher: o
1337
- });
1338
- v.length ? (l.push(...v), v[0].hasInverse && (_ = !0)) : m = !0;
1339
- }), !(_ && m) && l.length) {
1340
- const d = {
1341
- idx: i,
1342
- item: c,
1343
- matches: l
1344
- };
1345
- t ? (d.score = be(d.matches, {
1346
- ignoreFieldNorm: n
1347
- }), t.shouldInsert(d.score) && t.insert(d)) : u.push(d);
1348
- }
1349
- }), u;
1350
- }
1351
- _findMatches({
1352
- key: e,
1353
- value: t,
1354
- searcher: n
1355
- }) {
1356
- if (!L(t))
1357
- return [];
1358
- const o = [];
1359
- if (K(t))
1360
- t.forEach(({
1361
- v: r,
1362
- i: a,
1363
- n: u
1364
- }) => {
1365
- if (!L(r))
1366
- return;
1367
- const {
1368
- isMatch: c,
1369
- score: i,
1370
- indices: l,
1371
- hasInverse: m
1372
- } = n.searchIn(r);
1373
- c && o.push({
1374
- score: i,
1375
- key: e,
1376
- value: r,
1377
- idx: a,
1378
- norm: u,
1379
- indices: l,
1380
- hasInverse: m
1381
- });
1382
- });
1383
- else {
1384
- const {
1385
- v: r,
1386
- n: a
1387
- } = t, {
1388
- isMatch: u,
1389
- score: c,
1390
- indices: i,
1391
- hasInverse: l
1392
- } = n.searchIn(r);
1393
- u && o.push({
1394
- score: c,
1395
- key: e,
1396
- value: r,
1397
- norm: a,
1398
- indices: i,
1399
- hasInverse: l
1400
- });
1401
- }
1402
- return o;
1403
- }
1404
- }
1405
- class rs {
1406
- static condition(e, t) {
1407
- return t.useTokenSearch;
1408
- }
1409
- constructor(e, t) {
1410
- this.options = t, this.analyzer = Ce({
1411
- isCaseSensitive: t.isCaseSensitive,
1412
- ignoreDiacritics: t.ignoreDiacritics
1413
- });
1414
- const n = this.analyzer.tokenize(e), o = t._invertedIndex, {
1415
- df: r,
1416
- fieldCount: a
1417
- } = o;
1418
- this.termSearchers = [], this.idfWeights = [];
1419
- for (const u of n) {
1420
- this.termSearchers.push(new Me(u, {
1421
- location: t.location,
1422
- threshold: t.threshold,
1423
- distance: t.distance,
1424
- includeMatches: t.includeMatches,
1425
- findAllMatches: t.findAllMatches,
1426
- minMatchCharLength: t.minMatchCharLength,
1427
- isCaseSensitive: t.isCaseSensitive,
1428
- ignoreDiacritics: t.ignoreDiacritics,
1429
- ignoreLocation: !0
1430
- }));
1431
- const c = r.get(u) || 0, i = Math.log(1 + (a - c + 0.5) / (c + 0.5));
1432
- this.idfWeights.push(i);
1433
- }
1434
- }
1435
- searchIn(e) {
1436
- if (!this.termSearchers.length)
1437
- return {
1438
- isMatch: !1,
1439
- score: 1
1440
- };
1441
- const t = [];
1442
- let n = 0, o = 0, r = 0;
1443
- for (let c = 0; c < this.termSearchers.length; c++) {
1444
- const i = this.termSearchers[c].searchIn(e), l = this.idfWeights[c];
1445
- o += l, i.isMatch && (r++, n += l * (1 - i.score), i.indices && t.push(...i.indices));
1446
- }
1447
- if (r === 0)
1448
- return {
1449
- isMatch: !1,
1450
- score: 1
1451
- };
1452
- const a = o > 0 ? 1 - n / o : 0, u = {
1453
- isMatch: !0,
1454
- score: Math.max(1e-3, a)
1455
- };
1456
- return this.options.includeMatches && t.length && (u.indices = we(t)), u;
1457
- }
1458
- }
1459
- X.version = "7.3.0";
1460
- X.createIndex = ze;
1461
- X.parseIndex = Rt;
1462
- X.config = D;
1463
- X.match = function(s, e, t) {
1464
- return le(s, {
1465
- ...D,
1466
- ...t
1467
- }).searchIn(e);
1468
- };
1469
- X.parseQuery = He;
1470
- Ie(Jt);
1471
- Ie(rs);
1472
- X.use = function(...s) {
1473
- s.forEach((e) => Ie(e));
1474
- };
1475
- const Y = (s) => s == null ? "—" : `€${s.toFixed(2)}`, ls = (s) => {
1476
- if (!s) return "—";
1477
- if (s < 60) return `${s} min`;
1478
- const e = Math.floor(s / 60), t = s % 60;
1479
- return t > 0 ? `${e}h ${t}min` : `${e}h`;
1480
- }, cs = (s) => {
1481
- switch (s) {
1482
- case "confirmed":
1483
- return "Confirmed";
1484
- case "completed":
1485
- return "Completed";
1486
- case "pending":
1487
- return "Pending";
1488
- case "cancelled":
1489
- return "Cancelled";
1490
- default:
1491
- return s || "Unknown";
1492
- }
1493
- }, Oe = (s) => {
1494
- switch (s) {
1495
- case "confirmed":
1496
- case "completed":
1497
- return "#16a34a";
1498
- // green-600
1499
- case "pending":
1500
- return "#ca8a04";
1501
- // yellow-600
1502
- case "cancelled":
1503
- return "#dc2626";
1504
- // red-600
1505
- default:
1506
- return "#6b7280";
1507
- }
1508
- }, us = (s, e = {}) => {
1509
- const t = `${s.customerInfo?.firstName || ""} ${s.customerInfo?.lastName || ""}`.trim() || "Unknown Customer", n = s.id?.slice(0, 8) || "—", o = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
1510
- year: "numeric",
1511
- month: "long",
1512
- day: "numeric"
1513
- }), r = `
1514
- <!DOCTYPE html>
1515
- <html lang="en">
1516
- <head>
1517
- <meta charset="UTF-8">
1518
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
1519
- <title>Reservation ${n}</title>
1520
- <style>
1521
- * {
1522
- margin: 0;
1523
- padding: 0;
1524
- box-sizing: border-box;
1525
- }
1526
-
1527
- body {
1528
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1529
- line-height: 1.6;
1530
- color: #1f2937;
1531
- background: #fff;
1532
- padding: 40px;
1533
- max-width: 800px;
1534
- margin: 0 auto;
1535
- }
1536
-
1537
- .header {
1538
- display: flex;
1539
- justify-content: space-between;
1540
- align-items: flex-start;
1541
- margin-bottom: 40px;
1542
- padding-bottom: 20px;
1543
- border-bottom: 2px solid #e5e7eb;
1544
- }
1545
-
1546
- .company-info {
1547
- display: flex;
1548
- align-items: center;
1549
- gap: 16px;
1550
- }
1551
-
1552
- .company-logo {
1553
- max-height: 50px;
1554
- max-width: 150px;
1555
- object-fit: contain;
1556
- }
1557
-
1558
- .company-name {
1559
- font-size: 24px;
1560
- font-weight: 700;
1561
- color: #111827;
1562
- }
1563
-
1564
- .document-info {
1565
- text-align: right;
1566
- }
1567
-
1568
- .document-title {
1569
- font-size: 28px;
1570
- font-weight: 700;
1571
- color: #111827;
1572
- margin-bottom: 8px;
1573
- }
1574
-
1575
- .booking-id {
1576
- font-size: 14px;
1577
- color: #6b7280;
1578
- }
1579
-
1580
- .status-badge {
1581
- display: inline-block;
1582
- padding: 4px 12px;
1583
- border-radius: 9999px;
1584
- font-size: 12px;
1585
- font-weight: 600;
1586
- text-transform: uppercase;
1587
- margin-top: 8px;
1588
- }
1589
-
1590
- .section {
1591
- margin-bottom: 32px;
1592
- }
1593
-
1594
- .section-title {
1595
- font-size: 12px;
1596
- font-weight: 600;
1597
- text-transform: uppercase;
1598
- letter-spacing: 0.05em;
1599
- color: #6b7280;
1600
- margin-bottom: 12px;
1601
- }
1602
-
1603
- .section-content {
1604
- background: #f9fafb;
1605
- border-radius: 8px;
1606
- padding: 20px;
1607
- }
1608
-
1609
- .customer-name {
1610
- font-size: 18px;
1611
- font-weight: 600;
1612
- margin-bottom: 8px;
1613
- }
1614
-
1615
- .contact-info {
1616
- font-size: 14px;
1617
- color: #4b5563;
1618
- }
1619
-
1620
- .contact-info a {
1621
- color: #4b5563;
1622
- text-decoration: none;
1623
- }
1624
-
1625
- .grid {
1626
- display: grid;
1627
- grid-template-columns: 1fr 1fr;
1628
- gap: 16px;
1629
- }
1630
-
1631
- .info-card {
1632
- background: #f9fafb;
1633
- border-radius: 8px;
1634
- padding: 16px;
1635
- }
1636
-
1637
- .info-label {
1638
- font-size: 12px;
1639
- color: #6b7280;
1640
- margin-bottom: 4px;
1641
- }
1642
-
1643
- .info-value {
1644
- font-size: 16px;
1645
- font-weight: 600;
1646
- }
1647
-
1648
- .package-row {
1649
- display: flex;
1650
- justify-content: space-between;
1651
- align-items: flex-start;
1652
- }
1653
-
1654
- .package-name {
1655
- font-size: 16px;
1656
- font-weight: 600;
1657
- }
1658
-
1659
- .package-duration {
1660
- font-size: 14px;
1661
- color: #6b7280;
1662
- }
1663
-
1664
- .package-price {
1665
- font-size: 16px;
1666
- font-weight: 600;
1667
- }
1668
-
1669
- .payment-row {
1670
- display: flex;
1671
- justify-content: space-between;
1672
- padding: 8px 0;
1673
- font-size: 14px;
1674
- }
1675
-
1676
- .payment-label {
1677
- color: #6b7280;
1678
- }
1679
-
1680
- .payment-value {
1681
- font-weight: 500;
1682
- }
1683
-
1684
- .payment-value.green {
1685
- color: #16a34a;
1686
- }
1687
-
1688
- .payment-value.orange {
1689
- color: #ea580c;
1690
- }
1691
-
1692
- .payment-divider {
1693
- border-top: 1px solid #e5e7eb;
1694
- margin: 12px 0;
1695
- }
1696
-
1697
- .payment-total {
1698
- font-size: 16px;
1699
- font-weight: 600;
1700
- }
1701
-
1702
- .footer {
1703
- margin-top: 60px;
1704
- padding-top: 20px;
1705
- border-top: 1px solid #e5e7eb;
1706
- text-align: center;
1707
- font-size: 12px;
1708
- color: #9ca3af;
1709
- }
1710
-
1711
- @media print {
1712
- body {
1713
- padding: 20px;
1714
- }
1715
-
1716
- .no-print {
1717
- display: none;
1718
- }
1719
- }
1720
- </style>
1721
- </head>
1722
- <body>
1723
- <div class="header">
1724
- <div class="company-info">
1725
- ${e.companyLogo ? `<img src="${e.companyLogo}" alt="Logo" class="company-logo" />` : ""}
1726
- ${e.companyName ? `<span class="company-name">${e.companyName}</span>` : ""}
1727
- </div>
1728
- <div class="document-info">
1729
- <div class="document-title">Reservation</div>
1730
- <div class="booking-id">Booking #${n}</div>
1731
- <div
1732
- class="status-badge"
1733
- style="background-color: ${Oe(s.status)}20; color: ${Oe(s.status)};"
1734
- >
1735
- ${cs(s.status)}
1736
- </div>
1737
- </div>
1738
- </div>
1739
-
1740
- <div class="section">
1741
- <div class="section-title">Customer</div>
1742
- <div class="section-content">
1743
- <div class="customer-name">${t}</div>
1744
- <div class="contact-info">
1745
- ${s.customerInfo?.email ? `<div>Email: <a href="mailto:${s.customerInfo.email}">${s.customerInfo.email}</a></div>` : ""}
1746
- ${s.customerInfo?.phone ? `<div>Phone: <a href="tel:${s.customerInfo.phone}">${s.customerInfo.phone}</a></div>` : ""}
1747
- </div>
1748
- </div>
1749
- </div>
1750
-
1751
- <div class="section">
1752
- <div class="section-title">Reservation Details</div>
1753
- <div class="grid">
1754
- <div class="info-card">
1755
- <div class="info-label">Date</div>
1756
- <div class="info-value">${e.date || "—"}</div>
1757
- </div>
1758
- <div class="info-card">
1759
- <div class="info-label">Time</div>
1760
- <div class="info-value">${s.startTime} - ${s.endTime}</div>
1761
- </div>
1762
- <div class="info-card">
1763
- <div class="info-label">Spots</div>
1764
- <div class="info-value">${s.spots || 1} ${(s.spots || 1) === 1 ? "person" : "people"}</div>
1765
- </div>
1766
- ${e.resourceName ? `
1767
- <div class="info-card">
1768
- <div class="info-label">Resource</div>
1769
- <div class="info-value">${e.resourceName}</div>
1770
- </div>
1771
- ` : ""}
1772
- ${e.agendaName ? `
1773
- <div class="info-card">
1774
- <div class="info-label">Service</div>
1775
- <div class="info-value">${e.agendaName}</div>
1776
- </div>
1777
- ` : ""}
1778
- </div>
1779
- </div>
1780
-
1781
- ${s.pricingOption ? `
1782
- <div class="section">
1783
- <div class="section-title">Package</div>
1784
- <div class="section-content">
1785
- <div class="package-row">
1786
- <div>
1787
- <div class="package-name">${s.pricingOption.name}</div>
1788
- <div class="package-duration">${ls(s.pricingOption.duration)}</div>
1789
- </div>
1790
- <div class="package-price">${Y(s.pricingOption.price)}</div>
1791
- </div>
1792
- </div>
1793
- </div>
1794
- ` : ""}
1795
-
1796
- <div class="section">
1797
- <div class="section-title">Payment Summary</div>
1798
- <div class="section-content">
1799
- <div class="payment-row">
1800
- <span class="payment-label">Base price</span>
1801
- <span class="payment-value">${Y(s.reservationBasePrice)}</span>
1802
- </div>
1803
- ${s.reservationAddOnsPrice ? `
1804
- <div class="payment-row">
1805
- <span class="payment-label">Add-ons</span>
1806
- <span class="payment-value">${Y(s.reservationAddOnsPrice)}</span>
1807
- </div>
1808
- ` : ""}
1809
- ${s.discount ? `
1810
- <div class="payment-row">
1811
- <span class="payment-label">Discount</span>
1812
- <span class="payment-value green">-${Y(s.discount)}</span>
1813
- </div>
1814
- ` : ""}
1815
-
1816
- <div class="payment-divider"></div>
1817
-
1818
- <div class="payment-row payment-total">
1819
- <span>Reservation Total</span>
1820
- <span>${Y(s.reservationPrice)}</span>
1821
- </div>
1822
-
1823
- ${s.amountPaid !== void 0 || s.amountDue !== void 0 ? `
1824
- <div class="payment-divider"></div>
1825
-
1826
- ${s.amountPaid !== void 0 ? `
1827
- <div class="payment-row">
1828
- <span class="payment-label">Amount paid</span>
1829
- <span class="payment-value green">${Y(s.amountPaid)}</span>
1830
- </div>
1831
- ` : ""}
1832
-
1833
- ${s.amountDue !== void 0 && s.amountDue > 0 ? `
1834
- <div class="payment-row">
1835
- <span class="payment-label">Amount due</span>
1836
- <span class="payment-value orange">${Y(s.amountDue)}</span>
1837
- </div>
1838
- ` : ""}
1839
- ` : ""}
1840
- </div>
1841
- </div>
1842
-
1843
- <div class="footer">
1844
- <p>Generated on ${o}</p>
1845
- ${e.companyName ? `<p>${e.companyName}</p>` : ""}
1846
- </div>
1847
- </body>
1848
- </html>
1849
- `, a = window.open("", "_blank");
1850
- a && (a.document.write(r), a.document.close(), a.onload = () => {
1851
- a.print();
1852
- });
1853
- }, ds = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, fs = { class: "grid gap-2" }, ps = { class: "grid gap-2" }, hs = { class: "grid gap-2" }, ms = /* @__PURE__ */ se({
1854
- __name: "CancelReservationDialog",
1855
- emits: ["confirm"],
1856
- setup(s, { expose: e, emit: t }) {
1857
- const { config: n } = ne(), { sendMail: o } = Ae(n.mailAccount), r = t, a = E(!1), u = E(!1), c = E(""), i = E(""), l = E(""), m = (d) => {
1858
- u.value = !n.mailAccount, a.value = !0, d && (c.value = d.customerInfo?.email, i.value = "Cancellation of your reservation - " + new Date(d.date)?.toDateString(), l.value = `Dear ${d.customerInfo?.firstName ?? ""} ${d.customerInfo?.lastName ?? ""},
1859
-
1860
- We are writing to inform you that your reservation scheduled for ${new Date(d.date)?.toDateString()} at ${d.startTime} has been cancelled.
1861
-
1862
- Please accept our sincere apologies for any inconvenience this may cause. We would be happy to help you find an alternative time that works for you.`);
1863
- }, _ = () => {
1864
- if (!u.value) {
1865
- if (!c.value || !i.value || !l.value) return alert("Please fill in all the fields.");
1866
- o({
1867
- to: c.value,
1868
- subject: i.value,
1869
- body: l.value
1870
- });
1871
- }
1872
- a.value = !1;
1873
- const { $confetti: d } = useNuxtApp();
1874
- d(), r("confirm");
1875
- };
1876
- return e({
1877
- openDialog: m
1878
- }), (d, f) => {
1879
- const v = y("DialogTitle"), C = y("DialogDescription"), $ = y("DialogHeader"), j = y("Checkbox"), w = y("Label"), S = y("Input"), P = y("Textarea"), W = y("Button"), V = y("DialogFooter"), I = y("DialogScrollContent"), T = y("Dialog");
1880
- return R(), J(T, {
1881
- open: a.value,
1882
- "onUpdate:open": f[5] || (f[5] = (b) => a.value = b)
1883
- }, {
1884
- default: x(() => [
1885
- p(I, { class: "sm:max-w-3xl" }, {
1886
- default: x(() => [
1887
- p($, null, {
1888
- default: x(() => [
1889
- p(v, null, {
1890
- default: x(() => [...f[6] || (f[6] = [
1891
- A(" Cancel Reservation ", -1)
1892
- ])]),
1893
- _: 1
1894
- }),
1895
- p(C)
1896
- ]),
1897
- _: 1
1898
- }),
1899
- g("div", ds, [
1900
- p(j, {
1901
- modelValue: u.value,
1902
- "onUpdate:modelValue": f[0] || (f[0] = (b) => u.value = b),
1903
- id: "cancel-dialog-skip-mail",
1904
- class: "border-black/80 dark:border-gray-200",
1905
- disabled: !B(n).mailAccount
1906
- }, null, 8, ["modelValue", "disabled"]),
1907
- p(w, {
1908
- for: "cancel-dialog-skip-mail",
1909
- class: "py-4 pl-2 pr-4"
1910
- }, {
1911
- default: x(() => [...f[7] || (f[7] = [
1912
- A("Do not send email to customer", -1)
1913
- ])]),
1914
- _: 1
1915
- })
1916
- ]),
1917
- g("div", {
1918
- class: ue(["grid gap-4 py-4", { "opacity-50": u.value }])
1919
- }, [
1920
- g("div", fs, [
1921
- p(w, { for: "cancel-dialog-email" }, {
1922
- default: x(() => [...f[8] || (f[8] = [
1923
- A("To:", -1)
1924
- ])]),
1925
- _: 1
1926
- }),
1927
- p(S, {
1928
- modelValue: c.value,
1929
- "onUpdate:modelValue": f[1] || (f[1] = (b) => c.value = b),
1930
- disabled: u.value,
1931
- id: "cancel-dialog-email"
1932
- }, null, 8, ["modelValue", "disabled"])
1933
- ]),
1934
- g("div", ps, [
1935
- p(w, { for: "cancel-dialog-subject" }, {
1936
- default: x(() => [...f[9] || (f[9] = [
1937
- A("Subject:", -1)
1938
- ])]),
1939
- _: 1
1940
- }),
1941
- p(S, {
1942
- modelValue: i.value,
1943
- "onUpdate:modelValue": f[2] || (f[2] = (b) => i.value = b),
1944
- disabled: u.value,
1945
- id: "cancel-dialog-subject"
1946
- }, null, 8, ["modelValue", "disabled"])
1947
- ]),
1948
- g("div", hs, [
1949
- p(w, { for: "cancel-dialog-body" }, {
1950
- default: x(() => [...f[10] || (f[10] = [
1951
- A("Body:", -1)
1952
- ])]),
1953
- _: 1
1954
- }),
1955
- p(P, {
1956
- modelValue: l.value,
1957
- "onUpdate:modelValue": f[3] || (f[3] = (b) => l.value = b),
1958
- disabled: u.value,
1959
- id: "cancel-dialog-body"
1960
- }, null, 8, ["modelValue", "disabled"])
1961
- ])
1962
- ], 2),
1963
- p(V, null, {
1964
- default: x(() => [
1965
- p(W, {
1966
- variant: "outline",
1967
- onClick: f[4] || (f[4] = (b) => a.value = !1)
1968
- }, {
1969
- default: x(() => [...f[11] || (f[11] = [
1970
- A("Close", -1)
1971
- ])]),
1972
- _: 1
1973
- }),
1974
- p(W, {
1975
- variant: "destructive",
1976
- onClick: _
1977
- }, {
1978
- default: x(() => [...f[12] || (f[12] = [
1979
- A("Cancel reservation", -1)
1980
- ])]),
1981
- _: 1
1982
- })
1983
- ]),
1984
- _: 1
1985
- })
1986
- ]),
1987
- _: 1
1988
- })
1989
- ]),
1990
- _: 1
1991
- }, 8, ["open"]);
1992
- };
1993
- }
1994
- }), gs = /* @__PURE__ */ se({
1995
- __name: "TransferReservationDialog",
1996
- setup(s, { expose: e }) {
1997
- const { config: t } = ne(), n = E(!1);
1998
- return e({
1999
- openDialog: () => {
2000
- n.value = !0;
2001
- }
2002
- }), (r, a) => {
2003
- const u = y("DialogTitle"), c = y("DialogDescription"), i = y("DialogHeader"), l = y("Button"), m = y("DialogFooter"), _ = y("DialogScrollContent"), d = y("Dialog");
2004
- return R(), J(d, {
2005
- open: n.value,
2006
- "onUpdate:open": a[2] || (a[2] = (f) => n.value = f)
2007
- }, {
2008
- default: x(() => [
2009
- p(_, { class: "sm:max-w-3xl" }, {
2010
- default: x(() => [
2011
- p(i, null, {
2012
- default: x(() => [
2013
- p(u, null, {
2014
- default: x(() => [...a[3] || (a[3] = [
2015
- A(" Transfer Reservation ", -1)
2016
- ])]),
2017
- _: 1
2018
- }),
2019
- p(c)
2020
- ]),
2021
- _: 1
2022
- }),
2023
- a[6] || (a[6] = g("div", { class: "py-4" }, null, -1)),
2024
- p(m, null, {
2025
- default: x(() => [
2026
- p(l, {
2027
- variant: "outline",
2028
- onClick: a[0] || (a[0] = (f) => n.value = !1)
2029
- }, {
2030
- default: x(() => [...a[4] || (a[4] = [
2031
- A("Close", -1)
2032
- ])]),
2033
- _: 1
2034
- }),
2035
- p(l, {
2036
- onClick: a[1] || (a[1] = (f) => n.value = !1)
2037
- }, {
2038
- default: x(() => [...a[5] || (a[5] = [
2039
- A("Transfer reservation", -1)
2040
- ])]),
2041
- _: 1
2042
- })
2043
- ]),
2044
- _: 1
2045
- })
2046
- ]),
2047
- _: 1
2048
- })
2049
- ]),
2050
- _: 1
2051
- }, 8, ["open"]);
2052
- };
2053
- }
2054
- }), vs = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, _s = { class: "grid gap-2" }, xs = { class: "grid gap-2" }, ys = { class: "grid gap-2" }, Ds = /* @__PURE__ */ se({
2055
- __name: "ApproveReservationDialog",
2056
- emits: ["confirm"],
2057
- setup(s, { expose: e, emit: t }) {
2058
- const { config: n } = ne(), { sendMail: o } = Ae(n.mailAccount), r = t, a = E(!1), u = E("approve"), c = E(!1), i = E(""), l = E(""), m = E(""), _ = (f, v) => {
2059
- c.value = !n.mailAccount, a.value = !0, f && (v || (v = "approve"), u.value = v, i.value = f.customerInfo?.email, l.value = "Confirmation: Your reservation for " + new Date(f.date)?.toDateString(), m.value = `Dear ${f.customerInfo?.firstName ?? ""} ${f.customerInfo?.lastName ?? ""},
2060
-
2061
- This email confirms your reservation for ${new Date(f.date)?.toDateString()} at ${f.startTime}.
2062
-
2063
- We've got everything ready for you and look forward to your visit! If you need to make any changes or have special requests, please let us know.`);
2064
- }, d = () => {
2065
- if (!c.value) {
2066
- if (!i.value || !l.value || !m.value) return alert("Please fill in all the fields.");
2067
- o({
2068
- to: i.value,
2069
- subject: l.value,
2070
- body: m.value
2071
- });
2072
- }
2073
- a.value = !1;
2074
- const { $confetti: f } = useNuxtApp();
2075
- f(), r("confirm");
2076
- };
2077
- return e({
2078
- openDialog: _
2079
- }), (f, v) => {
2080
- const C = y("DialogTitle"), $ = y("DialogDescription"), j = y("DialogHeader"), w = y("Checkbox"), S = y("Label"), P = y("Input"), W = y("Textarea"), V = y("Button"), I = y("DialogFooter"), T = y("DialogScrollContent"), b = y("Dialog");
2081
- return R(), J(b, {
2082
- open: a.value,
2083
- "onUpdate:open": v[5] || (v[5] = (O) => a.value = O)
2084
- }, {
2085
- default: x(() => [
2086
- p(T, { class: "sm:max-w-3xl" }, {
2087
- default: x(() => [
2088
- p(j, null, {
2089
- default: x(() => [
2090
- p(C, null, {
2091
- default: x(() => [
2092
- A(F(u.value === "approve" ? "Approve Reservation" : "Resend Confirmation Email"), 1)
2093
- ]),
2094
- _: 1
2095
- }),
2096
- p($)
2097
- ]),
2098
- _: 1
2099
- }),
2100
- g("div", vs, [
2101
- p(w, {
2102
- modelValue: c.value,
2103
- "onUpdate:modelValue": v[0] || (v[0] = (O) => c.value = O),
2104
- id: "reject-dialog-skip-mail",
2105
- class: "border-black/80 dark:border-gray-200",
2106
- disabled: !B(n).mailAccount
2107
- }, null, 8, ["modelValue", "disabled"]),
2108
- p(S, {
2109
- for: "reject-dialog-skip-mail",
2110
- class: "py-4 pl-2 pr-4"
2111
- }, {
2112
- default: x(() => [...v[6] || (v[6] = [
2113
- A("Do not send email to customer", -1)
2114
- ])]),
2115
- _: 1
2116
- })
2117
- ]),
2118
- g("div", {
2119
- class: ue(["grid gap-4 py-4", { "opacity-50": c.value }])
2120
- }, [
2121
- g("div", _s, [
2122
- p(S, { for: "approve-dialog-email" }, {
2123
- default: x(() => [...v[7] || (v[7] = [
2124
- A("To:", -1)
2125
- ])]),
2126
- _: 1
2127
- }),
2128
- p(P, {
2129
- modelValue: i.value,
2130
- "onUpdate:modelValue": v[1] || (v[1] = (O) => i.value = O),
2131
- disabled: c.value,
2132
- id: "approve-dialog-email"
2133
- }, null, 8, ["modelValue", "disabled"])
2134
- ]),
2135
- g("div", xs, [
2136
- p(S, { for: "approve-dialog-subject" }, {
2137
- default: x(() => [...v[8] || (v[8] = [
2138
- A("Subject:", -1)
2139
- ])]),
2140
- _: 1
2141
- }),
2142
- p(P, {
2143
- modelValue: l.value,
2144
- "onUpdate:modelValue": v[2] || (v[2] = (O) => l.value = O),
2145
- disabled: c.value,
2146
- id: "approve-dialog-subject"
2147
- }, null, 8, ["modelValue", "disabled"])
2148
- ]),
2149
- g("div", ys, [
2150
- p(S, { for: "approve-dialog-body" }, {
2151
- default: x(() => [...v[9] || (v[9] = [
2152
- A("Body:", -1)
2153
- ])]),
2154
- _: 1
2155
- }),
2156
- p(W, {
2157
- modelValue: m.value,
2158
- "onUpdate:modelValue": v[3] || (v[3] = (O) => m.value = O),
2159
- disabled: c.value,
2160
- id: "approve-dialog-body"
2161
- }, null, 8, ["modelValue", "disabled"])
2162
- ])
2163
- ], 2),
2164
- p(I, null, {
2165
- default: x(() => [
2166
- p(V, {
2167
- variant: "outline",
2168
- onClick: v[4] || (v[4] = (O) => a.value = !1)
2169
- }, {
2170
- default: x(() => [...v[10] || (v[10] = [
2171
- A("Close", -1)
2172
- ])]),
2173
- _: 1
2174
- }),
2175
- p(V, { onClick: d }, {
2176
- default: x(() => [...v[11] || (v[11] = [
2177
- A("Approve reservation", -1)
2178
- ])]),
2179
- _: 1
2180
- })
2181
- ]),
2182
- _: 1
2183
- })
2184
- ]),
2185
- _: 1
2186
- })
2187
- ]),
2188
- _: 1
2189
- }, 8, ["open"]);
2190
- };
2191
- }
2192
- }), bs = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, Cs = { class: "grid gap-2" }, As = { class: "grid gap-2" }, ks = { class: "grid gap-2" }, ws = /* @__PURE__ */ se({
2193
- __name: "RejectReservationDialog",
2194
- emits: ["confirm"],
2195
- setup(s, { expose: e, emit: t }) {
2196
- const { config: n } = ne(), { sendMail: o } = Ae(n.mailAccount), r = t, a = E(!1), u = E(!1), c = E(""), i = E(""), l = E(""), m = (d) => {
2197
- u.value = !n.mailAccount, a.value = !0, d && (c.value = d.customerInfo?.email, i.value = "Regarding your reservation request for " + new Date(d.date)?.toDateString(), l.value = `Dear ${d.customerInfo?.firstName ?? ""} ${d.customerInfo?.lastName ?? ""},
2198
-
2199
- Thank you for your interest in booking with us. Unfortunately, we are unable to confirm your request for ${new Date(d.date)?.toDateString()} at ${d.startTime}.
2200
-
2201
- We would love to see you another time!`);
2202
- }, _ = () => {
2203
- if (!u.value) {
2204
- if (!c.value || !i.value || !l.value) return alert("Please fill in all the fields.");
2205
- o({
2206
- to: c.value,
2207
- subject: i.value,
2208
- body: l.value
2209
- });
2210
- }
2211
- a.value = !1;
2212
- const { $confetti: d } = useNuxtApp();
2213
- d(), r("confirm");
2214
- };
2215
- return e({
2216
- openDialog: m
2217
- }), (d, f) => {
2218
- const v = y("DialogTitle"), C = y("DialogDescription"), $ = y("DialogHeader"), j = y("Checkbox"), w = y("Label"), S = y("Input"), P = y("Textarea"), W = y("Button"), V = y("DialogFooter"), I = y("DialogScrollContent"), T = y("Dialog");
2219
- return R(), J(T, {
2220
- open: a.value,
2221
- "onUpdate:open": f[5] || (f[5] = (b) => a.value = b)
2222
- }, {
2223
- default: x(() => [
2224
- p(I, { class: "sm:max-w-3xl" }, {
2225
- default: x(() => [
2226
- p($, null, {
2227
- default: x(() => [
2228
- p(v, null, {
2229
- default: x(() => [...f[6] || (f[6] = [
2230
- A(" Reject Reservation Request ", -1)
2231
- ])]),
2232
- _: 1
2233
- }),
2234
- p(C)
2235
- ]),
2236
- _: 1
2237
- }),
2238
- g("div", bs, [
2239
- p(j, {
2240
- modelValue: u.value,
2241
- "onUpdate:modelValue": f[0] || (f[0] = (b) => u.value = b),
2242
- id: "reject-dialog-skip-mail",
2243
- class: "border-black/80 dark:border-gray-200",
2244
- disabled: !B(n).mailAccount
2245
- }, null, 8, ["modelValue", "disabled"]),
2246
- p(w, {
2247
- for: "reject-dialog-skip-mail",
2248
- class: "py-4 pl-2 pr-4"
2249
- }, {
2250
- default: x(() => [...f[7] || (f[7] = [
2251
- A("Do not send email to customer", -1)
2252
- ])]),
2253
- _: 1
2254
- })
2255
- ]),
2256
- g("div", {
2257
- class: ue(["grid gap-4 py-4", { "opacity-50": u.value }])
2258
- }, [
2259
- g("div", Cs, [
2260
- p(w, { for: "reject-dialog-email" }, {
2261
- default: x(() => [...f[8] || (f[8] = [
2262
- A("To:", -1)
2263
- ])]),
2264
- _: 1
2265
- }),
2266
- p(S, {
2267
- modelValue: c.value,
2268
- "onUpdate:modelValue": f[1] || (f[1] = (b) => c.value = b),
2269
- disabled: u.value,
2270
- id: "reject-dialog-email"
2271
- }, null, 8, ["modelValue", "disabled"])
2272
- ]),
2273
- g("div", As, [
2274
- p(w, { for: "reject-dialog-subject" }, {
2275
- default: x(() => [...f[9] || (f[9] = [
2276
- A("Subject:", -1)
2277
- ])]),
2278
- _: 1
2279
- }),
2280
- p(S, {
2281
- modelValue: i.value,
2282
- "onUpdate:modelValue": f[2] || (f[2] = (b) => i.value = b),
2283
- disabled: u.value,
2284
- id: "reject-dialog-subject"
2285
- }, null, 8, ["modelValue", "disabled"])
2286
- ]),
2287
- g("div", ks, [
2288
- p(w, { for: "reject-dialog-body" }, {
2289
- default: x(() => [...f[10] || (f[10] = [
2290
- A("Body:", -1)
2291
- ])]),
2292
- _: 1
2293
- }),
2294
- p(P, {
2295
- modelValue: l.value,
2296
- "onUpdate:modelValue": f[3] || (f[3] = (b) => l.value = b),
2297
- disabled: u.value,
2298
- id: "reject-dialog-body"
2299
- }, null, 8, ["modelValue", "disabled"])
2300
- ])
2301
- ], 2),
2302
- p(V, null, {
2303
- default: x(() => [
2304
- p(W, {
2305
- variant: "outline",
2306
- onClick: f[4] || (f[4] = (b) => a.value = !1)
2307
- }, {
2308
- default: x(() => [...f[11] || (f[11] = [
2309
- A("Close", -1)
2310
- ])]),
2311
- _: 1
2312
- }),
2313
- p(W, {
2314
- variant: "destructive",
2315
- onClick: _
2316
- }, {
2317
- default: x(() => [...f[12] || (f[12] = [
2318
- A("Reject reservation", -1)
2319
- ])]),
2320
- _: 1
2321
- })
2322
- ]),
2323
- _: 1
2324
- })
2325
- ]),
2326
- _: 1
2327
- })
2328
- ]),
2329
- _: 1
2330
- }, 8, ["open"]);
2331
- };
2332
- }
2333
- }), Ms = {
2334
- key: 0,
2335
- class: "space-y-6 py-4"
2336
- }, Is = { class: "space-y-3" }, Es = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, Ss = { class: "flex items-center gap-3" }, $s = { class: "h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center" }, Fs = { class: "font-medium" }, Bs = { class: "grid gap-2 text-sm" }, Rs = {
2337
- key: 0,
2338
- class: "flex items-center gap-2 text-muted-foreground"
2339
- }, js = ["href"], Ts = {
2340
- key: 1,
2341
- class: "flex items-center gap-2 text-muted-foreground"
2342
- }, Os = ["href"], Ns = { class: "space-y-3" }, Ls = { class: "grid grid-cols-2 gap-3" }, Ps = { class: "bg-muted/30 rounded-lg p-3" }, zs = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, Vs = { class: "font-medium" }, Us = { class: "bg-muted/30 rounded-lg p-3" }, Ws = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, Hs = { class: "font-medium" }, Ks = {
2343
- key: 0,
2344
- class: "space-y-3"
2345
- }, Gs = { class: "bg-muted/30 rounded-lg p-4" }, Ys = { class: "flex items-start justify-between" }, Qs = { class: "flex items-start gap-3" }, Js = { class: "h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center mt-0.5" }, Xs = { class: "font-medium" }, Zs = { class: "text-sm text-muted-foreground" }, qs = { class: "font-semibold" }, en = { class: "space-y-3" }, tn = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, sn = { class: "space-y-2 text-sm" }, nn = { class: "flex justify-between" }, on = {
2346
- key: 0,
2347
- class: "flex justify-between"
2348
- }, an = {
2349
- key: 1,
2350
- class: "flex justify-between text-green-600 dark:text-green-400"
2351
- }, rn = { class: "flex justify-between font-semibold" }, ln = {
2352
- key: 1,
2353
- class: "space-y-2 text-sm"
2354
- }, cn = {
2355
- key: 0,
2356
- class: "flex justify-between"
2357
- }, un = { class: "text-muted-foreground flex items-center gap-1.5" }, dn = { class: "text-green-600 dark:text-green-400" }, fn = {
2358
- key: 1,
2359
- class: "flex justify-between"
2360
- }, pn = { class: "text-muted-foreground flex items-center gap-1.5" }, hn = { class: "text-orange-600 dark:text-orange-400 font-medium" }, xn = /* @__PURE__ */ se({
2361
- __name: "ReservationDetailDialog",
2362
- emits: ["cancelled", "confirmed", "rejected"],
2363
- setup(s, { expose: e, emit: t }) {
2364
- const { hasPermission: n } = gt(), { config: o } = ne(), r = vt(o.project), a = et("event", E(null)), u = t, c = E(!1), i = E(null), l = E(!1), m = ie("cancelReservationDialog"), _ = ie("approveReservationDialog"), d = ie("rejectReservationDialog"), f = ie("transferReservationDialog"), v = (k) => {
2365
- i.value = k, c.value = !0;
2366
- }, C = he(() => i.value?.customerInfo && `${i.value.customerInfo.firstName} ${i.value.customerInfo.lastName}`.trim() || "Unknown Customer"), $ = he(() => {
2367
- let k = i.value?.status;
2368
- const h = i.value?.reservationStatus;
2369
- switch (["needs_approval", "rejected", "approved", "cancelled"].includes(h) && (k = h), k) {
2370
- case "needs_approval":
2371
- return { label: "Needs Approval", class: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400" };
2372
- case "rejected":
2373
- return { label: "Rejected", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
2374
- case "approved":
2375
- return { label: "Approved", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
2376
- case "pending":
2377
- return { label: "Pending", class: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400" };
2378
- case "cancelled":
2379
- return { label: "Cancelled", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
2380
- default:
2381
- return { label: k || "Unknown", class: "bg-muted text-muted-foreground" };
2382
- }
2383
- }), j = he(() => i.value?.status === "cancelled"), w = (k) => k == null || typeof k != "number" ? "—" : `€${k?.toFixed(2)}`, S = (k) => {
2384
- if (!k) return "—";
2385
- if (k < 60) return `${k} min`;
2386
- const h = Math.floor(k / 60), M = k % 60;
2387
- return M > 0 ? `${h}h ${M}min` : `${h}h`;
2388
- }, P = () => {
2389
- if (!i.value) return;
2390
- let k = "";
2391
- const h = a?.value?.date;
2392
- if (h)
2393
- try {
2394
- k = new Date(h).toLocaleDateString("en-US", {
2395
- weekday: "long",
2396
- year: "numeric",
2397
- month: "long",
2398
- day: "numeric"
2399
- });
2400
- } catch {
2401
- k = h;
2402
- }
2403
- const M = {
2404
- date: k,
2405
- resourceName: a?.value?.resource?.name
2406
- };
2407
- us(i.value, M);
2408
- }, W = () => {
2409
- _.value?.openDialog(i.value);
2410
- }, V = () => {
2411
- d.value?.openDialog(i.value);
2412
- }, I = () => {
2413
- _.value?.openDialog(i.value);
2414
- }, T = () => {
2415
- m.value?.openDialog(i.value);
2416
- }, b = async () => {
2417
- try {
2418
- if (l.value || !i.value?.id) throw new Error("Invalid state");
2419
- l.value = !0;
2420
- let h = (await r.get(o.reservationsCollection, i.value.id))?.reservations || [];
2421
- if (!h.find((M) => M.id === i.value.res_id))
2422
- throw new Error("Reservation not found");
2423
- h.find((M) => M.id === i.value.res_id).status = "cancelled", await r.update(o.reservationsCollection, i.value.id, {
2424
- reservations: h
2425
- }), i.value.status = "cancelled", q.success("Reservation cancelled successfully"), u("cancelled"), c.value = !1;
2426
- } catch (k) {
2427
- console.error("Error cancelling reservation:", k), q.error("Failed to cancel reservation");
2428
- } finally {
2429
- l.value = !1;
2430
- }
2431
- }, O = async () => {
2432
- try {
2433
- if (l.value || !i.value?.id) throw new Error("Invalid state");
2434
- l.value = !0;
2435
- let h = (await r.get(o.reservationsCollection, i.value.id))?.reservations || [];
2436
- if (!h.find((M) => M.id === i.value.res_id))
2437
- throw new Error("Reservation not found");
2438
- h.find((M) => M.id === i.value.res_id).status = "approved", await r.update(o.reservationsCollection, i.value.id, {
2439
- reservations: h
2440
- }), i.value.status = "approved", q.success("Reservation approved successfully"), u("confirmed"), c.value = !1;
2441
- } catch (k) {
2442
- console.error("Error approving reservation:", k), q.error("Failed to approve reservation");
2443
- } finally {
2444
- l.value = !1;
2445
- }
2446
- }, ee = async () => {
2447
- try {
2448
- if (l.value || !i.value?.id) throw new Error("Invalid state");
2449
- l.value = !0;
2450
- let h = (await r.get(o.reservationsCollection, i.value.id))?.reservations || [];
2451
- if (!h.find((M) => M.id === i.value.res_id))
2452
- throw new Error("Reservation not found");
2453
- h.find((M) => M.id === i.value.res_id).status = "rejected", await r.update(o.reservationsCollection, i.value.id, {
2454
- reservations: h
2455
- }), i.value.status = "rejected", q.success("Reservation rejected successfully"), u("rejected"), c.value = !1;
2456
- } catch (k) {
2457
- console.error("Error rejecting reservation:", k), q.error("Failed to reject reservation");
2458
- } finally {
2459
- l.value = !1;
2460
- }
2461
- }, H = () => {
2462
- };
2463
- return e({
2464
- openDialog: v
2465
- }), (k, h) => {
2466
- const M = y("DialogTitle"), Z = y("DialogDescription"), Ke = y("DialogHeader"), Ee = y("Separator"), de = y("Button"), Ge = y("DropdownMenuTrigger"), fe = y("DropdownMenuLabel"), oe = y("DropdownMenuItem"), pe = y("DropdownMenuGroup"), Se = y("DropdownMenuSeparator"), Ye = y("DropdownMenuContent"), Qe = y("DropdownMenu"), Je = y("DialogFooter"), Xe = y("DialogScrollContent"), Ze = y("Dialog");
2467
- return R(), U(me, null, [
2468
- p(Ze, {
2469
- open: c.value,
2470
- "onUpdate:open": h[0] || (h[0] = (qe) => c.value = qe)
2471
- }, {
2472
- default: x(() => [
2473
- p(Xe, { class: "sm:max-w-xl" }, {
2474
- default: x(() => [
2475
- p(Ke, null, {
2476
- default: x(() => [
2477
- p(M, { class: "flex items-center gap-3" }, {
2478
- default: x(() => [
2479
- h[1] || (h[1] = g("span", null, "Reservation Details", -1)),
2480
- g("span", {
2481
- class: ue(["px-2.5 py-1 text-xs font-medium rounded-full", $.value.class])
2482
- }, F($.value.label), 3)
2483
- ]),
2484
- _: 1
2485
- }),
2486
- p(Z, null, {
2487
- default: x(() => [
2488
- A(" Booking #" + F(i.value?.id?.slice(0, 8) || "—"), 1)
2489
- ]),
2490
- _: 1
2491
- })
2492
- ]),
2493
- _: 1
2494
- }),
2495
- i.value ? (R(), U("div", Ms, [
2496
- g("div", Is, [
2497
- h[2] || (h[2] = g("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Customer", -1)),
2498
- g("div", Es, [
2499
- g("div", Ss, [
2500
- g("div", $s, [
2501
- p(B(tt), {
2502
- size: 20,
2503
- class: "text-primary"
2504
- })
2505
- ]),
2506
- g("div", null, [
2507
- g("p", Fs, F(C.value), 1)
2508
- ])
2509
- ]),
2510
- g("div", Bs, [
2511
- i.value.customerInfo?.email ? (R(), U("div", Rs, [
2512
- p(B(st), { size: 14 }),
2513
- g("a", {
2514
- href: `mailto:${i.value.customerInfo.email}`,
2515
- class: "hover:text-foreground transition-colors"
2516
- }, F(i.value.customerInfo.email), 9, js)
2517
- ])) : z("", !0),
2518
- i.value.customerInfo?.phone ? (R(), U("div", Ts, [
2519
- p(B(nt), { size: 14 }),
2520
- g("a", {
2521
- href: `tel:${i.value.customerInfo.phone}`,
2522
- class: "hover:text-foreground transition-colors"
2523
- }, F(i.value.customerInfo.phone), 9, Os)
2524
- ])) : z("", !0)
2525
- ])
2526
- ])
2527
- ]),
2528
- g("div", Ns, [
2529
- h[5] || (h[5] = g("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Reservation", -1)),
2530
- g("div", Ls, [
2531
- g("div", Ps, [
2532
- g("div", zs, [
2533
- p(B(ot), { size: 14 }),
2534
- h[3] || (h[3] = g("span", { class: "text-xs" }, "Time", -1))
2535
- ]),
2536
- g("p", Vs, F(i.value.startTime) + " - " + F(i.value.endTime), 1)
2537
- ]),
2538
- g("div", Us, [
2539
- g("div", Ws, [
2540
- p(B(it), { size: 14 }),
2541
- h[4] || (h[4] = g("span", { class: "text-xs" }, "Spots", -1))
2542
- ]),
2543
- g("p", Hs, F(i.value.spots || 1) + " " + F(i.value.spots === 1 ? "person" : "people"), 1)
2544
- ])
2545
- ])
2546
- ]),
2547
- i.value.pricingOption ? (R(), U("div", Ks, [
2548
- h[6] || (h[6] = g("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Package", -1)),
2549
- g("div", Gs, [
2550
- g("div", Ys, [
2551
- g("div", Qs, [
2552
- g("div", Js, [
2553
- p(B(at), {
2554
- size: 18,
2555
- class: "text-primary"
2556
- })
2557
- ]),
2558
- g("div", null, [
2559
- g("p", Xs, F(i.value.pricingOption.name), 1),
2560
- g("p", Zs, F(S(i.value.pricingOption.duration)), 1)
2561
- ])
2562
- ]),
2563
- g("p", qs, F(w(i.value.pricingOption.price)), 1)
2564
- ])
2565
- ])
2566
- ])) : z("", !0),
2567
- g("div", en, [
2568
- h[13] || (h[13] = g("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Payment", -1)),
2569
- g("div", tn, [
2570
- g("div", sn, [
2571
- g("div", nn, [
2572
- h[7] || (h[7] = g("span", { class: "text-muted-foreground" }, "Base price", -1)),
2573
- g("span", null, F(w(i.value.reservationBasePrice)), 1)
2574
- ]),
2575
- i.value.reservationAddOnsPrice ? (R(), U("div", on, [
2576
- h[8] || (h[8] = g("span", { class: "text-muted-foreground" }, "Add-ons", -1)),
2577
- g("span", null, F(w(i.value.reservationAddOnsPrice)), 1)
2578
- ])) : z("", !0),
2579
- i.value.discount ? (R(), U("div", an, [
2580
- h[9] || (h[9] = g("span", null, "Discount", -1)),
2581
- g("span", null, "-" + F(w(i.value.discount)), 1)
2582
- ])) : z("", !0)
2583
- ]),
2584
- p(Ee),
2585
- g("div", rn, [
2586
- h[10] || (h[10] = g("span", null, "Reservation Total", -1)),
2587
- g("span", null, F(w(i.value.reservationPrice)), 1)
2588
- ]),
2589
- i.value.amountPaid !== void 0 || i.value.amountDue !== void 0 ? (R(), J(Ee, { key: 0 })) : z("", !0),
2590
- i.value.amountPaid !== void 0 || i.value.amountDue !== void 0 ? (R(), U("div", ln, [
2591
- i.value.amountPaid !== void 0 ? (R(), U("div", cn, [
2592
- g("span", un, [
2593
- p(B(rt), { size: 14 }),
2594
- h[11] || (h[11] = A(" Amount paid ", -1))
2595
- ]),
2596
- g("span", dn, F(w(i.value.amountPaid)), 1)
2597
- ])) : z("", !0),
2598
- i.value.amountDue !== void 0 && i.value.amountDue > 0 ? (R(), U("div", fn, [
2599
- g("span", pn, [
2600
- p(B(lt), { size: 14 }),
2601
- h[12] || (h[12] = A(" Amount due ", -1))
2602
- ]),
2603
- g("span", hn, F(w(i.value.amountDue)), 1)
2604
- ])) : z("", !0)
2605
- ])) : z("", !0)
2606
- ])
2607
- ])
2608
- ])) : z("", !0),
2609
- p(Je, { class: "gap-2 sm:justify-between" }, {
2610
- default: x(() => [
2611
- i.value.reservationStatus === "needs_approval" ? (R(), U(me, { key: 0 }, [
2612
- p(de, {
2613
- variant: "destructive",
2614
- onClick: V
2615
- }, {
2616
- default: x(() => [
2617
- p(B(ct), { size: 16 }),
2618
- h[14] || (h[14] = A(" Reject Reservation ", -1))
2619
- ]),
2620
- _: 1
2621
- }),
2622
- p(de, { onClick: W }, {
2623
- default: x(() => [
2624
- p(B(ut), { size: 16 }),
2625
- h[15] || (h[15] = A(" Approve Reservation ", -1))
2626
- ]),
2627
- _: 1
2628
- })
2629
- ], 64)) : i.value.reservationStatus === "approved" ? (R(), J(Qe, { key: 1 }, {
2630
- default: x(() => [
2631
- p(Ge, { "as-child": "" }, {
2632
- default: x(() => [
2633
- p(de, {
2634
- variant: "outline",
2635
- class: "gap-2"
2636
- }, {
2637
- default: x(() => [
2638
- p(B(dt), { size: 16 }),
2639
- h[16] || (h[16] = A(" Actions ", -1))
2640
- ]),
2641
- _: 1
2642
- })
2643
- ]),
2644
- _: 1
2645
- }),
2646
- p(Ye, {
2647
- class: "w-60",
2648
- align: "start"
2649
- }, {
2650
- default: x(() => [
2651
- p(fe, { class: "text-xs text-muted-foreground font-normal" }, {
2652
- default: x(() => [...h[17] || (h[17] = [
2653
- A(" Reservation Actions ", -1)
2654
- ])]),
2655
- _: 1
2656
- }),
2657
- p(pe, null, {
2658
- default: x(() => [
2659
- p(oe, {
2660
- onClick: P,
2661
- class: "gap-2 cursor-pointer"
2662
- }, {
2663
- default: x(() => [
2664
- p(B(ft), {
2665
- size: 16,
2666
- class: "text-muted-foreground"
2667
- }),
2668
- h[18] || (h[18] = g("span", null, "Download PDF", -1))
2669
- ]),
2670
- _: 1
2671
- })
2672
- ]),
2673
- _: 1
2674
- }),
2675
- p(Se),
2676
- p(pe, null, {
2677
- default: x(() => [
2678
- p(fe, { class: "text-xs text-muted-foreground font-normal" }, {
2679
- default: x(() => [...h[19] || (h[19] = [
2680
- A(" Communication ", -1)
2681
- ])]),
2682
- _: 1
2683
- }),
2684
- p(oe, {
2685
- onClick: I,
2686
- class: "gap-2 cursor-pointer"
2687
- }, {
2688
- default: x(() => [
2689
- p(B(pt), {
2690
- size: 16,
2691
- class: "text-muted-foreground"
2692
- }),
2693
- h[20] || (h[20] = g("span", null, "(Re)send Confirmation Mail", -1))
2694
- ]),
2695
- _: 1
2696
- })
2697
- ]),
2698
- _: 1
2699
- }),
2700
- B(n)("manage-reservations") ? (R(), U(me, { key: 0 }, [
2701
- p(Se),
2702
- p(pe, null, {
2703
- default: x(() => [
2704
- p(fe, { class: "text-xs text-muted-foreground font-normal" }, {
2705
- default: x(() => [...h[21] || (h[21] = [
2706
- A(" Cancellation ", -1)
2707
- ])]),
2708
- _: 1
2709
- }),
2710
- p(oe, {
2711
- onClick: T,
2712
- class: "gap-2 cursor-pointer",
2713
- variant: "destructive",
2714
- disabled: j.value
2715
- }, {
2716
- default: x(() => [
2717
- p(B(ht), { size: 16 }),
2718
- h[22] || (h[22] = g("span", null, "Cancel Reservation", -1))
2719
- ]),
2720
- _: 1
2721
- }, 8, ["disabled"]),
2722
- i.value?.reservationPrice && i.value.reservationPrice > 0 ? (R(), J(oe, {
2723
- key: 0,
2724
- onClick: H,
2725
- class: "gap-2 cursor-pointer text-orange-600 dark:text-orange-400 focus:text-orange-600 dark:focus:text-orange-400",
2726
- disabled: j.value
2727
- }, {
2728
- default: x(() => [
2729
- p(B(mt), {
2730
- class: "text-inherit",
2731
- size: 16
2732
- }),
2733
- h[23] || (h[23] = g("span", null, "Cancel & Send Coupon", -1))
2734
- ]),
2735
- _: 1
2736
- }, 8, ["disabled"])) : z("", !0)
2737
- ]),
2738
- _: 1
2739
- })
2740
- ], 64)) : z("", !0)
2741
- ]),
2742
- _: 1
2743
- })
2744
- ]),
2745
- _: 1
2746
- })) : z("", !0)
2747
- ]),
2748
- _: 1
2749
- })
2750
- ]),
2751
- _: 1
2752
- })
2753
- ]),
2754
- _: 1
2755
- }, 8, ["open"]),
2756
- p(ms, {
2757
- ref_key: "cancelReservationDialog",
2758
- ref: m,
2759
- onConfirm: b
2760
- }, null, 512),
2761
- p(Ds, {
2762
- ref_key: "approveReservationDialog",
2763
- ref: _,
2764
- onConfirm: O
2765
- }, null, 512),
2766
- p(ws, {
2767
- ref_key: "rejectReservationDialog",
2768
- ref: d,
2769
- onConfirm: ee
2770
- }, null, 512),
2771
- p(gs, {
2772
- ref_key: "transferReservationDialog",
2773
- ref: f
2774
- }, null, 512)
2775
- ], 64);
2776
- };
2777
- }
2778
- });
2779
- export {
2780
- X as F,
2781
- xn as _
2782
- };