@wix/bookings 1.0.1792 → 1.0.1794

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.
@@ -30,11 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // context-my-bookings.ts
31
31
  var context_my_bookings_exports = {};
32
32
  __export(context_my_bookings_exports, {
33
- MyBookingsContext: () => rP,
34
- MyBookingsContextProvider: () => lP,
35
- default: () => lP,
36
- injectAccessTokenGetter: () => uP,
37
- useBookings: () => iP
33
+ MyBookingsContext: () => aP,
34
+ MyBookingsContextProvider: () => dP,
35
+ default: () => dP,
36
+ injectAccessTokenGetter: () => fP,
37
+ useBookings: () => oP
38
38
  });
39
39
  module.exports = __toCommonJS(context_my_bookings_exports);
40
40
 
@@ -12036,121 +12036,126 @@ typeof window < `u` && (window.addEventListener(`beforeunload`, () => {
12036
12036
  var XA = () => JA || Date.now() - YA <= qA;
12037
12037
  var ZA = (e18) => (e18 instanceof TypeError || e18?.name === `AbortError`) && UA(e18);
12038
12038
  var QA = (e18) => XA() && ZA(e18);
12039
- var $A = (e18) => typeof e18.message == `string`;
12040
- var ej = (e18) => {
12039
+ var $A = (e18) => e18 instanceof TypeError && UA(e18) && !XA();
12040
+ var ej = (e18) => () => e18().catch((t2) => {
12041
+ if ($A(t2)) return e18();
12042
+ throw t2;
12043
+ });
12044
+ var tj = (e18) => typeof e18.message == `string`;
12045
+ var nj = (e18) => {
12041
12046
  try {
12042
12047
  let t2 = Xx.getMonitoringClient();
12043
- return $A(t2) ? void 0 : t2.startSpanManual({ name: e18, tags: { scope: e18 } });
12048
+ return tj(t2) ? void 0 : t2.startSpanManual({ name: e18, tags: { scope: e18 } });
12044
12049
  } catch {
12045
12050
  return;
12046
12051
  }
12047
12052
  };
12048
- var tj = (e18) => {
12053
+ var rj = (e18) => {
12049
12054
  try {
12050
12055
  e18();
12051
12056
  } catch {
12052
12057
  }
12053
12058
  };
12054
- var nj = async (e18, t2, { errorCodesMap: n2 = {}, statusCodesMap: r2, serverError: i2, isExpected: a2 } = {}) => {
12055
- let o2 = ej(e18);
12059
+ var ij = async (e18, t2, { errorCodesMap: n2 = {}, statusCodesMap: r2, serverError: i2, isExpected: a2, isRead: o2 = false } = {}) => {
12060
+ let s2 = nj(e18);
12056
12061
  try {
12057
- let e19 = await qx(t2, n2, { statusCodesOverrides: r2, serverErrorOverride: i2 });
12062
+ let e19 = await qx(o2 ? ej(t2) : t2, n2, { statusCodesOverrides: r2, serverErrorOverride: i2 });
12058
12063
  if (e19 instanceof Response && !e19.ok) throw e19;
12059
- return tj(() => o2?.end()), e19;
12064
+ return rj(() => s2?.end()), e19;
12060
12065
  } catch (t3) {
12061
- throw a2?.(t3) || QA(t3) ? tj(() => o2?.end()) : o2 ? (console.error(`[${e18}]`, t3), tj(() => o2.fail(GA(t3)))) : KA(t3, e18), t3;
12066
+ throw a2?.(t3) || QA(t3) ? rj(() => s2?.end()) : s2 ? (console.error(`[${e18}]`, t3), rj(() => s2.fail(GA(t3)))) : KA(t3, e18), t3;
12062
12067
  }
12063
12068
  };
12064
- var rj = `wix.bookings.v2.bookings`;
12065
- var ij = (e18) => e18?.details?.applicationError?.code === `BOOKINGS_SETTINGS_NOT_FOUND`;
12066
- var aj = 1e3;
12067
- var oj = () => ({ async queryExtendedBookings(e18, t2) {
12068
- return nj(`myBookings.queryExtendedBookings`, () => Ks(e18, t2));
12069
+ var aj = `wix.bookings.v2.bookings`;
12070
+ var oj = (e18) => e18?.details?.applicationError?.code === `BOOKINGS_SETTINGS_NOT_FOUND`;
12071
+ var sj = 1e3;
12072
+ var cj = () => ({ async queryExtendedBookings(e18, t2) {
12073
+ return ij(`myBookings.queryExtendedBookings`, () => Ks(e18, t2), { isRead: true });
12069
12074
  }, async queryServicesByIds(e18) {
12070
- return nj(`myBookings.queryServices`, () => Xd().in(`_id`, e18).find());
12075
+ return ij(`myBookings.queryServices`, () => Xd().in(`_id`, e18).find(), { isRead: true });
12071
12076
  }, async queryLocations() {
12072
- return nj(`myBookings.queryLocations`, () => Ld());
12077
+ return ij(`myBookings.queryLocations`, () => Ld(), { isRead: true });
12073
12078
  }, async querySubmissionsByBookingIds(e18) {
12074
- return nj(`myBookings.querySubmissionsByNamespace`, () => BA({ onlyYourOwn: true }).eq(`namespace`, rj).in(`_id`, e18).find());
12079
+ return ij(`myBookings.querySubmissionsByNamespace`, () => BA({ onlyYourOwn: true }).eq(`namespace`, aj).in(`_id`, e18).find(), { isRead: true });
12075
12080
  }, async getForm(e18) {
12076
- return nj(`myBookings.getForm`, () => DA(e18));
12081
+ return ij(`myBookings.getForm`, () => DA(e18), { isRead: true });
12077
12082
  }, async getFormattedSubmission(e18) {
12078
- return nj(`myBookings.getFormattedSubmission`, () => zA(e18));
12083
+ return ij(`myBookings.getFormattedSubmission`, () => zA(e18), { isRead: true });
12079
12084
  }, async getBookingsSettings() {
12080
- return nj(`myBookings.getBookingsSettings`, () => Of(), { isExpected: ij });
12085
+ return ij(`myBookings.getBookingsSettings`, () => Of(), { isExpected: oj, isRead: true });
12081
12086
  }, async listBookingFees(e18) {
12082
- return nj(`myBookings.listBookingFeesByBookingIds`, () => Go({ bookingIds: e18 }));
12087
+ return ij(`myBookings.listBookingFeesByBookingIds`, () => Go({ bookingIds: e18 }), { isRead: true });
12083
12088
  }, async listOrderTransactions(e18) {
12084
- return nj(`myBookings.listTransactionsForMultipleOrders`, () => xA(e18));
12089
+ return ij(`myBookings.listTransactionsForMultipleOrders`, () => xA(e18), { isRead: true });
12085
12090
  }, async getOrder(e18) {
12086
- return nj(`myBookings.getOrder`, () => tk(e18));
12091
+ return ij(`myBookings.getOrder`, () => tk(e18), { isRead: true });
12087
12092
  }, async queryBookingById(e18) {
12088
- return nj(`myBookings.queryBookingById`, () => Ks({ filter: { _id: e18 } }, {}));
12093
+ return ij(`myBookings.queryBookingById`, () => Ks({ filter: { _id: e18 } }, {}), { isRead: true });
12089
12094
  }, async cancelBooking(e18, t2) {
12090
- return nj(`myBookings.cancelBooking`, () => yf(e18, { revision: t2 }));
12095
+ return ij(`myBookings.cancelBooking`, () => yf(e18, { revision: t2 }));
12091
12096
  }, async cancelMultiServiceBooking(e18) {
12092
- return nj(`myBookings.cancelMultiServiceBooking`, () => _f(e18, { participantNotification: { notifyParticipants: true } }));
12097
+ return ij(`myBookings.cancelMultiServiceBooking`, () => _f(e18, { participantNotification: { notifyParticipants: true } }));
12093
12098
  }, async getMultiServiceBookingAllowedActions(e18) {
12094
- return nj(`myBookings.bulkGetMultiServiceBookingAllowedActions`, () => vf(e18));
12099
+ return ij(`myBookings.bulkGetMultiServiceBookingAllowedActions`, () => vf(e18), { isRead: true });
12095
12100
  }, async queryScheduleEvents(e18, t2) {
12096
- return nj(`myBookings.queryEvents`, async () => {
12097
- let n2 = await wD(t2).in(`scheduleId`, e18).limit(aj).find(), r2 = [...n2.items];
12101
+ return ij(`myBookings.queryEvents`, async () => {
12102
+ let n2 = await wD(t2).in(`scheduleId`, e18).limit(sj).find(), r2 = [...n2.items];
12098
12103
  for (; n2.hasNext(); ) n2 = await n2.next(), r2.push(...n2.items);
12099
12104
  return r2;
12100
- });
12105
+ }, { isRead: true });
12101
12106
  } });
12102
- var sj = /\.wix(site|studio)\.com$/;
12103
- function cj(e18) {
12107
+ var lj = /\.wix(site|studio)\.com$/;
12108
+ function uj(e18) {
12104
12109
  try {
12105
12110
  return new URL(e18);
12106
12111
  } catch {
12107
12112
  return null;
12108
12113
  }
12109
12114
  }
12110
- function lj(e18, t2) {
12111
- return e18.origin === t2.origin || sj.test(e18.hostname) && e18.hostname.replace(sj, ``) === t2.hostname.replace(sj, ``);
12115
+ function dj(e18, t2) {
12116
+ return e18.origin === t2.origin || lj.test(e18.hostname) && e18.hostname.replace(lj, ``) === t2.hostname.replace(lj, ``);
12112
12117
  }
12113
- function uj(e18, t2, n2, r2) {
12114
- let i2 = t2.replace(/\/$/, ``), a2 = cj(i2), o2 = cj(e18);
12115
- if (!r2 || !a2 || !o2 || !lj(o2, a2)) return e18;
12118
+ function fj(e18, t2, n2, r2) {
12119
+ let i2 = t2.replace(/\/$/, ``), a2 = uj(i2), o2 = uj(e18);
12120
+ if (!r2 || !a2 || !o2 || !dj(o2, a2)) return e18;
12116
12121
  let s2 = `${a2.pathname.replace(/\/$/, ``)}/${r2}/`;
12117
12122
  return !o2.pathname.startsWith(s2) || (n2.startsWith(i2) ? n2.slice(i2.length) : ``).split(/[/?#]/)[1] === r2 ? e18 : `${i2}/${o2.pathname.slice(s2.length)}${o2.search}${o2.hash}`;
12118
12123
  }
12119
- function dj(e18) {
12124
+ function pj(e18) {
12120
12125
  window.location.assign(e18);
12121
12126
  }
12122
- var fj = `https://calendar.google.com/calendar/render`;
12123
- var pj = (e18) => e18.toISOString().replace(/[-:]/g, ``).replace(/\.\d{3}/, ``);
12124
- function mj(e18, t2) {
12127
+ var mj = `https://calendar.google.com/calendar/render`;
12128
+ var hj = (e18) => e18.toISOString().replace(/[-:]/g, ``).replace(/\.\d{3}/, ``);
12129
+ function gj(e18, t2) {
12125
12130
  let n2 = new Intl.DateTimeFormat(`en-US`, { timeZone: t2, year: `numeric`, month: `2-digit`, day: `2-digit` }).formatToParts(e18), r2 = (e19) => n2.find((t3) => t3.type === e19)?.value ?? ``;
12126
12131
  return `${r2(`year`)}${r2(`month`)}${r2(`day`)}`;
12127
12132
  }
12128
- function hj(e18) {
12133
+ function _j(e18) {
12129
12134
  return new Date(Date.UTC(Number(e18.slice(0, 4)), Number(e18.slice(4, 6)) - 1, Number(e18.slice(6, 8)) + 1)).toISOString().slice(0, 10).replace(/-/g, ``);
12130
12135
  }
12131
- function gj(e18) {
12136
+ function vj(e18) {
12132
12137
  let t2 = new Date(e18.startDate), n2 = new Date(e18.endDate);
12133
- if (!e18.isAllDay) return `${pj(t2)}/${pj(n2)}`;
12134
- let r2 = mj(new Date(n2.getTime() - 1), e18.timeZone);
12135
- return `${mj(t2, e18.timeZone)}/${hj(r2)}`;
12138
+ if (!e18.isAllDay) return `${hj(t2)}/${hj(n2)}`;
12139
+ let r2 = gj(new Date(n2.getTime() - 1), e18.timeZone);
12140
+ return `${gj(t2, e18.timeZone)}/${_j(r2)}`;
12136
12141
  }
12137
- function _j(e18) {
12138
- let t2 = new URL(fj);
12139
- return t2.searchParams.set(`action`, `TEMPLATE`), t2.searchParams.set(`text`, e18.title), t2.searchParams.set(`dates`, gj(e18)), t2.searchParams.set(`ctz`, e18.timeZone), e18.location && t2.searchParams.set(`location`, e18.location), e18.details && t2.searchParams.set(`details`, e18.details), t2.toString();
12142
+ function yj(e18) {
12143
+ let t2 = new URL(mj);
12144
+ return t2.searchParams.set(`action`, `TEMPLATE`), t2.searchParams.set(`text`, e18.title), t2.searchParams.set(`dates`, vj(e18)), t2.searchParams.set(`ctz`, e18.timeZone), e18.location && t2.searchParams.set(`location`, e18.location), e18.details && t2.searchParams.set(`details`, e18.details), t2.toString();
12140
12145
  }
12141
- function vj(e18, t2, n2) {
12146
+ function bj(e18, t2, n2) {
12142
12147
  let r2 = e18.isAvailableOnline ? e18.conferencingDetails.guestUrl?.href ?? `` : ``, i2 = r2 ? [Ta(t2, Da.calendar.videoCall, { url: r2 }), ...e18.videoConferencePassword ? [Ta(t2, Da.calendar.videoCallPassword, { password: e18.videoConferencePassword })] : []].join(`
12143
12148
  `) : ``;
12144
- return _j({ title: new Intl.ListFormat(n2, { type: `conjunction` }).format(e18.serviceNames), startDate: e18.startDate ?? ``, endDate: e18.endDate ?? ``, isAllDay: e18.isAllDay, timeZone: e18.timeZone, location: e18.location, details: i2 });
12149
+ return yj({ title: new Intl.ListFormat(n2, { type: `conjunction` }).format(e18.serviceNames), startDate: e18.startDate ?? ``, endDate: e18.endDate ?? ``, isAllDay: e18.isAllDay, timeZone: e18.timeZone, location: e18.location, details: i2 });
12145
12150
  }
12146
- var yj = oj();
12147
- var bj = (e18) => {
12151
+ var xj = cj();
12152
+ var Sj = (e18) => {
12148
12153
  let t2 = (0, import_react.useRef)(/* @__PURE__ */ new Map());
12149
12154
  return (0, import_react.useEffect)(() => {
12150
12155
  for (let n2 of e18) {
12151
12156
  let e19 = n2.formSubmissionIds[0];
12152
12157
  if (e19 && !n2.isOver && !t2.current.has(e19)) {
12153
- let n3 = yj.getFormattedSubmission(e19);
12158
+ let n3 = xj.getFormattedSubmission(e19);
12154
12159
  t2.current.set(e19, n3), n3.catch(() => {
12155
12160
  t2.current.delete(e19);
12156
12161
  });
@@ -12158,40 +12163,40 @@ var bj = (e18) => {
12158
12163
  }
12159
12164
  }, [e18]), (0, import_react.useCallback)((e19) => {
12160
12165
  let n2 = t2.current.get(e19);
12161
- return n2 ? n2.catch(() => yj.getFormattedSubmission(e19)) : yj.getFormattedSubmission(e19);
12166
+ return n2 ? n2.catch(() => xj.getFormattedSubmission(e19)) : xj.getFormattedSubmission(e19);
12162
12167
  }, []);
12163
12168
  };
12164
12169
  var Q = (e18) => `var(--${e18})`;
12165
12170
  Q(`wst-paragraph-1-font`), Q(`wst-paragraph-2-font`), Q(`wst-paragraph-3-font`), Q(`wst-heading-2-font`), Q(`wst-heading-3-font`), Q(`wst-heading-5-font`), Q(`wst-heading-6-font`), Q(`wst-links-and-actions-color`), Q(`wst-graphics-1-color`), Q(`wst-heading-3-color`), Q(`wst-heading-5-color`), Q(`wst-heading-6-color`), Q(`wst-paragraph-1-color`), Q(`wst-paragraph-2-color`), Q(`wst-paragraph-3-color`), Q(`wst-primary-background-color`), Q(`wst-secondary-background-color`), Q(`wst-box-primary-border-top-color`), Q(`wst-box-primary-border-bottom-color`), Q(`wst-box-primary-border-left-color`), Q(`wst-box-primary-border-right-color`), Q(`wst-box-primary-border-top-left-radius`), Q(`wst-box-primary-border-top-right-radius`), Q(`wst-box-primary-border-bottom-left-radius`), Q(`wst-box-primary-border-bottom-right-radius`), Q(`wst-box-secondary-background-color`), Q(`wst-box-secondary-box-shadow`), Q(`wst-box-secondary-border-top-color`), Q(`wst-box-secondary-border-right-color`), Q(`wst-box-secondary-border-bottom-color`), Q(`wst-box-secondary-border-left-color`), Q(`wst-box-secondary-border-top-width`), Q(`wst-box-secondary-border-right-width`), Q(`wst-box-secondary-border-bottom-width`), Q(`wst-box-secondary-border-left-width`), Q(`wst-box-secondary-border-top-style`), Q(`wst-box-secondary-border-right-style`), Q(`wst-box-secondary-border-bottom-style`), Q(`wst-box-secondary-border-left-style`), Q(`wst-box-secondary-border-top-left-radius`), Q(`wst-box-secondary-border-top-right-radius`), Q(`wst-box-secondary-border-bottom-left-radius`), Q(`wst-box-secondary-border-bottom-right-radius`), Q(`wst-button-primary-color`), Q(`wst-button-primary-background-color`), Q(`wst-button-primary-font`), Q(`wst-button-primary-border-top-color`), Q(`wst-button-primary-border-top-style`), Q(`wst-button-primary-border-right-color`), Q(`wst-button-primary-border-right-style`), Q(`wst-button-primary-border-bottom-color`), Q(`wst-button-primary-border-bottom-style`), Q(`wst-button-primary-border-left-color`), Q(`wst-button-primary-border-left-style`), Q(`wst-button-primary-border-top-left-radius`), Q(`wst-button-primary-border-top-right-radius`), Q(`wst-button-primary-border-bottom-left-radius`), Q(`wst-button-primary-border-bottom-right-radius`), Q(`wst-button-primary-padding-top`), Q(`wst-button-primary-padding-bottom`), Q(`wst-button-primary-padding-left`), Q(`wst-button-primary-padding-right`), Q(`wst-button-primary-box-shadow`), Q(`wst-button-secondary-color`), Q(`wst-button-secondary-font`), Q(`wst-button-secondary-background-color`), Q(`wst-button-secondary-border-top-color`), Q(`wst-button-secondary-border-top-width`), Q(`wst-button-secondary-border-top-style`), Q(`wst-button-secondary-border-top-left-radius`), Q(`wst-button-tertiary-color`), Q(`wst-button-tertiary-background-color`), Q(`wst-button-tertiary-font`), Q(`wst-system-alert-color`), Q(`wst-system-error-color`), Q(`wst-system-disabled-color`), Q(`wst-system-line-1-color`), Q(`wst-system-line-1-width`), Q(`wst-base-1-color`), Q(`wst-base-2-color`), Q(`wst-shade-1-color`), Q(`wst-shade-2-color`), Q(`wst-shade-3-color`), Q(`wst-accent-1-color`), Q(`wst-accent-3-color`);
12166
- var xj = `yyyy-MM-dd'T'HH:mm:ss`;
12167
- function Sj(e18) {
12171
+ var Cj = `yyyy-MM-dd'T'HH:mm:ss`;
12172
+ function wj(e18) {
12168
12173
  if (!e18 || typeof e18 == `string` && !Z.fromISO(e18, { setZone: true }).isValid) return null;
12169
12174
  let t2 = new Date(e18);
12170
12175
  return Number.isNaN(t2.getTime()) ? null : t2.toISOString();
12171
12176
  }
12172
- function Cj(e18, t2) {
12173
- let n2 = Sj(e18);
12177
+ function Tj(e18, t2) {
12178
+ let n2 = wj(e18);
12174
12179
  if (!n2) return null;
12175
12180
  let r2 = Z.fromISO(n2, t2 ? { zone: t2 } : {});
12176
- return (r2.isValid ? r2 : Z.fromISO(n2)).toFormat(xj);
12181
+ return (r2.isValid ? r2 : Z.fromISO(n2)).toFormat(Cj);
12177
12182
  }
12178
- var wj = `wix:image://`;
12179
- var Tj = /^https?:\/\/static\.wixstatic\.com\/media\/([^/?#]+)/;
12180
- var Ej = /^https?:\/\//;
12181
- function Dj(e18) {
12182
- if (e18.startsWith(wj)) return e18;
12183
- let t2 = Tj.exec(e18);
12184
- return t2 ? `${wj}v1/${t2[1]}` : Ej.test(e18) ? `` : `${wj}v1/${e18}`;
12183
+ var Ej = `wix:image://`;
12184
+ var Dj = /^https?:\/\/static\.wixstatic\.com\/media\/([^/?#]+)/;
12185
+ var Oj = /^https?:\/\//;
12186
+ function kj(e18) {
12187
+ if (e18.startsWith(Ej)) return e18;
12188
+ let t2 = Dj.exec(e18);
12189
+ return t2 ? `${Ej}v1/${t2[1]}` : Oj.test(e18) ? `` : `${Ej}v1/${e18}`;
12185
12190
  }
12186
- function Oj(e18) {
12187
- return e18.slice(`${wj}v1/`.length).split(`/`)[0].split(`#`)[0];
12191
+ function Aj(e18) {
12192
+ return e18.slice(`${Ej}v1/`.length).split(`/`)[0].split(`#`)[0];
12188
12193
  }
12189
- function kj(e18) {
12194
+ function jj(e18) {
12190
12195
  if (!e18) return null;
12191
- let t2 = Dj(e18);
12192
- return t2 && Oj(t2) || null;
12196
+ let t2 = kj(e18);
12197
+ return t2 && Aj(t2) || null;
12193
12198
  }
12194
- function Aj(e18) {
12199
+ function Mj(e18) {
12195
12200
  let t2 = e18?.split(`#`)[1];
12196
12201
  if (!t2) return {};
12197
12202
  let n2 = new URLSearchParams(t2), r2 = (e19) => {
@@ -12200,300 +12205,300 @@ function Aj(e18) {
12200
12205
  }, i2 = r2(`originWidth`), a2 = r2(`originHeight`);
12201
12206
  return { ...i2 && { width: i2 }, ...a2 && { height: a2 } };
12202
12207
  }
12203
- function jj(e18) {
12208
+ function Nj(e18) {
12204
12209
  if (!e18) return null;
12205
- let t2 = Dj(e18);
12210
+ let t2 = kj(e18);
12206
12211
  if (!t2) return e18;
12207
- let n2 = Oj(t2);
12212
+ let n2 = Aj(t2);
12208
12213
  return n2 ? `https://static.wixstatic.com/media/${n2}` : null;
12209
12214
  }
12210
- function Mj(e18, t2) {
12215
+ function Pj(e18, t2) {
12211
12216
  if (!e18) return null;
12212
- let n2 = Dj(e18);
12217
+ let n2 = kj(e18);
12213
12218
  if (!n2) return e18;
12214
- let r2 = Oj(n2);
12219
+ let r2 = Aj(n2);
12215
12220
  return r2 ? `https://static.wixstatic.com/media/${r2}/v1/fit/w_${t2},h_${t2},q_90,enc_auto/${r2}` : null;
12216
12221
  }
12217
- function Nj({ amount: e18, currency: t2, language: n2 }) {
12222
+ function Fj({ amount: e18, currency: t2, language: n2 }) {
12218
12223
  return e18 == null ? `` : t2 ? new Intl.NumberFormat(n2, { style: `currency`, currency: t2 }).format(e18) : new Intl.NumberFormat(n2).format(e18);
12219
12224
  }
12220
- var { BookingStatus: Pj } = Ko;
12221
- var Fj = { [Pj.CANCELED]: 5, [Pj.DECLINED]: 4, [Pj.PENDING]: 3, [Pj.WAITING_LIST]: 2, [Pj.CONFIRMED]: 1, [Pj.CREATED]: 1 };
12222
- var Ij = (e18) => e18.reduce((e19, t2) => Fj[t2] > Fj[e19] ? t2 : e19, e18[0] ?? Pj.CONFIRMED);
12223
- var Lj = (e18) => e18 === Pj.CANCELED || e18 === Pj.DECLINED;
12224
- var Rj = (e18, t2) => Lj(e18) || !!t2 && new Date(t2).getTime() < Date.now();
12225
+ var { BookingStatus: Ij } = Ko;
12226
+ var Lj = { [Ij.CANCELED]: 5, [Ij.DECLINED]: 4, [Ij.PENDING]: 3, [Ij.WAITING_LIST]: 2, [Ij.CONFIRMED]: 1, [Ij.CREATED]: 1 };
12227
+ var Rj = (e18) => e18.reduce((e19, t2) => Lj[t2] > Lj[e19] ? t2 : e19, e18[0] ?? Ij.CONFIRMED);
12228
+ var zj = (e18) => e18 === Ij.CANCELED || e18 === Ij.DECLINED;
12229
+ var Bj = (e18, t2) => zj(e18) || !!t2 && new Date(t2).getTime() < Date.now();
12225
12230
  var $ = { FREE: `FREE`, PLAN_PAID: `PLAN_PAID`, PAID_ONLINE: `PAID_ONLINE`, PAID_IN_PERSON: `PAID_IN_PERSON`, PARTIALLY_PAID: `PARTIALLY_PAID`, NOT_PAID: `NOT_PAID` };
12226
- var zj = (e18) => {
12231
+ var Vj = (e18) => {
12227
12232
  let t2 = e18?.amount;
12228
12233
  if (t2 === void 0 || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t2)) return;
12229
12234
  let n2 = Number(t2);
12230
12235
  return Number.isFinite(n2) ? n2 : void 0;
12231
12236
  };
12232
- var Bj = (e18, t2, n2, r2 = 1) => {
12237
+ var Hj = (e18, t2, n2, r2 = 1) => {
12233
12238
  let i2 = new Intl.NumberFormat(n2, { style: `currency`, currency: t2 }).resolvedOptions().maximumFractionDigits ?? 2;
12234
12239
  return Math.abs(e18) * 2 ** -52 * r2 < 0.5 * 10 ** -i2;
12235
12240
  };
12236
- function Vj(e18, t2) {
12241
+ function Uj(e18, t2) {
12237
12242
  if (e18.price?.formattedAmount) return e18.price.formattedAmount;
12238
- let n2 = zj(e18.price);
12243
+ let n2 = Vj(e18.price);
12239
12244
  if (n2 !== void 0 && e18.currency) try {
12240
- return Bj(n2, e18.currency, t2) ? Nj({ amount: n2, currency: e18.currency, language: t2 }) : e18.fallback ?? ``;
12245
+ return Hj(n2, e18.currency, t2) ? Fj({ amount: n2, currency: e18.currency, language: t2 }) : e18.fallback ?? ``;
12241
12246
  } catch {
12242
12247
  return e18.fallback ?? ``;
12243
12248
  }
12244
12249
  return e18.fallback ?? ``;
12245
12250
  }
12246
- function Hj(e18, t2) {
12251
+ function Wj(e18, t2) {
12247
12252
  if (e18.length === 0) return ``;
12248
- let n2 = e18.map((e19) => Vj(e19, t2));
12253
+ let n2 = e18.map((e19) => Uj(e19, t2));
12249
12254
  if (n2.some((e19) => !e19)) return ``;
12250
12255
  if (e18.length === 1) return n2[0];
12251
- let r2 = e18.map((e19) => zj(e19.price)), i2 = e18[0].currency;
12256
+ let r2 = e18.map((e19) => Vj(e19.price)), i2 = e18[0].currency;
12252
12257
  if (i2 && e18.every((e19) => e19.currency === i2) && r2.every((e19) => e19 !== void 0)) try {
12253
12258
  let e19 = r2.reduce((e20, t3) => e20 + t3, 0), n3 = r2.reduce((e20, t3) => e20 + Math.abs(t3), 0);
12254
- if (r2.every((e20) => Bj(e20, i2, t2)) && Bj(n3, i2, t2, r2.length)) return Nj({ amount: e19, currency: i2, language: t2 });
12259
+ if (r2.every((e20) => Hj(e20, i2, t2)) && Hj(n3, i2, t2, r2.length)) return Fj({ amount: e19, currency: i2, language: t2 });
12255
12260
  } catch {
12256
12261
  return new Intl.ListFormat(t2).format(n2);
12257
12262
  }
12258
12263
  return r2.every((e19) => e19 === 0) && n2.every((e19) => e19 === n2[0]) ? n2[0] : new Intl.ListFormat(t2).format(n2);
12259
12264
  }
12260
- var Uj = [$.PAID_ONLINE, $.PAID_IN_PERSON];
12261
- function Wj(e18) {
12265
+ var Gj = [$.PAID_ONLINE, $.PAID_IN_PERSON];
12266
+ function Kj(e18) {
12262
12267
  let t2 = e18.filter((e19) => e19.state !== $.FREE);
12263
12268
  if (t2.length === 0) return $.FREE;
12264
12269
  let n2 = new Set(t2.map((e19) => e19.state));
12265
- return n2.size === 1 ? t2[0].state : n2.has(null) || n2.has($.PLAN_PAID) ? null : n2.has($.PARTIALLY_PAID) || n2.has($.NOT_PAID) && t2.some((e19) => Uj.includes(e19.state)) ? $.PARTIALLY_PAID : null;
12270
+ return n2.size === 1 ? t2[0].state : n2.has(null) || n2.has($.PLAN_PAID) ? null : n2.has($.PARTIALLY_PAID) || n2.has($.NOT_PAID) && t2.some((e19) => Gj.includes(e19.state)) ? $.PARTIALLY_PAID : null;
12266
12271
  }
12267
- function Gj(e18, t2, n2) {
12272
+ function qj(e18, t2, n2) {
12268
12273
  if (t2 === $.PLAN_PAID) return { amount: ``, amountPaid: `` };
12269
- let r2 = e18.filter((e19) => e19.state !== $.FREE), i2 = Hj((r2.length > 0 ? r2 : e18).filter((e19) => e19.state !== $.FREE || e19.price?.formattedAmount || zj(e19.price) !== void 0).map((e19) => ({ price: e19.price, currency: e19.currency })), n2);
12274
+ let r2 = e18.filter((e19) => e19.state !== $.FREE), i2 = Wj((r2.length > 0 ? r2 : e18).filter((e19) => e19.state !== $.FREE || e19.price?.formattedAmount || Vj(e19.price) !== void 0).map((e19) => ({ price: e19.price, currency: e19.currency })), n2);
12270
12275
  if (t2 === $.FREE || t2 === null) return { amount: ``, amountPaid: i2 };
12271
12276
  if (t2 === $.PARTIALLY_PAID) {
12272
12277
  let t3 = /* @__PURE__ */ new Map();
12273
12278
  return e18.forEach((e19, n3) => {
12274
- if (e19.state === $.FREE || Uj.includes(e19.state)) return;
12279
+ if (e19.state === $.FREE || Gj.includes(e19.state)) return;
12275
12280
  let r3 = e19.order?._id ?? `line-${n3}`;
12276
12281
  t3.has(r3) || t3.set(r3, e19.state === $.NOT_PAID && !e19.price ? { fallback: e19.amount, currency: e19.currency } : { price: e19.order?.balance, currency: e19.currency });
12277
- }), { amount: Hj([...t3.values()], n2), amountPaid: i2 };
12282
+ }), { amount: Wj([...t3.values()], n2), amountPaid: i2 };
12278
12283
  }
12279
- return { amount: Hj(e18.filter((e19) => e19.state !== $.FREE || zj(e19.price) !== void 0 && zj(e19.price) !== 0).map((e19) => ({ price: e19.price, currency: e19.currency, fallback: e19.amount })), n2), amountPaid: i2 };
12284
+ return { amount: Wj(e18.filter((e19) => e19.state !== $.FREE || Vj(e19.price) !== void 0 && Vj(e19.price) !== 0).map((e19) => ({ price: e19.price, currency: e19.currency, fallback: e19.amount })), n2), amountPaid: i2 };
12280
12285
  }
12281
- var { AttendanceStatus: Kj, BookingStatus: qj } = Ko;
12282
- var { ServiceType: Jj } = ic;
12283
- var Yj = 6e4;
12284
- function Xj(e18) {
12286
+ var { AttendanceStatus: Jj, BookingStatus: Yj } = Ko;
12287
+ var { ServiceType: Xj } = ic;
12288
+ var Zj = 6e4;
12289
+ function Qj(e18) {
12285
12290
  return e18.multiServiceBookingInfo?._id ?? e18._id ?? ``;
12286
12291
  }
12287
- var Zj = (e18) => e18.multiServiceBookingInfo?._id ?? ``;
12288
- function Qj(e18) {
12289
- let t2 = e18[e18.length - 1]?.booking, n2 = t2 ? Zj(t2) : ``;
12292
+ var $j = (e18) => e18.multiServiceBookingInfo?._id ?? ``;
12293
+ function eM(e18) {
12294
+ let t2 = e18[e18.length - 1]?.booking, n2 = t2 ? $j(t2) : ``;
12290
12295
  if (!n2) return { emitted: e18, deferred: [] };
12291
12296
  let r2 = e18.length;
12292
12297
  for (; r2 > 0; ) {
12293
12298
  let t3 = e18[r2 - 1]?.booking;
12294
- if (!t3 || Zj(t3) !== n2) break;
12299
+ if (!t3 || $j(t3) !== n2) break;
12295
12300
  --r2;
12296
12301
  }
12297
12302
  return { emitted: e18.slice(0, r2), deferred: e18.slice(r2) };
12298
12303
  }
12299
- function $j(e18) {
12304
+ function tM(e18) {
12300
12305
  let t2 = /* @__PURE__ */ new Map();
12301
12306
  for (let n2 of e18) {
12302
12307
  if (!n2.booking) continue;
12303
- let e19 = Xj(n2.booking);
12308
+ let e19 = Qj(n2.booking);
12304
12309
  if (!e19) continue;
12305
12310
  let r2 = t2.get(e19);
12306
12311
  r2 ? r2.push(n2) : t2.set(e19, [n2]);
12307
12312
  }
12308
12313
  return t2;
12309
12314
  }
12310
- function eM(e18) {
12311
- let t2 = jj(e18);
12315
+ function nM(e18) {
12316
+ let t2 = Nj(e18);
12312
12317
  if (!t2) return null;
12313
- let { width: n2, height: r2 } = Aj(e18);
12314
- return { uri: kj(e18) ?? void 0, url: t2, ...n2 && { width: n2 }, ...r2 && { height: r2 } };
12318
+ let { width: n2, height: r2 } = Mj(e18);
12319
+ return { uri: jj(e18) ?? void 0, url: t2, ...n2 && { width: n2 }, ...r2 && { height: r2 } };
12315
12320
  }
12316
- var tM = (e18) => new Date(e18).getTime();
12317
- function nM(e18, t2) {
12318
- return e18.reduce((e19, n2) => n2 && (!e19 || t2(tM(n2), tM(e19))) ? n2 : e19, null);
12321
+ var rM = (e18) => new Date(e18).getTime();
12322
+ function iM(e18, t2) {
12323
+ return e18.reduce((e19, n2) => n2 && (!e19 || t2(rM(n2), rM(e19))) ? n2 : e19, null);
12319
12324
  }
12320
- var rM = (e18) => nM(e18, (e19, t2) => e19 < t2);
12321
- var iM = (e18) => nM(e18, (e19, t2) => e19 > t2);
12322
- function aM(e18, t2) {
12325
+ var aM = (e18) => iM(e18, (e19, t2) => e19 < t2);
12326
+ var oM = (e18) => iM(e18, (e19, t2) => e19 > t2);
12327
+ function sM(e18, t2) {
12323
12328
  return e18 ? { href: e18, target: t2 } : null;
12324
12329
  }
12325
- function oM(e18) {
12330
+ function cM(e18) {
12326
12331
  let t2 = e18.name ?? ``, n2 = e18.bookingPolicy?.customPolicyDescription;
12327
- return { name: t2, image: eM(e18.media?.mainMedia?.image), servicePageUrl: e18.urls?.servicePage ?? ``, bookingPageUrl: e18.urls?.bookingPage ?? ``, calendarPageUrl: e18.urls?.calendarPage ?? ``, isAvailableOnline: e18.onlineBooking?.enabled === true, isCourse: e18.type === Jj.COURSE, serviceType: e18.type ?? null, isHidden: e18.hidden === true, requiresManualApproval: e18.onlineBooking?.requireManualApproval === true, policyDescription: n2?.enabled ? n2.description ?? `` : ``, rateType: e18.payment?.rateType ?? null, customPriceDescription: e18.payment?.custom?.description ?? `` };
12332
+ return { name: t2, image: nM(e18.media?.mainMedia?.image), servicePageUrl: e18.urls?.servicePage ?? ``, bookingPageUrl: e18.urls?.bookingPage ?? ``, calendarPageUrl: e18.urls?.calendarPage ?? ``, isAvailableOnline: e18.onlineBooking?.enabled === true, isCourse: e18.type === Xj.COURSE, serviceType: e18.type ?? null, isHidden: e18.hidden === true, requiresManualApproval: e18.onlineBooking?.requireManualApproval === true, policyDescription: n2?.enabled ? n2.description ?? `` : ``, rateType: e18.payment?.rateType ?? null, customPriceDescription: e18.payment?.custom?.description ?? `` };
12328
12333
  }
12329
- function sM(e18) {
12334
+ function lM(e18) {
12330
12335
  return (e18.bookedAddOns ?? []).map((e19) => ({ name: e19.nameTranslated ?? e19.name ?? ``, quantity: e19.quantity ?? 1 }));
12331
12336
  }
12332
- function cM(e18, t2) {
12337
+ function uM(e18, t2) {
12333
12338
  if (!e18 || !t2) return 0;
12334
12339
  let n2 = new Date(e18).getTime(), r2 = new Date(t2).getTime();
12335
- return Number.isFinite(n2) && Number.isFinite(r2) && r2 > n2 ? Math.round((r2 - n2) / Yj) : 0;
12340
+ return Number.isFinite(n2) && Number.isFinite(r2) && r2 > n2 ? Math.round((r2 - n2) / Zj) : 0;
12336
12341
  }
12337
- function lM(e18, t2, { services: n2, memberTimeZone: r2 }) {
12342
+ function dM(e18, t2, { services: n2, memberTimeZone: r2 }) {
12338
12343
  let i2 = e18.booking ?? {}, a2 = i2.bookedEntity, o2 = a2?.slot?.serviceId ?? a2?.schedule?.serviceId ?? ``, s2 = n2.get(o2);
12339
- return { bookingId: i2._id ?? ``, serviceId: o2, serviceName: a2?.titleTranslated || a2?.title || s2?.name || ``, serviceImage: s2?.image ?? null, startDate: Sj(i2.startDate), endDate: Sj(i2.endDate), timeZone: ka(a2, r2), durationMinutes: cM(i2.startDate ?? null, i2.endDate ?? null), staffName: a2?.slot?.resource?.nameTranslated || a2?.slot?.resource?.name || ``, addOns: sM(i2), isAllDay: a2?.slot?.allDay === true, servicePageUrl: s2?.isHidden ? `` : s2?.servicePageUrl ?? ``, canViewServiceDetails: !Lj(t2) && !!s2?.servicePageUrl && !s2.isHidden };
12340
- }
12341
- function uM(e18) {
12342
- let t2 = e18.map((e19) => e19.attendance?.status).filter((e19) => !!e19 && e19 !== Kj.NOT_SET);
12343
- return t2.length === 0 ? null : t2.some((e19) => e19 === Kj.NOT_ATTENDED) ? Kj.NOT_ATTENDED : Kj.ATTENDED;
12344
+ return { bookingId: i2._id ?? ``, serviceId: o2, serviceName: a2?.titleTranslated || a2?.title || s2?.name || ``, serviceImage: s2?.image ?? null, startDate: wj(i2.startDate), endDate: wj(i2.endDate), timeZone: ka(a2, r2), durationMinutes: uM(i2.startDate ?? null, i2.endDate ?? null), staffName: a2?.slot?.resource?.nameTranslated || a2?.slot?.resource?.name || ``, addOns: lM(i2), isAllDay: a2?.slot?.allDay === true, servicePageUrl: s2?.isHidden ? `` : s2?.servicePageUrl ?? ``, canViewServiceDetails: !zj(t2) && !!s2?.servicePageUrl && !s2.isHidden };
12344
12345
  }
12345
- var dM = [`MEMBERSHIP`, `MEMBERSHIP_OFFLINE`];
12346
12346
  function fM(e18) {
12347
- return dM.includes(e18.selectedPaymentOption ?? ``);
12348
- }
12349
- var pM = [`FULLY_REFUNDED`, `PARTIALLY_REFUNDED`];
12350
- var mM = (e18) => !Number(e18?.amount ?? 0);
12351
- var hM = (e18, t2) => !e18.bookingPrice || e18.bookingPrice.amount !== void 0 && e18.bookingPrice.amount.trim() !== `` && Number(e18.bookingPrice.amount) === 0 && !mM(e18.totalPrice) ? t2?.price : e18.bookingPrice;
12352
- var gM = (e18, t2) => t2?.rateType === `CUSTOM` && !!e18 && mM(e18.bookingPrice) && mM(e18.totalPrice);
12353
- function _M(e18, t2, n2) {
12354
- if (!n2 || t2?.rateType === `CUSTOM` && mM(e18.bookingPrice)) {
12347
+ let t2 = e18.map((e19) => e19.attendance?.status).filter((e19) => !!e19 && e19 !== Jj.NOT_SET);
12348
+ return t2.length === 0 ? null : t2.some((e19) => e19 === Jj.NOT_ATTENDED) ? Jj.NOT_ATTENDED : Jj.ATTENDED;
12349
+ }
12350
+ var pM = [`MEMBERSHIP`, `MEMBERSHIP_OFFLINE`];
12351
+ function mM(e18) {
12352
+ return pM.includes(e18.selectedPaymentOption ?? ``);
12353
+ }
12354
+ var hM = [`FULLY_REFUNDED`, `PARTIALLY_REFUNDED`];
12355
+ var gM = (e18) => !Number(e18?.amount ?? 0);
12356
+ var _M = (e18, t2) => !e18.bookingPrice || e18.bookingPrice.amount !== void 0 && e18.bookingPrice.amount.trim() !== `` && Number(e18.bookingPrice.amount) === 0 && !gM(e18.totalPrice) ? t2?.price : e18.bookingPrice;
12357
+ var vM = (e18, t2) => t2?.rateType === `CUSTOM` && !!e18 && gM(e18.bookingPrice) && gM(e18.totalPrice);
12358
+ function yM(e18, t2, n2) {
12359
+ if (!n2 || t2?.rateType === `CUSTOM` && gM(e18.bookingPrice)) {
12355
12360
  let n3 = e18.bookingPriceDescription;
12356
12361
  return n3?.translated || n3?.original || t2?.customPriceDescription || ``;
12357
12362
  }
12358
12363
  return n2.formattedAmount ?? ``;
12359
12364
  }
12360
- function vM(e18, t2, n2) {
12361
- let r2 = t2?.rateType === `CUSTOM` && mM(e18.bookingPrice) ? void 0 : hM(e18, n2), i2 = _M(e18, t2, r2);
12365
+ function bM(e18, t2, n2) {
12366
+ let r2 = t2?.rateType === `CUSTOM` && gM(e18.bookingPrice) ? void 0 : _M(e18, n2), i2 = yM(e18, t2, r2);
12362
12367
  return { state: i2 ? $.NOT_PAID : null, amount: i2, price: r2 };
12363
12368
  }
12364
- function yM(e18, t2, n2, r2, i2, a2) {
12365
- if (t2 && gM(t2, n2)) return vM(t2, n2, a2);
12369
+ function xM(e18, t2, n2, r2, i2, a2) {
12370
+ if (t2 && vM(t2, n2)) return bM(t2, n2, a2);
12366
12371
  if (n2?.rateType === `NO_FEE` || e18.paymentStatus === `EXEMPT`) return { state: $.FREE, amount: ``, price: t2?.bookingPrice };
12367
- if (fM(e18)) return { state: r2 ? $.PLAN_PAID : null, amount: `` };
12368
- if (t2 && mM(t2.bookingPrice) && mM(t2.totalPrice)) return { state: $.FREE, amount: ``, price: t2.bookingPrice };
12369
- if (!t2 || pM.includes(t2.paymentStatus ?? ``)) return { state: null, amount: ``, price: t2?.bookingPrice };
12372
+ if (mM(e18)) return { state: r2 ? $.PLAN_PAID : null, amount: `` };
12373
+ if (t2 && gM(t2.bookingPrice) && gM(t2.totalPrice)) return { state: $.FREE, amount: ``, price: t2.bookingPrice };
12374
+ if (!t2 || hM.includes(t2.paymentStatus ?? ``)) return { state: null, amount: ``, price: t2?.bookingPrice };
12370
12375
  if (t2.paymentStatus === `PAID`) {
12371
- let r3 = i2.get(t2._id ?? ``) ?? (e18.selectedPaymentOption === `ONLINE` ? `ONLINE` : `IN_PERSON`), o2 = hM(t2, a2);
12372
- return { state: r3 === `ONLINE` ? $.PAID_ONLINE : $.PAID_IN_PERSON, amount: o2?.formattedAmount ?? _M(t2, n2), price: o2 };
12376
+ let r3 = i2.get(t2._id ?? ``) ?? (e18.selectedPaymentOption === `ONLINE` ? `ONLINE` : `IN_PERSON`), o2 = _M(t2, a2);
12377
+ return { state: r3 === `ONLINE` ? $.PAID_ONLINE : $.PAID_IN_PERSON, amount: o2?.formattedAmount ?? yM(t2, n2), price: o2 };
12373
12378
  }
12374
- return t2.paymentStatus === `PARTIALLY_PAID` ? { state: $.PARTIALLY_PAID, amount: t2.balance?.formattedAmount ?? ``, price: hM(t2, a2) } : vM(t2, n2, a2);
12379
+ return t2.paymentStatus === `PARTIALLY_PAID` ? { state: $.PARTIALLY_PAID, amount: t2.balance?.formattedAmount ?? ``, price: _M(t2, a2) } : bM(t2, n2, a2);
12375
12380
  }
12376
- function bM(e18, { services: t2, orderPaymentMethods: n2, orderPlanCharges: r2, bookingLinePrices: i2, locale: a2 }) {
12381
+ function SM(e18, { services: t2, orderPaymentMethods: n2, orderPlanCharges: r2, bookingLinePrices: i2, locale: a2 }) {
12377
12382
  let o2 = e18.map((e19) => {
12378
12383
  let a3 = e19.booking ?? {}, o3 = a3.bookedEntity?.slot?.serviceId ?? a3.bookedEntity?.schedule?.serviceId ?? ``, s3 = r2.get(e19.order?._id ?? ``);
12379
- return { order: e19.order, charge: s3, currency: i2.get(a3._id ?? ``)?.currency ?? e19.order?.currency, ...yM(a3, e19.order, t2.get(o3), s3, n2, i2.get(a3._id ?? ``)) };
12380
- }), s2 = Wj(o2), c2 = o2.find((e19) => e19.state === s2)?.charge, { amount: l2, amountPaid: u2 } = Gj(o2, s2, a2), d2 = s2 === $.PLAN_PAID;
12384
+ return { order: e19.order, charge: s3, currency: i2.get(a3._id ?? ``)?.currency ?? e19.order?.currency, ...xM(a3, e19.order, t2.get(o3), s3, n2, i2.get(a3._id ?? ``)) };
12385
+ }), s2 = Kj(o2), c2 = o2.find((e19) => e19.state === s2)?.charge, { amount: l2, amountPaid: u2 } = qj(o2, s2, a2), d2 = s2 === $.PLAN_PAID;
12381
12386
  return { planName: d2 && (c2?.translated || c2?.original) || ``, amountPaid: d2 ? `` : u2, state: s2 !== $.FREE && !d2 && !l2 ? null : s2, amount: l2 };
12382
12387
  }
12383
- function xM(e18) {
12388
+ function CM(e18) {
12384
12389
  return (e18.participantsChoices?.serviceChoices ?? []).reduce((e19, t2) => e19 + (t2.numberOfParticipants ?? 0), 0);
12385
12390
  }
12386
- var SM = (e18) => !!e18 && new Date(e18).getTime() < Date.now();
12387
- function CM(e18, t2, n2) {
12391
+ var wM = (e18) => !!e18 && new Date(e18).getTime() < Date.now();
12392
+ function TM(e18, t2, n2) {
12388
12393
  let r2 = Date.now();
12389
- return e18.map((e19) => ({ reading: e19, startsAt: e19.startDate ? tM(e19.startDate) : NaN })).filter(({ startsAt: e19 }) => e19 > r2).sort((e19, t3) => e19.startsAt - t3.startsAt).map(({ reading: e19 }) => ({ startDate: e19.startDate, endDate: e19.endDate, timeZone: t2, durationMinutes: cM(e19.startDate, e19.endDate), staffName: e19.staffName || n2 }));
12394
+ return e18.map((e19) => ({ reading: e19, startsAt: e19.startDate ? rM(e19.startDate) : NaN })).filter(({ startsAt: e19 }) => e19 > r2).sort((e19, t3) => e19.startsAt - t3.startsAt).map(({ reading: e19 }) => ({ startDate: e19.startDate, endDate: e19.endDate, timeZone: t2, durationMinutes: uM(e19.startDate, e19.endDate), staffName: e19.staffName || n2 }));
12390
12395
  }
12391
- function wM(e18, t2, n2, r2, i2) {
12392
- return (t2 ?? e18.every((e19) => e19.allowedActions?.reschedule === true)) && n2 !== qj.PENDING && !!i2 && r2.every((e19) => !!e19 && !e19.isCourse && !e19.isHidden && !e19.requiresManualApproval);
12396
+ function EM(e18, t2, n2, r2, i2) {
12397
+ return (t2 ?? e18.every((e19) => e19.allowedActions?.reschedule === true)) && n2 !== Yj.PENDING && !!i2 && r2.every((e19) => !!e19 && !e19.isCourse && !e19.isHidden && !e19.requiresManualApproval);
12393
12398
  }
12394
- function TM(e18) {
12395
- return e18 === qj.CONFIRMED || e18 === qj.CREATED;
12399
+ function DM(e18) {
12400
+ return e18 === Yj.CONFIRMED || e18 === Yj.CREATED;
12396
12401
  }
12397
- function EM(e18, t2) {
12398
- return TM(e18) && t2.every((e19) => !!e19.startDate && !!e19.endDate) && !Rj(e18, iM(t2.map((e19) => e19.endDate)));
12402
+ function OM(e18, t2) {
12403
+ return DM(e18) && t2.every((e19) => !!e19.startDate && !!e19.endDate) && !Bj(e18, oM(t2.map((e19) => e19.endDate)));
12399
12404
  }
12400
- function DM(e18, t2, n2, r2) {
12401
- return !!r2?.bookingPageUrl && !r2.isHidden && !r2.isCourse && e18.length === 1 && Rj(t2, n2);
12405
+ function kM(e18, t2, n2, r2) {
12406
+ return !!r2?.bookingPageUrl && !r2.isHidden && !r2.isCourse && e18.length === 1 && Bj(t2, n2);
12402
12407
  }
12403
- var OM = (e18) => {
12408
+ var AM = (e18) => {
12404
12409
  let t2 = e18.booking?.startDate;
12405
12410
  return t2 ? new Date(t2).getTime() : 1 / 0;
12406
12411
  };
12407
- function kM(e18) {
12408
- return [...e18].sort((e19, t2) => OM(e19) - OM(t2));
12412
+ function jM(e18) {
12413
+ return [...e18].sort((e19, t2) => AM(e19) - AM(t2));
12409
12414
  }
12410
- function AM(e18, t2) {
12411
- let n2 = kM(e18), r2 = n2[0]?.booking;
12415
+ function MM(e18, t2) {
12416
+ let n2 = jM(e18), r2 = n2[0]?.booking;
12412
12417
  if (!r2) return null;
12413
- let i2 = Ij(n2.map((e19) => e19.booking?.status).filter((e19) => !!e19)), a2 = n2.map((e19) => lM(e19, i2, t2)), o2 = [...new Set(a2.map((e19) => e19.serviceId).filter(Boolean))], s2 = t2.services.get(a2[0].serviceId), c2 = o2.map((e19) => t2.services.get(e19)), l2 = s2?.calendarPageUrl || s2?.bookingPageUrl || ``, u2 = t2.multiServiceAllowedActions.get(Zj(r2)), d2 = rM(a2.map((e19) => e19.startDate)), f2 = iM(a2.map((e19) => e19.endDate)), p2 = SM(f2) ? uM(n2) : null, m2 = r2.bookedEntity, h2 = m2?.slot?.location ?? m2?.schedule?.location, g2 = n2.find((e19) => e19.conferencingDetails)?.conferencingDetails, _2 = a2[0].timeZone, v2 = !!g2?.guestUrl && TM(i2), y2 = n2.map((e19) => t2.cancellationFees.get(e19.booking?._id ?? ``)), b2 = y2.reduce((e19, t3) => e19 + (t3?.amount ?? 0), 0), x2 = y2.reduce((e19, t3, n3) => t3?.policyDescription ? [...e19, { description: t3.policyDescription, serviceName: a2[n3].serviceName }] : e19, []), S2 = o2.reduce((e19, n3) => {
12418
+ let i2 = Rj(n2.map((e19) => e19.booking?.status).filter((e19) => !!e19)), a2 = n2.map((e19) => dM(e19, i2, t2)), o2 = [...new Set(a2.map((e19) => e19.serviceId).filter(Boolean))], s2 = t2.services.get(a2[0].serviceId), c2 = o2.map((e19) => t2.services.get(e19)), l2 = s2?.calendarPageUrl || s2?.bookingPageUrl || ``, u2 = t2.multiServiceAllowedActions.get($j(r2)), d2 = aM(a2.map((e19) => e19.startDate)), f2 = oM(a2.map((e19) => e19.endDate)), p2 = wM(f2) ? fM(n2) : null, m2 = r2.bookedEntity, h2 = m2?.slot?.location ?? m2?.schedule?.location, g2 = n2.find((e19) => e19.conferencingDetails)?.conferencingDetails, _2 = a2[0].timeZone, v2 = !!g2?.guestUrl && DM(i2), y2 = n2.map((e19) => t2.cancellationFees.get(e19.booking?._id ?? ``)), b2 = y2.reduce((e19, t3) => e19 + (t3?.amount ?? 0), 0), x2 = y2.reduce((e19, t3, n3) => t3?.policyDescription ? [...e19, { description: t3.policyDescription, serviceName: a2[n3].serviceName }] : e19, []), S2 = o2.reduce((e19, n3) => {
12414
12419
  let r3 = t2.services.get(n3)?.policyDescription, i3 = a2.find((e20) => e20.serviceId === n3)?.serviceName;
12415
12420
  return r3 ? [...e19, { description: r3, serviceName: i3 ?? `` }] : e19;
12416
12421
  }, []), C2 = [...new Set(n2.map((e19) => e19.booking?.formSubmissionId ?? ``).filter((e19) => t2.submittedForms.has(e19)))], ee2 = C2.map((e19) => t2.submittedForms.get(e19) ?? ``), w2 = s2?.isCourse ? t2.courseSessions.get(m2?.schedule?.scheduleId ?? ``) ?? [] : [];
12417
- return { groupId: Xj(r2), bookingIds: n2.map((e19) => e19.booking?._id ?? ``), revision: n2.length === 1 ? r2.revision ?? null : null, bookingPageUrl: s2?.bookingPageUrl ?? ``, calendarPageUrl: s2?.calendarPageUrl ?? ``, contactId: r2.contactDetails?.contactId ?? null, title: a2[0].serviceName || null, serviceNames: a2.map((e19) => e19.serviceName), serviceImage: a2[0].serviceImage, startDate: d2, endDate: f2, timeZone: _2, isAllDay: m2?.slot?.allDay === true, location: (h2?.locationType === `OWNER_BUSINESS` ? `` : h2?.name) || h2?.formattedAddressTranslated || h2?.formattedAddress || t2.businessAddress, durationMinutes: a2.reduce((e19, t3) => e19 + t3.durationMinutes, 0), staffName: a2[0].staffName, participantCount: r2.totalParticipants ?? xM(r2), isCourse: s2?.isCourse === true, courseSessionCount: w2.length, courseSessions: CM(w2, _2, a2[0].staffName), serviceType: s2?.serviceType ?? null, status: i2, isOver: Rj(i2, f2), attendanceStatus: p2, isAvailableOnline: v2, videoConferenceLink: v2 ? aM(g2?.guestUrl ?? ``, `_blank`) : null, conferencingDetails: { guestUrl: v2 ? aM(g2?.guestUrl ?? ``, `_blank`) : null }, videoConferencePassword: v2 ? g2?.password ?? `` : ``, servicePageUrl: s2?.isHidden ? `` : s2?.servicePageUrl ?? ``, multiServiceId: Zj(r2) || null, canCancel: u2?.cancel ?? n2.every((e19) => e19.allowedActions?.cancel === true), canStateCancellationFee: n2.every((e19) => !t2.unreadableCancellationFees.has(e19.booking?._id ?? ``)), canReschedule: wM(n2, u2?.reschedule, i2, c2, l2), canBookAgain: DM(n2, i2, f2, s2), canBookAgainOnceCanceled: DM(n2, qj.CANCELED, f2, s2), canAddToCalendar: EM(i2, a2), canViewServiceDetails: !Lj(i2) && !!s2?.servicePageUrl && !s2.isHidden, cancellationFee: b2 ? Nj({ amount: b2, currency: y2.find(Boolean)?.currency, language: t2.locale }) : ``, cancellationPolicies: x2, bookingPolicies: S2, hasBookingPolicy: !Lj(i2) && S2.length > 0, payment: bM(n2, t2), hasOrder: n2.some((e19) => e19.order), submittedFormNames: [...new Set(ee2.filter(Boolean))], formSubmissionIds: C2, hasFormSubmission: C2.length > 0, sessions: a2 };
12422
+ return { groupId: Qj(r2), bookingIds: n2.map((e19) => e19.booking?._id ?? ``), revision: n2.length === 1 ? r2.revision ?? null : null, bookingPageUrl: s2?.bookingPageUrl ?? ``, calendarPageUrl: s2?.calendarPageUrl ?? ``, contactId: r2.contactDetails?.contactId ?? null, title: a2[0].serviceName || null, serviceNames: a2.map((e19) => e19.serviceName), serviceImage: a2[0].serviceImage, startDate: d2, endDate: f2, timeZone: _2, isAllDay: m2?.slot?.allDay === true, location: (h2?.locationType === `OWNER_BUSINESS` ? `` : h2?.name) || h2?.formattedAddressTranslated || h2?.formattedAddress || t2.businessAddress, durationMinutes: a2.reduce((e19, t3) => e19 + t3.durationMinutes, 0), staffName: a2[0].staffName, participantCount: r2.totalParticipants ?? CM(r2), isCourse: s2?.isCourse === true, courseSessionCount: w2.length, courseSessions: TM(w2, _2, a2[0].staffName), serviceType: s2?.serviceType ?? null, status: i2, isOver: Bj(i2, f2), attendanceStatus: p2, isAvailableOnline: v2, videoConferenceLink: v2 ? sM(g2?.guestUrl ?? ``, `_blank`) : null, conferencingDetails: { guestUrl: v2 ? sM(g2?.guestUrl ?? ``, `_blank`) : null }, videoConferencePassword: v2 ? g2?.password ?? `` : ``, servicePageUrl: s2?.isHidden ? `` : s2?.servicePageUrl ?? ``, multiServiceId: $j(r2) || null, canCancel: u2?.cancel ?? n2.every((e19) => e19.allowedActions?.cancel === true), canStateCancellationFee: n2.every((e19) => !t2.unreadableCancellationFees.has(e19.booking?._id ?? ``)), canReschedule: EM(n2, u2?.reschedule, i2, c2, l2), canBookAgain: kM(n2, i2, f2, s2), canBookAgainOnceCanceled: kM(n2, Yj.CANCELED, f2, s2), canAddToCalendar: OM(i2, a2), canViewServiceDetails: !zj(i2) && !!s2?.servicePageUrl && !s2.isHidden, cancellationFee: b2 ? Fj({ amount: b2, currency: y2.find(Boolean)?.currency, language: t2.locale }) : ``, cancellationPolicies: x2, bookingPolicies: S2, hasBookingPolicy: !zj(i2) && S2.length > 0, payment: SM(n2, t2), hasOrder: n2.some((e19) => e19.order), submittedFormNames: [...new Set(ee2.filter(Boolean))], formSubmissionIds: C2, hasFormSubmission: C2.length > 0, sessions: a2 };
12418
12423
  }
12419
- function jM(e18, t2) {
12420
- return [...$j(e18).values()].map((e19) => AM(e19, t2)).filter((e19) => e19 !== null);
12424
+ function NM(e18, t2) {
12425
+ return [...tM(e18).values()].map((e19) => MM(e19, t2)).filter((e19) => e19 !== null);
12421
12426
  }
12422
- function MM(e18, t2) {
12423
- return new Map(jM(e18, t2).filter((e19) => e19.hasFormSubmission).map(({ groupId: e19, formSubmissionIds: t3, hasFormSubmission: n2, submittedFormNames: r2 }) => [e19, { formSubmissionIds: t3, hasFormSubmission: n2, submittedFormNames: r2 }]));
12427
+ function PM(e18, t2) {
12428
+ return new Map(NM(e18, t2).filter((e19) => e19.hasFormSubmission).map(({ groupId: e19, formSubmissionIds: t3, hasFormSubmission: n2, submittedFormNames: r2 }) => [e19, { formSubmissionIds: t3, hasFormSubmission: n2, submittedFormNames: r2 }]));
12424
12429
  }
12425
- function NM(e18, t2) {
12430
+ function FM(e18, t2) {
12426
12431
  return e18.map((e19) => {
12427
12432
  let n2 = t2.get(e19.groupId);
12428
12433
  return n2 ? { ...e19, ...n2 } : e19;
12429
12434
  });
12430
12435
  }
12431
- function PM(e18) {
12436
+ function IM(e18) {
12432
12437
  let t2 = e18.map((e19) => {
12433
12438
  let t3 = e19.booking?.bookedEntity;
12434
12439
  return t3?.slot?.serviceId ?? t3?.schedule?.serviceId ?? ``;
12435
12440
  });
12436
12441
  return [...new Set(t2.filter(Boolean))];
12437
12442
  }
12438
- function FM(e18, t2) {
12443
+ function LM(e18, t2) {
12439
12444
  return e18.map((e19) => ({ ...e19, timeZone: e19.sessions[0]?.isAllDay ? e19.timeZone : t2, sessions: e19.sessions.map((e20) => e20.isAllDay ? e20 : { ...e20, timeZone: t2 }), courseSessions: e19.courseSessions.map((e20) => ({ ...e20, timeZone: t2 })) }));
12440
12445
  }
12441
- var IM = { groupId: true, bookingIds: true, revision: true, multiServiceId: true, bookingPageUrl: true, calendarPageUrl: true, contactId: true, formSubmissionIds: true };
12442
- function LM(e18) {
12443
- return Object.fromEntries(Object.entries(e18).filter(([e19]) => !(e19 in IM)));
12446
+ var RM = { groupId: true, bookingIds: true, revision: true, multiServiceId: true, bookingPageUrl: true, calendarPageUrl: true, contactId: true, formSubmissionIds: true };
12447
+ function zM(e18) {
12448
+ return Object.fromEntries(Object.entries(e18).filter(([e19]) => !(e19 in RM)));
12444
12449
  }
12445
- function RM(e18) {
12446
- return { ...e18, startDate: Cj(e18.startDate, e18.timeZone), endDate: Cj(e18.endDate, e18.timeZone), sessions: e18.sessions.map((e19) => ({ ...e19, startDate: Cj(e19.startDate, e19.timeZone), endDate: Cj(e19.endDate, e19.timeZone) })), courseSessions: e18.courseSessions.map((e19) => ({ ...e19, startDate: Cj(e19.startDate, e19.timeZone), endDate: Cj(e19.endDate, e19.timeZone) })) };
12450
+ function BM(e18) {
12451
+ return { ...e18, startDate: Tj(e18.startDate, e18.timeZone), endDate: Tj(e18.endDate, e18.timeZone), sessions: e18.sessions.map((e19) => ({ ...e19, startDate: Tj(e19.startDate, e19.timeZone), endDate: Tj(e19.endDate, e19.timeZone) })), courseSessions: e18.courseSessions.map((e19) => ({ ...e19, startDate: Tj(e19.startDate, e19.timeZone), endDate: Tj(e19.endDate, e19.timeZone) })) };
12447
12452
  }
12448
- var zM = () => {
12453
+ var VM = () => {
12449
12454
  let { locale: e18, language: t2 } = (0, import_services_manager_react.useService)(ua);
12450
12455
  return e18 || t2;
12451
12456
  };
12452
- var BM = { CREATED: `CONFIRMED`, CONFIRMED: `CONFIRMED`, PENDING: `PENDING`, WAITING_LIST: `WAITLISTED`, CANCELED: `CANCELED`, DECLINED: `DECLINED` };
12453
- var VM = { ATTENDED: `ATTENDED`, NOT_ATTENDED: `NOT_ATTENDED`, NOT_SET: null };
12454
- var HM = { CONFIRMED: Da.status.confirmed, PENDING: Da.status.pending, WAITLISTED: Da.status.waitlisted, CANCELED: Da.status.canceled, DECLINED: Da.status.declined, ATTENDED: Da.status.attended, NOT_ATTENDED: Da.status.notAttended };
12455
- var UM = { "&": `&amp;`, "<": `&lt;`, ">": `&gt;`, '"': `&quot;`, "'": `&#39;` };
12456
- var WM = (e18) => ({ text: e18, html: `<p>${e18.replace(/[&<>"']/g, (e19) => UM[e19])}</p>`, linkList: [] });
12457
- var GM = (e18, t2) => t2 ? WM(Ta(e18, HM[t2])) : null;
12458
- var KM = (e18, t2) => t2 !== null && Object.hasOwn(e18, t2) ? e18[t2] : null;
12459
- var qM = (e18, t2) => GM(e18, KM(BM, t2));
12460
- var JM = (e18, t2) => GM(e18, KM(VM, t2));
12461
- var YM = (e18) => ({ statusToRichText: (t2) => qM(e18, t2), attendanceStatusToRichText: (t2) => JM(e18, t2) });
12462
- var XM = oj();
12463
- var ZM = `bookingId`;
12464
- var QM = `rescheduleRedirectUrl`;
12465
- var $M = (e18, t2, n2) => {
12457
+ var HM = { CREATED: `CONFIRMED`, CONFIRMED: `CONFIRMED`, PENDING: `PENDING`, WAITING_LIST: `WAITLISTED`, CANCELED: `CANCELED`, DECLINED: `DECLINED` };
12458
+ var UM = { ATTENDED: `ATTENDED`, NOT_ATTENDED: `NOT_ATTENDED`, NOT_SET: null };
12459
+ var WM = { CONFIRMED: Da.status.confirmed, PENDING: Da.status.pending, WAITLISTED: Da.status.waitlisted, CANCELED: Da.status.canceled, DECLINED: Da.status.declined, ATTENDED: Da.status.attended, NOT_ATTENDED: Da.status.notAttended };
12460
+ var GM = { "&": `&amp;`, "<": `&lt;`, ">": `&gt;`, '"': `&quot;`, "'": `&#39;` };
12461
+ var KM = (e18) => ({ text: e18, html: `<p>${e18.replace(/[&<>"']/g, (e19) => GM[e19])}</p>`, linkList: [] });
12462
+ var qM = (e18, t2) => t2 ? KM(Ta(e18, WM[t2])) : null;
12463
+ var JM = (e18, t2) => t2 !== null && Object.hasOwn(e18, t2) ? e18[t2] : null;
12464
+ var YM = (e18, t2) => qM(e18, JM(HM, t2));
12465
+ var XM = (e18, t2) => qM(e18, JM(UM, t2));
12466
+ var ZM = (e18) => ({ statusToRichText: (t2) => YM(e18, t2), attendanceStatusToRichText: (t2) => XM(e18, t2) });
12467
+ var QM = cj();
12468
+ var $M = `bookingId`;
12469
+ var eN = `rescheduleRedirectUrl`;
12470
+ var tN = (e18, t2, n2) => {
12466
12471
  let r2 = e18.indexOf(`#`), i2 = r2 === -1 ? `` : e18.slice(r2), a2 = r2 === -1 ? e18 : e18.slice(0, r2), o2 = a2.indexOf(`?`), s2 = o2 === -1 ? a2 : a2.slice(0, o2), c2 = new URLSearchParams(o2 === -1 ? `` : a2.slice(o2 + 1));
12467
- return c2.set(ZM, t2), n2 && c2.set(QM, n2), `${s2}?${c2.toString()}${i2}`;
12472
+ return c2.set($M, t2), n2 && c2.set(eN, n2), `${s2}?${c2.toString()}${i2}`;
12468
12473
  };
12469
- var eN = async (e18, t2) => (await XM.queryBookingById(e18.bookingIds[0]).catch(() => void 0))?.extendedBookings?.[0]?.booking?.revision ?? t2 ?? ``;
12470
- var tN = (e18, t2, n2) => {
12474
+ var nN = async (e18, t2) => (await QM.queryBookingById(e18.bookingIds[0]).catch(() => void 0))?.extendedBookings?.[0]?.booking?.revision ?? t2 ?? ``;
12475
+ var rN = (e18, t2, n2) => {
12471
12476
  let r2 = e18.serviceNames.length;
12472
12477
  if (e18.multiServiceId && r2 > 1) return { succeeded: Ea(t2, Da.cancel.succeededGroup, r2, { value: dD(r2, n2) }), failed: Ea(t2, Da.cancel.failedGroup, r2, { value: dD(r2, n2) }) };
12473
12478
  if (e18.status === ds.PENDING) return { succeeded: Ta(t2, Da.cancel.succeededPending), failed: Ta(t2, Da.cancel.failedPending) };
12474
12479
  let i2 = e18.serviceNames[0] ?? e18.title ?? ``;
12475
12480
  return { succeeded: Ta(t2, Da.cancel.succeeded, { service: i2 }), failed: Ta(t2, Da.cancel.failed, { service: i2 }) };
12476
12481
  };
12477
- var nN = (e18, t2, n2, r2, i2) => {
12478
- let { t: a2 } = sa(), s2 = Lh(), { navigateTo: c2 } = (0, import_services_manager_react.useService)(da), p2 = (0, import_services_manager_react.useService)(eo), { siteUrl: m2 } = p2, { language: h2 } = (0, import_services_manager_react.useService)(ua), g2 = zM(), [_2, v2] = (0, import_react.useState)([]), y2 = (0, import_react.useRef)(/* @__PURE__ */ new Map()), [b2, x2] = (0, import_react.useState)([]), S2 = (0, import_react.useRef)(/* @__PURE__ */ new Set()), C2 = (0, import_react.useRef)(/* @__PURE__ */ new Map()), ee2 = Ia(), w2 = (0, import_react.useCallback)((e19, t3) => {
12482
+ var iN = (e18, t2, n2, r2, i2) => {
12483
+ let { t: a2 } = sa(), s2 = Lh(), { navigateTo: c2 } = (0, import_services_manager_react.useService)(da), p2 = (0, import_services_manager_react.useService)(eo), { siteUrl: m2 } = p2, { language: h2 } = (0, import_services_manager_react.useService)(ua), g2 = VM(), [_2, v2] = (0, import_react.useState)([]), y2 = (0, import_react.useRef)(/* @__PURE__ */ new Map()), [b2, x2] = (0, import_react.useState)([]), S2 = (0, import_react.useRef)(/* @__PURE__ */ new Set()), C2 = (0, import_react.useRef)(/* @__PURE__ */ new Map()), ee2 = Ia(), w2 = (0, import_react.useCallback)((e19, t3) => {
12479
12484
  let o2 = y2.current.get(e19.groupId);
12480
12485
  if (o2) return o2;
12481
12486
  v2((t4) => [...t4, e19.groupId]), x2((t4) => t4.filter((t5) => t5 !== e19.groupId)), S2.current.delete(e19.groupId);
12482
- let c3 = Promise.resolve().then(t3).then(() => (n2(e19.groupId), i2(e19))).then(() => (s2.success(tN(e19, a2, g2).succeeded), true), () => (r2(e19.groupId), x2((t4) => [...t4, e19.groupId]), s2.error(tN(e19, a2, g2).failed), false)).finally(() => {
12487
+ let c3 = Promise.resolve().then(t3).then(() => (n2(e19.groupId), i2(e19))).then(() => (s2.success(rN(e19, a2, g2).succeeded), true), () => (r2(e19.groupId), x2((t4) => [...t4, e19.groupId]), s2.error(rN(e19, a2, g2).failed), false)).finally(() => {
12483
12488
  y2.current.delete(e19.groupId), v2((t4) => t4.filter((t5) => t5 !== e19.groupId));
12484
12489
  });
12485
12490
  return y2.current.set(e19.groupId, c3), c3;
12486
12491
  }, [n2, r2, i2, a2, s2, g2]), T2 = (0, import_react.useCallback)((e19) => w2(e19, async () => {
12487
12492
  let { multiServiceId: t3 } = e19;
12488
- if (t3) return XM.cancelMultiServiceBooking(t3);
12489
- let n3 = await eN(e19, e19.revision);
12493
+ if (t3) return QM.cancelMultiServiceBooking(t3);
12494
+ let n3 = await nN(e19, e19.revision);
12490
12495
  if (!n3) throw Error(`No revision to cancel booking ${e19.bookingIds[0]} with`);
12491
- return XM.cancelBooking(e19.bookingIds[0], n3);
12496
+ return QM.cancelBooking(e19.bookingIds[0], n3);
12492
12497
  }), [w2]), te2 = (0, import_react.useCallback)((e19) => {
12493
12498
  if (!e19.canAddToCalendar) return;
12494
- let t3 = vj(e19, a2, g2);
12499
+ let t3 = bj(e19, a2, g2);
12495
12500
  window.open(t3, `_blank`, `noopener`);
12496
- }, [a2, g2]), ne2 = bj(e18), re2 = (0, import_react.useCallback)(async (e19) => {
12501
+ }, [a2, g2]), ne2 = Sj(e18), re2 = (0, import_react.useCallback)(async (e19) => {
12497
12502
  ee2($a(t2));
12498
12503
  let n3 = (C2.current.get(e19.groupId) ?? 0) + 1;
12499
12504
  C2.current.set(e19.groupId, n3);
@@ -12506,50 +12511,50 @@ var nN = (e18, t2, n2, r2, i2) => {
12506
12511
  return C2.current.get(e19.groupId) === n3 && s2.error(t3), { type: `error`, message: t3 };
12507
12512
  }
12508
12513
  }, [a2, s2, ee2, t2, ne2]), ie2 = (e19) => {
12509
- let t3 = (e20) => uj(e20, m2, p2.currentUrl, h2);
12514
+ let t3 = (e20) => fj(e20, m2, p2.currentUrl, h2);
12510
12515
  return { ...e19, bookingPageUrl: t3(e19.bookingPageUrl), calendarPageUrl: t3(e19.calendarPageUrl), servicePageUrl: e19.servicePageUrl && t3(e19.servicePageUrl), sessions: e19.sessions.map((e20) => ({ ...e20, servicePageUrl: e20.servicePageUrl && t3(e20.servicePageUrl) })) };
12511
- }, ae2 = (0, import_react.useMemo)(() => YM(a2), [a2]);
12512
- return { bookings: (0, import_react.useMemo)(() => e18.map(ie2).map((e19) => ({ ...LM(RM(e19)), sessions: RM(e19).sessions.map((e20) => ({ ...e20, onViewServiceDetails: () => {
12513
- e20.canViewServiceDetails && e20.servicePageUrl && dj(e20.servicePageUrl);
12516
+ }, ae2 = (0, import_react.useMemo)(() => ZM(a2), [a2]);
12517
+ return { bookings: (0, import_react.useMemo)(() => e18.map(ie2).map((e19) => ({ ...zM(BM(e19)), sessions: BM(e19).sessions.map((e20) => ({ ...e20, onViewServiceDetails: () => {
12518
+ e20.canViewServiceDetails && e20.servicePageUrl && pj(e20.servicePageUrl);
12514
12519
  } })), _id: e19.groupId, isCancelling: _2.includes(e19.groupId), hasCancelFailed: b2.includes(e19.groupId), cancelFailureDismissals: { isDismissed: () => S2.current.has(e19.groupId), dismiss: () => {
12515
12520
  S2.current.add(e19.groupId);
12516
12521
  } }, onCancel: () => T2(e19), onAddToCalendar: () => te2(e19), onReschedule: () => {
12517
12522
  let n3 = e19.calendarPageUrl || e19.bookingPageUrl;
12518
- e19.canReschedule && n3 && e19.multiServiceId === null && (ee2(Za(t2, { bookingId: e19.bookingIds[0], serviceId: e19.sessions[0]?.serviceId, contactId: e19.contactId })), c2({ href: $M(n3, e19.bookingIds[0], p2.currentUrl) }));
12523
+ e19.canReschedule && n3 && e19.multiServiceId === null && (ee2(Za(t2, { bookingId: e19.bookingIds[0], serviceId: e19.sessions[0]?.serviceId, contactId: e19.contactId })), c2({ href: tN(n3, e19.bookingIds[0], p2.currentUrl) }));
12519
12524
  }, onBookAgain: () => {
12520
12525
  e19.canBookAgain && (ee2(Ya(t2, e19.serviceType)), ee2(Xa(e19.serviceType, e19.sessions[0]?.serviceId)), c2({ href: e19.bookingPageUrl }));
12521
12526
  }, onViewServiceDetails: () => {
12522
- e19.canViewServiceDetails && e19.servicePageUrl && dj(e19.servicePageUrl);
12527
+ e19.canViewServiceDetails && e19.servicePageUrl && pj(e19.servicePageUrl);
12523
12528
  }, onJoinVideoCall: () => {
12524
12529
  let t3 = e19.isAvailableOnline ? e19.conferencingDetails.guestUrl?.href : ``;
12525
12530
  t3 && (ee2(Qa()), window.open(t3, `_blank`, `noopener`));
12526
12531
  }, onLoadFormSubmission: () => re2(e19), ...ae2 })), [e18, ae2, _2, b2, T2, te2, c2, p2, m2, h2, re2, ee2, t2]), themeAnchor: s2.themeAnchor };
12527
12532
  };
12528
- var rN = la(`@wix/site-service-pages`);
12529
- var iN = `13d21c63-b5ec-5912-8397-c3a5ddb27a97`;
12530
- var aN = (e18) => {
12531
- let { pages: t2 } = (0, import_services_manager_react.useService)(rN), n2 = (0, import_services_manager_react.useService)(eo), r2 = uD(t2, e18)?.appPageId;
12532
- return r2 ? `./${(n2.appSectionRelativeUrl(iN, r2) ?? ``).replace(/^\//, ``)}` : null;
12533
+ var aN = la(`@wix/site-service-pages`);
12534
+ var oN = `13d21c63-b5ec-5912-8397-c3a5ddb27a97`;
12535
+ var sN = (e18) => {
12536
+ let { pages: t2 } = (0, import_services_manager_react.useService)(aN), n2 = (0, import_services_manager_react.useService)(eo), r2 = uD(t2, e18)?.appPageId;
12537
+ return r2 ? `./${(n2.appSectionRelativeUrl(oN, r2) ?? ``).replace(/^\//, ``)}` : null;
12533
12538
  };
12534
- var oN = () => {
12535
- let { t: e18 } = sa(), t2 = zM(), { language: n2 } = (0, import_services_manager_react.useService)(ua), r2 = (0, import_react.useCallback)((e19) => new Intl.NumberFormat(t2).format(e19), [t2]), i2 = (0, import_react.useCallback)((e19) => fD(e19, n2, { unbreakableParts: true }), [n2]), a2 = (0, import_react.useCallback)((t3) => t3.join(Ta(e18, Da.forms.separator)), [e18]), s2 = (0, import_react.useCallback)((t3) => t3.flatMap((e19) => e19.addOns).filter((e19) => e19.name).map((t4) => t4.quantity > 1 ? Ta(e18, Da.addOns.withQuantity, { name: t4.name, quantity: r2(t4.quantity) }) : t4.name).join(Ta(e18, Da.addOns.separator)), [e18, r2]);
12539
+ var cN = () => {
12540
+ let { t: e18 } = sa(), t2 = VM(), { language: n2 } = (0, import_services_manager_react.useService)(ua), r2 = (0, import_react.useCallback)((e19) => new Intl.NumberFormat(t2).format(e19), [t2]), i2 = (0, import_react.useCallback)((e19) => fD(e19, n2, { unbreakableParts: true }), [n2]), a2 = (0, import_react.useCallback)((t3) => t3.join(Ta(e18, Da.forms.separator)), [e18]), s2 = (0, import_react.useCallback)((t3) => t3.flatMap((e19) => e19.addOns).filter((e19) => e19.name).map((t4) => t4.quantity > 1 ? Ta(e18, Da.addOns.withQuantity, { name: t4.name, quantity: r2(t4.quantity) }) : t4.name).join(Ta(e18, Da.addOns.separator)), [e18, r2]);
12536
12541
  return (0, import_react.useMemo)(() => ({ duration: i2, addOnsSummary: s2, submittedFormsSummary: a2 }), [i2, s2, a2]);
12537
12542
  };
12538
- var sN = (e18) => {
12539
- let t2 = oN();
12543
+ var lN = (e18) => {
12544
+ let t2 = cN();
12540
12545
  return (0, import_react.useMemo)(() => e18.map(({ durationMinutes: e19, sessions: n2, courseSessions: r2, payment: i2, submittedFormNames: a2, hasOrder: o2, canBookAgainOnceCanceled: s2, ...c2 }) => {
12541
12546
  let l2 = t2.addOnsSummary(n2), u2 = !c2.isOver, d2 = i2.state === `PLAN_PAID`, f2 = u2 && i2.state !== null, p2 = u2 && !!c2.location, m2 = t2.submittedFormsSummary(a2), h2 = u2 && !!m2;
12542
12547
  return { ...c2, bookedDuration: t2.duration(e19), addOnsSummary: l2, hasBookedAddOns: !!l2, hasLocation: p2, submittedFormsSummary: m2, hasSubmittedForms: h2, hasDetails: p2 || f2 || h2, hasPaymentLink: u2 && (d2 || f2 && o2), isMultiService: c2.multiServiceId !== null, payment: { ...i2, hasPlan: d2, hasSummary: f2 }, sessions: n2.map(({ durationMinutes: e20, ...n3 }) => ({ ...n3, bookedDuration: t2.duration(e20) })), courseSessions: r2.map(({ durationMinutes: e20, ...n3 }) => ({ ...n3, duration: t2.duration(e20) })) };
12543
12548
  }), [e18, t2]);
12544
12549
  };
12545
- var cN = oj();
12546
- var lN = 19;
12547
- var uN = `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`;
12548
- function dN(e18) {
12550
+ var uN = cj();
12551
+ var dN = 19;
12552
+ var fN = `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`;
12553
+ function pN(e18) {
12549
12554
  let t2 = /* @__PURE__ */ new Map();
12550
12555
  for (let n2 of e18) {
12551
- let e19 = n2.booking?.bookedEntity?.schedule, r2 = e19?.scheduleId, i2 = e19?.firstSessionStart?.slice(0, lN) ?? ``, a2 = e19?.lastSessionEnd?.slice(0, lN) ?? ``;
12552
- if (!r2 || i2.length !== lN || a2.length !== lN) continue;
12556
+ let e19 = n2.booking?.bookedEntity?.schedule, r2 = e19?.scheduleId, i2 = e19?.firstSessionStart?.slice(0, dN) ?? ``, a2 = e19?.lastSessionEnd?.slice(0, dN) ?? ``;
12557
+ if (!r2 || i2.length !== dN || a2.length !== dN) continue;
12553
12558
  let o2 = e19.timezone ?? ``, s2 = t2.get(o2);
12554
12559
  if (!s2) {
12555
12560
  t2.set(o2, { scheduleIds: [r2], fromLocalDate: i2, toLocalDate: a2 });
@@ -12559,95 +12564,95 @@ function dN(e18) {
12559
12564
  }
12560
12565
  return t2;
12561
12566
  }
12562
- function fN(e18, t2) {
12563
- let n2 = Sj(e18?.utcDate);
12567
+ function mN(e18, t2) {
12568
+ let n2 = wj(e18?.utcDate);
12564
12569
  if (n2 || !e18?.localDate || !t2) return n2;
12565
12570
  let r2 = Z.fromISO(e18.localDate, { zone: t2 });
12566
12571
  return r2.isValid ? r2.toJSDate().toISOString() : null;
12567
12572
  }
12568
- function pN(e18 = []) {
12573
+ function hN(e18 = []) {
12569
12574
  let t2 = e18.filter((e19) => e19.name);
12570
- return (t2.find((e19) => e19.type === uN) ?? t2[0])?.name ?? ``;
12575
+ return (t2.find((e19) => e19.type === fN) ?? t2[0])?.name ?? ``;
12571
12576
  }
12572
- function mN(e18, t2) {
12577
+ function gN(e18, t2) {
12573
12578
  let n2 = e18.timeZone || e18.start?.timeZone || t2;
12574
- return { startDate: fN(e18.start, n2), endDate: fN(e18.end, n2), staffName: pN(e18.resources) };
12579
+ return { startDate: mN(e18.start, n2), endDate: mN(e18.end, n2), staffName: hN(e18.resources) };
12575
12580
  }
12576
- async function hN(e18) {
12577
- let t2 = /* @__PURE__ */ new Map(), n2 = dN(e18);
12581
+ async function _N(e18) {
12582
+ let t2 = /* @__PURE__ */ new Map(), n2 = pN(e18);
12578
12583
  if (n2.size === 0) return t2;
12579
- let r2 = await Promise.all([...n2].map(([e19, { scheduleIds: t3, fromLocalDate: n3, toLocalDate: r3 }]) => cN.queryScheduleEvents(t3, { fromLocalDate: n3, toLocalDate: r3, ...e19 ? { timeZone: e19 } : {} }).then((t4) => t4.map((t5) => ({ event: t5, timeZone: e19 }))).catch(() => [])));
12584
+ let r2 = await Promise.all([...n2].map(([e19, { scheduleIds: t3, fromLocalDate: n3, toLocalDate: r3 }]) => uN.queryScheduleEvents(t3, { fromLocalDate: n3, toLocalDate: r3, ...e19 ? { timeZone: e19 } : {} }).then((t4) => t4.map((t5) => ({ event: t5, timeZone: e19 }))).catch(() => [])));
12580
12585
  for (let { event: e19, timeZone: n3 } of r2.flat()) if (e19.scheduleId && e19.status !== vD.CANCELLED) {
12581
12586
  let r3 = t2.get(e19.scheduleId) ?? [];
12582
- r3.push(mN(e19, n3)), t2.set(e19.scheduleId, r3);
12587
+ r3.push(gN(e19, n3)), t2.set(e19.scheduleId, r3);
12583
12588
  }
12584
12589
  return t2;
12585
12590
  }
12586
- var gN = oj();
12587
- var _N = `APPROVED`;
12588
- var vN = `CHARGED`;
12589
- var yN = (e18) => e18.giftcardPaymentDetails ? e18.giftcardPaymentDetails.voided !== true : e18.regularPaymentDetails?.status === _N;
12590
- var bN = (e18) => e18.membershipPaymentDetails?.status === vN && e18.membershipPaymentDetails.voided !== true;
12591
- async function xN(e18) {
12592
- let t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Map(), r2 = [...new Set(e18.filter((e19) => e19.order?.paymentStatus === `PAID` || e19.booking && fM(e19.booking)).map((e19) => e19.order?._id ?? ``).filter(Boolean))];
12591
+ var vN = cj();
12592
+ var yN = `APPROVED`;
12593
+ var bN = `CHARGED`;
12594
+ var xN = (e18) => e18.giftcardPaymentDetails ? e18.giftcardPaymentDetails.voided !== true : e18.regularPaymentDetails?.status === yN;
12595
+ var SN = (e18) => e18.membershipPaymentDetails?.status === bN && e18.membershipPaymentDetails.voided !== true;
12596
+ async function CN(e18) {
12597
+ let t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Map(), r2 = [...new Set(e18.filter((e19) => e19.order?.paymentStatus === `PAID` || e19.booking && mM(e19.booking)).map((e19) => e19.order?._id ?? ``).filter(Boolean))];
12593
12598
  if (r2.length === 0) return { methods: t2, planCharges: n2 };
12594
- let i2 = await gN.listOrderTransactions(r2).catch(() => void 0);
12599
+ let i2 = await vN.listOrderTransactions(r2).catch(() => void 0);
12595
12600
  for (let { orderId: e19, payments: r3 } of i2?.orderTransactions ?? []) {
12596
12601
  if (!e19) continue;
12597
- let i3 = (r3 ?? []).find(bN)?.membershipPaymentDetails;
12602
+ let i3 = (r3 ?? []).find(SN)?.membershipPaymentDetails;
12598
12603
  i3 && n2.set(e19, i3.name ?? {});
12599
- let [a2] = (r3 ?? []).filter(yN).sort((e20, t3) => new Date(t3._createdDate ?? 0).getTime() - new Date(e20._createdDate ?? 0).getTime());
12604
+ let [a2] = (r3 ?? []).filter(xN).sort((e20, t3) => new Date(t3._createdDate ?? 0).getTime() - new Date(e20._createdDate ?? 0).getTime());
12600
12605
  a2 && t2.set(e19, a2.regularPaymentDetails && !a2.regularPaymentDetails.offlinePayment ? `ONLINE` : `IN_PERSON`);
12601
12606
  }
12602
12607
  return { methods: t2, planCharges: n2 };
12603
12608
  }
12604
- var SN = oj();
12605
- var CN = (e18) => !!e18?.amount?.trim() || !!e18?.formattedAmount;
12606
- async function wN(e18) {
12607
- let t2 = e18.filter(({ booking: e19, order: t3 }) => e19?._id && t3?._id && !fM(e19) && ![`FULLY_REFUNDED`, `PARTIALLY_REFUNDED`].includes(t3.paymentStatus ?? ``) && (!t3.bookingPrice || t3.bookingPrice.amount !== void 0 && t3.bookingPrice.amount.trim() !== `` && Number(t3.bookingPrice.amount) === 0 && Number(t3.totalPrice?.amount) > 0)), n2 = [...new Set(t2.map(({ order: e19 }) => e19._id))], r2 = /* @__PURE__ */ new Map();
12609
+ var wN = cj();
12610
+ var TN = (e18) => !!e18?.amount?.trim() || !!e18?.formattedAmount;
12611
+ async function EN(e18) {
12612
+ let t2 = e18.filter(({ booking: e19, order: t3 }) => e19?._id && t3?._id && !mM(e19) && ![`FULLY_REFUNDED`, `PARTIALLY_REFUNDED`].includes(t3.paymentStatus ?? ``) && (!t3.bookingPrice || t3.bookingPrice.amount !== void 0 && t3.bookingPrice.amount.trim() !== `` && Number(t3.bookingPrice.amount) === 0 && Number(t3.totalPrice?.amount) > 0)), n2 = [...new Set(t2.map(({ order: e19 }) => e19._id))], r2 = /* @__PURE__ */ new Map();
12608
12613
  return await Promise.all(n2.map(async (e19) => {
12609
- let n3 = await SN.getOrder(e19).catch(() => void 0);
12614
+ let n3 = await wN.getOrder(e19).catch(() => void 0);
12610
12615
  if (!(!n3 || n3._id && n3._id !== e19)) for (let i2 of t2.filter((t3) => t3.order?._id === e19)) {
12611
12616
  let e20 = (n3.lineItems ?? []).filter((e21) => e21.catalogReference?.appId === cD.WIX_BOOKINGS && e21.catalogReference.catalogItemId === i2.booking?._id);
12612
12617
  if (e20.length !== 1 || e20[0].priceUndetermined) continue;
12613
- let t3 = [e20[0].totalPriceAfterTax, e20[0].lineItemPrice].find(CN);
12618
+ let t3 = [e20[0].totalPriceAfterTax, e20[0].lineItemPrice].find(TN);
12614
12619
  t3 && r2.set(i2.booking._id, { price: t3, currency: n3.currency ?? i2.order?.currency });
12615
12620
  }
12616
12621
  })), r2;
12617
12622
  }
12618
- var TN = oj();
12619
- async function EN(e18) {
12620
- let t2 = /* @__PURE__ */ new Map(), n2 = [...new Set(e18.map((e19) => e19.booking ? Zj(e19.booking) : ``))].filter(Boolean), r2 = [];
12623
+ var DN = cj();
12624
+ async function ON(e18) {
12625
+ let t2 = /* @__PURE__ */ new Map(), n2 = [...new Set(e18.map((e19) => e19.booking ? $j(e19.booking) : ``))].filter(Boolean), r2 = [];
12621
12626
  for (let e19 = 0; e19 < n2.length; e19 += 50) r2.push(n2.slice(e19, e19 + 50));
12622
- let i2 = await Promise.all(r2.map((e19) => TN.getMultiServiceBookingAllowedActions(e19).catch(() => void 0)));
12627
+ let i2 = await Promise.all(r2.map((e19) => DN.getMultiServiceBookingAllowedActions(e19).catch(() => void 0)));
12623
12628
  for (let e19 of i2.flatMap((e20) => e20?.results ?? [])) {
12624
12629
  let n3 = e19.itemMetadata?._id;
12625
12630
  n3 && e19.itemMetadata?.success && e19.item && t2.set(n3, { cancel: e19.item.cancel === true, reschedule: e19.item.reschedule === true });
12626
12631
  }
12627
12632
  return t2;
12628
12633
  }
12629
- var DN = oj();
12630
- var ON = [ds.CONFIRMED, ds.PENDING, ds.WAITING_LIST];
12631
- var kN = [ds.CANCELED, ds.DECLINED];
12632
- var AN = [{ appId: cD.WIX_BOOKINGS }, { appId: { $exists: false } }];
12633
- function jN(e18, t2) {
12634
- return e18 === Oa.ALL ? { filter: { $and: [{ $or: [{ endDate: { $gt: t2 }, status: { $in: ON } }, { endDate: { $lte: t2 } }, { status: { $in: kN } }] }, { $or: AN }] }, sort: [{ fieldName: `startDate`, order: `ASC` }, { fieldName: `id`, order: `ASC` }] } : e18 === Oa.UPCOMING ? { filter: { endDate: { $gt: t2 }, status: { $in: ON }, $or: AN }, sort: [{ fieldName: `startDate`, order: `ASC` }] } : { filter: { $and: [{ $or: [{ endDate: { $lte: t2 } }, { status: { $in: kN } }] }, { $or: AN }] }, sort: [{ fieldName: `startDate`, order: `DESC` }] };
12635
- }
12636
- var MN = (e18) => ({ withBookingAllowedActions: true, ...e18 !== Oa.UPCOMING && { withBookingAttendanceInfo: true }, withBookingConferencingDetails: true, withEcomOrder: true });
12637
- var NN = (e18) => [...new Set(e18.map((e19) => e19.booking ? Zj(e19.booking) : ``))].filter(Boolean);
12638
- async function PN(e18, t2, n2) {
12639
- let r2 = NN(e18);
12634
+ var kN = cj();
12635
+ var AN = [ds.CONFIRMED, ds.PENDING, ds.WAITING_LIST];
12636
+ var jN = [ds.CANCELED, ds.DECLINED];
12637
+ var MN = [{ appId: cD.WIX_BOOKINGS }, { appId: { $exists: false } }];
12638
+ function NN(e18, t2) {
12639
+ return e18 === Oa.ALL ? { filter: { $and: [{ $or: [{ endDate: { $gt: t2 }, status: { $in: AN } }, { endDate: { $lte: t2 } }, { status: { $in: jN } }] }, { $or: MN }] }, sort: [{ fieldName: `startDate`, order: `ASC` }, { fieldName: `id`, order: `ASC` }] } : e18 === Oa.UPCOMING ? { filter: { endDate: { $gt: t2 }, status: { $in: AN }, $or: MN }, sort: [{ fieldName: `startDate`, order: `ASC` }] } : { filter: { $and: [{ $or: [{ endDate: { $lte: t2 } }, { status: { $in: jN } }] }, { $or: MN }] }, sort: [{ fieldName: `startDate`, order: `DESC` }] };
12640
+ }
12641
+ var PN = (e18) => ({ withBookingAllowedActions: true, ...e18 !== Oa.UPCOMING && { withBookingAttendanceInfo: true }, withBookingConferencingDetails: true, withEcomOrder: true });
12642
+ var FN = (e18) => [...new Set(e18.map((e19) => e19.booking ? $j(e19.booking) : ``))].filter(Boolean);
12643
+ async function IN(e18, t2, n2) {
12644
+ let r2 = FN(e18);
12640
12645
  if (r2.length === 0) return e18;
12641
- let i2 = [], a2 = jN(t2, n2);
12646
+ let i2 = [], a2 = NN(t2, n2);
12642
12647
  for (let e19 = 0; e19 < r2.length; e19 += 100) {
12643
12648
  let n3;
12644
12649
  do {
12645
- let o3 = n3 ? { cursorPaging: { cursor: n3, limit: 100 } } : { ...a2, filter: { $and: [a2.filter, { "multiServiceBookingInfo.id": { $in: r2.slice(e19, e19 + 100) } }] }, cursorPaging: { limit: 100 } }, s3 = await DN.queryExtendedBookings(o3, MN(t2));
12650
+ let o3 = n3 ? { cursorPaging: { cursor: n3, limit: 100 } } : { ...a2, filter: { $and: [a2.filter, { "multiServiceBookingInfo.id": { $in: r2.slice(e19, e19 + 100) } }] }, cursorPaging: { limit: 100 } }, s3 = await kN.queryExtendedBookings(o3, PN(t2));
12646
12651
  i2.push(...s3.extendedBookings ?? []), n3 = s3.pagingMetadata?.cursors?.next ?? void 0;
12647
12652
  } while (n3);
12648
12653
  }
12649
12654
  let o2 = new Set(i2.map((e19) => e19.booking?._id));
12650
- if (e18.some((e19) => e19.booking && Zj(e19.booking) && !o2.has(e19.booking._id)) || i2.some((e19) => !e19.booking || !r2.includes(Zj(e19.booking)))) throw Error(`Complete booking groups could not be read`);
12655
+ if (e18.some((e19) => e19.booking && $j(e19.booking) && !o2.has(e19.booking._id)) || i2.some((e19) => !e19.booking || !r2.includes($j(e19.booking)))) throw Error(`Complete booking groups could not be read`);
12651
12656
  let s2 = new Map(e18.map((e19) => [e19.booking?._id, e19]));
12652
12657
  for (let e19 of i2) s2.set(e19.booking?._id, e19);
12653
12658
  return t2 === Oa.ALL ? [...s2.values()].sort((e19, t3) => {
@@ -12657,24 +12662,24 @@ async function PN(e18, t2, n2) {
12657
12662
  return r3 < i3 ? -1 : +(r3 > i3);
12658
12663
  }) : [...s2.values()];
12659
12664
  }
12660
- var FN = oj();
12661
- var IN = 5;
12662
- var LN = (e18, t2) => {
12665
+ var LN = cj();
12666
+ var RN = 5;
12667
+ var zN = (e18, t2) => {
12663
12668
  let n2 = [];
12664
12669
  for (let r2 = 0; r2 < e18.length; r2 += t2) n2.push(e18.slice(r2, r2 + t2));
12665
12670
  return n2;
12666
12671
  };
12667
- async function RN(e18) {
12672
+ async function BN(e18) {
12668
12673
  let t2 = /* @__PURE__ */ new Map();
12669
12674
  if (e18.length === 0) return t2;
12670
- let n2 = await FN.queryServicesByIds(e18).catch(() => void 0);
12671
- for (let e19 of n2?.items ?? []) e19._id && t2.set(e19._id, oM(e19));
12675
+ let n2 = await LN.queryServicesByIds(e18).catch(() => void 0);
12676
+ for (let e19 of n2?.items ?? []) e19._id && t2.set(e19._id, cM(e19));
12672
12677
  return t2;
12673
12678
  }
12674
- async function zN(e18) {
12679
+ async function VN(e18) {
12675
12680
  let t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Set();
12676
12681
  if (e18.length === 0) return { fees: t2, unreadable: n2 };
12677
- let r2 = LN(e18, 5), i2 = await Promise.all(r2.map((e19) => FN.listBookingFees(e19).catch(() => void 0)));
12682
+ let r2 = zN(e18, 5), i2 = await Promise.all(r2.map((e19) => LN.listBookingFees(e19).catch(() => void 0)));
12678
12683
  for (let [e19, a2] of i2.entries()) {
12679
12684
  if (!a2) {
12680
12685
  for (let t3 of r2[e19] ?? []) n2.add(t3);
@@ -12688,82 +12693,82 @@ async function zN(e18) {
12688
12693
  }
12689
12694
  return { fees: t2, unreadable: n2 };
12690
12695
  }
12691
- async function BN(e18) {
12696
+ async function HN(e18) {
12692
12697
  let t2 = /* @__PURE__ */ new Map();
12693
12698
  if (e18.length === 0) return t2;
12694
- let n2 = ((await FN.querySubmissionsByBookingIds(e18).catch(() => void 0))?.items ?? []).filter((e19) => !!(e19._id && e19.formId));
12699
+ let n2 = ((await LN.querySubmissionsByBookingIds(e18).catch(() => void 0))?.items ?? []).filter((e19) => !!(e19._id && e19.formId));
12695
12700
  if (n2.length === 0) return t2;
12696
- let r2 = [...new Set(n2.map((e19) => e19.formId))], i2 = await Promise.all(r2.map(async (e19) => [e19, await FN.getForm(e19).catch(() => void 0)])), a2 = new Map(i2.map(([e19, t3]) => [e19, t3?.name ?? ``]));
12701
+ let r2 = [...new Set(n2.map((e19) => e19.formId))], i2 = await Promise.all(r2.map(async (e19) => [e19, await LN.getForm(e19).catch(() => void 0)])), a2 = new Map(i2.map(([e19, t3]) => [e19, t3?.name ?? ``]));
12697
12702
  for (let e19 of n2) t2.set(e19._id, a2.get(e19.formId) ?? ``);
12698
12703
  return t2;
12699
12704
  }
12700
- async function VN(e18, t2) {
12701
- let n2 = Aa(), r2 = (await FN.getBookingsSettings().catch(() => void 0))?.displayTimeZone;
12705
+ async function UN(e18, t2) {
12706
+ let n2 = Aa(), r2 = (await LN.getBookingsSettings().catch(() => void 0))?.displayTimeZone;
12702
12707
  return { businessTimeZone: t2, memberTimeZone: n2, canChange: !!t2 && r2?.customerCanChange === true && Pa(t2, e18) !== Pa(n2, e18), initialTimeZone: t2 && r2?.basedOn === Tf.BUSINESS_TIME_ZONE ? t2 : n2 };
12703
12708
  }
12704
- async function HN(e18, t2, n2, r2, i2, a2 = [], o2 = [], s2 = (/* @__PURE__ */ new Date()).toISOString()) {
12709
+ async function WN(e18, t2, n2, r2, i2, a2 = [], o2 = [], s2 = (/* @__PURE__ */ new Date()).toISOString()) {
12705
12710
  let c2 = [...a2], l2 = i2, u2 = null, d2 = [], f2 = [];
12706
- for (let t3 = 0; t3 < IN; t3 += 1) {
12707
- let t4 = l2 ? { cursorPaging: { cursor: l2, limit: r2 } } : { ...jN(e18, s2), cursorPaging: { limit: r2 } }, n3 = await FN.queryExtendedBookings(t4, MN(e18));
12711
+ for (let t3 = 0; t3 < RN; t3 += 1) {
12712
+ let t4 = l2 ? { cursorPaging: { cursor: l2, limit: r2 } } : { ...NN(e18, s2), cursorPaging: { limit: r2 } }, n3 = await LN.queryExtendedBookings(t4, PN(e18));
12708
12713
  u2 = n3.pagingMetadata?.cursors?.next ?? null;
12709
12714
  let i3 = n3.extendedBookings ?? [];
12710
- if (c2.push(...i3.filter((e19) => !e19.booking || !o2.includes(Xj(e19.booking)))), { emitted: d2, deferred: f2 } = u2 && e18 !== Oa.ALL ? Qj(c2) : { emitted: c2, deferred: [] }, !u2 || d2.length > 0) break;
12715
+ if (c2.push(...i3.filter((e19) => !e19.booking || !o2.includes(Qj(e19.booking)))), { emitted: d2, deferred: f2 } = u2 && e18 !== Oa.ALL ? eM(c2) : { emitted: c2, deferred: [] }, !u2 || d2.length > 0) break;
12711
12716
  l2 = u2;
12712
12717
  }
12713
12718
  d2.length === 0 && (d2 = c2, f2 = []);
12714
12719
  let p2 = [];
12715
- if (e18 === Oa.ALL && u2) d2 = await PN(d2, e18, s2);
12720
+ if (e18 === Oa.ALL && u2) d2 = await IN(d2, e18, s2);
12716
12721
  else if (u2) {
12717
- let t3 = await PN(d2, e18, s2).catch(() => void 0);
12718
- t3 && (d2 = t3, p2 = NN(d2), f2 = f2.filter((e19) => !e19.booking || !p2.includes(Zj(e19.booking))));
12722
+ let t3 = await IN(d2, e18, s2).catch(() => void 0);
12723
+ t3 && (d2 = t3, p2 = FN(d2), f2 = f2.filter((e19) => !e19.booking || !p2.includes($j(e19.booking))));
12719
12724
  }
12720
- let { bookings: m2, submittedForms: h2 } = await UN(d2, e18, t2, n2);
12721
- return { bookings: m2, submittedForms: h2, cursor: u2, pendingEntries: f2, emittedGroupIds: e18 === Oa.ALL ? [.../* @__PURE__ */ new Set([...o2, ...d2.flatMap((e19) => e19.booking ? [Xj(e19.booking)] : [])])] : [.../* @__PURE__ */ new Set([...o2, ...p2])], cutoff: s2 };
12725
+ let { bookings: m2, submittedForms: h2 } = await GN(d2, e18, t2, n2);
12726
+ return { bookings: m2, submittedForms: h2, cursor: u2, pendingEntries: f2, emittedGroupIds: e18 === Oa.ALL ? [.../* @__PURE__ */ new Set([...o2, ...d2.flatMap((e19) => e19.booking ? [Qj(e19.booking)] : [])])] : [.../* @__PURE__ */ new Set([...o2, ...p2])], cutoff: s2 };
12722
12727
  }
12723
- async function UN(e18, t2, n2, r2) {
12724
- let i2 = PM(e18), a2 = [...new Set(e18.map((e19) => e19.booking?.formSubmissionId ?? ``).filter(Boolean))], o2 = RN(i2), s2 = BN(a2), c2 = t2 === Oa.UPCOMING ? e18 : t2 === Oa.ALL ? e18.filter((e19) => e19.booking?.endDate && new Date(e19.booking.endDate).getTime() > Date.now() && ON.includes(e19.booking.status)) : [], l2 = c2.map((e19) => e19.booking?._id ?? ``).filter(Boolean), [u2, d2, f2, p2, m2, h2, g2] = await Promise.all([o2, zN(l2), EN(c2), xN(e18), hN(e18), r2, wN(e18)]), _2 = { services: u2, cancellationFees: d2.fees, unreadableCancellationFees: d2.unreadable, multiServiceAllowedActions: f2, orderPaymentMethods: p2.methods, orderPlanCharges: p2.planCharges, bookingLinePrices: g2, submittedForms: /* @__PURE__ */ new Map(), courseSessions: m2, memberTimeZone: Aa(), locale: n2, businessAddress: h2 };
12725
- return { bookings: jM(e18, _2), submittedForms: s2.then((t3) => MM(e18, { ..._2, submittedForms: t3 })) };
12728
+ async function GN(e18, t2, n2, r2) {
12729
+ let i2 = IM(e18), a2 = [...new Set(e18.map((e19) => e19.booking?.formSubmissionId ?? ``).filter(Boolean))], o2 = BN(i2), s2 = HN(a2), c2 = t2 === Oa.UPCOMING ? e18 : t2 === Oa.ALL ? e18.filter((e19) => e19.booking?.endDate && new Date(e19.booking.endDate).getTime() > Date.now() && AN.includes(e19.booking.status)) : [], l2 = c2.map((e19) => e19.booking?._id ?? ``).filter(Boolean), [u2, d2, f2, p2, m2, h2, g2] = await Promise.all([o2, VN(l2), ON(c2), CN(e18), _N(e18), r2, EN(e18)]), _2 = { services: u2, cancellationFees: d2.fees, unreadableCancellationFees: d2.unreadable, multiServiceAllowedActions: f2, orderPaymentMethods: p2.methods, orderPlanCharges: p2.planCharges, bookingLinePrices: g2, submittedForms: /* @__PURE__ */ new Map(), courseSessions: m2, memberTimeZone: Aa(), locale: n2, businessAddress: h2 };
12730
+ return { bookings: NM(e18, _2), submittedForms: s2.then((t3) => PM(e18, { ..._2, submittedForms: t3 })) };
12726
12731
  }
12727
- async function WN(e18, t2, n2) {
12732
+ async function KN(e18, t2, n2) {
12728
12733
  let r2 = [];
12729
- for (let t3 of LN(e18, 100)) {
12734
+ for (let t3 of zN(e18, 100)) {
12730
12735
  let e19;
12731
12736
  do {
12732
- let n3 = await FN.queryExtendedBookings(e19 ? { cursorPaging: { cursor: e19, limit: 100 } } : { filter: { _id: { $in: t3 } }, cursorPaging: { limit: 100 } }, MN(Oa.ALL));
12737
+ let n3 = await LN.queryExtendedBookings(e19 ? { cursorPaging: { cursor: e19, limit: 100 } } : { filter: { _id: { $in: t3 } }, cursorPaging: { limit: 100 } }, PN(Oa.ALL));
12733
12738
  r2.push(...n3.extendedBookings ?? []), e19 = n3.pagingMetadata?.cursors?.next ?? void 0;
12734
12739
  } while (e19);
12735
12740
  }
12736
12741
  if (!e18.every((e19) => r2.some((t3) => t3.booking?._id === e19))) throw Error(`Canceled bookings could not all be read`);
12737
- let { bookings: i2, submittedForms: a2 } = await UN(r2, Oa.ALL, t2, n2);
12738
- return NM(i2, await a2);
12742
+ let { bookings: i2, submittedForms: a2 } = await GN(r2, Oa.ALL, t2, n2);
12743
+ return FM(i2, await a2);
12739
12744
  }
12740
- var GN = 600;
12741
- var KN = (e18) => Mj(e18?.uri, GN) || e18?.url || null;
12742
- var qN = 3e3;
12743
- function JN(e18) {
12745
+ var qN = 600;
12746
+ var JN = (e18) => Pj(e18?.uri, qN) || e18?.url || null;
12747
+ var YN = 3e3;
12748
+ function XN(e18) {
12744
12749
  let t2, n2 = new Promise((e19) => {
12745
- t2 = setTimeout(e19, qN);
12750
+ t2 = setTimeout(e19, YN);
12746
12751
  });
12747
12752
  return Promise.race([e18.decode(), n2]).finally(() => clearTimeout(t2));
12748
12753
  }
12749
- async function YN(e18) {
12754
+ async function ZN(e18) {
12750
12755
  if (typeof window > `u`) return;
12751
- let t2 = e18.flatMap((e19) => e19.multiServiceId !== null && e19.sessions.length > 1 ? e19.sessions.map((e20) => e20.serviceImage) : [e19.serviceImage]), n2 = new Set(t2.map(KN).filter((e19) => !!e19));
12756
+ let t2 = e18.flatMap((e19) => e19.multiServiceId !== null && e19.sessions.length > 1 ? e19.sessions.map((e20) => e20.serviceImage) : [e19.serviceImage]), n2 = new Set(t2.map(JN).filter((e19) => !!e19));
12752
12757
  await Promise.allSettled([...n2].map(async (e19) => {
12753
12758
  let t3 = new Image();
12754
- t3.src = e19, await JN(t3);
12759
+ t3.src = e19, await XN(t3);
12755
12760
  }));
12756
12761
  }
12757
- var XN = oj();
12758
- async function ZN() {
12759
- return (await XN.queryLocations().catch(() => void 0))?.businessLocations?.locations?.find((e18) => e18.business?.default === true)?.business?.address?.formatted?.trim() ?? ``;
12762
+ var QN = cj();
12763
+ async function $N() {
12764
+ return (await QN.queryLocations().catch(() => void 0))?.businessLocations?.locations?.find((e18) => e18.business?.default === true)?.business?.address?.formatted?.trim() ?? ``;
12760
12765
  }
12761
- var QN = /* @__PURE__ */ ((e18, t2 = e18) => ({ max: e18, defaultValue: t2, resolve: (n2) => typeof n2 == `number` && Number.isFinite(n2) ? Math.min(Math.max(Math.floor(n2), 1), e18) : t2 }))(10);
12762
- var $N = (e18, t2) => {
12766
+ var eP = /* @__PURE__ */ ((e18, t2 = e18) => ({ max: e18, defaultValue: t2, resolve: (n2) => typeof n2 == `number` && Number.isFinite(n2) ? Math.min(Math.max(Math.floor(n2), 1), e18) : t2 }))(10);
12767
+ var tP = (e18, t2) => {
12763
12768
  let n2 = (0, import_react.useCallback)((t3) => {
12764
12769
  t3.then((t4) => {
12765
12770
  t4.size > 0 && (0, import_react.startTransition)(() => {
12766
- e18((e19) => NM(e19, t4));
12771
+ e18((e19) => FM(e19, t4));
12767
12772
  });
12768
12773
  });
12769
12774
  }, [e18]);
@@ -12771,35 +12776,35 @@ var $N = (e18, t2) => {
12771
12776
  n2(t2);
12772
12777
  }, [t2, n2]), n2;
12773
12778
  };
12774
- function eP(e18, t2) {
12779
+ function nP(e18, t2) {
12775
12780
  let n2 = new Date(e18.startDate ?? 0).getTime() - new Date(t2.startDate ?? 0).getTime();
12776
12781
  if (n2) return n2;
12777
12782
  let r2 = e18.bookingIds[0] ?? ``, i2 = t2.bookingIds[0] ?? ``;
12778
12783
  return r2 < i2 ? -1 : +(r2 > i2);
12779
12784
  }
12780
- function tP(e18, t2, n2) {
12781
- return [...e18.filter((e19) => e19.groupId !== t2), ...n2].sort(eP);
12785
+ function rP(e18, t2, n2) {
12786
+ return [...e18.filter((e19) => e19.groupId !== t2), ...n2].sort(nP);
12782
12787
  }
12783
- function nP(e18, t2) {
12788
+ function iP(e18, t2) {
12784
12789
  return e18.map((e19) => e19.groupId === t2 ? { ...e19, status: ds.CANCELED, isOver: true, canBookAgain: e19.canBookAgainOnceCanceled, canCancel: false, canReschedule: false, canAddToCalendar: false, canViewServiceDetails: false, hasBookingPolicy: false, isAvailableOnline: false, videoConferenceLink: null, conferencingDetails: { guestUrl: null }, videoConferencePassword: ``, sessions: e19.sessions.map((e20) => ({ ...e20, canViewServiceDetails: false })) } : e19);
12785
12790
  }
12786
- var rP = (0, import_react.createContext)(null);
12787
- var iP = () => {
12788
- let e18 = (0, import_react.useContext)(rP);
12791
+ var aP = (0, import_react.createContext)(null);
12792
+ var oP = () => {
12793
+ let e18 = (0, import_react.useContext)(aP);
12789
12794
  if (!e18) throw Error(`useBookings must be used within MyBookingsContextProvider`);
12790
12795
  return e18;
12791
12796
  };
12792
- var aP = { businessTimeZone: ``, memberTimeZone: Aa(), canChange: false, initialTimeZone: Aa() };
12793
- var oP = (e18, t2) => {
12797
+ var sP = { businessTimeZone: ``, memberTimeZone: Aa(), canChange: false, initialTimeZone: Aa() };
12798
+ var cP = (e18, t2) => {
12794
12799
  let { t: n2 } = sa();
12795
12800
  return (0, import_react.useMemo)(() => e18.canChange ? [e18.businessTimeZone, e18.memberTimeZone].map((e19) => ({ value: e19, label: Ta(n2, Da.timeZoneFilter.option, { zone: Ma(e19, t2), offset: Na(e19, t2) }) })) : [], [e18, t2, n2]);
12796
12801
  };
12797
- var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2, locale: r2, timeframe: i2 = Oa.UPCOMING, pageSize: s2, children: p2 }) => {
12798
- let m2 = jn(e18), h2 = jn(t2), _2 = oP(h2, r2), { navigateTo: v2 } = (0, import_services_manager_react.useService)(da), y2 = Ia(), [b2, x2] = (0, import_react.useState)(i2), [S2, C2] = (0, import_react.useState)(() => m2.bookings), [ee2, w2] = (0, import_react.useState)(() => m2.cursor), [T2, te2] = (0, import_react.useState)(() => m2.pendingEntries), [ne2, re2] = (0, import_react.useState)(() => m2.emittedGroupIds), [ie2, ae2] = (0, import_react.useState)(() => m2.cutoff), [oe2, E2] = (0, import_react.useState)(false), [se2, ce2] = (0, import_react.useState)(false), [le2, ue2] = (0, import_react.useState)([]), [de2, fe2] = (0, import_react.useState)(null), pe2 = (0, import_react.useRef)(false), me2 = (0, import_react.useRef)(false), he2 = (0, import_react.useRef)(0), ge2 = (0, import_react.useRef)(0), _e2 = ge2.current, ve2 = sN((0, import_react.useMemo)(() => {
12802
+ var lP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2, locale: r2, timeframe: i2 = Oa.UPCOMING, pageSize: s2, children: p2 }) => {
12803
+ let m2 = jn(e18), h2 = jn(t2), _2 = cP(h2, r2), { navigateTo: v2 } = (0, import_services_manager_react.useService)(da), y2 = Ia(), [b2, x2] = (0, import_react.useState)(i2), [S2, C2] = (0, import_react.useState)(() => m2.bookings), [ee2, w2] = (0, import_react.useState)(() => m2.cursor), [T2, te2] = (0, import_react.useState)(() => m2.pendingEntries), [ne2, re2] = (0, import_react.useState)(() => m2.emittedGroupIds), [ie2, ae2] = (0, import_react.useState)(() => m2.cutoff), [oe2, E2] = (0, import_react.useState)(false), [se2, ce2] = (0, import_react.useState)(false), [le2, ue2] = (0, import_react.useState)([]), [de2, fe2] = (0, import_react.useState)(null), pe2 = (0, import_react.useRef)(false), me2 = (0, import_react.useRef)(false), he2 = (0, import_react.useRef)(0), ge2 = (0, import_react.useRef)(0), _e2 = ge2.current, ve2 = lN((0, import_react.useMemo)(() => {
12799
12804
  let e19 = S2.filter((e20) => !le2.includes(e20.groupId));
12800
- return de2 ? FM(e19, de2) : e19;
12801
- }, [S2, le2, de2])), ye2 = $N(C2, m2.submittedForms), be2 = io(i2, m2.bookings), xe2 = (0, import_react.useCallback)((e19) => (pe2.current = true, me2.current = true, he2.current += 1, x2(e19), E2(true), ce2(true), HN(e19, r2, n2, s2).then(async (t3) => {
12802
- be2(e19, t3.bookings), await YN(t3.bookings), ge2.current += 1, (0, import_react.startTransition)(() => {
12805
+ return de2 ? LM(e19, de2) : e19;
12806
+ }, [S2, le2, de2])), ye2 = tP(C2, m2.submittedForms), be2 = io(i2, m2.bookings), xe2 = (0, import_react.useCallback)((e19) => (pe2.current = true, me2.current = true, he2.current += 1, x2(e19), E2(true), ce2(true), WN(e19, r2, n2, s2).then(async (t3) => {
12807
+ be2(e19, t3.bookings), await ZN(t3.bookings), ge2.current += 1, (0, import_react.startTransition)(() => {
12803
12808
  C2(t3.bookings), w2(t3.cursor), te2(t3.pendingEntries), re2(t3.emittedGroupIds), ae2(t3.cutoff), ue2([]), ce2(false), E2(false);
12804
12809
  }), ye2(t3.submittedForms);
12805
12810
  }).catch(() => {
@@ -12816,17 +12821,17 @@ var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2
12816
12821
  b2 !== Oa.ALL && _e2 === ge2.current && ue2((t3) => [...t3, e19]);
12817
12822
  }, [b2, _e2]), Te2 = (0, import_react.useCallback)((e19) => {
12818
12823
  ue2((t3) => t3.filter((t4) => t4 !== e19));
12819
- }, []), { bookings: Ee2, themeAnchor: De2 } = nN(ve2, b2, we2, Te2, (0, import_react.useCallback)(async (e19) => {
12824
+ }, []), { bookings: Ee2, themeAnchor: De2 } = iN(ve2, b2, we2, Te2, (0, import_react.useCallback)(async (e19) => {
12820
12825
  if (b2 === Oa.ALL && _e2 === ge2.current) try {
12821
- let t3 = await WN(e19.bookingIds, r2, n2);
12822
- if (await YN(t3), _e2 !== ge2.current) return;
12826
+ let t3 = await KN(e19.bookingIds, r2, n2);
12827
+ if (await ZN(t3), _e2 !== ge2.current) return;
12823
12828
  (0, import_react.startTransition)(() => {
12824
- C2((n3) => tP(n3, e19.groupId, t3)), re2((t4) => [.../* @__PURE__ */ new Set([...t4, ...e19.bookingIds])]), Te2(e19.groupId);
12829
+ C2((n3) => rP(n3, e19.groupId, t3)), re2((t4) => [.../* @__PURE__ */ new Set([...t4, ...e19.bookingIds])]), Te2(e19.groupId);
12825
12830
  });
12826
12831
  } catch {
12827
12832
  if (_e2 !== ge2.current) return;
12828
12833
  (0, import_react.startTransition)(() => {
12829
- C2((t3) => nP(t3, e19.groupId)), Te2(e19.groupId);
12834
+ C2((t3) => iP(t3, e19.groupId)), Te2(e19.groupId);
12830
12835
  });
12831
12836
  }
12832
12837
  }, [b2, r2, n2, Te2, _e2])), Oe2 = (0, import_react.useRef)({ cursor: ee2, timeframe: b2, pendingEntries: T2, emittedGroupIds: ne2, cutoff: ie2 });
@@ -12840,13 +12845,13 @@ var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2
12840
12845
  let t3 = he2.current;
12841
12846
  E2(true);
12842
12847
  try {
12843
- let i3 = await HN(e19.timeframe, r2, n2, s2, e19.cursor, e19.pendingEntries, e19.emittedGroupIds, e19.cutoff);
12844
- if (await YN(i3.bookings), t3 !== he2.current) return;
12848
+ let i3 = await WN(e19.timeframe, r2, n2, s2, e19.cursor, e19.pendingEntries, e19.emittedGroupIds, e19.cutoff);
12849
+ if (await ZN(i3.bookings), t3 !== he2.current) return;
12845
12850
  await ke2((t4) => {
12846
12851
  (0, import_react.startTransition)(() => {
12847
12852
  C2((t5) => {
12848
12853
  let n3 = new Set(t5.flatMap((e20) => e20.bookingIds)), r3 = [...t5, ...e19.timeframe === Oa.ALL ? i3.bookings.filter((e20) => !e20.bookingIds.some((e21) => n3.has(e21))) : i3.bookings];
12849
- return e19.timeframe === Oa.ALL ? r3.sort(eP) : r3;
12854
+ return e19.timeframe === Oa.ALL ? r3.sort(nP) : r3;
12850
12855
  }), w2(i3.cursor), te2(i3.pendingEntries), re2((e20) => [.../* @__PURE__ */ new Set([...e20, ...i3.emittedGroupIds])]), E2(false), t4();
12851
12856
  });
12852
12857
  }), ye2(i3.submittedForms);
@@ -12854,27 +12859,27 @@ var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2
12854
12859
  } finally {
12855
12860
  t3 === he2.current && (pe2.current = false, E2(false));
12856
12861
  }
12857
- }, [r2, n2, s2, ke2, ye2]), je2 = aN(`bookingsServiceList`), Me2 = je2 ?? `./`, Ne2 = je2 !== null, Pe2 = (0, import_react.useCallback)(() => {
12862
+ }, [r2, n2, s2, ke2, ye2]), je2 = sN(`bookingsServiceList`), Me2 = je2 ?? `./`, Ne2 = je2 !== null, Pe2 = (0, import_react.useCallback)(() => {
12858
12863
  y2(Ja(b2)), v2({ href: Me2 });
12859
12864
  }, [v2, Me2, y2, b2]), Fe2 = (0, import_react.useMemo)(() => ({ bookings: se2 ? [] : Ee2, timeframe: b2, onTimeframeChange: Se2, businessTimeZone: h2.businessTimeZone, timeZone: de2 ?? h2.initialTimeZone, canChangeTimeZone: h2.canChange, timeZoneOptions: _2, onTimeZoneChange: Ce2, hasMore: ee2 !== null, isLoading: oe2, onLoadMore: Ae2, isEmpty: Ee2.length === 0 && !oe2 && ee2 === null, canBrowseServices: Ne2, onBrowseServices: Pe2 }), [Ee2, se2, b2, Se2, h2, de2, _2, Ce2, ee2, oe2, Ae2, Ne2, Pe2]);
12860
- return (0, import_jsx_runtime.jsxs)(rP.Provider, { value: Fe2, children: [De2, p2] });
12865
+ return (0, import_jsx_runtime.jsxs)(aP.Provider, { value: Fe2, children: [De2, p2] });
12861
12866
  };
12862
- var cP = ({ timeframe: e18 = Oa.UPCOMING, children: t2 }) => {
12867
+ var uP = ({ timeframe: e18 = Oa.UPCOMING, children: t2 }) => {
12863
12868
  let n2 = (0, import_react.useMemo)(() => ({ bookings: [], timeframe: e18, onTimeframeChange: () => void 0, businessTimeZone: ``, timeZone: Aa(), canChangeTimeZone: false, timeZoneOptions: [], onTimeZoneChange: () => void 0, hasMore: false, isLoading: true, onLoadMore: () => Promise.resolve(), isEmpty: false, canBrowseServices: false, onBrowseServices: () => void 0 }), [e18]);
12864
- return (0, import_jsx_runtime.jsx)(rP.Provider, { value: n2, children: t2 });
12869
+ return (0, import_jsx_runtime.jsx)(aP.Provider, { value: n2, children: t2 });
12865
12870
  };
12866
- var lP = ({ timeframe: e18 = Oa.UPCOMING, pageSize: t2, children: r2 }) => {
12867
- let i2 = QN.resolve(t2), o2 = Ca(), s2 = zM(), { timeZone: l2 } = (0, import_services_manager_react.useService)(ua);
12871
+ var dP = ({ timeframe: e18 = Oa.UPCOMING, pageSize: t2, children: r2 }) => {
12872
+ let i2 = eP.resolve(t2), o2 = Ca(), s2 = VM(), { timeZone: l2 } = (0, import_services_manager_react.useService)(ua);
12868
12873
  ro();
12869
12874
  let [u2] = (0, import_react.useState)({ timeframe: e18, locale: s2, businessTimeZone: l2, pageSize: i2 }), [p2, m2] = (0, import_react.useState)(null);
12870
12875
  return (0, import_react.useEffect)(() => {
12871
- let e19 = ZN(), t3 = HN(u2.timeframe, u2.locale, e19, u2.pageSize).then(async (e20) => (await YN(e20.bookings), e20)), n2 = VN(u2.locale, u2.businessTimeZone ?? ``).catch(() => aP);
12876
+ let e19 = $N(), t3 = WN(u2.timeframe, u2.locale, e19, u2.pageSize).then(async (e20) => (await ZN(e20.bookings), e20)), n2 = UN(u2.locale, u2.businessTimeZone ?? ``).catch(() => sP);
12872
12877
  (0, import_react.startTransition)(() => {
12873
12878
  m2({ timeframe: u2.timeframe, locale: u2.locale, initialPromise: t3, businessAddressPromise: e19, timeZonePromise: n2 });
12874
12879
  });
12875
- }, [u2]), (0, import_jsx_runtime.jsx)(ca, { i18n: o2, children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(cP, { timeframe: e18, children: r2 }), children: p2 ? (0, import_jsx_runtime.jsx)(sP, { ...p2, pageSize: i2, children: r2 }) : (0, import_jsx_runtime.jsx)(cP, { timeframe: e18, children: r2 }) }) });
12880
+ }, [u2]), (0, import_jsx_runtime.jsx)(ca, { i18n: o2, children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(uP, { timeframe: e18, children: r2 }), children: p2 ? (0, import_jsx_runtime.jsx)(lP, { ...p2, pageSize: i2, children: r2 }) : (0, import_jsx_runtime.jsx)(uP, { timeframe: e18, children: r2 }) }) });
12876
12881
  };
12877
- var uP = Dn(`c7590ff8-2e98-4416-9843-8ef7f8951155`);
12882
+ var fP = Dn(`c7590ff8-2e98-4416-9843-8ef7f8951155`);
12878
12883
  // Annotate the CommonJS export names for ESM import in node:
12879
12884
  0 && (module.exports = {
12880
12885
  MyBookingsContext,